lkml.org 
[lkml]   [2019]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v5 09/18] x86/split_lock: Handle #AC exception for split lock
From
Date
On 3/12/19 4:00 PM, Fenghua Yu wrote:
> +#ifndef CONFIG_CPU_SUP_INTEL
> DO_ERROR(X86_TRAP_AC, SIGBUS, BUS_ADRALN, NULL, "alignment check", alignment_check)
> +#else
> +dotraplinkage void do_alignment_check(struct pt_regs *regs, long error_code)
> +{
> + unsigned int trapnr = X86_TRAP_AC;
> + char str[] = "alignment check";
> + int signr = SIGBUS;
> +
> + RCU_LOCKDEP_WARN(!rcu_is_watching(), "entry code didn't wake RCU");
> +
> + if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) !=
> + NOTIFY_STOP) {
> + cond_local_irq_enable(regs);
> + if (!user_mode(regs)) {
> + /*
> + * Only split lock can generate #AC from kernel. Warn
> + * and disable #AC for split lock on current CPU.
> + */
> + msr_clear_bit(MSR_TEST_CTL,
> + TEST_CTL_ENABLE_SPLIT_LOCK_DETECT_SHIFT)

I don't see any feature checking here. Don't we need to see if this MSR
is supported?

Shouldn't the code here on systems that don't support split lock
disabling be the same as on CONFIG_CPU_SUP_INTEL=n systems?

> + WARN_ONCE(1, "A split lock issue is detected.\n");
> +
> + return;
> + }
> + /* Handle #AC generated from user code. */
> + do_trap(X86_TRAP_AC, SIGBUS, "alignment check", regs,
> + error_code, BUS_ADRALN, NULL);
> + }
> +}
> +#endif

So... Do we really need an Intel-specific #ifdef for this sucker?

\
 
 \ /
  Last update: 2019-03-13 00:52    [W:0.184 / U:0.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site