Linux-RISC-V Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Documentation: riscv: Document the sv57 VM layout
@ 2022-10-31 18:02 Björn Töpel
  2022-11-01  9:03 ` Bagas Sanjaya
  2022-11-18 16:07 ` Alexandre Ghiti
  0 siblings, 2 replies; 5+ messages in thread
From: Björn Töpel @ 2022-10-31 18:02 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, linux-riscv,
	Alexandre Ghiti
  Cc: Björn Töpel, Jonathan Corbet, linux-doc

From: Björn Töpel <bjorn@rivosinc.com>

RISC-V has been supporting the "sv57" address translation mode for a
while, but is has not been added to the VM layout documentation. Let
us fix that.

Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
---
 Documentation/riscv/vm-layout.rst | 36 +++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/Documentation/riscv/vm-layout.rst b/Documentation/riscv/vm-layout.rst
index 5b36e45fef60..35f76798b6e4 100644
--- a/Documentation/riscv/vm-layout.rst
+++ b/Documentation/riscv/vm-layout.rst
@@ -97,3 +97,39 @@ RISC-V Linux Kernel SV48
    ffffffff00000000 |   -4    GB | ffffffff7fffffff |    2 GB | modules, BPF
    ffffffff80000000 |   -2    GB | ffffffffffffffff |    2 GB | kernel
   __________________|____________|__________________|_________|____________________________________________________________
+
+
+RISC-V Linux Kernel SV57
+------------------------
+
+::
+
+ ========================================================================================================================
+      Start addr    |   Offset   |     End addr     |  Size   | VM area description
+ ========================================================================================================================
+                    |            |                  |         |
+   0000000000000000 |    0       | 00ffffffffffffff |   64 PB | user-space virtual memory, different per mm
+  __________________|____________|__________________|_________|___________________________________________________________
+                    |            |                  |         |
+   0100000000000000 | +64     PB | feffffffffffffff | ~16K PB | ... huge, almost 64 bits wide hole of non-canonical
+                    |            |                  |         | virtual memory addresses up to the -64 PB
+                    |            |                  |         | starting offset of kernel mappings.
+  __________________|____________|__________________|_________|___________________________________________________________
+                                                              |
+                                                              | Kernel-space virtual memory, shared between all processes:
+  ____________________________________________________________|___________________________________________________________
+                    |            |                  |         |
+   ff1bfffffee00000 |  -57    PB | ff1bfffffeffffff |    2 MB | fixmap
+   ff1bffffff000000 |  -57    PB | ff1bffffffffffff |   16 MB | PCI io
+   ff1c000000000000 |  -57    PB | ff1fffffffffffff |    1 PB | vmemmap
+   ff20000000000000 |  -56    PB | ff5fffffffffffff |   16 PB | vmalloc/ioremap space
+   ff60000000000000 |  -40    PB | ffdffffeffffffff |   32 PB | direct mapping of all physical memory
+   ffdfffff00000000 |  - 8    PB | fffffffeffffffff |    8 PB | kasan
+  __________________|____________|__________________|_________|____________________________________________________________
+                                                              |
+                                                              | Identical layout to the 39-bit one from here on:
+  ____________________________________________________________|____________________________________________________________
+                    |            |                  |         |
+   ffffffff00000000 |   -4    GB | ffffffff7fffffff |    2 GB | modules, BPF
+   ffffffff80000000 |   -2    GB | ffffffffffffffff |    2 GB | kernel
+  __________________|____________|__________________|_________|____________________________________________________________
-- 
2.37.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Documentation: riscv: Document the sv57 VM layout
  2022-10-31 18:02 [PATCH] Documentation: riscv: Document the sv57 VM layout Björn Töpel
