[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aFvymAS-pXMwkmjX@google.com>
Date: Wed, 25 Jun 2025 05:59:04 -0700
From: Sean Christopherson <seanjc@...gle.com>
To: Neeraj Upadhyay <Neeraj.Upadhyay@....com>
Cc: Borislav Petkov <bp@...en8.de>, linux-kernel@...r.kernel.org, tglx@...utronix.de,
mingo@...hat.com, dave.hansen@...ux.intel.com, Thomas.Lendacky@....com,
nikunj@....com, Santosh.Shukla@....com, Vasant.Hegde@....com,
Suravee.Suthikulpanit@....com, David.Kaplan@....com, x86@...nel.org,
hpa@...or.com, peterz@...radead.org, pbonzini@...hat.com, kvm@...r.kernel.org,
kirill.shutemov@...ux.intel.com, huibo.wang@....com, naveen.rao@....com,
francescolavra.fl@...il.com, tiala@...rosoft.com
Subject: Re: [RFC PATCH v7 03/37] x86/apic: KVM: Deduplicate APIC vector =>
register+bit math
On Wed, Jun 25, 2025, Neeraj Upadhyay wrote:
>
>
> On 6/23/2025 5:19 PM, Borislav Petkov wrote:
> > On Tue, Jun 10, 2025 at 11:23:50PM +0530, Neeraj Upadhyay wrote:
> >> diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
> >> index 23d86c9750b9..c84d4e86fe4e 100644
> >> --- a/arch/x86/include/asm/apic.h
> >> +++ b/arch/x86/include/asm/apic.h
> >> @@ -488,11 +488,14 @@ static inline void apic_setup_apic_calls(void) { }
> >>
> >> extern void apic_ack_irq(struct irq_data *data);
> >>
> >> +#define APIC_VECTOR_TO_BIT_NUMBER(v) ((unsigned int)(v) % 32)
> >> +#define APIC_VECTOR_TO_REG_OFFSET(v) ((unsigned int)(v) / 32 * 0x10)
> >
> > Dunno - I'd probably shorten those macro names:
> >
> > APIC_VEC_TO_BITNUM()
> > APIC_VEC_TO_REGOFF()
> >
> > because this way of shortening those words is very common and is still very
> > readable, even if not fully written out...
> >
>
> Sounds good to me. Will change this in next version (will also wait for Sean's
> comment on this).
My vote is for the long names. I find REG_OFFSET in particular to be much more
self-documenting. My brain gets there eventually with REGOFF, but I just don't
see the point in shortening the names. The only uses where line lengths get a
bit too long are apic_set_isr() and apic_clear_isr(), and the lines are still
quite long with the shorter names.
Powered by blists - more mailing lists