From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) by mx.groups.io with SMTP id smtpd.web08.6044.1613725508235378302 for ; Fri, 19 Feb 2021 01:05:08 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=I7TFxBlR; spf=pass (domain: oracle.com, ip: 156.151.31.85, mailfrom: ankur.a.arora@oracle.com) Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11J94GeU111126; Fri, 19 Feb 2021 09:05:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=peem+hchwuwd8Ambz/j8BraugAi7vEGN0rZ8mmkOR9U=; b=I7TFxBlRIKXWZY5P+YKPvJpKcKjRArQDldtCntxG7Dk8gPOup1ADvNZHFvwXs1vEAw7b 1YrUBHM6dndaJWmOZ7P9+c2FAEVrtCip0JT86R9djGh0xtjAiC8wjh6EEQJq8XwDlXxB 0vUVLDSS8QUy2dSNesAJ975InseKLtwJmpxiFuPKwhbIwAGsCaPw8WEIA2ssb197OSRA 3LHTSxIb81/Gyz1M9AD2sRns6rOVjhN4VLH15wHP/jDeFJPDncC9YJ2f2pexeHhGspXr hI3as4p7koIV1ZHV/TMJuVpPhiVeD2jIZRg94nLIxhdMEl2Bf5CUCcTsjoW8gU78VJAI IQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 36p7dnrn81-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 Feb 2021 09:05:04 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11J8uDEf164199; Fri, 19 Feb 2021 09:05:04 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2169.outbound.protection.outlook.com [104.47.55.169]) by userp3030.oracle.com with ESMTP id 36prq1nxha-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 Feb 2021 09:05:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QPgr7VmdozPkpUOIJ9ERZkJ+sUqrhyoYDNuoGbjogr1vjkwSZqAcTNFVDq/sEUKTW71ixafOcO/23Dfz4tOr6YVIsDKeK8RIhMMkv+Pkckl+Ctnp2h/9S3P5fwLw1zjwrOT1jWfU1U37/qfPlMqOcopZW22huUq/ZH5CesDaXIGrsbGJf59EVgPPwO4T49jtdgORrwpYV/qinziJ8jp6DsY1fPjlDddpaniHtzjMUFAYg/zEwaSMkBeVh8Qf1v3uGU/JchJl5mx5N1fIkx+wQ6X2YFhZZTNkqwbA5vwTY1P4QQd+eKGpiYxsMP9qi0ILDN8jXIpmVd2xUgUxF4A2Mg== 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=peem+hchwuwd8Ambz/j8BraugAi7vEGN0rZ8mmkOR9U=; b=BLY3Lpt+IsC9OTerGGr4DqhHFf27pvUEVaHYQRiT/66NAMm6/GP8Ql/S0YPKvENkY9Ih8bUrOK+x3kbtlct+uZzjSpdIgyI5ru7X0M0ia7ePvvMg1MTO6X2FC9ab13DYr8JKXugCQUhugmQwjNjeD8xVnc61ViP38jTNakww+iQQi/Uk5Br2GmVC55dAr2pWMpTcNgV+UKEQcCzyduRXZBU5Z/BiS9XrAAI8WK7fqwPz57+tHrCDHILEtMzduu5zbFlt43ANEkyyNSDwnfZJMNZOVfwwUDd3540tqaC0QrpoNaIGdkmoBJVe2dy/C8uXYFGr4uGt4lNw86VnZHnv7Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=peem+hchwuwd8Ambz/j8BraugAi7vEGN0rZ8mmkOR9U=; b=EwRcHlEkokW4uA8yxWVmVmkDCJZlk/b6iRble8nZfwTK1d4m5aqtJLsUksxBUFOjvPapSCy3S+e/OGVywDwNMxw2XJw0We3wAc9L+mMNE8WcywyPXhnpJoo9cDap8M+EnnJbjg8G44H8pDrtd8YQAwFkLxn85he93upoZgR+RPI= Authentication-Results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=oracle.com; Received: from SJ0PR10MB4605.namprd10.prod.outlook.com (2603:10b6:a03:2d9::24) by BYAPR10MB3605.namprd10.prod.outlook.com (2603:10b6:a03:129::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27; Fri, 19 Feb 2021 09:05:02 +0000 Received: from SJ0PR10MB4605.namprd10.prod.outlook.com ([fe80::a021:790:7ce6:6f16]) by SJ0PR10MB4605.namprd10.prod.outlook.com ([fe80::a021:790:7ce6:6f16%6]) with mapi id 15.20.3868.029; Fri, 19 Feb 2021 09:05:02 +0000 From: "Ankur Arora" To: devel@edk2.groups.io Cc: lersek@redhat.com, imammedo@redhat.com, boris.ostrovsky@oracle.com, Ankur Arora , Jordan Justen , Ard Biesheuvel , Aaron Young Subject: [PATCH v7 07/10] OvmfPkg/SmmCpuFeaturesLib: call CPU hot-eject handler Date: Fri, 19 Feb 2021 01:04:41 -0800 Message-Id: <20210219090444.1332380-8-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210219090444.1332380-1-ankur.a.arora@oracle.com> References: <20210219090444.1332380-1-ankur.a.arora@oracle.com> X-Originating-IP: [148.87.23.5] X-ClientProxiedBy: MWHPR13CA0004.namprd13.prod.outlook.com (2603:10b6:300:16::14) To SJ0PR10MB4605.namprd10.prod.outlook.com (2603:10b6:a03:2d9::24) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prion.us.oracle.com (148.87.23.5) by MWHPR13CA0004.namprd13.prod.outlook.com (2603:10b6:300:16::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.8 via Frontend Transport; Fri, 19 Feb 2021 09:05:01 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fa14554c-81f9-4bdf-59be-08d8d4b570df X-MS-TrafficTypeDiagnostic: BYAPR10MB3605: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GbxGzF+WopetGtYLXlRbcM2HmfxAmndGLZFes5YVPgcB00oNKkXrC9w/cG1ZsEngXJnpsgzGiwwkgr0lsvWwWuxsEhQTO2qgXxx8nnCgZYS0yl7qz+EfSUYy6QzaJLMBljvUghVtrdO7W6hhdLMqjyXGSreh7mOvj3HsFGvWtJfsKNtsNWJsFnijuXq4fXgq9IdSnZdWN1TqYplYkoEKGGXKk1URT6GLvqD1NhJBy1X0fsAaGagEcVuQnjMcCnAPVp+MFy99+PRaKOIhJoppEz0xRDLqGcXgN/fA+oKIFd+q1Ny9RxTLXlX9E0eLrC2ifqQbss0uTG3+AV6wCij509UYPCzINPastfUIOw8BFPE/p1dVrKisdhupHBVo3jUSYOy8JrlockIvJLYbvvnLPLk05afntxPs4Q8ULDC6lKWITALfSUJHCJSmT2NEtLCQLaC0XePHpmzthLD6JyTojVIa3hzZRu3LPf8nX0VsEjAUg0PINyzxFtVGUqK/wK01L8QVg1jGTvRZv/pQ8tH+OE1u9tS3IPbxM+2+0lqg5nhzlV5MfV1NaEhLvzHN6cAYV+otB7Y/kLjGXzgic4u6kOBAi127VAEApRIoiJVGDRE= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR10MB4605.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(376002)(39860400002)(346002)(396003)(136003)(83380400001)(7696005)(66946007)(2616005)(66556008)(6486002)(36756003)(86362001)(316002)(6666004)(54906003)(966005)(8676002)(66476007)(52116002)(478600001)(956004)(4326008)(5660300002)(6916009)(8936002)(2906002)(107886003)(1076003)(186003)(103116003)(26005)(16526019);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?CjXd+kEgKQUSbS/qKHa03KqPfhwpOptvuYht8PO6ormKhEK8Htad4gRrvQwt?= =?us-ascii?Q?QIac+BaJ25EZ5i+76/0nRL/Kc4T1a5GoHmCNGPpKvJB90w2xScyYpNPxhmnY?= =?us-ascii?Q?RQdW7pkJbm3R1ciba/I7jnL9Q/wUqNketWWUB2ZTIDKg2TyihDtoc6Y03Up9?= =?us-ascii?Q?2xTE0G43VW8Wal6emTQ8mL56HUFGal7GVO9ZObLrc/2JDzmWLwvjF8kpMjpJ?= =?us-ascii?Q?oY2F+NoP2heEFueyNpA5WIQzyfIlUP2YWigw/0+i7vlrDBQmURWsOf0ofVL6?= =?us-ascii?Q?yaSF29FTnH5UBID3L4P0F4BXKFuMhmCYvN2AHy7gotA9GIs7+Z8wli+jTIhD?= =?us-ascii?Q?hCHPitNjpX8+9QJDMV/yEvVWaIKRSvExNyiYwk54gMaG86jSC7Ek9bWcWMVj?= =?us-ascii?Q?i3NiN6zkhvkEPY6RBBQxARTKiHOiFWekayP4zdn9ErLD78fiL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N/Kn3ewkS?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: fa14554c-81f9-4bdf-59be-08d8d4b570df X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB4605.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Feb 2021 09:05:02.2771 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 1GwGAQCNnnexzeZ2tu1VBtU/QEGebFkiyE1ccmCryWeOuGDwyA1qE6SybSt6OAfsI4EPiWSe717qVxVA97dTPo571y85tSxOkIgbpzIFFYs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3605 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9899 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102190070 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9899 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 spamscore=0 adultscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102190071 Content-Transfer-Encoding: 8bit Content-Type: text/plain Call the CPU hot-eject handler if one is installed. The condition for installation is (PcdCpuMaxLogicalProcessorNumber > 1), and there's a hot-unplug request. The handler executes in context of SmmCpuFeaturesRendezvousExit(), which is called at the tail end of SmiRendezvous() after the BSP has given the signal to exit via the "AllCpusInSync" loop. Cc: Laszlo Ersek Cc: Jordan Justen Cc: Ard Biesheuvel Cc: Igor Mammedov Cc: Boris Ostrovsky Cc: Aaron Young Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3132 Signed-off-by: Ankur Arora --- Notes: Address the following review comments from v6, patch-6: (19a) Move the call to the ejection handler to a separate patch. (19b) Describe the calling context of SmmCpuFeaturesRendezvousExit(). (20) Add comment describing the state when the Handler is not armed. OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c b/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c index adbfc90ad46e..c5cfe2610c23 100644 --- a/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c +++ b/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c @@ -467,6 +467,19 @@ SmmCpuFeaturesRendezvousExit ( IN UINTN CpuIndex ) { + // + // We only call the Handler if CPU hot-eject is enabled + // (PcdCpuMaxLogicalProcessorNumber > 1), and hot-eject is needed + // in this SMI exit (otherwise mCpuHotEjectData->Handler is not armed.) + // + + if (mCpuHotEjectData != NULL) { + CPU_HOT_EJECT_HANDLER Handler = mCpuHotEjectData->Handler; + + if (Handler != NULL) { + Handler (CpuIndex); + } + } } /** -- 2.9.3