mce_wrmsr() and (at least) HVM guests
With mce_wrmsr() not permitting to write other than all zeroes or all ones to MCG_CTL and MCn_CTL, it is not possible for guests to implement workarounds (see the one in mce_cpu_quirks() which has been present in Linux versions for a very long time). While one could expect PV guests to be aware of that (and avoid the workaround), HVM guests clearly can't be expected to. Thus the question is whether the handling should be made a little more permissive.
Initially I had thought of just making Xen check whether the bit(s) in question are also off in the physical MSR, but that would imply that Xen always has implemented at least all of the workarounds any guest may know of. I'm not sure I have a good other idea, short of allowing all writes to succeed.
Jan
Jan,
IMO, mce_wrmsr() shouldn't return -1 as a workaround, which leads to a #GP in the
guest, at lease in MSR_IA32_MCG_CTL writting. Pnerhaps, it happens with IOMMU ad the GART.
-James Song (wei)
Quoted 24 lines · Jan Beulich
With
mce_wrmsr()not permitting to write other than all zeroes or all ones toMCG_CTLandMCn_CTL, it is not possible for guests to implement workarounds (see the one inmce_cpu_quirks()which has been present in Linux versions for a very long time). While one could expect PV guests to be aware of that (and avoid the workaround), HVM guests clearly can't be expected to. Thus the question is whether the handling should be made a little more permissive.Initially I had thought of just making Xen check whether the bit(s) in question are also off in the physical MSR, but that would imply that Xen always has implemented at least all of the workarounds any guest may know of. I'm not sure I have a good other idea, short of allowing all writes to succeed.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Signature · 2 lines
View this message in context: http://old.nabble.com/mce_wrmsr%28%29-and-%28at-least%29-HVM-guests-tp26590226p26604136.html Sent from the Xen - Dev mailing list archive at Nabble.com.
Quoted 9 lines
Quoted 1 line
Quoted 1 line
"Jan Beulich" <[email protected]> 01.12.09 12:19 >>>
With
mce_wrmsr()not permitting to write other than all zeroes or all ones toMCG_CTLandMCn_CTL, it is not possible for guests to implement workarounds (see the one inmce_cpu_quirks()which has been present in Linux versions for a very long time). While one could expect PV guests to be aware of that (and avoid the workaround), HVM guests clearly can't be expected to. Thus the question is whether the handling should be made a little more permissive.
Quoted 5 lines
Initially I had thought of just making Xen check whether the bit(s) in question are also off in the physical MSR, but that would imply that Xen always has implemented at least all of the workarounds any guest may know of. I'm not sure I have a good other idea, short of allowing all writes to succeed.
Ping?
Jan
Jan, sorry for no response for this. It is not in my inbox, maybe is put into my junkmail box. (Really strange that some xen-devel mail will be put into junkmail, including my patch submission mail).
I think it is different for MCG_CTL and MCn_CTL:
For MCG_CTL, the SDM spec stated: "IA32_MCG_CTL controls the reporting of machine-check exceptions. If present, writing 1s to this register enables machine-check features and writing all 0s disables machine-check features. All other values are undefined and/or implementation specific.". So I assume current implementation is ok.
For MCn_CTL, the spec only stated that "P6 family processors only allow the writing of all 1s or all 0s to the IA32_MCi_CTL MSR". So yes, current implementation is over-killed, especially I think we should not care about P6 family in Xen environment.
But the mce_cpu_quirks() give remind me if we should still split the Intel/AMD MCE msr virtualization? For example, will AMD platform allow IA32_MCE_CTL to be not all 1s and 0s?
And also another potential issue raised out. For example, guest has clear one bit in MCn_CTL while physically it is enabled. If a error corresponding to this bit really happen, at least we should not inject a vMCE to guest. We will either kill the guest, or let the guest continues, depends on the error type .
I can cook patches for these issues, after I resolve the vMCE to pvops dom0, hopefully early next week.
--jyh
Quoted 25 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, December 22, 2009 9:03 PM
To: Ke, Liping; Jiang, Yunhong
Cc: [email protected]
Subject: Re: [Xen-devel]mce_wrmsr()and (at least) HVM guestsQuoted 9 lines
Quoted 1 line
Quoted 1 line
"Jan Beulich" <[email protected]> 01.12.09 12:19 >>>
With
mce_wrmsr()not permitting to write other than all zeroes or all ones toMCG_CTLandMCn_CTL, it is not possible for guests to implement workarounds (see the one inmce_cpu_quirks()which has been present in Linux versions for a very long time). While one could expect PV guests to be aware of that (and avoid the workaround), HVM guests clearly can't be expected to. Thus the question is whether the handling should be made a little more permissive.Quoted 5 lines
Initially I had thought of just making Xen check whether the bit(s) in question are also off in the physical MSR, but that would imply that Xen always has implemented at least all of the workarounds any guest may know of. I'm not sure I have a good other idea, short of allowing all writes to succeed.
Ping?
Jan
Quoted 7 lines
Quoted 1 line
Quoted 1 line
"Jiang, Yunhong" <[email protected]> 23.12.09 04:22 >>>
I think it is different for
MCG_CTLandMCn_CTL:
ForMCG_CTL, the SDM spec stated: "IA32_MCG_CTLcontrols the reporting of machine-check exceptions. If present, writing 1s to this register enables machine-check features and writing all 0s disables machine-check features. All other values are undefined and/or implementation specific.". So I assume current implementation is ok.
I tend to disagree, based on the "and/or implementation specific": As long as model specific information is available to the kernel, it may validly write other values - as is happening for the specific AMD case.
Quoted 4 lines
For
MCn_CTL, the spec only stated that "P6 family processors only allow the writing of all 1s or all 0s to theIA32_MCi_CTLMSR". So yes, current implementation is over-killed, especially I think we should not care about P6 family in Xen environment.
I agree here.
Quoted 3 lines
But the
mce_cpu_quirks()give remind me if we should still split the Intel/AMD MCE msr virtualization? For example, will AMD platform allowIA32_MCE_CTLto be not all 1s and 0s?
I don't think so, as per the above.
Quoted 5 lines
And also another potential issue raised out. For example, guest has clear one bit in
MCn_CTLwhile physically it is enabled. If a error corresponding to this bit really happen, at least we should not inject a vMCE to guest. We will either kill the guest, or let the guest continues, depends on the error type .
Yes, this would make sense, albeit it seems overkill to me - there shouldn't really be disagreement in how specific models get handled. Instead, perhaps an unprivileged guest should be permitted to write zero bits wherever the underlying real register has them clear (as read back from hardware, not as written by Xen or dom0).
Quoted 2 lines
I can cook patches for these issues, after I resolve the vMCE to pvops dom0, hopefully early next week.
That would be great, thanks.
Jan
Quoted 16 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Monday, January 04, 2010 4:09 PM
To: Jiang, Yunhong
Cc: Ke, Liping; [email protected]
Subject: RE: [Xen-devel]mce_wrmsr()and (at least) HVM guestsQuoted 7 lines
Quoted 1 line
Quoted 1 line
"Jiang, Yunhong" <[email protected]> 23.12.09 04:22 >>>
I think it is different for
MCG_CTLandMCn_CTL:
ForMCG_CTL, the SDM spec stated: "IA32_MCG_CTLcontrols the reporting of machine-check exceptions. If present, writing 1s to this register enables machine-check features and writing all 0s disables machine-check features. All other values are undefined and/or implementation specific.". So I assume current implementation is ok.
Quoted 3 lines
I tend to disagree, based on the "and/or implementation specific": As long as model specific information is available to the kernel, it may validly write other values - as is happening for the specific AMD case.
Hmm, this make sense, originally I thought it's AMD specific.
Quoted 6 lines
Quoted 5 lines
For
MCn_CTL, the spec only stated that "P6 family processors only allow the writing of all 1s or all 0s to theIA32_MCi_CTLMSR". So yes, current implementation is over-killed, especially I think we should not care about P6 family in Xen environment.
Quoted 7 lines
I agree here.
Quoted 3 lines
But the
mce_cpu_quirks()give remind me if we should still split the Intel/AMD MCE msr virtualization? For example, will AMD platform allowIA32_MCE_CTLto be not all 1s and 0s?I don't think so, as per the above.
Agree.
Quoted 7 lines
Quoted 6 lines
And also another potential issue raised out. For example, guest has clear one bit in
MCn_CTLwhile physically it is enabled. If a error corresponding to this bit really happen, at least we should not inject a vMCE to guest. We will either kill the guest, or let the guest continues, depends on the error type .
Quoted 5 lines
Yes, this would make sense, albeit it seems overkill to me - there shouldn't really be disagreement in how specific models get handled. Instead, perhaps an unprivileged guest should be permitted to write zero bits wherever the underlying real register has them clear (as read back from hardware, not as written by Xen or dom0).
What do you mean of "write zero bits wherever the underlying real register has them clear"?
Quoted 5 lines
Quoted 3 lines
I can cook patches for these issues, after I resolve the vMCE to pvops dom0, hopefully early next week.
That would be great, thanks.
I'm working on this now.
--jyh
Quoted 2 lines
Jan
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
"Jiang, Yunhong" <[email protected]> 04.01.10 09:31 >>> And also another potential issue raised out. For example, guest has clear one bit in
MCn_CTLwhile physically it is enabled. If a error corresponding to this bit really happen, at least we should not inject a vMCE to guest. We will either kill the guest, or let the guest continues, depends on the error type .
Quoted 8 lines
Quoted 5 lines
Yes, this would make sense, albeit it seems overkill to me - there shouldn't really be disagreement in how specific models get handled. Instead, perhaps an unprivileged guest should be permitted to write zero bits wherever the underlying real register has them clear (as read back from hardware, not as written by Xen or dom0).
What do you mean of "write zero bits wherever the underlying real register has them clear"?
Writing e.g. all 1s into any of these registers doesn't mean you'd read back all 1s. Hence, writing zero into read-only (always zero) bits should be permitted as well as writing zero into bits that dom0 cleared explicitly.
Jan