> -----Original Message-----
> From: Fabiano Rosas <faro...@suse.de>
> Sent: Saturday, December 2, 2023 2:01 AM
> To: Liu, Yuan1 <yuan1....@intel.com>; quint...@redhat.com;
> pet...@redhat.com; leob...@redhat.com
> Cc: qemu-devel@nongnu.org; Liu, Yuan1 <yuan1....@intel.com>; Zou, Nanhai
> <nanhai....@intel.com>
> Subject: Re: [PATCH v2 2/4] multifd: Implement multifd compression
> accelerator
>
> Yuan Liu <yuan1....@intel.com> writes:
>
> > when starting multifd live migration, if the compression method is
> > enabled, compression method can be accelerated using accelerators.
> >
> > Signed-off-by: Yuan Liu <yuan1....@intel.com>
> > Reviewed-by: Nanhai Zou <nanhai....@intel.com>
> > ---
> > migration/multifd.c | 38 ++++++++++++++++++++++++++++++++++++--
> > migration/multifd.h | 8 ++++++++
> > 2 files changed, 44 insertions(+), 2 deletions(-)
> >
> > diff --git a/migration/multifd.c b/migration/multifd.c index
> > 1fe53d3b98..7149e67867 100644
> > --- a/migration/multifd.c
> > +++ b/migration/multifd.c
> > @@ -165,6 +165,34 @@ static MultiFDMethods multifd_nocomp_ops = {
> > static MultiFDMethods *multifd_ops[MULTIFD_COMPRESSION__MAX] = {
> > [MULTIFD_COMPRESSION_NONE] = &multifd_nocomp_ops, };
> > +static MultiFDAccelMethods
> > +*accel_multifd_ops[MULTIFD_COMPRESSION_ACCEL__MAX];
> > +
> > +static MultiFDMethods *get_multifd_ops(void) {
> > + MultiFDCompression comp = migrate_multifd_compression();
> > + MultiFDCompressionAccel accel =
> > +migrate_multifd_compression_accel();
> > +
> > + if (comp == MULTIFD_COMPRESSION_NONE ||
> > + accel == MULTIFD_COMPRESSION_ACCEL_NONE) {
> > + return multifd_ops[comp];
> > + }
> > + if (accel == MULTIFD_COMPRESSION_ACCEL_AUTO) {
> > + for (int i = 0; i < MULTIFD_COMPRESSION_ACCEL__MAX; i++) {
> > + if (accel_multifd_ops[i] &&
> > + accel_multifd_ops[i]->is_supported(comp)) {
> > + return accel_multifd_ops[i]->get_multifd_methods();
> > + }
> > + }
> > + return multifd_ops[comp];
> > + }
> > +
> > + /* Check if a specified accelerator is available */
> > + if (accel_multifd_ops[accel] &&
>
> The CI is complaining that we might reach here with accel=2
> when !CONFIG_QPL. It seems the assert at migrate_multifd_compression_accel
> is not enough.
I will add assert to check both comp and accel next version in the
get_multifd_ops function.