@ 2022-11-01  9:03 ` Bagas Sanjaya
  2022-11-01 10:25   ` Björn Töpel
  2022-11-18 16:07 ` Alexandre Ghiti
  1 sibling, 1 reply; 5+ messages in thread
From: Bagas Sanjaya @ 2022-11-01  9:03 UTC (permalink / raw)
  To: Björn Töpel
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, linux-riscv,
	Alexandre Ghiti, Björn Töpel, Jonathan Corbet,
	linux-doc


[-- Attachment #1.1: Type: text/plain, Size: 10082 bytes --]

On Mon, Oct 31, 2022 at 07:02:30PM +0100, Björn Töpel wrote:
> +
> +
> +RISC-V Linux Kernel SV57
> +------------------------
> +
> +::
> +
> + ========================================================================================================================
> +      Start addr    |   Offset   |     End addr     |  Size   | VM area description
> + ========================================================================================================================
> +                    |            |                  |         |
> +   0000000000000000 |    0       | 00ffffffffffffff |   64 PB | user-space virtual memory, different per mm
> +  __________________|____________|__________________|_________|___________________________________________________________
> +                    |            |                  |         |
> +   0100000000000000 | +64     PB | feffffffffffffff | ~16K PB | ... huge, almost 64 bits wide hole of non-canonical
> +                    |            |                  |         | virtual memory addresses up to the -64 PB
> +                    |            |                  |         | starting offset of kernel mappings.
> +  __________________|____________|__________________|_________|___________________________________________________________
> +                                                              |
> +                                                              | Kernel-space virtual memory, shared between all processes:
> +  ____________________________________________________________|___________________________________________________________
> +                    |            |                  |         |
> +   ff1bfffffee00000 |  -57    PB | ff1bfffffeffffff |    2 MB | fixmap
> +   ff1bffffff000000 |  -57    PB | ff1bffffffffffff |   16 MB | PCI io
> +   ff1c000000000000 |  -57    PB | ff1fffffffffffff |    1 PB | vmemmap
> +   ff20000000000000 |  -56    PB | ff5fffffffffffff |   16 PB | vmalloc/ioremap space
> +   ff60000000000000 |  -40    PB | ffdffffeffffffff |   32 PB | direct mapping of all physical memory
> +   ffdfffff00000000 |  - 8    PB | fffffffeffffffff |    8 PB | kasan
> +  __________________|____________|__________________|_________|____________________________________________________________
> +                                                              |
> +                                                              | Identical layout to the 39-bit one from here on:
> +  ____________________________________________________________|____________________________________________________________
> +                    |            |                  |         |
> +   ffffffff00000000 |   -4    GB | ffffffff7fffffff |    2 GB | modules, BPF
> +   ffffffff80000000 |   -2    GB | ffffffffffffffff |    2 GB | kernel
> +  __________________|____________|__________________|_________|____________________________________________________________

The memory layout figure above should have been in table format (it is
written as such, isn't it?):

---- >8 ----

diff --git a/Documentation/riscv/vm-layout.rst b/Documentation/riscv/vm-layout.rst
index 35f76798b6e41b..f87b63a0cc9cfa 100644
--- a/Documentation/riscv/vm-layout.rst
+++ b/Documentation/riscv/vm-layout.rst
@@ -102,34 +102,32 @@ RISC-V Linux Kernel SV48
 RISC-V Linux Kernel SV57
 ------------------------
 
-::
-
- ========================================================================================================================
-      Start addr    |   Offset   |     End addr     |  Size   | VM area description
- ========================================================================================================================
-                    |            |                  |         |
-   0000000000000000 |    0       | 00ffffffffffffff |   64 PB | user-space virtual memory, different per mm
-  __________________|____________|__________________|_________|___________________________________________________________
-                    |            |                  |         |
-   0100000000000000 | +64     PB | feffffffffffffff | ~16K PB | ... huge, almost 64 bits wide hole of non-canonical
-                    |            |                  |         | virtual memory addresses up to the -64 PB
-                    |            |                  |         | starting offset of kernel mappings.
-  __________________|____________|__________________|_________|___________________________________________________________
-                                                              |
-                                                              | Kernel-space virtual memory, shared between all processes:
-  ____________________________________________________________|___________________________________________________________
-                    |            |                  |         |
-   ff1bfffffee00000 |  -57    PB | ff1bfffffeffffff |    2 MB | fixmap
-   ff1bffffff000000 |  -57    PB | ff1bffffffffffff |   16 MB | PCI io
-   ff1c000000000000 |  -57    PB | ff1fffffffffffff |    1 PB | vmemmap
-   ff20000000000000 |  -56    PB | ff5fffffffffffff |   16 PB | vmalloc/ioremap space
-   ff60000000000000 |  -40    PB | ffdffffeffffffff |   32 PB | direct mapping of all physical memory
-   ffdfffff00000000 |  - 8    PB | fffffffeffffffff |    8 PB | kasan
-  __________________|____________|__________________|_________|____________________________________________________________
-                                                              |
-                                                              | Identical layout to the 39-bit one from here on:
-  ____________________________________________________________|____________________________________________________________
-                    |            |                  |         |
-   ffffffff00000000 |   -4    GB | ffffffff7fffffff |    2 GB | modules, BPF
-   ffffffff80000000 |   -2    GB | ffffffffffffffff |    2 GB | kernel
-  __________________|____________|__________________|_________|____________________________________________________________
+  +------------------+--------+------------------+---------+--------------------------------------------------------------+
+  |    Start addr    | Offset |     End addr     |  Size   | VM area description                                          |
+  +==================+========+==================+=========+==============================================================+
+  | 0000000000000000 |    0   | 00ffffffffffffff |   64 PB | user-space virtual memory, different per mm                  |
+  +------------------+--------+------------------+---------+--------------------------------------------------------------+
+  | 0100000000000000 | +64 PB | feffffffffffffff | ~16K PB | ... huge, almost 64 bits wide hole of non-canonical          |
+  |                  |        |                  |         | virtual memory addresses up to the -64 PB                    |
+  |                  |        |                  |         | starting offset of kernel mappings.                          |
+  +------------------+--------+------------------+---------+--------------------------------------------------------------+
+  |                              Kernel-space virtual memory, shared between all processes:                               |
+  +------------------+--------+------------------+---------+--------------------------------------------------------------+
+  | ff1bfffffee00000 | -57 PB | ff1bfffffeffffff |    2 MB | fixmap                                                       |
+  +------------------+--------+------------------+---------+--------------------------------------------------------------+
+  | ff1bffffff000000 | -57 PB | ff1bffffffffffff |   16 MB | PCI io                                                       |
+  +------------------+--------+------------------+---------+--------------------------------------------------------------+
+  | ff1c000000000000 | -57 PB | ff1fffffffffffff |    1 PB | vmemmap                                                      |
+  +------------------+--------+------------------+---------+--------------------------------------------------------------+
+  | ff20000000000000 | -56 PB | ff5fffffffffffff |   16 PB | vmalloc/ioremap space                                        |
+  +------------------+--------+------------------+---------+--------------------------------------------------------------+
+  | ff60000000000000 | -40 PB | ffdffffeffffffff |   32 PB | direct mapping of all physical memory                        |
+  +------------------+--------+------------------+---------+--------------------------------------------------------------+
+  | ffdfffff00000000 | -8 PB  | fffffffeffffffff |    8 PB | kasan                                                        |
+  +------------------+--------+------------------+---------+--------------------------------------------------------------+
+  |                                   Identical layout to the 39-bit one from here on:                                    |
+  +------------------+--------+------------------+---------+--------------------------------------------------------------+
+  | ffffffff00000000 | -4 GB  | ffffffff7fffffff |    2 GB | modules, BPF                                                 |
+  +------------------+--------+------------------+---------+--------------------------------------------------------------+
+  | ffffffff80000000 | -2 GB  | ffffffffffffffff |    2 GB | kernel                                                       |
+  +------------------+--------+------------------+---------+--------------------------------------------------------------+

However, for consistency, other similar figures should also be converted
to tables (as separate patch).

Thanks.

-- 
An old man doll... just what I always wanted! - Clara

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Documentation: riscv: Document the sv57 VM layout
  2022-11-01  9:03 ` Bagas Sanjaya
