From nobody Mon Apr 6 09:15:30 2026 Received: from mail-4316.protonmail.ch (mail-4316.protonmail.ch [185.70.43.16]) (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 1B95F3B6377 for ; Fri, 20 Mar 2026 12:50:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.70.43.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774011036; cv=none; b=FPetZJt3SPHMqVTXsovQUuaGq/AhqVkX2MJ36Zdkt+i8u36N7F+pS2x9OnelOlWw9JGPsI3a6UfefcANXwhky+pjJToeB59KpceOUmwrKexAOslMAqiVGRrzZdgr+zbX1a6S5qSwbGAq+EiWqlxGugzsJZZwMddGpRYIYzVWipU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774011036; c=relaxed/simple; bh=P2y3pCUze6MKXYd046eUQgg0kBF67LKL5aGaSMgDczs=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Urx+22AGaOToJ9rJ5Zo11nCO7mPq0l/4PJuE60kufe8PLJEdQXtFXObArzLOHo0FByZJ7EkVfWhwgOW7d5KU6MseKPH6ZjQGpks5ZDrL6AJ9mNTg8woo57KHL55GQLKKxOIZf7MGmYDH6lnzuzyZJCwSQaYf/9ck3/1p1NUCwWU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=pm.me; spf=pass smtp.mailfrom=pm.me; dkim=pass (2048-bit key) header.d=pm.me header.i=@pm.me header.b=sGAU0cYz; arc=none smtp.client-ip=185.70.43.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=pm.me Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pm.me Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pm.me header.i=@pm.me header.b="sGAU0cYz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail3; t=1774011032; x=1774270232; bh=P2y3pCUze6MKXYd046eUQgg0kBF67LKL5aGaSMgDczs=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=sGAU0cYzOFn2KRgVsdK47eCwSk/u4seJsmcHtMDnP/7Nz/PB9jLhk4jdP5cHbpZIG ZCQB65SJ9x49jztjzHclT7JpvQMiKQvvD0VoIseS04FTQJym+gvgjRQjqOa1nWNOXp DprsisYvq38LxdMRuDl8D6kicVfjmS510H2JxE5VluKQDL1Nb0iyGjboWwGd4Ei6lp Y8g1v+LcYFgL4rC9bcM2PN3BifrFPGkeD8utDlagMIjPaUBctlHkChSun4/i1WYUjw Gjehw3DrrtvcQifcGF/FLDeo67HcdhH0ECuONCcWI0LAdJiVes+Dh4yVJ06dTiPcgS pPXlOIa7wtmJw== Date: Fri, 20 Mar 2026 12:50:29 +0000 To: tglx@kernel.org, peterz@infradead.org, xin@zytor.com, maciej.wieczor-retman@intel.com, babu.moger@amd.com, chang.seok.bae@intel.com, sohil.mehta@intel.com, dave.hansen@linux.intel.com, jpoimboe@kernel.org, elena.reshetova@intel.com, hpa@zytor.com, pawan.kumar.gupta@linux.intel.com, ak@linux.intel.com, darwi@linutronix.de, bp@alien8.de, mingo@redhat.com From: Maciej Wieczor-Retman Cc: x86@kernel.org, linux-kernel@vger.kernel.org, m.wieczorretman@pm.me Subject: [PATCH v11 4/4] x86/cpu: Clear feature bits whose dependencies were cleared Message-ID: In-Reply-To: References: Feedback-ID: 164464600:user:proton X-Pm-Message-ID: f78bb0c989a5e405107772b317573bbf4998fbe6 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Maciej Wieczor-Retman After cpu_caps_cleared[] is initialized with DISABLED_MASK_INIT, features present in disabled bitmasks are cleared from x86_capability[]. However features that depend on them and are not part of any disabled mask are not cleared by anything. They can trigger the warning in check_cpufeature_deps(), as before both features would show up as enabled even though they weren't. The uncleared features can also still falsely show up in /proc/cpuinfo. Running setup_clear_cpu_cap() on such cases inside check_cpufeature_deps() should guarantee that the cleanup of the leftover bits has to run only once. Afterwards apply_forced_caps() clears the leftover bits from x86_capability[] and the warning inside check_cpufeature_deps() doesn't trigger anymore. Signed-off-by: Maciej Wieczor-Retman --- Changelog v11: - Add this patch to the series. arch/x86/kernel/cpu/cpuid-deps.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/x86/kernel/cpu/cpuid-deps.c b/arch/x86/kernel/cpu/cpuid-d= eps.c index 5002f496d095..b0f5d3fe6655 100644 --- a/arch/x86/kernel/cpu/cpuid-deps.c +++ b/arch/x86/kernel/cpu/cpuid-deps.c @@ -163,6 +163,16 @@ void check_cpufeature_deps(struct cpuinfo_x86 *c) =20 for (d =3D cpuid_deps; d->feature; d++) { if (cpu_has(c, d->feature) && !cpu_has(c, d->depends)) { + /* + * If the dependency was cleared through the disabled + * bitmasks while the feature wasn't it also needs to be + * cleared. + */ + if (!DISABLED_MASK_BIT_SET(d->feature) && DISABLED_MASK_BIT_SET(d->depe= nds)) { + setup_clear_cpu_cap(d->feature); + continue; + } + /* * Only warn about the first unmet dependency on the * first CPU where it is encountered to avoid spamming --=20 2.53.0