All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marc-André Lureau" <marcandre.lureau@gmail.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: QEMU <qemu-devel@nongnu.org>
Subject: Re: [PATCH 08/34] meson, configure: move RDMA options to meson
Date: Wed, 20 Apr 2022 20:24:52 +0400	[thread overview]
Message-ID: <CAJ+F1C+uEBQt2a8gJcZKBOrGqOXDAFGbpNPvJJcLroJdsqR5rQ@mail.gmail.com> (raw)
In-Reply-To: <20220420153407.73926-9-pbonzini@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 13306 bytes --]

On Wed, Apr 20, 2022 at 7:55 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>

lgtm
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
>  configure                      | 115 ---------------------------------
>  contrib/rdmacm-mux/meson.build |   4 +-
>  meson.build                    |  56 ++++++++++++++--
>  meson_options.txt              |   4 ++
>  migration/meson.build          |   2 +-
>  scripts/meson-buildoptions.sh  |   6 ++
>  6 files changed, 62 insertions(+), 125 deletions(-)
>
> diff --git a/configure b/configure
> index c9be6eb04d..cfd15c3518 100755
> --- a/configure
> +++ b/configure
> @@ -301,8 +301,6 @@ vhost_vsock="$default_feature"
>  vhost_user="no"
>  vhost_user_fs="$default_feature"
>  vhost_vdpa="$default_feature"
> -rdma="$default_feature"
> -pvrdma="$default_feature"
>  debug_info="yes"
>  debug_tcg="no"
>  debug="no"
> @@ -972,14 +970,6 @@ for opt do
>    ;;
>    --tls-priority=*) tls_priority="$optarg"
>    ;;
> -  --enable-rdma) rdma="yes"
> -  ;;
> -  --disable-rdma) rdma="no"
> -  ;;
> -  --enable-pvrdma) pvrdma="yes"
> -  ;;
> -  --disable-pvrdma) pvrdma="no"
> -  ;;
>    --disable-vhost-user) vhost_user="no"
>    ;;
>    --enable-vhost-user) vhost_user="yes"
> @@ -1244,8 +1234,6 @@ cat << EOF
>    lto             Enable Link-Time Optimization.
>    safe-stack      SafeStack Stack Smash Protection. Depends on
>                    clang/llvm >= 3.7 and requires coroutine backend
> ucontext.
> -  rdma            Enable RDMA-based migration
> -  pvrdma          Enable PVRDMA support
>    vhost-net       vhost-net kernel acceleration support
>    vhost-vsock     virtio sockets device support
>    vhost-scsi      vhost-scsi kernel target support
> @@ -2037,100 +2025,6 @@ EOF
>    fi
>  fi
>
> -##########################################
> -# RDMA needs OpenFabrics libraries
> -if test "$rdma" != "no" ; then
> -  cat > $TMPC <<EOF
> -#include <rdma/rdma_cma.h>
> -int main(void) { return 0; }
> -EOF
> -  rdma_libs="-lrdmacm -libverbs -libumad"
> -  if compile_prog "" "$rdma_libs" ; then
> -    rdma="yes"
> -  else
> -    if test "$rdma" = "yes" ; then
> -        error_exit \
> -            " OpenFabrics librdmacm/libibverbs/libibumad not present." \
> -            " Your options:" \
> -            "  (1) Fast: Install infiniband packages (devel) from your
> distro." \
> -            "  (2) Cleanest: Install libraries from www.openfabrics.org"
> \
> -            "  (3) Also: Install softiwarp if you don't have RDMA
> hardware"
> -    fi
> -    rdma="no"
> -  fi
> -fi
> -
> -##########################################
> -# PVRDMA detection
> -
> -cat > $TMPC <<EOF &&
> -#include <sys/mman.h>
> -
> -int
> -main(void)
> -{
> -    char buf = 0;
> -    void *addr = &buf;
> -    addr = mremap(addr, 0, 1, MREMAP_MAYMOVE | MREMAP_FIXED);
> -
> -    return 0;
> -}
> -EOF
> -
> -if test "$rdma" = "yes" ; then
> -    case "$pvrdma" in
> -    "")
> -        if compile_prog "" ""; then
> -            pvrdma="yes"
> -        else
> -            pvrdma="no"
> -        fi
> -        ;;
> -    "yes")
> -        if ! compile_prog "" ""; then
> -            error_exit "PVRDMA is not supported since mremap is not
> implemented"
> -        fi
> -        pvrdma="yes"
> -        ;;
> -    "no")
> -        pvrdma="no"
> -        ;;
> -    esac
> -else
> -    if test "$pvrdma" = "yes" ; then
> -        error_exit "PVRDMA requires rdma suppport"
> -    fi
> -    pvrdma="no"
> -fi
> -
> -# Let's see if enhanced reg_mr is supported
> -if test "$pvrdma" = "yes" ; then
> -
> -cat > $TMPC <<EOF &&
> -#include <infiniband/verbs.h>
> -
> -int
> -main(void)
> -{
> -    struct ibv_mr *mr;
> -    struct ibv_pd *pd = NULL;
> -    size_t length = 10;
> -    uint64_t iova = 0;
> -    int access = 0;
> -    void *addr = NULL;
> -
> -    mr = ibv_reg_mr_iova(pd, addr, length, iova, access);
> -
> -    ibv_dereg_mr(mr);
> -
> -    return 0;
> -}
> -EOF
> -    if ! compile_prog "" "-libverbs"; then
> -        QEMU_CFLAGS="$QEMU_CFLAGS -DLEGACY_RDMA_REG_MR"
> -    fi
> -fi
> -
>  ##########################################
>  # glib support probe
>
> @@ -2855,15 +2749,6 @@ if test "$have_tsan" = "yes" && test
> "$have_tsan_iface_fiber" = "yes" ; then
>      echo "CONFIG_TSAN=y" >> $config_host_mak
>  fi
>
> -if test "$rdma" = "yes" ; then
> -  echo "CONFIG_RDMA=y" >> $config_host_mak
> -  echo "RDMA_LIBS=$rdma_libs" >> $config_host_mak
> -fi
> -
> -if test "$pvrdma" = "yes" ; then
> -  echo "CONFIG_PVRDMA=y" >> $config_host_mak
> -fi
> -
>  if test "$plugins" = "yes" ; then
>      echo "CONFIG_PLUGIN=y" >> $config_host_mak
>  fi
> diff --git a/contrib/rdmacm-mux/meson.build
> b/contrib/rdmacm-mux/meson.build
> index 7674f54cc5..36c9c89630 100644
> --- a/contrib/rdmacm-mux/meson.build
> +++ b/contrib/rdmacm-mux/meson.build
> @@ -1,7 +1,5 @@
> -if 'CONFIG_PVRDMA' in config_host
> -  # if not found, CONFIG_PVRDMA should not be set
> +if have_pvrdma
>    # FIXME: broken on big endian architectures
> -  libumad = cc.find_library('ibumad', required: true)
>    executable('rdmacm-mux', files('main.c'), genh,
>               dependencies: [glib, libumad],
>               build_by_default: false,
> diff --git a/meson.build b/meson.build
> index f53fd66716..bdee186702 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1217,9 +1217,22 @@ if numa.found() and not cc.links('''
>  endif
>
>  rdma = not_found
> -if 'CONFIG_RDMA' in config_host
> -  rdma = declare_dependency(link_args: config_host['RDMA_LIBS'].split())
> +if not get_option('rdma').auto() or have_system
> +  libumad = cc.find_library('ibumad', required: get_option('rdma'))
> +  rdma_libs = [cc.find_library('rdmacm', has_headers: ['rdma/rdma_cma.h'],
> +                               required: get_option('rdma'),
> +                               kwargs: static_kwargs),
> +               cc.find_library('ibverbs', required: get_option('rdma'),
> +                               kwargs: static_kwargs),
> +               libumad]
> +  rdma = declare_dependency(dependencies: rdma_libs)
> +  foreach lib: rdma_libs
> +    if not lib.found()
> +      rdma = not_found
> +    endif
> +  endforeach
>  endif
> +
>  xen = not_found
>  if 'CONFIG_XEN_BACKEND' in config_host
>    xen = declare_dependency(compile_args:
> config_host['XEN_CFLAGS'].split(),
> @@ -1552,6 +1565,7 @@ config_host_data.set('CONFIG_NUMA', numa.found())
>  config_host_data.set('CONFIG_OPENGL', opengl.found())
>  config_host_data.set('CONFIG_PROFILER', get_option('profiler'))
>  config_host_data.set('CONFIG_RBD', rbd.found())
> +config_host_data.set('CONFIG_RDMA', rdma.found())
>  config_host_data.set('CONFIG_SDL', sdl.found())
>  config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
>  config_host_data.set('CONFIG_SECCOMP', seccomp.found())
> @@ -1650,7 +1664,7 @@ config_host_data.set('HAVE_SYSTEM_FUNCTION',
> cc.has_function('system', prefix: '
>  if rdma.found()
>    config_host_data.set('HAVE_IBV_ADVISE_MR',
>                         cc.has_function('ibv_advise_mr',
> -                                       args:
> config_host['RDMA_LIBS'].split(),
> +                                       dependencies: rdma,
>                                         prefix: '#include
> <infiniband/verbs.h>'))
>  endif
>
> @@ -1970,6 +1984,36 @@ config_host_data.set('CONFIG_AVX512F_OPT',
> get_option('avx512f') \
>      int main(int argc, char *argv[]) { return bar(argv[0]); }
>    '''), error_message: 'AVX512F not available').allowed())
>
> +have_pvrdma = get_option('pvrdma') \
> +  .require(rdma.found(), error_message: 'PVRDMA requires OpenFabrics
> libraries') \
> +  .require(cc.compiles('''
> +    int main(void)
> +    {
> +      char buf = 0;
> +      void *addr = &buf;
> +      addr = mremap(addr, 0, 1, MREMAP_MAYMOVE | MREMAP_FIXED);
> +
> +      return 0;
> +    }'''), error_message: 'PVRDMA requires mremap').allowed()
> +
> +if have_pvrdma
> +  config_host_data.set('LEGACY_RDMA_REG_MR', not cc.compiles('''
> +    #include <infiniband/verbs.h>
> +    int main(void)
> +    {
> +      struct ibv_mr *mr;
> +      struct ibv_pd *pd = NULL;
> +      size_t length = 10;
> +      uint64_t iova = 0;
> +      int access = 0;
> +      void *addr = NULL;
> +
> +      mr = ibv_reg_mr_iova(pd, addr, length, iova, access);
> +      ibv_dereg_mr(mr);
> +      return 0;
> +    }'''))
> +endif
> +
>  if get_option('membarrier').disabled()
>    have_membarrier = false
>  elif targetos == 'windows'
> @@ -2092,7 +2136,7 @@ host_kconfig = \
>    ('CONFIG_VHOST_KERNEL' in config_host ? ['CONFIG_VHOST_KERNEL=y'] : [])
> + \
>    (have_virtfs ? ['CONFIG_VIRTFS=y'] : []) + \
>    ('CONFIG_LINUX' in config_host ? ['CONFIG_LINUX=y'] : []) + \
> -  ('CONFIG_PVRDMA' in config_host ? ['CONFIG_PVRDMA=y'] : []) + \
> +  (have_pvrdma ? ['CONFIG_PVRDMA=y'] : []) + \
>    (multiprocess_allowed ? ['CONFIG_MULTIPROCESS_ALLOWED=y'] : [])
>
>  ignored = [ 'TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_ARCH' ]
> @@ -3686,8 +3730,8 @@ summary_info += {'l2tpv3 support':    have_l2tpv3}
>  summary_info += {'Linux AIO support': libaio}
>  summary_info += {'Linux io_uring support': linux_io_uring}
>  summary_info += {'ATTR/XATTR support': libattr}
> -summary_info += {'RDMA support':      config_host.has_key('CONFIG_RDMA')}
> -summary_info += {'PVRDMA support':
> config_host.has_key('CONFIG_PVRDMA')}
> +summary_info += {'RDMA support':      rdma}
> +summary_info += {'PVRDMA support':    have_pvrdma}
>  summary_info += {'fdt support':       fdt_opt == 'disabled' ? false :
> fdt_opt}
>  summary_info += {'libcap-ng support': libcap_ng}
>  summary_info += {'bpf support':       libbpf}
> diff --git a/meson_options.txt b/meson_options.txt
> index bd8efe4fbf..c00e0866e9 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -151,6 +151,10 @@ option('rbd', type : 'feature', value : 'auto',
>         description: 'Ceph block device driver')
>  option('opengl', type : 'feature', value : 'auto',
>         description: 'OpenGL support')
> +option('rdma', type : 'feature', value : 'auto',
> +       description: 'Enable RDMA-based migration')
> +option('pvrdma', type : 'feature', value : 'auto',
> +       description: 'Enable PVRDMA support')
>  option('gtk', type : 'feature', value : 'auto',
>         description: 'GTK+ user interface')
>  option('sdl', type : 'feature', value : 'auto',
> diff --git a/migration/meson.build b/migration/meson.build
> index 8b5ca5c047..6880b61b10 100644
> --- a/migration/meson.build
> +++ b/migration/meson.build
> @@ -27,7 +27,7 @@ softmmu_ss.add(files(
>    'tls.c',
>  ), gnutls)
>
> -softmmu_ss.add(when: ['CONFIG_RDMA', rdma], if_true: files('rdma.c'))
> +softmmu_ss.add(when: rdma, if_true: files('rdma.c'))
>  if get_option('live_block_migration').allowed()
>    softmmu_ss.add(files('block.c'))
>  endif
> diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
> index f91bd9231b..cd922614e8 100644
> --- a/scripts/meson-buildoptions.sh
> +++ b/scripts/meson-buildoptions.sh
> @@ -95,10 +95,12 @@ meson_options_help() {
>    printf "%s\n" '  oss             OSS sound support'
>    printf "%s\n" '  pa              PulseAudio sound support'
>    printf "%s\n" '  parallels       parallels image format support'
> +  printf "%s\n" '  pvrdma          Enable PVRDMA support'
>    printf "%s\n" '  qcow1           qcow1 image format support'
>    printf "%s\n" '  qed             qed image format support'
>    printf "%s\n" '  qga-vss         build QGA VSS support (broken with
> MinGW)'
>    printf "%s\n" '  rbd             Ceph block device driver'
> +  printf "%s\n" '  rdma            Enable RDMA-based migration'
>    printf "%s\n" '  replication     replication support'
>    printf "%s\n" '  sdl             SDL user interface'
>    printf "%s\n" '  sdl-image       SDL Image support for icons'
> @@ -282,6 +284,8 @@ _meson_option_parse() {
>      --disable-parallels) printf "%s" -Dparallels=disabled ;;
>      --enable-profiler) printf "%s" -Dprofiler=true ;;
>      --disable-profiler) printf "%s" -Dprofiler=false ;;
> +    --enable-pvrdma) printf "%s" -Dpvrdma=enabled ;;
> +    --disable-pvrdma) printf "%s" -Dpvrdma=disabled ;;
>      --enable-qcow1) printf "%s" -Dqcow1=enabled ;;
>      --disable-qcow1) printf "%s" -Dqcow1=disabled ;;
>      --enable-qed) printf "%s" -Dqed=enabled ;;
> @@ -292,6 +296,8 @@ _meson_option_parse() {
>      --disable-qom-cast-debug) printf "%s" -Dqom_cast_debug=false ;;
>      --enable-rbd) printf "%s" -Drbd=enabled ;;
>      --disable-rbd) printf "%s" -Drbd=disabled ;;
> +    --enable-rdma) printf "%s" -Drdma=enabled ;;
> +    --disable-rdma) printf "%s" -Drdma=disabled ;;
>      --enable-replication) printf "%s" -Dreplication=enabled ;;
>      --disable-replication) printf "%s" -Dreplication=disabled ;;
>      --enable-rng-none) printf "%s" -Drng_none=true ;;
> --
> 2.35.1
>
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 17528 bytes --]

  reply	other threads:[~2022-04-20 16:55 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
2022-04-20 15:33 ` [PATCH 01/34] meson: show final set of compiler flags Paolo Bonzini
2022-04-20 15:57   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 02/34] configure: remove dead code Paolo Bonzini
2022-04-20 16:04   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 03/34] qga: wixl: get path to sysroot from pkg-config as intended Paolo Bonzini
2022-04-20 15:47   ` Marc-André Lureau
2022-04-21 14:18   ` Konstantin Kostiuk
2022-04-20 15:33 ` [PATCH 04/34] configure: pc-bios/qemu-icon.bmp does not exist Paolo Bonzini
2022-04-20 15:47   ` Thomas Huth
2022-04-20 16:05   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 05/34] configure: gcov should not exclude fortify-source Paolo Bonzini
2022-04-20 16:06   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 06/34] configure: move --enable/--disable-debug-info to second option parsing pass Paolo Bonzini
2022-04-20 15:42   ` Thomas Huth
2022-04-20 16:08   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 07/34] configure, meson: move OpenGL check to meson Paolo Bonzini
2022-04-20 16:13   ` Marc-André Lureau
2022-04-20 19:17     ` Paolo Bonzini
2022-04-20 15:33 ` [PATCH 08/34] meson, configure: move RDMA options " Paolo Bonzini
2022-04-20 16:24   ` Marc-André Lureau [this message]
2022-04-20 15:33 ` [PATCH 09/34] meson, configure: move keyctl test " Paolo Bonzini
2022-04-20 16:27   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 10/34] meson, configure: move usbfs " Paolo Bonzini
2022-04-20 16:35   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 11/34] meson, configure: move libgio " Paolo Bonzini
2022-04-20 16:40   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 12/34] meson: move CONFIG_XEN_PCI_PASSTHROUGH to config-host.h Paolo Bonzini
2022-04-20 16:45   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 13/34] meson, configure: move --enable-module-upgrades to meson Paolo Bonzini
2022-04-20 18:05   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 14/34] meson, configure: move Xen detection " Paolo Bonzini
2022-04-20 15:33 ` [PATCH 15/34] meson-buildoptions: add support for string options Paolo Bonzini
2022-04-20 18:14   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 16/34] configure, meson: move iasl detection to meson Paolo Bonzini
2022-04-20 18:17   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 17/34] configure: move Windows flags " Paolo Bonzini
2022-04-20 18:20   ` Marc-André Lureau
2022-04-20 19:15     ` Paolo Bonzini
2022-04-20 15:33 ` [PATCH 18/34] configure: switch string options to automatic parsing Paolo Bonzini
2022-04-20 18:23   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 19/34] meson, configure: move --tls-priority to meson Paolo Bonzini
2022-04-20 18:25   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 20/34] meson, configure: move bdrv whitelists " Paolo Bonzini
2022-04-20 18:28   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 21/34] meson, configure: move --with-pkgversion, CONFIG_STAMP " Paolo Bonzini
2022-04-20 18:34   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 22/34] meson, configure: move --interp-prefix " Paolo Bonzini
2022-04-20 18:40   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 23/34] meson: always combine directories with prefix Paolo Bonzini
2022-04-20 18:43   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 24/34] configure: switch directory options to automatic parsing Paolo Bonzini
2022-04-21  9:48   ` Marc-André Lureau
2022-04-21 12:02     ` Paolo Bonzini
2022-04-20 15:33 ` [PATCH 25/34] meson: pass more options directly as -D Paolo Bonzini
2022-04-21  9:52   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 26/34] configure: omit options with default values from meson command line Paolo Bonzini
2022-04-21 10:04   ` Marc-André Lureau
2022-04-20 15:34 ` [PATCH 27/34] meson, virtio: place all virtio-pci devices under virtio_pci_ss Paolo Bonzini
2022-04-21 10:05   ` Marc-André Lureau
2022-04-20 15:34 ` [PATCH 28/34] configure: simplify vhost-net-{user, vdpa} configuration Paolo Bonzini
2022-04-21 10:08   ` Marc-André Lureau
2022-04-20 15:34 ` [PATCH 29/34] build: move vhost-vsock configuration to Kconfig Paolo Bonzini
2022-04-21 11:38   ` Marc-André Lureau
2022-04-20 15:34 ` [PATCH 30/34] build: move vhost-scsi " Paolo Bonzini
2022-04-21 11:47   ` Marc-André Lureau
2022-04-20 15:34 ` [PATCH 31/34] build: move vhost-user-fs " Paolo Bonzini
2022-04-21 11:48   ` Marc-André Lureau
2022-04-20 15:34 ` [PATCH 32/34] meson: create have_vhost_* variables Paolo Bonzini
2022-04-21 12:01   ` Marc-André Lureau
2022-04-20 15:34 ` [PATCH 33/34] meson: use have_vhost_* variables to pick sources Paolo Bonzini
2022-04-21 12:08   ` Marc-André Lureau
2022-04-20 15:34 ` [PATCH 34/34] configure, meson: move vhost options to Meson Paolo Bonzini
2022-04-21 12:13   ` Marc-André Lureau

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=CAJ+F1C+uEBQt2a8gJcZKBOrGqOXDAFGbpNPvJJcLroJdsqR5rQ@mail.gmail.com \
    --to=marcandre.lureau@gmail.com \
    --cc=pbonzini@redhat.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.