Re: rcutorture initrd/nolibc build on ARMv8?

From: Willy Tarreau
Date: Tue Jan 19 2021 - 12:19:04 EST


Hi Mark,

On Tue, Jan 19, 2021 at 05:02:38PM +0000, Mark Rutland wrote:
> > I can't spot from the report above the original C file that was attempted
> > to be built, it makes me think we tried to compile directly the .h file.
>
> That was the inline snippet in
> tools/testing/selftests/rcutorture/bin/mkinitrd.sh:
>
> | #ifndef NOLIBC
> | #include <unistd.h>
> | #include <sys/time.h>
> | #endif
> |
> | volatile unsigned long delaycount;
> |
> | int main(int argc, int argv[])
> | {
> | int i;
> | struct timeval tv;
> | struct timeval tvb;
> |
> | for (;;) {
> | sleep(1);
> | /* Need some userspace time. */
> | if (gettimeofday(&tvb, NULL))
> | continue;
> | do {
> | for (i = 0; i < 1000 * 100; i++)
> | delaycount = i * i;
> | if (gettimeofday(&tv, NULL))
> | break;
> | tv.tv_sec -= tvb.tv_sec;
> | if (tv.tv_sec > 1)
> | break;
> | tv.tv_usec += tv.tv_sec * 1000 * 1000;
> | tv.tv_usec -= tvb.tv_usec;
> | } while (tv.tv_usec < 1000);
> | }
> | return 0;
> | }
>
> ... which gets written to a file called init.c, and then built with:
>
> | ${CROSS_COMPILE}gcc -fno-asynchronous-unwind-tables -fno-ident \
> | -nostdlib -include ../../../../include/nolibc/nolibc.h \
> | -lgcc -s -static -Os -o init init.c

OK I'll retry this, thank you!

> I was building natively on an arm64 box:
>
> | ./tools/testing/selftests/rcutorture/bin/kvm.sh \
> | --cpus 250 --trust-make --configs "TREE03" \
> | --kmake-arg "CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64"
>
> > Having it run through sh -x would help me try to locate the root cause or
> > possibly even attempt to reproduce it.
>
> I ran with sh -x, but it didn't log the compiler invocation; hopefully
> the above is sufficient?

I guess so, yes. I'm pretty sure I'll come back with new questions
soon :-)

Thanks,
Willy