[PATCH v2 5/8] riscv: mm: Take memory hotplug read-lock during kernel page table dump
David Hildenbrand
david at redhat.com
Tue May 14 13:39:30 PDT 2024
On 14.05.24 16:04, Björn Töpel wrote:
> From: Björn Töpel <bjorn at rivosinc.com>
>
> During memory hot remove, the ptdump functionality can end up touching
> stale data. Avoid any potential crashes (or worse), by holding the
> memory hotplug read-lock while traversing the page table.
>
> This change is analogous to arm64's commit bf2b59f60ee1 ("arm64/mm:
> Hold memory hotplug lock while walking for kernel page table dump").
>
> Signed-off-by: Björn Töpel <bjorn at rivosinc.com>
> ---
> arch/riscv/mm/ptdump.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/arch/riscv/mm/ptdump.c b/arch/riscv/mm/ptdump.c
> index 1289cc6d3700..9d5f657a251b 100644
> --- a/arch/riscv/mm/ptdump.c
> +++ b/arch/riscv/mm/ptdump.c
> @@ -6,6 +6,7 @@
> #include <linux/efi.h>
> #include <linux/init.h>
> #include <linux/debugfs.h>
> +#include <linux/memory_hotplug.h>
> #include <linux/seq_file.h>
> #include <linux/ptdump.h>
>
> @@ -370,7 +371,9 @@ bool ptdump_check_wx(void)
>
> static int ptdump_show(struct seq_file *m, void *v)
> {
> + get_online_mems();
> ptdump_walk(m, m->private);
> + put_online_mems();
>
> return 0;
> }
Reviewed-by: David Hildenbrand <david at redhat.com>
--
Cheers,
David / dhildenb
More information about the linux-riscv
mailing list