Re: [PATCH] drivers: base: power: Fix GFP_KERNEL in spinlock context

From: shrikant
Date: Sat Dec 16 2017 - 03:21:20 EST




On Tuesday 12 December 2017 10:25 PM, Rafael J. Wysocki wrote:
> On Tue, Dec 12, 2017 at 2:45 PM, <shrikant.maurya@xxxxxxxxxxxx> wrote:
>> From: Shrikant Maurya <shrikant.maurya@xxxxxxxxxxxx>
>>
>> As reported by Jia-Ju Bai (https://lkml.org/lkml/2017/12/11/872):
>> API's are using GFP_KERNEL to allocate memory which may sleep.
>>
>> To ensure atomicity such allocations must be avoided in critical
>> sections under spinlock.
>
> That's right.
>
> Which is why wakeup_source_create() should never be called under a spinlock.

Yes.

Better approach is, to move the call to device_init_wakeup() before the spinlock.

>
> Are you aware of any place that happens in the mainline kernel?

No.

>
> Thanks,
> Rafael
>

Thank you Rafeal.
--
Shrikant
techveda.org