thinkpad-acpi: kill hotkey_thread_mutex
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest1 patch 5 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/1 | thinkpad-acpi: kill hotkey_thread_mutexdrivers/ | +0 | 5 replies |
Reviews trailers per patch
The patch has a Reviewed-by or Acked-by.
| Patch | Mandeep Singh Baines | Henrique de Moraes Holschuh |
|---|---|---|
| 1/1 | R-b | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 0/1] thinkpad-acpi: kill hotkey_thread_mutex
Quoted 14 lines · Henrique de Moraes Holschuh
Quoted 12 lines · Oleg Nesterov
static void hotkey_poll_stop_sync(void) { if (tpacpi_hotkey_task) { kthread_stop(tpacpi_hotkey_task); tpacpi_hotkey_task = NULL; mutex_lock(&hotkey_thread_mutex); /* at this point, the thread did exit */ mutex_unlock(&hotkey_thread_mutex); } }
Quoted 7 lines
Quoted 3 lines
And I simply do not understand the comment. This thread has already exited when
kthread_stop()returns (OK, it can be runningdo_exit()paths but this doesn't matter). So thismutex_lock()buys nothing afaics.It was added due to an oops, waaaaay back then. If it is not needed anymore, and there is zero chance of the kthread still being active when
hotkey_poll_stop_sync()ends,hotkey_thread_mutexcan be simply removed.
Well, there could be another bug. Say, hotkey_poll_stop_sync() can block on hotkey_thread_mutex if another thread was started. But at first glance this can't happen (hotkey_mutex), and even _if_ it can this needs another fix.
Quoted 1 line
Looks like it, if the current semanthics of
ktread_stop()are syncronous.
IIRC, it always was... But at least currently it is certainly syncronous. kthread_stop(t) does wait_for_completion(t->vfork_done), complete(vfork_done) can't happen unless this task calls do_exit().
Hmm. I just noticed that the recent changes in kthread_stop() are not correct... But this is offtopic and doesn't affect thinkpad_acpi.c, I'll write another email later.
So, what do you think about (UNTESTED) 1/1 ?
Oleg.
------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the endpoint security space. For insight on selecting the right partner to tackle endpoint security challenges, access the full report.
http://p.sf.net/sfu/symantec-dev2dev