From nobody Tue Dec 16 16:20:41 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600425575; cv=none; d=zohomail.com; s=zohoarc; b=G5VmUyz+OYhhmFpeDiOBG0gkNMU7UBdpsn1lU2pE2IORhfJfvOv214OCvadakUc/jdge9jx3D3X+3OR29EJYzBoCulhp4Oh7B3TBEHFyb32UjU6RyKH9C1LjNEDp7YErNMeft/QqZNXVqbg5WISP5mZe1oOGsui0SRTyfxsdnSM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600425575; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=l8xsYRMIJIJ4m0Wt8HkaSObhML2H8Bi0LBSCXpQJyHI=; b=m6vBhwB33IXWNRjK+lksDA8KCc9rhYT79Qjyu61OmMp7Wk2e4Ecq9X0/xopGhadOtyQFwE8K2x2CSV1C3eJ467qdfZG6t/DAIR6tXLa3rMGKGlSCAc2K/uuCi2tH0QW1MALDWaY8gXCXlv4pvmG0PUwBhvJJzMLAVgK6Yyi5xvg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600425575768840.7215457192029; Fri, 18 Sep 2020 03:39:35 -0700 (PDT) Received: from localhost ([::1]:42286 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJDnh-0006Zn-TE for importer@patchew.org; Fri, 18 Sep 2020 06:39:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34176) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJDj6-00024h-81 for qemu-devel@nongnu.org; Fri, 18 Sep 2020 06:34:49 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:50862 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kJDj3-0005Bz-GQ for qemu-devel@nongnu.org; Fri, 18 Sep 2020 06:34:47 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-311-dt5s5lg2OJCIL5ZmvAh16A-1; Fri, 18 Sep 2020 06:34:42 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5065F1084C93; Fri, 18 Sep 2020 10:34:41 +0000 (UTC) Received: from thuth.com (ovpn-112-53.ams2.redhat.com [10.36.112.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id BE0146198D; Fri, 18 Sep 2020 10:34:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600425284; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type:in-reply-to:in-reply-to: references:references; bh=l8xsYRMIJIJ4m0Wt8HkaSObhML2H8Bi0LBSCXpQJyHI=; b=IqUYh7e+vhvjh2wb1o2dFA/TDBjElMQDZcEeLXKxUaB8eFiNmtpxC0M4LdP48LUCE+tat5 +z7FuDWvqHks0jbbGmtu2i7O88aty6b55RmzjOUP4tYtKBCwq2uWR99/VKBWoLE9pAEzo1 7qnLfXz+roGy1PO7j4j3/Btp0sV4pz4= X-MC-Unique: dt5s5lg2OJCIL5ZmvAh16A-1 From: Thomas Huth To: =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org Subject: [PATCH 2/6] meson: move libmpathpersist test Date: Fri, 18 Sep 2020 12:34:26 +0200 Message-Id: <20200918103430.297167-3-thuth@redhat.com> In-Reply-To: <20200918103430.297167-1-thuth@redhat.com> References: <20200918103430.297167-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=thuth@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=thuth@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/18 03:47:33 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -50 X-Spam_score: -5.1 X-Spam_bar: ----- X-Spam_report: (-5.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.997, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Paolo Bonzini This is the first compiler/linker test that has been moved to Meson. Add more section headings to keep things clearer. Signed-off-by: Paolo Bonzini [thuth: Add check for mpathpersist.found() before showing mpathpersist_new_= api] Signed-off-by: Thomas Huth --- configure | 77 +++----------------------------------------- meson.build | 82 ++++++++++++++++++++++++++++++++++++++++++----- meson_options.txt | 2 ++ 3 files changed, 80 insertions(+), 81 deletions(-) diff --git a/configure b/configure index d8bd6829b3..df36ce6ab8 100755 --- a/configure +++ b/configure @@ -403,7 +403,7 @@ netmap=3D"no" sdl=3D"auto" sdl_image=3D"auto" virtfs=3D"" -mpath=3D"" +mpath=3D"auto" vnc=3D"enabled" sparse=3D"no" vde=3D"" @@ -1116,9 +1116,9 @@ for opt do ;; --enable-virtfs) virtfs=3D"yes" ;; - --disable-mpath) mpath=3D"no" + --disable-mpath) mpath=3D"disabled" ;; - --enable-mpath) mpath=3D"yes" + --enable-mpath) mpath=3D"enabled" ;; --disable-vnc) vnc=3D"disabled" ;; @@ -3848,57 +3848,6 @@ if test "$modules" =3D yes; then fi fi =20 -########################################## -# libmpathpersist probe - -if test "$mpath" !=3D "no" ; then - # probe for the new API - cat > $TMPC < -#include -unsigned mpath_mx_alloc_len =3D 1024; -int logsink; -static struct config *multipath_conf; -extern struct udev *udev; -extern struct config *get_multipath_config(void); -extern void put_multipath_config(struct config *conf); -struct udev *udev; -struct config *get_multipath_config(void) { return multipath_conf; } -void put_multipath_config(struct config *conf) { } - -int main(void) { - udev =3D udev_new(); - multipath_conf =3D mpath_lib_init(); - return 0; -} -EOF - if compile_prog "" "-ludev -lmultipath -lmpathpersist" ; then - mpathpersist=3Dyes - mpathpersist_new_api=3Dyes - else - # probe for the old API - cat > $TMPC < -#include -unsigned mpath_mx_alloc_len =3D 1024; -int logsink; -int main(void) { - struct udev *udev =3D udev_new(); - mpath_lib_init(udev); - return 0; -} -EOF - if compile_prog "" "-ludev -lmultipath -lmpathpersist" ; then - mpathpersist=3Dyes - mpathpersist_new_api=3Dno - else - mpathpersist=3Dno - fi - fi -else - mpathpersist=3Dno -fi - ########################################## # pthread probe PTHREADLIBS_LIST=3D"-pthread -lpthread -lpthreadGC2" @@ -6340,23 +6289,11 @@ if test "$softmmu" =3D yes ; then fi virtfs=3Dno fi - if test "$mpath" !=3D no && test "$mpathpersist" =3D yes ; then - mpath=3Dyes - else - if test "$mpath" =3D yes; then - error_exit "Multipath requires libmpathpersist devel" - fi - mpath=3Dno - fi else if test "$virtfs" =3D yes; then error_exit "VirtFS is supported only on Linux" fi virtfs=3Dno - if test "$mpath" =3D yes; then - error_exit "Multipath is supported only on Linux" - fi - mpath=3Dno fi fi =20 @@ -6897,12 +6834,6 @@ fi if test "$virtfs" =3D "yes" ; then echo "CONFIG_VIRTFS=3Dy" >> $config_host_mak fi -if test "$mpath" =3D "yes" ; then - echo "CONFIG_MPATH=3Dy" >> $config_host_mak - if test "$mpathpersist_new_api" =3D "yes"; then - echo "CONFIG_MPATH_NEW_API=3Dy" >> $config_host_mak - fi -fi if test "$vhost_scsi" =3D "yes" ; then echo "CONFIG_VHOST_SCSI=3Dy" >> $config_host_mak fi @@ -7992,7 +7923,7 @@ NINJA=3D${ninja:-$PWD/ninjatool} $meson setup \ -Dstrip=3D$(if test "$strip_opt" =3D yes; then echo true; else ech= o false; fi) \ -Db_pie=3D$(if test "$pie" =3D yes; then echo true; else echo fals= e; fi) \ -Db_coverage=3D$(if test "$gcov" =3D yes; then echo true; else ech= o false; fi) \ - -Dsdl=3D$sdl -Dsdl_image=3D$sdl_image \ + -Dmpath=3D$mpath -Dsdl=3D$sdl -Dsdl_image=3D$sdl_image \ -Dvnc=3D$vnc -Dvnc_sasl=3D$vnc_sasl -Dvnc_jpeg=3D$vnc_jpeg -Dvnc_png=3D$v= nc_png \ -Dgettext=3D$gettext -Dxkbcommon=3D$xkbcommon -Du2f=3D$u2f\ $cross_arg \ diff --git a/meson.build b/meson.build index 4872498897..c09d869f9b 100644 --- a/meson.build +++ b/meson.build @@ -81,6 +81,14 @@ if 'SPARSE_CFLAGS' in config_host 'compile_commands.json']) endif =20 +########################################### +# Target-specific checks and dependencies # +########################################### + +if targetos !=3D 'linux' and get_option('mpath').enabled() + error('Multipath is supported only on Linux') +endif + m =3D cc.find_library('m', required: false) util =3D cc.find_library('util', required: false) winmm =3D [] @@ -112,6 +120,11 @@ elif targetos =3D=3D 'haiku' cc.find_library('network'), cc.find_library('bsd')] endif + +################ +# Dependencies # +################ + # The path to glib.h is added to all compilation commands. This was # grandfathered in from the QEMU Makefiles. add_project_arguments(config_host['GLIB_CFLAGS'].split(), @@ -218,10 +231,6 @@ if 'CONFIG_SPICE' in config_host link_args: config_host['SPICE_LIBS'].split()) endif rt =3D cc.find_library('rt', required: false) -libmpathpersist =3D not_found -if config_host.has_key('CONFIG_MPATH') - libmpathpersist =3D cc.find_library('mpathpersist') -endif libdl =3D not_found if 'CONFIG_PLUGIN' in config_host libdl =3D cc.find_library('dl', required: true) @@ -252,9 +261,62 @@ if 'CONFIG_CURL' in config_host link_args: config_host['CURL_LIBS'].split()) endif libudev =3D not_found -if target_os =3D=3D 'linux' - libudev =3D dependency('libudev', static: enable_static) +if targetos =3D=3D 'linux' + libudev =3D dependency('libudev', + required: get_option('mpath'), + static: enable_static) +endif + +mpathpersist =3D not_found +if targetos =3D=3D 'linux' and not get_option('mpath').disabled() + libmultipath =3D cc.find_library('multipath', + required: get_option('mpath'), + static: enable_static) + libmpathpersist =3D cc.find_library('mpathpersist', + required: get_option('mpath'), + static: enable_static) + if libmultipath.found() and libmpathpersist.found() and libudev.found() + if cc.links(''' + #include + #include + unsigned mpath_mx_alloc_len =3D 1024; + int logsink; + static struct config *multipath_conf; + extern struct udev *udev; + extern struct config *get_multipath_config(void); + extern void put_multipath_config(struct config *conf); + struct udev *udev; + struct config *get_multipath_config(void) { return multipath_conf; } + void put_multipath_config(struct config *conf) { } + int main(void) { + udev =3D udev_new(); + multipath_conf =3D mpath_lib_init(); + return 0; + }''', dependencies: [libmultipath, libmpathpersist, libudev]) + mpathpersist =3D declare_dependency(dependencies: [libmultipath, lib= mpathpersist, libudev]) + mpathpersist_new_api =3D true + elif cc.links(''' + #include + #include + unsigned mpath_mx_alloc_len =3D 1024; + int logsink; + int main(void) { + struct udev *udev =3D udev_new(); + mpath_lib_init(udev); + return 0; + }''', dependencies: [libmultipath, libmpathpersist, libudev]) + mpathpersist =3D declare_dependency(dependencies: [libmultipath, lib= mpathpersist, libudev]) + mpathpersist_new_api =3D false + else + if get_option('mpath').enabled() + error('Cannot detect libmpathpersist API') + else + warning('Cannot detect libmpathpersist API, disabling') + endif + endif + endif endif + brlapi =3D not_found if 'CONFIG_BRLAPI' in config_host brlapi =3D declare_dependency(link_args: config_host['BRLAPI_LIBS'].spli= t()) @@ -436,6 +498,10 @@ has_gettid =3D cc.has_function('gettid') # Create config-host.h =20 config_host_data.set('CONFIG_LIBUDEV', libudev.found()) +config_host_data.set('CONFIG_MPATH', mpathpersist.found()) +if mpathpersist.found() + config_host_data.set('CONFIG_MPATH_NEW_API', mpathpersist_new_api) +endif config_host_data.set('CONFIG_SDL', sdl.found()) config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found()) config_host_data.set('CONFIG_VNC', vnc.found()) @@ -1185,7 +1251,7 @@ if have_tools =20 executable('qemu-pr-helper', files('scsi/qemu-pr-helper.c', 'scsi/util= s.c'), dependencies: [authz, crypto, io, qom, qemuutil, - libcap_ng, libudev, libmpathpersist], + libcap_ng, mpathpersist], install: true) endif =20 @@ -1407,7 +1473,7 @@ summary_info +=3D {'Audio drivers': config_host['= CONFIG_AUDIO_DRIVERS']} summary_info +=3D {'Block whitelist (rw)': config_host['CONFIG_BDRV_RW_WHI= TELIST']} summary_info +=3D {'Block whitelist (ro)': config_host['CONFIG_BDRV_RO_WHI= TELIST']} summary_info +=3D {'VirtFS support': config_host.has_key('CONFIG_VIRTFS= ')} -summary_info +=3D {'Multipath support': config_host.has_key('CONFIG_MPATH'= )} +summary_info +=3D {'Multipath support': mpathpersist.found()} summary_info +=3D {'VNC support': vnc.found()} if vnc.found() summary_info +=3D {'VNC SASL support': sasl.found()} diff --git a/meson_options.txt b/meson_options.txt index 543cf70043..b38a6ae92a 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -6,6 +6,8 @@ option('docdir', type : 'string', value : 'doc', option('gettext', type : 'boolean', value : true, description: 'Localization of the GTK+ user interface') =20 +option('mpath', type : 'feature', value : 'auto', + description: 'Multipath persistent reservation passthrough') option('sdl', type : 'feature', value : 'auto', description: 'SDL user interface') option('sdl_image', type : 'feature', value : 'auto', --=20 2.18.2