lkml.org 
[lkml]   [2022]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] x86/crash: Disable virt in core NMI crash handler to avoid double list_add
On Thu, May 12, 2022, Sean Christopherson wrote:
> On Thu, May 12, 2022, Thomas Gleixner wrote:
> > Sean,
> >
> > On Wed, May 11 2022 at 23:43, Sean Christopherson wrote:
> > > @@ -840,6 +858,20 @@ void nmi_shootdown_cpus(nmi_shootdown_cb callback)
> > > unsigned long msecs;
> > > local_irq_disable();
> > >
> > > + /*
> > > + * Invoking multiple callbacks is not currently supported, registering
> > > + * the NMI handler twice will cause a list_add() double add BUG().
> > > + * The exception is the "nop" handler in the emergency reboot path,
> > > + * which can run after e.g. kdump's shootdown. Do nothing if the crash
> > > + * handler has already run, i.e. has already prepared other CPUs, the
> > > + * reboot path doesn't have any work of its to do, it just needs to
> > > + * ensure all CPUs have prepared for reboot.
> >
> > This is confusing at best. The double list add is just one part of the
> > problem, which would be trivial enough to fix.
> >
> > The real point is that after the first shoot down all other CPUs are
> > stuck in crash_nmi_callback() and won't respond to the second NMI.
>
> Well that's embarrasingly obvious in hindsight.
>
> >
> > So trying to run this twice is completely pointless and guaranteed to
> > run into the timeout.
> >
> > > + */
> > > + if (shootdown_callback) {
> > > + WARN_ON_ONCE(callback != nmi_shootdown_nop);
> > > + return;
> >
> > Instead of playing games with the callback pointer, I prefer to make
> > this all explicit. Delta patch below.
>
> Much better. If you're planning on doing fixup, can you also include a comment
> tweak about why the callback is left set? If not, I'll do it in v2. A bit
> overkill, but it's another thing that for me was obvious only once I realized "why".

Actually, I'll send a v2, there's some more cleanup that can be done if patch 2
uses cpu_crash_disable_virtualization().

\
 
 \ /
  Last update: 2022-05-12 16:36    [W:0.080 / U:23.344 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site