From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web10.72367.1679577620550259746 for ; Thu, 23 Mar 2023 06:20:20 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=FWWLdeBd; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: ray.ni@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679577620; x=1711113620; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=85l+nfO1z1oRi/xvkZ3xHpiCNltziWhDgMWA2b0xnP4=; b=FWWLdeBdNx2MTCvlDvRvUXmCj7W2wfY6+cX2nHY4CFUziOKCaccH9zcQ 9NIBfuGd4DGSRLVlskpqDjp09pSWslxyx9LCx4GsTaIKWz7iIHpQRZvMg h3dHe/qVzIF6EEPilSCc+Ecq6rfW4q5zxBbRQE+D8VGK7wmXpZQiKL2Ty pK/bFIwrG5R7cCwNRzLe60X83DHcqvzHcP/k6IMGGo0NoDsYj6pk3KLoW 2y9+HPT1wfncix2HTmdGQ2eQdV6DIGfXgpZB3kSGQVpsY+eYizQc/i8kX DPCgHXvP+2/0GWgiTTppHgEKD7NxauFJp2/+w6VbmRrqB/JhhrhGiFLAR Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="367224810" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="367224810" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2023 06:20:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="632399083" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="632399083" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga003.jf.intel.com with ESMTP; 23 Mar 2023 06:20:19 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Thu, 23 Mar 2023 06:20:18 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21 via Frontend Transport; Thu, 23 Mar 2023 06:20:18 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.169) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.21; Thu, 23 Mar 2023 06:20:18 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GdTYOqlszoDJ7iE4bxZ8AaTuek7TP9AUKMdMOEZoJTMqpXZ4xlyyCho6YwHSfgP4QvTq/vywBAlJgfQ9HPBzp7nV6JPCrcsSVjdK1+2zhn1NZPOsmCcCmG79Kta8t/vEUjcEa7OOPdnwqchzKzAvvDrhxCb/xxj/tk1v7ixKHt+GeFkZC9WcqKRnXqlTw3qlGx4KOhH8pCcck6gt8rx6iYGw4EydV+AGEYVp/st82uz2J+MGtfneJUsuxapDCpRa0q+0Ne9huphvfkWz1GbbjnR0H3PevWJmILpTK7TfUbiakzy2ZRlofx2zvFy9saXSengnF3XthAf+11QkW/DLyQ== 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=PlFsj9ArxHeDe6zIKNGDWehWoRzf+MTzkxKEVWTC59s=; b=nmuH8Sh3LNt3GxopkVGI/MFnMPUYtDkkGf818HmC5yw+gT4jzCZVEg6m1vrU3Y5i6JopJzjHOtO9R40R0kNzXY6rhU/0rSOeOBmSW3ntAACCWHC084Ooved8BGt153mGGNSZqErQp89Q9BlWaZSW6RIeuf3yQ/9SWctHGgsr1EJScjYu992k3SZ8kzMDMpryUlPEoK+G/yhnRaNmKgA1dVq9whhSoB8i39Y5vP433RPfBbWmAWiPkf8c8KEwpFLGVVq/9TN5tq+TfLU0Lc0zzweMkd53YZlZ6MCbDTaaxxMhOj9p+iJaBp9SjarvFEaI/i8opWycODDRgzDTpi9z3Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from MN6PR11MB8244.namprd11.prod.outlook.com (2603:10b6:208:470::14) by PH0PR11MB5047.namprd11.prod.outlook.com (2603:10b6:510:3c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.38; Thu, 23 Mar 2023 13:20:16 +0000 Received: from MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::ae07:e96a:4a24:8a69]) by MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::ae07:e96a:4a24:8a69%7]) with mapi id 15.20.6178.037; Thu, 23 Mar 2023 13:20:16 +0000 From: "Ni, Ray" To: "Tan, Dun" , "devel@edk2.groups.io" CC: "Dong, Eric" , "Kumar, Rahul R" , Gerd Hoffmann Subject: Re: [Patch V4 13/21] UefiCpuPkg/CpuPageTableLib: Add OUTPUT IsModified parameter. Thread-Topic: [Patch V4 13/21] UefiCpuPkg/CpuPageTableLib: Add OUTPUT IsModified parameter. Thread-Index: AQHZXVr0Z9EqHu6eP0emU/iw87TWkK8IWBag Date: Thu, 23 Mar 2023 13:20:16 +0000 Message-ID: References: <20230323074057.549-1-dun.tan@intel.com> <20230323074057.549-14-dun.tan@intel.com> In-Reply-To: <20230323074057.549-14-dun.tan@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN6PR11MB8244:EE_|PH0PR11MB5047:EE_ x-ms-office365-filtering-correlation-id: 4a571624-fa52-43a3-16be-08db2ba157b2 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: WpgJNLw4SBFHvXCWQNwiRoJh1gUqkPG7uFR4BxwaI43AyHxdfQtdWXwDBizFc76yJJHNtjwnmY+t8eebfpwz8e2HuqxccVSu79rxtpx4VrkAmatGf8nWPsg6FB3Btu0t2V3eXoDNs7iPn/OEt738XRuAzsPJWaMAQi0eLU9gmZ32xK4qYyQphbLKzvId8RTyg0sISNjGxp93B1L5tdKKX6pOQBK8Il7YD9zHyZ2wVynfCCBMyF+gJ96OEtGIEKhOtNm5l+1iyrVIglMgEWH1C01zZ7EC2LmjZj/zapUzodpIzyyNL8r1oO66n/s6TKrQ2VDwlq8l1XmocEfCid+dR+ZRmrrlmoSuZgxs5sPWw8mKIPNuOaL9Fyxl+9diJVWZqe5V9CIRXA8kEWECOhBIoBnabKwrvnocNhZnqqoca3VIWV19osI0FfmOpaTKpUZ1Qy9d1mGitsrlnJ4VnBQeCeHUQC3D5T2EIrN2Vl3K1uTtIQw9d0YSGnwYPGhdT1ctR0hI+GQsmS0uIUV2O3uMvFOi95w/BGsT4wNwrQjdxxMG/8/Y5voeEPLYHqYewnR7mxBKWt0LKbg9i1UO8J/ydU42VSOSfqwFVsSjFhhnBATemg+DznJRdK7/T0iTIUIIGbwmj4LHrMOevs3CUt+QsxqaklKhCT7LbXz7AbSwjyow1boOoA4sISvVEMJsbb8SeKG1550e8pWqaBVKv61xcg== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN6PR11MB8244.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(6029001)(366004)(346002)(376002)(396003)(136003)(39860400002)(451199018)(26005)(6506007)(38100700002)(82960400001)(122000001)(55016003)(186003)(9686003)(54906003)(41300700001)(110136005)(478600001)(33656002)(52536014)(8936002)(5660300002)(66476007)(66446008)(66946007)(66556008)(64756008)(4326008)(8676002)(316002)(86362001)(76116006)(19627235002)(7696005)(2906002)(71200400001)(38070700005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?vJLbNRNZLO2hR5K0BEoMlLzf858xMYI1OX6nFTYkVlXH/u+sWTWnLpw7DG53?= =?us-ascii?Q?L8DZi7OCupfjbUFQHGbvYAE20/KTG/AAnWSI7sd2aqCZybgv3XC9drpqOuT4?= =?us-ascii?Q?V9HaU9U8LCFp99wxCefFN37UXUtTwlxeplitPXRWF83PSyzpoOlv7KT/rEs0?= =?us-ascii?Q?ITmxB4DF2/fMEdB6oPYgSk05SZvneSKKr9S6bNA7ATqv/+1Z49TnAuDhRkfD?= =?us-ascii?Q?uA4H7Q4nqmK3xyWg648zviVrTJI4CTG0Sn5DkgQTb3ibqXUbkfX57sZoWQb6?= =?us-ascii?Q?oF/2IYxrwmE8g5wX6iC8M6ZI/P7kPPBlhqpusuwspO1LRaJ63YjpiA7qgM0k?= =?us-ascii?Q?4UGFg5E3a1aOUOjpIC5fNNVakKyMPAAEkih+0Fz2mEXPKV8WEluAQk4jpG8M?= =?us-ascii?Q?Lm7Awb29zjw0L9d99ToE972BBuLcAHjwzpscK1+ZURBbMufS6lThtwjqQacJ?= =?us-ascii?Q?RcAwK97Zapsw6McWMfJAAWR7MuLd8WE7neAXyhqZzy7IJnRmlAGbcw05aepw?= =?us-ascii?Q?N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1b86zAiLw/Fm743BRNdiz6?= =?us-ascii?Q?3lhS1zpK6jpUOiMPNoQanVlrJoaUw4xAYWeZ54g3y+f1G+84ON1653g1v70U?= =?us-ascii?Q?HmP7k/4k0qULEB2Ijxse+sZn5x+jHJUHIAU8tRcQ88tbLl5pnWvOTgef/Hu2?= =?us-ascii?Q?Jhbv9+0CIQmwlEtT/buV9cY6+C5uZ96YHhrCLNZZ?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN6PR11MB8244.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4a571624-fa52-43a3-16be-08db2ba157b2 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Mar 2023 13:20:16.3450 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: PaYx6tPsm+qED5EXihaZU6Afv4CCK8wqa1V/Ha8bxnGz/62lQ4big1RNsWmkLqtWsJO1pVJS33fStkvapcnGYw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5047 Return-Path: ray.ni@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > @@ -290,7 +291,8 @@ PageTableLibMapInLevel ( > IN UINT64 Length, > IN UINT64 Offset, > IN IA32_MAP_ATTRIBUTE *Attribute, > - IN IA32_MAP_ATTRIBUTE *Mask > + IN IA32_MAP_ATTRIBUTE *Mask, > + OUT BOOLEAN *IsModified > ) > { > RETURN_STATUS Status; > @@ -316,6 +318,8 @@ PageTableLibMapInLevel ( > IA32_MAP_ATTRIBUTE LocalParentAttribute; > UINT64 PhysicalAddrInEntry; > UINT64 PhysicalAddrInAttr; > + IA32_PAGING_ENTRY OriginalParentPagingEntry; > + IA32_PAGING_ENTRY OriginalCurrentPagingEntry; >=20 > ASSERT (Level !=3D 0); > ASSERT ((Attribute !=3D NULL) && (Mask !=3D NULL)); > @@ -328,8 +332,9 @@ PageTableLibMapInLevel ( > NopAttribute.Bits.ReadWrite =3D 1; > NopAttribute.Bits.UserSupervisor =3D 1; >=20 > - LocalParentAttribute.Uint64 =3D ParentAttribute->Uint64; > - ParentAttribute =3D &LocalParentAttribute; > + LocalParentAttribute.Uint64 =3D ParentAttribute->Uint64; > + ParentAttribute =3D &LocalParentAttribute; > + OriginalParentPagingEntry.Uint64 =3D ParentPagingEntry->Uint64; 1. can you add a blank line before "OriginalParentPagingEntry" assignment? This helps to tell that the new added line has nothing to do with the origi= nal two lines code that changes "ParentAttribute". >=20 > + if (IsModified !=3D NULL) { > + *IsModified =3D FALSE; > + } 2. can you use code as below? If (IsModified =3D=3D NULL) { IsModified =3D LocalIsModified; } Then all code can just change "*IsModified" without checking if it's NULL.