From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (NAM10-BN7-obe.outbound.protection.outlook.com [40.107.92.71]) by mx.groups.io with SMTP id smtpd.web08.5441.1664413486852745393 for ; Wed, 28 Sep 2022 18:04:47 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=B4zxnOGS; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.92.71, mailfrom: abner.chang@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q/POjbXGNBvvKe4QBv5OIW4beHGngSgpuoOhBWd7obueyU8t76wGro8OP65/P8D00FmppQ6TMyAwBehj1tdyaTa6Yfcc0ZYRdvNyg8GkfJgEk0MhePv3GWKwW1Nyym9N+EDqZm7FzzNcip2d5MfHQoODpxzzO8dSN7qWC0Z0SWeE8us5bH6GXT9n1J6DK9B5WD6T0qF0cLTPSJOpw5O8RTcEKOndTn75pEuRO3a8wDL/MuSBbwqH6jNZoxbKK/9f1TVlTm7HTgX0/YjADp4L3RtJj/SlzLMtNcCkm4EIw+X4qQKnGWf9Q+kokbbUjVL+v1/AUB6Rq/DLuT/jBvaNIQ== 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=1OBmBbssU2Dolns0b3sE3MIcibNlLKuDk2sWFDiE/oM=; b=lN0mYaWlzmbmphBu9Luos11tBCv16C5AXdLF4MHZ0kaU5LzJRiQZf1km+E+n5E2wgNThFMRj3xgmgFauxnZcRnmyADHTVQywRj4Ye2aGkQuMdoDedq7juuX/rhv57IWrZBnOg6w2E1eiCKFyuaGgw/niCb+iyUfbqPaUbuQQq/zi2uxqQFKc44c3Wn5D0jB3pkShVrG4ssBJvFbuDMFrWYrY8AAwuMid9uSsOdX3HUA1Ruz8F5wPqGVFhwKU73XlxmFhqzq6/r4sC4lo4fwKXmfgHq9kBTjM5Qoj1uUjaquLkdmmEg2Vo2TRK0vGJt2Kz2scL0zvxjYshPrljlAGlg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1OBmBbssU2Dolns0b3sE3MIcibNlLKuDk2sWFDiE/oM=; b=B4zxnOGSewegSvKBcxO5RoSS5ltYkvtJnjrdQLhoKsD+MXyYM/NuMKTwWi1+6qWjfylBFnVZ20fxWeu2rG/lXOD6wQ7x8fLhE0FNN6kA6/P3GI3/xofszZM+uEwt8RCFjZ+01RW98qt8mzpUh4uIxThVtlRVtXA/oiXT2z5l498= Received: from MN2PR12MB3966.namprd12.prod.outlook.com (2603:10b6:208:165::18) by DM6PR12MB4925.namprd12.prod.outlook.com (2603:10b6:5:1b7::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.17; Thu, 29 Sep 2022 01:04:43 +0000 Received: from MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::998b:f1a2:b183:43be]) by MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::998b:f1a2:b183:43be%4]) with mapi id 15.20.5676.017; Thu, 29 Sep 2022 01:04:43 +0000 From: "Chang, Abner" To: "devel@edk2.groups.io" , "dun.tan@intel.com" CC: Eric Dong , Ray Ni , Rahul Kumar Subject: Re: [edk2-devel] [PATCH] UefiCpuPkg/CpuExceptionHandlerLib: Code optimization to allow bigger stack Thread-Topic: [edk2-devel] [PATCH] UefiCpuPkg/CpuExceptionHandlerLib: Code optimization to allow bigger stack Thread-Index: AQHY0t0KVFpc4Jbrgk6fixMp2NYa5K31mHlw Date: Thu, 29 Sep 2022 01:04:43 +0000 Message-ID: References: <20220928015157.1647-1-dun.tan@intel.com> In-Reply-To: <20220928015157.1647-1-dun.tan@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2022-09-29T01:04:40Z; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Method=Standard; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Name=General; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=ccafca56-8b1e-410c-affe-1d14149cd83a; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=1 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN2PR12MB3966:EE_|DM6PR12MB4925:EE_ x-ms-office365-filtering-correlation-id: 5a571a85-4d6d-4038-365b-08daa1b69819 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: J9L1IOSK0GkEGQIhaFClRoXv5Wx/gE2GuEWWspTGiWE+DsDXw2ABfNyYjZ6KBLpIS/1NuWwLCJktLGpnhQcEWJs858Qbn2PUZFhes4RD+SPoz3w7yjySrCH5Lb0/c0aJEomoSY4SDds+rLnjI0W9W7uvALq4qpSNK5LQCpM9SUSeBZyIzTJ7UdBH13w9XGCT74pizJLYexyXlLIa3HOEMmNi9jrrGqqzuNYuPWFO1DPpgDQYCLsrGaP+AMk7NgnmLZfFW3ERp5Zt9l5KXdVS/rm4xyAwKoRhjQigAhgbPc1TFMWDj7qa+qmyTmwNnBkOqPSDyZelttgjpvJ4m9AUMIBzAdfs6z2WPUD9cCd6CQ8RUASzJXq8G3skEhHPeeORuMff5JfBt2qttJQgD7Cadv844qhYh1TA66cR6Podz8MhSEIAIFr2UrSh0ljULPTvqSEtuGat2TDBYi1hTA/QCooEicTNKR4YtjdjY8+O3btu3C1qg7GFC07GTj3257xvZIoYenQ41jzpb7cpoBH4VjjJh2+mqMubneYQ8TcuQr2hpgNI4Ojeg8QSDHFoGUVnVnL+lFMJXgpMsUwfg8GKwSsW74e2Nm4ijQvAH6x58oZfEWJfOfBlM9HPuPWnKOXHPoSc6/NiJ+eYBAPDWjY5T4r85LHusbeDpYNCQTqs/WNXGev0z4PzNSCaBX9rtoM4COpLpA2a5Uby5onW5AF8asGTOaU8py7V4WMXQEm8GMvxHMKMXSY4UtHQu6IytGDYHF5zIiuZmhJx9YjPJnviOj+qeAEetyZe9acVS02Kl6gnxMyyqasRZ69En1MtZuHjTwAYrsiWxRP/QToUFJxrML52Bx4S4WHfxS3/h/5Hx7Q= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB3966.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(346002)(136003)(376002)(366004)(39860400002)(396003)(451199015)(53546011)(71200400001)(2906002)(83380400001)(966005)(66446008)(33656002)(6506007)(7696005)(478600001)(54906003)(38070700005)(38100700002)(316002)(66946007)(8676002)(4326008)(76116006)(64756008)(66556008)(86362001)(41300700001)(45080400002)(55016003)(8936002)(110136005)(52536014)(5660300002)(122000001)(66899015)(186003)(66476007)(9686003)(26005)(135533001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Ehp4WyQOZGDnGgbaY/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2X4PkEE?= =?us-ascii?Q?jTi9CnmJAT1ZBCTj03Ic9EJE1Ov86gJSnZkywOfjSWhm9P1c97OxcM24CVDT?= =?us-ascii?Q?7T6vpP8tR5QTCR4AYZ5mmr59QqeZDjy6pVTErf7s9YPB+stCKDB6A61iqClV?= =?us-ascii?Q?e7/1N5UBiggKHz1uqCVbvGr1lYBEHKR6UOt85OA8KnKmWZQWbou/EWvbKbwR?= =?us-ascii?Q?2aVik0FlCEnmG7jBVDyBiyTbxjR9dm/eVJMlKTztohn0ZpU535+9W5faOVwQ?= =?us-ascii?Q?LeBzbnyZ+EwbDw/v6wLZW4M6dUcUbBEiOZ00H78K+JVlhc2qJFx1HgYOj1GF?= =?us-ascii?Q?NjG6bWRg77jw4wEp8K13Vr98th74bvBTgAHT/m8A0uT5tVT0+h+9YDm7kzEX?= =?us-ascii?Q?Tyrnxy44apvgqjCys+bESrJSHVLceyUB6e8u53eDp1+D0utA9DONnFh3eAXM?= =?us-ascii?Q?mj9ar8q7O7ldmUqDDfzf07EXHzwsLzJb62PuKggAzHqp5/LToCA0E6LDwcr/?= =?us-ascii?Q?Em91mD2Y0mEen6gVi3NtxoD1ggQcmgJvpf/7rCzhwQ/YUQoXsw7whzEIlaZC?= =?us-ascii?Q?TXZWx2k840iINeOq3uak01ieBqd6CR9fp8AWA6D1TOH2Yj3Ru6zrGOPucszC?= =?us-ascii?Q?80Otv5WfggbnsCil+xwE9FqdVwVoUkHfoCuOoDCBzyF5WkZ1gT8QMDSrmk9G?= =?us-ascii?Q?V1H9btwi9xdgkyr2X7txw4nllQMKunSBZMoBQUtL?= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB3966.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5a571a85-4d6d-4038-365b-08daa1b69819 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Sep 2022 01:04:43.3942 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Oo3NTJaRGnLc2HHPvYy/fQ9P/kM4UDXVfU88LDCPhlX/BnPUOujKL+dZ5gA7M0H/GW86XKnru3JXJeiFRgVhIg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4925 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable [AMD Official Use Only - General] > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of duntan > via groups.io > Sent: Wednesday, September 28, 2022 9:52 AM > To: devel@edk2.groups.io > Cc: Eric Dong ; Ray Ni ; Rahul > Kumar > Subject: [edk2-devel] [PATCH] UefiCpuPkg/CpuExceptionHandlerLib: Code > optimization to allow bigger stack >=20 > Caution: This message originated from an External Source. Use proper > caution when opening attachments, clicking links, or responding. >=20 >=20 > This commit is a code optimization to allow bigger seperate stack size in > ArchSetupExceptionStack. In previous code logic, CPU_STACK_ALIGNMENT > bytes will be wasted if StackTop is already CPU_STACK_ALIGNMENT aligned. >=20 > Signed-off-by: Dun Tan > Cc: Eric Dong > Cc: Ray Ni > Cc: Rahul Kumar > --- > UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler.c | > 2 +- > UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c | > 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git > a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler.c > b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler. > c > index 8c398ebc5b..c8fa30a32f 100644 > --- > a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandler.c > +++ > b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ArchExceptionHandle > +++ r.c > @@ -215,7 +215,7 @@ ArchSetupExceptionStack ( > // Fixup exception task descriptor and task-state segment > // > AsmGetTssTemplateMap (&TemplateMap); > - StackTop =3D StackTop - CPU_STACK_ALIGNMENT; > + StackTop =3D StackTop - CPU_STACK_ALIGNMENT + 1; Hi Dun, Could you please add a comment on this change says the change is for the co= mpact stack layout? Thanks Abner > StackTop =3D (UINTN)ALIGN_POINTER (StackTop, CPU_STACK_ALIGNMENT); > IdtTable =3D (IA32_IDT_GATE_DESCRIPTOR *)Idtr.Base; > for (Index =3D 0; Index < CPU_STACK_SWITCH_EXCEPTION_NUMBER; > ++Index) { diff --git > a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c > b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c > index 80e9f08e5b..74b2193cb0 100644 > --- > a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler.c > +++ > b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ArchExceptionHandler > +++ .c > @@ -223,7 +223,7 @@ ArchSetupExceptionStack ( > // Fixup exception task descriptor and task-state segment > // > ZeroMem (Tss, sizeof (*Tss)); > - StackTop =3D StackTop - CPU_STACK_ALIGNMENT; > + StackTop =3D StackTop - CPU_STACK_ALIGNMENT + 1; > StackTop =3D (UINTN)ALIGN_POINTER (StackTop, CPU_STACK_ALIGNMENT); > IdtTable =3D (IA32_IDT_GATE_DESCRIPTOR *)Idtr.Base; > for (Index =3D 0; Index < CPU_STACK_SWITCH_EXCEPTION_NUMBER; > ++Index) { > -- > 2.31.1.windows.1 >=20 >=20 >=20 >=20 >=20