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.web12.8810.1611643493481754541 for ; Mon, 25 Jan 2021 22:44:53 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=uf1FfzLd; 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 10Q6a3od054946; Tue, 26 Jan 2021 06:44:52 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=oOOz1yD3+dx1SMP3KR6rjEydlp6eaTmdBXO79fehl5w=; b=uf1FfzLdW5PIst98AQVhqn11wv35pD19X8pGzsH1EIfhIyjp5Q4FOHpSVAq59ZOaVZPY +RBZmqF1vFQX4oaT2Q/UXquWo01wdpEIiNxvLWKi4xVODaj64P3OU/rhRTyrC513/ZHI /ELgCFcLh7A7JKLSufAc4ka1wQ/LYV3xBBMnyLLUhIfal3WRqWm1JdDoObUU9CJokOZJ Klcf7K85dA4OlxgOdL006Clk5+IIEg5V7OuzRGDZVt9YmY4pIgkZ3BTB6sBH03iVpDdZ +sitKHiFndlb5NN7SNKg8pUnQYU0C/eO6OLeVq2gjHgCpdGDMroLMTjnT0nIP8fLT7JY bQ== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 368b7qrnub-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 26 Jan 2021 06:44:52 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 10Q6ZWIv002707; Tue, 26 Jan 2021 06:44:51 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2173.outbound.protection.outlook.com [104.47.58.173]) by userp3020.oracle.com with ESMTP id 368wjqs12b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 26 Jan 2021 06:44:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dtgkjc5tbRjGgyajjB5bubqNTJBxVkHIpWtHI1Db/6e3i/40V3UTY6e1O5UYJvTiR4ci3n27aE8mDjtQKhrpcQl8+j8mlFK3f/edKAm7C+payJxEJ5voJry2dVGKg7Yqn3tQ/N/7fKUe4JFHkSa4YNfORttjF+BVzHuSWjbfOeV/unobGk8kTNoCrW8EJHcfReqjnHZXI6ZXUFJnvLBM504BX+SF5oyIKrBHQ04IqNjVncEZ9TJYRG5Xc817f+wj0TwulyJCzWqUY2EwEWQ0RR8tyxZwtpxeXC7WP7+PuM2pEMAj9BCromK/xG/abcFT4VVv5gkGN8YkAvkK2koHSA== 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=oOOz1yD3+dx1SMP3KR6rjEydlp6eaTmdBXO79fehl5w=; b=FFChSIx3WUDLNhbCAhIlfNamIR96C1zw3JVbXlCijbzYXtkJMGKfoaqj+VoBr5YnkysFS4s9Od21af366ggTlND8AOBoTJ6oX+X4ZN/eqk7Gy6PISQPtQZhFpSGornpMC7pq47WJI3x2M2ki+iPZnhLlpkULes3SaNp/cByryKgLuHeZfvv2LZ0Rjcvht2LE4twyu1vRFfUlRmJ9StPOeTt4lpkCDjpSYVwrlL42TF0RTDyk089ifAHdFqoUeWlCmNrj7Mo/h1PLNlLYahD1w/rid6H0ZXUT6OX//X+Ckr7vl2jgcMLSdwA6DkIvnPU1A0vTe8Ogbh32SG5Lac71VA== 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=oOOz1yD3+dx1SMP3KR6rjEydlp6eaTmdBXO79fehl5w=; b=uwBL7YX6hmIKHoHt2LmV3BcT9gysTdNxQyms79a23+8niWMlSXJAnTQyo7MpZ3xHOtkUwS+eFdOQ4QVexVsLFw39n41jweK5Y8wDPdH4e5+RGWdv5gkjZZ55/mVYvVmErzjpDRIZR/2zrBhKTgGKiNMvgA/X5luiSK2owMiMTPg= 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 CY4PR10MB1718.namprd10.prod.outlook.com (2603:10b6:910:9::17) by CY4PR10MB1781.namprd10.prod.outlook.com (2603:10b6:910:a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11; Tue, 26 Jan 2021 06:44:49 +0000 Received: from CY4PR10MB1718.namprd10.prod.outlook.com ([fe80::39dc:6ba7:9397:cb6]) by CY4PR10MB1718.namprd10.prod.outlook.com ([fe80::39dc:6ba7:9397:cb6%6]) with mapi id 15.20.3784.019; Tue, 26 Jan 2021 06:44:49 +0000 From: "Ankur Arora" To: devel@edk2.groups.io Cc: lersek@redhat.com, imammedo@redhat.com, boris.ostrovsky@oracle.com, Ankur Arora Subject: [PATCH v5 0/9] support CPU hot-unplug Date: Mon, 25 Jan 2021 22:44:31 -0800 Message-Id: <20210126064440.299596-1-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.29.2 X-Originating-IP: [70.36.60.91] X-ClientProxiedBy: MWHPR18CA0061.namprd18.prod.outlook.com (2603:10b6:300:39::23) To CY4PR10MB1718.namprd10.prod.outlook.com (2603:10b6:910:9::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (70.36.60.91) by MWHPR18CA0061.namprd18.prod.outlook.com (2603:10b6:300:39::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12 via Frontend Transport; Tue, 26 Jan 2021 06:44:48 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fe70d773-b1d9-4457-2ae1-08d8c1c5e082 X-MS-TrafficTypeDiagnostic: CY4PR10MB1781: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LL9z6K4dKWPtif+CDcsMbCCgrZfqoPlvMr3gm0XHkuGL3FIzPJJ5PN84Od+zgD6E04M424a1jfNPSOpuANIBV1pvBRcmenRl7CfIF9nWRXbCPxWnzbKkvrV/x/JP4q2WvoZQQpiOo7Q3SOJvqzcTQlffoOVZv1k3OpivIRbnNuNmz1r1Jb+gRbtU0dYufv0PbNy+NaMO2TbvoOFCouaCw+PevLaN8V7MxMM8RjWBC1ji4ZihFsOSBPE+Bczrt0VQS5MvCcrB3tZHFmfO95dd+Z6OEejbJzMkh8pvL9rj37UDzRMNwT8vhwrOZe1EzqI4s9u+5psZ8ocr7FsheNEEDe696H2H33iUQCUo0FqDFVLOcj/lhIL58FeSxo5+DCNjoGyIJNMxSYEYBeVxnxT3n+lFvL2E5CjLu4joqQB9vqoYWzD2o2XBO3OiPyi8WVvHf8ta1VhNjYusYLoPUq4IC+TbMk3LM/7P0lZ3xiKZfsMqAFncbon5UnzvwltNmTKv3C0N4NDwCsa563jPkhuhlA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY4PR10MB1718.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(39860400002)(376002)(396003)(366004)(136003)(346002)(83380400001)(6666004)(6512007)(4326008)(19627235002)(8936002)(2616005)(316002)(107886003)(36756003)(103116003)(16526019)(478600001)(956004)(66556008)(6506007)(66476007)(52116002)(66946007)(186003)(2906002)(26005)(5660300002)(69590400011)(8676002)(6916009)(86362001)(1076003)(966005)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?I6kbcB+jmBe5PtpG7V4QYV1xM94hvxjUPkn/uT/nWaPzGfFOO2otCAnM5JqW?= =?us-ascii?Q?fBSCibdbK2ES+t1thHCAFXAlAHoCKpkBVg9ozc68kNoLQHJmuNoDSPjlDuKt?= =?us-ascii?Q?JBlgqMeGRBByvkckD9RIFGE88vSLKWDhkBg+wqxm0mF40vmCRRrODAyLA+CA?= =?us-ascii?Q?wtMHmNH8nirdRhNTv+dlclirKUSmnrjyQVJuD0WaJ+Srqbt7yg8ccCIbTwZs?= =?us-ascii?Q?PgojRdClmO/CnoxLVhWSgTw4Z4e7njWLi9FhvrsTN65TrZi58YIJsEbVl611?= =?us-ascii?Q?oUqDGXkor8d1/QNuPjkzm8AgFOlfLwhX95lznYavbn8ThW+G3YUdWZvUthNG?= =?us-ascii?Q?a1wUYSflzID0liopQ1ZnCjTW4mu/W8AeYDMYL3iSfwfll8WoZnt28zn3edVV?= =?us-ascii?Q?7jo+/yfuocZKBf8Ak0eypgBr1oU59F0Wlglk+u2Bk4Y61lz2w1DP887emoMC?= =?us-ascii?Q?gyt35lnejkVKIx2WDAReFnmmTJPFGEZ0Qz1yCZwmHxsiS/zjnPbZikDfJisn?= =?us-ascii?Q?pLi1j0f5xhZqg8U0Qt2p85eg0m5uLKaxrU4C09ENHgtLl/Ke9HwjfqBczs0P?= =?us-ascii?Q?qM6+Sw4trz7ehCrwLQV5T4RyS6RSALyBjeyuFAMHP+XoWOBbdrCEtGeW0hHb?= =?us-ascii?Q?LILJM9b64TyKuYG84m1eziCTRj2WqqVG8OzEqUA5iIp4ESR/y7MRYbeN9uIa?= =?us-ascii?Q?PL8zXRQbYAVgg+S6rpNnpEyU+AjD2khkoeFHqKft/tmkwPfvtBNdw68hEsPR?= =?us-ascii?Q?uUAhZAANO0NS5nd33zdpzegIQ8xxRFBP9j08JpqjsqSzHv9Q74xZ6Oa3+gOf?= =?us-ascii?Q?3WvEAywFL/HV/oe89XPBdIeM4WlbcXdelA8zWC21q7RpbIA45iCn+m2JSUQp?= =?us-ascii?Q?1d5SS+GqH5B6e/cXojnp/B/PW8aPnWYRbu5pdSxmGNYuOnJnT2O7WT5ka2Ld?= =?us-ascii?Q?fdsZs9PNbA663qNnHpehQQJmsn8tS2/+HMD36TkrSpq2580OtoQzKcns0d+y?= =?us-ascii?Q?Grvpis/ezbgNmqyH1DROJJlvX0jgUwK+3khY3J6iqiwGHZaiI3MqiWO42Cnw?= =?us-ascii?Q?6tGbgRPj?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: fe70d773-b1d9-4457-2ae1-08d8c1c5e082 X-MS-Exchange-CrossTenant-AuthSource: CY4PR10MB1718.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2021 06:44:49.5518 (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: i1ZRshB/x6itYPm7e7YMwHhDqzigmjr3ihyAu5q6syxqEMWzmwkQ84nIdM6tSY21lcAswHzV8yf1+n7zV5RAJGmsblv4LBl3Ub/tCohukSc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR10MB1781 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9875 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 suspectscore=0 adultscore=0 mlxscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101260035 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9875 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 spamscore=0 phishscore=0 adultscore=0 impostorscore=0 malwarescore=0 lowpriorityscore=0 bulkscore=0 priorityscore=1501 mlxscore=0 clxscore=1015 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101260035 Content-Transfer-Encoding: 8bit Content-Type: text/plain Hi, This series adds support for CPU hot-unplug with OVMF. Please see this in conjunction with the QEMU secureboot hot-unplug v2 series posted here (now upstreamed): https://lore.kernel.org/qemu-devel/20201207140739.3829993-1-imammedo@redhat.com/ Patches 1 and 3, ("OvmfPkg/CpuHotplugSmm: refactor hotplug logic") ("OvmfPkg/CpuHotplugSmm: add Qemu Cpu Status helper") are either refactors or add support functions. OvmfPkg/CpuHotplugSmm: introduce UnplugCpus() OvmfPkg/CpuHotplugSmm: add CpuEject() OvmfPkg/CpuHotplugSmm: add worker to do CPU ejection Patch 2 and 9, ("OvmfPkg/CpuHotplugSmm: collect hot-unplug events") ("OvmfPkg/SmmControl2Dxe: negotiate CPU hot-unplug") handle the QEMU protocol logic for collection of CPU hot-unplug events or the protocol negotiation. Patch 4, ("OvmfPkg/CpuHotplugSmm: introduce UnplugCpus()") adds the MMI logic for CPU hot-unplug handling and informing the PiSmmCpuDxeSmm of CPU removal. Patches 5 and 6, ("OvmfPkg/CpuHotplugSmm: define CPU_HOT_EJECT_DATA") ("OvmfPkg/SmmCpuFeaturesLib: init CPU ejection state") sets up state for doing the CPU ejection as part of hot-unplug. Patches 7, and 8, ("OvmfPkg/CpuHotplugSmm: introduce UnplugCpus()") ("OvmfPkg/CpuHotplugSmm: add worker to do CPU ejection") add the CPU ejection logic. Testing (with QEMU 5.2.50): - Stable with randomized CPU plug/unplug (guest maxcpus=1,8,128) - Synthetic tests with simultaneous multi CPU hot-unplug - Negotiation with/without CPU hotplug enabled Also at: github.com/terminus/edk2/ hot-unplug-v5 Changelog: v5: - fixes ECC errors (all but one in "OvmfPkg/CpuHotplugSmm: add add Qemu Cpu Status helper"). 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 (9): OvmfPkg/CpuHotplugSmm: refactor hotplug logic OvmfPkg/CpuHotplugSmm: collect hot-unplug events OvmfPkg/CpuHotplugSmm: add Qemu Cpu Status helper OvmfPkg/CpuHotplugSmm: introduce UnplugCpus() OvmfPkg/CpuHotplugSmm: define CPU_HOT_EJECT_DATA OvmfPkg/SmmCpuFeaturesLib: init CPU ejection state OvmfPkg/CpuHotplugSmm: add CpuEject() OvmfPkg/CpuHotplugSmm: add worker to do CPU ejection OvmfPkg/SmmControl2Dxe: negotiate CPU hot-unplug OvmfPkg/OvmfPkg.dec | 10 + OvmfPkg/CpuHotplugSmm/CpuHotplugSmm.inf | 1 + .../SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf | 3 + OvmfPkg/CpuHotplugSmm/QemuCpuhp.h | 6 + OvmfPkg/Include/IndustryStandard/QemuCpuHotplug.h | 2 + OvmfPkg/Include/Library/CpuHotEjectData.h | 32 ++ OvmfPkg/CpuHotplugSmm/CpuHotplug.c | 450 ++++++++++++++++----- OvmfPkg/CpuHotplugSmm/QemuCpuhp.c | 57 ++- .../Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c | 68 ++++ OvmfPkg/SmmControl2Dxe/SmiFeatures.c | 25 +- 10 files changed, 552 insertions(+), 102 deletions(-) create mode 100644 OvmfPkg/Include/Library/CpuHotEjectData.h -- 2.9.3