Re: [PATCH v3 02/11] x86/irq: Define NMI source vectors

From: Jacob Pan
Date: Mon Jul 01 2024 - 13:11:21 EST



On Sat, 29 Jun 2024 11:32:10 -0700, Xin Li <xin@xxxxxxxxx> wrote:

> On 6/28/2024 1:18 PM, Jacob Pan wrote:
> > When NMI-source reporting is supported, each logical processor maintains
> > a 16-bit NMI-source bitmap. It is up to the system software to assign
> > NMI sources for their matching vector (bit position) in the bitmap.
> >
> > Notice that NMI source vector is in a different namespace than the IDT
> > vectors. Though they share the same programming interface/field in the
> > NMI originator.
> >
> > This initial allocation of the NMI sources are limited to local NMIs in
> > that there is no external device NMI usage yet.
> >
> > Signed-off-by: Jacob Pan <jacob.jun.pan@xxxxxxxxxxxxxxx>
> > ---
> > arch/x86/include/asm/irq_vectors.h | 28 ++++++++++++++++++++++++++++
> > 1 file changed, 28 insertions(+)
> >
> > diff --git a/arch/x86/include/asm/irq_vectors.h
> > b/arch/x86/include/asm/irq_vectors.h index 13aea8fc3d45..e4cd33bc4fef
> > 100644 --- a/arch/x86/include/asm/irq_vectors.h
> > +++ b/arch/x86/include/asm/irq_vectors.h
> > @@ -105,6 +105,34 @@
> >
> > #define NR_VECTORS 256
> >
> > +/*
> > + * The NMI senders specify the NMI source vector as an 8bit integer in
> > their
>
> s/The NMI senders/NMI senders/
will do

> > + * vector field with NMI delivery mode. A local APIC receiving an NMI
> > will
> > + * set the corresponding bit in a 16bit bitmask, which is accumulated
> > until
> > + * the NMI is delivered.
> > + * When a sender didn't specify an NMI source vector the source vector
> > will
> > + * be 0, which will result in bit 0 of the bitmask being set. For out
> > of
> > + * bounds vectors >= 16 bit 0 will also be set.
> > + * When bit 0 is set, system software must invoke all registered NMI
> > handlers
> > + * as if NMI source feature is not enabled.
>
> Add empty lines in the above paragraph.
sounds good.

> > + *
> > + * Vector 2 is reserved for matching IDT NMI vector where it may be
> > hardcoded
> > + * by some external devices.
> > + *
> > + * The NMI source vectors are sorted by descending priority with the
> > exceptions
> > + * of 0 and 2.
> > + */
> > +#define NMI_SOURCE_VEC_UNKNOWN 0
> > +#define NMI_SOURCE_VEC_IPI_REBOOT 1 /* Crash reboot */
> > +#define NMI_SOURCE_VEC_IDT_NMI 2 /* Match IDT
> > NMI vector 2 */ +#define NMI_SOURCE_VEC_IPI_SMP_STOP 3 /*
> > Panic stop CPU */ +#define NMI_SOURCE_VEC_IPI_BT
> > 4 /* CPU backtrace */ +#define NMI_SOURCE_VEC_PMI
> > 5 /* PerfMon counters */ +#define NMI_SOURCE_VEC_IPI_KGDB
> > 6 /* KGDB */ +#define NMI_SOURCE_VEC_IPI_MCE
> > 7 /* MCE injection */ +#define
> > NMI_SOURCE_VEC_IPI_TEST 8 /* For remote and local
> > IPIs */ +#define NR_NMI_SOURCE_VECTORS 9
>
> Fix alignment.
Do you see alignment problem after the patch is applied? Alignment looks
good with vi, emacs, etc. passed checkpatch --strict.

> > +
> > #ifdef CONFIG_X86_LOCAL_APIC
> > #define FIRST_SYSTEM_VECTOR
> > POSTED_MSI_NOTIFICATION_VECTOR #else
>


Thanks,

Jacob