* Writing VM Exit handlers in Xen
@ 2010-07-29 8:45 Jonathan White
2010-07-29 8:59 ` George Dunlap
0 siblings, 1 reply; 6+ messages in thread
From: Jonathan White @ 2010-07-29 8:45 UTC (permalink / raw)
To: Xen-devel
[-- Attachment #1.1: Type: text/plain, Size: 407 bytes --]
Hi,
I would like to start write some simple Intel-VT VMExit handlers in Xen -
for e.g. when CPUID is executed, or some other VM Exit condition is
satisfied.
How can I define new VMExit conditions for a Intel-VT based HVM guest
(WinXP) in Xen? and how can I write simple handlers for those conditions?
What is a good place to start in the Xen (or Dom0?) code for the above
requirements?
Thanks a lot,
Jon
[-- Attachment #1.2: Type: text/html, Size: 546 bytes --]
[-- Attachment #2: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Writing VM Exit handlers in Xen
2010-07-29 8:45 Writing VM Exit handlers in Xen Jonathan White
@ 2010-07-29 8:59 ` George Dunlap
2010-07-29 13:16 ` Patrick Colp
0 siblings, 1 reply; 6+ messages in thread
From: George Dunlap @ 2010-07-29 8:59 UTC (permalink / raw)
To: Jonathan White; +Cc: Xen-devel
It sounds like you've already got a basic understanding of how vmexits
work at a high level?
The main vmexit handling code is in
xen/arch/x86/hvm/vmx/vmx.c:vmx_vmexit_handler(). It already has code
to handle cpuid exits. So you'd just need to add code to the cpuid
handling function, possibly enable CPUID vmexits (if they're not
enabled already).
-George
On Thu, Jul 29, 2010 at 9:45 AM, Jonathan White <jonxwhite@gmail.com> wrote:
> Hi,
>
> I would like to start write some simple Intel-VT VMExit handlers in Xen -
> for e.g. when CPUID is executed, or some other VM Exit condition is
> satisfied.
> How can I define new VMExit conditions for a Intel-VT based HVM guest
> (WinXP) in Xen? and how can I write simple handlers for those conditions?
>
> What is a good place to start in the Xen (or Dom0?) code for the above
> requirements?
>
> Thanks a lot,
> Jon
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Writing VM Exit handlers in Xen
2010-07-29 8:59 ` George Dunlap
@ 2010-07-29 13:16 ` Patrick Colp
2010-07-29 15:01 ` Dulloor
0 siblings, 1 reply; 6+ messages in thread
From: Patrick Colp @ 2010-07-29 13:16 UTC (permalink / raw)
To: George Dunlap; +Cc: Jonathan White, Xen-devel
>> I would like to start write some simple Intel-VT VMExit handlers in Xen -
>> for e.g. when CPUID is executed, or some other VM Exit condition is
>> satisfied.
>> How can I define new VMExit conditions for a Intel-VT based HVM guest
>> (WinXP) in Xen? and how can I write simple handlers for those conditions?
You can't define new VMExit conditions. For all the possible exit
conditions, look at Intel's "Intel 64 and IA-32 Architectures Software
Developer's Manual", Volume 3B. In the current (or near current)
edition, you want to look at chapter 24 - VM Exits.
Patrick
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Writing VM Exit handlers in Xen
2010-07-29 13:16 ` Patrick Colp
@ 2010-07-29 15:01 ` Dulloor
2010-07-29 15:30 ` Jonathan White
0 siblings, 1 reply; 6+ messages in thread
From: Dulloor @ 2010-07-29 15:01 UTC (permalink / raw)
To: Patrick Colp; +Cc: George Dunlap, Jonathan White, Xen-devel
You might also want to look at 21.6 (VM Execution controls) for the tunables and
Appendix 1.
-dulloor
On Thu, Jul 29, 2010 at 6:16 AM, Patrick Colp <pjcolp@gmail.com> wrote:
>>> I would like to start write some simple Intel-VT VMExit handlers in Xen -
>>> for e.g. when CPUID is executed, or some other VM Exit condition is
>>> satisfied.
>>> How can I define new VMExit conditions for a Intel-VT based HVM guest
>>> (WinXP) in Xen? and how can I write simple handlers for those conditions?
>
> You can't define new VMExit conditions. For all the possible exit
> conditions, look at Intel's "Intel 64 and IA-32 Architectures Software
> Developer's Manual", Volume 3B. In the current (or near current)
> edition, you want to look at chapter 24 - VM Exits.
>
>
> Patrick
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Writing VM Exit handlers in Xen
2010-07-29 15:01 ` Dulloor
@ 2010-07-29 15:30 ` Jonathan White
2010-07-29 16:09 ` Keir Fraser
0 siblings, 1 reply; 6+ messages in thread
From: Jonathan White @ 2010-07-29 15:30 UTC (permalink / raw)
To: Dulloor, Patrick Colp, George Dunlap, Xen-devel
Thanks so much for your responses.
Yes, I am familiar with the Intel manuals and VT chapters in volume
3B. My question was where to look in the Xen or dom0 code to tweak
what VMExits are enabled in the VMCS of a particular HVM guest, so
that VTx actually traps on those conditions and gives me an
opportunity to handle them in a handler.
Do I modify VMCS structure directly in Xen somewhere, or are there
easier interfaces available for VMCS management?
Sorry, I should have phrased my question better earlier.
Thanks,
Jon
On 7/29/10, Dulloor <dulloor@gmail.com> wrote:
> You might also want to look at 21.6 (VM Execution controls) for the tunables
> and
> Appendix 1.
>
> -dulloor
>
> On Thu, Jul 29, 2010 at 6:16 AM, Patrick Colp <pjcolp@gmail.com> wrote:
>>>> I would like to start write some simple Intel-VT VMExit handlers in Xen
>>>> -
>>>> for e.g. when CPUID is executed, or some other VM Exit condition is
>>>> satisfied.
>>>> How can I define new VMExit conditions for a Intel-VT based HVM guest
>>>> (WinXP) in Xen? and how can I write simple handlers for those
>>>> conditions?
>>
>> You can't define new VMExit conditions. For all the possible exit
>> conditions, look at Intel's "Intel 64 and IA-32 Architectures Software
>> Developer's Manual", Volume 3B. In the current (or near current)
>> edition, you want to look at chapter 24 - VM Exits.
>>
>>
>> Patrick
>>
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@lists.xensource.com
>> http://lists.xensource.com/xen-devel
>>
>
--
Sent from my mobile device
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Re: Writing VM Exit handlers in Xen
2010-07-29 15:30 ` Jonathan White
@ 2010-07-29 16:09 ` Keir Fraser
0 siblings, 0 replies; 6+ messages in thread
From: Keir Fraser @ 2010-07-29 16:09 UTC (permalink / raw)
To: Jonathan White, Dulloor, Patrick Colp, George Dunlap,
"Xen-devel@lists.xensource.com" <Xen-de>
On 29/07/2010 16:30, "Jonathan White" <jonxwhite@gmail.com> wrote:
> Thanks so much for your responses.
> Yes, I am familiar with the Intel manuals and VT chapters in volume
> 3B. My question was where to look in the Xen or dom0 code to tweak
> what VMExits are enabled in the VMCS of a particular HVM guest, so
> that VTx actually traps on those conditions and gives me an
> opportunity to handle them in a handler.
> Do I modify VMCS structure directly in Xen somewhere, or are there
> easier interfaces available for VMCS management?
The intercepts get set up for a new vcpu in
xen/arch/x86/hvm/vmx/vmcs.c:construct_vmcs(). See how certain VMCS control
fields are shadowed in the per-vcpu infor structure. You can also update
these after a vcpu is initialised, and then write the shadow field back to
the VMCS (see for example xen/arch/x86/hvm/vmx/vmx.c:vmx_save_dr() which
updates VMCS field CPU_BASED_VM_EXEC_CONTROL). The vmexits when they occur
are demuxed in xen/arch/x86/hvm/vmx/vmx.c:vmx_vmexit_handler().
K.
> Sorry, I should have phrased my question better earlier.
>
> Thanks,
> Jon
>
>
> On 7/29/10, Dulloor <dulloor@gmail.com> wrote:
>> You might also want to look at 21.6 (VM Execution controls) for the tunables
>> and
>> Appendix 1.
>>
>> -dulloor
>>
>> On Thu, Jul 29, 2010 at 6:16 AM, Patrick Colp <pjcolp@gmail.com> wrote:
>>>>> I would like to start write some simple Intel-VT VMExit handlers in Xen
>>>>> -
>>>>> for e.g. when CPUID is executed, or some other VM Exit condition is
>>>>> satisfied.
>>>>> How can I define new VMExit conditions for a Intel-VT based HVM guest
>>>>> (WinXP) in Xen? and how can I write simple handlers for those
>>>>> conditions?
>>>
>>> You can't define new VMExit conditions. For all the possible exit
>>> conditions, look at Intel's "Intel 64 and IA-32 Architectures Software
>>> Developer's Manual", Volume 3B. In the current (or near current)
>>> edition, you want to look at chapter 24 - VM Exits.
>>>
>>>
>>> Patrick
>>>
>>> _______________________________________________
>>> Xen-devel mailing list
>>> Xen-devel@lists.xensource.com
>>> http://lists.xensource.com/xen-devel
>>>
>>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-07-29 16:09 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-29 8:45 Writing VM Exit handlers in Xen Jonathan White
2010-07-29 8:59 ` George Dunlap
2010-07-29 13:16 ` Patrick Colp
2010-07-29 15:01 ` Dulloor
2010-07-29 15:30 ` Jonathan White
2010-07-29 16:09 ` Keir Fraser
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).