From nobody Tue Feb 10 15:29:05 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1714640814; cv=none; d=zohomail.com; s=zohoarc; b=hpjoNiBuXpa33D54QWrYHn+nvBxNyS6OB0eCV/LZUnD6gHaJCVPyLNIwviZeIPK06mQs0KLgWnTe3YEiZcBiqUMQcxtqwUtoDD0uMbI67fFu8Rd5ucXsLkFFGDnmCsFIY+ueUczaUvnUGdiDsVkbg9gL9Zg9rVrif7bL0RRgRlk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1714640814; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=m6hdX/QShEyoevdHWJVmo9TQTgWa7HYlW/pBH8IIc94=; b=JOscT1+i6kSiYnYKb8Apf5TGUFgRxVVRkPasytIrs418fcVd4wOJO2Eg/1RTQEryryL+Mr/imH6HPhF2bCmN5TYOQsA7/1Khz3K5J3kQWhCxEPP/kV5R3RtvQ0l8plBDQ8EIGGX0zKPmR9X7Jin6oeT3x93Mz7K9rk/IQqqrkl0= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 171464081410333.80898213403839; Thu, 2 May 2024 02:06:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s2SO7-0008FB-SK; Thu, 02 May 2024 05:05:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s2SO6-0008EV-Fz for qemu-devel@nongnu.org; Thu, 02 May 2024 05:05:58 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s2SO0-0000gO-Tv for qemu-devel@nongnu.org; Thu, 02 May 2024 05:05:58 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-41dc9f98e8dso3472515e9.1 for ; Thu, 02 May 2024 02:05:52 -0700 (PDT) Received: from m1x-phil.lan ([176.187.215.106]) by smtp.gmail.com with ESMTPSA id y10-20020a5d620a000000b0034ddb760da2sm753549wru.79.2024.05.02.02.05.48 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 02 May 2024 02:05:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714640751; x=1715245551; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=m6hdX/QShEyoevdHWJVmo9TQTgWa7HYlW/pBH8IIc94=; b=r3RrTnZvmNDhxCi9Vuee2lmDPFzvN2uex91lm+Ssmk2ROrcZR0MAemPuLo1gKDiz2t +lhqK7zzLWRlWMWYfFkc88h+OC5119HAB/jPTeTCMD9sCWh5cxkW/XFAMGXDWWIFBzIR sf+Qj7L6mQ5aWAlpAuk1BJRom3f4DERCEt2aHZNRHmlt/ExYvFwi8MAglKf0CuqKqZDh JvG5YRWBdqdd0YVe4EXLMwF8OnnR1kjaobpEeJG1PUcTF4orWfSHQnyNEATejd3gkO2/ Ol9UdVnOGxyVUrjf7id7ZPnuGwrTPO9rtFhbIGcrqYFL+SkVF/rHAqqdi426Xbv03lTE KrNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714640751; x=1715245551; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=m6hdX/QShEyoevdHWJVmo9TQTgWa7HYlW/pBH8IIc94=; b=N8Nll2QcdYmf7RqsP9DO8FHmmL5O5yfGToiCr9oiwfnp2izHO4SShx7K/IxQfUmqRK 9uaO2wl+bpXPm5bX+h3fCELLdgwNqthHl/kzZ1luuzwEmkMhHsj+rR/rIvFS1YZwUSqK 2kbHDi0TvZHaoTYs0V5yAbSrgFs97wNNHqPKo7H1TILklQD4Nb49W5HSKONYGjEK5H76 tUDimX1uxxdu+/D1fZhaWhFqo01Lz8pVeiza+jmOIXuN+6+yD1cnTyKytyJHRukOMfpi eQUFEG+489E4WIozSszaQ5Oz7rzR1zU0MWxkA5h18dlyga7D+yjFiY5hqVkSY2/QHq9j UoWw== X-Gm-Message-State: AOJu0YwXoRCTnlZEHASHX8h51ItpFoGH6Pdv/AeC0oV+p/zudXLv9pei L2yeY1yqv8xE1/05YUFZ4MZcZgHcs1fuYY1kZT3Dd6/qvCQQ9xZLoZG8tsVlpyIIn3J+qzoDVHg O X-Google-Smtp-Source: AGHT+IF9e3B4t4KUsaF9I1B+VX4Qg01xgoSe06CGyBo5WLah5E8ZZBY/F7M2OIVhPwbXePh6WffstA== X-Received: by 2002:a5d:4b83:0:b0:34d:9b4d:2a43 with SMTP id b3-20020a5d4b83000000b0034d9b4d2a43mr1748734wrt.0.1714640750205; Thu, 02 May 2024 02:05:50 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Xu , Yu Zhang , Paolo Bonzini , Thomas Huth , Jack Wang , Li Zhijian , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Michael Galaxy , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH] migration/rdma: Allow building without on-demand paging support Date: Thu, 2 May 2024 11:05:47 +0200 Message-ID: <20240502090547.87824-1-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1714640814934100001 On-demand paging support was added in libibverbs v1.2.0 in commit https://github.com/linux-rdma/rdma-core/commit/e500adc7b1 We don't check the libibverbs, so add a meson check on the IBV_ACCESS_ON_DEMAND symbol, and define HAVE_IBV_ACCESS_ON_DEMAND if found. Restrict rdma_support_odp() so it returns %false when on-demand paging is not supported. This fixes: migration/rdma.c: In function 'rdma_support_odp': migration/rdma.c:1133:12: error: variable 'attr' has initializer but inco= mplete type 1133 | struct ibv_device_attr_ex attr =3D {0}; | ^~~~~~~~~~~~~~~~~~ migration/rdma.c:1135:9: warning: implicit declaration of function 'ibv_q= uery_device_ex'; did you mean 'ibv_query_device'? [-Wimplicit-function-decl= aration] 1135 | if (ibv_query_device_ex(dev, NULL, &attr)) { | ^~~~~~~~~~~~~~~~~~~ | ibv_query_device migration/rdma.c:1135:9: warning: nested extern declaration of 'ibv_query= _device_ex' [-Wnested-externs] migration/rdma.c:1139:38: error: 'IBV_ODP_SUPPORT' undeclared (first use = in this function); did you mean 'IBV_QP_PORT'? 1139 | if (attr.odp_caps.general_caps & IBV_ODP_SUPPORT) { | ^~~~~~~~~~~~~~~ | IBV_QP_PORT migration/rdma.c: In function 'qemu_rdma_reg_whole_ram_blocks': migration/rdma.c:1189:27: error: 'IBV_ACCESS_ON_DEMAND' undeclared (first= use in this function); did you mean 'IBV_ACCESS_MW_BIND'? 1189 | access |=3D IBV_ACCESS_ON_DEMAND; | ^~~~~~~~~~~~~~~~~~~~ | IBV_ACCESS_MW_BIND ninja: build stopped: subcommand failed. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- meson.build | 3 +++ migration/rdma.c | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/meson.build b/meson.build index 837a2bdb56..7c6436ac9e 100644 --- a/meson.build +++ b/meson.build @@ -2410,6 +2410,9 @@ if rdma.found() cc.has_function('ibv_advise_mr', dependencies: rdma, prefix: '#include ')) + config_host_data.set('HAVE_IBV_ACCESS_ON_DEMAND', + cc.has_header_symbol('infiniband/verbs.h', + 'IBV_ACCESS_ON_DEMAND')) endif =20 have_asan_fiber =3D false diff --git a/migration/rdma.c b/migration/rdma.c index 855753c671..4717fb3143 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -1127,9 +1127,14 @@ static int qemu_rdma_alloc_qp(RDMAContext *rdma) return 0; } =20 +#ifndef HAVE_IBV_ACCESS_ON_DEMAND +#define IBV_ACCESS_ON_DEMAND 0 +#endif + /* Check whether On-Demand Paging is supported by RDAM device */ static bool rdma_support_odp(struct ibv_context *dev) { +#ifdef HAVE_IBV_ACCESS_ON_DEMAND struct ibv_device_attr_ex attr =3D {0}; =20 if (ibv_query_device_ex(dev, NULL, &attr)) { @@ -1139,6 +1144,7 @@ static bool rdma_support_odp(struct ibv_context *dev) if (attr.odp_caps.general_caps & IBV_ODP_SUPPORT) { return true; } +#endif =20 return false; } --=20 2.41.0