@ 2022-11-01 10:25   ` Björn Töpel
  0 siblings, 0 replies; 5+ messages in thread
From: Björn Töpel @ 2022-11-01 10:25 UTC (permalink / raw)
  To: Bagas Sanjaya
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, linux-riscv,
	Alexandre Ghiti, Björn Töpel, Jonathan Corbet,
	linux-doc

Bagas Sanjaya <bagasdotme@gmail.com> writes:

> The memory layout figure above should have been in table format (it is
> written as such, isn't it?):

I'm not sure, given the "::" (verbatim) for the other tables. I followed
the verbatim layout of the previous svXX layout descriptions.

> However, for consistency, other similar figures should also be converted
> to tables (as separate patch).

Yes, that can be done as follow-up patches (and also add SV32).


Björn


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Documentation: riscv: Document the sv57 VM layout
  2022-10-31 18:02 [PATCH] Documentation: riscv: Document the sv57 VM layout Björn Töpel
  2022-11-01  9:03 ` Bagas Sanjaya
@ 2022-11-18 16:07 ` Alexandre Ghiti
  2022-11-18 16:33   ` Björn Töpel
  1 sibling, 1 reply; 5+ messages in thread
From: Alexandre Ghiti @ 2022-11-18 16:07 UTC (permalink / raw)
  To: Björn Töpel, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-riscv, Alexandre Ghiti
  Cc: Björn Töpel, Jonathan Corbet, linux-doc

Hi Björn,

On 10/31/22 19:02, Björn Töpel wrote:
> From: Björn Töpel <bjorn@rivosinc.com>
>
> RISC-V has been supporting the "sv57" address translation mode for a
> while, but is has not been added to the VM layout documentation. Let
> us fix that.
>
> Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
> ---
>   Documentation/riscv/vm-layout.rst | 36 +++++++++++++++++++++++++++++++
>   1 file changed, 36 insertions(+)
>
> diff --git a/Documentation/riscv/vm-layout.rst b/Documentation/riscv/vm-layout.rst
> index 5b36e45fef60..35f76798b6e4 100644
> --- a/Documentation/riscv/vm-layout.rst
> +++ b/Documentation/riscv/vm-layout.rst
> @@ -97,3 +97,39 @@ RISC-V Linux Kernel SV48
>      ffffffff00000000 |   -4    GB | ffffffff7fffffff |    2 GB | modules, BPF
>      ffffffff80000000 |   -2    GB | ffffffffffffffff |    2 GB | kernel
>     __________________|____________|__________________|_________|____________________________________________________________
> +
> +
> +RISC-V Linux Kernel SV57
> +------------------------
> +
> +::
> +
> + ========================================================================================================================
> +      Start addr    |   Offset   |     End addr     |  Size   | VM area description
> + ========================================================================================================================
> +                    |            |                  |         |
> +   0000000000000000 |    0       | 00ffffffffffffff |   64 PB | user-space virtual memory, different per mm
> +  __________________|____________|__________________|_________|___________________________________________________________
> +                    |            |                  |         |
> +   0100000000000000 | +64     PB | feffffffffffffff | ~16K PB | ... huge, almost 64 bits wide hole of non-canonical


Very very nit but "+64" is not correctly aligned :)


