From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=35.162.73.231 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795977080; b=a1/1VuEYujogYjZSZpBxBgykK7VZDKPBT+15aertaCgRgb2AQ0ej23b2EEgRhKnNmGQ4 irFMQ7oHnXYJDCxZGLx5W9AOaP3cCsgqLV10I7aGibva4aCDT2K/sYxjp2WeBWdP486kK iioZQM6BXpHyuBgzmt4zsVaVaYThqeIZ5zUkrOdpSOhwORJjKrwqN9D9s6NHKeAtyPOAP yZwE1yyLJDVC6Q1Ak/o3RctYWAwFrMoOa+uR2gKVW2U+/i+164CZuSMsAHnvvCzJiMsjp WF0xnVGMw28U7FKgO6dIOvkh15fQpaqzkKRfirjmI+H3+HKyPmR0adFzxHhMRDeudXA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795977080; 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=nGcqRNHRVoB1miAQvS/loVxdRBzmrhCEtr5bezjxy2o=; b=agvu91XwuSLJHJFM5t/Hpx8kYTyiHGbh1MgXB303ps4MuGswJKwAOLWVqYBIDvJ2EXKI DDq4gOMvwzjO01hVpDKFGj/pXCOkDPHAbSoaWPhnyBNUvGe1RnrfAPJ5z2nOBtZfmySd1 +y+Mk+OwIm7aI1qi16NzLNIF9LDOuB9jHcufQlErDaqQ185jI6g+4OcZJTA0CuPE2IA5M 88zWG2NhCag3g2zZCRaZUYblu29rAUUww0mSvg/lIXhUw0tnnVTQ35hqQMLh0OaFF7rhq KUdtG3uYd3l4hji78EZre4mQIobCQfvXhN5OvAY4k/kGaEI4tI2Dg1+InUfGwmj5BdQ== 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="h8z7DsI/"; arc=none smtp.remote-ip=35.162.73.231 Received: from pdx-out-012.esa.us-west-2.outbound.mail-perimeter.amazon.com (pdx-out-012.esa.us-west-2.outbound.mail-perimeter.amazon.com [35.162.73.231]) (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 0A30C606A323; Sun, 29 Nov 2026 18:31:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 0A30C606A323 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=h8z7DsI/ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazoncorp2; t=1795977080; x=1827513080; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nGcqRNHRVoB1miAQvS/loVxdRBzmrhCEtr5bezjxy2o=; b=h8z7DsI/FGVm06+8BxGiEl0OOOr/UhZLLds1jig9JTjhlPhlLoWgYEt9 HT+NaiY2+J6X2SwK4R8BlU8sgAhpHcBHJzvqSRQi7qx8OUNdvwSIrEKgn cB7GOX01NdMM3ppWNy1RSnXRCKemkdlfxqt1Ohh8X7psVTHe075XRyzzJ WhB98mB41nScQ3n/RKa0iTmHK2QvBvCVmBL7v6V3tN8Cp4bUBj+VW2ppW gEwwwPhjzJUyWqVKp5jee7AmMb5QsOagUMiYg+l7tYkpVQqehIjVqTmaZ 1EsEJJFHy5M4BlAv4Sja6FlPLpb/9+bOpL7IpDkvplbEykHBcKyrZdVuR Q==; X-CSE-ConnectionGUID: lm6vUzx2SiaopT2UPCJhrA== X-CSE-MsgGUID: nqsfri/oSomCY0nG/tzedA== X-IronPort-AV: E=Sophos;i="6.27,241,1787011200"; d="scan'208";a="35245790" 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-012.esa.us-west-2.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2026 18:31:19 +0000 Received: from EX19MTAUWB002.ant.amazon.com [205.251.233.48:18227] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.27.231:2525] with esmtp (Farcaster) id beb494c7-0e4c-427a-a4b6-24429eea2f24; Sun, 29 Nov 2026 18:31:19 +0000 (UTC) X-Farcaster-Flow-ID: beb494c7-0e4c-427a-a4b6-24429eea2f24 Received: from EX19D001UWA001.ant.amazon.com (10.13.138.214) by EX19MTAUWB002.ant.amazon.com (10.250.64.231) 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:19 +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:15 +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 16/23] nitro_enclaves: Initialise the CPU pool mutex statically Date: Sun, 29 Nov 2026 18:21:45 +0000 Message-ID: <27d7d3ce0b572bb272937ce6a200cde65f414544.1795965038.git.graf@amazon.com> 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: EX19D031UWC004.ant.amazon.com (10.13.139.246) To EX19D001UWA001.ant.amazon.com (10.13.138.214) The ne_cpus setter can run before ne_init(), when the parameter is given at boot or to modprobe, and then takes ne_cpu_pool.mutex before mutex_init() ran on it. Initialise the mutex in its definition instead. Fixes: ff8a4d3e3a99 ("nitro_enclaves: Add logic for setting an enclave vCPU") Signed-off-by: Alexander Graf --- drivers/virt/nitro_enclaves/ne_misc_dev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/virt/nitro_enclaves/ne_misc_dev.c b/drivers/virt/nitro_enclaves/ne_misc_dev.c index f4a531e705917..308597166b819 100644 --- a/drivers/virt/nitro_enclaves/ne_misc_dev.c +++ b/drivers/virt/nitro_enclaves/ne_misc_dev.c @@ -125,7 +125,9 @@ struct ne_cpu_pool { int numa_node; }; -static struct ne_cpu_pool ne_cpu_pool; +static struct ne_cpu_pool ne_cpu_pool = { + .mutex = __MUTEX_INITIALIZER(ne_cpu_pool.mutex), +}; /** * struct ne_phys_contig_mem_regions - Contiguous physical memory regions. @@ -1984,8 +1986,6 @@ static long ne_ioctl(struct file *file, unsigned int cmd, unsigned long arg) static int __init ne_init(void) { - mutex_init(&ne_cpu_pool.mutex); - return pci_register_driver(&ne_pci_driver); } -- 2.47.1