[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH RFC 20/21] migration: Handle page faults using UFFDIO_CONTINU
From: |
Juan Quintela |
Subject: |
Re: [PATCH RFC 20/21] migration: Handle page faults using UFFDIO_CONTINUE |
Date: |
Wed, 01 Feb 2023 20:52:07 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) |
Juan Quintela <quintela@redhat.com> wrote:
> Peter Xu <peterx@redhat.com> wrote:
>> Teach QEMU to be able to handle page faults using UFFDIO_CONTINUE for
>> hugetlbfs double mapped ranges.
>>
>> To copy the data, we need to use the mirror buffer created per ramblock by
>> a raw memcpy(), then we can kick the faulted threads using UFFDIO_CONTINUE
>> by installing the pgtables.
>>
>> Move trace_postcopy_place_page(host) upper so that it'll dump something for
>> either UFFDIO_COPY or UFFDIO_CONTINUE.
>>
>> Signed-off-by: Peter Xu <peterx@redhat.com>
>
>> ---
>> migration/postcopy-ram.c | 55 ++++++++++++++++++++++++++++++++++++++--
>> migration/trace-events | 4 +--
>> 2 files changed, 55 insertions(+), 4 deletions(-)
>>
>> diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
>> index 8a2259581e..c4bd338e22 100644
>> --- a/migration/postcopy-ram.c
>> +++ b/migration/postcopy-ram.c
>> @@ -1350,6 +1350,43 @@ int postcopy_notify_shared_wake(RAMBlock *rb,
>> uint64_t offset)
>> return 0;
>> }
>>
>> +/* Returns the mirror_host addr for a specific host address in ramblock */
>> +static inline void *migration_ram_get_mirror_addr(RAMBlock *rb, void *host)
>> +{
>> + return (void *)((__u64)rb->host_mirror + ((__u64)host -
>> (__u64)rb->host));
>
> This is gross :-(
> I hate this C miss-feature.
>
> What about:
> return (char *)rb->host_mirror + (char*)host - (char*)rb->host;
This was a generic suggestion. But after looking at ramblock.h and
realizing that rb->host is not void*.
return (uint8_t *)rb->host_mirror + (uint8_t *)host - rb->host;
Sorry for looking too late.
BTW, once here, why is the type of host_mirror different than the one
from host? I don't know what is more confusing anymore.
Later, Juan.