[PATCH 2/2] ath10k: make core registering async

Michal Kazior michal.kazior at tieto.com
Mon Jun 23 05:17:43 PDT 2014

On 23 June 2014 13:51, Johannes Berg <johannes at sipsolutions.net> wrote:
> Hi,
>>  [worker]
>>  complete_all()
>>  device_release_driver()
>>  dev_lock()
>>  {already held, yield}
>>  [syscall]
>>  free(internal structures)
>>  dev_unlock()
>>  return
>>  [worker]
>>  {woken up, but dev->driver == NULL so no callbacks}
>>  dev_unlock()
>>  return
>> The driver code section may not be reachable anymore upon worker
>> returning from the device_release_driver() call, right? Also since
>> ath10k uses an internal worker it also means the work_struct would be
>> already freed by the syscall flow (i.e. worker would run after driver
>> has supposedly been cleaned up..). Even if ath10k was to use
>> request_firmware_nowait(), which allocates a temporary work_struct,
>> the unreachable code section still remains a problem.
>> Or maybe this isn't really a problem and/or I'm missing something?
> Yeah, hmm, this looks like a problem. I guess we didn't really consider
> module unload in such detail ...
> I guess this would crash upon return from device_release_driver()? I
> guess if that's the last thing then maybe we'd actually get a tail-call
> optimisation, but we don't want to rely on that of course!
> Seems like to fix it we just need to get a module reference though? Can
> a module put() itself though? Hmmm.

It seems some drivers use module_put(THIS_MODULE) and
__module_get(THIS_MODULE), e.g. tun/tap driver.

But does this bump up the module refcount in such a way that an
in-progress rmmod will wait/block until the refcount reaches 0?


More information about the ath10k mailing list