• Navdeep Parhar's avatar
    cxgbe(4): Fix bad races between sysctl and driver detach. · a727d953
    Navdeep Parhar authored
    The default sysctl context setup by newbus for a device is eventually
    freed by device_sysctl_fini, which runs after the device driver's detach
    routine.  sysctl nodes associated with this context must not use any
    resources (like driver locks, hardware access, counters, etc.) that are
    released by driver detach.
    There are a lot of sysctl nodes like this in cxgbe(4) and the fix is to
    hang them off a context that is explicitly freed by the driver before it
    releases any resource that might be used by a sysctl.
    This fixes panics when running "sysctl dev.t6nex dev.cc" in a tight loop
    and loading/unloading the driver in parallel.
    Reported by:	Suhas Lokesha
    MFC after:	1 week
    Sponsored by:	Chelsio Communications