[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJF2gTRZyAAgrM1RMrTi7Zi+Vx_VBnM1=CWwZZtLy+uHZ=vZpw@mail.gmail.com>
Date: Wed, 26 Mar 2025 14:34:32 +0800
From: Guo Ren <guoren@...nel.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: arnd@...db.de, gregkh@...uxfoundation.org, paul.walmsley@...ive.com,
palmer@...belt.com, anup@...infault.org, atishp@...shpatra.org,
oleg@...hat.com, kees@...nel.org, tglx@...utronix.de, will@...nel.org,
mark.rutland@....com, brauner@...nel.org, akpm@...ux-foundation.org,
rostedt@...dmis.org, edumazet@...gle.com, unicorn_wang@...look.com,
inochiama@...look.com, gaohan@...as.ac.cn, shihua@...as.ac.cn,
jiawei@...as.ac.cn, wuwei2016@...as.ac.cn, drew@...7.com,
prabhakar.mahadev-lad.rj@...renesas.com, ctsai390@...estech.com,
wefu@...hat.com, kuba@...nel.org, pabeni@...hat.com, josef@...icpanda.com,
dsterba@...e.com, mingo@...hat.com, peterz@...radead.org,
boqun.feng@...il.com, xiao.w.wang@...el.com, qingfang.deng@...lower.com.cn,
leobras@...hat.com, jszhang@...nel.org, conor.dooley@...rochip.com,
samuel.holland@...ive.com, yongxuan.wang@...ive.com,
luxu.kernel@...edance.com, david@...hat.com, ruanjinjie@...wei.com,
cuiyunhui@...edance.com, wangkefeng.wang@...wei.com, qiaozhe@...as.ac.cn,
ardb@...nel.org, ast@...nel.org, linux-kernel@...r.kernel.org,
linux-riscv@...ts.infradead.org, kvm@...r.kernel.org,
kvm-riscv@...ts.infradead.org, linux-mm@...ck.org,
linux-crypto@...r.kernel.org, bpf@...r.kernel.org,
linux-input@...r.kernel.org, linux-perf-users@...r.kernel.org,
linux-serial@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-arch@...r.kernel.org, maple-tree@...ts.infradead.org,
linux-trace-kernel@...r.kernel.org, netdev@...r.kernel.org,
linux-atm-general@...ts.sourceforge.net, linux-btrfs@...r.kernel.org,
netfilter-devel@...r.kernel.org, coreteam@...filter.org,
linux-nfs@...r.kernel.org, linux-sctp@...r.kernel.org,
linux-usb@...r.kernel.org, linux-media@...r.kernel.org
Subject: Re: [RFC PATCH V3 01/43] rv64ilp32_abi: uapi: Reuse lp64 ABI interface
On Wed, Mar 26, 2025 at 4:41 AM Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
>
> On Tue, 25 Mar 2025 at 05:17, <guoren@...nel.org> wrote:
> >
> > The rv64ilp32 abi kernel accommodates the lp64 abi userspace and
> > leverages the lp64 abi Linux interface. Hence, unify the
> > BITS_PER_LONG = 32 memory layout to match BITS_PER_LONG = 64.
>
> No.
>
> This isn't happening.
>
> You can't do crazy things in the RISC-V code and then expect the rest
> of the kernel to just go "ok, we'll do crazy things".
>
> We're not doing crazy __riscv_xlen hackery with random structures
> containing 64-bit values that the kernel then only looks at the low 32
> bits. That's wrong on *so* many levels.
>
> I'm willing to say "big-endian is dead", but I'm not willing to accept
> this kind of crazy hackery.
>
> Not today, not ever.
>
> If you want to run a ilp32 kernel on 64-bit hardware (and support
> 64-bit ABI just in a 32-bit virtual memory size), I would suggest you
>
> (a) treat the kernel as natively 32-bit (obviously you can then tell
> the compiler to use the rv64 instructions, which I presume you're
> already doing - I didn't look)
I used CONFIG_32BIT in v1 and v2, but I've abandoned them because,
based on CONFIG_64BIT, I gain more functionality by inheriting the
lp64-abi kernel. I want the full functionality of the CONFIG_64BIT
Linux kernel, which can be equivalent, used interchangeably, and
seamlessly.
>
> (b) look at making the compat stuff do the conversion the "wrong way".
>
> And btw, that (b) implies *not* just ignoring the high bits. If
> user-space gives 64-bit pointer, you don't just treat it as a 32-bit
> one by dropping the high bits. You add some logic to convert it to an
> invalid pointer so that user space gets -EFAULT.
Thanks for the advice. I'm looking at how to make the compat stuff.
--
Best Regards
Guo Ren
Powered by blists - more mailing lists