From patchwork Mon Jan 30 14:25:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 13121262 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF766C54EAA for ; Mon, 30 Jan 2023 14:27:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237707AbjA3O15 (ORCPT ); Mon, 30 Jan 2023 09:27:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237750AbjA3O12 (ORCPT ); Mon, 30 Jan 2023 09:27:28 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81865212F for ; Mon, 30 Jan 2023 06:25:57 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 204ECB80CB4 for ; Mon, 30 Jan 2023 14:25:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 402B7C433D2; Mon, 30 Jan 2023 14:25:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1675088755; bh=/1TfNXkq3YUd460YgVWP5Vp7tFX3R/qZEnQqHWZHWnI=; h=From:To:Cc:Subject:Date:From; b=b+BlhWE/mLSFOT9aXGe11zQa2d6Im8JDvfhCGEGdJE30Ge4MXS/fsoy8auQU4fzkL mjvJaYt47cl4Il5EwdEOXvOv/vepRCD7Thxnc5NpK00+Bhq+CjXAE+5YWrXMyZdCIO aleEZk4rChupsc4xqzMATo+rlEJAjcawHlWWHOcg+GN/M0s8KwGaxmwrQoLMxr5HWK 5zYD+nOr9osJbj715Tv5Pcr+NV9ta6VC722sit46uSF87KWZONA3bdvVkjmu4NQbDL FTYW05Coxnk/4gbZoqbDSJInQj4Lr1LqKqyPH6z6qrUC4rU35iIl1s1pxwoKLkmhOu HHUvNsLPLrvug== From: Leon Romanovsky To: Jason Gunthorpe Cc: Maor Gottlieb , =?utf-8?q?Christian_K=C3=B6nig?= , Dmitry Osipenko , linux-rdma@vger.kernel.org Subject: [PATCH rdma-rc] RDMA/umem: Use dma-buf locked API to solve deadlock Date: Mon, 30 Jan 2023 16:25:50 +0200 Message-Id: <311c2cb791f8af75486df446819071357353db1b.1675088709.git.leon@kernel.org> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Maor Gottlieb The cited commit moves umem to call the unlocked versions of dmabuf unmap/map attachment, but the lock is held while calling to these functions, hence move back to the locked versions of these APIs. Fixes: 21c9c5c0784f ("RDMA/umem: Prepare to dynamic dma-buf locking specification") Signed-off-by: Maor Gottlieb Reviewed-by: Christian König Signed-off-by: Leon Romanovsky Reviewed-by: Dmitry Osipenko --- drivers/infiniband/core/umem_dmabuf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/core/umem_dmabuf.c b/drivers/infiniband/core/umem_dmabuf.c index 43b26bc12288..39357dc2d229 100644 --- a/drivers/infiniband/core/umem_dmabuf.c +++ b/drivers/infiniband/core/umem_dmabuf.c @@ -26,8 +26,8 @@ int ib_umem_dmabuf_map_pages(struct ib_umem_dmabuf *umem_dmabuf) if (umem_dmabuf->sgt) goto wait_fence; - sgt = dma_buf_map_attachment_unlocked(umem_dmabuf->attach, - DMA_BIDIRECTIONAL); + sgt = dma_buf_map_attachment(umem_dmabuf->attach, + DMA_BIDIRECTIONAL); if (IS_ERR(sgt)) return PTR_ERR(sgt); @@ -103,8 +103,8 @@ void ib_umem_dmabuf_unmap_pages(struct ib_umem_dmabuf *umem_dmabuf) umem_dmabuf->last_sg_trim = 0; } - dma_buf_unmap_attachment_unlocked(umem_dmabuf->attach, umem_dmabuf->sgt, - DMA_BIDIRECTIONAL); + dma_buf_unmap_attachment(umem_dmabuf->attach, umem_dmabuf->sgt, + DMA_BIDIRECTIONAL); umem_dmabuf->sgt = NULL; }