Re: [PATCH v2 2/6] x86/irq: Extend NMI handler registration interface to include source

From: Jacob Pan
Date: Fri Jun 28 2024 - 00:51:29 EST



On Mon, 24 Jun 2024 16:16:52 -0700, Sohil Mehta <sohil.mehta@xxxxxxxxx>
wrote:

> On 6/11/2024 9:54 AM, Jacob Pan wrote:
> > Add a source vector argument to register_nmi_handler() such that
> > designated NMI originators can leverage NMI source reporting feature.
> > For those who do not use NMI source reporting, 0 (unknown) is used as
> > the source vector. NMI source vectors (up to 16) are pre-defined.
> >
>
> What determines whether a source supports the new reporting vs some that
> don't? It might be useful to add that reasoning to the commit message as
> well.
>
> I am guessing there is some connection to NMI_LOCAL based on
> use_nmi_source() definition but I am not sure.
Yes, this patch only enables NMI source reporting for local interrupts.
There is no use of MSIs delivered as NMI so far. Will add the rationale
here.

> Also, would it be worthwhile to split this patch into 2? One part that
> extents the register_nmi_handler() API and another that allocates the
> source vectors to certain sources.
Good point, will do.
>
> > +static inline bool use_nmi_source(unsigned int type, struct nmiaction
> > *a) +{
> > + return (cpu_feature_enabled(X86_FEATURE_NMI_SOURCE) &&
> > + type == NMI_LOCAL && a->source_vec);
> > +}
> > +
>
> Sohil


Thanks,

Jacob