2016-03-01 07:26:00

by Borislav Petkov

[permalink] [raw]
Subject: Re: [PATCH 1/3] panic: Export panic_cpu and nmi_panic_self_stop

On Tue, Mar 01, 2016 at 10:50:37AM +0900, Hidehiro Kawai wrote:
> Export panic_cpu and nmi_panic_self_stop symbols for modules which
> use nmi_panic() macro.
>
> Signed-off-by: Hidehiro Kawai <[email protected]>
> Cc: Andrew Morton <[email protected]>
> Cc: Borislav Petkov <[email protected]>
> Cc: Thomas Gleixner <[email protected]>
> Cc: Michal Hocko <[email protected]>
> Cc: HATAYAMA Daisuke <[email protected]>
> Cc: Vitaly Kuznetsov <[email protected]>
> Cc: Tejun Heo <[email protected]>
> ---
> kernel/panic.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/kernel/panic.c b/kernel/panic.c
> index d96469d..f4e8035 100644
> --- a/kernel/panic.c
> +++ b/kernel/panic.c
> @@ -69,8 +69,10 @@ void __weak nmi_panic_self_stop(struct pt_regs *regs)
> {
> panic_smp_self_stop();
> }
> +EXPORT_SYMBOL(nmi_panic_self_stop);
>
> atomic_t panic_cpu = ATOMIC_INIT(PANIC_CPU_INVALID);
> +EXPORT_SYMBOL(panic_cpu);

Can we make nmi_panic() at least a proper function and export that
instead of exporting all those implementation details...?

--
Regards/Gruss,
Boris.

ECO tip #101: Trim your mails when you reply.
--


2016-03-01 07:48:16

by Hidehiro Kawai

[permalink] [raw]
Subject: RE: [PATCH 1/3] panic: Export panic_cpu and nmi_panic_self_stop

Hi Borislav,

> From: Borislav Petkov [mailto:[email protected]]
> On Tue, Mar 01, 2016 at 10:50:37AM +0900, Hidehiro Kawai wrote:
> > Export panic_cpu and nmi_panic_self_stop symbols for modules which
> > use nmi_panic() macro.
> >
> > Signed-off-by: Hidehiro Kawai <[email protected]>
> > Cc: Andrew Morton <[email protected]>
> > Cc: Borislav Petkov <[email protected]>
> > Cc: Thomas Gleixner <[email protected]>
> > Cc: Michal Hocko <[email protected]>
> > Cc: HATAYAMA Daisuke <[email protected]>
> > Cc: Vitaly Kuznetsov <[email protected]>
> > Cc: Tejun Heo <[email protected]>
> > ---
> > kernel/panic.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/kernel/panic.c b/kernel/panic.c
> > index d96469d..f4e8035 100644
> > --- a/kernel/panic.c
> > +++ b/kernel/panic.c
> > @@ -69,8 +69,10 @@ void __weak nmi_panic_self_stop(struct pt_regs *regs)
> > {
> > panic_smp_self_stop();
> > }
> > +EXPORT_SYMBOL(nmi_panic_self_stop);
> >
> > atomic_t panic_cpu = ATOMIC_INIT(PANIC_CPU_INVALID);
> > +EXPORT_SYMBOL(panic_cpu);
>
> Can we make nmi_panic() at least a proper function and export that
> instead of exporting all those implementation details...?

The reason I implemented nmi_panic() as a macro is to pass
variable arguments directly to panic(). Fortunately, since all
invocations of nmi_panic() just pass a fixed string, I can change it
to a normal function like:

int nmi_panic(struct pt_regs *regs, const char *msg)
{
...
panic("%s", msg);

If people don't mind if that, I'll change it.

Regards,

--
Hidehiro Kawai
Hitachi, Ltd. Research & Development Group


2016-03-01 08:49:29

by Michal Hocko

[permalink] [raw]
Subject: Re: [PATCH 1/3] panic: Export panic_cpu and nmi_panic_self_stop

On Tue 01-03-16 07:48:10, 河合英宏 / KAWAI,HIDEHIRO wrote:
> Hi Borislav,
>
> > From: Borislav Petkov [mailto:[email protected]]
> > On Tue, Mar 01, 2016 at 10:50:37AM +0900, Hidehiro Kawai wrote:
> > > Export panic_cpu and nmi_panic_self_stop symbols for modules which
> > > use nmi_panic() macro.
> > >
> > > Signed-off-by: Hidehiro Kawai <[email protected]>
> > > Cc: Andrew Morton <[email protected]>
> > > Cc: Borislav Petkov <[email protected]>
> > > Cc: Thomas Gleixner <[email protected]>
> > > Cc: Michal Hocko <[email protected]>
> > > Cc: HATAYAMA Daisuke <[email protected]>
> > > Cc: Vitaly Kuznetsov <[email protected]>
> > > Cc: Tejun Heo <[email protected]>
> > > ---
> > > kernel/panic.c | 2 ++
> > > 1 file changed, 2 insertions(+)
> > >
> > > diff --git a/kernel/panic.c b/kernel/panic.c
> > > index d96469d..f4e8035 100644
> > > --- a/kernel/panic.c
> > > +++ b/kernel/panic.c
> > > @@ -69,8 +69,10 @@ void __weak nmi_panic_self_stop(struct pt_regs *regs)
> > > {
> > > panic_smp_self_stop();
> > > }
> > > +EXPORT_SYMBOL(nmi_panic_self_stop);
> > >
> > > atomic_t panic_cpu = ATOMIC_INIT(PANIC_CPU_INVALID);
> > > +EXPORT_SYMBOL(panic_cpu);
> >
> > Can we make nmi_panic() at least a proper function and export that
> > instead of exporting all those implementation details...?
>
> The reason I implemented nmi_panic() as a macro is to pass
> variable arguments directly to panic(). Fortunately, since all
> invocations of nmi_panic() just pass a fixed string, I can change it
> to a normal function like:
>
> int nmi_panic(struct pt_regs *regs, const char *msg)
> {
> ...
> panic("%s", msg);
>
> If people don't mind if that, I'll change it.

Yeah, I think this is better. If we ever need a variable strings we can
reconsider.
--
Michal Hocko
SUSE Labs