All of lore.kernel.org
 help / color / mirror / Atom feed
* Paravirtualization of the "HLT" instruction (for example) on x386
@ 2006-01-12  9:27 Ian Brown
  2006-01-12 10:36 ` Keir Fraser
  0 siblings, 1 reply; 11+ messages in thread
From: Ian Brown @ 2006-01-12  9:27 UTC (permalink / raw)
  To: Xen Mailing List

Hello,

I am trying to understand a little more the paravirtualization
implementation in Xen.
As I understand, when using paravirtualization, we want to
change the behavior of certain instructions.
So for example, we don't want to enable guest domains to
perform "HLT" instruction (which will stop the machine).
And there are other instructions which their
default behavior in ring 1 should  be modified.

So I tried to find where in the Xen-3.0 code it is done.
I saw in vmx.c the vmx_vmexit_do_hlt() method ,which is called
when "HLT" is performed,  but this is relevant when running a
platform with VT-x.
I am looking for tracing where this handling or modifying of
the HLT instruction is done in a usual x386 (non-VTX) processor.

Can anybody please point where in the code of Xen 3.0 this is done
(for x86 processors)?
IB

^ permalink raw reply	[flat|nested] 11+ messages in thread
* RE: Paravirtualization of the "HLT" instruction ( for example) on x386
@ 2006-01-24 13:34 Petersson, Mats
  0 siblings, 0 replies; 11+ messages in thread
From: Petersson, Mats @ 2006-01-24 13:34 UTC (permalink / raw)
  To: Ian Brown, Keir Fraser; +Cc: Xen Mailing List

 

> -----Original Message-----
> From: xen-devel-bounces@lists.xensource.com 
> [mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of Ian Brown
> Sent: 24 January 2006 12:24
> To: Keir Fraser
> Cc: Xen Mailing List
> Subject: Re: [Xen-devel] Paravirtualization of the "HLT" 
> instruction ( for example) on x386
> 
> Hello,
> 
> Thanks for your answer in such a short time !
> 
> I am aware of emulate_privileged_op() in traps.c and also of 
> the emulation of both CLTS and WBINVD in this method.
> 
> you said :
> >GPFs that are not handled by Xen are indeed then passed to the guest 
> >and will end up in the function you mentioned in your email.
> 
> I am not sure about something regarding "are indeed then 
> passed to the guest":
> suppose a guest OS, running in ring 1, issues a privileged 
> instruction (namely, an instruction which causes #GP(0) since 
> it was issued in CPL1 ).
> I don't know if it is possible at all since as I understand 
> such instructions were replaced in the guest OS code. But 
> let's say it's possible, the "passed to the guest" is the 
> point I am trying to get at.
> 
> In such a case, what happens ? there is a #GP(0) of course, 
> but who handles it in the first place ? is it the OS in ring 
> 0 (with it's
> do_general_protection() method in this case ? ) ? or is it 
> the OS in ring 1, which also have do_general_protection() method ?
> 
> and by
> >GPFs that are not handled by Xen are indeed then passed to the guest 
> >and will end up in the function you mentioned in your email.
> 
> you mean that GPFs that occurred in ring 1 will be handled at 
> the first place by the guest ? (or ,what seems to me more 
> unlikely, first by ring0 and then somehow "passed" to the guest)
> 
> Regards,
> IB
> 
> 
The way it works is that the GP fault is taken by Xen, and if Xen
decides that "I don't know what to do with this", for example because
it's an unexpected scenario, it will PASS it to the Guest. I haven't
looked at how the passing is done in Xen's hypervisor - there are
several ways you could do this, for example parsing the IDT of the guest
and making a fake stack-frame for the guest. 

In a hardware virtualized environment, the GP fault would be passed in
the same way as a virtual interrupt is passed to the guest. 

I just noticed that Keir just answered this one too. 

[snip]

--
Mats

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2006-01-28 22:06 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-12  9:27 Paravirtualization of the "HLT" instruction (for example) on x386 Ian Brown
2006-01-12 10:36 ` Keir Fraser
2006-01-12 10:39   ` Ian Brown
2006-01-12 10:58     ` Keir Fraser
2006-01-24 11:27   ` Ian Brown
2006-01-24 11:39     ` Keir Fraser
2006-01-24 12:24       ` Ian Brown
2006-01-24 13:30         ` Keir Fraser
2006-01-28 15:41       ` Mark Ryden
2006-01-28 22:06         ` Anthony Liguori
  -- strict thread matches above, loose matches on Subject: below --
2006-01-24 13:34 Paravirtualization of the "HLT" instruction ( for " Petersson, Mats

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.