[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <58794e0e-43f5-f6cb-6b34-ad299ddac69f@intel.com>
Date: Mon, 7 Feb 2022 11:13:04 -0800
From: Reinette Chatre <reinette.chatre@...el.com>
To: Shuah Khan <skhan@...uxfoundation.org>, <shuah@...nel.org>,
<linux-kselftest@...r.kernel.org>
CC: <linux-kernel@...r.kernel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Ram Pai <linuxram@...ibm.com>,
Sandipan Das <sandipan@...ux.ibm.com>,
"Florian Weimer" <fweimer@...hat.com>,
"Desnes A. Nunes do Rosario" <desnesn@...ux.vnet.ibm.com>,
Ingo Molnar <mingo@...nel.org>,
"Thiago Jung Bauermann" <bauerman@...ux.ibm.com>,
Michael Ellerman <mpe@...erman.id.au>,
Michal Suchanek <msuchanek@...e.de>, <linux-mm@...ck.org>,
"Chang S . Bae" <chang.seok.bae@...el.com>,
Borislav Petkov <bp@...e.de>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>, <x86@...nel.org>,
Andy Lutomirski <luto@...nel.org>
Subject: Re: [PATCH 0/3] selftests: Remove duplicate CPUID wrappers
Hi Shuah,
On 2/7/2022 10:00 AM, Shuah Khan wrote:
>
> This will work fine on newer versions of gcc/clang. However this could
> fail when mainline kselftest is used on stable releases on test rings
> and so on, especially if they have older versions of gcc/clang.
Indeed. It thus seems that kselftest has a minimal required version for
gcc/clang that is not the current mainline minimal version but the
minimal version of the oldest supported stable kernel, which is v4.9.
__cpuid_count() was added to gcc in commit:
cb0dee885cb30b4e9beeef070cf000baa7d09abe and thus available since
gcc 4.4.
Looking at Documentation/Changes or later Documentation/process/changes.rst
kernels v4.9 and v4.14 have the minimal required version of
gcc of 3.2. So this change would encounter an issue if mainline
kselftest is used to test a v4.9 or v4.14 kernel on a system that only
supports its minimal gcc.
Kernel v4.19 moved the gcc minimal required version to 4.6 that does
contain this macro.
There does not seem to be a minimum required version of clang/LLVM
in v4.19. The first time I see a minimal version for Clang/LLVM
for a stable kernel is in kernel v5.10 with Clang/LLVM minimal
version 10.0.1 and from what I can tell the __cpuid_count() macro
was added to Clang/LLVM in version 3.4.0
(commit 4dcb5dbb53ea4fbeab48bc6bc3c4d392361dabc1).
>
> We will have to find a solution for this. Instead of deleting the local
> define, let's keep it under ifndef __cpuid_count
>
> /usr/lib/gcc/x86_64-linux-gnu/11/include/cpuid.h
>
> #define __cpuid_count(level, count, a, b, c, d) \
> __asm__ __volatile__ ("cpuid\n\t" \
> : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \
> : "0" (level), "2" (count))
>
Will do. I see that gcc obtained the volatile qualifier in v11.1 so I can use
the most recent macro as you have here.
Reinette
Powered by blists - more mailing lists