From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-43102.protonmail.ch (mail-43102.protonmail.ch [185.70.43.102]) (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 B820123FC41 for ; Mon, 30 Mar 2026 20:42:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.70.43.102 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774903340; cv=none; b=JkgaeuKi7XUa3p4jhb3ZZiSVTw65O/ABBgycb2vWxSj/nqdoZRtSVUfZngvKXCZ87clHDTZxmUMaFJvzpDuggE+aL+XKJIi7HDMg0GsZsga1+OituGnnN19pn1LfHifYDHHpX7oiJWtG2Jr+qXx+bUQMYM4ePut3yw6iYHFw0kc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774903340; c=relaxed/simple; bh=GkNQ/9hPx0ULwb0etpsyJQkBXiIKd5bRKXB2dJzBZ7A=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=p0Cc8QzwLn9+f+oXlfjH12xjRiIeMRtYMQx/vPTBKDOEGgtENkEPHNAB5J4SxHys8aJrCcLxvS3pWMITpbYsTccdC0xbD1GfNuJOwVNNDLA3I5cz9ZfOvkV40/I4s5RtHY4XgcTnh4TmNzx2QY4k4lnOH2xYcCeWizmu51rwzoc= 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=rElK7EBC; arc=none smtp.client-ip=185.70.43.102 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="rElK7EBC" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail3; t=1774903336; x=1775162536; bh=oKZZ9c7DCT/+JQp6KCP41G8rEzuebvQmuQiSbQV0a9I=; 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=rElK7EBCbiYSJ+bQ2Xhf4FojAFNNHFwlxRsFeglj8uGBfiiRJ92DZEOLzD5F2pFZp fOOkegg22P7ciqggcBG+Faqyzo5NNpK1IPUR+VuauEaSRkeO0AAq/IKge7thm2bYyj 5oFR2HhhByWwaOCtpDu+Nc3f7nq0rIhiIrrAmwoMIkCzmqQ0X64vFr1HWjHFTjAQ04 alqhZdgL/UyIScsWbKLOKZbLjma5jeT0WzqI2kfrt/hrMSWzGPJt810h9rlX6E0Xvp omQ2KiGGQyf1x5ikPTW8808Fo7dz3tF8MNtzrCY6jCtd24Nar2/Qnr2PHk/STz/RU6 MrZL29Nh7P9Sw== Date: Mon, 30 Mar 2026 20:42:11 +0000 To: Borislav Petkov From: Maciej Wieczor-Retman Cc: dave.hansen@linux.intel.com, hpa@zytor.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, darwi@linutronix.de, 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 2/4] x86/cpu: Check if feature string is non-zero Message-ID: In-Reply-To: <20260330200045.GUacrWbcsBhp9a-kfb@fat_crate.local> References: <20260330200045.GUacrWbcsBhp9a-kfb@fat_crate.local> Feedback-ID: 164464600:user:proton X-Pm-Message-ID: c018edf3494571d47b7f802860848420c97cd282 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=utf-8 Content-Transfer-Encoding: quoted-printable On 2026-03-30 at 22:00:45 +0200, Borislav Petkov wrote: >On Fri, Mar 27, 2026 at 03:10:52PM +0000, Maciej Wieczor-Retman wrote: >> diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c >> index 76339e988304..7cfd124b3fbf 100644 >> --- a/arch/x86/kernel/cpu/common.c >> +++ b/arch/x86/kernel/cpu/common.c >> @@ -678,6 +678,7 @@ cpuid_dependent_features[] =3D { >> static void filter_cpuid_features(struct cpuinfo_x86 *c, bool warn) >> { >> =09const struct cpuid_dependent_feature *df; >> +=09char feature_buf[X86_NAMELESS_FEAT_BUFLEN]; > >The tip-tree preferred ordering of variable declarations at the >beginning of a function is reverse fir tree order:: > >=09struct long_struct_name *descriptive_name; >=09unsigned long foo, bar; >=09unsigned int tmp; >=09int ret; > >The above is faster to parse than the reverse ordering:: > >=09int ret; >=09unsigned int tmp; >=09unsigned long foo, bar; >=09struct long_struct_name *descriptive_name; > >And even more so than random ordering:: > >=09unsigned long foo, bar; >=09int ret; >=09struct long_struct_name *descriptive_name; >=09unsigned int tmp; > >Check your whole set pls. Sorry, will do. > >... > >> +/* >> + * Return the feature "name" if available, otherwise return the >> + * X86_FEATURE_* numerals to make it easier to identify the feature. > >"return the X86_FEATURE word number and bit position...." > >Might as well correct it to be more precise. so maybe: + * Return the feature's "name" if available, otherwise return the + * feature's bit numerals in "word:bit" format so it's easier to identify. ? >> + * Callers of this function need to pass a char * buffer of size >> + * X86_NAMELESS_FEAT_BUFLEN. >> + */ >> +const char *x86_feature_name(unsigned int bit, char *buf) > >... > >> void check_cpufeature_deps(struct cpuinfo_x86 *c) >> { >> -=09char feature_buf[16], depends_buf[16]; >> +=09char feature_buf[X86_NAMELESS_FEAT_BUFLEN], depends_buf[X86_NAMELESS= _FEAT_BUFLEN]; > >Blergh, that define is too long. ;-\ X86_NAMELESS_FEAT_BUF? X86_NUM_FEAT_BUF? Not sure how to make it much more shorter without making it also unreadable= . --=20 Kind regards Maciej Wiecz=C3=B3r-Retman