Re: [PATCH v2 2/4] x86/split_lock: Align x86_capability to unsigned long to avoid split locked access
From: Fenghua Yu
Date: Fri Jun 29 2018 - 16:39:29 EST
On Fri, Jun 29, 2018 at 10:08:59PM +0200, Thomas Gleixner wrote:
> On Fri, 29 Jun 2018, Fenghua Yu wrote:
>
> > On Fri, Jun 29, 2018 at 06:35:39PM +0200, Thomas Gleixner wrote:
> > > On Fri, 29 Jun 2018, Dave Hansen wrote:
> > >
> > > Plus what enforces proper alignment for the other capability related
> > > u32 arrays?
> >
> > Do you want me to enforce unsigned long alignment for all that are used by
> > locked BTS/BTR?
>
> If there are variables which might be unaligned and accessed with locked
> instructions and you have them identified, then why are you asking whether
> they should be fixed?
>
> Ignoring them because they do not trigger #AC right now, is only the
> correct answer if you are a follower of the 'works by chance' cult.
>
> Yeah, I know that most of this industry just works by chance....
>
Ok. I can work on fixing alignment for these instructions in next version.
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?
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?
Thanks.
-Fenghua