[PATCH v3 15/24] migration/multifd: Add migration_has_device_state_support()

Maciej S. Szmigiero posted 24 patches 1 year, 2 months ago
There is a newer version of this series
[PATCH v3 15/24] migration/multifd: Add migration_has_device_state_support()
Posted by Maciej S. Szmigiero 1 year, 2 months ago
From: "Maciej S. Szmigiero" <maciej.szmigiero@oracle.com>

Since device state transfer via multifd channels requires multifd
channels with packets and is currently not compatible with multifd
compression add an appropriate query function so device can learn
whether it can actually make use of it.

Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
---
 include/migration/misc.h         | 1 +
 migration/multifd-device-state.c | 7 +++++++
 2 files changed, 8 insertions(+)

diff --git a/include/migration/misc.h b/include/migration/misc.h
index 118e205bbcc6..43558d9198f7 100644
--- a/include/migration/misc.h
+++ b/include/migration/misc.h
@@ -112,5 +112,6 @@ bool migration_in_bg_snapshot(void);
 /* migration/multifd-device-state.c */
 bool multifd_queue_device_state(char *idstr, uint32_t instance_id,
                                 char *data, size_t len);
+bool migration_has_device_state_support(void);
 
 #endif
diff --git a/migration/multifd-device-state.c b/migration/multifd-device-state.c
index 8cf5a6c2668c..bcbea926b6be 100644
--- a/migration/multifd-device-state.c
+++ b/migration/multifd-device-state.c
@@ -11,6 +11,7 @@
 #include "qemu/lockable.h"
 #include "migration/misc.h"
 #include "multifd.h"
+#include "options.h"
 
 static QemuMutex queue_job_mutex;
 
@@ -99,3 +100,9 @@ bool multifd_queue_device_state(char *idstr, uint32_t instance_id,
 
     return true;
 }
+
+bool migration_has_device_state_support(void)
+{
+    return migrate_multifd() && !migrate_mapped_ram() &&
+        migrate_multifd_compression() == MULTIFD_COMPRESSION_NONE;
+}
Re: [PATCH v3 15/24] migration/multifd: Add migration_has_device_state_support()
Posted by Avihai Horon 1 year, 2 months ago
On 17/11/2024 21:20, Maciej S. Szmigiero wrote:
> External email: Use caution opening links or attachments
>
>
> From: "Maciej S. Szmigiero" <maciej.szmigiero@oracle.com>
>
> Since device state transfer via multifd channels requires multifd
> channels with packets and is currently not compatible with multifd
> compression add an appropriate query function so device can learn
> whether it can actually make use of it.
>
> Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
> ---
>   include/migration/misc.h         | 1 +
>   migration/multifd-device-state.c | 7 +++++++
>   2 files changed, 8 insertions(+)
>
> diff --git a/include/migration/misc.h b/include/migration/misc.h
> index 118e205bbcc6..43558d9198f7 100644
> --- a/include/migration/misc.h
> +++ b/include/migration/misc.h
> @@ -112,5 +112,6 @@ bool migration_in_bg_snapshot(void);
>   /* migration/multifd-device-state.c */
>   bool multifd_queue_device_state(char *idstr, uint32_t instance_id,
>                                   char *data, size_t len);
> +bool migration_has_device_state_support(void);

Nit: maybe rename to multifd_device_state_supported or 
migration_multifd_device_state_supported, as it's specifically related 
to multifd?

Thanks.

>
>   #endif
> diff --git a/migration/multifd-device-state.c b/migration/multifd-device-state.c
> index 8cf5a6c2668c..bcbea926b6be 100644
> --- a/migration/multifd-device-state.c
> +++ b/migration/multifd-device-state.c
> @@ -11,6 +11,7 @@
>   #include "qemu/lockable.h"
>   #include "migration/misc.h"
>   #include "multifd.h"
> +#include "options.h"
>
>   static QemuMutex queue_job_mutex;
>
> @@ -99,3 +100,9 @@ bool multifd_queue_device_state(char *idstr, uint32_t instance_id,
>
>       return true;
>   }
> +
> +bool migration_has_device_state_support(void)
> +{
> +    return migrate_multifd() && !migrate_mapped_ram() &&
> +        migrate_multifd_compression() == MULTIFD_COMPRESSION_NONE;
> +}
Re: [PATCH v3 15/24] migration/multifd: Add migration_has_device_state_support()
Posted by Maciej S. Szmigiero 1 year, 2 months ago
On 28.11.2024 11:33, Avihai Horon wrote:
> 
> On 17/11/2024 21:20, Maciej S. Szmigiero wrote:
>> External email: Use caution opening links or attachments
>>
>>
>> From: "Maciej S. Szmigiero" <maciej.szmigiero@oracle.com>
>>
>> Since device state transfer via multifd channels requires multifd
>> channels with packets and is currently not compatible with multifd
>> compression add an appropriate query function so device can learn
>> whether it can actually make use of it.
>>
>> Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
>> ---
>>   include/migration/misc.h         | 1 +
>>   migration/multifd-device-state.c | 7 +++++++
>>   2 files changed, 8 insertions(+)
>>
>> diff --git a/include/migration/misc.h b/include/migration/misc.h
>> index 118e205bbcc6..43558d9198f7 100644
>> --- a/include/migration/misc.h
>> +++ b/include/migration/misc.h
>> @@ -112,5 +112,6 @@ bool migration_in_bg_snapshot(void);
>>   /* migration/multifd-device-state.c */
>>   bool multifd_queue_device_state(char *idstr, uint32_t instance_id,
>>                                   char *data, size_t len);
>> +bool migration_has_device_state_support(void);
> 
> Nit: maybe rename to multifd_device_state_supported or migration_multifd_device_state_supported, as it's specifically related to multifd?

Sure, will do.
  
> Thanks.

Thanks,
Maciej


Re: [PATCH v3 15/24] migration/multifd: Add migration_has_device_state_support()
Posted by Peter Xu 1 year, 2 months ago
On Thu, Nov 28, 2024 at 01:12:01PM +0100, Maciej S. Szmigiero wrote:
> On 28.11.2024 11:33, Avihai Horon wrote:
> > 
> > On 17/11/2024 21:20, Maciej S. Szmigiero wrote:
> > > External email: Use caution opening links or attachments
> > > 
> > > 
> > > From: "Maciej S. Szmigiero" <maciej.szmigiero@oracle.com>
> > > 
> > > Since device state transfer via multifd channels requires multifd
> > > channels with packets and is currently not compatible with multifd
> > > compression add an appropriate query function so device can learn
> > > whether it can actually make use of it.
> > > 
> > > Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
> > > ---
> > >   include/migration/misc.h         | 1 +
> > >   migration/multifd-device-state.c | 7 +++++++
> > >   2 files changed, 8 insertions(+)
> > > 
> > > diff --git a/include/migration/misc.h b/include/migration/misc.h
> > > index 118e205bbcc6..43558d9198f7 100644
> > > --- a/include/migration/misc.h
> > > +++ b/include/migration/misc.h
> > > @@ -112,5 +112,6 @@ bool migration_in_bg_snapshot(void);
> > >   /* migration/multifd-device-state.c */
> > >   bool multifd_queue_device_state(char *idstr, uint32_t instance_id,
> > >                                   char *data, size_t len);
> > > +bool migration_has_device_state_support(void);
> > 
> > Nit: maybe rename to multifd_device_state_supported or migration_multifd_device_state_supported, as it's specifically related to multifd?
> 
> Sure, will do.

With that, feel free to take:

Reviewed-by: Peter Xu <peterx@redhat.com>

-- 
Peter Xu


Re: [PATCH v3 15/24] migration/multifd: Add migration_has_device_state_support()
Posted by Fabiano Rosas 1 year, 2 months ago
"Maciej S. Szmigiero" <mail@maciej.szmigiero.name> writes:

> From: "Maciej S. Szmigiero" <maciej.szmigiero@oracle.com>
>
> Since device state transfer via multifd channels requires multifd
> channels with packets and is currently not compatible with multifd
> compression add an appropriate query function so device can learn
> whether it can actually make use of it.
>
> Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>

Reviewed-by: Fabiano Rosas <farosas@suse.de>