qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Steven Sistare <steven.sistare@oracle.com>
Cc: qemu-devel@nongnu.org, Fabiano Rosas <farosas@suse.de>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Jason Wang <jasowang@redhat.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	Cedric Le Goater <clg@redhat.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Marc-Andre Lureau <marcandre.lureau@redhat.com>,
	David Hildenbrand <david@redhat.com>
Subject: Re: [PATCH V2 03/11] migration: convert to NotifierWithReturn
Date: Wed, 17 Jan 2024 10:29:31 +0800	[thread overview]
Message-ID: <Zac7i3GscXHjO-Qa@x1n> (raw)
In-Reply-To: <d12792a3-1d34-4819-9f95-5cbddbacf1a0@oracle.com>

On Tue, Jan 16, 2024 at 03:35:53PM -0500, Steven Sistare wrote:
> On 1/15/2024 1:44 AM, Peter Xu wrote:
> > On Fri, Jan 12, 2024 at 07:05:02AM -0800, Steve Sistare wrote:
> >> Change all migration notifiers to type NotifierWithReturn, so notifiers
> >> can return an error status in a future patch.  For now, pass NULL for the
> >> notifier error parameter, and do not check the return value.
> >>
> >> Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
> >> ---
> >>  hw/net/virtio-net.c            |  4 +++-
> >>  hw/vfio/migration.c            |  4 +++-
> >>  include/hw/vfio/vfio-common.h  |  2 +-
> >>  include/hw/virtio/virtio-net.h |  2 +-
> >>  include/migration/misc.h       |  6 +++---
> >>  migration/migration.c          | 16 ++++++++--------
> >>  net/vhost-vdpa.c               |  6 ++++--
> >>  ui/spice-core.c                |  8 +++++---
> >>  8 files changed, 28 insertions(+), 20 deletions(-)
> >>
> >> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> >> index 7a2846f..9570353 100644
> >> --- a/hw/net/virtio-net.c
> >> +++ b/hw/net/virtio-net.c
> >> @@ -3529,11 +3529,13 @@ static void virtio_net_handle_migration_primary(VirtIONet *n, MigrationState *s)
> >>      }
> >>  }
> >>  
> >> -static void virtio_net_migration_state_notifier(Notifier *notifier, void *data)
> >> +static int virtio_net_migration_state_notifier(NotifierWithReturn *notifier,
> >> +                                               void *data, Error **errp)
> >>  {
> >>      MigrationState *s = data;
> >>      VirtIONet *n = container_of(notifier, VirtIONet, migration_state);
> >>      virtio_net_handle_migration_primary(n, s);
> >> +    return 0;
> >>  }
> > 
> > I should have mentioned this earlier.. we have a trend recently to modify
> > retval to boolean when Error** existed, e.g.:
> > 
> > https://lore.kernel.org/all/20231017202633.296756-5-peterx@redhat.com/
> > 
> > Let's start using boolean too here?  Previous patches may need touch-ups
> > too for this.
> > 
> > Other than that it all looks good here.  Thanks,
> 
> Boolean makes sense when there is only one way to recover from failure.
> However, when the notifier may fail in different ways, and recovery differs
> for each, then the function should return an int errno.  NotifierWithReturn
> could have future uses that need multiple return values and multiple recovery 
> paths above the notifier_with_return_list_notify level, so IMO the function 
> should continue to return int for generality.

Ah ok.  Please then add a comment either in the commit message or code for
that.  Thanks.

-- 
Peter Xu



  reply	other threads:[~2024-01-17  2:30 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-12 15:04 [PATCH V2 00/11] allow cpr-reboot for vfio Steve Sistare
2024-01-12 15:05 ` [PATCH V2 01/11] notify: pass error to notifier with return Steve Sistare
2024-01-15  6:38   ` Peter Xu
2024-01-12 15:05 ` [PATCH V2 02/11] migration: remove error from notifier data Steve Sistare
2024-01-15  6:38   ` Peter Xu
2024-01-12 15:05 ` [PATCH V2 03/11] migration: convert to NotifierWithReturn Steve Sistare
2024-01-15  6:44   ` Peter Xu
2024-01-16 20:35     ` Steven Sistare
2024-01-17  2:29       ` Peter Xu [this message]
2024-01-12 15:05 ` [PATCH V2 04/11] migration: remove migration_in_postcopy parameter Steve Sistare
2024-01-15  6:48   ` Peter Xu
2024-01-16 20:36     ` Steven Sistare
2024-01-12 15:05 ` [PATCH V2 05/11] migration: MigrationEvent for notifiers Steve Sistare
2024-01-12 15:18   ` Steven Sistare
2024-01-12 15:05 ` [PATCH V2 06/11] migration: MigrationNotifyFunc Steve Sistare
2024-01-12 15:05 ` [PATCH V2 07/11] migration: per-mode notifiers Steve Sistare
2024-01-12 15:05 ` [PATCH V2 08/11] migration: refactor migrate_fd_connect failures Steve Sistare
2024-01-15  7:37   ` Peter Xu
2024-01-16 20:35     ` Steven Sistare
2024-01-12 15:05 ` [PATCH V2 09/11] migration: notifier error checking Steve Sistare
2024-01-12 15:05 ` [PATCH V2 10/11] vfio: register container for cpr Steve Sistare
2024-01-12 15:05 ` [PATCH V2 11/11] vfio: allow cpr-reboot migration if suspended Steve Sistare
2024-01-15  7:33   ` Peter Xu
2024-01-16 20:37     ` Steven Sistare
2024-01-16 20:44       ` Steven Sistare
2024-01-17  7:12       ` Peter Xu
2024-01-17 21:30         ` Steven Sistare
2024-01-18  3:20           ` Peter Xu
2024-01-12 21:38 ` [PATCH V2 00/11] allow cpr-reboot for vfio Alex Williamson
2024-01-16 20:36   ` Steven Sistare
2024-01-15 10:48 ` David Hildenbrand
2024-01-15 10:51   ` David Hildenbrand

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=Zac7i3GscXHjO-Qa@x1n \
    --to=peterx@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=clg@redhat.com \
    --cc=david@redhat.com \
    --cc=farosas@suse.de \
    --cc=jasowang@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=steven.sistare@oracle.com \
    /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).