From nobody Wed Nov 5 14:39:11 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1534796786256343.59718569598874; Mon, 20 Aug 2018 13:26:26 -0700 (PDT) Received: from localhost ([::1]:49134 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1frqkq-0002DX-Kg for importer@patchew.org; Mon, 20 Aug 2018 16:26:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50636) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1frqjI-0001L3-3Y for qemu-devel@nongnu.org; Mon, 20 Aug 2018 16:24:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1frqjG-0008Kc-EF for qemu-devel@nongnu.org; Mon, 20 Aug 2018 16:24:48 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:39056 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1frqjG-0008JU-3Y for qemu-devel@nongnu.org; Mon, 20 Aug 2018 16:24:46 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9FA37402178A; Mon, 20 Aug 2018 20:24:45 +0000 (UTC) Received: from redhat.com (ovpn-122-197.rdu2.redhat.com [10.10.122.197]) by smtp.corp.redhat.com (Postfix) with SMTP id 6E1532156889; Mon, 20 Aug 2018 20:24:37 +0000 (UTC) Date: Mon, 20 Aug 2018 23:24:36 +0300 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <20180820104045.133968-4-mst@redhat.com> References: <20180820104045.133968-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20180820104045.133968-1-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 20 Aug 2018 20:24:45 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 20 Aug 2018 20:24:45 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mst@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 3/7] configure: add libpmem support X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Fam Zheng , Haozhong Zhang , Richard Henderson , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Junyan He , Gerd Hoffmann , Stefan Hajnoczi , Paolo Bonzini , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Junyan He Add a pair of configure options --{enable,disable}-libpmem to control whether QEMU is compiled with PMDK libpmem [1]. QEMU may write to the host persistent memory (e.g. in vNVDIMM label emulation and live migration), so it must take the proper operations to ensure the persistence of its own writes. Depending on the CPU models and available instructions, the optimal operation can vary [2]. PMDK libpmem have already implemented those operations on multiple CPU models (x86 and ARM) and the logic to select the optimal ones, so QEMU can just use libpmem rather than re-implement them. Libpem is a part of PMDK project(formerly known as NMVL). The project's home page is: http://pmem.io/pmdk/ And the project's repository is: https://github.com/pmem/pmdk/ For more information about libpmem APIs, you can refer to the comments in source code of: pmdk/src/libpmem/pmem.c, begin at line 33. Signed-off-by: Junyan He Signed-off-by: Haozhong Zhang Reviewed-by: Stefan Hajnoczi Reviewed-by: Igor Mammedov Reviewed-by: Richard Henderson Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- configure | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/configure b/configure index 2a7796ea80..1c9288b17b 100755 --- a/configure +++ b/configure @@ -475,6 +475,7 @@ vxhs=3D"" libxml2=3D"" docker=3D"no" debug_mutex=3D"no" +libpmem=3D"" =20 # cross compilers defaults, can be overridden with --cross-cc-ARCH cross_cc_aarch64=3D"aarch64-linux-gnu-gcc" @@ -1435,6 +1436,10 @@ for opt do ;; --disable-debug-mutex) debug_mutex=3Dno ;; + --enable-libpmem) libpmem=3Dyes + ;; + --disable-libpmem) libpmem=3Dno + ;; *) echo "ERROR: unknown option $opt" echo "Try '$0 --help' for more information" @@ -1710,6 +1715,7 @@ disabled with --disable-FEATURE, default is enabled i= f available: vhost-user vhost-user support capstone capstone disassembler support debug-mutex mutex debugging support + libpmem libpmem support =20 NOTE: The object files are built at the place where configure is launched EOF @@ -5545,6 +5551,24 @@ if has "docker"; then docker=3D$($python $source_path/tests/docker/docker.py probe) fi =20 +########################################## +# check for libpmem + +if test "$libpmem" !=3D "no"; then + if $pkg_config --exists "libpmem"; then + libpmem=3D"yes" + libpmem_libs=3D$($pkg_config --libs libpmem) + libpmem_cflags=3D$($pkg_config --cflags libpmem) + libs_softmmu=3D"$libs_softmmu $libpmem_libs" + QEMU_CFLAGS=3D"$QEMU_CFLAGS $libpmem_cflags" + else + if test "$libpmem" =3D "yes" ; then + feature_not_found "libpmem" "Install nvml or pmdk" + fi + libpmem=3D"no" + fi +fi + ########################################## # End of CC checks # After here, no more $cc or $ld runs @@ -6010,6 +6034,7 @@ echo "replication support $replication" echo "VxHS block device $vxhs" echo "capstone $capstone" echo "docker $docker" +echo "libpmem support $libpmem" =20 if test "$sdl_too_old" =3D "yes"; then echo "-> Your SDL version is too old - please upgrade to have SDL support" @@ -6763,6 +6788,10 @@ if test "$vxhs" =3D "yes" ; then echo "VXHS_LIBS=3D$vxhs_libs" >> $config_host_mak fi =20 +if test "$libpmem" =3D "yes" ; then + echo "CONFIG_LIBPMEM=3Dy" >> $config_host_mak +fi + if test "$tcg_interpreter" =3D "yes"; then QEMU_INCLUDES=3D"-iquote \$(SRC_PATH)/tcg/tci $QEMU_INCLUDES" elif test "$ARCH" =3D "sparc64" ; then --=20 MST