public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] cpufreq_opp.c: Fixed the __might_sleep by changing GFP_KERNEL to GFP_ATOMIC.
       [not found] <1407183283-21921-1-git-send-email-moon.linux@yahoo.com>
@ 2014-08-05  6:17 ` Viresh Kumar
  2014-08-05 23:35   ` Rafael J. Wysocki
  0 siblings, 1 reply; 5+ messages in thread
From: Viresh Kumar @ 2014-08-05  6:17 UTC (permalink / raw)
  To: Anand Moon, Stephen Boyd
  Cc: Rafael J. Wysocki, linux-pm@vger.kernel.org,
	Linux Kernel Mailing List

On 5 August 2014 01:44, Anand Moon <moon.linux@yahoo.com> wrote:
> Note: Generally, you should use GFP_ATOMIC in interrupt context
> or in process context where it is not allowed to sleep, and GFP_KERNEL elsewhere.
>
> This changes fixes bellow bug on ARM imx6
>
> Signed-off-by: Anand Moon <moon.linux@yahoo.com>

This should have come after the kernel dump.

> [    7.331858]
> [    7.333369] ===============================
> [    7.337633] [ INFO: suspicious RCU usage. ]
> [    7.341834] 3.16.0-armv7-x2 #1 Not tainted
> [    7.346506] -------------------------------
> [    7.350709] include/linux/rcupdate.h:513 Illegal context switch in RCU read-side critical section!
> [    7.359735]
> [    7.359735] other info that might help us debug this:
> [    7.359735]
> [    7.367932]
> [    7.367932] rcu_scheduler_active = 1, debug_locks = 1
> [    7.374477] 2 locks held by swapper/0/1:
> [    7.378491]  #0:  (&dev->mutex){......}, at: [<c06b273c>] device_attach+0x28/0x9c
> [    7.386212]  #1:  (rcu_read_lock){......}, at: [<c083cfc8>] dev_pm_opp_init_cpufreq_table+0x0/0x23c
> [    7.396284]
> [    7.396284] stack backtrace:
> [    7.400666] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.16.0-armv7-x2 #1
> [    7.407668] [<c0019234>] (unwind_backtrace) from [<c0014218>] (show_stack+0x20/0x24)
> [    7.415473] [<c0014218>] (show_stack) from [<c0a5b8a0>] (dump_stack+0x9c/0xbc)
> [    7.422818] [<c0a5b8a0>] (dump_stack) from [<c00b4474>] (lockdep_rcu_suspicious+0xdc/0x110)
> [    7.431298] [<c00b4474>] (lockdep_rcu_suspicious) from [<c008d214>] (__might_sleep+0x204/0x240)
> [    7.440106] [<c008d214>] (__might_sleep) from [<c01c8090>] (__kmalloc+0x2a8/0x328)
> [    7.447801] [<c01c8090>] (__kmalloc) from [<c083d06c>] (dev_pm_opp_init_cpufreq_table+0xa4/0x23c)
> [    7.456780] [<c083d06c>] (dev_pm_opp_init_cpufreq_table) from [<c0841bb0>] (imx6q_cpufreq_probe+0x160/0x750)
> [    7.466734] [<c0841bb0>] (imx6q_cpufreq_probe) from [<c06b4b84>] (platform_drv_probe+0x28/0x5c)
> [    7.475456] [<c06b4b84>] (platform_drv_probe) from [<c06b2960>] (driver_probe_device+0x14c/0x39c)
> [    7.484457] [<c06b2960>] (driver_probe_device) from [<c06b2c00>] (__device_attach+0x50/0x54)
> [    7.492986] [<c06b2c00>] (__device_attach) from [<c06b09e0>] (bus_for_each_drv+0x70/0xa4)
> [    7.501291] [<c06b09e0>] (bus_for_each_drv) from [<c06b279c>] (device_attach+0x88/0x9c)
> [    7.509388] [<c06b279c>] (device_attach) from [<c06b1c08>] (bus_probe_device+0x98/0xbc)
> [    7.517600] [<c06b1c08>] (bus_probe_device) from [<c06afac0>] (device_add+0x4a8/0x5a0)
> [    7.525679] [<c06afac0>] (device_add) from [<c06b487c>] (platform_device_add+0xd4/0x26c)
> [    7.533974] [<c06b487c>] (platform_device_add) from [<c06b5144>] (platform_device_register+0x30/0x34)
> [    7.543404] [<c06b5144>] (platform_device_register) from [<c0f0dcb4>] (imx6q_init_late+0x17c/0x18c)
> [    7.552609] [<c0f0dcb4>] (imx6q_init_late) from [<c0f00b8c>] (init_machine_late+0x28/0x30)
> [    7.560991] [<c0f00b8c>] (init_machine_late) from [<c0008bb0>] (do_one_initcall+0xec/0x224)
> [    7.569538] [<c0008bb0>] (do_one_initcall) from [<c0efef00>] (kernel_init_freeable+0x208/0x2ac)
> [    7.578448] [<c0efef00>] (kernel_init_freeable) from [<c0a557ac>] (kernel_init+0x1c/0xf8)
> [    7.586764] [<c0a557ac>] (kernel_init) from [<c000fce8>] (ret_from_fork+0x14/0x20)
> ---
>  drivers/cpufreq/cpufreq_opp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cpufreq/cpufreq_opp.c b/drivers/cpufreq/cpufreq_opp.c
> index c0c6f4a..d5b5625 100644
> --- a/drivers/cpufreq/cpufreq_opp.c
> +++ b/drivers/cpufreq/cpufreq_opp.c
> @@ -60,7 +60,7 @@ int dev_pm_opp_init_cpufreq_table(struct device *dev,
>                 goto out;
>         }
>
> -       freq_table = kzalloc(sizeof(*freq_table) * (max_opps + 1), GFP_KERNEL);
> +       freq_table = kzalloc(sizeof(*freq_table) * (max_opps + 1), GFP_ATOMIC);
>         if (!freq_table) {
>                 ret = -ENOMEM;
>                 goto out;

Please see this:

https://lkml.org/lkml/2014/7/16/815

@Rafael: Have you already applied patch from above link?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] cpufreq_opp.c: Fixed the __might_sleep by changing GFP_KERNEL to GFP_ATOMIC.
  2014-08-05  6:17 ` [PATCH] cpufreq_opp.c: Fixed the __might_sleep by changing GFP_KERNEL to GFP_ATOMIC Viresh Kumar
@ 2014-08-05 23:35   ` Rafael J. Wysocki
  2014-08-06  5:08     ` Viresh Kumar
  0 siblings, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2014-08-05 23:35 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Anand Moon, Stephen Boyd, linux-pm@vger.kernel.org,
	Linux Kernel Mailing List

On Tuesday, August 05, 2014 11:47:50 AM Viresh Kumar wrote:
> On 5 August 2014 01:44, Anand Moon <moon.linux@yahoo.com> wrote:
> > Note: Generally, you should use GFP_ATOMIC in interrupt context
> > or in process context where it is not allowed to sleep, and GFP_KERNEL elsewhere.
> >
> > This changes fixes bellow bug on ARM imx6
> >
> > Signed-off-by: Anand Moon <moon.linux@yahoo.com>
> 
> This should have come after the kernel dump.
> 
> > [    7.331858]
> > [    7.333369] ===============================
> > [    7.337633] [ INFO: suspicious RCU usage. ]
> > [    7.341834] 3.16.0-armv7-x2 #1 Not tainted
> > [    7.346506] -------------------------------
> > [    7.350709] include/linux/rcupdate.h:513 Illegal context switch in RCU read-side critical section!
> > [    7.359735]
> > [    7.359735] other info that might help us debug this:
> > [    7.359735]
> > [    7.367932]
> > [    7.367932] rcu_scheduler_active = 1, debug_locks = 1
> > [    7.374477] 2 locks held by swapper/0/1:
> > [    7.378491]  #0:  (&dev->mutex){......}, at: [<c06b273c>] device_attach+0x28/0x9c
> > [    7.386212]  #1:  (rcu_read_lock){......}, at: [<c083cfc8>] dev_pm_opp_init_cpufreq_table+0x0/0x23c
> > [    7.396284]
> > [    7.396284] stack backtrace:
> > [    7.400666] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.16.0-armv7-x2 #1
> > [    7.407668] [<c0019234>] (unwind_backtrace) from [<c0014218>] (show_stack+0x20/0x24)
> > [    7.415473] [<c0014218>] (show_stack) from [<c0a5b8a0>] (dump_stack+0x9c/0xbc)
> > [    7.422818] [<c0a5b8a0>] (dump_stack) from [<c00b4474>] (lockdep_rcu_suspicious+0xdc/0x110)
> > [    7.431298] [<c00b4474>] (lockdep_rcu_suspicious) from [<c008d214>] (__might_sleep+0x204/0x240)
> > [    7.440106] [<c008d214>] (__might_sleep) from [<c01c8090>] (__kmalloc+0x2a8/0x328)
> > [    7.447801] [<c01c8090>] (__kmalloc) from [<c083d06c>] (dev_pm_opp_init_cpufreq_table+0xa4/0x23c)
> > [    7.456780] [<c083d06c>] (dev_pm_opp_init_cpufreq_table) from [<c0841bb0>] (imx6q_cpufreq_probe+0x160/0x750)
> > [    7.466734] [<c0841bb0>] (imx6q_cpufreq_probe) from [<c06b4b84>] (platform_drv_probe+0x28/0x5c)
> > [    7.475456] [<c06b4b84>] (platform_drv_probe) from [<c06b2960>] (driver_probe_device+0x14c/0x39c)
> > [    7.484457] [<c06b2960>] (driver_probe_device) from [<c06b2c00>] (__device_attach+0x50/0x54)
> > [    7.492986] [<c06b2c00>] (__device_attach) from [<c06b09e0>] (bus_for_each_drv+0x70/0xa4)
> > [    7.501291] [<c06b09e0>] (bus_for_each_drv) from [<c06b279c>] (device_attach+0x88/0x9c)
> > [    7.509388] [<c06b279c>] (device_attach) from [<c06b1c08>] (bus_probe_device+0x98/0xbc)
> > [    7.517600] [<c06b1c08>] (bus_probe_device) from [<c06afac0>] (device_add+0x4a8/0x5a0)
> > [    7.525679] [<c06afac0>] (device_add) from [<c06b487c>] (platform_device_add+0xd4/0x26c)
> > [    7.533974] [<c06b487c>] (platform_device_add) from [<c06b5144>] (platform_device_register+0x30/0x34)
> > [    7.543404] [<c06b5144>] (platform_device_register) from [<c0f0dcb4>] (imx6q_init_late+0x17c/0x18c)
> > [    7.552609] [<c0f0dcb4>] (imx6q_init_late) from [<c0f00b8c>] (init_machine_late+0x28/0x30)
> > [    7.560991] [<c0f00b8c>] (init_machine_late) from [<c0008bb0>] (do_one_initcall+0xec/0x224)
> > [    7.569538] [<c0008bb0>] (do_one_initcall) from [<c0efef00>] (kernel_init_freeable+0x208/0x2ac)
> > [    7.578448] [<c0efef00>] (kernel_init_freeable) from [<c0a557ac>] (kernel_init+0x1c/0xf8)
> > [    7.586764] [<c0a557ac>] (kernel_init) from [<c000fce8>] (ret_from_fork+0x14/0x20)
> > ---
> >  drivers/cpufreq/cpufreq_opp.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/cpufreq/cpufreq_opp.c b/drivers/cpufreq/cpufreq_opp.c
> > index c0c6f4a..d5b5625 100644
> > --- a/drivers/cpufreq/cpufreq_opp.c
> > +++ b/drivers/cpufreq/cpufreq_opp.c
> > @@ -60,7 +60,7 @@ int dev_pm_opp_init_cpufreq_table(struct device *dev,
> >                 goto out;
> >         }
> >
> > -       freq_table = kzalloc(sizeof(*freq_table) * (max_opps + 1), GFP_KERNEL);
> > +       freq_table = kzalloc(sizeof(*freq_table) * (max_opps + 1), GFP_ATOMIC);
> >         if (!freq_table) {
> >                 ret = -ENOMEM;
> >                 goto out;
> 
> Please see this:
> 
> https://lkml.org/lkml/2014/7/16/815
> 
> @Rafael: Have you already applied patch from above link?

No, I haven't.  Do we need it after all?

Rafael


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] cpufreq_opp.c: Fixed the __might_sleep by changing GFP_KERNEL to GFP_ATOMIC.
  2014-08-05 23:35   ` Rafael J. Wysocki
