RE: [PATCH 1/1] x86/irq: Add hardcoded hypervisor interrupts to /proc/stat

From: Michael Kelley (LINUX)
Date: Thu Apr 13 2023 - 19:20:45 EST


From: Michael Kelley (LINUX) <mikelley@xxxxxxxxxxxxx> Sent: Thursday, March 23, 2023 10:36 AM
>
> From: Sean Christopherson <seanjc@xxxxxxxxxx> Sent: Wednesday, March 22, 2023
> 6:27 PM
> >
> > On Wed, Mar 22, 2023, Michael Kelley (LINUX) wrote:
> > > From: Dave Hansen <dave.hansen@xxxxxxxxx> Sent: Wednesday, March 22, 2023
> > 11:07 AM
> > > >
> > > > On 2/27/23 10:46, Michael Kelley wrote:
> > > > > diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
> > > > > index 766ffe3..9f668d2 100644
> > > > > --- a/arch/x86/kernel/irq.c
> > > > > +++ b/arch/x86/kernel/irq.c
> > > > > @@ -211,6 +211,13 @@ u64 arch_irq_stat_cpu(unsigned int cpu)
> > > > > #ifdef CONFIG_X86_MCE_THRESHOLD
> > > > > sum += irq_stats(cpu)->irq_threshold_count;
> > > > > #endif
> > > > > +#ifdef CONFIG_X86_HV_CALLBACK_VECTOR
> > > > > + sum += irq_stats(cpu)->irq_hv_callback_count;
> > > > > +#endif
> > > > > +#if IS_ENABLED(CONFIG_HYPERV)
> > > > > + sum += irq_stats(cpu)->irq_hv_reenlightenment_count;
> > > > > + sum += irq_stats(cpu)->hyperv_stimer0_count;
> > > > > +#endif
> > > > > #ifdef CONFIG_X86_MCE
> > > > > sum += per_cpu(mce_exception_count, cpu);
> > > > > sum += per_cpu(mce_poll_count, cpu);
> > > >
> > > > This seems fine, especially since arch_show_interrupts() has them. But,
> > > > what's with the "#if IS_ENABLED" versus the plain #ifdef? Is there some
> > > > difference I'm missing? Why not just be consistent with the other code
> > > > and use a plain #ifdef for both?
> > >
> > > I'm following the coding pattern in arch_show_interrupts(), in irq_cpustat_t,
> > > and most other places that test CONFIG_HYPERV. Maybe all those existing
> > > cases are a mis-application of Documentation/process/coding-style.rst
> > > Section 21, which prefers "if (IS_ENABLED(CONFIG_HYPERV))" over
> > > "#ifdef CONFIG_HYPERV". "#if IS_ENABLED()" is not the same as
> > > "if (IS_ENABLED())". :-)
> > >
> > > Net, I don't have a strong preference either way.
> >
> > Using IS_ENABLED() is mandatory because CONFIG_HYPERV is a tri-state, i.e. can
> > be a module and thus #define CONFIG_HYPER_MODULE instead of CONFIG_HYPERV.
>
> Ah, right. Thanks.
>

x86 maintainers: Any issues with picking up this patch for the 6.4 merge window?

Michael