From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web11.3914.1678873782942472538 for ; Wed, 15 Mar 2023 02:49:45 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=K6BTjx1n; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: dun.tan@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678873785; x=1710409785; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=OrmCE6VcdQ4vw4Y3fR1qYXemcrkfVnXxMxAKtwDV/lE=; b=K6BTjx1nrJS5K1WTLPH5Ejls/J1+nkVUVBrhXIYcIGI2Px582gL5umSh sBwajfyAUxque4Vj2aiNn5YRBNa5ZBpqWKsJQNHNpMZIvknwVM/Ivj9dP cVaWwXCDiYNYommkdvg9XF1sNLRsAuPsIYk9cectOE0O9qrDYsMveNqRj M4Bw2FGH6tTwl9eBhNHs0lfbbcf1lu6O8mFCDS+zTUMuHCS5GI0gpekNk ya7DwTKqqA9Pk/dAXtCyvSVnwidSv00MjZdoEGRq1OybTwi1k4Zcua9sh L4KfhuOA6F3VCu6WUtQj+UP375x6rSA7PEZNCvLt9CE9/3C78n5MqqzWm w==; X-IronPort-AV: E=McAfee;i="6500,9779,10649"; a="317312350" X-IronPort-AV: E=Sophos;i="5.98,262,1673942400"; d="scan'208";a="317312350" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Mar 2023 02:49:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10649"; a="629392285" X-IronPort-AV: E=Sophos;i="5.98,262,1673942400"; d="scan'208";a="629392285" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga003.jf.intel.com with ESMTP; 15 Mar 2023 02:49:45 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Wed, 15 Mar 2023 02:49:44 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21 via Frontend Transport; Wed, 15 Mar 2023 02:49:44 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.109) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.21; Wed, 15 Mar 2023 02:49:44 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Mm7XVPeJpfBUMdwS5PzVZCIqZ/r6B5UNKCmTY6G4HGGvZ1WCPn14Sg1N8FJesb7+Yk5hNvB8uOe3HiHkrQiliuZlOGY2fEiKRh4JMf6F9m7afI3S8Bda9BUw3eyS2zcoWGQQcmYKC/TbBbns14ieKF8M700SOoi9MVkV/8UcO5sRTPeWlUXl1ASxdySfokv0MRwG1WT/88InsV0nHUFWmBB3DNhbBygDtzFCoLaoFvE3Tn06SnJkQjfaYNdskDHYZ5Jy2wxMmat0KtZ40gSfywvzE3U5syY8UuJTIekfa0f66rRh3rdFFEy1ZX0DS8q99MUMK6Vb/sXVhNb520S+8g== 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=yRJnxhDJyE5eQI9FE401g3dQvctyLivRUMu5s7T9y8Q=; b=OTd425shut13V9keMoXiwnuBelBxuHZ0RUaJpV/4ihdOZb+kT3QNXr5+WE4NDdwZ04LGCAKwYaMeaOgxMqA0IzeOVRhMRi6aLixTDIMoq4traBH9yi4rXWnYy7x1NYXhnvOsEzcBUUQzFarpU6bowZyR56qFuNvC54iuCQ6wJCFkjEt1x/LPrGO4+GVXUg1GL79ycYdvS5iZGkoRVdLfF3TQjbqRpf85Vk6ejo4ajj1FNfxTkIGxlfqPemsilSP8jxnJRd58lhPDqtMSEl2Aj8aDyIyTYJ5rt0GWT7DxpR/JKR/Mhd86u+pwZ2tbSw/b9xVZ/1u5fQh9+Ctd6uEeUA== 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 BN9PR11MB5483.namprd11.prod.outlook.com (2603:10b6:408:104::10) by DM8PR11MB5574.namprd11.prod.outlook.com (2603:10b6:8:39::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.29; Wed, 15 Mar 2023 09:49:38 +0000 Received: from BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::af70:de56:4a6f:b2cc]) by BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::af70:de56:4a6f:b2cc%8]) with mapi id 15.20.6178.029; Wed, 15 Mar 2023 09:49:38 +0000 From: "duntan" To: "Ni, Ray" , "devel@edk2.groups.io" CC: "Dong, Eric" , "Kumar, Rahul R" , Gerd Hoffmann , "Liu, Zhiguang" Subject: Re: [Patch V2 10/14] UefiCpuPkg/CpuPageTableLib: Modify RandomTest to check IsModified Thread-Topic: [Patch V2 10/14] UefiCpuPkg/CpuPageTableLib: Modify RandomTest to check IsModified Thread-Index: AQHZUaYV/AZPZSBJaEWOkEv1qYTK2a77ZL0QgAA7yYA= Date: Wed, 15 Mar 2023 09:49:38 +0000 Message-ID: References: <20230308100758.669-1-dun.tan@intel.com> <20230308100758.669-11-dun.tan@intel.com> In-Reply-To: Accept-Language: zh-CN, 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: BN9PR11MB5483:EE_|DM8PR11MB5574:EE_ x-ms-office365-filtering-correlation-id: 3d361b33-f341-4d1a-b9a9-08db253a9763 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: llB1TnUqImi47rBVzB/TkdaYOB4QxRKk7H569/0clNVQAQybcG7HNHJkDXAJWhqbAENmWPIdihPMvKVSQATIB+hm8DBlZLMr2aIm1sh58YB5gOgOc19IOKe400vljraZdazBSQuk4BR73gn5dAhjC/HgBJxeTE/v59IacphltbWVS8wGCrByJ0Lh5/5J+lqNums5r7D0ZcHHb80+aCR6o4l7YqvhTh4GuxDefsLhOpxRE4yevj3EoK5IQlmFEMzi/W9rZfybzhaA+vOq934KVkzWpCwfiIJZW0WrRmoyTsDZgBRTpRZL0BNSySXTw7NdyKwChZJ+wHIXbcQBWM6m6d0lZuwfGz5hmFoOXsOiTJMVERxboUKUv8UUdPW+SKkkELQdXDpu2DLVsntk7/cJenC8zKwIOzVM8connbLnP7w1NLpYf5L6YUXbvdXSqyr7G5a/n2u93G/1mgr7n1I6XGDfbJQej/x7p8nmC+bBH3rbU/d9kRpX+xlTrK/nkk2crCQH4FhwHQRMmt65N+GoRuhu1anL7USWj56wzEvXz5YtkpJLtm9PA7C/Eeh1IOUIQHn0jFNsaiEX3tJ+ORlFEb669dFdhsD6AA6DsIARtF9rY+9890iBbJxBiwc9yplKq2Umskxfg3t/zIu11tzzCoumnTJgkJ1Le0eNh5+VdhaKVjODyAL6oyw8uXIl7cLVP6SXKN3Xh1DUj5iuczx6FA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN9PR11MB5483.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(6029001)(366004)(376002)(396003)(39860400002)(136003)(346002)(451199018)(5660300002)(83380400001)(107886003)(478600001)(7696005)(53546011)(71200400001)(9686003)(6506007)(26005)(186003)(66446008)(38070700005)(76116006)(66556008)(52536014)(66946007)(55016003)(64756008)(33656002)(41300700001)(4326008)(8936002)(66476007)(86362001)(54906003)(110136005)(316002)(38100700002)(82960400001)(122000001)(2906002)(8676002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?bkFUY3yfA00AEFvNwHJya64H8EJUftxOeKK0UhqwVBejH3Jp1aqJh0Yhec+N?= =?us-ascii?Q?9aBnOCXy5bARPkR83H5cIEl9Ina9ihVsLa/npCx6CmKNPMOZek610M5X1WlS?= =?us-ascii?Q?73z2vzt4PMwvqAePB6CUjV5q13HL5ngHVO0fjhvnSC6jDxzBRFbrl2/hIXBO?= =?us-ascii?Q?4bZrwD+RMO7zPAFwIvqi68wENPHjanLKr9/wAUh4UjkAuQCDuaT+dtNlgMqi?= =?us-ascii?Q?rNiDc2xlrXY+db6HlLNMTdoa7R5x4dvQsBqVALkH31AY0Qo14qmJare9BFvb?= =?us-ascii?Q?dmYUDgaXbd6B6rcP3CejW5iEJfuo2RDVewLgeTRIKHEs4oxKZ7fQw7ZIY0Vm?= =?us-ascii?Q?C7FxsPKsspwX09J5W1CHn4vrqVJJiJ14VrYvGeDrCFR3rDbLjF6h6Br5GrhZ?= =?us-ascii?Q?/WyEfV9Pvo1kI6nqfBRjDK7/Pi92l8QPWc0+pX65qwIxy/ouwdJZFu2IzKtD?= =?us-ascii?Q?BoJjIh8Ye6q2Bi+r1TeMCfzHhX3+5EMaEuIEjv5vAOh7xjW1a8BrPEdPceJM?= =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ercdxoHqT1nxICU2I3Hf/k2?= =?us-ascii?Q?93VS/wYeYNIKpIcHVj/e+pWFZ60qtg919Q/VrDHZVAB+Yueicdv2f5BxMXGu?= =?us-ascii?Q?d9rMgIkrSuMEGQ43JXquU/ILA+Bp8ChFdk5VL3+Nwd5jqISiVokzEFlJNSZf?= =?us-ascii?Q?hNu42e7F1aR0vIVARrGAKN9+BCVY3LayhSJJVig3?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN9PR11MB5483.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3d361b33-f341-4d1a-b9a9-08db253a9763 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Mar 2023 09:49:38.0658 (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: 0yl8cxWFc8lYvSdPddDwDNrjyiOboYRLCNbhNHb/w9hOOUUV8w6ko0RlaAsbOTU9LrwvDnNjWveZYxfJXbUnBQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR11MB5574 Return-Path: dun.tan@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Thanks for the comments. I'll split this patch and remove the unneeded 'if'= condition check. Thanks, Dun -----Original Message----- From: Ni, Ray =20 Sent: Wednesday, March 15, 2023 2:09 PM To: Tan, Dun ; devel@edk2.groups.io Cc: Dong, Eric ; Kumar, Rahul R ; Gerd Hoffmann ; Liu, Zhiguang Subject: RE: [Patch V2 10/14] UefiCpuPkg/CpuPageTableLib: Modify RandomTest= to check IsModified >=20 > GenerateSingleRandomMapEntry (MaxAddress, MapEntrys); > Status =3D PageTableParse (*PageTable, PagingMode, NULL, &MapCount); >=20 > + if (MapCount !=3D 0) { > + // > + // Allocate memory for Map > + // Note the memory is only used in this one Single MapEntry Test > + // > + UT_ASSERT_EQUAL (Status, RETURN_BUFFER_TOO_SMALL); > + Map =3D AllocatePages (EFI_SIZE_TO_PAGES (MapCount * sizeof > (IA32_MAP_ENTRY))); > + ASSERT (Map !=3D NULL); > + Status =3D PageTableParse (*PageTable, PagingMode, Map, &MapCount); = =20 > + } > + > // > // Check if the generated MapEntrys->Maps[MapsIndex] contains not-=20 > present range. > // > if (MapEntrys->Maps[MapsIndex].Length > 0) { > if (MapCount !=3D 0) { > - UT_ASSERT_EQUAL (Status, RETURN_BUFFER_TOO_SMALL); > - Map =3D AllocatePages (EFI_SIZE_TO_PAGES (MapCount * sizeof > (IA32_MAP_ENTRY))); > - ASSERT (Map !=3D NULL); > - Status =3D PageTableParse (*PageTable, PagingMode, Map, &MapCount)= ; > - > if (Map[MapCount - 1].LinearAddress + Map[MapCount - 1].Length=20 > < > MapEntrys->Maps[MapsIndex].LinearAddress + MapEntrys- > >Maps[MapsIndex].Length) { > IsNotPresent =3D TRUE; 1. can you split the Parse() API call into a standalone patch? > + if (MapCount2 =3D=3D 0) { > + UT_ASSERT_EQUAL (IsModified, FALSE); 2. no need to treat "MapCount =3D=3D 0" as special. CompareMem() should be = able to accept 0-length bytes. > + } else if (CompareMem (Map, Map2, MapCount2 * sizeof > (IA32_MAP_ENTRY)) !=3D 0) { > + UT_ASSERT_EQUAL (IsModified, TRUE); > + } else { > + UT_ASSERT_EQUAL (IsModified, FALSE); > + } > }