From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.alien8.de (mail.alien8.de [65.109.113.108]) (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 D03BF395DB4 for ; Mon, 30 Mar 2026 20:01:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=65.109.113.108 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774900876; cv=none; b=tU3X4Rjwr+/x14Ed2FQwkKKbCa2Q6cvA3nRwHU+M+oNr+zkhzBJe621NCW/2wRl+QIYpXaWliZ5uic11xDGE8R29P7hFltJhCIlR6Cm9SVZCV9H2zd4s1OJB/WD5ANZ1ItVNWQv2XuOQot/piA9OpeRjwcfxvPUuCHm+kRJW/hc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774900876; c=relaxed/simple; bh=QroLsksN4CWtPJhsFWpGwDqdLivE+oEXDs+I22pCsHg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=p1BYqj2R/9Ilzhht5rbt6MvUnaViqECkLGrRjnnOScJDUrJ5eEVLztTTcJgUqeQkAOc6PVaeJERnxHX+SsIZdfxP08/2zrGKalNQ8n73tD0mrtbXYhTl1gLkc08GD980Vw8RETIZHmRhVxR9xvl9qMHvIRtRpnqBlO30bbOXzqM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de; spf=pass smtp.mailfrom=alien8.de; dkim=pass (4096-bit key) header.d=alien8.de header.i=@alien8.de header.b=O8giddb2; arc=none smtp.client-ip=65.109.113.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=alien8.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (4096-bit key) header.d=alien8.de header.i=@alien8.de header.b="O8giddb2" Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTP id 6CBE940E015B; Mon, 30 Mar 2026 20:01:12 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at mail.alien8.de Authentication-Results: mail.alien8.de (amavisd-new); dkim=pass (4096-bit key) header.d=alien8.de Received: from mail.alien8.de ([127.0.0.1]) by localhost (mail.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id ZzeGa0SPmaND; Mon, 30 Mar 2026 20:01:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=alien8; t=1774900868; bh=GJDecQ4e5pn9MB/lkF2wAbP4DkvZQX+oNBxqkaXTKMI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=O8giddb2ZqzMjqhnOfQH4XFJk6Tw0f9C0MnYsdh6MiJDbEBFZoOeyNIf5N1Apa09n JU/m+/Rt1G94+y2M57qW5P6rA0kk9b8wEGzF/MzGLKrBfQU/DZ48EttyXMxkyJ8k0w C1CHETHLSt2LoWmdTxNpxPjCxnU8EhUbM6d3GvNJA1BnwP5bWRSEHYQjL89yCy3j/K mWJ6Usy/7SqlUAUnpY0sIWzW/cdfHxO+rDIk9MeMgxkaMjmkau8k1q3XfdT3mHrg7F am6F7lpFwjt1S0L/IfF7Al3iVJHpc6i4WRxfWz82GTqdvHV2DoovlJP/zq1esLCvzl Yps8FfE6jTmLjmJEUA0tanVuWd+uw3gH9ITDJKNRYB4Gc7Ek2/8oT9ZfIeF7s/yskI yH4jA0qhOvhddP9VU3w6EZ262x6ptjQkFWV3u2g8vic/BmVYbO+aOh/ahurV9oLaAR OXPYjJSaX6EuyN21Nu984LHj78vcZqK2E0VhRjVVCwG02gl3L8I/nmvZ02jEetUekt UPak0cpRhXnY2d+tvLzayIM9klSee9tJDOSNq7HSD6zmGn830XY1rW4dEFmwEL+Bw2 NE8yrg9FpJleaQVE4rK6LJtUsHw2e7l/gMwwHwpddbxNfrRGueGzbcn3axCXARyo2f JCuQ5esDJdfPRh7hxPaWUEv0= Received: from zn.tnic (p5de8e020.dip0.t-ipconnect.de [93.232.224.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with UTF8SMTPSA id BA82A40E016E; Mon, 30 Mar 2026 20:00:46 +0000 (UTC) Date: Mon, 30 Mar 2026 22:00:45 +0200 From: Borislav Petkov To: 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: <20260330200045.GUacrWbcsBhp9a-kfb@fat_crate.local> References: 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-Disposition: inline In-Reply-To: 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[] = { > static void filter_cpuid_features(struct cpuinfo_x86 *c, bool warn) > { > const struct cpuid_dependent_feature *df; > + char 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:: struct long_struct_name *descriptive_name; unsigned long foo, bar; unsigned int tmp; int ret; The above is faster to parse than the reverse ordering:: int ret; unsigned int tmp; unsigned long foo, bar; struct long_struct_name *descriptive_name; And even more so than random ordering:: unsigned long foo, bar; int ret; struct long_struct_name *descriptive_name; unsigned int tmp; Check your whole set pls. ... > +/* > + * 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. > + * 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) > { > - char feature_buf[16], depends_buf[16]; > + char feature_buf[X86_NAMELESS_FEAT_BUFLEN], depends_buf[X86_NAMELESS_FEAT_BUFLEN]; Blergh, that define is too long. ;-\ -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette