public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sven Schnelle <svens@linux.ibm.com>
To: Willy Tarreau <w@1wt.eu>
Cc: "Paul E . McKenney" <paulmck@kernel.org>,
	Josh Triplett <josh@joshtriplett.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	linux-kernel@vger.kernel.org, hca@linux.ibm.com
Subject: Re: [PATCH 2/5] nolibc: add support for s390
Date: Mon, 02 Jan 2023 09:17:04 +0100	[thread overview]
Message-ID: <yt9dilhpjqpr.fsf@linux.ibm.com> (raw)
In-Reply-To: <20221227213530.GA6390@1wt.eu> (Willy Tarreau's message of "Tue, 27 Dec 2022 22:35:30 +0100")

Hi Willy,

Willy Tarreau <w@1wt.eu> writes:

> On Fri, Dec 09, 2022 at 03:19:36PM +0100, Sven Schnelle wrote:
>> Use arch-x86_64 as a template. Not really different, but
>> we have our own mmap syscall which takes a structure instead
>> of discrete arguments.
> (...)
>
> This evening I downloaded an s390 toolchain from kernel.org's nolibc
> toolchains and expected to test the code under qemu, but I met two
> build errors.
>
> The first one is that __maybe_unused breaks the build below:
>
>> +static __maybe_unused
>> +void *sys_mmap(void *addr, size_t length, int prot, int flags, int fd,
>> +	       off_t offset)
>
> And indeed, __maybe_unused is not defined here in userland. The following
> patch allows to go further:
>
>   diff --git a/tools/include/nolibc/arch-s390.h b/tools/include/nolibc/arch-s390.h
>   index 34b744e2f7d6..effae6e3d9e2 100644
>   --- a/tools/include/nolibc/arch-s390.h
>   +++ b/tools/include/nolibc/arch-s390.h
>   @@ -194,7 +194,7 @@ struct s390_mmap_arg_struct {
>           unsigned long offset;
>    };
>    
>   -static __maybe_unused
>   +static __attribute__((unused))
>    void *sys_mmap(void *addr, size_t length, int prot, int flags, int fd,
>                  off_t offset)
>    {

Hrm, yes. I didn't thought about this macro not being present.

> But with this addressed, I'm facing this next error:
>
>   $ make nolibc-test LDFLAGS= ARCH=s390 CC=/f/tc/nolibc/gcc-12.2.0-nolibc/s390-linux/bin/s390-linux-gcc
>     MKDIR   sysroot/s390/include
>   make[1]: Entering directory '/g/public/linux/master/tools/include/nolibc'
>   make[2]: Entering directory '/g/public/linux/master'
>   make[2]: Leaving directory '/g/public/linux/master'
>   make[2]: Entering directory '/g/public/linux/master'
>     INSTALL /g/public/linux/master/tools/testing/selftests/nolibc/sysroot/sysroot/include
>   make[2]: Leaving directory '/g/public/linux/master'
>   make[1]: Leaving directory '/g/public/linux/master/tools/include/nolibc'
>     CC      nolibc-test
>   /tmp/ccCzaBgD.s: Assembler messages:
>   /tmp/ccCzaBgD.s:9: Error: Unrecognized opcode: `lg'
>   /tmp/ccCzaBgD.s:12: Error: Unrecognized opcode: `lay'
>   /tmp/ccCzaBgD.s:15: Error: Unrecognized opcode: `lghi'
>   make: *** [Makefile:108: nolibc-test] Error 1
>
> Thus I'm wondering if specific options are required for the compiler
> (it's gcc 12.2.0 + binutils 2.39), if I'm not using the proper compiler,
> or if there's anything wrong in the asm code (e.g. maybe by accident you
> sent the patch from an earlier development branch), or anything else ?

Hmm, tried this on my x86 laptop, and it looks like there are two things
here:

The cross compiler needs -m64 to compile in 64bit mode. otherwise it
assumes 31bit mode, where both lg and lghi are not present. The other
thing is that lay was introduced with later generations of the
z/Architecture. The kernel compiles with z10 as minimum architecture, so
i'm leaning towards enforcing the same arch for nolibc. What do you think?

  reply	other threads:[~2023-01-02  8:20 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-09 14:19 [PATCH 0/5] add s390 support to nolibc and rcutorture Sven Schnelle
2022-12-09 14:19 ` [PATCH 1/5] nolibc: fix fd_set type Sven Schnelle
2022-12-10  8:46   ` Willy Tarreau
2022-12-09 14:19 ` [PATCH 2/5] nolibc: add support for s390 Sven Schnelle
2022-12-10  9:07   ` Willy Tarreau
2022-12-10  9:34     ` Sven Schnelle
2022-12-10  9:37       ` Willy Tarreau
2022-12-10  9:39         ` Sven Schnelle
2022-12-10  9:44           ` Willy Tarreau
2022-12-10 17:57             ` Paul E. McKenney
2022-12-10 22:05               ` Willy Tarreau
2022-12-11  5:51                 ` Paul E. McKenney
2022-12-27 21:35   ` Willy Tarreau
2023-01-02  8:17     ` Sven Schnelle [this message]
2023-01-02  8:41       ` Willy Tarreau
2023-01-02  9:33         ` Sven Schnelle
2023-01-02  9:50           ` Willy Tarreau
2022-12-09 14:19 ` [PATCH 3/5] selftests/nolibc: add s390 support Sven Schnelle
2022-12-10  9:08   ` Willy Tarreau
2022-12-09 14:19 ` [PATCH 4/5] rcutorture: add support for s390 Sven Schnelle
2022-12-09 14:19 ` [PATCH 5/5] rcutorture: build initrd for rcutorture with nolibc Sven Schnelle
2022-12-09 15:03 ` [PATCH 0/5] add s390 support to nolibc and rcutorture Paul E. McKenney
2022-12-09 15:28   ` Willy Tarreau
2022-12-10  1:26     ` Paul E. McKenney
2022-12-10  9:12       ` Willy Tarreau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yt9dilhpjqpr.fsf@linux.ibm.com \
    --to=svens@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=jiangshanlai@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=paulmck@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=w@1wt.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox