RE: [PATCH] mce: use safe MSR accesses

From: Luck, Tony
Date: Wed Mar 11 2015 - 18:47:14 EST


> 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.

Isn't that a KVM bug? The code here first checks family/model before accessing the MSR:

if (c->x86 == 0x15 &&
(c->x86_model >= 0x10 && c->x86_model <= 0x1f)) {

If kvm tells the guest that it is running on one of these models, shouldn't it provide
complete coverage for that model?

If that isn't possible - then you should still do more than just s/rdmsrl/rdmsrl_safe/ ... like
check the return value to see whether you got an exception .. and thus should skip past
code that uses the "val" that you thought you read from the non-existent MSR.

-Tony

--
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/