* [PATCH] memblock: Add flags and nid info in memblock debugfs
@ 2023-05-16 2:06 Yuwei Guan
2023-05-16 10:17 ` Tarun Sahu
2023-05-16 14:10 ` Mike Rapoport
0 siblings, 2 replies; 4+ messages in thread
From: Yuwei Guan @ 2023-05-16 2:06 UTC (permalink / raw)
To: rppt, akpm; +Cc: linux-mm, linux-kernel, Yuwei Guan
Currently, the memblock debugfs can display the count of memblock_type and
the base and end of the reg. However, when the following scenario occurs,
the information in the existing debugfs cannot make it clear why the
address is not consecutive.
For example,
cat /sys/kernel/debug/memblock/memory
0: 0x0000000080000000..0x00000000901fffff
1: 0x0000000090200000..0x00000000905fffff
2: 0x0000000090600000..0x0000000092ffffff
3: 0x0000000093000000..0x00000000973fffff
4: 0x0000000097400000..0x00000000b71fffff
5: 0x00000000c0000000..0x00000000dfffffff
6: 0x00000000e2500000..0x00000000f87fffff
7: 0x00000000f8800000..0x00000000fa7fffff
8: 0x00000000fa800000..0x00000000fd3effff
9: 0x00000000fd3f0000..0x00000000fd3fefff
10: 0x00000000fd3ff000..0x00000000fd7fffff
11: 0x00000000fd800000..0x00000000fd901fff
12: 0x00000000fd902000..0x00000000fd909fff
13: 0x00000000fd90a000..0x00000000fd90bfff
14: 0x00000000fd90c000..0x00000000ffffffff
15: 0x0000000880000000..0x0000000affffffff
So we can add flags and nid to this debugfs.
For example,
cat /sys/kernel/debug/memblock/memory
cnt flags base..end
0: 0x0 0x0000000080000000..0x00000000901fffff
1: 0x4 0x0000000090200000..0x00000000905fffff
2: 0x0 0x0000000090600000..0x0000000092ffffff
3: 0x4 0x0000000093000000..0x00000000973fffff
4: 0x0 0x0000000097400000..0x00000000b71fffff
5: 0x0 0x00000000c0000000..0x00000000dfffffff
6: 0x0 0x00000000e2500000..0x00000000f87fffff
7: 0x4 0x00000000f8800000..0x00000000fa7fffff
8: 0x0 0x00000000fa800000..0x00000000fd3effff
9: 0x4 0x00000000fd3f0000..0x00000000fd3fefff
10: 0x0 0x00000000fd3ff000..0x00000000fd7fffff
11: 0x4 0x00000000fd800000..0x00000000fd901fff
12: 0x0 0x00000000fd902000..0x00000000fd909fff
13: 0x4 0x00000000fd90a000..0x00000000fd90bfff
14: 0x0 0x00000000fd90c000..0x00000000ffffffff
15: 0x0 0x0000000880000000..0x0000000affffffff
Signed-off-by: Yuwei Guan <ssawgyw@gmail.com>
---
mm/memblock.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/mm/memblock.c b/mm/memblock.c
index 45f198750be9..34230b258e21 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -2045,11 +2045,21 @@ static int memblock_debug_show(struct seq_file *m, void *private)
int i;
phys_addr_t end;
+#ifdef CONFIG_NUMA
+ seq_puts(m, "cnt\tflags\tnid\tbase..end\n");
+#else
+ seq_puts(m, "cnt\tflags\tbase..end\n");
+#endif
+
for (i = 0; i < type->cnt; i++) {
reg = &type->regions[i];
end = reg->base + reg->size - 1;
- seq_printf(m, "%4d: ", i);
+ seq_printf(m, "%d:\t", i);
+ seq_printf(m, "0x%x\t", reg->flags);
+#ifdef CONFIG_NUMA
+ seq_printf(m, "0x%x\t", reg->nid);
+#endif
seq_printf(m, "%pa..%pa\n", ®->base, &end);
}
return 0;
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] memblock: Add flags and nid info in memblock debugfs
2023-05-16 2:06 [PATCH] memblock: Add flags and nid info in memblock debugfs Yuwei Guan
@ 2023-05-16 10:17 ` Tarun Sahu
2023-05-16 14:10 ` Mike Rapoport
1 sibling, 0 replies; 4+ messages in thread
From: Tarun Sahu @ 2023-05-16 10:17 UTC (permalink / raw)
To: Yuwei Guan, rppt, akpm; +Cc: linux-mm, linux-kernel, Yuwei Guan, aneesh.kumar
Hi Guan,
Looks good to me, I tested it on my system.
Feel free to add
Reviewed-by: Tarun Sahu <tsahu@linux.ibm.com>
Yuwei Guan <ssawgyw@gmail.com> writes:
> Currently, the memblock debugfs can display the count of memblock_type and
> the base and end of the reg. However, when the following scenario occurs,
> the information in the existing debugfs cannot make it clear why the
> address is not consecutive.
>
> For example,
> cat /sys/kernel/debug/memblock/memory
> 0: 0x0000000080000000..0x00000000901fffff
> 1: 0x0000000090200000..0x00000000905fffff
> 2: 0x0000000090600000..0x0000000092ffffff
> 3: 0x0000000093000000..0x00000000973fffff
> 4: 0x0000000097400000..0x00000000b71fffff
> 5: 0x00000000c0000000..0x00000000dfffffff
> 6: 0x00000000e2500000..0x00000000f87fffff
> 7: 0x00000000f8800000..0x00000000fa7fffff
> 8: 0x00000000fa800000..0x00000000fd3effff
> 9: 0x00000000fd3f0000..0x00000000fd3fefff
> 10: 0x00000000fd3ff000..0x00000000fd7fffff
> 11: 0x00000000fd800000..0x00000000fd901fff
> 12: 0x00000000fd902000..0x00000000fd909fff
> 13: 0x00000000fd90a000..0x00000000fd90bfff
> 14: 0x00000000fd90c000..0x00000000ffffffff
> 15: 0x0000000880000000..0x0000000affffffff
>
> So we can add flags and nid to this debugfs.
>
> For example,
> cat /sys/kernel/debug/memblock/memory
> cnt flags base..end
> 0: 0x0 0x0000000080000000..0x00000000901fffff
> 1: 0x4 0x0000000090200000..0x00000000905fffff
> 2: 0x0 0x0000000090600000..0x0000000092ffffff
> 3: 0x4 0x0000000093000000..0x00000000973fffff
> 4: 0x0 0x0000000097400000..0x00000000b71fffff
> 5: 0x0 0x00000000c0000000..0x00000000dfffffff
> 6: 0x0 0x00000000e2500000..0x00000000f87fffff
> 7: 0x4 0x00000000f8800000..0x00000000fa7fffff
> 8: 0x0 0x00000000fa800000..0x00000000fd3effff
> 9: 0x4 0x00000000fd3f0000..0x00000000fd3fefff
> 10: 0x0 0x00000000fd3ff000..0x00000000fd7fffff
> 11: 0x4 0x00000000fd800000..0x00000000fd901fff
> 12: 0x0 0x00000000fd902000..0x00000000fd909fff
> 13: 0x4 0x00000000fd90a000..0x00000000fd90bfff
> 14: 0x0 0x00000000fd90c000..0x00000000ffffffff
> 15: 0x0 0x0000000880000000..0x0000000affffffff
>
> Signed-off-by: Yuwei Guan <ssawgyw@gmail.com>
> ---
> mm/memblock.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/mm/memblock.c b/mm/memblock.c
> index 45f198750be9..34230b258e21 100644
> --- a/mm/memblock.c
> +++ b/mm/memblock.c
> @@ -2045,11 +2045,21 @@ static int memblock_debug_show(struct seq_file *m, void *private)
> int i;
> phys_addr_t end;
>
> +#ifdef CONFIG_NUMA
> + seq_puts(m, "cnt\tflags\tnid\tbase..end\n");
> +#else
> + seq_puts(m, "cnt\tflags\tbase..end\n");
> +#endif
> +
> for (i = 0; i < type->cnt; i++) {
> reg = &type->regions[i];
> end = reg->base + reg->size - 1;
>
> - seq_printf(m, "%4d: ", i);
> + seq_printf(m, "%d:\t", i);
> + seq_printf(m, "0x%x\t", reg->flags);
> +#ifdef CONFIG_NUMA
> + seq_printf(m, "0x%x\t", reg->nid);
> +#endif
> seq_printf(m, "%pa..%pa\n", ®->base, &end);
> }
> return 0;
> --
> 2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] memblock: Add flags and nid info in memblock debugfs
2023-05-16 2:06 [PATCH] memblock: Add flags and nid info in memblock debugfs Yuwei Guan
2023-05-16 10:17 ` Tarun Sahu
@ 2023-05-16 14:10 ` Mike Rapoport
2023-05-17 1:52 ` Yuwei Guan
1 sibling, 1 reply; 4+ messages in thread
From: Mike Rapoport @ 2023-05-16 14:10 UTC (permalink / raw)
To: Yuwei Guan; +Cc: akpm, linux-mm, linux-kernel
Hi,
On Tue, May 16, 2023 at 10:06:45AM +0800, Yuwei Guan wrote:
> Currently, the memblock debugfs can display the count of memblock_type and
> the base and end of the reg. However, when the following scenario occurs,
> the information in the existing debugfs cannot make it clear why the
> address is not consecutive.
>
> For example,
> cat /sys/kernel/debug/memblock/memory
> 0: 0x0000000080000000..0x00000000901fffff
> 1: 0x0000000090200000..0x00000000905fffff
> 2: 0x0000000090600000..0x0000000092ffffff
> 3: 0x0000000093000000..0x00000000973fffff
> 4: 0x0000000097400000..0x00000000b71fffff
> 5: 0x00000000c0000000..0x00000000dfffffff
> 6: 0x00000000e2500000..0x00000000f87fffff
> 7: 0x00000000f8800000..0x00000000fa7fffff
> 8: 0x00000000fa800000..0x00000000fd3effff
> 9: 0x00000000fd3f0000..0x00000000fd3fefff
> 10: 0x00000000fd3ff000..0x00000000fd7fffff
> 11: 0x00000000fd800000..0x00000000fd901fff
> 12: 0x00000000fd902000..0x00000000fd909fff
> 13: 0x00000000fd90a000..0x00000000fd90bfff
> 14: 0x00000000fd90c000..0x00000000ffffffff
> 15: 0x0000000880000000..0x0000000affffffff
>
> So we can add flags and nid to this debugfs.
>
> For example,
> cat /sys/kernel/debug/memblock/memory
> cnt flags base..end
> 0: 0x0 0x0000000080000000..0x00000000901fffff
> 1: 0x4 0x0000000090200000..0x00000000905fffff
> 2: 0x0 0x0000000090600000..0x0000000092ffffff
> 3: 0x4 0x0000000093000000..0x00000000973fffff
> 4: 0x0 0x0000000097400000..0x00000000b71fffff
> 5: 0x0 0x00000000c0000000..0x00000000dfffffff
> 6: 0x0 0x00000000e2500000..0x00000000f87fffff
> 7: 0x4 0x00000000f8800000..0x00000000fa7fffff
> 8: 0x0 0x00000000fa800000..0x00000000fd3effff
> 9: 0x4 0x00000000fd3f0000..0x00000000fd3fefff
> 10: 0x0 0x00000000fd3ff000..0x00000000fd7fffff
> 11: 0x4 0x00000000fd800000..0x00000000fd901fff
> 12: 0x0 0x00000000fd902000..0x00000000fd909fff
> 13: 0x4 0x00000000fd90a000..0x00000000fd90bfff
> 14: 0x0 0x00000000fd90c000..0x00000000ffffffff
> 15: 0x0 0x0000000880000000..0x0000000affffffff
>
> Signed-off-by: Yuwei Guan <ssawgyw@gmail.com>
> ---
> mm/memblock.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/mm/memblock.c b/mm/memblock.c
> index 45f198750be9..34230b258e21 100644
> --- a/mm/memblock.c
> +++ b/mm/memblock.c
> @@ -2045,11 +2045,21 @@ static int memblock_debug_show(struct seq_file *m, void *private)
> int i;
> phys_addr_t end;
>
> +#ifdef CONFIG_NUMA
> + seq_puts(m, "cnt\tflags\tnid\tbase..end\n");
> +#else
> + seq_puts(m, "cnt\tflags\tbase..end\n");
> +#endif
> +
> for (i = 0; i < type->cnt; i++) {
> reg = &type->regions[i];
> end = reg->base + reg->size - 1;
>
> - seq_printf(m, "%4d: ", i);
> + seq_printf(m, "%d:\t", i);
> + seq_printf(m, "0x%x\t", reg->flags);
> +#ifdef CONFIG_NUMA
> + seq_printf(m, "0x%x\t", reg->nid);
> +#endif
Please add flags and node information after the ranges and print node for
UMA case as well. I'd prefer to have zeros in debugfs rather than ifdefs
here. Just use memblock_get_region_node() instead of r->nid.
> seq_printf(m, "%pa..%pa\n", ®->base, &end);
> }
> return 0;
> --
> 2.34.1
>
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] memblock: Add flags and nid info in memblock debugfs
2023-05-16 14:10 ` Mike Rapoport
@ 2023-05-17 1:52 ` Yuwei Guan
0 siblings, 0 replies; 4+ messages in thread
From: Yuwei Guan @ 2023-05-17 1:52 UTC (permalink / raw)
To: Mike Rapoport; +Cc: akpm, linux-mm, linux-kernel
Mike Rapoport <rppt@kernel.org> 于2023年5月16日周二 22:10写道:
>
> Hi,
>
> On Tue, May 16, 2023 at 10:06:45AM +0800, Yuwei Guan wrote:
> > Currently, the memblock debugfs can display the count of memblock_type and
> > the base and end of the reg. However, when the following scenario occurs,
> > the information in the existing debugfs cannot make it clear why the
> > address is not consecutive.
> >
> > For example,
> > cat /sys/kernel/debug/memblock/memory
> > 0: 0x0000000080000000..0x00000000901fffff
> > 1: 0x0000000090200000..0x00000000905fffff
> > 2: 0x0000000090600000..0x0000000092ffffff
> > 3: 0x0000000093000000..0x00000000973fffff
> > 4: 0x0000000097400000..0x00000000b71fffff
> > 5: 0x00000000c0000000..0x00000000dfffffff
> > 6: 0x00000000e2500000..0x00000000f87fffff
> > 7: 0x00000000f8800000..0x00000000fa7fffff
> > 8: 0x00000000fa800000..0x00000000fd3effff
> > 9: 0x00000000fd3f0000..0x00000000fd3fefff
> > 10: 0x00000000fd3ff000..0x00000000fd7fffff
> > 11: 0x00000000fd800000..0x00000000fd901fff
> > 12: 0x00000000fd902000..0x00000000fd909fff
> > 13: 0x00000000fd90a000..0x00000000fd90bfff
> > 14: 0x00000000fd90c000..0x00000000ffffffff
> > 15: 0x0000000880000000..0x0000000affffffff
> >
> > So we can add flags and nid to this debugfs.
> >
> > For example,
> > cat /sys/kernel/debug/memblock/memory
> > cnt flags base..end
> > 0: 0x0 0x0000000080000000..0x00000000901fffff
> > 1: 0x4 0x0000000090200000..0x00000000905fffff
> > 2: 0x0 0x0000000090600000..0x0000000092ffffff
> > 3: 0x4 0x0000000093000000..0x00000000973fffff
> > 4: 0x0 0x0000000097400000..0x00000000b71fffff
> > 5: 0x0 0x00000000c0000000..0x00000000dfffffff
> > 6: 0x0 0x00000000e2500000..0x00000000f87fffff
> > 7: 0x4 0x00000000f8800000..0x00000000fa7fffff
> > 8: 0x0 0x00000000fa800000..0x00000000fd3effff
> > 9: 0x4 0x00000000fd3f0000..0x00000000fd3fefff
> > 10: 0x0 0x00000000fd3ff000..0x00000000fd7fffff
> > 11: 0x4 0x00000000fd800000..0x00000000fd901fff
> > 12: 0x0 0x00000000fd902000..0x00000000fd909fff
> > 13: 0x4 0x00000000fd90a000..0x00000000fd90bfff
> > 14: 0x0 0x00000000fd90c000..0x00000000ffffffff
> > 15: 0x0 0x0000000880000000..0x0000000affffffff
> >
> > Signed-off-by: Yuwei Guan <ssawgyw@gmail.com>
> > ---
> > mm/memblock.c | 12 +++++++++++-
> > 1 file changed, 11 insertions(+), 1 deletion(-)
> >
> > diff --git a/mm/memblock.c b/mm/memblock.c
> > index 45f198750be9..34230b258e21 100644
> > --- a/mm/memblock.c
> > +++ b/mm/memblock.c
> > @@ -2045,11 +2045,21 @@ static int memblock_debug_show(struct seq_file *m, void *private)
> > int i;
> > phys_addr_t end;
> >
> > +#ifdef CONFIG_NUMA
> > + seq_puts(m, "cnt\tflags\tnid\tbase..end\n");
> > +#else
> > + seq_puts(m, "cnt\tflags\tbase..end\n");
> > +#endif
> > +
> > for (i = 0; i < type->cnt; i++) {
> > reg = &type->regions[i];
> > end = reg->base + reg->size - 1;
> >
> > - seq_printf(m, "%4d: ", i);
> > + seq_printf(m, "%d:\t", i);
> > + seq_printf(m, "0x%x\t", reg->flags);
> > +#ifdef CONFIG_NUMA
> > + seq_printf(m, "0x%x\t", reg->nid);
> > +#endif
>
> Please add flags and node information after the ranges and print node for
> UMA case as well. I'd prefer to have zeros in debugfs rather than ifdefs
> here. Just use memblock_get_region_node() instead of r->nid.
>
Thanks for the code review. I will update it and send a v2 patch.
> > seq_printf(m, "%pa..%pa\n", ®->base, &end);
> > }
> > return 0;
> > --
> > 2.34.1
> >
>
> --
> Sincerely yours,
> Mike.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-05-17 1:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-16 2:06 [PATCH] memblock: Add flags and nid info in memblock debugfs Yuwei Guan
2023-05-16 10:17 ` Tarun Sahu
2023-05-16 14:10 ` Mike Rapoport
2023-05-17 1:52 ` Yuwei Guan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox