From: "Jan Beulich" Subject: [PATCH 4/6] x86/mm: prefer is_..._domain() over is_..._vcpu() Date: Thu, 11 Jun 2015 11:21:56 +0100 Message-ID: <55797D6402000078000838C5@mail.emea.novell.com> References: <55797BF702000078000838AF@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part71455054.0__=" Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Z2zcY-00036U-An for xen-devel@lists.xenproject.org; Thu, 11 Jun 2015 10:22:02 +0000 In-Reply-To: <55797BF702000078000838AF@mail.emea.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: Tim Deegan List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part71455054.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline ... when the domain pointer is already available. Signed-off-by: Jan Beulich --- a/xen/arch/x86/mm/guest_walk.c +++ b/xen/arch/x86/mm/guest_walk.c @@ -159,7 +159,7 @@ guest_walk_tables(struct vcpu *v, struct mflags =3D mandatory_flags(v, pfec); iflags =3D (_PAGE_NX_BIT | _PAGE_INVALID_BITS); =20 - if ( is_hvm_vcpu(v) && !(pfec & PFEC_user_mode) ) + if ( is_hvm_domain(d) && !(pfec & PFEC_user_mode) ) { struct segment_register seg; const struct cpu_user_regs *regs =3D guest_cpu_user_regs(); --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -3157,12 +3157,10 @@ void shadow_teardown(struct domain *d) * destroyed any shadows of it or sh_destroy_shadow will get = confused. */ if ( !pagetable_is_null(d->arch.paging.shadow.unpaged_pagetable) ) { + ASSERT(is_hvm_domain(d)); for_each_vcpu(d, v) - { - ASSERT(is_hvm_vcpu(v)); if ( !hvm_paging_enabled(v) ) v->arch.guest_table =3D pagetable_null(); - } unpaged_pagetable =3D pagetable_get_page(d->arch.paging.shadow.unpaged_pagetable); d->arch.paging.shadow.unpaged_pagetable =3D pagetable_null(); --- a/xen/arch/x86/mm/shadow/multi.c +++ b/xen/arch/x86/mm/shadow/multi.c @@ -2043,7 +2043,7 @@ void sh_destroy_monitor_table(struct vcp sh_unmap_domain_page(l3e); shadow_free(d, m3mfn); =20 - if ( is_pv_32on64_vcpu(v) ) + if ( is_pv_32on64_domain(d) ) { /* Need to destroy the l3 and l2 monitor pages that map the * Xen VAs at 3GB-4GB */ @@ -3963,7 +3963,7 @@ sh_update_cr3(struct vcpu *v, int do_loc (unsigned long)pagetable_get_pfn(v->arch.guest_table));= =20 #if GUEST_PAGING_LEVELS =3D=3D 4 - if ( !(v->arch.flags & TF_kernel_mode) && !is_pv_32on64_vcpu(v) ) + if ( !(v->arch.flags & TF_kernel_mode) && !is_pv_32on64_domain(d) ) gmfn =3D pagetable_get_mfn(v->arch.guest_table_user); else #endif @@ -4674,7 +4674,7 @@ static void *emulate_map_dest(struct vcp =20 /* Cross-page emulated writes are only supported for HVM guests; * PV guests ought to know better */ - if ( !is_hvm_vcpu(v) ) + if ( !is_hvm_domain(d) ) return MAPPING_UNHANDLEABLE; =20 /* This write crosses a page boundary. Translate the second page = */ @@ -5104,7 +5104,7 @@ int sh_audit_l3_table(struct vcpu *v, mf gmfn =3D get_shadow_status(d, get_gfn_query_unlocked( d, gfn_x(gfn), &p2mt), ((GUEST_PAGING_LEVELS =3D=3D 3 || - is_pv_32on64_vcpu(v)) + is_pv_32on64_domain(d)) && !shadow_mode_external(d) && (guest_index(gl3e) % 4) =3D=3D = 3) ? SH_type_l2h_shadow --=__Part71455054.0__= Content-Type: text/plain; name="use-is_X_domain-x86-mm.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="use-is_X_domain-x86-mm.patch" x86/mm: prefer is_..._domain() over is_..._vcpu()=0A=0A... when the domain = pointer is already available.=0A=0ASigned-off-by: Jan Beulich =0A=0A--- a/xen/arch/x86/mm/guest_walk.c=0A+++ b/xen/arch/x86/mm/gues= t_walk.c=0A@@ -159,7 +159,7 @@ guest_walk_tables(struct vcpu *v, struct=0A = mflags =3D mandatory_flags(v, pfec);=0A iflags =3D (_PAGE_NX_BIT | = _PAGE_INVALID_BITS);=0A =0A- if ( is_hvm_vcpu(v) && !(pfec & PFEC_user_m= ode) )=0A+ if ( is_hvm_domain(d) && !(pfec & PFEC_user_mode) )=0A = {=0A struct segment_register seg;=0A const struct = cpu_user_regs *regs =3D guest_cpu_user_regs();=0A--- a/xen/arch/x86/mm/shad= ow/common.c=0A+++ b/xen/arch/x86/mm/shadow/common.c=0A@@ -3157,12 +3157,10 = @@ void shadow_teardown(struct domain *d)=0A * destroyed any shadows = of it or sh_destroy_shadow will get confused. */=0A if ( !pagetable_is_= null(d->arch.paging.shadow.unpaged_pagetable) )=0A {=0A+ = ASSERT(is_hvm_domain(d));=0A for_each_vcpu(d, v)=0A- {=0A- = ASSERT(is_hvm_vcpu(v));=0A if ( !hvm_paging_enabled(v= ) )=0A v->arch.guest_table =3D pagetable_null();=0A- = }=0A unpaged_pagetable =3D=0A pagetable_get_page(d->ar= ch.paging.shadow.unpaged_pagetable);=0A d->arch.paging.shadow.unpag= ed_pagetable =3D pagetable_null();=0A--- a/xen/arch/x86/mm/shadow/multi.c= =0A+++ b/xen/arch/x86/mm/shadow/multi.c=0A@@ -2043,7 +2043,7 @@ void = sh_destroy_monitor_table(struct vcp=0A sh_unmap_domain_page(l3e);= =0A shadow_free(d, m3mfn);=0A =0A- if ( is_pv_32on64_vcpu(v)= )=0A+ if ( is_pv_32on64_domain(d) )=0A {=0A /* = Need to destroy the l3 and l2 monitor pages that map the=0A * = Xen VAs at 3GB-4GB */=0A@@ -3963,7 +3963,7 @@ sh_update_cr3(struct vcpu = *v, int do_loc=0A (unsigned long)pagetable_get_pfn(v->ar= ch.guest_table));=0A =0A #if GUEST_PAGING_LEVELS =3D=3D 4=0A- if ( = !(v->arch.flags & TF_kernel_mode) && !is_pv_32on64_vcpu(v) )=0A+ if ( = !(v->arch.flags & TF_kernel_mode) && !is_pv_32on64_domain(d) )=0A = gmfn =3D pagetable_get_mfn(v->arch.guest_table_user);=0A else=0A = #endif=0A@@ -4674,7 +4674,7 @@ static void *emulate_map_dest(struct vcp=0A = =0A /* Cross-page emulated writes are only supported for HVM = guests;=0A * PV guests ought to know better */=0A- if ( = !is_hvm_vcpu(v) )=0A+ if ( !is_hvm_domain(d) )=0A = return MAPPING_UNHANDLEABLE;=0A =0A /* This write crosses a page = boundary. Translate the second page */=0A@@ -5104,7 +5104,7 @@ int = sh_audit_l3_table(struct vcpu *v, mf=0A gmfn =3D get_shadow_sta= tus(d, get_gfn_query_unlocked(=0A = d, gfn_x(gfn), &p2mt),=0A ((GUEST_PAGI= NG_LEVELS =3D=3D 3 ||=0A- is_pv_32on6= 4_vcpu(v))=0A+ is_pv_32on64_domain(d)= )=0A && !shadow_mode_external(d)=0A = && (guest_index(gl3e) % 4) =3D=3D = 3)=0A ? SH_type_l2h_shadow=0A --=__Part71455054.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part71455054.0__=--