Re: [PATCH v2 2/4] x86/split_lock: Align x86_capability to unsigned long to avoid split locked access

From: Dave Hansen
Date: Fri Jun 29 2018 - 16:48:52 EST


On 06/29/2018 01:38 PM, Fenghua Yu wrote:
> How to handle data that is used in generic code which can be used on
> non-Intel platform? For exmple, if I do this change for struct efi in
> include/linux/efi.h because set_bit() sets bits in efi.flags:
> - unsigned long flags;
> + unsigned long flags __aligned(unsigned long);
> } efi;
>
> People may argue that the alignment unnecessarily increases size of 'efi'
> on non-Intel platform which doesn't have split lock issue. Do we care this
> argument?

Unaligned memory accesses are bad, pretty much universally. This is a
general good practice that we should have been doing anyway. Let folks
complain. Don't let it stop you.

Also, look at the size of that structure. Look at how many pointers it
has. Do you think *anyone* is going to complain about an extra 4 bytes
in a 400-byte structure?

> Another question, there will be a bunch of one-line changes for
> the alignment (i.e. adding __aligned(unsigned long)) in various files.
> Will the changes be put in one big patch or in separate one-liner patches?

Just group them logically.