[PATCH v3 0/7] selftests/x86: fix build errors and warnings found via clang

John Hubbard posted 7 patches 1 year, 8 months ago
There is a newer version of this series
tools/testing/selftests/x86/Makefile          | 31 +++++++++++++++----
tools/testing/selftests/x86/amx.c             | 16 ----------
.../testing/selftests/x86/clang_helpers_32.S  | 11 +++++++
.../testing/selftests/x86/clang_helpers_64.S  | 28 +++++++++++++++++
tools/testing/selftests/x86/fsgsbase.c        |  6 ----
.../testing/selftests/x86/fsgsbase_restore.c  | 11 +++----
tools/testing/selftests/x86/sigreturn.c       |  2 +-
.../testing/selftests/x86/syscall_arg_fault.c |  1 -
tools/testing/selftests/x86/sysret_rip.c      | 20 ++++--------
tools/testing/selftests/x86/test_FISTTP.c     |  8 ++---
tools/testing/selftests/x86/test_vsyscall.c   | 15 +++------
tools/testing/selftests/x86/vdso_restorer.c   |  2 ++
12 files changed, 87 insertions(+), 64 deletions(-)
create mode 100644 tools/testing/selftests/x86/clang_helpers_32.S
create mode 100644 tools/testing/selftests/x86/clang_helpers_64.S
[PATCH v3 0/7] selftests/x86: fix build errors and warnings found via clang
Posted by John Hubbard 1 year, 8 months ago
Hi,

Dave Hansen, Muhammad Usama Anjum, here is the combined series that we
discussed yesterday [1].

As I mentioned then, this is a bit intrusive--but no more than
necessary, IMHO. Specifically, it moves some clang-un-inlineable things
out to "pure" assembly code files.

I've tested this by building with clang, then running each binary on my
x86_64 test system with today's 6.10-rc1, and comparing the console and
dmesg output to a gcc-based build without these patches applied. Aside
from timestamps and virtual addresses, it looks identical.

Earlier cover letter:

Just a bunch of build and warnings fixes that show up when building with
clang. Some of these depend on each other, so I'm sending them as a
series.

Changes since v2:

1) Dropped my test_FISTTP.c patch, and picked up Muhammad's fix instead,
   seeing as how that was posted first.

2) Updated patch descriptions to reflect that Valentin Obst's build fix
   for LLVM [1] has already been merged into Linux main.

3) Minor wording and typo corrections in the commit logs throughout.

Changes since the first version:
1) Rebased onto Linux 6.10-rc1

Enjoy!

[1] https://lore.kernel.org/44428518-4d21-4de7-8587-04eceefb330d@nvidia.com

thanks,
John Hubbard

John Hubbard (6):
  selftests/x86: fix Makefile dependencies to work with clang
  selftests/x86: build fsgsbase_restore.c with clang
  selftests/x86: build sysret_rip.c with clang
  selftests/x86: avoid -no-pie warnings from clang during compilation
  selftests/x86: remove (or use) unused variables and functions
  selftests/x86: fix printk warnings reported by clang

Muhammad Usama Anjum (1):
  selftests: x86: test_FISTTP: use fisttps instead of ambiguous fisttp

 tools/testing/selftests/x86/Makefile          | 31 +++++++++++++++----
 tools/testing/selftests/x86/amx.c             | 16 ----------
 .../testing/selftests/x86/clang_helpers_32.S  | 11 +++++++
 .../testing/selftests/x86/clang_helpers_64.S  | 28 +++++++++++++++++
 tools/testing/selftests/x86/fsgsbase.c        |  6 ----
 .../testing/selftests/x86/fsgsbase_restore.c  | 11 +++----
 tools/testing/selftests/x86/sigreturn.c       |  2 +-
 .../testing/selftests/x86/syscall_arg_fault.c |  1 -
 tools/testing/selftests/x86/sysret_rip.c      | 20 ++++--------
 tools/testing/selftests/x86/test_FISTTP.c     |  8 ++---
 tools/testing/selftests/x86/test_vsyscall.c   | 15 +++------
 tools/testing/selftests/x86/vdso_restorer.c   |  2 ++
 12 files changed, 87 insertions(+), 64 deletions(-)
 create mode 100644 tools/testing/selftests/x86/clang_helpers_32.S
 create mode 100644 tools/testing/selftests/x86/clang_helpers_64.S


base-commit: 4a4be1ad3a6efea16c56615f31117590fd881358
-- 
2.45.1
Re: [PATCH v3 0/7] selftests/x86: fix build errors and warnings found via clang
Posted by John Hubbard 1 year, 7 months ago
On 5/31/24 12:38 PM, John Hubbard wrote:
> Hi,
> 
> Dave Hansen, Muhammad Usama Anjum, here is the combined series that we
> discussed yesterday [1].

Hi Dave, Shuah,

Are either of you planning to take this series? I ask because I have a
very slightly overlapping series that enhances the LLVM/clang checks,
that I'm about to post. And I'm not sure if I should try to include
a small fix that would apply to patch 5/7 here.

(This is not urgent, because it's merely a deferral of adding LLVM/clang
support to these kselftests.)


thanks,
-- 
John Hubbard
NVIDIA

> 
> As I mentioned then, this is a bit intrusive--but no more than
> necessary, IMHO. Specifically, it moves some clang-un-inlineable things
> out to "pure" assembly code files.
> 
> I've tested this by building with clang, then running each binary on my
> x86_64 test system with today's 6.10-rc1, and comparing the console and
> dmesg output to a gcc-based build without these patches applied. Aside
> from timestamps and virtual addresses, it looks identical.
> 
> Earlier cover letter:
> 
> Just a bunch of build and warnings fixes that show up when building with
> clang. Some of these depend on each other, so I'm sending them as a
> series.
> 
> Changes since v2:
> 
> 1) Dropped my test_FISTTP.c patch, and picked up Muhammad's fix instead,
>     seeing as how that was posted first.
> 
> 2) Updated patch descriptions to reflect that Valentin Obst's build fix
>     for LLVM [1] has already been merged into Linux main.
> 
> 3) Minor wording and typo corrections in the commit logs throughout.
> 
> Changes since the first version:
> 1) Rebased onto Linux 6.10-rc1
> 
> Enjoy!
> 
> [1] https://lore.kernel.org/44428518-4d21-4de7-8587-04eceefb330d@nvidia.com
> 
> thanks,
> John Hubbard
> 
> John Hubbard (6):
>    selftests/x86: fix Makefile dependencies to work with clang
>    selftests/x86: build fsgsbase_restore.c with clang
>    selftests/x86: build sysret_rip.c with clang
>    selftests/x86: avoid -no-pie warnings from clang during compilation
>    selftests/x86: remove (or use) unused variables and functions
>    selftests/x86: fix printk warnings reported by clang
> 
> Muhammad Usama Anjum (1):
>    selftests: x86: test_FISTTP: use fisttps instead of ambiguous fisttp
> 
>   tools/testing/selftests/x86/Makefile          | 31 +++++++++++++++----
>   tools/testing/selftests/x86/amx.c             | 16 ----------
>   .../testing/selftests/x86/clang_helpers_32.S  | 11 +++++++
>   .../testing/selftests/x86/clang_helpers_64.S  | 28 +++++++++++++++++
>   tools/testing/selftests/x86/fsgsbase.c        |  6 ----
>   .../testing/selftests/x86/fsgsbase_restore.c  | 11 +++----
>   tools/testing/selftests/x86/sigreturn.c       |  2 +-
>   .../testing/selftests/x86/syscall_arg_fault.c |  1 -
>   tools/testing/selftests/x86/sysret_rip.c      | 20 ++++--------
>   tools/testing/selftests/x86/test_FISTTP.c     |  8 ++---
>   tools/testing/selftests/x86/test_vsyscall.c   | 15 +++------
>   tools/testing/selftests/x86/vdso_restorer.c   |  2 ++
>   12 files changed, 87 insertions(+), 64 deletions(-)
>   create mode 100644 tools/testing/selftests/x86/clang_helpers_32.S
>   create mode 100644 tools/testing/selftests/x86/clang_helpers_64.S
> 
> 
> base-commit: 4a4be1ad3a6efea16c56615f31117590fd881358
Re: [PATCH v3 0/7] selftests/x86: fix build errors and warnings found via clang
Posted by Muhammad Usama Anjum 1 year, 7 months ago
On 6/29/24 1:06 AM, John Hubbard wrote:
> On 5/31/24 12:38 PM, John Hubbard wrote:
>> Hi,
>>
>> Dave Hansen, Muhammad Usama Anjum, here is the combined series that we
>> discussed yesterday [1].
> 
> Hi Dave, Shuah,
> 
> Are either of you planning to take this series? I ask because I have a
> very slightly overlapping series that enhances the LLVM/clang checks,
> that I'm about to post. And I'm not sure if I should try to include
> a small fix that would apply to patch 5/7 here.
This series is important. Please accept it.

