From nobody Fri Dec 19 18:52:52 2025 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE0FF64CEE for ; Tue, 23 Jan 2024 13:11:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706015481; cv=none; b=U4dBm2qc+be6Bz/1JeVe4G4IZpce1ODgZsRHaJN4njHl5sZyyrL/7FwDvnlzvEwaCDWfo3T91yS9qPF941TSdb1HrvcelzK5niKM/8eYjg/zptqwJQwxPjgULUalzIrKIziNnA6fU+SWcwQDco1s6pnN7jgo2fLI7fIOttPUHso= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706015481; c=relaxed/simple; bh=r5AGb/XQ+lkMk/28b6KQQlUOwH5R5IM2l6YzETADWPk=; h=Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type:Date; b=sOvUzrBauSZM2XcqKz8xvgHYVYJ4tpp7txJBrxFVXUp4AyUM+0Oez/K6lllhPbWpscMM7hQvSc/KjCXqsIcOjxzNyp8Sj6rwCXRNVIq6KI0Q6mHNSPFTEo9QrRbe7J88RVBYC5ZBrGnK15gVPErDXrbedZLPRNX8CxrCHVqxTJ0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=rMqAeOL8; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=QwHll0Gi; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="rMqAeOL8"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="QwHll0Gi" Message-ID: <20240118123649.513878058@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1706015478; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=AL6rtCpTcNHRwvmkB9lH73XsGA1kAtoRIuLTc7Fw7rE=; b=rMqAeOL8SfoskRhVnzzZ1cgGVKKHEy8/LjTFzaZoz/fPvYB43MMg84vcWq6nK+lgOyqL9L GG8IfX33+gpg2N/Hs/ZDmMe7kXAfPBsBUZiO0eVzhlpNmDeLYvGc7RfK19cGQjqGB+U4Qo //vhaLKF+OTuYmSpur0IcWJRGqpUwsLk9XuSHzLh3TvlibBeYWg94Vb9wF77FX4kXBSArN gDFmfu7707rducLbdtEdxKqVun2X9Lbu3jcmI/gNBh2/0dKCucm+H5ryLF2A8KuEHJMDgq 8XHpv0/ueVjniKnXbLOuJHaO7tV/3nJdwqTsFf3PzyTCDpo3+dlIOCpG4s/0GA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1706015478; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=AL6rtCpTcNHRwvmkB9lH73XsGA1kAtoRIuLTc7Fw7rE=; b=QwHll0GiP2lanU8HeZcYPYuEpVbvjY7KofnkML6uapGHzV9/Wi5oW+JP41OoJnOWLPJwyw Vhoe8kGyemadi0Cw== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Tom Lendacky , Andrew Cooper , Arjan van de Ven , Huang Rui , Juergen Gross , Dimitri Sivanich , Sohil Mehta , K Prateek Nayak , Kan Liang , Zhang Rui , "Paul E. McKenney" , Feng Tang , Andy Shevchenko , Michael Kelley , "Peter Zijlstra (Intel)" Subject: [patch v2 17/30] x86/cpu/topology: Reject unknown APIC IDs on ACPI hotplug References: <20240118123127.055361964@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Tue, 23 Jan 2024 14:11:17 +0100 (CET) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Thomas Gleixner The topology bitmaps track all possible APIC IDs which have been registered during enumeration. As sizing and further topology information is going to be derived from these bitmaps, reject attempts to hotplug an APIC ID which was not registered during enumeration. Signed-off-by: Thomas Gleixner --- arch/x86/kernel/cpu/topology.c | 4 ++++ 1 file changed, 4 insertions(+) --- --- a/arch/x86/kernel/cpu/topology.c +++ b/arch/x86/kernel/cpu/topology.c @@ -266,6 +266,10 @@ int topology_hotplug_apic(u32 apic_id, u if (apic_id >=3D MAX_LOCAL_APIC) return -EINVAL; =20 + /* Reject if the APIC ID was not registered during enumeration. */ + if (!test_bit(apic_id, apic_maps[TOPO_SMT_DOMAIN].map)) + return -ENODEV; + cpu =3D topo_lookup_cpuid(apic_id); if (cpu < 0) { if (topo_info.nr_assigned_cpus >=3D nr_cpu_ids)