Re: [GIT PULL] nolibc changes for 6.6-rc1

From: Willy Tarreau
Date: Tue Aug 15 2023 - 14:51:00 EST


Hello Shuah,

On Tue, Aug 15, 2023 at 12:13:24PM -0600, Shuah Khan wrote:
> On 8/15/23 08:39, Shuah Khan wrote:
> > On 8/15/23 08:35, Willy Tarreau wrote:
> > > On Tue, Aug 15, 2023 at 08:25:51AM -0600, Shuah Khan wrote:
> > > > > The following changes since commit 06c2afb862f9da8dc5efa4b6076a0e48c3fbaaa5:
> > > > >
> > > > >     Linux 6.5-rc1 (2023-07-09 13:53:13 -0700)
> > > > >
> > > > > are available in the Git repository at:
> > > > >
> > > > >     https://git.kernel.org/pub/scm/linux/kernel/git/wtarreau/nolibc.git/ 20230806-for-6.6-1
> > > > >
> > > > > for you to fetch changes up to d98c1e27e46e47a3ae67e1d048f153598ba82611:
> > > > >
> > > > >     tools/nolibc: stackprotector.h: make __stack_chk_init static (2023-08-06 18:44:47 +0200)
> > > > >
> > > >
> > > > Hi Willy,
> > > >
> > > > I am sorry for the delay on this. I was traveling last week
> > > > and getting back to digging myself out of emails.
> > >
> > > No problem, thanks for getting back :-)
> > >
> > > > I am having trouble pulling this request though:
> > > >
> > > > git request-pull https://git.kernel.org/pub/scm/linux/kernel/git/wtarreau/nolibc.git/ 20230806-for-6.6-1
> > > >
> > > > gives me the following error
> > > >
> > > > fatal: Not a valid revision: git.kernel.org/pub/scm/linux/kernel/git/wtarreau/nolibc.git/
> > > >
> > > > I don't see a tag at https://git.kernel.org/pub/scm/linux/kernel/git/wtarreau/nolibc.git
> > >
> > > Ah sorry for the misunderstanding, that's the branch name, I'll set a
> > > tag then.
> > >
> >
> > No worries. Could you also share the test you run? I will pull
> > you request and run tests.
> >
>
> Please send either another pull request or send the tag details.

I've pushed a tag named 20230815-for-6.6-2 in the repo below:

https://git.kernel.org/pub/scm/linux/kernel/git/wtarreau/nolibc.git

Please let me know if you want me to resend a PR.

I'm also attaching a script I'm using here to run the tests on the
various archs. It's quite limited but gets the job done for now.
There are simplifications coming for future versions. The simplest
way to use it is:

1) make sure you have the relevant toolchains. We're currently
using those Arnd maintains and that are located here:

https://mirrors.edge.kernel.org/pub/tools/crosstool/

If that helps I'm attaching a tiny script I have which downloads
all needed ones from a given version and extracts them in a same
directory.

Please note, if you've downloaded version 13.1.0, I've had a
segfault on gcc-aarch64 only on this one and that was fixed with
13.2.0. I preferred to tell you upfront instead of wasting your
time on it.

2) from the kernel top dir, copy the test-all-full4.sh script into
tools/testing/selftests/nolibc/ then indicate where you extracted
the crosstools:

$ cd tools/testing/selftests/nolibc
$ TOOLCHAIN_BASE=/path/to/gcc-13.2.0-nolibc ./test-all-full4.sh

For each supported arch, it will build the test program, run it in
userland under qemu with your current kernel, and will also build
a kernel, install the program in it and run it under qemu. Support
for loongarch in Qemu is recent, so if the one from your distro
doesn't have it, you can instead build for all other archs by
passing their names in argument to the program:

$ TOOLCHAIN_BASE=... ./test-all-full4.sh \
i386 x86_64 arm64 arm mips ppc ppc64 ppc64le riscv s390

Note that the archs most of the time match the kernel ones, except
when there are variants, where we defined extra ones (typically to
force 32/64 bits), and in this case we use distinct names to avoid
any ambiguity. This explains "ppc" and "ppc64" above, which both
map to "powerpc" when building the kernel.

3) At the end it will show a synthetic report indicating what archs
succeeded/failed and some will show "warning" if there is at
least one test skipped:

#### Synthetic summary:
USER i386 160 test(s): 158 passed, 2 skipped, 0 failed => status: warning
KERN i386 160 test(s): 160 passed, 0 skipped, 0 failed => status: success

Two "skipped" are expected for the userland tests, due to privileged
operations being skipped. That is OK. On MIPS and s390 depending on
the toolchains, another skipped can appear due to the stack-protector
test being skipped. In this case it will be 3 skipped for userland,
and 1 skipped for the kernel. There should never be any failure.

4) Save precious time: it is often useful to just run the userland
tests when you're not testing for a kernel regression: the program
is exactly the same and if you didn't change your kernel between
tests there is no reason you'll get a different result once you know
what the userland reports. For this, set USER_ONLY=1 when calling
the script:

$ TOOLCHAIN_BASE=... ./test-all-full4.sh \
USER_ONLY=1 \
i386 x86_64 arm64 arm mips ppc ppc64 ppc64le riscv s390

It will skip all the kernel parts and will only install UAPI headers,
build nolibc-test for each arch and run it through Qemu. Quite
honestly this is the recommended way to use it when you're not
seeking a specific kernel issue. On my laptop it takes 24 seconds
(loongarch was not tested here):

#### Synthetic summary:
USER i386 160 test(s): 158 passed, 2 skipped, 0 failed => status: warning
USER x86_64 160 test(s): 158 passed, 2 skipped, 0 failed => status: warning
USER arm64 160 test(s): 158 passed, 2 skipped, 0 failed => status: warning
USER arm 160 test(s): 158 passed, 2 skipped, 0 failed => status: warning
USER mips 160 test(s): 157 passed, 3 skipped, 0 failed => status: warning
USER ppc 160 test(s): 158 passed, 2 skipped, 0 failed => status: warning
USER ppc64 160 test(s): 158 passed, 2 skipped, 0 failed => status: warning
USER ppc64le 160 test(s): 158 passed, 2 skipped, 0 failed => status: warning
USER riscv 160 test(s): 158 passed, 2 skipped, 0 failed => status: warning
USER s390 160 test(s): 157 passed, 3 skipped, 0 failed => status: warning

5) Other variables: it's possible to force a specific cross-compiler
prefix with CROSS_COMPILE_$arch, or when building for a single arch,
CROSS_COMPILE, a specific CC with CC, and to enable verbose build
with V=1.

6) A complete capture of all outputs is done in "report.out", and a
copy of each used nolibc-test executable is kept with the suffix
-$arch.

The script contains a "set -e" statement to stop on any error. There is
one known case (missing qemu binary for userlan) where the error is
ignored in the makefile and the build will continue. But this stuff is
currently being improved so I consider there's no point re-changing this
at the last minute at the risk of breaking other stuff.

Do not hesitate to ask if you encounter difficulties or if anything is
not clear.

Thank you!
Willy

Attachment: test-all-full4.sh
Description: Bourne shell script

Attachment: download.sh
Description: Bourne shell script