@ 2014-08-06  5:08     ` Viresh Kumar
  2014-08-06 15:02       ` Stephen Boyd
  0 siblings, 1 reply; 5+ messages in thread
From: Viresh Kumar @ 2014-08-06  5:08 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Anand Moon, Stephen Boyd, linux-pm@vger.kernel.org,
	Linux Kernel Mailing List

On 6 August 2014 05:05, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
>> https://lkml.org/lkml/2014/7/16/815
>>
>> @Rafael: Have you already applied patch from above link?
>
> No, I haven't.  Do we need it after all?

I think yes, Right Stephen? :)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] cpufreq_opp.c: Fixed the __might_sleep by changing GFP_KERNEL to GFP_ATOMIC.
  2014-08-06  5:08     ` Viresh Kumar
@ 2014-08-06 15:02       ` Stephen Boyd
  2014-08-06 20:36         ` Rafael J. Wysocki
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Boyd @ 2014-08-06 15:02 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Rafael J. Wysocki, Anand Moon, linux-pm@vger.kernel.org,
	Linux Kernel Mailing List

On 08/06, Viresh Kumar wrote:
> On 6 August 2014 05:05, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> >> https://lkml.org/lkml/2014/7/16/815
> >>
> >> @Rafael: Have you already applied patch from above link?
> >
> > No, I haven't.  Do we need it after all?
> 
> I think yes, Right Stephen? :)

Yes.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] cpufreq_opp.c: Fixed the __might_sleep by changing GFP_KERNEL to GFP_ATOMIC.
  2014-08-06 15:02       ` Stephen Boyd
@ 2014-08-06 20:36         ` Rafael J. Wysocki
  0 siblings, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2014-08-06 20:36 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Viresh Kumar, Anand Moon, linux-pm@vger.kernel.org,
	Linux Kernel Mailing List

On Wednesday, August 06, 2014 08:02:27 AM Stephen Boyd wrote:
> On 08/06, Viresh Kumar wrote:
> > On 6 August 2014 05:05, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> > >> https://lkml.org/lkml/2014/7/16/815
> > >>
> > >> @Rafael: Have you already applied patch from above link?
> > >
> > > No, I haven't.  Do we need it after all?
> > 
> > I think yes, Right Stephen? :)
> 
> Yes.

OK, queued up for the next pull request, thanks!


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-08-06 20:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1407183283-21921-1-git-send-email-moon.linux@yahoo.com>
2014-08-05  6:17 ` [PATCH] cpufreq_opp.c: Fixed the __might_sleep by changing GFP_KERNEL to GFP_ATOMIC Viresh Kumar
2014-08-05 23:35   ` Rafael J. Wysocki
2014-08-06  5:08     ` Viresh Kumar
2014-08-06 15:02       ` Stephen Boyd
2014-08-06 20:36         ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox