* [PATCH v2 1/2] powerpc/ptdump: Refactor update of st->last_pa @ 2020-06-29 11:17 ` Christophe Leroy 0 siblings, 0 replies; 5+ messages in thread From: Christophe Leroy @ 2020-06-29 11:17 UTC (permalink / raw) To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman Cc: linux-kernel, linuxppc-dev st->last_pa is always updated in note_page() so it can be done outside the if/elseif/else block. Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> --- arch/powerpc/mm/ptdump/ptdump.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/arch/powerpc/mm/ptdump/ptdump.c b/arch/powerpc/mm/ptdump/ptdump.c index b2ed1ca4f254..20a039867934 100644 --- a/arch/powerpc/mm/ptdump/ptdump.c +++ b/arch/powerpc/mm/ptdump/ptdump.c @@ -211,7 +211,6 @@ static void note_page(struct pg_state *st, unsigned long addr, st->current_flags = flag; st->start_address = addr; st->start_pa = pa; - st->last_pa = pa; st->page_size = page_size; pt_dump_seq_printf(st->seq, "---[ %s ]---\n", st->marker->name); /* @@ -251,13 +250,11 @@ static void note_page(struct pg_state *st, unsigned long addr, } st->start_address = addr; st->start_pa = pa; - st->last_pa = pa; st->page_size = page_size; st->current_flags = flag; st->level = level; - } else { - st->last_pa = pa; } + st->last_pa = pa; } static void walk_pte(struct pg_state *st, pmd_t *pmd, unsigned long start) -- 2.25.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 1/2] powerpc/ptdump: Refactor update of st->last_pa @ 2020-06-29 11:17 ` Christophe Leroy 0 siblings, 0 replies; 5+ messages in thread From: Christophe Leroy @ 2020-06-29 11:17 UTC (permalink / raw) To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman Cc: linuxppc-dev, linux-kernel st->last_pa is always updated in note_page() so it can be done outside the if/elseif/else block. Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> --- arch/powerpc/mm/ptdump/ptdump.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/arch/powerpc/mm/ptdump/ptdump.c b/arch/powerpc/mm/ptdump/ptdump.c index b2ed1ca4f254..20a039867934 100644 --- a/arch/powerpc/mm/ptdump/ptdump.c +++ b/arch/powerpc/mm/ptdump/ptdump.c @@ -211,7 +211,6 @@ static void note_page(struct pg_state *st, unsigned long addr, st->current_flags = flag; st->start_address = addr; st->start_pa = pa; - st->last_pa = pa; st->page_size = page_size; pt_dump_seq_printf(st->seq, "---[ %s ]---\n", st->marker->name); /* @@ -251,13 +250,11 @@ static void note_page(struct pg_state *st, unsigned long addr, } st->start_address = addr; st->start_pa = pa; - st->last_pa = pa; st->page_size = page_size; st->current_flags = flag; st->level = level; - } else { - st->last_pa = pa; } + st->last_pa = pa; } static void walk_pte(struct pg_state *st, pmd_t *pmd, unsigned long start) -- 2.25.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 2/2] powerpc/ptdump: Refactor update of pg_state 2020-06-29 11:17 ` Christophe Leroy @ 2020-06-29 11:17 ` Christophe Leroy -1 siblings, 0 replies; 5+ messages in thread From: Christophe Leroy @ 2020-06-29 11:17 UTC (permalink / raw) To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman Cc: linux-kernel, linuxppc-dev In note_page(), the pg_state is updated the same way in two places. Add note_page_update_state() to do it. Also include the display of boundary markers there as it is missing "no level" leg, leading to a mismatch when the first two markers are at the same address and the first displayed area uses that address. Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> --- arch/powerpc/mm/ptdump/ptdump.c | 34 +++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/arch/powerpc/mm/ptdump/ptdump.c b/arch/powerpc/mm/ptdump/ptdump.c index 20a039867934..c911cd757f7d 100644 --- a/arch/powerpc/mm/ptdump/ptdump.c +++ b/arch/powerpc/mm/ptdump/ptdump.c @@ -199,6 +199,24 @@ static void note_prot_wx(struct pg_state *st, unsigned long addr) st->wx_pages += (addr - st->start_address) / PAGE_SIZE; } +static void note_page_update_state(struct pg_state *st, unsigned long addr, + unsigned int level, u64 val, unsigned long page_size) +{ + u64 flag = val & pg_level[level].mask; + u64 pa = val & PTE_RPN_MASK; + + st->level = level; + st->current_flags = flag; + st->start_address = addr; + st->start_pa = pa; + st->page_size = page_size; + + while (addr >= st->marker[1].start_address) { + st->marker++; + pt_dump_seq_printf(st->seq, "---[ %s ]---\n", st->marker->name); + } +} + static void note_page(struct pg_state *st, unsigned long addr, unsigned int level, u64 val, unsigned long page_size) { @@ -207,12 +225,8 @@ static void note_page(struct pg_state *st, unsigned long addr, /* At first no level is set */ if (!st->level) { - st->level = level; - st->current_flags = flag; - st->start_address = addr; - st->start_pa = pa; - st->page_size = page_size; pt_dump_seq_printf(st->seq, "---[ %s ]---\n", st->marker->name); + note_page_update_state(st, addr, level, val, page_size); /* * Dump the section of virtual memory when: * - the PTE flags from one entry to the next differs. @@ -244,15 +258,7 @@ static void note_page(struct pg_state *st, unsigned long addr, * Address indicates we have passed the end of the * current section of virtual memory */ - while (addr >= st->marker[1].start_address) { - st->marker++; - pt_dump_seq_printf(st->seq, "---[ %s ]---\n", st->marker->name); - } - st->start_address = addr; - st->start_pa = pa; - st->page_size = page_size; - st->current_flags = flag; - st->level = level; + note_page_update_state(st, addr, level, val, page_size); } st->last_pa = pa; } -- 2.25.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 2/2] powerpc/ptdump: Refactor update of pg_state @ 2020-06-29 11:17 ` Christophe Leroy 0 siblings, 0 replies; 5+ messages in thread From: Christophe Leroy @ 2020-06-29 11:17 UTC (permalink / raw) To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman Cc: linuxppc-dev, linux-kernel In note_page(), the pg_state is updated the same way in two places. Add note_page_update_state() to do it. Also include the display of boundary markers there as it is missing "no level" leg, leading to a mismatch when the first two markers are at the same address and the first displayed area uses that address. Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> --- arch/powerpc/mm/ptdump/ptdump.c | 34 +++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/arch/powerpc/mm/ptdump/ptdump.c b/arch/powerpc/mm/ptdump/ptdump.c index 20a039867934..c911cd757f7d 100644 --- a/arch/powerpc/mm/ptdump/ptdump.c +++ b/arch/powerpc/mm/ptdump/ptdump.c @@ -199,6 +199,24 @@ static void note_prot_wx(struct pg_state *st, unsigned long addr) st->wx_pages += (addr - st->start_address) / PAGE_SIZE; } +static void note_page_update_state(struct pg_state *st, unsigned long addr, + unsigned int level, u64 val, unsigned long page_size) +{ + u64 flag = val & pg_level[level].mask; + u64 pa = val & PTE_RPN_MASK; + + st->level = level; + st->current_flags = flag; + st->start_address = addr; + st->start_pa = pa; + st->page_size = page_size; + + while (addr >= st->marker[1].start_address) { + st->marker++; + pt_dump_seq_printf(st->seq, "---[ %s ]---\n", st->marker->name); + } +} + static void note_page(struct pg_state *st, unsigned long addr, unsigned int level, u64 val, unsigned long page_size) { @@ -207,12 +225,8 @@ static void note_page(struct pg_state *st, unsigned long addr, /* At first no level is set */ if (!st->level) { - st->level = level; - st->current_flags = flag; - st->start_address = addr; - st->start_pa = pa; - st->page_size = page_size; pt_dump_seq_printf(st->seq, "---[ %s ]---\n", st->marker->name); + note_page_update_state(st, addr, level, val, page_size); /* * Dump the section of virtual memory when: * - the PTE flags from one entry to the next differs. @@ -244,15 +258,7 @@ static void note_page(struct pg_state *st, unsigned long addr, * Address indicates we have passed the end of the * current section of virtual memory */ - while (addr >= st->marker[1].start_address) { - st->marker++; - pt_dump_seq_printf(st->seq, "---[ %s ]---\n", st->marker->name); - } - st->start_address = addr; - st->start_pa = pa; - st->page_size = page_size; - st->current_flags = flag; - st->level = level; + note_page_update_state(st, addr, level, val, page_size); } st->last_pa = pa; } -- 2.25.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/2] powerpc/ptdump: Refactor update of st->last_pa 2020-06-29 11:17 ` Christophe Leroy (?) (?) @ 2020-07-27 7:26 ` Michael Ellerman -1 siblings, 0 replies; 5+ messages in thread From: Michael Ellerman @ 2020-07-27 7:26 UTC (permalink / raw) To: Michael Ellerman, Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras Cc: linuxppc-dev, linux-kernel On Mon, 29 Jun 2020 11:17:18 +0000 (UTC), Christophe Leroy wrote: > st->last_pa is always updated in note_page() so it can > be done outside the if/elseif/else block. Applied to powerpc/next. [1/2] powerpc/ptdump: Refactor update of st->last_pa https://git.kernel.org/powerpc/c/846feeace51bce13f5c645d5bf162455b89841fd [2/2] powerpc/ptdump: Refactor update of pg_state https://git.kernel.org/powerpc/c/e54e30bca40233139290aecfce932dea9b996516 cheers ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-07-27 7:26 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-06-29 11:17 [PATCH v2 1/2] powerpc/ptdump: Refactor update of st->last_pa Christophe Leroy 2020-06-29 11:17 ` Christophe Leroy 2020-06-29 11:17 ` [PATCH v2 2/2] powerpc/ptdump: Refactor update of pg_state Christophe Leroy 2020-06-29 11:17 ` Christophe Leroy 2020-07-27 7:26 ` [PATCH v2 1/2] powerpc/ptdump: Refactor update of st->last_pa Michael Ellerman
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.