Re: [Xen-devel] [V3 PATCH 7/9] x86/hvm: pkeys, add pkeys support for guest_walk_tables

2015-12-18 Thread Tim Deegan
At 08:21 + on 18 Dec (1450426907), Han, Huaitong wrote: > On Wed, 2015-12-16 at 15:36 +, George Dunlap wrote: > > With your current series, guest_walk_tables() already checks for > > pkeys > > being enabled in the guest before checking for them in the > > pagetables. > > For shadow mode, th

Re: [Xen-devel] [V3 PATCH 7/9] x86/hvm: pkeys, add pkeys support for guest_walk_tables

2015-12-18 Thread George Dunlap
On 18/12/15 08:21, Han, Huaitong wrote: > On Wed, 2015-12-16 at 15:36 +, George Dunlap wrote: >> [Adding Tim, the previous mm maintainer] >> >> On 11/12/15 09:16, Wu, Feng wrote: > +{ > +void *xsave_addr; > +unsigned int pkru = 0; > +bool_t pkru_ad, pkru_wd; > +

Re: [Xen-devel] [V3 PATCH 7/9] x86/hvm: pkeys, add pkeys support for guest_walk_tables

2015-12-18 Thread Han, Huaitong
On Wed, 2015-12-16 at 15:36 +, George Dunlap wrote: > [Adding Tim, the previous mm maintainer] > > On 11/12/15 09:16, Wu, Feng wrote: > > > > +{ > > > > +void *xsave_addr; > > > > +unsigned int pkru = 0; > > > > +bool_t pkru_ad, pkru_wd; > > > > + > > > > +bool_t uf = !!(pfec &

Re: [Xen-devel] [V3 PATCH 7/9] x86/hvm: pkeys, add pkeys support for guest_walk_tables

2015-12-17 Thread Jan Beulich
>>> On 17.12.15 at 10:18, wrote: > On Wed, 2015-12-16 at 02:12 -0700, Jan Beulich wrote: >> > > > On 16.12.15 at 10:03, wrote: >> > On Wed, 2015-12-16 at 01:32 -0700, Jan Beulich wrote: >> > > Depending on how frequently this might get called, the allocation >> > > overhead may not be tolerable.

Re: [Xen-devel] [V3 PATCH 7/9] x86/hvm: pkeys, add pkeys support for guest_walk_tables

2015-12-17 Thread Han, Huaitong
On Wed, 2015-12-16 at 02:12 -0700, Jan Beulich wrote: > > > > On 16.12.15 at 10:03, wrote: > > On Wed, 2015-12-16 at 01:32 -0700, Jan Beulich wrote: > > > > > > On 16.12.15 at 09:16, wrote: > > > > On Tue, 2015-12-15 at 02:02 -0700, Jan Beulich wrote: > > > > > Well, I wouldn't want you to introd

Re: [Xen-devel] [V3 PATCH 7/9] x86/hvm: pkeys, add pkeys support for guest_walk_tables

2015-12-16 Thread Tim Deegan
At 16:34 + on 16 Dec (1450283699), Andrew Cooper wrote: > On 16/12/15 16:28, Tim Deegan wrote: > > Hi, > > > > At 15:36 + on 16 Dec (1450280191), George Dunlap wrote: > >> (hvm_fetch_from_guest_virt() seems to only set PFEC_insn_fetch if nx or > >> smep are enabled in the guest. This seems

Re: [Xen-devel] [V3 PATCH 7/9] x86/hvm: pkeys, add pkeys support for guest_walk_tables

2015-12-16 Thread Tim Deegan
At 16:50 + on 16 Dec (1450284615), George Dunlap wrote: > On 16/12/15 16:28, Tim Deegan wrote: > > Hi, > > > > At 15:36 + on 16 Dec (1450280191), George Dunlap wrote: > >> (hvm_fetch_from_guest_virt() seems to only set PFEC_insn_fetch if nx or > >> smep are enabled in the guest. This seem

Re: [Xen-devel] [V3 PATCH 7/9] x86/hvm: pkeys, add pkeys support for guest_walk_tables

2015-12-16 Thread George Dunlap
On 16/12/15 16:28, Tim Deegan wrote: > Hi, > > At 15:36 + on 16 Dec (1450280191), George Dunlap wrote: >> (hvm_fetch_from_guest_virt() seems to only set PFEC_insn_fetch if nx or >> smep are enabled in the guest. This seems inconsistent to me with the >> treatment of PFEC_reserved_bit: it seem

Re: [Xen-devel] [V3 PATCH 7/9] x86/hvm: pkeys, add pkeys support for guest_walk_tables

2015-12-16 Thread Andrew Cooper
On 16/12/15 16:28, Tim Deegan wrote: > Hi, > > At 15:36 + on 16 Dec (1450280191), George Dunlap wrote: >> (hvm_fetch_from_guest_virt() seems to only set PFEC_insn_fetch if nx or >> smep are enabled in the guest. This seems inconsistent to me with the >> treatment of PFEC_reserved_bit: it seems

Re: [Xen-devel] [V3 PATCH 7/9] x86/hvm: pkeys, add pkeys support for guest_walk_tables

2015-12-16 Thread Tim Deegan
Hi, At 15:36 + on 16 Dec (1450280191), George Dunlap wrote: > (hvm_fetch_from_guest_virt() seems to only set PFEC_insn_fetch if nx or > smep are enabled in the guest. This seems inconsistent to me with the > treatment of PFEC_reserved_bit: it seems like > hvm_fetch_from_guest_virt() should al

Re: [Xen-devel] [V3 PATCH 7/9] x86/hvm: pkeys, add pkeys support for guest_walk_tables

2015-12-16 Thread George Dunlap
[Adding Tim, the previous mm maintainer] On 11/12/15 09:16, Wu, Feng wrote: >>> +{ >>> +void *xsave_addr; >>> +unsigned int pkru = 0; >>> +bool_t pkru_ad, pkru_wd; >>> + >>> +bool_t uf = !!(pfec & PFEC_user_mode); >>> +bool_t wf = !!(pfec & PFEC_write_access); >>> +bool_t f

Re: [Xen-devel] [V3 PATCH 7/9] x86/hvm: pkeys, add pkeys support for guest_walk_tables

2015-12-16 Thread Jan Beulich
>>> On 16.12.15 at 10:03, wrote: > On Wed, 2015-12-16 at 01:32 -0700, Jan Beulich wrote: >> > > > On 16.12.15 at 09:16, wrote: >> > On Tue, 2015-12-15 at 02:02 -0700, Jan Beulich wrote: >> > > Well, I wouldn't want you to introduce a brand new function, but >> > > instead just factor out the nece

Re: [Xen-devel] [V3 PATCH 7/9] x86/hvm: pkeys, add pkeys support for guest_walk_tables

2015-12-16 Thread Han, Huaitong
On Wed, 2015-12-16 at 01:32 -0700, Jan Beulich wrote: > > > > On 16.12.15 at 09:16, wrote: > > On Tue, 2015-12-15 at 02:02 -0700, Jan Beulich wrote: > > > Well, I wouldn't want you to introduce a brand new function, but > > > instead just factor out the necessary piece from xsave() (making > > > t

Re: [Xen-devel] [V3 PATCH 7/9] x86/hvm: pkeys, add pkeys support for guest_walk_tables

2015-12-16 Thread Jan Beulich
>>> On 16.12.15 at 09:16, wrote: > On Tue, 2015-12-15 at 02:02 -0700, Jan Beulich wrote: >> Well, I wouldn't want you to introduce a brand new function, but >> instead just factor out the necessary piece from xsave() (making >> the new one take a struct xsave_struct * instead of a struct vcpu *, >

Re: [Xen-devel] [V3 PATCH 7/9] x86/hvm: pkeys, add pkeys support for guest_walk_tables

2015-12-16 Thread Han, Huaitong
On Tue, 2015-12-15 at 02:02 -0700, Jan Beulich wrote: > > > > On 15.12.15 at 09:14, wrote: > > On Fri, 2015-12-11 at 02:26 -0700, Jan Beulich wrote: > > > > > > On 10.12.15 at 19:19, wrote: > > > > On 07/12/15 09:16, Huaitong Han wrote: > > > > > +if ( likely(!pte_pkeys) ) > > > > > +

Re: [Xen-devel] [V3 PATCH 7/9] x86/hvm: pkeys, add pkeys support for guest_walk_tables

2015-12-15 Thread Jan Beulich
>>> On 15.12.15 at 09:14, wrote: > On Fri, 2015-12-11 at 02:26 -0700, Jan Beulich wrote: >> > > > On 10.12.15 at 19:19, wrote: >> > On 07/12/15 09:16, Huaitong Han wrote: >> > > +if ( likely(!pte_pkeys) ) >> > > +return 0; >> > > + >> > > +/* Update vcpu xsave area */ >> > > +

Re: [Xen-devel] [V3 PATCH 7/9] x86/hvm: pkeys, add pkeys support for guest_walk_tables

2015-12-15 Thread Han, Huaitong
On Fri, 2015-12-11 at 02:26 -0700, Jan Beulich wrote: > > > > On 10.12.15 at 19:19, wrote: > > On 07/12/15 09:16, Huaitong Han wrote: > > > +if ( likely(!pte_pkeys) ) > > > +return 0; > > > + > > > +/* Update vcpu xsave area */ > > > +fpu_xsave(vcpu); > > > > Is there a reason

Re: [Xen-devel] [V3 PATCH 7/9] x86/hvm: pkeys, add pkeys support for guest_walk_tables

2015-12-11 Thread Jan Beulich
>>> On 11.12.15 at 10:23, wrote: > On Thu, 2015-12-10 at 18:19 +, George Dunlap wrote: >> On 07/12/15 09:16, Huaitong Han wrote: >> > +if ( likely(!pte_pkeys) ) >> > +return 0; >> > + >> > +/* Update vcpu xsave area */ >> > +fpu_xsave(vcpu); >> >> Is there a reason you're

Re: [Xen-devel] [V3 PATCH 7/9] x86/hvm: pkeys, add pkeys support for guest_walk_tables

2015-12-11 Thread Han, Huaitong
On Thu, 2015-12-10 at 18:19 +, George Dunlap wrote: > On 07/12/15 09:16, Huaitong Han wrote: > > +{ > > +void *xsave_addr; > > +unsigned int pkru = 0; > > +bool_t pkru_ad, pkru_wd; > > + > > +bool_t uf = !!(pfec & PFEC_user_mode); > > +bool_t wf = !!(pfec & PFEC_write_access

Re: [Xen-devel] [V3 PATCH 7/9] x86/hvm: pkeys, add pkeys support for guest_walk_tables

2015-12-11 Thread Jan Beulich
>>> On 10.12.15 at 19:19, wrote: > On 07/12/15 09:16, Huaitong Han wrote: >> +if ( likely(!pte_pkeys) ) >> +return 0; >> + >> +/* Update vcpu xsave area */ >> +fpu_xsave(vcpu); > > Is there a reason you're calling fpu_xsave() directly here, rather than > just calling vcpu_save

Re: [Xen-devel] [V3 PATCH 7/9] x86/hvm: pkeys, add pkeys support for guest_walk_tables

2015-12-11 Thread Jan Beulich
>>> On 11.12.15 at 10:16, wrote: >> From: xen-devel-boun...@lists.xen.org [mailto:xen-devel- >> boun...@lists.xen.org] On Behalf Of George Dunlap >> Sent: Friday, December 11, 2015 2:20 AM >> On 07/12/15 09:16, Huaitong Han wrote: >> > This patch adds pkeys support for guest_walk_tables. >> > >> >

Re: [Xen-devel] [V3 PATCH 7/9] x86/hvm: pkeys, add pkeys support for guest_walk_tables

2015-12-11 Thread Wu, Feng
; Eddie ; Tian, Kevin ; > george.dun...@eu.citrix.com; ian.jack...@eu.citrix.com; > stefano.stabell...@eu.citrix.com; ian.campb...@citrix.com; > wei.l...@citrix.com; > k...@xen.org > Cc: xen-devel@lists.xen.org > Subject: Re: [Xen-devel] [V3 PATCH 7/9] x86/hvm: pkeys, add pkeys sup

Re: [Xen-devel] [V3 PATCH 7/9] x86/hvm: pkeys, add pkeys support for guest_walk_tables

2015-12-11 Thread Andrew Cooper
On 11/12/2015 07:18, Han, Huaitong wrote: > On Thu, 2015-12-10 at 18:59 +, Andrew Cooper wrote: >> On 07/12/15 09:16, Huaitong Han wrote: >>> + >>> +/* PKRU dom0 is always zero */ >>> +if ( likely(!pte_pkeys) ) >>> +return 0; >> This is not an architectural restriction (as far a

Re: [Xen-devel] [V3 PATCH 7/9] x86/hvm: pkeys, add pkeys support for guest_walk_tables

2015-12-10 Thread Han, Huaitong
On Thu, 2015-12-10 at 18:59 +, Andrew Cooper wrote: > On 07/12/15 09:16, Huaitong Han wrote: > > + > > +/* PKRU dom0 is always zero */ > > +if ( likely(!pte_pkeys) ) > > +return 0; > > This is not an architectural restriction (as far as I can tell). Xen > must never make assum

Re: [Xen-devel] [V3 PATCH 7/9] x86/hvm: pkeys, add pkeys support for guest_walk_tables

2015-12-10 Thread Andrew Cooper
On 07/12/15 09:16, Huaitong Han wrote: > + > +/* PKRU dom0 is always zero */ > +if ( likely(!pte_pkeys) ) > +return 0; This is not an architectural restriction (as far as I can tell). Xen must never make assumptions about how a guest chooses to use a feature. ~Andrew ___

Re: [Xen-devel] [V3 PATCH 7/9] x86/hvm: pkeys, add pkeys support for guest_walk_tables

2015-12-10 Thread George Dunlap
On 07/12/15 09:16, Huaitong Han wrote: > This patch adds pkeys support for guest_walk_tables. > > Signed-off-by: Huaitong Han > --- > xen/arch/x86/i387.c | 2 +- > xen/arch/x86/mm/guest_walk.c | 73 > +++ > xen/include/asm-x86/hvm/hvm.h | 2 +

[Xen-devel] [V3 PATCH 7/9] x86/hvm: pkeys, add pkeys support for guest_walk_tables

2015-12-07 Thread Huaitong Han
This patch adds pkeys support for guest_walk_tables. Signed-off-by: Huaitong Han --- xen/arch/x86/i387.c | 2 +- xen/arch/x86/mm/guest_walk.c | 73 +++ xen/include/asm-x86/hvm/hvm.h | 2 ++ xen/include/asm-x86/i387.h| 1 + 4 files changed