On Mon, Oct 20, 2025 at 06:01:00PM +0200, Mikhail Zaslonko wrote:
>> @@ -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).
It is getting ugly this way, indeed.
Do you think we should just try keeping the code similar to other
architectures?
No, I am just afraid of missing the reason why some other archs do it (not all).
So it looks like you approach is fine.
/* 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;
Thanks!