Re: [RFC PATCH 02/16] x86/split_lock: Handle #AC exception for split lock in kernel mode
From: Fenghua Yu
Date: Sat Jun 23 2018 - 00:21:17 EST
On Fri, Jun 22, 2018 at 12:49:00PM +0200, Thomas Gleixner wrote:
> On Sun, 27 May 2018, Fenghua Yu wrote:
> > +static void wait_for_reexecution(void)
> > +{
> > + while (time_before(jiffies, disable_split_lock_jiffies +
> > + reenable_split_lock_delay))
> > + cpu_relax();
> > +}
> > +
> > +/*
> > + * TEST_CTL MSR is shared among threads on the same core. To simplify
> > + * situation, disable_split_lock_jiffies is global instead of per core.
>
> This patch surely earns extra points in the trainwreck engineering contest,
> but that's not taking place on LKML.
>
> The whole thing is simply:
>
> handle_ac()
> {
> if (user_mode(regs)) {
> do_trap(AC, SIGBUS, ...);
> } else {
> disable_ac_on_local_cpu();
> WARN_ONCE(1);
> }
> }
Should I add kernel parameter or control knob to opt-out the feature?
I'm afraid firmware may hang system after handling split lock if the
feature is enabled by kernel, e.g. "reboot" hits split lock in firmware
and firmware hangs the system after handling #AC.
Thanks.
-Fenghua