From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web10.2005.1669779001502168112 for ; Tue, 29 Nov 2022 19:30:01 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=S3Xu+ZPj; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: jiaxin.wu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669779001; x=1701315001; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=Vw1CXbsEeLaSXQwZmMqae6bGMY+e3bzZNX85+rCVG7M=; b=S3Xu+ZPjDpeQk1y1+ybku+z3qAKe6UGZcHHc43cWY+BbBDyWg4SDAf9M FFgXnwMU0TTWNWp9BmPlxkDhQNAO1MchoU5m7Bb046B0pGuEdE7D75vIi Z/Lj47ClA2Y61+b0g0rxiqexepvtUyy5ALKkLTkTX0LiRMANLULh27PfA w+7gDfut2yl3F37fCKVx/q7XaJBazDYwXp6KMufMJyhOtM0+EcCXsPoz5 HmqI3g8cH85zn9FuiW7Hr/XC3sPu+QHOgNemtrzhHnN3Site6Rk28Zt1C rsV0C/qrH7U1s/mL8e+7MIooFmLKAeTi+ML2J1T2GDEs23o/IedxoNOz3 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10546"; a="313988312" X-IronPort-AV: E=Sophos;i="5.96,205,1665471600"; d="scan'208";a="313988312" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2022 19:30:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10546"; a="972937815" X-IronPort-AV: E=Sophos;i="5.96,205,1665471600"; d="scan'208";a="972937815" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga005.fm.intel.com with ESMTP; 29 Nov 2022 19:30:00 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) 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.16; Tue, 29 Nov 2022 19:30:00 -0800 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Tue, 29 Nov 2022 19:30:00 -0800 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.100) 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.16; Tue, 29 Nov 2022 19:29:59 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HhBtnGrwAsr4VVdbohiv8SnGGXDVUEziGFUdC5+4Wl2wKdePzWwVwbWQZ1cDvDYPkWkk9KTct109fyqlnekcL7DhzPJCUp3e3dkUrkQVinm7Gj0E81bllqTsSltCVVLBE3oCMASUb1pNg4GrZFlkDuHfnEQTc3TxvUhmgyCNxzk6Ysvk/wwjXGJ7F3GCUzbH2lMw67Tf72LErZyCaAmeL4CWCExrEKK+SwuUcZO4bsAbhyWDlbmfa9X3yJq1QFUZa4hAKhJT7J0yBpnb33RolB6wFbMZ9OR9zZdkELCmb9buI1cs8dwftwUkdJ1aaQ8rKzpQsZeZs2WpbwFy7ZClSQ== 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=d1Ynt7ys/YeLKAObVtZ9VhG0VtxWqWIuQPLkXChr2dk=; b=dlWi9DCgVU+H85AUFD303uFwYJRWtmg/ChtNKiBAqF8blBjuSYFik4wR5liFwbDwJIIfiWgM/LNbQxySkf5ZPPf97+iU/ZvccCzgT3fVnMFBd/scJx2LVPUF9g2d+UXGcmrr20EYqBNvSttQh46X4ZUbhM1JY6nXPX6VBo6P1Xsn4lRtkj8S+GTsmGngESBIzo9pKGRhWffy03FR3CTNi6zsEQzzn6Bg4h9Jrw+BWBu3aCxvez2L2Z6rRSJdA12bIjA5lNFA54dLsyVFDuNNdRzIhpfAAs2a6EPq2tQ9WKTtVZMHGI5KPcDjrJOWMNM6u/hRCVEOp7sECUIWLUN8GQ== 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 MN0PR11MB6158.namprd11.prod.outlook.com (2603:10b6:208:3ca::18) by PH7PR11MB6676.namprd11.prod.outlook.com (2603:10b6:510:1ae::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.23; Wed, 30 Nov 2022 03:29:57 +0000 Received: from MN0PR11MB6158.namprd11.prod.outlook.com ([fe80::8997:923d:c193:8e31]) by MN0PR11MB6158.namprd11.prod.outlook.com ([fe80::8997:923d:c193:8e31%3]) with mapi id 15.20.5857.023; Wed, 30 Nov 2022 03:29:57 +0000 From: "Wu, Jiaxin" To: "Ni, Ray" , "devel@edk2.groups.io" CC: "Dong, Eric" Subject: Re: [PATCH v1] [PATCH v1] UefiCpuPkg: Check SMM Delayed/Blocked AP Count to decide all CPUs in SMI or not Thread-Topic: [PATCH v1] [PATCH v1] UefiCpuPkg: Check SMM Delayed/Blocked AP Count to decide all CPUs in SMI or not Thread-Index: AQHZA8tCeA7HPyE0rEOw8jXgIx2w8K5VlPDQgAE6g3A= Date: Wed, 30 Nov 2022 03:29:57 +0000 Message-ID: References: <20221129081852.12888-1-jiaxin.wu@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: MN0PR11MB6158:EE_|PH7PR11MB6676:EE_ x-ms-office365-filtering-correlation-id: 11d67616-e74b-48ad-8887-08dad28327cd x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ow5j3CRZfnQW797HDyG4+6shxUd66oAbli5zsAX4af11aATszyrFwOqpZn2Cyf3VQBaUOnoN/TQGVIYdxbBJyvDhALPgmP+OL52cIIl/Iz2MYdo8zmpd46DKjfOH7XGbQQ+1EGdqXs5x4IyNLICuaS+WLTSTOQVbb9iLpRqjBahzXGBMUL+wHU2QKMJ+dB9K7SdAj39mPKYcdKnj695otf5TZ5oNYICXDHNNPXZJw2AGn2D13jEmtKDvhAzHS4zSlVbd4+blvSbUMCGAfeoZyqWobl7ckkS0huO3PZnf+9BdLXLRxq32XfFnQEcJogRjx95icPtdXYRBq/7jqPN4jloNsvKjy+NSpStZL6TAZCWXEaMwBlebFQ6BlsGazLcUReGsdEfZl74V8qBDacxdIR7sCPtJehkb2RblsDEXVREPTuOw/z7hjyUoaAcatP1ucFYJYfehXAURKfMaGFQlW/Ke9sSUjfeNDU/UoAymld5g+dZSrIkO6qok/3N3F4mz/vggfYDbDhGQ+L6dZoI5qoQCwipQ8/NAWoY+CjTDlhna65x9IY9W0hCFnLKcwxvt8ojFZ+NLUGe85Aky0XnVZ/DL8yk44rtsOsXir53kggXRwwLe5VuayUOGwtxnvmZJCbygDNNMsqbN7MaJ7P/wMOT8ANV2rvrT39CG65kjdnyt3/caJ8npzVpr9lEB5RLkQ1Xq+2Yj300femF6xWKA9rui17/+1EPbvEv1SbwaB2CsKTvBqJNdBDjPv2gLs/fsQBfhCwy00ZeNay2Za3dH2A== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN0PR11MB6158.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(346002)(376002)(39860400002)(366004)(136003)(396003)(451199015)(5660300002)(33656002)(55016003)(9686003)(41300700001)(26005)(316002)(110136005)(82960400001)(52536014)(66446008)(186003)(76116006)(66476007)(8676002)(66556008)(15650500001)(4326008)(66946007)(122000001)(38100700002)(38070700005)(64756008)(8936002)(2906002)(83380400001)(86362001)(966005)(6506007)(107886003)(7696005)(71200400001)(478600001)(53546011);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?CCk9lESUjHoDfJomBNbPztyL9hEpeGYJAy6cvL2KKWe/BQl9AokZjgMU66XQ?= =?us-ascii?Q?1ZaA1V2S1mmCnFtzCy7Di3nlAhc6/6P5n/4EPhx0HrcGBJGhsq4Mz+aPBgc1?= =?us-ascii?Q?9OpcHsdPwuGekHBrm/8RM7xYneWDUu6MkcVRFot4T0J3Ne152iMlegchyIPH?= =?us-ascii?Q?jVHarXJa+rX1bU/g/7eD18KYAhxs+7Irtdh+asC5vegBiYFu2deKaU0H4t+X?= =?us-ascii?Q?H/CHEyX6oDDxjFSK0H6llU4dLvX8xoldz1kE8FUT7PIysZIh4nKcFZenjHug?= =?us-ascii?Q?0bCSpcG48QmDwc2FaHp4WUab14H8OOg1aep+MhrkMl0nxNsMm/FWkSeYarga?= =?us-ascii?Q?3hx2ZtsP3fkJXxpasFlaCQ8Pgj418hukfF2hlHlMPy0z/pZulgi65I9SPoja?= =?us-ascii?Q?Yhh4gVdjTaldxxdl7TGAOuaakOkM0IXMZq4bmEmHRuWO5r6Znuk2JLZLFGJ2?= =?us-ascii?Q?WAAc5cZL6CD0L9QpcARPu5mD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-ascii?Q?GSlkhvsj41KVjwFfo1NP/kLggBM/T3gPJfaTf6hpZ2Y7sVvwY3udk9eg8EdH?= =?us-ascii?Q?GA3Gh5cfvYIOQULQGpf7JU/MGaxqI3nqb032YBr0AbdF6yDNbh91gGp7slik?= =?us-ascii?Q?x4Mp20RQQPhf+69hOeMIXyYqUOIu4WxpBOAOu7mVN5uvq4ekYVzxJexBwxKd?= =?us-ascii?Q?SOAEzoOIrdchfYx5TIYk9ovrhWQoQL2nygaZcIRb?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN0PR11MB6158.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 11d67616-e74b-48ad-8887-08dad28327cd X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Nov 2022 03:29:57.6364 (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: UzBc5XdZbC/DfMNRpIQLOYiK4TQei7eIt71NVE2IU41ktNBD2hWaYFKi+op7q1kdwjFtKHXoLF8oYlWMUnPymg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB6676 Return-Path: jiaxin.wu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Thanks Ray. I added the comments in patch v2 (https://edk2.groups.io/g/deve= l/message/96722) to clarify the expected value of "SmmRegSmmEnable" & "SmmR= egSmmDelayed" & "SmmRegSmmBlocked" returned from SmmCpuFeaturesLib. That ca= n answer the questions. Due to more core count increasement, it's hard to reflect all APs state via AP bitvector support in the register. Actually, SMM CPU driver doesn't need to check each AP state to know all CPUs in SMI or not, one alternative method is to check the SMM Delayed & Blocked AP Count number: APs in SMI + Blocked Count + Disabled Count >=3D All supported Aps (code comments explained why can be > All supported Aps) With above change, the returned value of "SmmRegSmmEnable" & "SmmRegSmmDelayed" & "SmmRegSmmBlocked" from SmmCpuFeaturesLib should be the AP count number within the existing CPU package. For register that return the bitvector state, require SmmCpuFeaturesGetSmmRegister() returns count number of all bit per logical processor within the same package. For register that return the AP count, require SmmCpuFeaturesGetSmmRegister() returns the register value directly.=20 Thanks, Jiaxin=20 > -----Original Message----- > From: Ni, Ray > Sent: Tuesday, November 29, 2022 5:11 PM > To: Wu, Jiaxin ; devel@edk2.groups.io > Cc: Dong, Eric > Subject: RE: [PATCH v1] [PATCH v1] UefiCpuPkg: Check SMM > Delayed/Blocked AP Count to decide all CPUs in SMI or not >=20 > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4173 > > > > The blocked register might return the counter instead of bitvector. Thi= s > > request > > is to update the code to handle the case by checking SMM > Delayed/Blocked > > AP Count > > to decide all CPUs in SMI or not. >=20 > The code change actually assumes the SmmRegSmmBlocked, > SmmRegSmmDelayed > and SmmRegSmmEnable registers return the number of threads that are in > blocked, delayed or disabled state. > Can you provide suggestions regarding how to change those close source > CpuSmmFeaturesLib > implementation which still returns the bitmap value instead of count in t= he > commit message? >=20 >=20 > > +UINT32 *mPackageBspInfo =3D NULL; >=20 > The variable name is confusing. Can you rename it to > "mPackageFirstThreadIndex"?