qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v7 11/12] multifd: Zero pages transmission


From: Juan Quintela
Subject: Re: [PATCH v7 11/12] multifd: Zero pages transmission
Date: Mon, 14 Nov 2022 13:20:07 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux)

Leonardo Brás <leobras@redhat.com> wrote:
> On Tue, 2022-08-02 at 08:39 +0200, Juan Quintela wrote:
>> This implements the zero page dection and handling.
>> 
>> Signed-off-by: Juan Quintela <quintela@redhat.com>

>> @@ -358,6 +365,18 @@ static int multifd_recv_unfill_packet(MultiFDRecvParams 
>> *p, Error **errp)
>>          p->normal[i] = offset;
>>      }
>>  
>> +    for (i = 0; i < p->zero_num; i++) {
>> +        uint64_t offset = be64_to_cpu(packet->offset[p->normal_num + i]);
>> +
>> +        if (offset > (block->used_length - p->page_size)) {
>> +            error_setg(errp, "multifd: offset too long %" PRIu64
>> +                       " (max " RAM_ADDR_FMT ")",
>> +                       offset, block->used_length);
>> +            return -1;
>> +        }
>> +        p->zero[i] = offset;
>> +    }
>> +
>>      return 0;
>>  }
>
> IIUC ram_addr_t is supposed to be the address size for the architecture, 
> mainly
> being 32 or 64 bits. So packet->offset[i] is always u64, and p->zero[i] 
> possibly
> being u32 or u64.
>
> Since both local variables and packet->offset[i] are 64-bit, there is no 
> issue.
>
> But on 'p->zero[i] = offset' we can have 'u32 = u64', and this should raise a
> warning (or am I missing something?).

I don't really know what to do here.
The problem is only theoretical (in the long, long past, we have
supported migrating between different architectures, but we aren't
testing anymore).

And because it was a pain in the ass, we define it as:

/* address in the RAM (different from a physical address) */
#if defined(CONFIG_XEN_BACKEND)
typedef uint64_t ram_addr_t;
#  define RAM_ADDR_MAX UINT64_MAX
#  define RAM_ADDR_FMT "%" PRIx64
#else
typedef uintptr_t ram_addr_t;
#  define RAM_ADDR_MAX UINTPTR_MAX
#  define RAM_ADDR_FMT "%" PRIxPTR
#endif

So I am pretty sure that almost nothing uses 32bits for it now (I
haven't checked lately, but I guess that nobody is really using/testing
xen on 32 bits).

I don't really know.  But it could only happens when you are migrating
from Xen 64 bits to Xen 32 bits, I don't really know if that even work.

I will give it a try to change normal/zero to u64.

Thanks, Juan.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]