2012-08-07 22:09:38

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH] cpuidle: coupled: fix sleeping while atomic in cpu notifier

On Wednesday, July 25, 2012, 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 <[email protected]>

Has this been applied already?

Rafael


> ---
> 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;
> + }
> +
> mutex_lock(&cpuidle_lock);
>
> dev = per_cpu(cpuidle_devices, cpu);
>


2012-08-08 00:54:27

by Colin Cross

[permalink] [raw]
Subject: Re: [PATCH] cpuidle: coupled: fix sleeping while atomic in cpu notifier

On Tue, Aug 7, 2012 at 3:15 PM, Rafael J. Wysocki <[email protected]> wrote:
> On Wednesday, July 25, 2012, 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 <[email protected]>
>
> Has this been applied already?

It's not in Linus' tree, and I haven't heard anything from Len.

2012-08-15 20:10:18

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH] cpuidle: coupled: fix sleeping while atomic in cpu notifier

On Wednesday, August 08, 2012, Colin Cross wrote:
> On Tue, Aug 7, 2012 at 3:15 PM, Rafael J. Wysocki <[email protected]> wrote:
> > On Wednesday, July 25, 2012, 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 <[email protected]>
> >
> > Has this been applied already?
>
> It's not in Linus' tree, and I haven't heard anything from Len.

Len appears to be unavailable.

I'll put it into the linux-next branch of the linux-pm.git tree and will
push it to Linus for -rc3 if Len doesn't show up till then.

Thanks,
Rafael