提交 4985ce15 编写于 作者: A Andy Lutomirski 提交者: Ingo Molnar

x86/paravirt: Make "unsafe" MSR accesses unsafe even if PARAVIRT=y

Enabling CONFIG_PARAVIRT had an unintended side effect: rdmsr() turned
into rdmsr_safe() and wrmsr() turned into wrmsr_safe(), even on bare
metal.  Undo that by using the new unsafe paravirt MSR callbacks.
Tested-by: NBoris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: NAndy Lutomirski <luto@kernel.org>
Acked-by: NLinus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: KVM list <kvm@vger.kernel.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: xen-devel <Xen-devel@lists.xen.org>
Link: http://lkml.kernel.org/r/414fabd6d3527703077c6c2a797223d0a9c3b081.1459605520.git.luto@kernel.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
上级 dd2f4a00
...@@ -152,24 +152,21 @@ static inline int paravirt_write_msr_safe(unsigned msr, ...@@ -152,24 +152,21 @@ static inline int paravirt_write_msr_safe(unsigned msr,
return PVOP_CALL3(int, pv_cpu_ops.write_msr_safe, msr, low, high); return PVOP_CALL3(int, pv_cpu_ops.write_msr_safe, msr, low, high);
} }
/* These should all do BUG_ON(_err), but our headers are too tangled. */
#define rdmsr(msr, val1, val2) \ #define rdmsr(msr, val1, val2) \
do { \ do { \
int _err; \ u64 _l = paravirt_read_msr(msr); \
u64 _l = paravirt_read_msr_safe(msr, &_err); \
val1 = (u32)_l; \ val1 = (u32)_l; \
val2 = _l >> 32; \ val2 = _l >> 32; \
} while (0) } while (0)
#define wrmsr(msr, val1, val2) \ #define wrmsr(msr, val1, val2) \
do { \ do { \
paravirt_write_msr_safe(msr, val1, val2); \ paravirt_write_msr(msr, val1, val2); \
} while (0) } while (0)
#define rdmsrl(msr, val) \ #define rdmsrl(msr, val) \
do { \ do { \
int _err; \ val = paravirt_read_msr(msr); \
val = paravirt_read_msr_safe(msr, &_err); \
} while (0) } while (0)
static inline void wrmsrl(unsigned msr, u64 val) static inline void wrmsrl(unsigned msr, u64 val)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册