Gianluca Guida
2012-Apr-11 23:04 UTC
[PATCH] Fix save/restore of guest PAT table in HAP paging mode.
Hello, HAP paging mode guests use direct MSR read/write into the VMCS/VMCB for the guest PAT table, while the current save/restore code was accessing only the pat_cr field in hvm_vcpu, used when intercepting the MSR mostly in shadow mode (the Intel scenario is a bit more complicated). This patch fixes this issue creating a new couple of hvm_funcs, get/set_guest_pat, that access the right PAT table based on the paging mode and guest configuration. As a major caveat, I haven''t tested this patch on AMD, for lack of hardware. Signed-off-by: Gianluca Guida <gianluca.guida@citrix.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Wei Huang
2012-Apr-12 06:14 UTC
Re: [PATCH] Fix save/restore of guest PAT table in HAP paging mode.
On 04/11/2012 06:04 PM, Gianluca Guida wrote:> Hello, > > HAP paging mode guests use direct MSR read/write into the VMCS/VMCB > for the guest PAT table, while the current save/restore code was > accessing only the pat_cr field in hvm_vcpu, used when intercepting > the MSR mostly in shadow mode (the Intel scenario is a bit more > complicated). > This patch fixes this issue creating a new couple of hvm_funcs, > get/set_guest_pat, that access the right PAT table based on the paging > mode and guest configuration. > > As a major caveat, I haven''t tested this patch on AMD, for lack of hardware.I can test it on my AMD box tomorrow. BTW from my understanding, this patch doesn''t have performance implication for nested paging mode, does it? -Wei> > Signed-off-by: Gianluca Guida<gianluca.guida@citrix.com>
Gianluca Guida
2012-Apr-12 07:32 UTC
Re: [PATCH] Fix save/restore of guest PAT table in HAP paging mode.
On Wed, Apr 11, 2012 at 11:14 PM, Wei Huang <wei.huang2@amd.com> wrote:> On 04/11/2012 06:04 PM, Gianluca Guida wrote: >> As a major caveat, I haven''t tested this patch on AMD, for lack of >> hardware. > > I can test it on my AMD box tomorrow. BTW from my understanding, this patch > doesn''t have performance implication for nested paging mode, does it?Thank you! A good but not perfect way is to check that xen-hvmctx doesn''t return on HAP the reset PAT table after a linux/windows guest has been running. And that its value is actually preserved across save/restore. As for the performances in nested mode, as far as I could see, I think not -- but I haven''t looked at eventually hidden details of the nested vm implementation. Gianluca
Huang2, Wei
2012-Apr-13 16:29 UTC
Re: [PATCH] Fix save/restore of guest PAT table in HAP paging mode.
I tested it with SLES11 SP1 and Windows 7 guest VM. With nested paging enabled, I saw XEN saved 0x0007010600070106ULL, instead of default 0x0007040600070406ULL, to guest disk files. So it behaved as expected. -Wei -----Original Message----- From: Gianluca Guida [mailto:glguida@gmail.com] Sent: Thursday, April 12, 2012 2:32 AM To: Huang2, Wei Cc: xen-devel@lists.xensource.com; Gianluca Guida Subject: Re: [Xen-devel] [PATCH] Fix save/restore of guest PAT table in HAP paging mode. On Wed, Apr 11, 2012 at 11:14 PM, Wei Huang <wei.huang2@amd.com> wrote:> On 04/11/2012 06:04 PM, Gianluca Guida wrote: >> As a major caveat, I haven''t tested this patch on AMD, for lack of >> hardware. > > I can test it on my AMD box tomorrow. BTW from my understanding, this patch > doesn''t have performance implication for nested paging mode, does it?Thank you! A good but not perfect way is to check that xen-hvmctx doesn''t return on HAP the reset PAT table after a linux/windows guest has been running. And that its value is actually preserved across save/restore. As for the performances in nested mode, as far as I could see, I think not -- but I haven''t looked at eventually hidden details of the nested vm implementation. Gianluca
Gianluca Guida
2012-Apr-13 17:08 UTC
Re: [PATCH] Fix save/restore of guest PAT table in HAP paging mode.
On Fri, Apr 13, 2012 at 9:29 AM, Huang2, Wei <Wei.Huang2@amd.com> wrote:> I tested it with SLES11 SP1 and Windows 7 guest VM. With nested paging enabled, I saw XEN saved 0x0007010600070106ULL, instead of default 0x0007040600070406ULL, to guest disk files. So it behaved as expected.Yes, that is exactly what I expected to see (WC enabled). Thanks again. Any change to get this checked in? Gianluca
Tim Deegan
2012-Apr-13 17:51 UTC
Re: [PATCH] Fix save/restore of guest PAT table in HAP paging mode.
At 10:08 -0700 on 13 Apr (1334311697), Gianluca Guida wrote:> On Fri, Apr 13, 2012 at 9:29 AM, Huang2, Wei <Wei.Huang2@amd.com> wrote: > > I tested it with SLES11 SP1 and Windows 7 guest VM. With nested paging enabled, I saw XEN saved 0x0007010600070106ULL, instead of default 0x0007040600070406ULL, to guest disk files. So it behaved as expected. > > Yes, that is exactly what I expected to see (WC enabled). Thanks again. > > Any change to get this checked in?FWIW, Acked-by: Tim Deegan <tim@xen.org>
Wei Huang
2012-Apr-13 18:42 UTC
Re: [PATCH] Fix save/restore of guest PAT table in HAP paging mode.
You can treat my experiments as an ack. But other folks need to ack it too. -Wei On 04/13/2012 12:08 PM, Gianluca Guida wrote:> On Fri, Apr 13, 2012 at 9:29 AM, Huang2, Wei<Wei.Huang2@amd.com> wrote: >> I tested it with SLES11 SP1 and Windows 7 guest VM. With nested paging enabled, I saw XEN saved 0x0007010600070106ULL, instead of default 0x0007040600070406ULL, to guest disk files. So it behaved as expected. > Yes, that is exactly what I expected to see (WC enabled). Thanks again. > > Any change to get this checked in? > Gianluca >