From patchwork Fri Aug 26 09:03:18 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan Wu X-Patchwork-Id: 1101312 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7Q95KjA007995 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 26 Aug 2011 09:05:41 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QwsLA-0001zI-3q; Fri, 26 Aug 2011 09:04:40 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QwsL9-00024q-AX; Fri, 26 Aug 2011 09:04:39 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QwsKz-000230-1x for linux-arm-kernel@lists.infradead.org; Fri, 26 Aug 2011 09:04:30 +0000 Received: from [222.65.189.197] (helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1QwsKs-0004UM-6p; Fri, 26 Aug 2011 09:04:25 +0000 From: Bryan Wu To: linux@arm.linux.org.uk, linus.walleij@linaro.org, rpurdie@rpsys.net, tony@atomide.com, jochen@scram.de, linux@maxim.org.za, nicolas.pitre@linaro.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, jamie@jamieiles.com, linux-kernel@vger.kernel.org Subject: [PATCH 01/18] led-triggers: use atomic kzalloc during led trigger registering Date: Fri, 26 Aug 2011 17:03:18 +0800 Message-Id: <1314349415-889-2-git-send-email-bryan.wu@canonical.com> X-Mailer: git-send-email 1.7.5 In-Reply-To: <1314349415-889-1-git-send-email-bryan.wu@canonical.com> References: <1314349415-889-1-git-send-email-bryan.wu@canonical.com> X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110826_050429_251724_18262220 X-CRM114-Status: GOOD ( 10.50 ) X-Spam-Score: -1.2 (-) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-1.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [91.189.89.112 listed in list.dnswl.org] -0.5 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Fri, 26 Aug 2011 09:05:41 +0000 (UTC) kzalloc might cause sleep and will generate some warning detected by lockdep, when call led_trigger_register_simple on each cpu cores in SMP. This patch fix this. [ 1.999938] ------------[ cut here ]------------ [ 2.004791] WARNING: at kernel/lockdep.c:2664 lockdep_trace_alloc+0xd8/0xf0() [ 2.012298] Modules linked in: [ 2.015563] [] (unwind_backtrace+0x0/0xf0) from [] (warn_slowpath_common+0x4c/0x64) [ 2.025451] [] (warn_slowpath_common+0x4c/0x64) from [] (warn_slowpath_null+0x1c/0x24) [ 2.035583] [] (warn_slowpath_null+0x1c/0x24) from [] (lockdep_trace_alloc+0xd8/0xf0) [ 2.045684] [] (lockdep_trace_alloc+0xd8/0xf0) from [] (kmem_cache_alloc_trace+0x2c/0x148) [ 2.056213] [] (kmem_cache_alloc_trace+0x2c/0x148) from [] (led_trigger_register_simple+0x20/0x74) [ 2.067474] [] (led_trigger_register_simple+0x20/0x74) from [] (ledtrig_cpu_register+0x4c/0x8c) [ 2.078460] [] (ledtrig_cpu_register+0x4c/0x8c) from [] (generic_smp_call_function_single_interrupt+0xcc/0x138) [ 2.090911] [] (generic_smp_call_function_single_interrupt+0xcc/0x138) from [] (do_IPI+0xb0/0x128) [ 2.102172] [] (do_IPI+0xb0/0x128) from [] (__irq_svc+0x3c/0x100) [ 2.110412] Exception stack(0xc07adf70 to 0xc07adfb8) [ 2.115722] df60: c07c80f8 0000fb45 00000000 c07c80f8 [ 2.124328] df80: c07ac000 c0837be4 c0464b64 c07c9d8c 00000000 411fc092 00000000 00000000 [ 2.132934] dfa0: c0649760 c07adfb8 c07c5c58 c0014d50 20000013 ffffffff [ 2.139892] [] (__irq_svc+0x3c/0x100) from [] (default_idle+0x30/0x38) [ 2.148590] [] (default_idle+0x30/0x38) from [] (cpu_idle+0xb4/0xf4) [ 2.157135] [] (cpu_idle+0xb4/0xf4) from [] (start_kernel+0x2a8/0x2fc) [ 2.165832] [] (start_kernel+0x2a8/0x2fc) from [<80008040>] (0x80008040) [ 2.173797] ---[ end trace 97549d21d8dad3f5 ]--- Signed-off-by: Bryan Wu --- drivers/leds/led-triggers.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c index 4bebae7..9a9c78d 100644 --- a/drivers/leds/led-triggers.c +++ b/drivers/leds/led-triggers.c @@ -256,7 +256,7 @@ void led_trigger_register_simple(const char *name, struct led_trigger **tp) struct led_trigger *trigger; int err; - trigger = kzalloc(sizeof(struct led_trigger), GFP_KERNEL); + trigger = kzalloc(sizeof(struct led_trigger), GFP_ATOMIC); if (trigger) { trigger->name = name;