* [PATCH] Clear VMCS if reusing after vcpu reset
@ 2007-04-30 6:09 Tian, Kevin
2007-04-30 6:41 ` Keir Fraser
2007-04-30 7:12 ` Keir Fraser
0 siblings, 2 replies; 10+ messages in thread
From: Tian, Kevin @ 2007-04-30 6:09 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Type: text/plain, Size: 226 bytes --]
Clear whole page when VMCS is reused due to cpu hotplug.
construct_vmcs doesn't take care of all fields and some stale
content may make hardware unhappy.
Signed-off-by Kevin Tian <kevin.tian@intel.com>
Thanks,
Kevin
[-- Attachment #2: vmcs_clear_for_vcpu_reset.patch --]
[-- Type: application/octet-stream, Size: 821 bytes --]
Clear whole page when VMCS is reused due to cpu hotplug.
construct_vmcs doesn't take care of all fields and some stale
content may make hardware unhappy.
Signed-off-by Kevin Tian <kevin.tian@intel.com>
diff -r d6973889288f -r ce3cbcacd650 xen/arch/x86/hvm/vmx/vmcs.c
--- a/xen/arch/x86/hvm/vmx/vmcs.c Thu Apr 19 14:03:10 2007 -0400
+++ b/xen/arch/x86/hvm/vmx/vmcs.c Thu Apr 19 14:13:16 2007 -0400
@@ -468,10 +468,14 @@ int vmx_create_vmcs(struct vcpu *v)
{
if ( (v->arch.hvm_vmx.vmcs = vmx_alloc_vmcs()) == NULL )
return -ENOMEM;
-
- __vmx_clear_vmcs(v);
- }
-
+ }
+ else
+ {
+ memset(v->arch.hvm_vmx.vmcs, 0, PAGE_SIZE);
+ v->arch.hvm_vmx.vmcs->vmcs_revision_id = vmcs_revision_id;
+ }
+
+ __vmx_clear_vmcs(v);
construct_vmcs(v);
return 0;
[-- Attachment #3: 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] 10+ messages in thread* Re: [PATCH] Clear VMCS if reusing after vcpu reset
2007-04-30 6:09 [PATCH] Clear VMCS if reusing after vcpu reset Tian, Kevin
@ 2007-04-30 6:41 ` Keir Fraser
2007-04-30 6:45 ` Tian, Kevin
2007-04-30 7:12 ` Keir Fraser
1 sibling, 1 reply; 10+ messages in thread
From: Keir Fraser @ 2007-04-30 6:41 UTC (permalink / raw)
To: Tian, Kevin, xen-devel
On 30/4/07 07:09, "Tian, Kevin" <kevin.tian@intel.com> wrote:
> Clear whole page when VMCS is reused due to cpu hotplug.
> construct_vmcs doesn't take care of all fields and some stale
> content may make hardware unhappy.
>
> Signed-off-by Kevin Tian <kevin.tian@intel.com>
Which hotplug would that be? I can't see how vmx_create_vmcs() can be called
more than once for any vcpu. It's called during vcpu creation and that's it
afaics. The current check for v->arch.hvm_vmx.vmcs==NULL is therefore
redundant.
-- Keir
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH] Clear VMCS if reusing after vcpu reset
2007-04-30 6:41 ` Keir Fraser
@ 2007-04-30 6:45 ` Tian, Kevin
2007-04-30 6:48 ` Li, Xin B
2007-04-30 7:00 ` Keir Fraser
0 siblings, 2 replies; 10+ messages in thread
From: Tian, Kevin @ 2007-04-30 6:45 UTC (permalink / raw)
To: Keir Fraser, xen-devel
>From: Keir Fraser [mailto:Keir.Fraser@cl.cam.ac.uk]
>Sent: 2007年4月30日 14:41
>On 30/4/07 07:09, "Tian, Kevin" <kevin.tian@intel.com> wrote:
>
>> Clear whole page when VMCS is reused due to cpu hotplug.
>> construct_vmcs doesn't take care of all fields and some stale
>> content may make hardware unhappy.
>>
>> Signed-off-by Kevin Tian <kevin.tian@intel.com>
>
>Which hotplug would that be? I can't see how vmx_create_vmcs() can
>be called
>more than once for any vcpu. It's called during vcpu creation and that's it
>afaics. The current check for v->arch.hvm_vmx.vmcs==NULL is
>therefore
>redundant.
>
> -- Keir
Within HVM domain:
Echo "0" > /sys/devices/system/cpu/cpuN/online;
Echo "1" > /sys/devices/system/cpu/cpuN/online;
Hvm_vcpu_reset is invoked as the result of receiving vINIT, which
then goes to hvm_vcpu_initialise, vmx_vcpu_initialise,
vmx_create_vmcs.
Thanks,
Kevin
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH] Clear VMCS if reusing after vcpu reset
2007-04-30 6:45 ` Tian, Kevin
@ 2007-04-30 6:48 ` Li, Xin B
2007-04-30 7:00 ` Keir Fraser
1 sibling, 0 replies; 10+ messages in thread
From: Li, Xin B @ 2007-04-30 6:48 UTC (permalink / raw)
To: Tian, Kevin, Keir Fraser, xen-devel
>>Which hotplug would that be? I can't see how vmx_create_vmcs() can be
called
>>more than once for any vcpu. It's called during vcpu creation and
that's it
>>afaics. The current check for v->arch.hvm_vmx.vmcs==NULL is therefore
>>redundant.
>>
After Xen 3.0.5, renaming is needed :-)
>Within HVM domain:
>Echo "0" > /sys/devices/system/cpu/cpuN/online;
>Echo "1" > /sys/devices/system/cpu/cpuN/online;
>
>Hvm_vcpu_reset is invoked as the result of receiving vINIT, which
>then goes to hvm_vcpu_initialise, vmx_vcpu_initialise, vmx_create_vmcs.
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Clear VMCS if reusing after vcpu reset
2007-04-30 6:45 ` Tian, Kevin
2007-04-30 6:48 ` Li, Xin B
@ 2007-04-30 7:00 ` Keir Fraser
1 sibling, 0 replies; 10+ messages in thread
From: Keir Fraser @ 2007-04-30 7:00 UTC (permalink / raw)
To: Tian, Kevin, xen-devel
On 30/4/07 07:45, "Tian, Kevin" <kevin.tian@intel.com> wrote:
> Within HVM domain:
> Echo "0" > /sys/devices/system/cpu/cpuN/online;
> Echo "1" > /sys/devices/system/cpu/cpuN/online;
>
> Hvm_vcpu_reset is invoked as the result of receiving vINIT, which
> then goes to hvm_vcpu_initialise, vmx_vcpu_initialise,
> vmx_create_vmcs.
Ah. Ok. :-)
-- Keir
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Clear VMCS if reusing after vcpu reset
2007-04-30 6:09 [PATCH] Clear VMCS if reusing after vcpu reset Tian, Kevin
2007-04-30 6:41 ` Keir Fraser
@ 2007-04-30 7:12 ` Keir Fraser
2007-04-30 7:19 ` Tian, Kevin
1 sibling, 1 reply; 10+ messages in thread
From: Keir Fraser @ 2007-04-30 7:12 UTC (permalink / raw)
To: Tian, Kevin, xen-devel
On 30/4/07 07:09, "Tian, Kevin" <kevin.tian@intel.com> wrote:
> Clear whole page when VMCS is reused due to cpu hotplug.
> construct_vmcs doesn't take care of all fields and some stale
> content may make hardware unhappy.
You almost certainly need to vmx_clear_vmcs() before you zap it, as there's
no reason it might not be active on some CPU when vmx_create_vmcs() is
called (domain_pause() does not deactivate VMCSs).
Furthermore, this need to zap the page a second time is worrying. We only
modify architectural state in the VMCS in a well-defined way. That shouldn't
upset the hardware. Is this actually an indication that there is some
architectural state that we are forgetting to re-initialise? If so then
that's the bug which should be fixed.
-- Keir
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH] Clear VMCS if reusing after vcpu reset
2007-04-30 7:12 ` Keir Fraser
@ 2007-04-30 7:19 ` Tian, Kevin
2007-04-30 7:25 ` Keir Fraser
0 siblings, 1 reply; 10+ messages in thread
From: Tian, Kevin @ 2007-04-30 7:19 UTC (permalink / raw)
To: Keir Fraser, xen-devel
>From: Keir Fraser [mailto:Keir.Fraser@cl.cam.ac.uk]
>Sent: 2007年4月30日 15:12
>
>On 30/4/07 07:09, "Tian, Kevin" <kevin.tian@intel.com> wrote:
>
>> Clear whole page when VMCS is reused due to cpu hotplug.
>> construct_vmcs doesn't take care of all fields and some stale
>> content may make hardware unhappy.
>
>You almost certainly need to vmx_clear_vmcs() before you zap it, as
>there's
>no reason it might not be active on some CPU when vmx_create_vmcs()
>is
>called (domain_pause() does not deactivate VMCSs).
You're exactly right. :-)
>
>Furthermore, this need to zap the page a second time is worrying. We
>only
>modify architectural state in the VMCS in a well-defined way. That
>shouldn't
>upset the hardware. Is this actually an indication that there is some
>architectural state that we are forgetting to re-initialise? If so then
>that's the bug which should be fixed.
>
Does construct_vmcs need to explicitly care all fields if hardware
just expects a zero there which can be satisfied by memset()? Anyway,
I'll take a deeper look to check which unexpected fields are with stale
content before reset.
Thanks,
Kevin
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Clear VMCS if reusing after vcpu reset
2007-04-30 7:19 ` Tian, Kevin
@ 2007-04-30 7:25 ` Keir Fraser
2007-04-30 7:32 ` Tian, Kevin
0 siblings, 1 reply; 10+ messages in thread
From: Keir Fraser @ 2007-04-30 7:25 UTC (permalink / raw)
To: Tian, Kevin, xen-devel
On 30/4/07 08:19, "Tian, Kevin" <kevin.tian@intel.com> wrote:
>> Furthermore, this need to zap the page a second time is worrying. We
>> only
>> modify architectural state in the VMCS in a well-defined way. That
>> shouldn't
>> upset the hardware. Is this actually an indication that there is some
>> architectural state that we are forgetting to re-initialise? If so then
>> that's the bug which should be fixed.
>
> Does construct_vmcs need to explicitly care all fields if hardware
> just expects a zero there which can be satisfied by memset()? Anyway,
> I'll take a deeper look to check which unexpected fields are with stale
> content before reset.
Well, we actually write lots of zeroes in construct_vmcs(), so it's not like
we really take advantage of the memset(). And in fact strictly speaking I
don't think we can -- the only architectural interface to the VMCS is via
the stupid VMREAD/VMWRITE instructions. We can make no assumptions about
VMCS layout nor, presumably, field encodings (you might choose to write 1s
for 0s and 0s for 1s in the actual in-memory format, for all I know!).
-- Keir
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH] Clear VMCS if reusing after vcpu reset
2007-04-30 7:25 ` Keir Fraser
@ 2007-04-30 7:32 ` Tian, Kevin
2007-05-11 12:33 ` question about blktap tgh
0 siblings, 1 reply; 10+ messages in thread
From: Tian, Kevin @ 2007-04-30 7:32 UTC (permalink / raw)
To: Keir Fraser, xen-devel
>From: Keir Fraser [mailto:Keir.Fraser@cl.cam.ac.uk]
>Sent: 2007年4月30日 15:25
>
>Well, we actually write lots of zeroes in construct_vmcs(), so it's not like
>we really take advantage of the memset(). And in fact strictly speaking I
>don't think we can -- the only architectural interface to the VMCS is via
>the stupid VMREAD/VMWRITE instructions. We can make no
>assumptions about
>VMCS layout nor, presumably, field encodings (you might choose to
>write 1s
>for 0s and 0s for 1s in the actual in-memory format, for all I know!).
>
> -- Keir
Agree.
Thanks,
Kevin
^ permalink raw reply [flat|nested] 10+ messages in thread
* question about blktap
2007-04-30 7:32 ` Tian, Kevin
@ 2007-05-11 12:33 ` tgh
0 siblings, 0 replies; 10+ messages in thread
From: tgh @ 2007-05-11 12:33 UTC (permalink / raw)
To: xen-devel
hi
I am using blktap,and I want to understand how does the blktap work
In the domU,there seems to be no blktap in it ,is it right?
If it is, does an application in domU access to the disk through the
frontend in domU and blktap in dom0 and then backend in dom0,or does it
just walk through frontend in domU and blktap in dom0, or how does it work?
could you help me
Thanks in advance
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2007-05-11 12:33 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-30 6:09 [PATCH] Clear VMCS if reusing after vcpu reset Tian, Kevin
2007-04-30 6:41 ` Keir Fraser
2007-04-30 6:45 ` Tian, Kevin
2007-04-30 6:48 ` Li, Xin B
2007-04-30 7:00 ` Keir Fraser
2007-04-30 7:12 ` Keir Fraser
2007-04-30 7:19 ` Tian, Kevin
2007-04-30 7:25 ` Keir Fraser
2007-04-30 7:32 ` Tian, Kevin
2007-05-11 12:33 ` question about blktap tgh
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.