From patchwork Tue Mar 18 15:54:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Christoph Lameter (Ampere)" X-Patchwork-Id: 3848541 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6BC96BF540 for ; Tue, 18 Mar 2014 15:54:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 70370203AF for ; Tue, 18 Mar 2014 15:54:45 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6EBBA203AE for ; Tue, 18 Mar 2014 15:54:44 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WPwLb-0007C6-4y; Tue, 18 Mar 2014 15:54:35 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WPwLY-00072i-Mf; Tue, 18 Mar 2014 15:54:32 +0000 Received: from qmta15.emeryville.ca.mail.comcast.net ([2001:558:fe2d:44:76:96:27:228]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WPwLW-000721-0A for linux-arm-kernel@lists.infradead.org; Tue, 18 Mar 2014 15:54:31 +0000 Received: from omta19.emeryville.ca.mail.comcast.net ([76.96.30.76]) by qmta15.emeryville.ca.mail.comcast.net with comcast id f3fu1n0021eYJf8AF3ttcp; Tue, 18 Mar 2014 15:53:53 +0000 Received: from gentwo.org ([98.213.233.247]) by omta19.emeryville.ca.mail.comcast.net with comcast id f3u61n00s5Lw0ES013u7T0; Tue, 18 Mar 2014 15:54:08 +0000 Received: by gentwo.org (Postfix, from userid 1001) id 63A5D1041; Tue, 18 Mar 2014 10:54:06 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by gentwo.org (Postfix) with ESMTP id 60146FED; Tue, 18 Mar 2014 10:54:06 -0500 (CDT) Date: Tue, 18 Mar 2014 10:54:06 -0500 (CDT) From: Christoph Lameter X-X-Sender: cl@nuc To: Grygorii Strashko Subject: Re: [linux-next][regression] [PATCH] percpu: add preemption checks to __this_cpu ops In-Reply-To: <53286ABF.3040408@ti.com> Message-ID: References: <53285FE7.5010203@ti.com> <53286ABF.3040408@ti.com> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20140121; t=1395158033; bh=NCeB4Vihtzgd+MKizxD+ex17V2o9Tn05ezkAVJaH4y0=; h=Received:Received:Received:Received:Date:From:To:Subject: Message-ID:Content-Type; b=MtK+jGkNS0aRgGSW9B21l2YvB6l6J2hPrh4rHROy0ZQs4pueFH1MITfuoTcbUzBoX sHS5wjoXMbrmkPvP7ZUfwalGGBBuPZFxd6dkkIzL8HZUP/tDsseQri2ioyYUOgrVTj 9CfN2MkD6qxWTgDEpEhLpJ5NqgQ++l2Uso95CGHXfhuEl3FuMufw0sPN5aJSZu2A8z NUXhgslsTys1uJ5UFkG2084LJtxtQCzlTPIWk/hZqng3Hk6uDJAM8g34HNnsyxmMeg Tgr7E/TCfMRWPV/dYbOLyZSryNnjWATSL3znZy1C0l60L5I7Ws3tzlh3sLwjB4Uhbh nM2ah4Kbm9NQw== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140318_115430_261594_452C67DD X-CRM114-Status: UNSURE ( 8.94 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) Cc: linux-kernel@vger.kernel.org, Santosh Shilimkar , Tejun Heo , Andrew Morton , Ingo Molnar , linux-arm X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Tue, 18 Mar 2014, Grygorii Strashko wrote: > Any way, I can boot and console works fine with your change :) > Thanks. Ok here is the properly formatted patch: Subject: preemption_checks: Avoid snprintf before checking error conditions snprintf can cause hangs. Move the string processing into the function so that the string operations only occur when necessary after the conditions have been checked. Tested-by: Grygorii Strashko Signed-off-by: Christoph Lameter Index: linux/lib/smp_processor_id.c =================================================================== --- linux.orig/lib/smp_processor_id.c 2014-03-18 09:36:31.330450525 -0500 +++ linux/lib/smp_processor_id.c 2014-03-18 09:36:37.822315534 -0500 @@ -7,7 +7,8 @@ #include #include -notrace static unsigned int check_preemption_disabled(char *what) +notrace static unsigned int check_preemption_disabled(const char *what1, + const char *what2) { int this_cpu = raw_smp_processor_id(); @@ -38,8 +39,8 @@ if (!printk_ratelimit()) goto out_enable; - printk(KERN_ERR "BUG: using %s in preemptible [%08x] code: %s/%d\n", - what, preempt_count() - 1, current->comm, current->pid); + printk(KERN_ERR "BUG: using %s%s() in preemptible [%08x] code: %s/%d\n", + what1, what2, preempt_count() - 1, current->comm, current->pid); print_symbol("caller is %s\n", (long)__builtin_return_address(0)); dump_stack(); @@ -52,15 +53,12 @@ notrace unsigned int debug_smp_processor_id(void) { - return check_preemption_disabled("smp_processor_id()"); + return check_preemption_disabled("smp_processor_id",""); } EXPORT_SYMBOL(debug_smp_processor_id); notrace void __this_cpu_preempt_check(const char *op) { - char text[40]; - - snprintf(text, sizeof(text), "__this_cpu_%s()", op); - check_preemption_disabled(text); + check_preemption_disabled("__this_cpu_", op); } EXPORT_SYMBOL(__this_cpu_preempt_check);