public inbox for platform-driver-x86@vger.kernel.org
 help / color / mirror / Atom feed
From: Mandeep Singh Baines <msb@chromium.org>
To: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org,
	ibm-acpi@hmh.eng.br, ibm-acpi-devel@lists.sourceforge.net,
	platform-driver-x86@vger.kernel.org
Cc: Mandeep Singh Baines <msb@chromium.org>,
	Aaron Lu <aaron.lu@intel.com>,
	Henrique de Moraes Holschuh <hmh@hmh.eng.br>,
	Tejun Heo <tj@kernel.org>, Oleg Nesterov <oleg@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH] thinkpad-acpi: fix potential suspend blocking issue
Date: Tue,  5 Mar 2013 09:34:43 -0800	[thread overview]
Message-ID: <1362504883-9180-1-git-send-email-msb@chromium.org> (raw)
In-Reply-To: <201303042055.38040.maciej.rutecki@gmail.com>

Fixes the following lockdep error:

[ BUG: ktpacpi_nvramd/446 still has locks held! ]

hotkey_kthread() calls set_freezable() after acquiring the
hotkey_kthread_mutex(). set_freezable() calls try_to_freeze().
This could block suspend if we were to freeze at this point
and another task were to block on the mutex, potentially via
writing to one of the sysfs attrs. This race is unlikely but
can be easily fixed by moving the set_freezable() call.

Reported-by: Maciej Rutecki <maciej.rutecki@gmail.com>
Signed-off-by: Mandeep Singh Baines <msb@chromium.org>
CC: Aaron Lu <aaron.lu@intel.com>
CC: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
CC: Tejun Heo <tj@kernel.org>
CC: Oleg Nesterov <oleg@redhat.com>
CC: Andrew Morton <akpm@linux-foundation.org>
---
 drivers/platform/x86/thinkpad_acpi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 9a90756..69870a841 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -2462,13 +2462,13 @@ static int hotkey_kthread(void *data)
 	unsigned int poll_freq;
 	bool was_frozen;
 
+	set_freezable();
+
 	mutex_lock(&hotkey_thread_mutex);
 
 	if (tpacpi_lifecycle == TPACPI_LIFE_EXITING)
 		goto exit;
 
-	set_freezable();
-
 	so = 0;
 	si = 1;
 	t = 0;
-- 
1.7.12.4

  parent reply	other threads:[~2013-03-05 17:34 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 ` Mandeep Singh Baines [this message]
2013-03-05 17:48   ` [PATCH] thinkpad-acpi: fix potential suspend blocking issue 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                   ` [PATCH 0/1] thinkpad-acpi: kill hotkey_thread_mutex Oleg Nesterov
2013-03-07 17:53                     ` [PATCH 1/1] " 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=1362504883-9180-1-git-send-email-msb@chromium.org \
    --to=msb@chromium.org \
    --cc=aaron.lu@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=hmh@hmh.eng.br \
    --cc=ibm-acpi-devel@lists.sourceforge.net \
    --cc=ibm-acpi@hmh.eng.br \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=tj@kernel.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