Re: [PATCH 1/6] x86: drop unneded members of struct cpuinfo_x86

From: Mathias Krause
Date: Tue Feb 14 2017 - 11:40:52 EST


On 14 February 2017 at 17:17, Borislav Petkov <bp@xxxxxxxxx> wrote:
> On Sun, Feb 12, 2017 at 10:12:07PM +0100, Mathias Krause wrote:
>> Those member serve no purpose -- not even fill padding for alignment or
>> such. So just get rid of them.
>
> Well, almost. You need the wp_works_ok removal patch too, otherwise you
> have the 3 bytes hole below.

Heh, indeed! But only since commit 79a8b9aa388b ("x86/CPU/AMD: Bring
back Compute Unit ID") ;)

> But the wp_works_ok goes away too so I guess that's fine.
>
> $ pahole -C cpuinfo_x86 vmlinux
> struct cpuinfo_x86 {
> __u8 x86; /* 0 1 */
> __u8 x86_vendor; /* 1 1 */
> __u8 x86_model; /* 2 1 */
> __u8 x86_mask; /* 3 1 */
> char wp_works_ok; /* 4 1 */
> __u8 x86_virt_bits; /* 5 1 */
> __u8 x86_phys_bits; /* 6 1 */
> __u8 x86_coreid_bits; /* 7 1 */
> __u8 cu_id; /* 8 1 */
>
> /* XXX 3 bytes hole, try to pack */

The cu_id member is "new". Without it there would be no hole. But,
yeah, without wp_works_ok everything's fine again.

Cheers,
Mathias