Re: [PATCH RFC 01/13] x86: Move posted interrupt descriptor out of vmx code

From: Thomas Gleixner
Date: Wed Dec 06 2023 - 11:33:35 EST


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);

Hmm?

> +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.

Thanks,

tglx