RE: [PATCH 4/5] platform/x86/intel/ifs: Implement Array BIST test

From: Luck, Tony
Date: Wed Feb 01 2023 - 12:24:26 EST


> > +/* MSR_ARRAY_BIST bit fields */
> > +union ifs_array {
> > + u64 data;
> > + struct {
> > + u32 array_bitmask :32;
> > + u32 array_bank :16;
> > + u32 rsvd :15;
> > + u32 ctrl_result :1;
>
> This isn't going to work well over time, just mask the bits you want off
> properly, don't rely on the compiler to lay them out like this.

What is this "time" issue? This driver is X86_64 specific (and it seems
incredibly unlikely that some other architecture will copy this h/w
interface so closely that they want to re-use this driver. There's an x86_64
ABI that says how bitfields in C are allocated. So should not break moving
to other C compilers.

Is there going to be a "re-write all drivers in Rust" edict coming soon?

> Note, we have bitmask and bitfield operations, please use them.

We do, but code written using them is not as easy to read (unless
you wrap in even more macros, which has its own maintainability
issues).

There are already thousands of bitfields in Linux kernel source:

$ git grep ':[1-9][0-9]*;' -- include/ | wc -l
2251

Has there been a change in attitude at the kernel maintainers summit?

-Tony