Re: [PATCH v14 21/22] arm64: mm: Convert mm/dump.c to use walk_page_range()

Catalin Marinas
2019-10-31T14:37:31Z

On Thu, Oct 31, 2019 at 02:00:38PM +0000, Catalin Marinas wrote:
> On Thu, Oct 31, 2019 at 01:32:34PM +0000, Steven Price wrote:
> > On 30/10/2019 16:45, Catalin Marinas wrote:
> > > On Mon, Oct 28, 2019 at 01:59:09PM +0000, Steven Price wrote:
> > >> diff --git a/arch/arm64/mm/dump.c b/arch/arm64/mm/dump.c
> > >> index 93f9f77582ae..9d9b740a86d2 100644
> > >> --- a/arch/arm64/mm/dump.c
> > >> +++ b/arch/arm64/mm/dump.c
> > >> @@ -15,6 +15,7 @@
> > >> #include <linux/io.h>
> > >> #include <linux/init.h>
> > >> #include <linux/mm.h>
> > >> +#include <linux/ptdump.h>
> > >> #include <linux/sched.h>
> > >> #include <linux/seq_file.h>
> > >>
> > >> @@ -75,10 +76,11 @@ static struct addr_marker address_markers[] = {
> > >> * dumps out a description of the range.
> > >> */
> > >> struct pg_state {
> > >> + struct ptdump_state ptdump;
> > >> struct seq_file *seq;
> > >> const struct addr_marker *marker;
> > >> unsigned long start_address;
> > >> - unsigned level;
> > >> + int level;
> > >> u64 current_prot;
> > >> bool check_wx;
> > >> unsigned long wx_pages;
> > >> @@ -178,6 +180,10 @@ static struct pg_level pg_level[] = {
> > >> .name = "PGD",
> > >> .bits = pte_bits,
> > >> .num = ARRAY_SIZE(pte_bits),
> > >> + }, { /* p4d */
> > >> + .name = "P4D",
> > >> + .bits = pte_bits,
> > >> + .num = ARRAY_SIZE(pte_bits),
> > >> }, { /* pud */
> > >> .name = (CONFIG_PGTABLE_LEVELS > 3) ? "PUD" : "PGD",
> > >> .bits = pte_bits,
> > >
> > > We could use "PGD" for the p4d entry since we don't have five levels.
> > > This patches the "PGD" name used for pud/pmd when these levels are
> > > folded.
> >
> > Good point, although I'd actually be more tempted to do the opposite -
> > remove the special casing for PUD/PMD as the generic code should now
> > never provide those levels if they are folded. What do you think?
>
> I agree, it makes sense.

Forgot to mention. With the additional patch you sent, feel free to also
add my r-o-b on this one.

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>