From b927ab15198533e507a4d3d335e5dfdf21201149 Mon Sep 17 00:00:00 2001 From: Mark Pryor Date: Fri, 12 Aug 2022 18:32:25 -0700 Subject: [PATCH 1107/1110] meson configure move RDMA options to meson --- configure | 115 --------------------------------- contrib/tools/qemu-xen/rdmacm-mux/meson.build | 4 +- meson.build | 56 ++++++++++++++-- meson_options.txt | 4 ++ migration/meson.build | 2 +- scripts/meson-buildoptions.sh | 8 +++ 6 files changed, 64 insertions(+), 125 deletions(-) diff --git a/tools/qemu-xen/configure b/tools/qemu-xen/configure index 2a1eb8a76e..a75088514d 100755 --- a/tools/qemu-xen/configure +++ b/tools/qemu-xen/configure @@ -302,8 +302,6 @@ vhost_vsock="$default_feature" vhost_user="no" vhost_user_fs="$default_feature" vhost_vdpa="$default_feature" -rdma="$default_feature" -pvrdma="$default_feature" debug_tcg="no" debug="no" sanitizers="no" @@ -978,14 +976,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" @@ -1250,8 +1240,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 @@ -2043,100 +2043,6 @@ EOF fi fi -########################################## -# RDMA needs OpenFabrics libraries -if test "$rdma" != "no" ; then - cat > $TMPC < -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 < - -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 < - -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 @@ -2866,15 +2760,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/tools/qemu-xen/contrib/tools/qemu-xen/rdmacm-mux/meson.build b/contrib/rdmacm-mux/meson.build index 7674f54cc5..36c9c89630 100644 --- a/tools/qemu-xen/contrib/tools/qemu-xen/rdmacm-mux/meson.build +++ b/tools/qemu-xen/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/tools/qemu-xen/meson.build b/tools/qemu-xen/meson.build index 67a2cad95c..f909908ed2 100644 --- a/tools/qemu-xen/meson.build +++ b/tools/qemu-xen/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()) @@ -1652,7 +1666,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 ')) endif @@ -1963,6 +1977,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 + 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' @@ -2116,7 +2160,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' ] @@ -3705,8 +3749,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/tools/qemu-xen/meson_options.txt b/tools/qemu-xen/meson_options.txt index bd8efe4fbf..c00e0866e9 100644 --- a/tools/qemu-xen/meson_options.txt +++ b/tools/qemu-xen/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/tools/qemu-xen/migration/meson.build b/tools/qemu-xen/migration/meson.build index 8b5ca5c047..6880b61b10 100644 --- a/tools/qemu-xen/migration/meson.build +++ b/tools/qemu-xen/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/tools/qemu-xen/scripts/meson-buildoptions.sh b/tools/qemu-xen/scripts/meson-buildoptions.sh index f91bd9231b..47338da89d 100644 --- a/tools/qemu-xen/scripts/meson-buildoptions.sh +++ b/tools/qemu-xen/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,10 @@ _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-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 +298,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.37.1