Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1348333
| From | Guenter Roeck <linux@roeck-us.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [v2 PATCH 1/3] panic: Change nmi_panic from macro to function |
| Date | 2016-03-02 18:10 +0100 |
| Message-ID | <r8irE-2bo-13@gated-at.bofh.it> (permalink) |
| References | <r8cvT-6qw-3@gated-at.bofh.it> <r8cvT-6qw-11@gated-at.bofh.it> <r8eR3-84M-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 03/02/2016 05:18 AM, Michal Hocko wrote:
> 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 */
I am also not too happy with this additional stack allocation.
panic() itself takes varargs. Can those be passed on ?
I understand this would need something like vpanic(), so
maybe that isn't feasible.
Dropping the format, at least for now, might be a simpler option.
Guenter
>> + 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
>>
>>
>
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[v2 PATCH 0/3] Use nmi_panic() in panic on NMI case Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com> - 2016-03-02 11:50 +0100
[v2 PATCH 2/3] ipmi/watchdog: Use nmi_panic() when kernel panics in NMI handler Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com> - 2016-03-02 11:50 +0100
[v2 PATCH 1/3] panic: Change nmi_panic from macro to function Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com> - 2016-03-02 11:50 +0100
Re: [v2 PATCH 1/3] panic: Change nmi_panic from macro to function Michal Hocko <mhocko@kernel.org> - 2016-03-02 14:20 +0100
Re: [v2 PATCH 1/3] panic: Change nmi_panic from macro to function Borislav Petkov <bp@alien8.de> - 2016-03-02 14:30 +0100
RE: [v2 PATCH 1/3] panic: Change nmi_panic from macro to function 河合英宏 / KAWAI,HIDEHIRO <hidehiro.kawai.ez@hitachi.com> - 2016-03-03 02:30 +0100
Re: [v2 PATCH 1/3] panic: Change nmi_panic from macro to function Guenter Roeck <linux@roeck-us.net> - 2016-03-02 18:10 +0100
csiph-web