From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) by mx.groups.io with SMTP id smtpd.web09.4820.1615530430032009159 for ; Thu, 11 Mar 2021 22:27:10 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=pB/wzy2+; spf=pass (domain: oracle.com, ip: 156.151.31.86, mailfrom: ankur.a.arora@oracle.com) Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 12C6A6oE178497; Fri, 12 Mar 2021 06:27:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=zfWqUcl0UEyaso86nUrcwZEbzhVsRC6GpzyXArBpvJE=; b=pB/wzy2+bEdpCha5hFGsiEze0/JpfS7n7qpuXdyp3WahKqoDFb3nxpjTW2TRuhcmt1m0 90oh4ErXiQsarlvvwWm/2A5HNb0Eshms4HtF/Tq+vvQyxobD5XecjR/ArPQEVyEpRZTn GMQ7VNepVZR5t6ajYIOyDfgBm5Qhe4cwb8xA5rWW48tioFvYiKM+j8GoqKIbBScuv39s 6w0P7eJAgzCxl3wlYztx/3l9F1jbIEc+UiX49zRG6fsECrRIWTEA9w26w/7TW23AlT7r bulMGaMcEeN+GUog4irqpxS9KMpT4/hqUpTxHYgEgtL1lkCTZ6T7/0A77I2mu3t16Cza Cw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 37415rgyee-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Mar 2021 06:27:08 +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 12C6PY03079482; Fri, 12 Mar 2021 06:27:08 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam07lp2040.outbound.protection.outlook.com [104.47.56.40]) by userp3030.oracle.com with ESMTP id 374kp243k0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Mar 2021 06:27:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LVV0+kufsAqAgMhuTnkwQhtPC5iFnFcWAnN45pk+H0FCBlsMv2i+kbqY9xdDwjweHzLV0M5FeRePqiEF49xtUDeVIZ7HWigpOWEV4uq96GMl+mnfvr2Ka3oEY0PGUehHc7US6+UCmLUG7kq50M2tuK0P5nmCr9lospbGY/wGCLEZxKkOBUjJMiAf6rBKtd23DkTLTsvYWnwBFGu5KzDNnHU7fbBsXqcjPeG8V5aGUAnsvqWl7NyN0+3ME+AjG6QTwAJzIDqdeg/4DwLuqCS3gjG9G/w41OwdUZL/wnYmgOxpDXlq1Y5x6oqlyeOHwfdEOG4jj16gkDcy/kjUJwrnrw== 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=zfWqUcl0UEyaso86nUrcwZEbzhVsRC6GpzyXArBpvJE=; b=fzbaEQVcO8QpItywMFJ2BYXNhLK25S3TKvhz8KEw5Bgkt6kinnF70wRPRfzGnxiDQ2LF6M6S1AIpUiyFQQTh64z3Woi2077rvrCXATeJ1IShOgLsNjNBokVegwSQ6fVxGt6lI5B0I+3EAhZ0XxHbl4/RoJ1D+xjAQk1IjlqRDggbS2KSlpYKWRGnr9yljlXgwkCqPJ7TYvAES9e+lsStDHU6Yr1VOh+bibLwZTG5eQ1hsimf8D56d2IgjRi97EaUCQJ7kMGgJA4rnxlon7qP6xDRmD39lRbfjqMyUnKgnkpA5O+7BCJRQpMhQalwCSbb31A+Zb54zY36NdYyznBhOQ== 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=zfWqUcl0UEyaso86nUrcwZEbzhVsRC6GpzyXArBpvJE=; b=gIkmardsGe9MNPx8DUoROtJLABDM10x7++trp7iseBAtno+A6N1QELYI4CE8R2wdRbKUogiLub14aFe3nXChhlgXAf4dKvJiekSTQ67BxevU7JSvl8S3Ncy5loM6hL9IdfuqWepIS91R+IGhUgjGhV9/IpQL2NytGHwfKq/nTZw= 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 BYAPR10MB3191.namprd10.prod.outlook.com (2603:10b6:a03:14f::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.24; Fri, 12 Mar 2021 06:27:05 +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.3912.030; Fri, 12 Mar 2021 06:27:05 +0000 From: "Ankur Arora" To: devel@edk2.groups.io Cc: lersek@redhat.com, imammedo@redhat.com, boris.ostrovsky@oracle.com, Ankur Arora Subject: [PATCH v9 00/10] support CPU hot-unplug Date: Thu, 11 Mar 2021 22:26:46 -0800 Message-Id: <20210312062656.2477515-1-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.29.2 X-Originating-IP: [148.87.23.12] X-ClientProxiedBy: MWHPR02CA0018.namprd02.prod.outlook.com (2603:10b6:300:4b::28) 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.12) by MWHPR02CA0018.namprd02.prod.outlook.com (2603:10b6:300:4b::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17 via Frontend Transport; Fri, 12 Mar 2021 06:27:04 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 433859d2-755b-4ef7-5a0a-08d8e51fdae8 X-MS-TrafficTypeDiagnostic: BYAPR10MB3191: 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: Bm7oTxY2f4IhjkkryQLI9/Cm7s4lOb6QV0kF4hmYszAQ3A3E7T57w8q+/VfLAegkbr0+advRTHeimCaebF5P7B2THo03CK1l3Ku8tmFFPkYNhxeo5KXSqXdNonKe31gjgrRmYC7P59zDHWyS9vlJtnjfLmG1bnyxDTdhxPg5Fl1rQ86lC6nll+QvBfTsX0mHzIvd0AefLu3EaQnI6VexOfaT43V1egOLtJ+9kn8942Y6HuiYJVNdmx1xBKIWx2upU23zv6pm5PZG7STMtwGpKQiC2ZLg7sY0kZxPJ3689uS5FQurXSWTjO4o2jqlOaK5VxTLtUPbqIX2ZBEhE4wdDoDwfX6p0K4QhJEOUR3g+fhNgWGb7tlR6aFFG0NSotwlot8fQ7PoH6uoRuz3CVnQwlj34fBfkvXd8iOBhOw63KHJuIHd7MPn2XkGEMMVOH5hhel2lVwjcxMsPZPqumrJm9z6CHWE7c9Z9wPTh9NptX6IIe/yWQcCtPxWzGY129JjZ8VXOvAoCBzSkkEpb0My7aLypMpHCaF5xoephMLDvNWZxYQF9sj/ssCKRcQMuw/h0DnKEdi92T7gA5KF2cX+JBYqForcDpWodjAOUgpRUQ8= 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:(346002)(39860400002)(396003)(376002)(366004)(136003)(86362001)(4326008)(36756003)(478600001)(66556008)(66476007)(66946007)(316002)(83380400001)(5660300002)(2906002)(6916009)(19627235002)(103116003)(966005)(6486002)(26005)(2616005)(956004)(6666004)(186003)(107886003)(7696005)(16526019)(52116002)(1076003)(8936002)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?siWKeAxYQuJwjqKZo/cOxP+nAZI5L6hHgpiXHE+5a+0QJ1xVwdwmCQHr9HlQ?= =?us-ascii?Q?2RmBAsg5yDCQIwL0l9SdwkMYEw2C1ktpqK+kpZcITvXlk3qSlP2jwThvcUiH?= =?us-ascii?Q?QdFaO1EWu+1G17atnORDZQ+URbDjR3Lq+P303Dtb/efNhqDf89gLd+Kl1ciL?= =?us-ascii?Q?23wKS6ynny5moGcrz35RjpeNjtVKO2Z1zi0zjkM8yn743nyrKa9i3k1HIEjy?= =?us-ascii?Q?twXFwccdRNXZPqXM7FeMUeFz81TIXh4jOfDdb/yawjRaGQfKLzvqNw3MWLtR?= =?us-ascii?Q?uknzGELCmb6WKPvltDeZwdLknaHAiLmHDYdR8d6O6/LvV9up0s4rTRRnuinc?= =?us-ascii?Q?KkNhEB3kueBH07QUtX/NxJ5QGe+8yQEKHUHR3cNd5HS3UY+YCCpfV3JWVRv9?= =?us-ascii?Q?LIdBtZM8ECRz527O2bAk5EZ+FcT4VnTlPq4Wca2eKAaZleSJzEaytFToeZl0?= =?us-ascii?Q?496hDOcvi/G5SmROHuYL/jAp3dAC/xgZM8rwZCtw9XUbyQFcrkAlOsUoCHy0?= =?us-ascii?Q?zA2Y5Pq/hBPefsg831g2DTDN8N7XO3W3YJ+1yrx3GQlR4g7rxxrMq+uImxpJ?= =?us-ascii?Q?N+LLGMbeGHweYgl99UVjHCU+Wt3vvJPnlWqX9G1E11+63uohkQgsv2Ota8jB?= =?us-ascii?Q?osgUhyS5GD3kPzFfl3/ruS+js+tbDQp7cqv+ujQDz9k4w5ri1RlLN9d/fOAS?= =?us-ascii?Q?sly92aRiI66yRyf2OitqQaP4U6zzuJvSC9oVcaPFiO08xkL5+rWy7SntUgJY?= =?us-ascii?Q?FxZsP4Tbe/JWW0Fv0368btHcfRyjy81dQBfrqrLKi8Jpf6Fy+7JdwqX5e4PQ?= =?us-ascii?Q?rMOs567rCtu2yugz3lWkp3RFQeUuofm4z2KSkXyyRslvQnlFCb5tw5UCkooO?= =?us-ascii?Q?YZQG+lk7Dut3yb944TnaNLRAx3sCq84HNnhnEXo9T+pPStdW0P5UphrkLPHU?= =?us-ascii?Q?eS2kxX2td3ywS+CYSN7YdWWATikJ1bqRhd0kCAYC6p52nbBifRGeWxft5z/c?= =?us-ascii?Q?w23n9a/xnH5ScdOZAJN8YczcxjTgwj/35981oqq2sGtOOHxKJuMiXqPU2SqT?= =?us-ascii?Q?MIZKQds5bSerRFSWmP1iqMHXAVdvQlrBOU55bohUjNe2xW8MwBTwjOyw71SS?= =?us-ascii?Q?Hyd+uAqZcTVnOCmkpEEzHDcCSlNhZ3N3OmAIE3B4+8tSRZ40PgJlMsfAjlIv?= =?us-ascii?Q?HgcTOtWJVJJNWyq5sYgElkdOR0SsSCh/c/Wsh0BGfItK+0K9wVuZH0vcQ4FM?= =?us-ascii?Q?hLyAfMPH8D9njQrUEmCjaFNQsMItHE2bOHZZZmlTMo4A6w9xT/WvDKGDnu2A?= =?us-ascii?Q?EXqFHA4XBjgQuUrMg6P8ibrY?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 433859d2-755b-4ef7-5a0a-08d8e51fdae8 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB4605.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Mar 2021 06:27:05.4363 (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: jfXVZ/2XEa8c6GDO/x9zgKiK83NcZoPf1sL8SrYqE4u1RJjoxU+Fw5zQPNk672vE5n5YAEzu/UEC5D/yRPaLnsaliS62BaLyL5qsVCoxZY8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3191 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9920 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 adultscore=0 phishscore=0 malwarescore=0 mlxscore=0 bulkscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103120044 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9920 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 lowpriorityscore=0 impostorscore=0 mlxlogscore=999 malwarescore=0 suspectscore=0 adultscore=0 phishscore=0 spamscore=0 priorityscore=1501 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103120043 Content-Transfer-Encoding: 8bit Content-Type: text/plain Hi, This series adds OVMF support for CPU hot-unplug. QEMU secureboot hot-unplug logic corresponding to this is in upstream. Also posted here: https://lore.kernel.org/qemu-devel/20201207140739.3829993-1-imammedo@redhat.com/ Testing (with QEMU 5.2.50): - Stable with randomized CPU plug/unplug (guest maxcpus=33,128) - Synthetic tests with simultaneous multi CPU hot-unplug Also at: github.com/terminus/edk2/ hot-unplug-v9 Changelog: v9: - Rebased on top of edd46cd407ea - Clarify comments around memory-barriers in patches 7, 8, 9 - Address other review comments from v8 v8: - Fixes a couple of ECC issues in the code (in patches 7, 9) URL: https://patchew.org/EDK2/20210222071928.1401820-1-ankur.a.arora@oracle.com/ v7: - Address review comments from v6. - Fix ejection bug where we were using APIC ID to do the ejection rather than the Qemu Selector. - Describes safety properties and ordering needed for concurrent accesses to CPU_HOT_EJECT_DATA->QemuSelectorMap, and CPU_HOT_EJECT_DATA->Handler. URL: https://patchew.org/EDK2/20210219090444.1332380-1-ankur.a.arora@oracle.com/ v6: - addresses v5 review comments. URL: https://patchew.org/EDK2/20210129005950.467638-1-ankur.a.arora@oracle.com/ v5: - fixes ECC errors (all but one in "OvmfPkg/CpuHotplugSmm: add add Qemu Cpu Status helper"). URL: https://patchew.org/EDK2/20210126064440.299596-1-ankur.a.arora@oracle.com/ v4: - Gets rid of unnecessary UefiCpuPkg changes URL: https://patchew.org/EDK2/20210118063457.358581-1-ankur.a.arora@oracle.com/ v3: - Use a saner PCD based interface to share state between PiSmmCpuDxeSmm and OvmfPkg/CpuHotplugSmm - Cleaner split of the hot-unplug code URL: https://patchew.org/EDK2/20210115074533.277448-1-ankur.a.arora@oracle.com/ v2: - Do the ejection via SmmCpuFeaturesRendezvousExit() URL: https://patchew.org/EDK2/20210107195515.106158-1-ankur.a.arora@oracle.com/ RFC: URL: https://patchew.org/EDK2/20201208053432.2690694-1-ankur.a.arora@oracle.com/ Please review. Thanks Ankur Ankur Arora (10): OvmfPkg/CpuHotplugSmm: refactor hotplug logic OvmfPkg/CpuHotplugSmm: collect hot-unplug events OvmfPkg/CpuHotplugSmm: add Qemu Cpu Status helper OvmfPkg/CpuHotplugSmm: introduce UnplugCpus() OvmfPkg: define CPU_HOT_EJECT_DATA OvmfPkg/SmmCpuFeaturesLib: init CPU ejection state OvmfPkg/SmmCpuFeaturesLib: call CPU hot-eject handler OvmfPkg/CpuHotplugSmm: add EjectCpu() OvmfPkg/CpuHotplugSmm: do actual CPU hot-eject OvmfPkg/SmmControl2Dxe: negotiate CPU hot-unplug OvmfPkg/OvmfPkg.dec | 4 + OvmfPkg/CpuHotplugSmm/CpuHotplugSmm.inf | 2 + .../SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf | 4 + OvmfPkg/CpuHotplugSmm/QemuCpuhp.h | 7 + OvmfPkg/Include/IndustryStandard/QemuCpuHotplug.h | 2 + OvmfPkg/Include/Pcd/CpuHotEjectData.h | 60 +++ OvmfPkg/CpuHotplugSmm/CpuHotplug.c | 576 +++++++++++++++++---- OvmfPkg/CpuHotplugSmm/QemuCpuhp.c | 123 +++-- .../Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c | 111 ++++ OvmfPkg/SmmControl2Dxe/SmiFeatures.c | 18 +- 10 files changed, 775 insertions(+), 132 deletions(-) create mode 100644 OvmfPkg/Include/Pcd/CpuHotEjectData.h -- 2.9.3