[PATCH v2] riscv: mm: Enable PMD split page table lock for RV64

Subsystems: risc-v architecture, the rest

STALE1734d REVIEWED: 1 (1M)

1 review trailer (1 from subsystem maintainers).

3 messages, 2 authors, 2022-01-06 · open the first message on its own page

[PATCH v2] riscv: mm: Enable PMD split page table lock for RV64

From: Kefeng Wang <hidden>
Date: 2021-09-27 03:01:31

After commit 1355c31eeb7e ("asm-generic: pgalloc: provide generic
pmd_alloc_one() and pmd_free_one()"), the main part to support
PMD split page table lock is in asm-generic/pgalloc.h.

The only change is add pgtable_pmd_page_ctor() into alloc_pmd_late(),
then we could enable ARCH_ENABLE_SPLIT_PMD_PTLOCK for RV64.

Reviewed-by: Alexandre Ghiti <alex@ghiti.fr>
Signed-off-by: Kefeng Wang <redacted>
---
v2:
- rebase to v5.15-rc3, update changelog, and add RB

 arch/riscv/Kconfig   | 1 +
 arch/riscv/mm/init.c | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 301a54233c7e..5c4463f30eb0 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -14,6 +14,7 @@ config RISCV
 	def_bool y
 	select ARCH_CLOCKSOURCE_INIT
 	select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION
+	select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2
 	select ARCH_HAS_BINFMT_FLAT
 	select ARCH_HAS_DEBUG_VM_PGTABLE
 	select ARCH_HAS_DEBUG_VIRTUAL if MMU
diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
index c0cddf0fc22d..1f21375ba86f 100644
--- a/arch/riscv/mm/init.c
+++ b/arch/riscv/mm/init.c
@@ -367,7 +367,8 @@ static phys_addr_t __init alloc_pmd_late(uintptr_t va)
 	unsigned long vaddr;
 
 	vaddr = __get_free_page(GFP_KERNEL);
-	BUG_ON(!vaddr);
+	BUG_ON(!vaddr || !pgtable_pmd_page_ctor(virt_to_page(vaddr)));
+
 	return __pa(vaddr);
 }
 
-- 
2.26.2


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

Re: [PATCH v2] riscv: mm: Enable PMD split page table lock for RV64

From: Kefeng Wang <hidden>
Date: 2021-11-19 08:14:52

Hi Palmer,  ping, it looks this patch is missed...

On 2021/9/27 11:03, Kefeng Wang wrote:
quoted hunk
After commit 1355c31eeb7e ("asm-generic: pgalloc: provide generic
pmd_alloc_one() and pmd_free_one()"), the main part to support
PMD split page table lock is in asm-generic/pgalloc.h.

The only change is add pgtable_pmd_page_ctor() into alloc_pmd_late(),
then we could enable ARCH_ENABLE_SPLIT_PMD_PTLOCK for RV64.

Reviewed-by: Alexandre Ghiti <alex@ghiti.fr>
Signed-off-by: Kefeng Wang <redacted>
---
v2:
- rebase to v5.15-rc3, update changelog, and add RB

  arch/riscv/Kconfig   | 1 +
  arch/riscv/mm/init.c | 3 ++-
  2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 301a54233c7e..5c4463f30eb0 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -14,6 +14,7 @@ config RISCV
  	def_bool y
  	select ARCH_CLOCKSOURCE_INIT
  	select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION
+	select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2
  	select ARCH_HAS_BINFMT_FLAT
  	select ARCH_HAS_DEBUG_VM_PGTABLE
  	select ARCH_HAS_DEBUG_VIRTUAL if MMU
diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
index c0cddf0fc22d..1f21375ba86f 100644
--- a/arch/riscv/mm/init.c
+++ b/arch/riscv/mm/init.c
@@ -367,7 +367,8 @@ static phys_addr_t __init alloc_pmd_late(uintptr_t va)
  	unsigned long vaddr;
  
  	vaddr = __get_free_page(GFP_KERNEL);
-	BUG_ON(!vaddr);
+	BUG_ON(!vaddr || !pgtable_pmd_page_ctor(virt_to_page(vaddr)));
+
  	return __pa(vaddr);
  }
  
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

Re: [PATCH v2] riscv: mm: Enable PMD split page table lock for RV64

From: Palmer Dabbelt <palmer@dabbelt.com>
Date: 2022-01-06 04:00:39

On Fri, 19 Nov 2021 00:14:19 PST (-0800), wangkefeng.wang@huawei.com wrote:
Hi Palmer,  ping, it looks this patch is missed...
Sorry about that.  This is on for-next, thanks!
On 2021/9/27 11:03, Kefeng Wang wrote:
quoted
After commit 1355c31eeb7e ("asm-generic: pgalloc: provide generic
pmd_alloc_one() and pmd_free_one()"), the main part to support
PMD split page table lock is in asm-generic/pgalloc.h.

The only change is add pgtable_pmd_page_ctor() into alloc_pmd_late(),
then we could enable ARCH_ENABLE_SPLIT_PMD_PTLOCK for RV64.

Reviewed-by: Alexandre Ghiti <alex@ghiti.fr>
Signed-off-by: Kefeng Wang <redacted>
---
v2:
- rebase to v5.15-rc3, update changelog, and add RB

  arch/riscv/Kconfig   | 1 +
  arch/riscv/mm/init.c | 3 ++-
  2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 301a54233c7e..5c4463f30eb0 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -14,6 +14,7 @@ config RISCV
  	def_bool y
  	select ARCH_CLOCKSOURCE_INIT
  	select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION
+	select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2
  	select ARCH_HAS_BINFMT_FLAT
  	select ARCH_HAS_DEBUG_VM_PGTABLE
  	select ARCH_HAS_DEBUG_VIRTUAL if MMU
diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
index c0cddf0fc22d..1f21375ba86f 100644
--- a/arch/riscv/mm/init.c
+++ b/arch/riscv/mm/init.c
@@ -367,7 +367,8 @@ static phys_addr_t __init alloc_pmd_late(uintptr_t va)
  	unsigned long vaddr;

  	vaddr = __get_free_page(GFP_KERNEL);
-	BUG_ON(!vaddr);
+	BUG_ON(!vaddr || !pgtable_pmd_page_ctor(virt_to_page(vaddr)));
+
  	return __pa(vaddr);
  }
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help