kldunload hangs on FreeBSD with camcontrol debug on

Desai, Kashyap Kashyap.Desai at lsi.com
Thu Jan 5 15:22:40 UTC 2012


While doing some sanity test on "mps" driver, I found kldunload hangs in below condition.

Case-1
1. Connect LSI 2008 controller(any SAS2 card). Load there mps driver and detect the controller.
2. unload driver/load driver in loop. There will not be any problem.

Case-2 
Run above Case-1 with below settings.
"camcontorl debug -IT <bus>"

A moment I enable CAM debug level -I and -T, kldunload always hangs on "sim->refcount"

Here is relavent output for reference.

Jan  5 06:42:08 dhcp-135-24-192-146 kernel: mpslsi30: mps_detach_sas:754 ref count 2
Jan  5 06:42:08 dhcp-135-24-192-146 kernel: mpslsi30: path ID 6
Jan  5 06:42:08 dhcp-135-24-192-146 kernel: (noperiph:mpslsi30:0:-1:-1): xpt_compile_path
Jan  5 06:42:08 dhcp-135-24-192-146 kernel: (noperiph:mpslsi30:0:-1:-1): xpt_async
Jan  5 06:42:08 dhcp-135-24-192-146 kernel: (noperiph:mpslsi30:0:-1:-1): xpt_async
Jan  5 06:42:08 dhcp-135-24-192-146 kernel: (noperiph:mpslsi30:0:-1:-1): xpt_release_path
Jan  5 06:42:08 dhcp-135-24-192-146 kernel: mpslsi30: mps_detach_sas:757 ref count 2


I have added few prints in detach routine (mps_detach_sas) as below.

    if (sassc->sim != NULL) {
        mps_dprint(sc, MPS_INFO, "%s:%d ref count %d\n", __func__,__LINE__,sassc->sim->refcount);
        mps_dprint(sc, MPS_INFO, "path ID %d\n",cam_sim_path(sassc->sim));
        xpt_bus_deregister(cam_sim_path(sassc->sim));
        mps_dprint(sc, MPS_INFO, "%s:%d ref count %d\n", __func__,__LINE__,sassc->sim->refcount);
        cam_sim_free(sassc->sim, FALSE);
    }


Before entering into " xpt_bus_deregister" sim->refcount is 2 and which never goes to 0. And eventually Driver unloading hangs at
Cam_sim_free() at below location....

error = msleep(sim, sim->mtx, PRIBIO, "simfree", 0);


Any idea about this issue ?


Regards, Kashyap


More information about the freebsd-scsi mailing list