Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753130AbcCBNS3 (ORCPT ); Wed, 2 Mar 2016 08:18:29 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:35414 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750906AbcCBNS1 (ORCPT ); Wed, 2 Mar 2016 08:18:27 -0500 Date: Wed, 2 Mar 2016 14:18:24 +0100 From: Michal Hocko To: Hidehiro Kawai Cc: Andrew Morton , Thomas Mingarelli , Wim Van Sebroeck , Corey Minyard , Javi Merino , linux-watchdog@vger.kernel.org, "Steven Rostedt (Red Hat)" , Rasmus Villemoes , linux-kernel@vger.kernel.org, Michal Nazarewicz , Vitaly Kuznetsov , HATAYAMA Daisuke , Borislav Petkov , Gobinda Charan Maji , Tejun Heo , Nicolas Iooss , openipmi-developer@lists.sourceforge.net, Borislav Petkov , Thomas Gleixner , Guenter Roeck Subject: Re: [v2 PATCH 1/3] panic: Change nmi_panic from macro to function Message-ID: <20160302131824.GH26686@dhcp22.suse.cz> References: <20160302103624.5058.35844.stgit@softrs> <20160302103626.5058.74361.stgit@softrs> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160302103626.5058.74361.stgit@softrs> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 851 Lines: 36 On Wed 02-03-16 19:36:26, Hidehiro Kawai wrote: [...] > +void nmi_panic(struct pt_regs *regs, const char *fmt, ...) Do we really need vargs? All the current users seem to be OK with a simple string. This makes the code slightly more complicated without any apparent reason. > +{ > + static char buf[1024]; /* protected by panic_cpu */ > + va_list args; > + int old_cpu, cpu; > + > + cpu = raw_smp_processor_id(); > + old_cpu = atomic_cmpxchg(&panic_cpu, PANIC_CPU_INVALID, cpu); > + > + if (old_cpu == PANIC_CPU_INVALID) { > + va_start(args, fmt); > + vsnprintf(buf, sizeof(buf), fmt, args); > + va_end(args); > + > + panic("%s", buf); > + } else if (old_cpu != cpu) > + nmi_panic_self_stop(regs); > +} > +EXPORT_SYMBOL(nmi_panic); > + > /** > * panic - halt the system > * @fmt: The text string to print > > -- Michal Hocko SUSE Labs