From: Jessica Clarke <jrtc27@jrtc27.com>
To: Charlie Jenkins <charlie@rivosinc.com>
Cc: Alexandre Ghiti <alex@ghiti.fr>,
linux-riscv <linux-riscv@lists.infradead.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
Conor Dooley <conor@kernel.org>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@rivosinc.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Anup Patel <anup@brainfault.org>,
konstantin@linuxfoundation.org, linux-doc@vger.kernel.org,
linux-kselftest@vger.kernel.org, Linux-MM <linux-mm@kvack.org>,
mick@ics.forth.gr
Subject: Re: [RESEND PATCH v3 1/2] RISC-V: mm: Restrict address space for sv39,sv48,sv57
Date: Fri, 7 Jul 2023 01:52:47 +0100 [thread overview]
Message-ID: <34483C0C-FA31-41E6-9263-1F9A08CEBE2C@jrtc27.com> (raw)
In-Reply-To: <ZKdUpzvyfy9f48MI@ghost>
On 7 Jul 2023, at 00:56, Charlie Jenkins <charlie@rivosinc.com> wrote:
>
> On Thu, Jul 06, 2023 at 11:11:37AM +0200, Alexandre Ghiti wrote:
>> Hi Charlie,
>>
>>
>> On 05/07/2023 20:59, Charlie Jenkins wrote:
>>> Make sv48 the default address space for mmap as some applications
>>> currently depend on this assumption. The RISC-V specification enforces
>>> that bits outside of the virtual address range are not used, so
>>> restricting the size of the default address space as such should be
>>> temporary.
>>
>>
>> What do you mean in the last sentence above?
>>
> Applications like Java and Go broke when sv57 was implemented because
> they shove bits into the upper space of pointers. However riscv enforces
> that all of the upper bits in the virtual address are equal to the most
> significant bit. "Temporary" may not have been the best word, but this change
> would be irrelevant if application developers were following this rule, if I
> am understanding this requirement correctly. What this means to me is
> that riscv hardware is not guaranteed to not discard the bits in the virtual
> address that are not used in paging.
RISC-V guarantees that it will not discard the bits*. Java and Go aren’t
actually dereferencing the pointers with their own metadata in the top
bits (doing so would require a pointer masking extension, like how Arm
has TBI), they’re just temporarily storing it there, assuming they’re
not significant bits, then masking out and re-canonicalising the
address prior to dereferencing. Which breaks, not because the hardware
is looking at the higher bits (otherwise you could never use Sv57 for
such applications even if you kept your addresses < 2^47), but because
the chosen addresses have those high bits as significant.
* A page fault is guaranteed if the address isn’t sign-extended
Jess
next prev parent reply other threads:[~2023-07-07 0:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-05 18:59 [RESEND PATCH v3 0/2] RISC-V: mm: Make SV48 the default address space Charlie Jenkins
2023-07-05 18:59 ` [RESEND PATCH v3 1/2] RISC-V: mm: Restrict address space for sv39,sv48,sv57 Charlie Jenkins
2023-07-06 9:11 ` Alexandre Ghiti
2023-07-06 23:56 ` Charlie Jenkins
2023-07-07 0:52 ` Jessica Clarke [this message]
2023-07-05 18:59 ` [RESEND PATCH v3 2/2] RISC-V: mm: Update documentation and include test Charlie Jenkins
2023-07-06 5:30 ` Randy Dunlap
2023-07-06 9:17 ` Alexandre Ghiti
2023-07-05 20:00 ` [RESEND PATCH v3 0/2] RISC-V: mm: Make SV48 the default address space Conor Dooley
2023-07-05 20:50 ` Charlie Jenkins
2023-07-05 21:59 ` Conor Dooley
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=34483C0C-FA31-41E6-9263-1F9A08CEBE2C@jrtc27.com \
--to=jrtc27@jrtc27.com \
--cc=alex@ghiti.fr \
--cc=anup@brainfault.org \
--cc=aou@eecs.berkeley.edu \
--cc=charlie@rivosinc.com \
--cc=conor@kernel.org \
--cc=konstantin@linuxfoundation.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-riscv@lists.infradead.org \
--cc=mick@ics.forth.gr \
--cc=palmer@rivosinc.com \
--cc=paul.walmsley@sifive.com \
/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