Re: [PATCH] KVM: Change [g|h]va_t as u64
From: Paolo Bonzini
Date: Mon Mar 09 2026 - 04:31:55 EST
On Mon, Mar 9, 2026 at 9:29 AM Anshuman Khandual
<anshuman.khandual@xxxxxxx> wrote:
>
> On 09/03/26 1:50 PM, Paolo Bonzini wrote:
> > Il dom 8 mar 2026, 13:58 Anshuman Khandual <anshuman.khandual@xxxxxxx>
> > ha scritto:
> >>
> >> On 06/03/26 11:46 PM, Sean Christopherson wrote:
> >>> On Fri, Mar 06, 2026, Anshuman Khandual wrote:
> >>>> Change both [g|h]va_t as u64 to be consistent with other address types.
> >>>
> >>> That's hilariously, blatantly wrong.
> >>
> >> Sorry did not understand how this is wrong. Both guest and host
> >> virtual address types should be be contained in u64 rather than
> >> 'unsigned long'. Did I miss something else here.
> >
> > Virtual addresses are pointers and the pointer-sized integer type in
> > Linux is long.
>
> Agreed but would not u64 work as well ? OR will it be over provisioning
> causing memory wastage for all those unused higher 32 bits on platforms
> where long is just 32 bits.
Maybe, but you'd have to add casts which makes the code harder to
follow and more brittle. So that's not a good idea.
Also, even on 64-bit systems any %l printk format have to be changed to %ll.
Paolo