From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) by mx.groups.io with SMTP id smtpd.web12.6140.1613725501336855564 for ; Fri, 19 Feb 2021 01:05:01 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=AZDgF9EA; spf=pass (domain: oracle.com, ip: 141.146.126.78, mailfrom: ankur.a.arora@oracle.com) 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 11J93jwG178465; Fri, 19 Feb 2021 09:04:57 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=ZFJdZp1sdZ80aBboCSZMSDE269EfvYrP1FInq6LBFGs=; b=AZDgF9EAYZfTVwfFb7uBxslY7Z7Eg3vS+GVDqZi+x7YsGzx/zS0Z77cXvZFKqDoClj7h 5t5zbN5cuK1+2n4gjZIMmbLg9Em7qmBWQAq3VNF0sfulOf5jLfENMymb/NvXk5CyQw1q 2h0W5cAGyWot8Uivr6EdUj19J38XXNjUp80g43tnaA0F+W9moTmzs+WxG0KB5iArasG5 nxsWYuXNSVCZBqGWaLeBRdnfz8CCcE1aAgTY9hy6onofKR/JsGNvmZIhw5NnGXGyKdnp zQMDiFvwrdepnfxpBu0WFHQIavUtGHYImkfO1QX8PV2p4ZT0bF4uOdesHrSTbW7D10HI zQ== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 36pd9ag89b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 Feb 2021 09:04:57 +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 11J8tl0o182210; Fri, 19 Feb 2021 09:04:56 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2177.outbound.protection.outlook.com [104.47.55.177]) by userp3020.oracle.com with ESMTP id 36prhve0ju-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 Feb 2021 09:04:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BXpiP8dVOAVzKMjRc3sSNvcgtZ88Cmz+TTTFDxjYNYUVX01O8WfKGTyuIBuo/XouUxwMvTNsjNJ9QIN5ssg0n9UqgDuQ5aBku+fwSei3Zbil8SJYHHEvsuvEjdZOsKzbEDOxzxw03bjjruT11MFZfWPhwewfn7DQ/hfMfeAS6g+g4o21Ru6VxWA/HXvtqya4yzTJcpimdLyJv133SxQ8RpQXSlGLMXWa8zibURheQwWuVUC6A7OZgdh+sjAoY25oPM2eEOejOIyMHjQmcmYp8kZwydpx8Cph6+h+uXAuv2tRrAJSKD5EYOfd9H+rlOSa5NaYKrkJcBrnx8V/UFLxCQ== 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=ZFJdZp1sdZ80aBboCSZMSDE269EfvYrP1FInq6LBFGs=; b=QlNZ2ycpguvr1guGyI1pdmj0NRRz4/8d2cA+QaxC5KVJlz2SEzHgnMMYoCw5yuRIj+L0yJ2vvi6q8+93ejIG8HJkWnc0Z7pziumbzfElr6Bgd5kaTyGmkIxml6qE5++Yt9vHZYSeHUySWJrAy3aa8oQe+m7e72DGfrN2sXAYHaY+pEOg+ANHZOjyZa9ctlV2BGHMcs8suraQTa7mfKCfnnqcoiLw1qZH1rVJVRb7oSLhVEvaJhhQ+3MStpjnMrlfhvreUkd4n0B4Bba+NQwB8HfaaamvZeVJMDMoIdl1+lE0myLLpC1Oa5UQda0A7iys4G4QoVEsvBYGJn7l9y7ZGw== 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=ZFJdZp1sdZ80aBboCSZMSDE269EfvYrP1FInq6LBFGs=; b=T5ooWvM2IN1q972bDSAhCtQnHPWKrg7TRiBoXoe7Tuqmu0WtcuNB1cQukRuXLUlpM4Bs9Ob5V3SZCO9SZ4bUlUvWVwzdkDS9TlVyaDIj8EmxoN9gcX/fss2Yu93evijcZ93/B8IoDTDuEKAZB1o3V53FKlfqmMFdU7+Ad2vEpEI= 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:04:53 +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:04:53 +0000 From: "Ankur Arora" To: devel@edk2.groups.io Cc: lersek@redhat.com, imammedo@redhat.com, boris.ostrovsky@oracle.com, Ankur Arora Subject: [PATCH v7 00/10] support CPU hot-unplug Date: Fri, 19 Feb 2021 01:04:34 -0800 Message-Id: <20210219090444.1332380-1-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.29.2 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:04:53 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4e2de427-0210-4318-bf51-08d8d4b56bd1 X-MS-TrafficTypeDiagnostic: BYAPR10MB3605: 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: iNmQkX2kYLPVWW9Zt67YO8x3j9bJ3NZ/P/sCVmQEgOlzKXSjp5BH19QWApC2MarRciw7JjuD7u0TNMlBNolyojgA4B4SB0IJgwLtWtxOGTI3cvMTbcgLfV/GsCN7IvvdER7lMtS1x/cuecRIGuF/yiQ/lu6fT7C5nvzMr+bos0j0C5fkjPS6ywj0vKn+Q+dMBTdHy+YUpREQgHzr4roEYzX8LdFwskIyvKBHFTCDyXYtfYA4lebB3+jO30s3uKE/bWVLwVZ5fWkYs0kmRwHteB2IgPBJLFmJxuZ5AFrzqcxobH6DuW4mxNV58Ol0sSspLSxCRHvBj1lJbeoIWa5qgshnb+WToTWPV4Cybm9ftsaQJEefzGu9cPokDjHtA1H/G15p27riWyec4KxXljnL0Oi41QGWkr6HL2NcyzOMZuTc3MOa+11e0xoViri/ygyz7GjZDBxnTpBekovU4/Ey7MXNq1CuhykTzDHOAreB2XO+1xOUYadeh6+610BigCyAPqck89jqKfEY7qOZKY6HW4TsHcVwA1nKG2WCo7emzfBcX4hwWcqB+Z9mc2LjgadFHTMJ/2ACQ20KHzdGUDYmriWZ2P+cm388MfEUrYfRr1w= 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)(966005)(8676002)(66476007)(52116002)(478600001)(956004)(4326008)(19627235002)(5660300002)(6916009)(8936002)(2906002)(107886003)(1076003)(186003)(103116003)(26005)(16526019);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?bGd2/h6VqcdlQ6f8TKGGI3L6GbpwwMPZG05AD2HEwvTdysaKem415QXj+yZN?= =?us-ascii?Q?I++LisiGt6pnYl/Tv+57ulXxpNqYSPOB2cWiDqA14EvSKn5JNYKjzHaUdqpt?= =?us-ascii?Q?/a/58pg8ZDcoHrlrlZ6WhrmgrlCgc5qOPhmbdhalM6kpoA8CXK+lPGLXO3gJ?= =?us-ascii?Q?RdmWC5Sr7lVooOru2tk5QoaDvJ8stLPzMTqAcHDwddNudzjjuc4EhkbndShZ?= =?us-ascii?Q?vL7fVFnWs712FuGHr4vkerAK3VDE/kJyN2QJCZrDiVbsbgee5T0BFA5wvKkE?= =?us-ascii?Q?A8WtCrGdEjjTRCj7P51/4lS638DhDnOgMGsAGwJJZG1Aghmx7V6nDSfTxWnM?= =?us-ascii?Q?1bY2Jw7I1+GKbvRY5ZcYzqyGfGSIIXVqvFJS53mtY0NYYDRPZcHT7hepnDy4?= =?us-ascii?Q?jiLzYA9ZbwogO3nWMy5RpfhdlFYtbfp3A4uCuUI/+zO6wT6BTw/tX1nd9nWd?= =?us-ascii?Q?JKT3U8OjmXh7As173cR1RSV/i0Qg9ILTSdG5rB/2S0xeh6GjmpFH2gqBz7in?= =?us-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08d8d4b56bd1 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:04:53.7874 (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: fIB4KbulxEAQBHXn/pqCmvtJ4MzC3bnYUxngLdW4NQM3VZlC5FtjNbsvs296JPCa2BMJBBxG4hJwXyo5t9h+snIfV3ZL7KHkQLx7uZ7IDUs= 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 mlxlogscore=999 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 malwarescore=0 spamscore=0 phishscore=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 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102190071 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-v7 Changelog: 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, 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/CpuHotplugSmm: 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 | 52 ++ OvmfPkg/CpuHotplugSmm/CpuHotplug.c | 578 +++++++++++++++++---- OvmfPkg/CpuHotplugSmm/QemuCpuhp.c | 106 +++- .../Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c | 136 +++++ OvmfPkg/SmmControl2Dxe/SmiFeatures.c | 18 +- 10 files changed, 789 insertions(+), 120 deletions(-) create mode 100644 OvmfPkg/Include/Pcd/CpuHotEjectData.h -- 2.9.3