On 10/20/2025 2:27 PM, Alexander Gordeev wrote:
On Fri, Oct 17, 2025 at 01:26:41PM +0200, Mikhail Zaslonko wrote:
> In s390x_kvtop() early return may take place despite the verbose
> flag. Thus we can miss page-table walk information in the vtop output
> for kernel virtual addresses.
> Make sure that s390x_vtop() is always called for kernel virtual addresses
> when the verbose flag is passed to s390x_kvtop() by do_vtop().
>
> Suggested-by: Heiko Carstens <hca(a)linux.ibm.com>
> Signed-off-by: Mikhail Zaslonko <zaslonko(a)linux.ibm.com>
> ---
> s390x.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/s390x.c b/s390x.c
> index 25dca5e..77d9082 100644
> --- a/s390x.c
> +++ b/s390x.c
> @@ -943,15 +943,15 @@ s390x_kvtop(struct task_context *tc, ulong vaddr, physaddr_t
*paddr, int verbose
>
> if (!IS_KVADDR(vaddr)){
> *paddr = 0;
> return FALSE;
> }
>
> - if (!IS_VMALLOC_ADDR(vaddr)) {
> - *paddr = VTOP(vaddr);
> - return TRUE;
> + if (!verbose && !IS_VMALLOC_ADDR(vaddr)) {
> + *paddr = VTOP(vaddr);
> + return TRUE;
Few other architectures do it like this:
if (!vt->vmalloc_start) {
*paddr = VTOP(kvaddr);
return TRUE;
}
if (!IS_VMALLOC_ADDR(kvaddr)) {
*paddr = VTOP(kvaddr);
if (!verbose)
return TRUE;
}
Would it work for s390x?
It would, but does it make sense updating *paddr value for non-verbose case prior to
calling s390x_vtop() where we set it back to zero at the very start (see below).
Do you think we should just try keeping the code similar to other architectures?
/* lookup virtual address in page tables */
int s390x_vtop(ulong table, ulong vaddr, physaddr_t *phys_addr, int verbose)
{
ulong entry, paddr;
int level, len;
if (verbose)
fprintf(fp, "PAGE DIRECTORY: %016lx\n", table);
*phys_addr = 0;
> }
>
> pgd_base = (unsigned long)vt->kernel_pgd[0];
> return s390x_vtop(pgd_base, vaddr, paddr, verbose);
> }
Thanks!