Avihai Horon <[email protected]> writes: > Currently, VFIO device migration event is sent after the device state > transition has been completed. However, it may be useful to additionally > send a "prepare" event before the state transition, to notify users that > it's about to happen. > > For example, in some cases with heavy resource utilization, stopping the > VFIO device may take a long time. In time-sensitive scenarios, the > management application that consumes the event may be notified about the > state transition too late. > > To overcome this issue, send an additional "prepare" migration event > before the device state transition. > > Signed-off-by: Avihai Horon <[email protected]> > --- > qapi/vfio.json | 33 +++++++++++++++++++++++++++++++++ > hw/vfio/migration.c | 18 +++++++++++++----- > 2 files changed, 46 insertions(+), 5 deletions(-) > > diff --git a/qapi/vfio.json b/qapi/vfio.json > index a1a9c5b673..de41211f1d 100644 > --- a/qapi/vfio.json > +++ b/qapi/vfio.json > @@ -66,3 +66,36 @@ > 'qom-path': 'str', > 'device-state': 'QapiVfioMigrationState' > } } > + > +## > +# @VFIO_MIGRATION_PREPARE: > +# > +# This event is emitted when a VFIO device migration state is about to > +# be changed. Note that even if this event is received for state X, > +# the VFIO device may transition to a different state if the original > +# state transition to X failed. > +# > +# @device-id: The device's id, if it has one. > +# > +# @qom-path: The device's QOM path. > +# > +# @device-state: The new device migration state that is about to be > +# changed. > +# > +# Since: 11.0 > +# > +# .. qmp-example:: > +# > +# <- { "timestamp": { "seconds": 1713771323, "microseconds": 212268 }, > +# "event": "VFIO_MIGRATION_PREPARE", > +# "data": { > +# "device-id": "vfio_dev1", > +# "qom-path": "/machine/peripheral/vfio_dev1", > +# "device-state": "stop" } } > +## > +{ 'event': 'VFIO_MIGRATION_PREPARE', > + 'data': { > + 'device-id': 'str', > + 'qom-path': 'str', > + 'device-state': 'QapiVfioMigrationState' > + } }
The QAPI schema is fine, so Acked-by: Markus Armbruster <[email protected]> Whether the event makes sense I have no idea. I'm leaving that judgement to the migration and VFIO maintainers.
