From nobody Thu Nov 14 17:04:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+69973+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+69973+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1610049332; cv=none; d=zohomail.com; s=zohoarc; b=LRYFQUYIHw/DXUHx3gSdSqO4v3EFsZCb4eeF52nEw0DMUjXGCyaAyHpyZkAtOHaf5SeE6KkxZ5sDMtiJxB6fJbTorA+CrHeWYOZBcCwtesTc+a2CKXVRz74IjXXz6rhNSLZIishEOB63FjcxiLqRAYJwxAPdnkBrOHXV33d1uaM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610049332; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=wiSL1dxU4XpDBh7p2B8uxETCSyf6XiaRuLFQ1bCOvNM=; b=NCTlH1DhNcP11KW5IzLm6x3XXH5+e8X7vq7iXGaIOcE+2fUx+ournHGjRgtTK8AVXKNsoeLCh4hdHhEWqzSlDAbwxm4y6hbOC13fTK99Z8ewlBxClY7WZQn8SdvRZ4+mKuNXwnU5GePVPZxip/eeibprxguh6045Fti0raPJYSA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+69973+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 161004933213165.26538670143475; Thu, 7 Jan 2021 11:55:32 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id XRqcYY1788612xHzNhvwF0XJ; Thu, 07 Jan 2021 11:55:31 -0800 X-Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) by mx.groups.io with SMTP id smtpd.web11.2142.1610049331141846464 for ; Thu, 07 Jan 2021 11:55:31 -0800 X-Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 107JtUhX013659; Thu, 7 Jan 2021 19:55:30 GMT X-Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 35wepme2js-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 07 Jan 2021 19:55:30 +0000 X-Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 107JaWWq023991; Thu, 7 Jan 2021 19:55:30 GMT X-Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3030.oracle.com with ESMTP id 35v4ree7ru-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Jan 2021 19:55:30 +0000 X-Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 107JtSrd021829; Thu, 7 Jan 2021 19:55:28 GMT X-Received: from localhost.localdomain (/70.36.60.91) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 07 Jan 2021 11:55:28 -0800 From: "Ankur Arora" To: devel@edk2.groups.io Cc: lersek@redhat.com, imammedo@redhat.com, boris.ostrovsky@oracle.com, Ankur Arora , Eric Dong , Ray Ni , Rahul Kumar , Aaron Young Subject: [edk2-devel] [PATCH v2 06/10] UefiCpuPkg/PiSmmCpuDxeSmm: initialize IsBsp Date: Thu, 7 Jan 2021 11:55:11 -0800 Message-Id: <20210107195515.106158-7-ankur.a.arora@oracle.com> In-Reply-To: <20210107195515.106158-1-ankur.a.arora@oracle.com> References: <20210107195515.106158-1-ankur.a.arora@oracle.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ankur.a.arora@oracle.com X-Gm-Message-State: 0rBqhdlMo397JcZml66jwA2Gx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610049331; bh=IJwN+XiiTbNO1p3UMDUcvZHlkDI4kZyvYGUaQiNU5z0=; h=Cc:Date:From:Reply-To:Subject:To; b=qKOAJT6ZGf261JcHdkiBzPx2IRNwp+fxTExtbeQWUh8kGVIFGmXwOI0jgGq6aIuXpaH 2ZHRtu+Y2PkFQ7QYxjyoipDFkp9Eww3dOsYiZEOAVsIAZ9hvemDuGWclYDbMCh4kUEOI7 736ulSa6x7ytq/qwg+WfId2uQCz9BkQMLI4= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Initialize IsBsp early to ensure that this variable reflects the BSP status correctly. Also replace this check: if (mSmmMpSyncData->BspIndex =3D=3D (UINT32)CpuIndex) with: if (IsBsp) Note that there's a window of time when these two diverge, when the BSP, at exit from BSPHandler(), resets mSmmMpSyncData->BspIndex. Cc: Eric Dong Cc: Ray Ni Cc: Laszlo Ersek Cc: Rahul Kumar Cc: Igor Mammedov Cc: Boris Ostrovsky Cc: Aaron Young Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3132 Signed-off-by: Ankur Arora --- UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c b/UefiCpuPkg/PiSmmCpuDxe= Smm/MpService.c index 4bcd217917d7..e7ea44eb86fc 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c @@ -1565,7 +1565,12 @@ SmiRendezvous ( { EFI_STATUS Status; BOOLEAN ValidSmi; - BOOLEAN IsBsp; + + // + // IsBsp starts out as false. Once a CPU gets elected as BSP, + // it will transition its value to true. + // + BOOLEAN IsBsp =3D FALSE; BOOLEAN BspInProgress; UINTN Index; UINTN Cr2; @@ -1656,7 +1661,6 @@ SmiRendezvous ( // // Elect BSP // - IsBsp =3D FALSE; if (FeaturePcdGet (PcdCpuSmmEnableBspElection)) { if (!mSmmMpSyncData->SwitchBsp || mSmmMpSyncData->CandidateBsp[Cpu= Index]) { // @@ -1679,6 +1683,8 @@ SmiRendezvous ( (UINT32)-1, (UINT32)CpuIndex ); + + IsBsp =3D mSmmMpSyncData->BspIndex =3D=3D (UINT32)CpuIndex; } } } @@ -1686,7 +1692,7 @@ SmiRendezvous ( // // "mSmmMpSyncData->BspIndex =3D=3D CpuIndex" means this is the BSP // - if (mSmmMpSyncData->BspIndex =3D=3D CpuIndex) { + if (IsBsp) { =20 // // Clear last request for SwitchBsp. --=20 2.9.3 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#69973): https://edk2.groups.io/g/devel/message/69973 Mute This Topic: https://groups.io/mt/79507540/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-