qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dave@treblig.org>
To: Peter Xu <peterx@redhat.com>
Cc: farosas@suse.de, eblake@redhat.com, armbru@redhat.com,
	qemu-devel@nongnu.org
Subject: Re: [PATCH v2 6/7] migration/postcopy: Use uffd helpers
Date: Mon, 30 Sep 2024 20:23:34 +0000	[thread overview]
Message-ID: <ZvsIxkKRvC8vN9ME@gallifrey> (raw)
In-Reply-To: <ZvsBPQzODYXJQ52L@x1n>

* Peter Xu (peterx@redhat.com) wrote:
> On Thu, Sep 19, 2024 at 02:46:25PM +0100, dave@treblig.org wrote:
> > From: "Dr. David Alan Gilbert" <dave@treblig.org>
> > 
> > Use the uffd_copy_page, uffd_zero_page and uffd_wakeup helpers
> > rather than calling ioctl ourselves.
> > 
> > They return -errno on error, and print an error_report themselves.
> > I think this actually makes postcopy_place_page actually more
> > consistent in it's callers.
> > 
> > Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
> > ---
> >  migration/postcopy-ram.c | 47 +++++++++++-----------------------------
> >  1 file changed, 13 insertions(+), 34 deletions(-)
> > 
> > diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
> > index 1c374b7ea1..e2b318d3da 100644
> > --- a/migration/postcopy-ram.c
> > +++ b/migration/postcopy-ram.c
> > @@ -746,18 +746,9 @@ int postcopy_wake_shared(struct PostCopyFD *pcfd,
> >                           RAMBlock *rb)
> >  {
> >      size_t pagesize = qemu_ram_pagesize(rb);
> > -    struct uffdio_range range;
> > -    int ret;
> >      trace_postcopy_wake_shared(client_addr, qemu_ram_get_idstr(rb));
> > -    range.start = ROUND_DOWN(client_addr, pagesize);
> > -    range.len = pagesize;
> > -    ret = ioctl(pcfd->fd, UFFDIO_WAKE, &range);
> > -    if (ret) {
> > -        error_report("%s: Failed to wake: %zx in %s (%s)",
> > -                     __func__, (size_t)client_addr, qemu_ram_get_idstr(rb),
> > -                     strerror(errno));
> > -    }
> > -    return ret;
> > +    return uffd_wakeup(pcfd->fd, (void *)ROUND_DOWN(client_addr, pagesize),
> > +                       pagesize);
> >  }
> 
> There's a build issue on i386:
> 
> ../migration/postcopy-ram.c: In function ‘postcopy_wake_shared’:
> ../migration/postcopy-ram.c:750:34: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>   750 |     return uffd_wakeup(pcfd->fd, (void *)ROUND_DOWN(client_addr, pagesize),
>       |                                  ^
> 
> The plan is to squash below fix:

Thanks!

Dave

> =========8<===========
> diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
> index 03a63ef5cd..83f6160a36 100644
> --- a/migration/postcopy-ram.c
> +++ b/migration/postcopy-ram.c
> -@@ -747,7 +747,8 @@ int postcopy_wake_shared(struct PostCopyFD *pcfd,
>  {
>      size_t pagesize = qemu_ram_pagesize(rb);
>      trace_postcopy_wake_shared(client_addr, qemu_ram_get_idstr(rb));
> -    return uffd_wakeup(pcfd->fd, (void *)ROUND_DOWN(client_addr, pagesize),
> +    return uffd_wakeup(pcfd->fd,
> +                       (void *)(uintptr_t)ROUND_DOWN(client_addr, pagesize),
>                         pagesize);
>  }
> =========8<===========
> 
> Thanks,
> 
> -- 
> Peter Xu
> 
-- 
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/


  reply	other threads:[~2024-09-30 20:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-19 13:46 [PATCH v2 0/7] Migration deadcode removal dave
2024-09-19 13:46 ` [PATCH v2 1/7] migration: Remove migrate_cap_set dave
2024-09-19 13:46 ` [PATCH v2 2/7] migration: Remove unused migrate_zero_blocks dave
2024-09-19 17:45   ` Peter Xu
2024-09-19 13:46 ` [PATCH v2 3/7] migration: Deprecate zero-blocks capability dave
2024-09-19 17:45   ` Peter Xu
2024-09-19 13:46 ` [PATCH v2 4/7] migration: Remove unused socket_send_channel_create_sync dave
2024-09-19 13:46 ` [PATCH v2 5/7] util/userfaultfd: Return -errno on error dave
2024-09-19 17:46   ` Peter Xu
2024-09-19 13:46 ` [PATCH v2 6/7] migration/postcopy: Use uffd helpers dave
2024-09-19 17:44   ` Peter Xu
2024-09-30 19:51   ` Peter Xu
2024-09-30 20:23     ` Dr. David Alan Gilbert [this message]
2024-09-19 13:46 ` [PATCH v2 7/7] util/userfaultfd: Remove unused uffd_poll_events dave
2024-09-19 17:44   ` Peter Xu
2024-09-20 15:34 ` [PATCH v2 0/7] Migration deadcode removal Peter Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZvsIxkKRvC8vN9ME@gallifrey \
    --to=dave@treblig.org \
    --cc=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=farosas@suse.de \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).