Skip to contentSkip to conversation

NMI Race

DISCUSSION Peter Teoh 2 participants 2 messages Aug 2, 2007

lore
Share & tools
lore

Peter Teoh

author
#0 lore raw

I saw the following in xen\arch\x86\domain.c:

/*
* Map Xen segments into every VCPU's GDT, irrespective of whether every
* VCPU will actually be used. This avoids an NMI race during context
* switch: if we take an interrupt after switching CR3 but before switching
* GDT, and the old VCPU# is invalid in the new domain, we would otherwise
* try to load CS from an invalid table.
*/

Can someone please elaborate on this "NMI race"? Ie, Between which functions called, for example?

(X-Ref:
http://osdir.com/ml/emulators.xen.cvs/2005-10/msg00300.html for more details).

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 12 lines · Peter Teoh

I saw the following in xen\arch\x86\domain.c:

/*
* Map Xen segments into every VCPU's GDT, irrespective of whether every
* VCPU will actually be used. This avoids an NMI race during context
* switch: if we take an interrupt after switching CR3 but
before switching
* GDT, and the old VCPU# is invalid in the new domain, we
would otherwise
* try to load CS from an invalid table.
*/
Can someone please elaborate on this "NMI race"? Ie, Between which functions called, for example?

Not sure if there is a "function call" as such - it's more a case of "if someone changes CR3, followed by an NMI", then if not all GDT are in visible on all VCPU's, the NMI will fail because it's trying to read the GDT, and the GDT is unavailable in the memory map pointed to by CR3.

So the race is between setting CR3 and setting GDT and NMI's.

--
Mats

Quoted 8 lines

(X-Ref:
<http://osdir.com/ml/emulators.xen.cvs/2005-10/msg00300.html>http://osdir.com/ml/emulators.xen.cvs/2005-10/msg00300.html for more details).

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel