[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231207205431.75a214c2@jacob-builder>
Date: Thu, 7 Dec 2023 20:54:31 -0800
From: Jacob Pan <jacob.jun.pan@...ux.intel.com>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: LKML <linux-kernel@...r.kernel.org>, X86 Kernel <x86@...nel.org>,
iommu@...ts.linux.dev, Lu Baolu <baolu.lu@...ux.intel.com>,
kvm@...r.kernel.org, Dave Hansen <dave.hansen@...el.com>,
Joerg Roedel <joro@...tes.org>,
"H. Peter Anvin" <hpa@...or.com>, Borislav Petkov <bp@...en8.de>,
Ingo Molnar <mingo@...hat.com>,
Raj Ashok <ashok.raj@...el.com>,
"Tian, Kevin" <kevin.tian@...el.com>, maz@...nel.org,
peterz@...radead.org, seanjc@...gle.com,
Robin Murphy <robin.murphy@....com>,
jacob.jun.pan@...ux.intel.com
Subject: Re: [PATCH RFC 01/13] x86: Move posted interrupt descriptor out of
vmx code
Hi Thomas,
On Wed, 06 Dec 2023 17:33:28 +0100, Thomas Gleixner <tglx@...utronix.de>
wrote:
> On Sat, Nov 11 2023 at 20:16, Jacob Pan wrote:
> > +/* Posted-Interrupt Descriptor */
> > +struct pi_desc {
> > + u32 pir[8]; /* Posted interrupt requested */
> > + union {
> > + struct {
> > + /* bit 256 - Outstanding Notification
> > */
> > + u16 on : 1,
> > + /* bit 257 - Suppress Notification */
> > + sn : 1,
> > + /* bit 271:258 - Reserved */
> > + rsvd_1 : 14;
> > + /* bit 279:272 - Notification Vector */
> > + u8 nv;
> > + /* bit 287:280 - Reserved */
> > + u8 rsvd_2;
> > + /* bit 319:288 - Notification
> > Destination */
> > + u32 ndst;
>
> This mixture of bitfields and types is weird and really not intuitive:
>
> /* Posted-Interrupt Descriptor */
> struct pi_desc {
> /* Posted interrupt requested */
> u32 pir[8];
>
> union {
> struct {
> /* bit 256 - Outstanding Notification */
> u64 on : 1,
> /* bit 257 - Suppress Notification */
> sn : 1,
> /* bit 271:258 - Reserved */
> : 14,
> /* bit 279:272 - Notification Vector */
> nv : 8,
> /* bit 287:280 - Reserved */
> : 8,
> /* bit 319:288 - Notification Destination
> */ ndst : 32;
> };
> u64 control;
> };
> u32 rsvd[6];
> } __aligned(64);
>
It seems bit-fields cannot pass type check. I got these compile error.
arch/x86/kernel/irq.c: In function ‘intel_posted_msi_init’:
./include/linux/percpu-defs.h:363:20: error: cannot take address of bit-field ‘nv’
363 | __verify_pcpu_ptr(&(variable)); \
| ^
./include/linux/percpu-defs.h:219:47: note: in definition of macro ‘__verify_pcpu_ptr’
219 | const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \
| ^~~
./include/linux/percpu-defs.h:490:34: note: in expansion of macro ‘__pcpu_size_call’
490 | #define this_cpu_write(pcp, val) __pcpu_size_call(this_cpu_write_, pcp, val)
| ^~~~~~~~~~~~~~~~
arch/x86/kernel/irq.c:358:2: note: in expansion of macro ‘this_cpu_write’
358 | this_cpu_write(posted_interrupt_desc.nv, POSTED_MSI_NOTIFICATION_VECTOR);
| ^~~~~~~~~~~~~~
./include/linux/percpu-defs.h:364:15: error: ‘sizeof’ applied to a bit-field
364 | switch(sizeof(variable)) { \
>
> > +static inline bool pi_test_and_set_on(struct pi_desc *pi_desc)
> > +{
> > + return test_and_set_bit(POSTED_INTR_ON,
> > + (unsigned long *)&pi_desc->control);
>
> Please get rid of those line breaks.
will do.
Thanks,
Jacob
Powered by blists - more mailing lists