[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <mhng-16d3c75b-cf60-499e-98b0-098d630874b4@palmer-ri-x1c9a>
Date: Thu, 27 Mar 2025 09:20:11 -0700 (PDT)
From: Palmer Dabbelt <palmer@...belt.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
CC: guoren@...nel.org, Arnd Bergmann <arnd@...db.de>,
Greg KH <gregkh@...uxfoundation.org>, Paul Walmsley <paul.walmsley@...ive.com>, anup@...infault.org,
atishp@...shpatra.org, oleg@...hat.com, kees@...nel.org, tglx@...utronix.de,
Will Deacon <will@...nel.org>, Mark Rutland <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 <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, Ard Biesheuvel <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 Tue, 25 Mar 2025 13:41:30 PDT (-0700), Linus Torvalds 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.
FWIW: this has come up a few times and we've generally said "nobody
wants this", but that doesn't seem to stick...
> 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.
OK, maybe that will stick ;)
> 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)
>
> (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.
>
> Linus
Powered by blists - more mailing lists