Early test for Windows vs Linux hvm domain?
Thanks to all for the 32-bit vs 64-bit ideas. Keir's EFER LME bit works like a charm.
Now a probably tougher (and more controversial) question:
Is there any algorithm or heuristic early in hvm launch that can distinguish between a windows guest and a linux guest (64-bit specifically, but if same or different test works for 32-bit that would be useful too).
Thanks,
Dan
Quoted 34 lines
-----Original Message-----
From: Keir Fraser [mailto:[email protected]]
Sent: Wednesday, January 30, 2008 1:21 AM
To: [email protected]; Samuel Thibault
Cc: [email protected]
Subject: Re: [Xen-devel] Early test for 32- vs 64-bit hvm domain?Quoted 1 line · Dan Magenheimer
Quoted 1 line
As long as e.g. Linux has not started (i.e. during bios
and grub for
Quoted 10 lines
Quoted 3 lines
instance), you can't know whether that will be a 64bit Linux or a 32bit
Linux.That's what I was afraid of...
Then what is the earliest point in the execution of an
x86_64domain/vcpu in *xen* wherehvm_long_mode_enabled(v)will work properly? E.g. in Linux/x86_64 is long mode set early in__start? And is this done via a hypercall or an emulated instruction?As sson as you see LME bit get set in the EFER MSR then you know you have a
64-bit guest. Writes to EFER are emulated inlong_mode_do_msr_write()invmx.candsvm.c. Those are the places to patch in Xen 3.1 branch.-- Keir
Quoted 11 lines
Thanks to all for the 32-bit vs 64-bit ideas. Keir's EFER LME bit works like a charm.
Now a probably tougher (and more controversial) question:
Is there any algorithm or heuristic early in hvm launch that can distinguish between a windows guest and a linux guest (64-bit specifically, but if same or different test works for 32-bit that would be useful too).
You may have mentioned it in your other thread, but what exactly is the problem you are trying to solve here?
I would say that the answer is definitely no, depending on what your definition of 'early' is. A hvm domain could invoke grub, and then a user could then choose to run windows or Linux (or BSD, or another OS altogether). Does DOS work under HVM? If it does, a HVM domain could start DOS, the user could spend a bit of time in there, and then later on launch Linux from there.
James
For my purposes, the definition of 'early' is before the launched guest expects to be doing any (accurate) timekeeping.
I'm experimenting with the mechanisms in Xen for handling virtual time. At this point, I'm looking for heuristics, not 100% accuracy, and want to divine in hvm code whether Windows is running or Linux is running (and, yes, I realize there are other possibilities :-)
Thanks,
Dan Magenheimer
If Xen could save time in a bottle / then clocks wouldn't virtually skew / It would save every tick / for VMs that aren't quick /
and Xen then would send them anew
(by Dan Magenheimer... with apologies to the late great Jim Croce)
Quoted 33 lines
-----Original Message-----
From: James Harper [mailto:[email protected]]
Sent: Wednesday, January 30, 2008 5:17 PM
To: [email protected]; Xen-Devel (E-mail)
Subject: RE: [Xen-devel] Early test for Windows vs Linux hvm domain?Quoted 11 lines
Thanks to all for the 32-bit vs 64-bit ideas. Keir's EFER LME bit works like a charm.
Now a probably tougher (and more controversial) question:
Is there any algorithm or heuristic early in hvm launch that can distinguish between a windows guest and a linux guest (64-bit specifically, but if same or different test works for 32-bit that would be useful too).
You may have mentioned it in your other thread, but what exactly is the
problem you are trying to solve here?I would say that the answer is definitely no, depending on what your definition of 'early' is. A hvm domain could invoke grub, and then a user could then choose to run windows or Linux (or BSD, or another OS altogether). Does DOS work under HVM? If it does, a HVM domain could start DOS, the user could spend a bit of time in there, and then later on launch Linux from there.
James