From mboxrd@z Thu Jan 1 00:00:00 1970 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 E4596326951 for ; Mon, 23 Mar 2026 19:33:50 +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=1774294435; cv=none; b=aZ8vtklzGIRMDvAsh4UGxg9gJutNpoA44NBO9HHuJGOm2x8yzjhxeu9znXlo+As8AhFBE8lghNLAFnNsLo9SWKhDReVefYJdJC2gozJa8j485W0fA84K9u5cuE13OtMFYaPKuMWgoTGYwKI5eKwrPOeQCDjSdBVN1dtsy10Vf7k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774294435; c=relaxed/simple; bh=f7ZvN1ub78El5yQ64dPToN38BCBXq7GxnJ6qo/VGMOo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=rott/JJYa7Lu9xPL0DHCd6s9aKw5bLo4b2NGUenjAR0FEQeYgFo3CeZ4BVZ8I7c5M5N3PlM//4YgB3gQcM7/QqXHRWX9b058+vvh8CH043TF21tmjjACXb0S3gWRksMmXGrsJulGqMCC13I7KMQypRB/8+srC+S0RGR3kx1Jl10= 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=S+gjeZMT; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=x5ZrHG3j; 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="S+gjeZMT"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="x5ZrHG3j" Date: Mon, 23 Mar 2026 20:33:45 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1774294428; 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: in-reply-to:in-reply-to:references:references; bh=LNEPtHBNY1b6cCyBnTyVvibwwmmhqPuybxpCWjrAQhc=; b=S+gjeZMTgzXuc4wWlKMWqPqBAIvri8x8bhGzWH0cU+g10MSg6FI1rDLML6mhI73De0lSea W9tB2S/McB0pJ87IMfqS4hbdco2532LjcOZ3JJAWLDS4qx6UeRKXYMrAC1NaNLYmQhPjLh +LiXj9ZXV7Go4y6fEJiEYYivejqvxhJiUhzjJTFnSLpzPFkiZU3odJ9yQRR5xnCQVQFZxq /ROqzIqv8KwWRyfw4PjXWHLDU5oqXa8n+bA3HCgUMl75UKDFcgGYSUu8gkoFauIf5zNo5D wQi0J2wpVtZdcOTxHOccuwYH9uaMZKolfeD/Kx5qZJIBsLke1sLJSZeddzwqpQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1774294428; 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: in-reply-to:in-reply-to:references:references; bh=LNEPtHBNY1b6cCyBnTyVvibwwmmhqPuybxpCWjrAQhc=; b=x5ZrHG3jycYwnoOAgz0EFkHZJmSOrPjJr5fafbq5vBo4y1mONZU1PbnQRyTLfxR5Bxj57+ pJmnh790/viGDwBQ== From: "Ahmed S. Darwish" To: "H. Peter Anvin" Cc: Borislav Petkov , Maciej Wieczor-Retman , 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, pawan.kumar.gupta@linux.intel.com, ak@linux.intel.com, mingo@redhat.com, x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v11 4/4] x86/cpu: Clear feature bits whose dependencies were cleared Message-ID: References: <20260323163557.GHacFr7VbKIADqonuX@fat_crate.local> <20260323175902.GBacF_ZnWQJJWdOZJT@fat_crate.local> <55af4420-e230-4f14-a2d3-608f2bc5a412@zytor.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55af4420-e230-4f14-a2d3-608f2bc5a412@zytor.com> On Mon, 23 Mar 2026, H. Peter Anvin wrote: > > On 2026-03-23 10:59, Borislav Petkov wrote: > > On Mon, Mar 23, 2026 at 05:23:19PM +0000, Maciej Wieczor-Retman wrote: > >> Clearing the compile time disabled bits is fairly low effort since it's just > >> initializing the cpu_caps_cleared[]. > > > > and cpu_caps_cleared[] is consulted in apply_forced_caps(). > > > >> To validate the whole cpuid_deps[] array and add relevant bits to > >> cpu_caps_cleared[] would probably require adding another loop that would > >> check all of the entries. Since now only SGX has this problem I didn't think > >> it warranted adding more than this check in check_cpufeature_deps(). > > > > So we're going to do half-baked solution again and it'll come to bite us in > > the ass later? > > > > How about we hammer it out properly once and for all? > > > > One could argue that the Right Thing[TM] to do would be to encode the > dependencies in a file that can be processed at compile time, and have those > features explicitly added to the enabled and disabled masks, basically > augmenting Kconfig.cpufeatures. > > The sanest way to do that would probably be to move cpuid_deps[] from > cpuid-deps.c into a standalone file which can be processed by > cpufeaturesmask.awk or equivalent. > I'm posting the CPUID patch queue tomorrow. It has all the X86_FEATURE words (synthetic and hardware-backed) modeled and mapped by x86-cpuid-db. These XMLs are definitely the right place to encode the dependencies, as there is already different types of generators in the project. The series cover letter tomorrow will cover a lot of details on this. Thanks! Ahmed