From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (NAM04-BN8-obe.outbound.protection.outlook.com [40.107.100.48]) by mx.groups.io with SMTP id smtpd.web10.17151.1600876247120565548 for ; Wed, 23 Sep 2020 08:50:47 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=UPD2Q0n6; spf=none, err=SPF record not found (domain: amd.com, ip: 40.107.100.48, mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BS54m5ZDDZjj5IthOf6DiY+DQUxSqCkdkGMThriy3odEn9B1LyoU09XDwSjrAWsoO4vHeQZQqhgJrWxLPQb3EM/z5MPPIboortaDUQftkwg2nne/9eG+jyUqMEhQB0ucpMlgdAkxg2leaEKqHFCEc+AquikwzKAVPTmFOVkYaTfbYPfvo46UNhjv8wlgIiY79W2MwNEnKQrYoHUH3UAJA38xZuUVVY1ixpiai+LuCCoZTsab1uY7vEn/XxAzv3udtPOQNOScLJ0i8SSkz7x2fZ5ns6aYLg4p+U40FB6B3c4fN9QgObMHWEAOhS2nElk6mxzvIdlSMgp0urpLo814dw== 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-SenderADCheck; bh=spEYOqIpvMVmzBQXw15GfdgTANF/fKQYR4T/haqgKao=; b=C1DDmiDWTzaJej3fFCuj77Ebw3bWnLlJgOXieW131ACFtCm+g+gTIe2vIYJ7BrZyJzY6oIOmrOmKl4ZbCVVwzOaif/C4A48oyVoaYW3PDF7CWxpJPn2IUpHD5RpoW8cpBHy9Z3U3NC+jA6D7IeZCQ8DBo93eksUWqiw8M9M3W9xx/0eAM5eNCBHfBLful+DiMchruHNDFTdf43GZq55ntyfG5eDvhZ0ZmlzV5EPopQTKeVEMgfLIFvGzJUCq8hipp1qtckS7SxQ2xLJNvMg4hJnfO//7zLH4UlL9HWfjUR0W0BiDSx/tqY6XahTiJBOVsFtdohTqIOEkXlmxA9jZxQ== 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=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=spEYOqIpvMVmzBQXw15GfdgTANF/fKQYR4T/haqgKao=; b=UPD2Q0n6UVNQa8EfYUSx1BaisLuVDOl9RBOPxUbjRinPkO+IbBeLzPaqlkc2NXLgFnYFffdgyoSnSOuIx2KdEgOLAkrBnNBgFpL9cuygTNRCOgZbSAGJrZrjPyaobKt1Bduaw08/Xb/aOS87eZvRk0+RGMhUu2efgMojpXmZ7gA= Authentication-Results: amd.com; dkim=none (message not signed) header.d=none;amd.com; dmarc=none action=none header.from=amd.com; Received: from DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) by DM6PR12MB4353.namprd12.prod.outlook.com (2603:10b6:5:2a6::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.14; Wed, 23 Sep 2020 15:50:45 +0000 Received: from DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::299a:8ed2:23fc:6346]) by DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::299a:8ed2:23fc:6346%3]) with mapi id 15.20.3391.024; Wed, 23 Sep 2020 15:50:45 +0000 Subject: Re: [PATCH 1/1] UefiCpuPkg/MpInitLib: Reduce reset vector memory pressure From: "Lendacky, Thomas" To: Laszlo Ersek , devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Rahul Kumar , Brijesh Singh , Garrett Kirkendall References: <22eb2625-6ece-6f1d-43b2-4ca6aad54b9c@redhat.com> <58ed06b7-dc6e-61ab-1e82-ec14d10a700e@redhat.com> <934ea92f-4e83-37ae-cf3d-a8e252bfa68e@amd.com> Message-ID: Date: Wed, 23 Sep 2020 10:50:43 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 In-Reply-To: <934ea92f-4e83-37ae-cf3d-a8e252bfa68e@amd.com> X-ClientProxiedBy: SN4PR0201CA0057.namprd02.prod.outlook.com (2603:10b6:803:20::19) To DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) Return-Path: thomas.lendacky@amd.com MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [10.236.30.118] (165.204.77.1) by SN4PR0201CA0057.namprd02.prod.outlook.com (2603:10b6:803:20::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.21 via Frontend Transport; Wed, 23 Sep 2020 15:50:44 +0000 X-Originating-IP: [165.204.77.1] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b9c96751-2a7a-43ff-2a8a-08d85fd86ef1 X-MS-TrafficTypeDiagnostic: DM6PR12MB4353: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0oYe2eyEYCw+z3EzdB5khi+9oM5m8GNo+2MWArbHBPErh+aLTTiF4tZ+8REUrGuqHI3geat0lw7Z6yqzHJG/Xm4khTBRGygK4yzvMylw0cllMXcvSNo2kwZj/qdebjYnDjWiLucdVpVfpjrXWlARr/3wAdxxiGkH6WJx+CziOAyyQebMZDIWsaZymIrIK3Q1DFG2nSt6MmtvfxLs6+2j4pvdWhLBUucvgrh7FOL++URr+ilyykUqexBXnW3ggmhT0lwu0AFAXO+JBdizIyqsPmlGcQ6OyZF0gJDcDdU0qnQJQ4LKB7w59KmbirohJ96MglijhUHfbt6ICI140ywn7PPhplPIokgPsc0gm/i6TD3f5QKY25OpkKsLdw1hEyDAjStuSosJDoA0PQgSmR/N6Qg4F9Fz+yiPnHpiB9de0bA= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR12MB1355.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(6029001)(4636009)(396003)(376002)(39860400002)(136003)(346002)(366004)(53546011)(36756003)(26005)(31696002)(2906002)(5660300002)(16576012)(31686004)(8676002)(66556008)(66476007)(478600001)(83380400001)(66946007)(54906003)(956004)(186003)(4326008)(86362001)(2616005)(8936002)(316002)(16526019)(6486002)(52116002)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 0ZTG9aKvmix1Ho7qSV7uC6bofAJ90WHYIFscz0MdMEgHZQdBvfcFlxGuK4TFdnh2Mdiz72VNeRFL4GdVVbpikGSbwKkxBhI0UFGyG89NRfCRYjazLCX0uC1NZ4q4Hq9CjRj/LW9IDw0moE0oULydI5iWoITG0B5px4h129Vuci151d6pB5FA7wLxjC98y+nqvfMTIfqRC++zeqO18G8DeiE80kV95NC9t/gGLXdtcH4/CRVmXZjw2NjL4roeD2WH9JqIE7pxxjFlWw3SuoRpqXJFwDPyo0ejV//3C75uheJQkpetPdEBVpVguceVgM0V2Bx1l6FHSqFBVEaRHcR5Wuo6WicjsYJomyou+ljg0NZTmfKJ/FC8SruOTK0Z0Obb93Zyp5ZbXYo8a47CatMnesp04KyBO09s6Z3FxtKImG2mm9cpJNA0K5OYxiHpjVm468Dzy88w1z383uZ2mx10PvkklmyXFV4B/zb7h0oRf+4lJyU1jlN+Ju7iqSHetKVX+8luDhzWBcpjvniq5EFnU+wd7W7FkIudyIKs0/UAuGfTAR7UzAAh3hofjjqH8gHuoAJAAIi10nKEZwXxrneXzOTqHh8ibZ0XuHsQM51P/MGuGK6MvrsICbLP9tWh9gd5tBEd/4tgT4lfNMKIhbngWg== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: b9c96751-2a7a-43ff-2a8a-08d85fd86ef1 X-MS-Exchange-CrossTenant-AuthSource: DM5PR12MB1355.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2020 15:50:45.3647 (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: 1YSFOswyVA4EtrPSwZbQH3nyTYSaUxf1WzdPlj81zGGDDLvJwhOBbavthdjVShFroXGsua8fJiy3JazLxasJLw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4353 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 9/23/20 8:58 AM, Tom Lendacky wrote: > On 9/23/20 3:31 AM, Laszlo Ersek wrote: >> On 09/23/20 10:14, Laszlo Ersek wrote: >> >>> (3) Even better... can you modify GetApResetVectorSize() to take >>> &CpuMpData rather than &CpuMpData->AddressMap, and then check >>> CpuMpData->SevEsIsEnabled? >>> >>> Hmmm, wait, that's not really simple, as we call GetApResetVectorSize() >>> from MpInitLibInitialize() too, way before we set >>> CpuMpData->SevEsIsEnabled from the PCD. >>> >>> So I guess we should pass a dedicated BOOLEAN parameter to >>> GetApResetVectorSize(), called "SevEsIsEnabled". At the call site in >>> MpInitLibInitialize(), we should pass in the PCD's value. At the call >>> site in AllocateResetVector(), we should pass in >>> CpuMpData->SevEsIsEnabled. >>> >>> The reason I'm suggesting (3) is that I don't feel comfortable with >>> checking dynamic PCDs outside of entry point functions / initialization >>> functions. >> >> You know what, never mind (3) -- I've just realized that >> PcdCpuMaxLogicalProcessorNumber may be a dynamic PCD too. It might >> require a lot of work to restrict all dynamic PCD accesses to the init >> function only, and I couldn't necessarily justify all that work at the >> moment (for myself or for anyone else). >> >> So please consider (1), (2) and (4). > > Yup, will do. Re. #4, the code uses the APIC ID to calculate the stack start, so the calculation, now in GetApResetVectorSize(), uses the full value of PcdGet32(PcdCpuMaxLogicalProcessorNumber) instead of subtracting one from it. I can always update MpInitLibSevEsAPReet() to subtract one from the APIC ID value returned if we want to eliminate the extra 64 bytes. Thanks, Tom > > Thanks, > Tom > >> >> Thanks! >> Laszlo >>