From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750943AbaHEXRQ (ORCPT ); Tue, 5 Aug 2014 19:17:16 -0400 Received: from v094114.home.net.pl ([79.96.170.134]:51722 "HELO v094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751365AbaHEXRO (ORCPT ); Tue, 5 Aug 2014 19:17:14 -0400 From: "Rafael J. Wysocki" To: Viresh Kumar Cc: Anand Moon , Stephen Boyd , "linux-pm@vger.kernel.org" , Linux Kernel Mailing List Subject: Re: [PATCH] cpufreq_opp.c: Fixed the __might_sleep by changing GFP_KERNEL to GFP_ATOMIC. Date: Wed, 06 Aug 2014 01:35:55 +0200 Message-ID: <5600331.UfWMPf73u1@vostro.rjw.lan> User-Agent: KMail/4.11.5 (Linux/3.16.0-rc5+; KDE/4.11.5; x86_64; ; ) In-Reply-To: References: <1407183283-21921-1-git-send-email-moon.linux@yahoo.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday, August 05, 2014 11:47:50 AM Viresh Kumar wrote: > On 5 August 2014 01:44, Anand Moon 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 > > 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: [] device_attach+0x28/0x9c > > [ 7.386212] #1: (rcu_read_lock){......}, at: [] 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] [] (unwind_backtrace) from [] (show_stack+0x20/0x24) > > [ 7.415473] [] (show_stack) from [] (dump_stack+0x9c/0xbc) > > [ 7.422818] [] (dump_stack) from [] (lockdep_rcu_suspicious+0xdc/0x110) > > [ 7.431298] [] (lockdep_rcu_suspicious) from [] (__might_sleep+0x204/0x240) > > [ 7.440106] [] (__might_sleep) from [] (__kmalloc+0x2a8/0x328) > > [ 7.447801] [] (__kmalloc) from [] (dev_pm_opp_init_cpufreq_table+0xa4/0x23c) > > [ 7.456780] [] (dev_pm_opp_init_cpufreq_table) from [] (imx6q_cpufreq_probe+0x160/0x750) > > [ 7.466734] [] (imx6q_cpufreq_probe) from [] (platform_drv_probe+0x28/0x5c) > > [ 7.475456] [] (platform_drv_probe) from [] (driver_probe_device+0x14c/0x39c) > > [ 7.484457] [] (driver_probe_device) from [] (__device_attach+0x50/0x54) > > [ 7.492986] [] (__device_attach) from [] (bus_for_each_drv+0x70/0xa4) > > [ 7.501291] [] (bus_for_each_drv) from [] (device_attach+0x88/0x9c) > > [ 7.509388] [] (device_attach) from [] (bus_probe_device+0x98/0xbc) > > [ 7.517600] [] (bus_probe_device) from [] (device_add+0x4a8/0x5a0) > > [ 7.525679] [] (device_add) from [] (platform_device_add+0xd4/0x26c) > > [ 7.533974] [] (platform_device_add) from [] (platform_device_register+0x30/0x34) > > [ 7.543404] [] (platform_device_register) from [] (imx6q_init_late+0x17c/0x18c) > > [ 7.552609] [] (imx6q_init_late) from [] (init_machine_late+0x28/0x30) > > [ 7.560991] [] (init_machine_late) from [] (do_one_initcall+0xec/0x224) > > [ 7.569538] [] (do_one_initcall) from [] (kernel_init_freeable+0x208/0x2ac) > > [ 7.578448] [] (kernel_init_freeable) from [] (kernel_init+0x1c/0xf8) > > [ 7.586764] [] (kernel_init) from [] (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