From: "Jan Beulich" Subject: [PATCH 3/3] x86/shadow: use shorter constants for callback masks Date: Thu, 29 Jan 2015 13:17:48 +0000 Message-ID: <54CA410C020000780005AE02@mail.emea.novell.com> References: <54CA3F19020000780005ADDC@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part281DBBEC.0__=" Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YGoyl-0000Ax-T9 for xen-devel@lists.xenproject.org; Thu, 29 Jan 2015 13:17:52 +0000 In-Reply-To: <54CA3F19020000780005ADDC@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. --=__Part281DBBEC.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline private.h defining them I can't see why they couldn't be used here to make the code easier to read. Signed-off-by: Jan Beulich --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -2163,12 +2163,12 @@ int sh_remove_write_access(struct vcpu * }; =20 static const unsigned int callback_mask =3D - 1 << SH_type_l1_32_shadow - | 1 << SH_type_fl1_32_shadow - | 1 << SH_type_l1_pae_shadow - | 1 << SH_type_fl1_pae_shadow - | 1 << SH_type_l1_64_shadow - | 1 << SH_type_fl1_64_shadow + SHF_L1_32 + | SHF_FL1_32 + | SHF_L1_PAE + | SHF_FL1_PAE + | SHF_L1_64 + | SHF_FL1_64 ; struct page_info *pg =3D mfn_to_page(gmfn); =20 @@ -2413,12 +2413,12 @@ int sh_remove_all_mappings(struct vcpu * }; =20 static const unsigned int callback_mask =3D - 1 << SH_type_l1_32_shadow - | 1 << SH_type_fl1_32_shadow - | 1 << SH_type_l1_pae_shadow - | 1 << SH_type_fl1_pae_shadow - | 1 << SH_type_l1_64_shadow - | 1 << SH_type_fl1_64_shadow + SHF_L1_32 + | SHF_FL1_32 + | SHF_L1_PAE + | SHF_FL1_PAE + | SHF_L1_64 + | SHF_FL1_64 ; =20 perfc_incr(shadow_mappings); @@ -2558,20 +2558,18 @@ void sh_remove_shadows(struct vcpu *v, m /* Another lookup table, for choosing which mask to use */ static const unsigned int masks[SH_type_unused] =3D { 0, /* none */ - 1 << SH_type_l2_32_shadow, /* l1_32 */ + SHF_L2_32, /* l1_32 */ 0, /* fl1_32 */ 0, /* l2_32 */ - ((1 << SH_type_l2h_pae_shadow) - | (1 << SH_type_l2_pae_shadow)), /* l1_pae */ + SHF_L2H_PAE | SHF_L2_PAE, /* l1_pae */ 0, /* fl1_pae */ 0, /* l2_pae */ 0, /* l2h_pae */ - ((1 << SH_type_l2h_64_shadow) - | (1 << SH_type_l2_64_shadow)), /* l1_64 */ + SHF_L2H_64 | SHF_L2_64, /* l1_64 */ 0, /* fl1_64 */ - 1 << SH_type_l3_64_shadow, /* l2_64 */ - 1 << SH_type_l3_64_shadow, /* l2h_64 */ - 1 << SH_type_l4_64_shadow, /* l3_64 */ + SHF_L3_64, /* l2_64 */ + SHF_L3_64, /* l2h_64 */ + SHF_L4_64, /* l3_64 */ 0, /* l4_64 */ 0, /* p2m */ 0 /* unused */ @@ -2701,7 +2699,7 @@ void sh_reset_l3_up_pointers(struct vcpu NULL, /* p2m */ NULL /* unused */ }; - static const unsigned int callback_mask =3D 1 << SH_type_l3_64_shadow;= + static const unsigned int callback_mask =3D SHF_L3_64; =20 hash_foreach(v, callback_mask, callbacks, _mfn(INVALID_MFN)); } --=__Part281DBBEC.0__= Content-Type: text/plain; name="x86-shadow-mask-constants.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-shadow-mask-constants.patch" x86/shadow: use shorter constants for callback masks=0A=0Aprivate.h = defining them I can't see why they couldn't be used here to=0Amake the = code easier to read.=0A=0ASigned-off-by: Jan Beulich =0A= =0A--- a/xen/arch/x86/mm/shadow/common.c=0A+++ b/xen/arch/x86/mm/shadow/com= mon.c=0A@@ -2163,12 +2163,12 @@ int sh_remove_write_access(struct vcpu = *=0A };=0A =0A static const unsigned int callback_mask =3D=0A- = 1 << SH_type_l1_32_shadow=0A- | 1 << SH_type_fl1_32_shadow=0A- = | 1 << SH_type_l1_pae_shadow=0A- | 1 << SH_type_fl1_pae_shado= w=0A- | 1 << SH_type_l1_64_shadow=0A- | 1 << SH_type_fl1_64_s= hadow=0A+ SHF_L1_32=0A+ | SHF_FL1_32=0A+ | = SHF_L1_PAE=0A+ | SHF_FL1_PAE=0A+ | SHF_L1_64=0A+ | = SHF_FL1_64=0A ;=0A struct page_info *pg =3D mfn_to_page(gmfn);= =0A =0A@@ -2413,12 +2413,12 @@ int sh_remove_all_mappings(struct vcpu *=0A = };=0A =0A static const unsigned int callback_mask =3D=0A- = 1 << SH_type_l1_32_shadow=0A- | 1 << SH_type_fl1_32_shadow=0A- = | 1 << SH_type_l1_pae_shadow=0A- | 1 << SH_type_fl1_pae_shadow=0A-= | 1 << SH_type_l1_64_shadow=0A- | 1 << SH_type_fl1_64_shadow= =0A+ SHF_L1_32=0A+ | SHF_FL1_32=0A+ | SHF_L1_PAE=0A+= | SHF_FL1_PAE=0A+ | SHF_L1_64=0A+ | SHF_FL1_64=0A = ;=0A =0A perfc_incr(shadow_mappings);=0A@@ -2558,20 +2558,18 @@ = void sh_remove_shadows(struct vcpu *v, m=0A /* Another lookup table, = for choosing which mask to use */=0A static const unsigned int = masks[SH_type_unused] =3D {=0A 0, /* none */=0A- 1 << = SH_type_l2_32_shadow, /* l1_32 */=0A+ SHF_L2_32, /* l1_32 */=0A = 0, /* fl1_32 */=0A 0, /* l2_32 */=0A- ((1 << = SH_type_l2h_pae_shadow)=0A- | (1 << SH_type_l2_pae_shadow)), /* = l1_pae */=0A+ SHF_L2H_PAE | SHF_L2_PAE, /* l1_pae */=0A = 0, /* fl1_pae */=0A 0, /* l2_pae */=0A 0, /* l2h_pae = */=0A- ((1 << SH_type_l2h_64_shadow)=0A- | (1 << SH_type_l2_= 64_shadow)), /* l1_64 */=0A+ SHF_L2H_64 | SHF_L2_64, /* l1_64 = */=0A 0, /* fl1_64 */=0A- 1 << SH_type_l3_64_shadow, /* = l2_64 */=0A- 1 << SH_type_l3_64_shadow, /* l2h_64 */=0A- = 1 << SH_type_l4_64_shadow, /* l3_64 */=0A+ SHF_L3_64, /* l2_64 = */=0A+ SHF_L3_64, /* l2h_64 */=0A+ SHF_L4_64, /* l3_64 = */=0A 0, /* l4_64 */=0A 0, /* p2m */=0A 0 = /* unused */=0A@@ -2701,7 +2699,7 @@ void sh_reset_l3_up_pointers(struct = vcpu=0A NULL, /* p2m */=0A NULL /* unused */=0A = };=0A- static const unsigned int callback_mask =3D 1 << SH_type_l3_64_sh= adow;=0A+ static const unsigned int callback_mask =3D SHF_L3_64;=0A =0A = hash_foreach(v, callback_mask, callbacks, _mfn(INVALID_MFN));=0A }=0A --=__Part281DBBEC.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 --=__Part281DBBEC.0__=--