[RESEND,v3,0/2] RISC-V: mm: Make SV48 the default address space

Message ID 20230705190002.384799-1-charlie@rivosinc.com
Headers
Series RISC-V: mm: Make SV48 the default address space |

Message

Charlie Jenkins July 5, 2023, 6:59 p.m. UTC
  Make sv48 the default address space for mmap as some applications
currently depend on this assumption. Also enable users to select
desired address space using a non-zero hint address to mmap. Previous
kernel changes caused Java and other applications to be broken on sv57
which this patch fixes.

Documentation is also added to the RISC-V virtual memory section to explain
these changes.

Charlie Jenkins (2):
  RISC-V: mm: Restrict address space for sv39,sv48,sv57
  RISC-V: mm: Update documentation and include test

 Documentation/riscv/vm-layout.rst             | 22 +++++++++
 arch/riscv/include/asm/elf.h                  |  2 +-
 arch/riscv/include/asm/pgtable.h              | 21 ++++++--
 arch/riscv/include/asm/processor.h            | 34 ++++++++++---
 tools/testing/selftests/riscv/Makefile        |  2 +-
 tools/testing/selftests/riscv/mm/.gitignore   |  1 +
 tools/testing/selftests/riscv/mm/Makefile     | 21 ++++++++
 .../selftests/riscv/mm/testcases/mmap.c       | 49 +++++++++++++++++++
 8 files changed, 139 insertions(+), 13 deletions(-)
 create mode 100644 tools/testing/selftests/riscv/mm/.gitignore
 create mode 100644 tools/testing/selftests/riscv/mm/Makefile
 create mode 100644 tools/testing/selftests/riscv/mm/testcases/mmap.c
  

Comments

Conor Dooley July 5, 2023, 8 p.m. UTC | #1
Hey Charlie,

On Wed, Jul 05, 2023 at 11:59:40AM -0700, Charlie Jenkins wrote:
> Make sv48 the default address space for mmap as some applications
> currently depend on this assumption. Also enable users to select
> desired address space using a non-zero hint address to mmap. Previous
> kernel changes caused Java and other applications to be broken on sv57
> which this patch fixes.
> 
> Documentation is also added to the RISC-V virtual memory section to explain
> these changes.

I can't find a changelog in any of these patches, nor an explanation for
why this is v3 (or a RESEND). All I can find on the list is a v1. Could
you explain and provide a changelog please?

Cheers,
Conor.
  
Charlie Jenkins July 5, 2023, 8:50 p.m. UTC | #2
On Wed, Jul 05, 2023 at 09:00:18PM +0100, Conor Dooley wrote:
> Hey Charlie,
> 
> On Wed, Jul 05, 2023 at 11:59:40AM -0700, Charlie Jenkins wrote:
> > Make sv48 the default address space for mmap as some applications
> > currently depend on this assumption. Also enable users to select
> > desired address space using a non-zero hint address to mmap. Previous
> > kernel changes caused Java and other applications to be broken on sv57
> > which this patch fixes.
> > 
> > Documentation is also added to the RISC-V virtual memory section to explain
> > these changes.
> 
> I can't find a changelog in any of these patches, nor an explanation for
> why this is v3 (or a RESEND). All I can find on the list is a v1. Could
> you explain and provide a changelog please?
> 
> Cheers,
> Conor.

I made a series of mistakes due to an incorrect email configuration. I
knew something was wrong but I didn't know what after I sent out v2. v2
bumped the default address space from sv39 to sv48. The purpose of v3
was to remove an erroneous .gitignore I had included in v2 and also
modify a testcase that was supposed to check the default was sv48 but it
was still checking for sv39. After sending out v3 I realized what was
wrong with my configuration, so I decided to mark it as a resend because
I believe some people did recieve the previous emails.

This is the only patch that made it through to everybody, and includes a
default address space of sv48 instead of sv39. I have tested that
OpenJDK 19 works on sv39, sv48, and sv57 in QEMU on this patch.
OpenJDK 19 failed to work on kernel v6.4 on sv57 but worked on sv39 and
sv48. Applications like Java and Go failing on sv57 were the motivation
of this patch. Setting a default of sv48 will allow applications that
don't explicitly support sv57 to work on sv57 hardware but still allow
applications to take advantage of sv57 by specifying a hint address to
mmap that is greater than or equal to 1<<56.

- Charlie
  
Conor Dooley July 5, 2023, 9:59 p.m. UTC | #3
On Wed, Jul 05, 2023 at 01:50:50PM -0700, Charlie Jenkins wrote:
> On Wed, Jul 05, 2023 at 09:00:18PM +0100, Conor Dooley wrote:
> > Hey Charlie,
> > 
> > On Wed, Jul 05, 2023 at 11:59:40AM -0700, Charlie Jenkins wrote:
> > > Make sv48 the default address space for mmap as some applications
> > > currently depend on this assumption. Also enable users to select
> > > desired address space using a non-zero hint address to mmap. Previous
> > > kernel changes caused Java and other applications to be broken on sv57
> > > which this patch fixes.
> > > 
> > > Documentation is also added to the RISC-V virtual memory section to explain
> > > these changes.
> > 
> > I can't find a changelog in any of these patches, nor an explanation for
> > why this is v3 (or a RESEND). All I can find on the list is a v1. Could
> > you explain and provide a changelog please?
> > 
> > Cheers,
> > Conor.
> 
> I made a series of mistakes due to an incorrect email configuration. I
> knew something was wrong but I didn't know what after I sent out v2. v2
> bumped the default address space from sv39 to sv48. The purpose of v3
> was to remove an erroneous .gitignore I had included in v2 and also
> modify a testcase that was supposed to check the default was sv48 but it
> was still checking for sv39. After sending out v3 I realized what was
> wrong with my configuration, so I decided to mark it as a resend because
> I believe some people did recieve the previous emails.

Ah yes, I remember massive CC list you used first time around that seemed
to trip up infradead's list service. I guess I've finally gotten to the
incoming mail volume that I am starting to not remember things, even
when they were unusual...

Next time you're sending patches, please add the changelog to your
cover, makes life easier for reviewers etc.

Thanks Charlie,
Conor.