From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=52.26.1.71 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795977116; b=n/FWi5hqOIS1AaBAyXlntnAYQ35nyHV5iG39I+hyWHXwSdq5ozvMojUZ+AhWYEccGEjF EhdCrvu5fDbdUmNrCln5011uBRTNonc2GwbJho4E2CvMIdm3wW5xx44E30RhbV5oN7kVh oO/qhjfdrcJLGbqinFkV0YkBSQ/+C2cAA7pEzTiaF/0ETuTP0srhRDc/IJg3zK4FHssMB DSkmeiyuwPl7eHR8tsj6UNhjMkAwZ+FaalByfUZBibiI+3MwpBS9UeQUn2RI5AV0MfF/Y Mm+kNoQ+aa2RHGEBBkmZaJnVcjjMENv0lMJAwqFO9Zbkpo/gp+Eq2/H+iKILqys2HQQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795977116; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:Received:Received:X-Farcaster-Flow-ID:Received:Received: From:To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type:X-Originating-IP: X-ClientProxiedBy; bh=m/OF5VeTGfxR5uGLT/SEZdBtCRLLSOeOqkz/1Lww750=; b=t6SjcGOoW7OUNf3kyqQcFK5MksUQz7qSC7/jOpr0mSOcmAn7GfZT5uXnGKlEm52O/JmC T9Fb394nVrgws1byFIPWn6sdmhuJg/lnkszqSSEbOFID8ix8Yi5xfziUUZNZnKi6Yzxjg EnnCPisQT74cTbARrrLluQoJPBnUqercOiu9N7SD07AEpDsThorx5ljAxjp11FKfi5Smd 7hHIiS4DPyUrjJNez6RwwKW1tB+Z6Exs/hGPtdSi7Wgp/NIAtyeXTQARPM10q7IQCXpZk RjvgrKHpCnYW9AVnMXud+YFOiaqogCGkynUIo+/iPLNIidJBz+2VisUIgaYNtuBKprQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=amazon.com; spf=pass smtp.mailfrom=amazon.de; dkim=pass header.d=amazon.com header.i=@amazon.com header.a=rsa-sha256 header.s=amazoncorp2 header.b=QLMoWwFv; arc=none smtp.remote-ip=52.26.1.71 Received: from pdx-out-006.esa.us-west-2.outbound.mail-perimeter.amazon.com (pdx-out-006.esa.us-west-2.outbound.mail-perimeter.amazon.com [52.26.1.71]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B7FC1606A31C; Sun, 29 Nov 2026 18:31:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B7FC1606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.a=rsa-sha256 header.s=amazoncorp2 header.b=QLMoWwFv DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazoncorp2; t=1795977115; x=1827513115; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=m/OF5VeTGfxR5uGLT/SEZdBtCRLLSOeOqkz/1Lww750=; b=QLMoWwFvppw3I4TyZ9Rcat39u244ZIq/GylWNqQxmmIwaEG7LPxC6daN lvz2VY7cDaojudMdGcSPJ1Z/mdIZgGFnqaxSF9Nxqj0ZGPbj+DPbVrUgv 18PmrCSBtnJ8sHkKewLRCxLvpJVR3AaBSYQ7DvBrc0De4G9RojKa0N/Tx PaJe2XHYS4EefCTTSo3T6059aZoxURUJVgVhDCE+xxs6/gb9MgleG5J+q lctRqzopFumxWSr2pxvx3WTXmm7I5iLoufYMyVb9My5Gex5GHfgQWFYHY 2ZMiuUjwCQ9YENZ2JYRQNT+aSEpZ6kvhF8P9IYV23r3Ag90e6xvCsvjjP g==; X-CSE-ConnectionGUID: olUIIgHDSmC+vuIC+jMmew== X-CSE-MsgGUID: FRSqUxmlT/O0gDJkkrObig== X-IronPort-AV: E=Sophos;i="6.27,241,1787011200"; d="scan'208";a="35472896" Received: from ip-10-5-0-115.us-west-2.compute.internal (HELO smtpout.naws.us-west-2.prod.farcaster.email.amazon.dev) ([10.5.0.115]) by internal-pdx-out-006.esa.us-west-2.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2026 18:31:54 +0000 Received: from EX19MTAUWA002.ant.amazon.com [205.251.233.178:2446] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.59.220:2525] with esmtp (Farcaster) id e95769bb-c67e-4f27-93ac-762b3b2fd176; Sun, 29 Nov 2026 18:31:54 +0000 (UTC) X-Farcaster-Flow-ID: e95769bb-c67e-4f27-93ac-762b3b2fd176 Received: from EX19D001UWA001.ant.amazon.com (10.13.138.214) by EX19MTAUWA002.ant.amazon.com (10.250.64.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.57; Sun, 29 Nov 2026 18:31:54 +0000 Received: from ip-10-253-83-51.amazon.com (172.19.99.218) by EX19D001UWA001.ant.amazon.com (10.13.138.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.57; Sun, 29 Nov 2026 18:31:50 +0000 From: Alexander Graf To: Greg Kroah-Hartman , Arnd Bergmann CC: The AWS Nitro Enclaves Team , , Paolo Bonzini , "Stefano Garzarella" , Stefan Hajnoczi , Marek Szyprowski , Robin Murphy , Andrew Morton , "David Hildenbrand" , Mike Rapoport , "Jonathan Corbet" , Shuah Khan , "Randy Dunlap" , , , , , , , , , Subject: [PATCH v2 17/23] nitro_enclaves: Free the CPU pool when driver registration fails Date: Sun, 29 Nov 2026 18:21:46 +0000 Message-ID: X-Mailer: git-send-email 2.47.1 In-Reply-To: References: X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: EX19D031UWA001.ant.amazon.com (10.13.139.88) To EX19D001UWA001.ant.amazon.com (10.13.138.214) When the module loads with a ne_cpus= parameter, the setter builds the CPU pool and offlines its CPUs before ne_init() runs. A pci_register_driver() failure then unloads the module with the pool still allocated and its CPUs offline, and only onlining them by hand brings them back. Tear down the pool when the driver cannot register. Fixes: ff8a4d3e3a99 ("nitro_enclaves: Add logic for setting an enclave vCPU") Signed-off-by: Alexander Graf --- drivers/virt/nitro_enclaves/ne_misc_dev.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/virt/nitro_enclaves/ne_misc_dev.c b/drivers/virt/nitro_enclaves/ne_misc_dev.c index 308597166b819..f5d723cebb348 100644 --- a/drivers/virt/nitro_enclaves/ne_misc_dev.c +++ b/drivers/virt/nitro_enclaves/ne_misc_dev.c @@ -1986,7 +1986,13 @@ static long ne_ioctl(struct file *file, unsigned int cmd, unsigned long arg) static int __init ne_init(void) { - return pci_register_driver(&ne_pci_driver); + int rc; + + rc = pci_register_driver(&ne_pci_driver); + if (rc < 0) + ne_teardown_cpu_pool(); + + return rc; } static void __exit ne_exit(void) -- 2.47.1