From: Oleg Nesterov <oleg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Henrique de Moraes Holschuh
<hmh-N3TV7GIv+o9fyO9Q7EP/yw@public.gmane.org>
Cc: Aaron Lu <aaron.lu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
ibm-acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
Mandeep Singh Baines
<msb-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
ibm-acpi-N3TV7GIv+o9fyO9Q7EP/yw@public.gmane.org,
Linux Kernel Mailing List
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
platform-driver-x86-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Andrew Morton
<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
Subject: [PATCH 0/1] thinkpad-acpi: kill hotkey_thread_mutex
Date: Thu, 7 Mar 2013 18:53:05 +0100 [thread overview]
Message-ID: <20130307175305.GA15631@redhat.com> (raw)
In-Reply-To: <20130306233232.GA12645-ZGHd14iZgfaRjzvQDGKj+xxZW9W5cXbT@public.gmane.org>
On 03/06, Henrique de Moraes Holschuh wrote:
>
> On Wed, 06 Mar 2013, Oleg Nesterov wrote:
> >
> > 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);
> > }
> > }
> >
> > And I simply do not understand the comment. This thread has already exited
> > when kthread_stop() returns (OK, it can be running do_exit() paths but this
> > doesn't matter). So this mutex_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_mutex can 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.
> 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
next prev parent reply other threads:[~2013-03-07 17:53 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-04 19:55 [REGRESSION] [3.9-rc1] BUG: ktpacpi_nvramd/446 still has locks held! Maciej Rutecki
2013-03-05 7:28 ` Aaron Lu
2013-03-05 16:04 ` Mandeep Singh Baines
2013-03-05 17:34 ` [PATCH] thinkpad-acpi: fix potential suspend blocking issue Mandeep Singh Baines
2013-03-05 17:48 ` Oleg Nesterov
2013-03-05 17:59 ` Mandeep Singh Baines
2013-03-05 18:05 ` Oleg Nesterov
2013-03-05 20:55 ` Mandeep Singh Baines
2013-03-05 23:26 ` Henrique de Moraes Holschuh
2013-03-06 15:44 ` Oleg Nesterov
2013-03-06 23:32 ` Henrique de Moraes Holschuh
[not found] ` <20130306233232.GA12645-ZGHd14iZgfaRjzvQDGKj+xxZW9W5cXbT@public.gmane.org>
2013-03-07 17:53 ` Oleg Nesterov [this message]
2013-03-07 17:53 ` [PATCH 1/1] thinkpad-acpi: kill hotkey_thread_mutex Oleg Nesterov
2013-03-07 18:42 ` Mandeep Singh Baines
[not found] ` <CACBanvqP0jx_d-LtV5+fRD7M698M_b6j0Sv=v0uoTBpjEusQCw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-09 21:34 ` Henrique de Moraes Holschuh
2013-03-26 13:14 ` Rafael J. Wysocki
2013-03-26 13:09 ` Oleg Nesterov
2013-03-26 13:50 ` Rafael J. Wysocki
2013-03-05 19:18 ` [PATCH] thinkpad-acpi: fix potential suspend blocking issue Maciej Rutecki
2013-03-05 22:18 ` Andrew Morton
2013-03-06 15:50 ` Oleg Nesterov
2013-03-06 20:18 ` Artem Savkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130307175305.GA15631@redhat.com \
--to=oleg-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
--cc=aaron.lu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
--cc=hmh-N3TV7GIv+o9fyO9Q7EP/yw@public.gmane.org \
--cc=ibm-acpi-N3TV7GIv+o9fyO9Q7EP/yw@public.gmane.org \
--cc=ibm-acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=msb-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=platform-driver-x86-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox