[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c77b3da9-136d-9988-119f-e94c86fd34a3@linux.intel.com>
Date: Fri, 16 Feb 2018 10:44:06 -0800
From: Tim Chen <tim.c.chen@...ux.intel.com>
To: mingo@...nel.org, hpa@...or.com, tglx@...utronix.de,
torvalds@...ux-foundation.org, linux-kernel@...r.kernel.org,
dwmw@...zon.co.uk, peterz@...radead.org,
linux-tip-commits@...r.kernel.org
Subject: Re: [tip:x86/pti] x86/speculation: Use IBRS if available before
calling into firmware
On 02/11/2018 11:19 AM, tip-bot for David Woodhouse wrote:
\
> })
> diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h
> index 300cc15..788c4da 100644
> --- a/arch/x86/include/asm/nospec-branch.h
> +++ b/arch/x86/include/asm/nospec-branch.h
> @@ -162,17 +162,36 @@ static inline void vmexit_fill_RSB(void)
> #endif
> }
>
> +#define alternative_msr_write(_msr, _val, _feature) \
> + asm volatile(ALTERNATIVE("", \
> + "movl %[msr], %%ecx\n\t" \
> + "movl %[val], %%eax\n\t" \
> + "movl $0, %%edx\n\t" \
> + "wrmsr", \
> + _feature) \
> + : : [msr] "i" (_msr), [val] "i" (_val) \
> + : "eax", "ecx", "edx", "memory")
> +
I encountered hang on a machine but not others when using the above
macro. It is probably an alignment thing with ALTERNATIVE as the problem went
away after I made the change below:
Tim
diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h
index 8f2ff74..0f65bd2 100644
--- a/arch/x86/include/asm/nospec-branch.h
+++ b/arch/x86/include/asm/nospec-branch.h
@@ -148,6 +148,7 @@ extern char __indirect_thunk_end[];
#define alternative_msr_write(_msr, _val, _feature) \
asm volatile(ALTERNATIVE("", \
+ ".align 16\n\t" \
"movl %[msr], %%ecx\n\t" \
"movl %[val], %%eax\n\t" \
"movl $0, %%edx\n\t" \
Powered by blists - more mailing lists