From nobody Mon Feb 9 10:12:10 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1630566085; cv=none; d=zohomail.com; s=zohoarc; b=aYxsDYU9PYw0XBJoeeowWCRZCwd0AfowuQOWAi9Hovhd5ewhWGzNMEAFLdtOLyJMbEzIzdd9WfoLARZgVvlPqbl/rCZnzf+aV8PEXXKRUQgphqX3xgMtYPR//1LGXSfTHsLfRbGYEcR+xPEnFKvIgnCl8NBsuiLGcplPyUM3Kq8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630566085; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=ojj+ZaFHzvapR5Yklu/beV4VWQwhlVBhI7TMjzFMewk=; b=XekjlVyrxuQCio4Y8MK78aH5kVYnMCwmpT/5aV0WBg/UCdVxp19Qhbay5NFS6kkpo9/Pc5Zp6ih2XFh98/V6PTCegGIRnCfP6o7mLOLj2pUBy7GpX7WfH7YpL8SRWHDZRy3Y9X/774+/2P9p0XfmnPt5mrHtZvooKDf+Wgym12s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1630566085246892.2950513516448; Thu, 2 Sep 2021 00:01:25 -0700 (PDT) Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-357-1XvQpjEfOICo18Ewxs2gkA-1; Thu, 02 Sep 2021 03:01:23 -0400 Received: by mail-wr1-f71.google.com with SMTP id r17-20020adfda510000b02901526f76d738so223340wrl.0 for ; Thu, 02 Sep 2021 00:01:23 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (163.red-83-52-55.dynamicip.rima-tde.net. [83.52.55.163]) by smtp.gmail.com with ESMTPSA id x9sm730430wmi.30.2021.09.02.00.01.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Sep 2021 00:01:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630566084; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ojj+ZaFHzvapR5Yklu/beV4VWQwhlVBhI7TMjzFMewk=; b=UQsHQemR7unS/BVaaoV7K9RhUVg/+RIlJHkKLCoe7ribMidrqn3AME0enlrFyTcyOF0iID yLaKgdzfUgCQIJ74Ozrg7hIQOmfBI/G6aa1pZ8/YH5ReSFinly+zecdzBm/3C1wdSjPHhR Lj9KYnjX4pi4I8CGMpLakv3sMoibDWQ= X-MC-Unique: 1XvQpjEfOICo18Ewxs2gkA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ojj+ZaFHzvapR5Yklu/beV4VWQwhlVBhI7TMjzFMewk=; b=HgWHwaTBg6nsLD7YoRdFrfFF+a0EXjcvGz7NlxART6OxUNHfdcuL2/ZvOt6CaRyC2z glgs4LRcwhku5Ty46+e4DXjbhhCNOOWRp3So1q5Ch5xSs6R/kbxK86sZiYQoyKYKEa5z zG0jgGCD76i1fBY/h2cNJjDhv5jISh/2YbWUcCwlxX/kCTNUvoI3Aa2A6Xt4Nl6rCqkZ YRScITcr+kzTUbGscGzjxtSJbg6jv9C8UZRSDnCbGUFz7zwx8C0jz89L0dYC74iL2//3 9cpRMSgu1Li98Hf2XCRzI3HC1d0UbkfJEtkrYZHEgyiXYNuLbGbTQWmB1kbyESeivW/e 5tyw== X-Gm-Message-State: AOAM530UH7+Jy1zVBQXeewY47/8GgIQhL9mwPc42KDGyy8Cw5CUCEyXu 9tyjLrbv3Lr6BupFFeFpnCoKljb3easGFE/qMC7Bfc7szL681Dwb4/XlL8ewPM4nvsIsdU1cnnZ RJxHwZJVIqOGNyQ== X-Received: by 2002:a1c:2bc6:: with SMTP id r189mr1552956wmr.183.1630566077257; Thu, 02 Sep 2021 00:01:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjPO9+j1p/lKqPtGN0rof7wAaE3gOLxBrOL6tvfx4iDsgGjr5PR5vnT1yie2pRi8nThH0dNQ== X-Received: by 2002:a1c:2bc6:: with SMTP id r189mr1552943wmr.183.1630566077058; Thu, 02 Sep 2021 00:01:17 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Kevin Wolf , Fam Zheng , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Klaus Jensen , Hanna Reitz , Auger Eric , qemu-block@nongnu.org, Stefan Hajnoczi , Tingting Mao Subject: [PATCH v3 11/11] block/nvme: Only report VFIO error on failed retry Date: Thu, 2 Sep 2021 09:00:25 +0200 Message-Id: <20210902070025.197072-12-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210902070025.197072-1-philmd@redhat.com> References: <20210902070025.197072-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1630566086091100001 We expect the first qemu_vfio_dma_map() to fail (indicating DMA mappings exhaustion, see commit 15a730e7a3a). Do not report the first failure as error, since we are going to flush the mappings and retry. This removes spurious error message displayed on the monitor: (qemu) c (qemu) qemu-kvm: VFIO_MAP_DMA failed: No space left on device (qemu) info status VM status: running Reported-by: Tingting Mao Reviewed-by: Klaus Jensen Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- block/nvme.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/block/nvme.c b/block/nvme.c index 80546b0babd..abfe305baf2 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -1019,6 +1019,7 @@ static coroutine_fn int nvme_cmd_map_qiov(BlockDriver= State *bs, NvmeCmd *cmd, uint64_t *pagelist =3D req->prp_list_page; int i, j, r; int entries =3D 0; + Error *local_err =3D NULL, **errp =3D NULL; =20 assert(qiov->size); assert(QEMU_IS_ALIGNED(qiov->size, s->page_size)); @@ -1031,7 +1032,7 @@ static coroutine_fn int nvme_cmd_map_qiov(BlockDriver= State *bs, NvmeCmd *cmd, try_map: r =3D qemu_vfio_dma_map(s->vfio, qiov->iov[i].iov_base, - len, true, &iova, NULL); + len, true, &iova, errp); if (r =3D=3D -ENOSPC) { /* * In addition to the -ENOMEM error, the VFIO_IOMMU_MAP_DMA @@ -1066,6 +1067,8 @@ try_map: goto fail; } } + errp =3D &local_err; + goto try_map; } if (r) { @@ -1109,6 +1112,9 @@ fail: * because they are already mapped before calling this function; for * temporary mappings, a later nvme_cmd_(un)map_qiov will reclaim by * calling qemu_vfio_dma_reset_temporary when necessary. */ + if (local_err) { + error_reportf_err(local_err, "Cannot map buffer for DMA: "); + } return r; } =20 --=20 2.31.1