* Re: [v3 PATCH 1/3] panic: Change nmi_panic from macro to function
2016-03-03 10:57 ` [v3 PATCH 1/3] panic: Change nmi_panic from macro to function Hidehiro Kawai
@ 2016-03-03 13:14 ` Borislav Petkov
2016-03-07 10:53 ` 河合英宏 / KAWAI,HIDEHIRO
2016-03-04 17:49 ` Michal Hocko
2016-03-04 19:27 ` Michal Nazarewicz
2 siblings, 1 reply; 13+ messages in thread
From: Borislav Petkov @ 2016-03-03 13:14 UTC (permalink / raw)
To: Hidehiro Kawai
Cc: Andrew Morton, Thomas Mingarelli, Wim Van Sebroeck, Corey Minyard,
Javi Merino, Michal Hocko, linux-watchdog,
Steven Rostedt (Red Hat), Rasmus Villemoes, linux-kernel,
Michal Nazarewicz, Michal Hocko, Vitaly Kuznetsov,
HATAYAMA Daisuke, Gobinda Charan Maji, Tejun Heo, Nicolas Iooss,
openipmi-developer, Thomas Gleixner, Guenter Roeck
On Thu, Mar 03, 2016 at 07:57:44PM +0900, Hidehiro Kawai wrote:
> Change nmi_panic() macro to a normal function for the portability.
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 <hidehiro.kawai.ez@hitachi.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Borislav Petkov <bp@suse.de>
> Cc: Michal Nazarewicz <mina86@mina86.com>
> Cc: Michal Hocko <mhocko@suse.com>
> Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> Cc: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
> Cc: Javi Merino <javi.merino@arm.com>
> Cc: Gobinda Charan Maji <gobinda.cemk07@gmail.com>
> Cc: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
> Cc: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
> Cc: Tejun Heo <tj@kernel.org>
> ---
> include/linux/kernel.h | 21 +--------------------
> kernel/panic.c | 20 ++++++++++++++++++++
> 2 files changed, 21 insertions(+), 20 deletions(-)
Acked-by: Borislav Petkov <bp@suse.de>
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
^ permalink raw reply [flat|nested] 13+ messages in thread* RE: [v3 PATCH 1/3] panic: Change nmi_panic from macro to function
2016-03-03 13:14 ` Borislav Petkov
@ 2016-03-07 10:53 ` 河合英宏 / KAWAI,HIDEHIRO
2016-03-07 11:13 ` Borislav Petkov
0 siblings, 1 reply; 13+ messages in thread
From: 河合英宏 / KAWAI,HIDEHIRO @ 2016-03-07 10:53 UTC (permalink / raw)
To: 'Borislav Petkov'
Cc: Andrew Morton, Thomas Mingarelli, Wim Van Sebroeck, Corey Minyard,
Javi Merino, Michal Hocko, linux-watchdog@vger.kernel.org,
Steven Rostedt (Red Hat), Rasmus Villemoes,
linux-kernel@vger.kernel.org, Michal Nazarewicz, Michal Hocko,
Vitaly Kuznetsov, HATAYAMA Daisuke, Gobinda Charan Maji,
Tejun Heo, Nicolas Iooss,
openipmi-developer@lists.sourceforge.net, Thomas Gleixner,
Guenter Roeck
> From: Borislav Petkov [mailto:bp@alien8.de]
> On Thu, Mar 03, 2016 at 07:57:44PM +0900, Hidehiro Kawai wrote:
> > Change nmi_panic() macro to a normal function for the portability.
>
> portability?
I wanted to say encapsulating things into a function makes modules
only have to know about the function. Modules don't need to know
all things in the macro. But I thought again, and `portability'
was not appropriate.
However, this patch set has been queued into -mm now. So I'll
leave this if not necessary.
Regards,
Hidehiro Kawai
> > 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 <hidehiro.kawai.ez@hitachi.com>
> > Cc: Andrew Morton <akpm@linux-foundation.org>
> > Cc: Borislav Petkov <bp@suse.de>
> > Cc: Michal Nazarewicz <mina86@mina86.com>
> > Cc: Michal Hocko <mhocko@suse.com>
> > Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> > Cc: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
> > Cc: Javi Merino <javi.merino@arm.com>
> > Cc: Gobinda Charan Maji <gobinda.cemk07@gmail.com>
> > Cc: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
> > Cc: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
> > Cc: Tejun Heo <tj@kernel.org>
> > ---
> > include/linux/kernel.h | 21 +--------------------
> > kernel/panic.c | 20 ++++++++++++++++++++
> > 2 files changed, 21 insertions(+), 20 deletions(-)
>
> Acked-by: Borislav Petkov <bp@suse.de>
>
> --
> Regards/Gruss,
> Boris.
>
> ECO tip #101: Trim your mails when you reply.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [v3 PATCH 1/3] panic: Change nmi_panic from macro to function
2016-03-07 10:53 ` 河合英宏 / KAWAI,HIDEHIRO
@ 2016-03-07 11:13 ` Borislav Petkov
0 siblings, 0 replies; 13+ messages in thread
From: Borislav Petkov @ 2016-03-07 11:13 UTC (permalink / raw)
To: 河合英宏 / KAWAI,HIDEHIRO
Cc: Andrew Morton, Thomas Mingarelli, Wim Van Sebroeck, Corey Minyard,
Javi Merino, Michal Hocko, linux-watchdog@vger.kernel.org,
Steven Rostedt (Red Hat), Rasmus Villemoes,
linux-kernel@vger.kernel.org, Michal Nazarewicz, Michal Hocko,
Vitaly Kuznetsov, HATAYAMA Daisuke, Gobinda Charan Maji,
Tejun Heo, Nicolas Iooss,
openipmi-developer@lists.sourceforge.net, Thomas Gleixner,
Guenter Roeck
On Mon, Mar 07, 2016 at 10:53:51AM +0000, 河合英宏 / KAWAI,HIDEHIRO wrote:
> > From: Borislav Petkov [mailto:bp@alien8.de]
> > On Thu, Mar 03, 2016 at 07:57:44PM +0900, Hidehiro Kawai wrote:
> > > Change nmi_panic() macro to a normal function for the portability.
> >
> > portability?
>
> I wanted to say encapsulating things into a function makes modules
> only have to know about the function. Modules don't need to know
> all things in the macro. But I thought again, and `portability'
> was not appropriate.
>
> However, this patch set has been queued into -mm now. So I'll
> leave this if not necessary.
Unless Andrew is willing to do a quick "quilt header -e" on your patch
and paste in a corrected commit message text which you give him...
:-)
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [v3 PATCH 1/3] panic: Change nmi_panic from macro to function
@ 2016-03-07 11:13 ` Borislav Petkov
0 siblings, 0 replies; 13+ messages in thread
From: Borislav Petkov @ 2016-03-07 11:13 UTC (permalink / raw)
To: 河合英宏 / KAWAI,HIDEHIRO
Cc: Andrew Morton, Thomas Mingarelli, Wim Van Sebroeck, Corey Minyard,
Javi Merino, Michal Hocko, linux-watchdog@vger.kernel.org,
Steven Rostedt (Red Hat), Rasmus Villemoes,
linux-kernel@vger.kernel.org, Michal Nazarewicz, Michal Hocko,
Vitaly Kuznetsov, HATAYAMA Daisuke, Gobinda Charan Maji,
Tejun Heo, Nicolas Iooss,
openipmi-developer@lists.sourceforge.net, Thomas Gleixner,
Guenter Roeck
On Mon, Mar 07, 2016 at 10:53:51AM +0000, 河合英宏 / KAWAI,HIDEHIRO wrote:
> > From: Borislav Petkov [mailto:bp@alien8.de]
> > On Thu, Mar 03, 2016 at 07:57:44PM +0900, Hidehiro Kawai wrote:
> > > Change nmi_panic() macro to a normal function for the portability.
> >
> > portability?
>
> I wanted to say encapsulating things into a function makes modules
> only have to know about the function. Modules don't need to know
> all things in the macro. But I thought again, and `portability'
> was not appropriate.
>
> However, this patch set has been queued into -mm now. So I'll
> leave this if not necessary.
Unless Andrew is willing to do a quick "quilt header -e" on your patch
and paste in a corrected commit message text which you give him...
:-)
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [v3 PATCH 1/3] panic: Change nmi_panic from macro to function
2016-03-03 10:57 ` [v3 PATCH 1/3] panic: Change nmi_panic from macro to function Hidehiro Kawai
2016-03-03 13:14 ` Borislav Petkov
@ 2016-03-04 17:49 ` Michal Hocko
2016-03-04 19:27 ` Michal Nazarewicz
2 siblings, 0 replies; 13+ messages in thread
From: Michal Hocko @ 2016-03-04 17:49 UTC (permalink / raw)
To: Hidehiro Kawai
Cc: Andrew Morton, Thomas Mingarelli, Wim Van Sebroeck, Corey Minyard,
Javi Merino, linux-watchdog, Steven Rostedt (Red Hat),
Rasmus Villemoes, linux-kernel, Michal Nazarewicz,
Vitaly Kuznetsov, HATAYAMA Daisuke, Borislav Petkov,
Gobinda Charan Maji, Tejun Heo, Nicolas Iooss, openipmi-developer,
Borislav Petkov, Thomas Gleixner, Guenter Roeck
On Thu 03-03-16 19:57:44, Hidehiro Kawai wrote:
> Change nmi_panic() macro to a normal function for the portability.
> Also, export it for modules.
I guess you wanted to say
"
Change nmi_panic() from macro to a normal function so that it can be
exported to modules. At least ipmi and hpwdt watchdogs can be compiled
as a module and need to panic from the NMI context.
"
>
> Changes since v2:
> - Make nmi_panic receive a single string instead of printf style args
>
> Signed-off-by: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Borislav Petkov <bp@suse.de>
> Cc: Michal Nazarewicz <mina86@mina86.com>
> Cc: Michal Hocko <mhocko@suse.com>
> Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> Cc: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
> Cc: Javi Merino <javi.merino@arm.com>
> Cc: Gobinda Charan Maji <gobinda.cemk07@gmail.com>
> Cc: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
> Cc: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
> Cc: Tejun Heo <tj@kernel.org>
For the change itself
Acked-by: Michal Hocko <mhocko@suse.com>
> ---
> 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
>
>
--
Michal Hocko
SUSE Labs
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [v3 PATCH 1/3] panic: Change nmi_panic from macro to function
2016-03-03 10:57 ` [v3 PATCH 1/3] panic: Change nmi_panic from macro to function Hidehiro Kawai
@ 2016-03-04 19:27 ` Michal Nazarewicz
2016-03-04 17:49 ` Michal Hocko
2016-03-04 19:27 ` Michal Nazarewicz
2 siblings, 0 replies; 13+ messages in thread
From: Michal Nazarewicz @ 2016-03-04 19:27 UTC (permalink / raw)
To: Hidehiro Kawai, Andrew Morton, Thomas Mingarelli,
Wim Van Sebroeck, Corey Minyard
Cc: Javi Merino, Michal Hocko, linux-watchdog,
Steven Rostedt (Red Hat), Rasmus Villemoes, linux-kernel,
Michal Hocko, Vitaly Kuznetsov, HATAYAMA Daisuke, Borislav Petkov,
Gobinda Charan Maji, Tejun Heo, Nicolas Iooss, openipmi-developer,
Borislav Petkov, Thomas Gleixner, Guenter Roeck
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 <hidehiro.kawai.ez@hitachi.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Borislav Petkov <bp@suse.de>
> Cc: Michal Nazarewicz <mina86@mina86.com>
Code does what the commit advertises so
Acked-by: Michal Nazarewicz <mina86@mina86.com>
> Cc: Michal Hocko <mhocko@suse.com>
> Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> Cc: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
> Cc: Javi Merino <javi.merino@arm.com>
> Cc: Gobinda Charan Maji <gobinda.cemk07@gmail.com>
> Cc: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
> Cc: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
> Cc: Tejun Heo <tj@kernel.org>
> ---
> 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»
--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [v3 PATCH 1/3] panic: Change nmi_panic from macro to function
@ 2016-03-04 19:27 ` Michal Nazarewicz
0 siblings, 0 replies; 13+ messages in thread
From: Michal Nazarewicz @ 2016-03-04 19:27 UTC (permalink / raw)
To: Hidehiro Kawai, Andrew Morton, Thomas Mingarelli,
Wim Van Sebroeck, Corey Minyard
Cc: Javi Merino, Michal Hocko, linux-watchdog,
Steven Rostedt (Red Hat), Rasmus Villemoes, linux-kernel,
Michal Hocko, Vitaly Kuznetsov, HATAYAMA Daisuke, Borislav Petkov,
Gobinda Charan Maji, Tejun Heo, Nicolas Iooss, openipmi-developer,
Borislav Petkov, Thomas Gleixner, Guenter Roeck
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 <hidehiro.kawai.ez@hitachi.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Borislav Petkov <bp@suse.de>
> Cc: Michal Nazarewicz <mina86@mina86.com>
Code does what the commit advertises so
Acked-by: Michal Nazarewicz <mina86@mina86.com>
> Cc: Michal Hocko <mhocko@suse.com>
> Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> Cc: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
> Cc: Javi Merino <javi.merino@arm.com>
> Cc: Gobinda Charan Maji <gobinda.cemk07@gmail.com>
> Cc: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
> Cc: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
> Cc: Tejun Heo <tj@kernel.org>
> ---
> 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»
^ permalink raw reply [flat|nested] 13+ messages in thread