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 C440E2AF1D for ; Mon, 30 Mar 2026 21:42:01 +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=1774906923; cv=none; b=ICPxX8kwpu4WdFDgaLOnSpAaLTzB+U5EPKfSxIERJVsU90yF9UHtuhDaTPMNLzaRGiIa3wILfl/hQ1qYYxqLpJrjTww/XwUa+6oeK1QtWGZhHta3ByUriU75dOGQbvXGF+WHGIdJFYiRxSSOEwil0zGieaYAk7DnJVvfKTReNek= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774906923; c=relaxed/simple; bh=+gzgV5SeINjUY8V/+06W0mHrUt1P9lvkue9Ak3XFfxk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=g49WvUdReVv/cI7cZVPa+qi0YDz0cSSl9ikoNO1m2BfjgCH6nQGFSXNeBeKuozJFjKhTMpgtYgjYPnTRBRFGvrGy374q1ZPCqNthyhXTLkWYD/GUcURIdwg1qYK79Q0wGuoTKLYP0wZb8YYQssavdklSz/NehJCeA01u9MQhYI0= 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=JKV+xAdG; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Q9mchtoc; 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="JKV+xAdG"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Q9mchtoc" Date: Mon, 30 Mar 2026 23:41:57 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1774906919; 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=+gzgV5SeINjUY8V/+06W0mHrUt1P9lvkue9Ak3XFfxk=; b=JKV+xAdGVFYBCRFAuu1vXx8jAr1u2Qteu+Hk/F4SULzk5drlX5ie+HEkJu0t9OGhqGCcEN h/cUsLE+kDosQZozbfQLnUjSK0/rb3XKcT+5VFCPlNpUQqmQrzIVaGuakeedkdNQk4tFiW 1wteOJuE48A5b7KGa5RId6KugWKQ82/ooQDmYivUdhRGL+agHqkfTLTLIZSZ0bWuK9cALk ci71fd3NVH0V/+6b3ZzETnOcq16WCXa1o07inynXOaDYIR3zJzaAlWCUT1zBYf/RjXBxKU mNYpJEUYP5d7JtL3aJmeIfR181istnCGM74yLPSdVKS3yTk4NJtiwNoi2Xvi9Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1774906919; 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=+gzgV5SeINjUY8V/+06W0mHrUt1P9lvkue9Ak3XFfxk=; b=Q9mchtoc2pEbncOUwQVHerCd/5TX+NX78SPhH4a65kC91ZEz6EVgbnHMB510UqrhKy+hDH 7mb1v0q9zuGeLPAw== From: "Ahmed S. Darwish" To: "H. Peter Anvin" Cc: Maciej Wieczor-Retman , bp@alien8.de, dave.hansen@linux.intel.com, xin@zytor.com, chang.seok.bae@intel.com, mingo@redhat.com, elena.reshetova@intel.com, maciej.wieczor-retman@intel.com, babu.moger@amd.com, sohil.mehta@intel.com, pawan.kumar.gupta@linux.intel.com, pmladek@suse.com, nik.borisov@suse.com, ptesarik@suse.com, tglx@kernel.org, peterz@infradead.org, jpoimboe@kernel.org, ak@linux.intel.com, linux-kernel@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH v12 4/4] x86/cpu: Clear feature bits whose dependencies were cleared Message-ID: References: <48fda57397205a062b752e37e63948fa668946f7.1774623092.git.m.wieczorretman@pm.me> 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: On Fri, 27 Mar 2026, H. Peter Anvin wrote: > > Thinking about it, if this is discovered at runtime, it is really too late, > because in a sense we have miscompiled the kernel with unwanted code (as we > should have compiled out these features just as with other DISABLED features.) > > This ultimately reflects a failed dependency in Kconfig.cpufeatures, which may > have caused kconfig to do the Wrong Thing[TM]. So at the very least it might > be a good thing to print a message here saying Kconfig.cpufeatures should be > fixed. > > The better option, which I don't know how difficult it would be, would be to > make the dependencies available to Kconfig. This sounds like something that > would fall in the scope of Ahmed's rework rather than this patchset, though > (Ahmed, would you agree?) > Definitely! If the CPUID model sent some days ago is to be merged, (*) then all these dependencies should be encoded within x86-cpuid-db, especially that it now covers all the synthetic X86_FEATURE flags as well. x86-cpuid-db can then flatten the Directed Acyclic Graph of dependencies, and auto-generate a flat map which the kernel can use at configuration, compile, and run time. And if a dependency cycle (or other dependency annotation failures) exist, then this can be detected early on; e.g., at the project's CI level, which auto generates kcpuid CSV and the C99 fields at . Thanks, Ahmed (*) https://lore.kernel.org/lkml/20260327021645.555257-1-darwi@linutronix.de