* [PATCH] RISC-V: fix virtual address overlapped in FIXADDR_START and VMEMMAP_START
@ 2019-10-16 7:34 greentime.hu
2019-10-16 7:49 ` Anup Patel
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: greentime.hu @ 2019-10-16 7:34 UTC (permalink / raw)
To: greentime.hu, green.hu, paul.walmsley, palmer, linux-riscv, linux-kernel
From: Greentime Hu <greentime.hu@sifive.com>
This patch fixes the virtual address layout in pgtable.h.
The virtual address of FIXADDR_START and VMEMMAP_START should not be overlapped.
These addresses will be existed at the same time in Linux kernel that they can't
be overlapped.
Fixes: d95f1a542c3d ("RISC-V: Implement sparsemem")
Signed-off-by: Greentime Hu <greentime.hu@sifive.com>
---
arch/riscv/include/asm/pgtable.h | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h
index 4f4162d90586..b927fb4ecf1c 100644
--- a/arch/riscv/include/asm/pgtable.h
+++ b/arch/riscv/include/asm/pgtable.h
@@ -87,14 +87,6 @@ extern pgd_t swapper_pg_dir[];
#define VMALLOC_END (PAGE_OFFSET - 1)
#define VMALLOC_START (PAGE_OFFSET - VMALLOC_SIZE)
-#define FIXADDR_TOP VMALLOC_START
-#ifdef CONFIG_64BIT
-#define FIXADDR_SIZE PMD_SIZE
-#else
-#define FIXADDR_SIZE PGDIR_SIZE
-#endif
-#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
-
/*
* Roughly size the vmemmap space to be large enough to fit enough
* struct pages to map half the virtual address space. Then
@@ -108,6 +100,14 @@ extern pgd_t swapper_pg_dir[];
#define vmemmap ((struct page *)VMEMMAP_START)
+#define FIXADDR_TOP (VMEMMAP_START)
+#ifdef CONFIG_64BIT
+#define FIXADDR_SIZE PMD_SIZE
+#else
+#define FIXADDR_SIZE PGDIR_SIZE
+#endif
+#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
+
/*
* ZERO_PAGE is a global shared page that is always zero,
* used for zero-mapped memory areas, etc.
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] RISC-V: fix virtual address overlapped in FIXADDR_START and VMEMMAP_START
2019-10-16 7:34 [PATCH] RISC-V: fix virtual address overlapped in FIXADDR_START and VMEMMAP_START greentime.hu
@ 2019-10-16 7:49 ` Anup Patel
2019-10-16 7:59 ` Andreas Schwab
2019-10-16 15:24 ` Paul Walmsley
2 siblings, 0 replies; 4+ messages in thread
From: Anup Patel @ 2019-10-16 7:49 UTC (permalink / raw)
To: greentime.hu
Cc: Greentime Hu, Paul Walmsley, Palmer Dabbelt, linux-riscv,
linux-kernel@vger.kernel.org List
On Wed, Oct 16, 2019 at 1:04 PM <greentime.hu@sifive.com> wrote:
>
> From: Greentime Hu <greentime.hu@sifive.com>
>
> This patch fixes the virtual address layout in pgtable.h.
> The virtual address of FIXADDR_START and VMEMMAP_START should not be overlapped.
> These addresses will be existed at the same time in Linux kernel that they can't
> be overlapped.
>
> Fixes: d95f1a542c3d ("RISC-V: Implement sparsemem")
> Signed-off-by: Greentime Hu <greentime.hu@sifive.com>
> ---
> arch/riscv/include/asm/pgtable.h | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h
> index 4f4162d90586..b927fb4ecf1c 100644
> --- a/arch/riscv/include/asm/pgtable.h
> +++ b/arch/riscv/include/asm/pgtable.h
> @@ -87,14 +87,6 @@ extern pgd_t swapper_pg_dir[];
> #define VMALLOC_END (PAGE_OFFSET - 1)
> #define VMALLOC_START (PAGE_OFFSET - VMALLOC_SIZE)
>
> -#define FIXADDR_TOP VMALLOC_START
> -#ifdef CONFIG_64BIT
> -#define FIXADDR_SIZE PMD_SIZE
> -#else
> -#define FIXADDR_SIZE PGDIR_SIZE
> -#endif
> -#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
> -
> /*
> * Roughly size the vmemmap space to be large enough to fit enough
> * struct pages to map half the virtual address space. Then
> @@ -108,6 +100,14 @@ extern pgd_t swapper_pg_dir[];
>
> #define vmemmap ((struct page *)VMEMMAP_START)
>
> +#define FIXADDR_TOP (VMEMMAP_START)
> +#ifdef CONFIG_64BIT
> +#define FIXADDR_SIZE PMD_SIZE
> +#else
> +#define FIXADDR_SIZE PGDIR_SIZE
> +#endif
> +#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
> +
> /*
> * ZERO_PAGE is a global shared page that is always zero,
> * used for zero-mapped memory areas, etc.
> --
> 2.17.1
>
Looks good to me.
Reviewed-by: Anup Patel <anup@brainfault.org>
Regards,
Anup
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] RISC-V: fix virtual address overlapped in FIXADDR_START and VMEMMAP_START
2019-10-16 7:34 [PATCH] RISC-V: fix virtual address overlapped in FIXADDR_START and VMEMMAP_START greentime.hu
2019-10-16 7:49 ` Anup Patel
@ 2019-10-16 7:59 ` Andreas Schwab
2019-10-16 15:24 ` Paul Walmsley
2 siblings, 0 replies; 4+ messages in thread
From: Andreas Schwab @ 2019-10-16 7:59 UTC (permalink / raw)
To: greentime.hu; +Cc: green.hu, paul.walmsley, palmer, linux-riscv, linux-kernel
On Okt 16 2019, greentime.hu@sifive.com wrote:
> From: Greentime Hu <greentime.hu@sifive.com>
>
> This patch fixes the virtual address layout in pgtable.h.
> The virtual address of FIXADDR_START and VMEMMAP_START should not be overlapped.
> These addresses will be existed at the same time in Linux kernel that they can't
> be overlapped.
s/be existed/exist/
s/be overlapped/overlap/
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] RISC-V: fix virtual address overlapped in FIXADDR_START and VMEMMAP_START
2019-10-16 7:34 [PATCH] RISC-V: fix virtual address overlapped in FIXADDR_START and VMEMMAP_START greentime.hu
2019-10-16 7:49 ` Anup Patel
2019-10-16 7:59 ` Andreas Schwab
@ 2019-10-16 15:24 ` Paul Walmsley
2 siblings, 0 replies; 4+ messages in thread
From: Paul Walmsley @ 2019-10-16 15:24 UTC (permalink / raw)
To: greentime.hu; +Cc: green.hu, palmer, linux-riscv, linux-kernel
On Wed, 16 Oct 2019, greentime.hu@sifive.com wrote:
> From: Greentime Hu <greentime.hu@sifive.com>
>
> This patch fixes the virtual address layout in pgtable.h.
> The virtual address of FIXADDR_START and VMEMMAP_START should not be overlapped.
> These addresses will be existed at the same time in Linux kernel that they can't
> be overlapped.
>
> Fixes: d95f1a542c3d ("RISC-V: Implement sparsemem")
> Signed-off-by: Greentime Hu <greentime.hu@sifive.com>
Thanks, here's what's been queued for v5.4-rc.
- Paul
From: Greentime Hu <greentime.hu@sifive.com>
Date: Tue, 8 Oct 2019 14:45:24 +0800
Subject: [PATCH] RISC-V: fix virtual address overlapped in FIXADDR_START and
VMEMMAP_START
This patch fixes the virtual address layout in pgtable.h. The virtual
address of FIXADDR_START and VMEMMAP_START should not be overlapped.
Fixes: d95f1a542c3d ("RISC-V: Implement sparsemem")
Signed-off-by: Greentime Hu <greentime.hu@sifive.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
[paul.walmsley@sifive.com: fixed patch description]
Signed-off-by: Paul Walmsley <paul.walmsley@sifive.com>
---
arch/riscv/include/asm/pgtable.h | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h
index 7255f2d8395b..42292d99cc74 100644
--- a/arch/riscv/include/asm/pgtable.h
+++ b/arch/riscv/include/asm/pgtable.h
@@ -87,14 +87,6 @@ extern pgd_t swapper_pg_dir[];
#define VMALLOC_END (PAGE_OFFSET - 1)
#define VMALLOC_START (PAGE_OFFSET - VMALLOC_SIZE)
-#define FIXADDR_TOP VMALLOC_START
-#ifdef CONFIG_64BIT
-#define FIXADDR_SIZE PMD_SIZE
-#else
-#define FIXADDR_SIZE PGDIR_SIZE
-#endif
-#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
-
/*
* Roughly size the vmemmap space to be large enough to fit enough
* struct pages to map half the virtual address space. Then
@@ -108,6 +100,14 @@ extern pgd_t swapper_pg_dir[];
#define vmemmap ((struct page *)VMEMMAP_START)
+#define FIXADDR_TOP (VMEMMAP_START)
+#ifdef CONFIG_64BIT
+#define FIXADDR_SIZE PMD_SIZE
+#else
+#define FIXADDR_SIZE PGDIR_SIZE
+#endif
+#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
+
/*
* ZERO_PAGE is a global shared page that is always zero,
* used for zero-mapped memory areas, etc.
--
2.23.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-10-16 15:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-16 7:34 [PATCH] RISC-V: fix virtual address overlapped in FIXADDR_START and VMEMMAP_START greentime.hu
2019-10-16 7:49 ` Anup Patel
2019-10-16 7:59 ` Andreas Schwab
2019-10-16 15:24 ` Paul Walmsley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).