Re: [RFC PATCH 02/16] x86/split_lock: Handle #AC exception for split lock in kernel mode
From: Fenghua Yu
Date: Fri Jun 22 2018 - 18:42:30 EST
On Fri, Jun 22, 2018 at 01:59:44PM +0200, Thomas Gleixner wrote:
> On Fri, 22 Jun 2018, Thomas Gleixner wrote:
> > The whole thing is simply:
> >
> > handle_ac()
> > {
> > if (user_mode(regs)) {
> > do_trap(AC, SIGBUS, ...);
> > } else {
> > disable_ac_on_local_cpu();
> > WARN_ONCE(1);
> > }
> > }
> >
> > That wants #AC enabled as early as possible so the kernel gets as much
> > coverage as it can. If it trips in the kernel it's a bug and needs to be
> > fixed and we can them fix ONE by ONE.
>
> That said, #AC is just yet another badly defined and hastily bolted on
> (mis)feature. This should have been:
>
> Bit A: Enable #AC if CPL < 3
> Bit B: Enable #AC if CPL == 3
>
> But that would have been too useful and would allow sensible use of #AC
> without creating software trainwrecks.
>
> Aside of that the spec says:
>
> 31 Disable LOCK# assertion for split locked access.
>
> Can you pretty please make sure that this bit enforces #AC enable? If 31 is
> ever set and such an access happens then the resulting havoc will takes
> ages to decode.
>
> That bit is also mentioned in the SDM with ZERO explanation why it exists
> in the first place and why anyone would ever enable it and without a big
> fat warning about the possible consequences. Can this pretty please be
> fixed?
The bit 31 already exits on all processors. Hardware always sets its value
as zero after power on. It has been legacy for 20 years. It was added for
one customer 20 years ago. Now Intel hardware design team doesn't expect
anyone to set the bit.
Currently Linux kernel doesn't define this bit and doesn't set this bit.
Thanks.
-Fenghua