From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from aserp2130.oracle.com (aserp2130.oracle.com [141.146.126.79]) by mx.groups.io with SMTP id smtpd.web12.3161.1611882123026763853 for ; Thu, 28 Jan 2021 17:02:03 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=BgWqKhEo; spf=pass (domain: oracle.com, ip: 141.146.126.79, mailfrom: ankur.a.arora@oracle.com) Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 10T0eJ6w117369; Fri, 29 Jan 2021 01:02:02 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=t/25FRqP+so51h/r/LXKHjoS18RBbAufzYdxVH9zE6g=; b=BgWqKhEoVNsZ4x6XR8BjvzqOxJVpTfnncH/iNu7XXM5o8Vc476p+ofDguqZDkAmtrZGd +lEothoC/SK/RYA73+zLuEFyqCsT6GkJgJAXJx6UfF1ty3T1DOQVvpp9BWg0bmxXoqp/ ZrvPFbC0lFjiazn7uNPZSPA1bkEtcu6wap7fLYXUwnBkPNFdG7Drb+2APqYyYwWSOLSQ jZE0NnpY1zoity0GIg+gaUZm38cfMcldBMbaRgH1iNLj1LomVifLIM+C58wjyDRpGAYE xs2kduqokwdx5pVaqOuKwY98ffanjPeFimuapTh6pYBAt460dmIEVST9bI6HhKIP0a59 Gg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2130.oracle.com with ESMTP id 3689aay144-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 29 Jan 2021 01:02:02 +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 10T0eGVC081743; Fri, 29 Jan 2021 01:00:01 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2172.outbound.protection.outlook.com [104.47.56.172]) by userp3030.oracle.com with ESMTP id 368wr13e5c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 29 Jan 2021 01:00:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CuUnt3ktu8UMB0nki1+a6dWj/Q1HDYhu+8gEmKz8dahKFa7KQfZVu89VlQRPo6il3yATNUU+UO4sxnFF39HMeOxcIdx9e41FcHfFNhakHXFoEYgem15c+rNG80bXw39GoaNcFMtt5U/+1fE6NB/wdi45jyvofdhvnayIQwXm1ImPgZMlxCnJENf3tKjFRqNcst9tv/q/pwHBqd7E42PykuegTAmUKAPNIwPgC5CSjzsvjajyurPhjIXxkChdo4pNNLJvQeicnDEbjLJUWY+YFV7u9VraJhV0M1mS+3H65LSYUKMz4bdl1qONnzDLehLZRsCVt1r0wYLH9XZSGl7Z7w== 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=t/25FRqP+so51h/r/LXKHjoS18RBbAufzYdxVH9zE6g=; b=Ry2TQXJZXh8oXEUC2vKM7d7Cr6i8+AePS1M84yj8hfkEVgLdsw6u4QBvOfZnIDKuIty+Rid8bpdBvMi1SPLxcbV1e4cxGf9Oluw3wTcmAqNTjqk53eFx8TBoNStbfJRmKG/cCpjeB36R9DikJP6AHKkQ10UBaGHL9Wd0W+99svvpB7Iud7d4kwOE9v6BDDPD7aosQJPQH9ZeqvwncgyhAbJgnpOAZAxWPzwYVZwsJn9ofm/FAzqa+xju1FTjeStvdHyBz0cDl6mM/gtFYFDASnjoc0P5w+9RW30c8AkvtPMf8NyzYK+fi9Mi571RhE2fp0QgHZB7GdbHSEQ6dzHyjQ== 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=t/25FRqP+so51h/r/LXKHjoS18RBbAufzYdxVH9zE6g=; b=0HSIkJp43TYQz8fFpm7r7Gk6ipuD5OimzGrAa0mUzF6wZ2QfTMBHLfySMnxdwBAetbev+cuFb2jWlBMUzQbDHOgIXkREVSXGy+mjPF0Wr+T8C5MS2LBk4ARJYtckIy52m+hbPE9zPVtcySSi3qI5IdhzYh4zdtdgYpK/2PSMPBY= 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 CY4PR1001MB2246.namprd10.prod.outlook.com (2603:10b6:910:41::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.16; Fri, 29 Jan 2021 00:59:57 +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.3805.019; Fri, 29 Jan 2021 00:59:57 +0000 From: "Ankur Arora" To: devel@edk2.groups.io Cc: lersek@redhat.com, imammedo@redhat.com, boris.ostrovsky@oracle.com, Ankur Arora Subject: [PATCH v6 0/9] support CPU hot-unplug Date: Thu, 28 Jan 2021 16:59:41 -0800 Message-Id: <20210129005950.467638-1-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.29.2 X-Originating-IP: [148.87.23.8] X-ClientProxiedBy: MWHPR1401CA0022.namprd14.prod.outlook.com (2603:10b6:301:4b::32) To CY4PR10MB1718.namprd10.prod.outlook.com (2603:10b6:910:9::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prion.us.oracle.com (148.87.23.8) by MWHPR1401CA0022.namprd14.prod.outlook.com (2603:10b6:301:4b::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.17 via Frontend Transport; Fri, 29 Jan 2021 00:59:56 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5f8692a9-b1ee-490a-f29d-08d8c3f13281 X-MS-TrafficTypeDiagnostic: CY4PR1001MB2246: 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: 1tQ3H4gHV2zoiWJwIfP/ptl9eB+LfPxZYBQJmBhFnV297Msyffhc6JQd76VrJ1mrs2GNF3KGoGNK6Tig7jpMC10W4v3GgF4jOsKV10B/d2jd2v0aJPk7lmdRIB/D9zhOL2Y6Emaumf26Fc1Rk3PtK3u7G/DgCDaBy88U3epP1GpFG5o+qqEdDy60RArs6c/oO79LR/IPXmpIXu3cZCDSWIHDj4EIHpinKDksE16WlIsVFtv8WxuPFwNqdQhPhgOnGXS72YI6fYmwgwhn1nnQOszOEScWxX5VXFvQSb4xDHDbkKFRXdfh20ohbBzIj3fxphU2zCXKrZHAl0E4Yq2eJ4peiqFY8qMdztMuKfq5WFGS4c/ObVe29swwtTfitoRIUcWtF5fhYjKfprPRehFr9oY6a3loq7uAnwpmYH8RTzJxnXEfA9tqPtkfBl3G6uEMe+pGWrlKvR3H5CebBZ6at1pSViej0IgLMlYel2NMS4RHilvls4tss6l249XYmQysPBgy5UYX0SxkuUn6Q8q5dbr2uCIP1oLQvwAAcOEz1okl1hB1PSRLohlTr3+j8vFZsvNiwZIzrmu8pA0HQj8QXf6Ex0BrZk2MOcPqAKWR7R8= 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:(366004)(39860400002)(346002)(376002)(396003)(136003)(8936002)(107886003)(2906002)(66946007)(66476007)(66556008)(36756003)(1076003)(103116003)(16526019)(956004)(966005)(7696005)(478600001)(52116002)(6486002)(86362001)(83380400001)(6666004)(8676002)(186003)(5660300002)(4326008)(19627235002)(6916009)(26005)(316002)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?O0bJBXSVISTPmETO/6cUuVb88RaWM51j9DpscanepYYoP7O3eTUA+AT1zVD2?= =?us-ascii?Q?zI9DGSiMNNYvBop4IcmIY3+akF6TosNN1Ql/rsa3PUFPiiIW5QmQx4ofgFa8?= =?us-ascii?Q?ywaOG6XIBVgmmQ5LrJcP1220ldlYJ5tNAil1J8cMybhRp+ZKY1xfIW6lU8oZ?= =?us-ascii?Q?kZrMaB468ZN8hGOWvmHNIX5kGPM4tStu+6Bjbhxacfm3ieYWb9TSjYrTXihn?= =?us-ascii?Q?7eI1L8eMFn+Z+5kMckdEH4j0X8m+ZT6p88lH+8uZwe/gQujqyGwlKp0LNaGP?= =?us-ascii?Q?UZEI2qXqRRcIdqGLJ9h4n2DlXHZZldN4I/m29LwsUAjywZgGuQFYlk22/cMD?= =?us-ascii?Q?Rl6LxnFEJeXtUNrKAZGkXZSWdefO/vbPqpNU5UQZQxoDPrQLR/Ilt/0PFNKJ?= =?us-ascii?Q?pKZUDC0f2fHpZq4jkOjnjiEqhSreQ1Eg9jA7gSrLnvyi9xUaUselneREC6aZ?= =?us-ascii?Q?rYxhc8MOcJ8K1oVJTypSsEWWq/C50werI+t+9pbIh5jwhkBzxkoKgCO7Hfx4?= =?us-ascii?Q?O2Iz06Z4GB3gvxqcmGmf3SjizDTGKcXRhSIq4pT/gDmPENpygyKtTgmq29dR?= =?us-ascii?Q?mUbXKJ/IfOxAdgeBIcLkAB+Hi7LC5F61vIT518fJY9Awidn56EXJUHisEOq5?= =?us-ascii?Q?ib1fIsTWKQnCtwvNMNiZ+BOHGiwx/6W76ZZElPCd0BVlrYvru8WR8nWBYMlH?= =?us-ascii?Q?AkvjVbk5q8tEFb5d7bor7kfbTWDKWSZ1OIHzvrKo2wjSRErgYXVJjwc2ZeXM?= =?us-ascii?Q?Dr06wc6e3M5GKrOteioo40OOuIz01J7xJMdGhst/j7vYr7+B+rXLCPXbmtL+?= =?us-ascii?Q?75ezyZowUjVFihWvaUNLkUWCZRgj8/bsH0ALS+I9vh2HCB7osUnNl89FfAeo?= =?us-ascii?Q?ff9+Xn3LDhV2ErxFS6mKmzOK/3L91Oemn907s4dG7UhNTu8vUsUevmSv1ptn?= =?us-ascii?Q?V8vuyjBTKynU0x5AzS78EGaOpodi8CFaj+naCigaI2r9bh3uHa+ZDu/R/5QJ?= =?us-ascii?Q?r6U32XMT3Y9jcEwzLUCaRWssikcuHeEbVf9Xl6Nw4WuTRJ1WpdRDIqMiA7Ed?= =?us-ascii?Q?kjHvPfnG?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5f8692a9-b1ee-490a-f29d-08d8c3f13281 X-MS-Exchange-CrossTenant-AuthSource: CY4PR10MB1718.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2021 00:59:57.6566 (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: vCYm+2oBsiIqnhf4XtHWK5lvrpNleDxT2/FdxUCeoaZCPTMed7esBSqBifG22QHNzq4Nq+NKzmiA1SKkb6GKZk32yIBK2JYm+BJDG+Sib2c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1001MB2246 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9878 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 spamscore=0 phishscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101290001 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9878 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 adultscore=0 lowpriorityscore=0 mlxlogscore=999 clxscore=1015 phishscore=0 bulkscore=0 spamscore=0 priorityscore=1501 mlxscore=0 suspectscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101290001 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. 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: add CpuEject()"), ("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-v6 Changelog: v6: - addresses v5 review comments. 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 (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 | 35 ++ OvmfPkg/CpuHotplugSmm/CpuHotplug.c | 472 +++++++++++++++++---- OvmfPkg/CpuHotplugSmm/QemuCpuhp.c | 51 ++- .../Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c | 78 ++++ OvmfPkg/SmmControl2Dxe/SmiFeatures.c | 25 +- 10 files changed, 584 insertions(+), 99 deletions(-) create mode 100644 OvmfPkg/Include/Library/CpuHotEjectData.h -- 2.9.3