[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 04/16] x86/shadow: replace memcmp() in sh_resync_l1()


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 22 Mar 2023 10:31:36 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=D1Dsj40oRv4OjoqF3xMmolhrQ7JzGMarXChK83LdjUg=; b=cAxPkxMAmUytH/XVgZ+wM0DF1qC5KLie2owEsa+13saGonfRI+eqyxWQ/dVfpd9Bd32ru8YHboZkmADfPGyUHRAjPYTHUSTciyLa9DDC6N0BHfyljKJq0aRQ+/YA0/zDCFmO4W/kVbVxg+Uxg/hz9A5c1x9tsf8m0q4ZP2l34vDN5O8oOvP1SE5Lf/zs0T7J06szsbldL/aAbbC0UFgSr41WqfMY0rv30nmvCCcg00AAKbIMWfG31JFT7dxiplbavj/YuMG16l5Z1n6m9RtaxeGMGep6gEb1vqKpiWOqo9FIWpmBYJi3H1jObGQhfrH0wmqFoaiSEh+W53PqtKoARw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kMrKUvcqLWLjhDdfVyxXBZv1X2rPhrseSUGE2Nlyvv+Q85F5zJkwxtSfOYxzvDZURO64hWP5Ct+tNgoCHt1k0zVQ3L85RUhTwvR5/eb96cCW/uB3If1/lw3MS4te332P74W0LWVgyKFyUPw8KJVSVAzs//fKMw6aruTJEbJKzdDAZLa0gtPOSqkICAsFytLNeiSFE/JVDFb5wN5305vVr2V/7PHN0ssv7Si+mjQ5xg3p2jU05Aa8hyc6S6tX1qgRo3iCZiKuxWONPdtRrtjFzFXsuGxM3sGI8FO20EDphb9xPyagyRlKnq3CJTf/E26vgSLwfuL1W8C/bPz52vI37Q==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Tim Deegan <tim@xxxxxxx>
  • Delivery-date: Wed, 22 Mar 2023 09:31:52 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Ordinary scalar operations are used in a multitude of other places, so
do so here as well. In fact take the opportunity and drop a local
variable then as well, first and foremost to get rid of a bogus cast.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -1659,9 +1659,8 @@ void sh_resync_l1(struct vcpu *v, mfn_t
 
    SHADOW_FOREACH_L1E(sl1mfn, sl1p, &gl1p, 0, {
         guest_l1e_t gl1e = *gl1p;
-        guest_l1e_t *snpl1p = (guest_l1e_t *)snp + guest_index(gl1p);
 
-        if ( memcmp(snpl1p, &gl1e, sizeof(gl1e)) )
+        if ( snp[guest_index(gl1p)].l1 != gl1e.l1 )
         {
             gfn_t gfn;
             mfn_t gmfn = INVALID_MFN;
@@ -1677,7 +1676,7 @@ void sh_resync_l1(struct vcpu *v, mfn_t
 
             l1e_propagate_from_guest(v, gl1e, gmfn, &nsl1e, ft_prefetch, p2mt);
             rc |= shadow_set_l1e(d, sl1p, nsl1e, p2mt, sl1mfn);
-            *snpl1p = gl1e;
+            snp[guest_index(gl1p)] = gl1e;
         }
     });
 




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.