> +                    |            |                  |         | virtual memory addresses up to the -64 PB
> +                    |            |                  |         | starting offset of kernel mappings.
> +  __________________|____________|__________________|_________|___________________________________________________________
> +                                                              |
> +                                                              | Kernel-space virtual memory, shared between all processes:
> +  ____________________________________________________________|___________________________________________________________
> +                    |            |                  |         |
> +   ff1bfffffee00000 |  -57    PB | ff1bfffffeffffff |    2 MB | fixmap
> +   ff1bffffff000000 |  -57    PB | ff1bffffffffffff |   16 MB | PCI io
> +   ff1c000000000000 |  -57    PB | ff1fffffffffffff |    1 PB | vmemmap
> +   ff20000000000000 |  -56    PB | ff5fffffffffffff |   16 PB | vmalloc/ioremap space
> +   ff60000000000000 |  -40    PB | ffdffffeffffffff |   32 PB | direct mapping of all physical memory
> +   ffdfffff00000000 |  - 8    PB | fffffffeffffffff |    8 PB | kasan


To me, the kasan start address is wrong, an sv57 kernel produces the 
following output for me:

[    0.000000]       fixmap : 0xff1bfffffee00000 - 0xff1bffffff000000   
(2048 kB)
[    0.000000]       pci io : 0xff1bffffff000000 - 0xff1c000000000000   
(  16 MB)
[    0.000000]      vmemmap : 0xff1c000000000000 - 0xff20000000000000   
(1024 TB)
[    0.000000]      vmalloc : 0xff20000000000000 - 0xff60000000000000   
(16384 TB)
[    0.000000]      modules : 0xffffffff01e2a000 - 0xffffffff80000000   
(2017 MB)
[    0.000000]       lowmem : 0xff60000000000000 - 0xff60000100000000   
(4096 MB)
[    0.000000]        kasan : 0xffdf000000000000 - 0xffffffff00000000   
(8447 TB)
[    0.000000]       kernel : 0xffffffff80000000 - 0xffffffffffffffff   
(2047 MB)

Because by definition, KASAN_SHADOW_START is aligned on PGDIR_SIZE 
(because it is easier to map this way).

And again very very nit: there is a space between the '-' and '8' :)


> +  __________________|____________|__________________|_________|____________________________________________________________
> +                                                              |
> +                                                              | Identical layout to the 39-bit one from here on:
> +  ____________________________________________________________|____________________________________________________________
> +                    |            |                  |         |
> +   ffffffff00000000 |   -4    GB | ffffffff7fffffff |    2 GB | modules, BPF
> +   ffffffff80000000 |   -2    GB | ffffffffffffffff |    2 GB | kernel
> +  __________________|____________|__________________|_________|____________________________________________________________


Thanks,

Alex


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Documentation: riscv: Document the sv57 VM layout
  2022-11-18 16:07 ` Alexandre Ghiti
@ 2022-11-18 16:33   ` Björn Töpel
  0 siblings, 0 replies; 5+ messages in thread
From: Björn Töpel @ 2022-11-18 16:33 UTC (permalink / raw)
  To: Alexandre Ghiti, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-riscv, Alexandre Ghiti
  Cc: Björn Töpel, Jonathan Corbet, linux-doc

Alexandre Ghiti <alex@ghiti.fr> writes:

> Very very nit but "+64" is not correctly aligned :)

Thanks! I'll fix that!

>> +   ffdfffff00000000 |  - 8    PB | fffffffeffffffff |    8 PB | kasan
> To me, the kasan start address is wrong, an sv57 kernel produces the 
> following output for me:
>
> [    0.000000]        kasan : 0xffdf000000000000 - 0xffffffff00000000   

Indeed! Good catch! Will fix.

> And again very very nit: there is a space between the '-' and '8' :)

I'll fix that in the v2.

Thanks for having a look!


Cheers,
Björn

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-11-18 16:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-31 18:02 [PATCH] Documentation: riscv: Document the sv57 VM layout Björn Töpel
2022-11-01  9:03 ` Bagas Sanjaya
2022-11-01 10:25   ` Björn Töpel
2022-11-18 16:07 ` Alexandre Ghiti
2022-11-18 16:33   ` Björn Töpel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox