All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Avihai Horon <avihaih@nvidia.com>
Cc: "Fabiano Rosas" <farosas@suse.de>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Joao Martins" <joao.m.martins@oracle.com>,
	"Alex Williamson" <alex.williamson@redhat.com>,
	"Cédric Le Goater" <clg@redhat.com>,
	"Michael Roth" <michael.roth@amd.com>,
	"Eric Blake" <eblake@redhat.com>,
	"Maor Gottlieb" <maorg@nvidia.com>,
	qemu-devel@nongnu.org
Subject: Re: [PATCH 2/3] vfio/migration: Emit VFIO device migration state change QAPI event
Date: Tue, 7 May 2024 11:51:30 -0400	[thread overview]
Message-ID: <ZjpOAm3kXE-7Rg6G@x1n> (raw)
In-Reply-To: <23edb44a-7147-443e-b0e3-2a832aff5aa4@nvidia.com>

On Tue, May 07, 2024 at 10:47:13AM +0300, Avihai Horon wrote:
> > While at it, another trivial comment is maybe it's nice to have a helper to
> > both update the vfio migration state, plus emitting events when necessary.
> 
> I think vfio_migration_set_state() does exactly that, no?

Ah yes, looks so.  It's just that I saw some common patterns, like:

===8<===
@@ -126,11 +167,13 @@ static int vfio_migration_set_state(VFIODevice *vbasedev,
         }
 
         migration->device_state = recover_state;
+        vfio_migration_send_state_change_event(vbasedev);
 
         return ret;
     }
 
     migration->device_state = new_state;
+    vfio_migration_send_state_change_event(vbasedev);
     if (mig_state->data_fd != -1) {
         if (migration->data_fd != -1) {
             /*
@@ -157,6 +200,7 @@ reset_device:
     }
 
     migration->device_state = VFIO_DEVICE_STATE_RUNNING;
+    vfio_migration_send_state_change_event(vbasedev);
 
     return ret;
 }
===8<===

So maybe some more internal helpers?  It doesn't look like to cover all
updates to device_state, but I really didn't read into it.  Not a huge deal
really, feel free to keep it as-is if maintainers are happy.

Thanks,

-- 
Peter Xu



  reply	other threads:[~2024-05-07 15:52 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-30  5:16 [PATCH 0/3] qapi/vfio: Add VFIO device migration state change QAPI event Avihai Horon
2024-04-30  5:16 ` [PATCH 1/3] " Avihai Horon
2024-05-01 11:50   ` Joao Martins
2024-05-01 12:08     ` Avihai Horon
2024-05-06  4:52       ` Markus Armbruster
2024-05-06 10:07         ` Avihai Horon
2024-05-06 10:36           ` Markus Armbruster
2024-05-06 10:57             ` Avihai Horon
2024-05-02 11:19   ` Markus Armbruster
2024-05-05  7:48     ` Avihai Horon
2024-05-06  4:35       ` Markus Armbruster
2024-05-06  9:59         ` Avihai Horon
2024-04-30  5:16 ` [PATCH 2/3] vfio/migration: Emit " Avihai Horon
2024-05-01 11:50   ` Joao Martins
2024-05-01 12:28     ` Avihai Horon
2024-05-02 10:22       ` Joao Martins
2024-05-05  7:28         ` Avihai Horon
2024-05-06  4:56           ` Markus Armbruster
2024-05-06 14:38             ` Fabiano Rosas
2024-05-06 15:07               ` Peter Xu
2024-05-07  7:47                 ` Avihai Horon
2024-05-07 15:51                   ` Peter Xu [this message]
2024-05-07 16:21                     ` Avihai Horon
2024-04-30  5:16 ` [PATCH 3/3] vfio/migration: Don't emit STOP_COPY state change event twice Avihai Horon
2024-05-06 14:39   ` Cédric Le Goater
2024-05-06 15:01     ` Avihai Horon

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=ZjpOAm3kXE-7Rg6G@x1n \
    --to=peterx@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=armbru@redhat.com \
    --cc=avihaih@nvidia.com \
    --cc=clg@redhat.com \
    --cc=eblake@redhat.com \
    --cc=farosas@suse.de \
    --cc=joao.m.martins@oracle.com \
    --cc=maorg@nvidia.com \
    --cc=michael.roth@amd.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.