[PATCH] mce: use safe MSR accesses

From: jesse.larrew
Date: Wed Mar 11 2015 - 18:52:46 EST


From: Jesse Larrew <jesse.larrew@xxxxxxx>

When running as a guest under kvm, it's possible that the MSR
being accessed may not be implemented. All MSR accesses should
be prepared to handle exceptions.

Signed-off-by: Jesse Larrew <jesse.larrew@xxxxxxx>
---
arch/x86/kernel/cpu/mcheck/mce.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 61a9668ce..4151ba9 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -1556,12 +1556,12 @@ static int __mcheck_cpu_apply_quirks(struct cpuinfo_x86 *c)
wrmsrl(MSR_K7_HWCR, hwcr | BIT(18));

for (i = 0; i < ARRAY_SIZE(msrs); i++) {
- rdmsrl(msrs[i], val);
+ rdmsrl_safe(msrs[i], &val);

/* CntP bit set? */
if (val & BIT_64(62)) {
val &= ~BIT_64(62);
- wrmsrl(msrs[i], val);
+ wrmsrl_safe(msrs[i], val);
}
}

--
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/