Re: [PATCH][USBATM]: convert heavy init dances to kthread API

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Duncan Sands
Date: Thursday, February 7, 2008 - 2:57 am

Hi Pavel,


I don't see why it helps.  The race I mentioned occurs when the kthread creating thread
runs too fast compared to the kthread.  Let C (creator) be the thread running
usbatm_heavy_init, and K (kthread) be the created kthread.  When C calls wake_up_process,
thread K starts running, however on an SMP system C may also be running.  Now suppose
that for some reason K takes a long time to execute the command "allow_signal(SIGTERM);",
but that C runs very fast and immediately executes the disconnect callback, and sends the
signal to K before K manages to execute allow_signal.  This is the race, and it can only
be fixed by making C run slower (thus the completion).  Of course this is fantastically
unlikely which is why I described it as tiny, but as far as I can see it is a theoretical
possibility.  I don't see that wake_up_process fixes it, it just makes it even less likely.


I think your patch should go in, since I'm not likely to ever implement the
scheme I suggested - I don't use this hardware anymore and have lost interest
in the driver.

Best wishes,

Duncan.
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH][USBATM]: convert heavy init dances to kthread API, Pavel Emelyanov, (Wed Feb 6, 9:15 am)
Re: [PATCH][USBATM]: convert heavy init dances to kthread API, Duncan Sands, (Thu Feb 7, 2:57 am)