> 
> (This is not urgent, because it's merely a deferral of adding LLVM/clang
> support to these kselftests.)
> 
> 
> thanks,

-- 
BR,
Muhammad Usama Anjum
Re: [PATCH v3 0/7] selftests/x86: fix build errors and warnings found via clang
Posted by John Hubbard 1 year, 7 months ago
On 7/2/24 3:28 AM, Muhammad Usama Anjum wrote:
> On 6/29/24 1:06 AM, John Hubbard wrote:
>> On 5/31/24 12:38 PM, John Hubbard wrote:
>>> Hi,
>>>
>>> Dave Hansen, Muhammad Usama Anjum, here is the combined series that we
>>> discussed yesterday [1].
>>
>> Hi Dave, Shuah,
>>
>> Are either of you planning to take this series? I ask because I have a
>> very slightly overlapping series that enhances the LLVM/clang checks,
>> that I'm about to post. And I'm not sure if I should try to include
>> a small fix that would apply to patch 5/7 here.
> This series is important. Please accept it.
> 

Hi Muhammad,

May I add your acked by to the series? I can use that as a weak excuse to
resend this, rebased onto the latest, and keep trying to get attention on
it.

thanks,
-- 
John Hubbard
NVIDIA
Re: [PATCH v3 0/7] selftests/x86: fix build errors and warnings found via clang
Posted by Muhammad Usama Anjum 1 year, 7 months ago
On 7/4/24 8:08 AM, John Hubbard wrote:
> On 7/2/24 3:28 AM, Muhammad Usama Anjum wrote:
>> On 6/29/24 1:06 AM, John Hubbard wrote:
>>> On 5/31/24 12:38 PM, John Hubbard wrote:
>>>> Hi,
>>>>
>>>> Dave Hansen, Muhammad Usama Anjum, here is the combined series that we
>>>> discussed yesterday [1].
>>>
>>> Hi Dave, Shuah,
>>>
>>> Are either of you planning to take this series? I ask because I have a
>>> very slightly overlapping series that enhances the LLVM/clang checks,
>>> that I'm about to post. And I'm not sure if I should try to include
>>> a small fix that would apply to patch 5/7 here.
>> This series is important. Please accept it.
>>
> 
> Hi Muhammad,
> 
> May I add your acked by to the series? I can use that as a weak excuse to
> resend this, rebased onto the latest, and keep trying to get attention on
> it.
Yeah, sure. I've reviewed the patches. But haven't found time to send the
tags to patches individually.

> 
> thanks,

-- 
BR,
Muhammad Usama Anjum