From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web11.13327.1660641309370199735 for ; Tue, 16 Aug 2022 02:15:09 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=QwNVRUT7; spf=pass (domain: intel.com, ip: 134.134.136.24, 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=1660641309; x=1692177309; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=qOXBpFtekCgcVADJUrnx39HElXmX8Tgj2/bC3Pta5+M=; b=QwNVRUT7afP687FQsVpJZOEdVB1cOu5RKPPCPuE7HRHv6N7Oi4Gp8Pz/ rlDOW+bpu74GeXX0LCaB7x8d7n+IVKf7hE3BhuFmrvcF/lZ1cdmKdG+EQ B4TGF9bvKXjhYnFKkCOttNe8ItmUVHOLEk2QGpjOBzE8/cJ7qyb/58Abg 3YtOM6HhTlebTwm1LoLVpkpmr1KK2DCk9FUd5CJ5j2fMQOuwvZpL//6R/ SGr/J7blTksbw9eSLzsmz2E5VUVyyL26aVhvazSHW3g2mksTJ46sPzVFD XLcY5QeXvKGyfSfTAPoe3IsbM69WmJrRMsbsJ/qGSatdXCrJQzMkhK4PB A==; X-IronPort-AV: E=McAfee;i="6400,9594,10440"; a="292965453" X-IronPort-AV: E=Sophos;i="5.93,240,1654585200"; d="scan'208";a="292965453" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Aug 2022 02:15:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,240,1654585200"; d="scan'208";a="583226488" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga006.jf.intel.com with ESMTP; 16 Aug 2022 02:15:06 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) 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.2375.28; Tue, 16 Aug 2022 02:15:01 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28 via Frontend Transport; Tue, 16 Aug 2022 02:15:01 -0700 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.44) 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.2375.28; Tue, 16 Aug 2022 02:15:00 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MAE/8dU3qXEZrTuKuS8yglNc9orZXJM6Nv7nNC5jgdimvULWYkVb3c7NovCtxBUGAtbCaXdKM1evbFl3IS7EYY8AqjPkVVLbDWmOVohe5CXZ18yVoZyGPGwOwK0icxwCxg3Vnh+1iLobAkyhjD61AVBt8lFNsycL2H640NfCKH84ISCRuEQW9Efgz/w3hWq375Z3lFjU666MFdhwlCo9HopIBXLZy1R5g8vreKxtqfiFIldmVhjWyxKNVh50lU3h1SiSCouebqh/leadlB6DTZWbE+CP0pI6hDOQqduwTRZ+3ygbh9H3HX/zuO6FaS1lUwOYuY/Z1PHXFYerzaFUrw== 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=rpUn16FKg4de+2jDSsGAcXTj0LRvdIzfF+8mWt4a60s=; b=XyaAuKjRy5yJD39f6uiK0VAPMjXm/+W6NihkYJlqSYUQoRpJgjjKYOHP8Fvb+Wvun7LmwqhtZ1dVibhQKBEXZsEINOXNVssyOqLAZqMaQK41SEzkBKg9X7kPUZ55dNmk+TREte/TffA//RQOBsEKt989l1CHRYgxOYnxI4oxaIdX1SLMLyOcYrf1d/S3APP7CLJCTGk3jUlxImyGZrGzEtAodTrh6zxRPIwFrwKfx7/3Jd6+Hq7TG6DPQUwdyPp2rz/ARDw4OXQwJ8yspSTKMH0bqTpwo/5o2b+GCdC7ngd4A8soh85HD2+U0TZSC/Y6fd4GcTJd1/ffkg8nuJ/drg== 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 MWHPR11MB1631.namprd11.prod.outlook.com (2603:10b6:301:10::10) by SA2PR11MB4972.namprd11.prod.outlook.com (2603:10b6:806:fb::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.16; Tue, 16 Aug 2022 09:14:58 +0000 Received: from MWHPR11MB1631.namprd11.prod.outlook.com ([fe80::958b:cc9d:ac3:288a]) by MWHPR11MB1631.namprd11.prod.outlook.com ([fe80::958b:cc9d:ac3:288a%10]) with mapi id 15.20.5504.027; Tue, 16 Aug 2022 09:14:58 +0000 From: "Ni, Ray" To: "devel@edk2.groups.io" , "Xie, Yuanhao" CC: "Dong, Eric" , "Kumar, Rahul R" Subject: Re: [edk2-devel] [PATCH] UefiCpuPkg: Use Top of each AP's stack to save CpuMpData Thread-Topic: [edk2-devel] [PATCH] UefiCpuPkg: Use Top of each AP's stack to save CpuMpData Thread-Index: AQHYsUXlyUl6D+c1Z06oZgHqOzUDS62xOjzQ Date: Tue, 16 Aug 2022 09:14:58 +0000 Message-ID: References: <20220816075715.932-1-yuanhao.xie@intel.com> In-Reply-To: <20220816075715.932-1-yuanhao.xie@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-office365-filtering-correlation-id: 7ca99c9c-07f2-4f4a-d394-08da7f67cad3 x-ms-traffictypediagnostic: SA2PR11MB4972:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 41l7DegA48HTMAHE0lztTDvmmd1NZB3ozSAeOWE/SRdlbr0YkcV1/g2io9CIchXXWWvbOSxSlA2nYowKtSH/x3NPHv2mF6qfqxBzNwXB3RqGbpUrpnXAyMh36THZDCW0AyeXFK15qYXjauGzRVSz0gWPzmzvqfU3pQ86rWBIsmw2vzCkUoi39P5IasNR8w1DxqNU9F0UFRby1orFT6vnXpuFogNxJlexTHsFFUlax5V46MlFGJpMfMd/GbroheWiRy/f02jV6V1biQa5woNuJt1utDqUakt9k5h6UuPzUlekKVz0NIrAaOcHmHno+ileY7TbA2IKK9L045pIVYxO9MFUq/mPJwX7Vub9MTAk+61SaWiJNSxi6eViJLfX1tKDNPB5d7oFAHCDthB72baACsWTR2ydLkpPskVDUEK2Yvkox50D50cc0N5DvPgFw7XCvBVSgNaF2oh3wnkFU+kFEE8/ok+LF0jv92nSYgiKshQCNLxc9mdSFZrV2TaTV4oQ2B+yIPMkrvPX2jI4W50J7hbsbKys9SQCnTtKR4WjCszXwUFQWdErpRM6WxlIwOpFnVlU38HbhEwanj/stqZIbofHtoMC4Plohi2e/bAQVNqDG68OwikhMMtbQfJSion40caZQrcXpu7URE9Y19xz0rGcIxiGAxcIDfdw3Khd6lleEIT9alHqq6SGOuh/kh7t1yaWMz/TjC6ytp9qXWtVvAhjZcs4c5D6O20gNeih1k4Qvomg0vC3zjFKqXwKuYbErciesqeJf/G+D02EwzNyjmCLvWd5lyiPmUumy4afQUqCpjilB1r3aX1IIU2bO+sL x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR11MB1631.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(6029001)(376002)(346002)(136003)(366004)(39860400002)(396003)(52536014)(8936002)(55016003)(2906002)(82960400001)(5660300002)(86362001)(38070700005)(38100700002)(122000001)(71200400001)(7696005)(54906003)(41300700001)(6506007)(478600001)(110136005)(6636002)(66476007)(316002)(8676002)(66446008)(66556008)(64756008)(4326008)(76116006)(66946007)(26005)(107886003)(9686003)(186003)(33656002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?mlByIdG0Mh5o+hpGpTS95sTvV1wEb2q1+jMDHvtB4v3INJm15ycWBtJ6NCnu?= =?us-ascii?Q?XmX8qyQ+2QzXzKGcc/RYUkVNyl/sTINhVdQTy5tlU9VkP74ye6HYsUBlNzLm?= =?us-ascii?Q?1fboVqMbYmdgpMVzrAPohQ9p8a3urWeDCzcOhbZvux2KBun+ZNtf02jPlzo9?= =?us-ascii?Q?pW3RBPe5rDX0Hw90J7h8yp1uU56bUi5e+B1e9vXuoVjTevajErS+6ZcoymU+?= =?us-ascii?Q?40FKfXDwwZI7bVBGqNHUjkUxYsAcltzQ/cERMv37bpLWXLINBOf4Gi1/FIWN?= =?us-ascii?Q?Wk+qC/Db5oW7NuGD5UO0IJh2OBdBxDPoewqXvp3MghQoS4RkjV1FYXFVXb4M?= =?us-ascii?Q?PAUAPMbkG7AVPXYbBcHHQtRKj2dI6Fyd4pNd1dYe+vgHToidlnyvv5kK42jP?= =?us-ascii?Q?uJHUg9sf0fXGyc1VHyL2FnEARrUZvKM828+0XoYtSV3H4wKs1qrNlIrk6sDq?= =?us-ascii?Q?oAybZ5WXZBpZBbP+q0dd8hKFOeXJylglXWtY1/ht5VtaWsdY7jw/5K4BtEuX?= =?us-ascii?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EtDHdSd4/ECxsy2oC85fRZlnun8u/rFfM?= =?us-ascii?Q?QYfyO+Kr4K6nRZLl7WXPdWyoMNI4ridoh7/aPdaCOiJQB0A5hXAdtTzkxarF?= =?us-ascii?Q?30omCf0uBmN63VaJgnw2RPYQ+4iBDt6RADSlk3k7DB3UZNziWpoEirEuyojI?= =?us-ascii?Q?NvLSRpIpXSs9SrTf5XI=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MWHPR11MB1631.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7ca99c9c-07f2-4f4a-d394-08da7f67cad3 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Aug 2022 09:14:58.7429 (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: tfsc2LekbygwIb7ONrB7CVZmAsqAKzWV5XWa9D2XMxKi76urWkkOr27dsWstdy19zU3AUPaoLPwOBbrn/h/YaQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR11MB4972 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 > - MpBuffer =3D AllocatePages (EFI_SIZE_TO_PAGES (BufferSize)); > + // > + // Allocate extra ApStackSize to let stack align on ApStackSize bounda= y > + // > + MpBuffer =3D AllocatePages (EFI_SIZE_TO_PAGES (BufferSize)); 1. Above comments are not necessary. Can you please remove them? > ASSERT ( > - (CpuMpData->CpuInfoInHob + sizeof (CPU_INFO_IN_HOB) * > MaxLogicalProcessorNumber) =3D=3D > - Buffer + BufferSize > + (CpuMpData->CpuInfoInHob + sizeof (CPU_INFO_IN_HOB) * > MaxLogicalProcessorNumber) <=3D > + (UINTN)MpBuffer + BufferSize > ); 2. Can you try changing "<=3D" back to "=3D=3D"? I agree that "Buffer" shou= ld be changed to "MpBuffer" in above check. > - For AP, the structure is just after IDT. > + For AP, the structure is stored in the top of each AP's stack. 3. Can you change it to "For AP, the pointer of CPU_MP_DATA is stored in top of each AP's stack."? > + ; > + ; Reserve 8 bytes for storing CpuMpData. > + ; Using sub rsp instead of push rbp to avoid overwriting existed > CpuMpData 4. Can you explain a bit more in which case the overwritten may happen? I guess the overwritten may happen when the PcdCpuApLoopMode is ApInHltLoop but pointer of CpuMpData is only stored in top of AP stack in first time INIT-SIPI-SIPI. =20