Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759117AbcCDT1t (ORCPT ); Fri, 4 Mar 2016 14:27:49 -0500 Received: from mail-qg0-f41.google.com ([209.85.192.41]:33390 "EHLO mail-qg0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751476AbcCDT1q convert rfc822-to-8bit (ORCPT ); Fri, 4 Mar 2016 14:27:46 -0500 From: Michal Nazarewicz To: Hidehiro Kawai , Andrew Morton , Thomas Mingarelli , Wim Van Sebroeck , Corey Minyard Cc: Javi Merino , Michal Hocko , linux-watchdog@vger.kernel.org, "Steven Rostedt \(Red Hat\)" , Rasmus Villemoes , linux-kernel@vger.kernel.org, Michal Hocko , 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: [v3 PATCH 1/3] panic: Change nmi_panic from macro to function In-Reply-To: <20160303105744.4587.1001.stgit@softrs> Organization: http://mina86.com/ References: <20160303105741.4587.49047.stgit@softrs> <20160303105744.4587.1001.stgit@softrs> User-Agent: Notmuch/0.19+53~g2e63a09 (http://notmuchmail.org) Emacs/25.1.50.1 (x86_64-unknown-linux-gnu) Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEWbfGlUPDDHgE57V0jUupKjgIObY0PLrom9mH4dFRK4gmjPs41MxjOgAAACP0lEQVQ4T23Sv2vbQBQHcBk1xE6WyALX107VUEgmn6+ouUwpEQQ6uRjttkWP4CkBg2M0BQLBdPFZYPsyFYo7qEtKDQ7on+t7+nF2Ux8ahD587717OmNYrOvycHsZ+o2r051wHTHysAvGb8ygvgu4QWT0sCmkgZCIEnlV2X8BtyraazFGDuxhmKSQJMlwHQ7v5MHSNxmz78rfElwAa3ieVD9e+hBhjaPDDG6NgFo2f4wBMNIo5YmRtF0RyDgFjJjlMIWbnuM4x9MMfABGTlN4qgIQB4A1DEyA1BHWtfeWNUMwiVJKoqh97KrkOO+qzgluVYLvFCUKAX73nONeBr7BGMdM6Sg0kuep03VywLaIzRiVr+GAzKlpQIsAFnWAG2e6DT5WmWDiudZMIc6hYrMOmeMQK9WX0B+/RfjzL9DI7Y9/Iayn29Ci0r2i4f9gMimMSZLCDMalgQGU5hnUtqAN0OGvEmO1Wnl0C0wWSCEHnuHBqmygxdxA8oWXwbipoc1EoNR9DqOpBpOJrnr0criQab9ZT4LL+wI+K7GBQH30CrhUruilgP9DRTrhVWZCiAyILP+wiuLeCKGTD6r/nc8LOJcAwR6IBTUs+7CASw3QFZ0MdA2PI3zNziH4ZKVhXCRMBjeZ1DWMekKwDCASwExy+NQ86TaykaDAFHO4aP48y4fIcDM5yOG8GcTLbOyp8A8azjJI93JFd1EA6yN8sSxMQJWoABqniRZVykYgRXErzrdqExAoUrRb0xfRp8p2A/4XmfilTtkDZ4cAAAAASUVORK5CYII= X-Face: -TR8(rDTHy/(xl?SfWd1|3:TTgDIatE^t'vop%*gVg[kn$t{EpK(P"VQ=~T2#ysNmJKN$"yTRLB4YQs$4{[.]Fc1)*O]3+XO^oXM>Q#b^ix,O)Zbn)q[y06$`e3?C)`CwR9y5riE=fv^X@x$y?D:XO6L&x4f-}}I4=VRNwiA^t1-ZrVK^07.Pi/57c_du'& X-PGP: 50751FF4 X-PGP-FP: AC1F 5F5C D418 88F8 CC84 5858 2060 4012 5075 1FF4 X-Hashcash: 1:20:160304:bp@alien8.de::lCYfM9dq7clkjDIM:000000MqM X-Hashcash: 1:20:160304:linux@rasmusvillemoes.dk::JQUnRqG53tb0aF/K:00000000000000000000000000000000000000/Lh X-Hashcash: 1:20:160304:akpm@linux-foundation.org::OP6kdbLJhaGjGDPk:0000000000000000000000000000000000000gL5 X-Hashcash: 1:20:160304:hidehiro.kawai.ez@hitachi.com::mhQRtnLlgRb0S/sI:000000000000000000000000000000000Xh5 X-Hashcash: 1:20:160304:tglx@linutronix.de::DV6ijA1qP2E+aivh:00000000000000000000000000000000000000000000/BV X-Hashcash: 1:20:160304:linux-kernel@vger.kernel.org::3ENCUhbaxIky/nR1:0000000000000000000000000000000000uzo X-Hashcash: 1:20:160304:linux-watchdog@vger.kernel.org::JLgIQsF5xV+AtlbI:00000000000000000000000000000001WcA X-Hashcash: 1:20:160304:javi.merino@arm.com::RxcQ82e3ybGFUlwc:0000000000000000000000000000000000000000001oY2 X-Hashcash: 1:20:160304:tj@kernel.org::NuZcBxwDqThRay1q:00001uP6 X-Hashcash: 1:20:160304:linux@roeck-us.net::HApiOAKoVU4ha8GI:00000000000000000000000000000000000000000001YtS X-Hashcash: 1:20:160304:bp@suse.de::IFq22yCc9i6XUCPP:000000027Ac X-Hashcash: 1:20:160304:gobinda.cemk07@gmail.com::1/260fqS7RhjJR9u:00000000000000000000000000000000000002YTm X-Hashcash: 1:20:160304:openipmi-developer@lists.sourceforge.net::F1al8fEq2ssfuGWn:0000000000000000000003Yxd X-Hashcash: 1:20:160304:vkuznets@redhat.com::mIAzSxc7j+zSCBqC:0000000000000000000000000000000000000000003HF8 X-Hashcash: 1:20:160304:mhocko@kernel.org::lTpEe4Dj3ajlM3ha:000000000000000000000000000000000000000000003n4t X-Hashcash: 1:20:160304:mhocko@suse.com::+VxkeioACCazpZgK:004kWR X-Hashcash: 1:20:160304:wim@iguana.be::SfcJuwChRfRyHmK4:00003e6s X-Hashcash: 1:20:160304:rostedt@goodmis.org::4pNsUkJfAA8gAjqY:0000000000000000000000000000000000000000004Mqt X-Hashcash: 1:20:160304:minyard@acm.org::N88mFvjnSrhk2XHP:0071LM X-Hashcash: 1:20:160304:d.hatayama@jp.fujitsu.com::yT4ieLxE4Rzy9zcI:0000000000000000000000000000000000008F6p X-Hashcash: 1:20:160304:thomas.mingarelli@hpe.com::zhDWk1kNFMbtpV6j:0000000000000000000000000000000000008p8n X-Hashcash: 1:20:160304:nicolas.iooss_linux@m4x.org::m9ImxsJYJGHtpB1r:00000000000000000000000000000000007X3D Date: Fri, 04 Mar 2016 14:27:43 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3654 Lines: 108 On Thu, Mar 03 2016, Hidehiro Kawai wrote: > Change nmi_panic() macro to a normal function for the portability. > Also, export it for modules. > > Changes since v2: > - Make nmi_panic receive a single string instead of printf style args > > Signed-off-by: Hidehiro Kawai > Cc: Andrew Morton > Cc: Borislav Petkov > Cc: Michal Nazarewicz Code does what the commit advertises so Acked-by: Michal Nazarewicz > Cc: Michal Hocko > Cc: Rasmus Villemoes > Cc: Nicolas Iooss > Cc: Javi Merino > Cc: Gobinda Charan Maji > Cc: "Steven Rostedt (Red Hat)" > Cc: Thomas Gleixner > Cc: Vitaly Kuznetsov > Cc: HATAYAMA Daisuke > Cc: Tejun Heo > --- > include/linux/kernel.h | 21 +------------------- > kernel/panic.c | 20 ++++++++++++++++++++ > 2 files changed, 21 insertions(+), 20 deletions(-) > > diff --git a/include/linux/kernel.h b/include/linux/kernel.h > index f31638c..cbe7d70 100644 > --- a/include/linux/kernel.h > +++ b/include/linux/kernel.h > @@ -255,7 +255,7 @@ extern long (*panic_blink)(int state); > __printf(1, 2) > void panic(const char *fmt, ...) > __noreturn __cold; > -void nmi_panic_self_stop(struct pt_regs *); > +void nmi_panic(struct pt_regs *regs, const char *msg); > extern void oops_enter(void); > extern void oops_exit(void); > void print_oops_end_marker(void); > @@ -455,25 +455,6 @@ extern atomic_t panic_cpu; > #define PANIC_CPU_INVALID -1 > > /* > - * A variant of panic() called from NMI context. We return if we've already > - * panicked on this CPU. If another CPU already panicked, loop in > - * nmi_panic_self_stop() which can provide architecture dependent code such > - * as saving register state for crash dump. > - */ > -#define nmi_panic(regs, fmt, ...) \ > -do { \ > - 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) \ > - panic(fmt, ##__VA_ARGS__); \ > - else if (old_cpu != cpu) \ > - nmi_panic_self_stop(regs); \ > -} while (0) > - > -/* > * Only to be used by arch init code. If the user over-wrote the default > * CONFIG_PANIC_TIMEOUT, honor it. > */ > diff --git a/kernel/panic.c b/kernel/panic.c > index d96469d..8abfc30 100644 > --- a/kernel/panic.c > +++ b/kernel/panic.c > @@ -72,6 +72,26 @@ void __weak nmi_panic_self_stop(struct pt_regs *regs) > > atomic_t panic_cpu = ATOMIC_INIT(PANIC_CPU_INVALID); > > +/* > + * A variant of panic() called from NMI context. We return if we've already > + * panicked on this CPU. If another CPU already panicked, loop in > + * nmi_panic_self_stop() which can provide architecture dependent code such > + * as saving register state for crash dump. > + */ > +void nmi_panic(struct pt_regs *regs, const char *msg) > +{ > + 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) > + panic("%s", msg); > + else if (old_cpu != cpu) > + nmi_panic_self_stop(regs); > +} > +EXPORT_SYMBOL(nmi_panic); > + > /** > * panic - halt the system > * @fmt: The text string to print > > -- Best regards ミハウ “????????????????86” ナザレヴイツ «If at first you don’t succeed, give up skydiving»