From: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
To: Colin Cross <ccross@android.com>
Cc: Len Brown <lenb@kernel.org>, Len Brown <len.brown@intel.com>,
Kevin Hilman <khilman@ti.com>,
Santosh Shilimkar <santosh.shilimkar@ti.com>,
"Rafael J. Wysocki" <rjw@sisk.pl>,
linux-kernel@vger.kernel.org,
Linux PM mailing list <linux-pm@vger.kernel.org>
Subject: Re: [PATCH] cpuidle: coupled: fix sleeping while atomic in cpu notifier
Date: Wed, 01 Aug 2012 11:29:50 +0530 [thread overview]
Message-ID: <5018C5D6.4000304@linux.vnet.ibm.com> (raw)
In-Reply-To: <CAMbhsRT_h=dTfUVRmMUj5Bz7ZqcJ7UA2svwNP9CNa9=f=cL4+Q@mail.gmail.com>
On 07/31/2012 11:57 PM, Colin Cross wrote:
> On Tue, Jul 31, 2012 at 8:43 AM, Srivatsa S. Bhat
> <srivatsa.bhat@linux.vnet.ibm.com> wrote:
>> On 07/26/2012 02:50 AM, Colin Cross wrote:
>>> The cpu hotplug notifier gets called in both atomic and non-atomic
>>> contexts, it is not always safe to lock a mutex. Filter out all events
>>> except the six necessary ones, which are all sleepable, before taking
>>> the mutex.
>>>
>>> Signed-off-by: Colin Cross <ccross@android.com>
>>> ---
>>> drivers/cpuidle/coupled.c | 12 ++++++++++++
>>> 1 files changed, 12 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/drivers/cpuidle/coupled.c b/drivers/cpuidle/coupled.c
>>> index 2c9bf26..c24dda0 100644
>>> --- a/drivers/cpuidle/coupled.c
>>> +++ b/drivers/cpuidle/coupled.c
>>> @@ -678,6 +678,18 @@ static int cpuidle_coupled_cpu_notify(struct notifier_block *nb,
>>> int cpu = (unsigned long)hcpu;
>>> struct cpuidle_device *dev;
>>>
>>> + switch (action & ~CPU_TASKS_FROZEN) {
>>> + case CPU_UP_PREPARE:
>>> + case CPU_DOWN_PREPARE:
>>> + case CPU_ONLINE:
>>> + case CPU_DEAD:
>>> + case CPU_UP_CANCELED:
>>> + case CPU_DOWN_FAILED:
>>> + break;
>>> + default:
>>> + return NOTIFY_OK;
>>> + }
>>> +
>>
>> Instead, wouldn't it be better to have case statements for the
>> 2 cases that imply atomic context and return immediately?
>>
>> Something like:
>> switch (action & ~CPU_TASKS_FROZEN) {
>> case CPU_STARTING:
>> case CPU_DYING:
>> return NOTIFY_OK;
>> }
>
> No, because then it would need updating whenever a new notification
> event was added.
>
Hmm.. Fair enough.
Reviewed-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Regards,
Srivatsa S. Bhat
next prev parent reply other threads:[~2012-08-01 6:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-25 21:20 [PATCH] cpuidle: coupled: fix sleeping while atomic in cpu notifier Colin Cross
2012-07-26 7:25 ` Shilimkar, Santosh
2012-07-26 22:54 ` Shilimkar, Santosh
2012-07-26 19:55 ` Rafael J. Wysocki
2012-07-26 19:51 ` Colin Cross
2012-07-26 20:15 ` Rafael J. Wysocki
2012-07-26 20:16 ` Rafael J. Wysocki
2012-07-31 15:43 ` Srivatsa S. Bhat
2012-07-31 18:27 ` Colin Cross
2012-08-01 5:59 ` Srivatsa S. Bhat [this message]
2012-08-07 22:15 ` Rafael J. Wysocki
2012-08-08 0:54 ` Colin Cross
2012-08-15 20:16 ` Rafael J. Wysocki
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=5018C5D6.4000304@linux.vnet.ibm.com \
--to=srivatsa.bhat@linux.vnet.ibm.com \
--cc=ccross@android.com \
--cc=khilman@ti.com \
--cc=len.brown@intel.com \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@sisk.pl \
--cc=santosh.shilimkar@ti.com \
/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