From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A065944CAF5; Tue, 16 Jun 2026 16:13:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781626383; cv=none; b=qcOYHltTL38gRlwkvYuGTNkvf5gmvnz3mouRD14YqI4DOoux9rIl8YUGCJZLhv+98bp3ypKRSyi8MjYcSg5Mr4dz69qMmd2MAMitIIQT0kAohz05iUW8r5RBI8iyAMMt5ypu0mUhH5EYg6yVgD/3i4b9xHHZNw/fWETp3ipUQEA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781626383; c=relaxed/simple; bh=iHyOJ69a+ELdi4Po8tVxhbrFX4GuDvNS/T6U768kHow=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Xbl0MdtU7qL160M3Z0/MEvYwa9xB1D7Fq1FqKrWdl6VSgVDXNt61XaeW4ro/eKugME7M6IlAEtA5wlW5nRuas1U54aIYFetvPYTylk+o56EHGCEkuf0e4se+qKXz2GshfADNDqUv8wSmMa789H1tN2EH3CJa6WZFahfrs1/azDM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=YV6HW/Gr; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="YV6HW/Gr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A931C1F000E9; Tue, 16 Jun 2026 16:13:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1781626382; bh=zBqFQoWXpLdFi5SY5FGVO5waDG6qucpiX3ynt8b85eg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=YV6HW/GrH0B6H4LRuyNXWziwuOL6PBBh1PFR5DL/NgR02knfZ3i/yDsS2q11+B2jI 6/ph6tQrQGKhq8lAIaoLfRgeJ2ESVxhgY911PBjNXWiIwChK7A/LP2ALyYFkt9UUac 5okzKmFRM8/PEt0/kKg93BNCMj6hrtkdVfKTYaBw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jacob Moroni , Leon Romanovsky , Sasha Levin Subject: [PATCH 6.18 310/325] RDMA/umem: Move umem dmabuf revoke logic into helper function Date: Tue, 16 Jun 2026 20:31:46 +0530 Message-ID: <20260616145114.467720743@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260616145057.827196531@linuxfoundation.org> References: <20260616145057.827196531@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jacob Moroni [ Upstream commit 797291a66ce346c96114b72222fc290d402da005 ] This same logic will eventually be reused from within the invalidate_mappings callback which already has the dma_resv_lock held, so break it out into a separate function so it can be reused. Signed-off-by: Jacob Moroni Link: https://patch.msgid.link/20260305170826.3803155-3-jmoroni@google.com Signed-off-by: Leon Romanovsky Stable-dep-of: badad6fad60d ("RDMA: During rereg_mr ensure that REREG_ACCESS is compatible") Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/core/umem_dmabuf.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) --- a/drivers/infiniband/core/umem_dmabuf.c +++ b/drivers/infiniband/core/umem_dmabuf.c @@ -198,6 +198,22 @@ static struct dma_buf_attach_ops ib_umem .move_notify = ib_umem_dmabuf_unsupported_move_notify, }; +static void ib_umem_dmabuf_revoke_locked(struct dma_buf_attachment *attach) +{ + struct ib_umem_dmabuf *umem_dmabuf = attach->importer_priv; + + dma_resv_assert_held(attach->dmabuf->resv); + + if (umem_dmabuf->revoked) + return; + ib_umem_dmabuf_unmap_pages(umem_dmabuf); + if (umem_dmabuf->pinned) { + dma_buf_unpin(umem_dmabuf->attach); + umem_dmabuf->pinned = 0; + } + umem_dmabuf->revoked = 1; +} + static struct ib_umem_dmabuf * ib_umem_dmabuf_get_pinned_and_lock(struct ib_device *device, struct device *dma_device, @@ -265,15 +281,7 @@ void ib_umem_dmabuf_revoke(struct ib_ume struct dma_buf *dmabuf = umem_dmabuf->attach->dmabuf; dma_resv_lock(dmabuf->resv, NULL); - if (umem_dmabuf->revoked) - goto end; - ib_umem_dmabuf_unmap_pages(umem_dmabuf); - if (umem_dmabuf->pinned) { - dma_buf_unpin(umem_dmabuf->attach); - umem_dmabuf->pinned = 0; - } - umem_dmabuf->revoked = 1; -end: + ib_umem_dmabuf_revoke_locked(umem_dmabuf->attach); dma_resv_unlock(dmabuf->resv); } EXPORT_SYMBOL(ib_umem_dmabuf_revoke);