From patchwork Sun Apr 2 16:48:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 78270 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1829287vqo; Sun, 2 Apr 2023 09:51:01 -0700 (PDT) X-Google-Smtp-Source: AKy350bDlcc3BM9dZGi+4p/YrqcIz6/C6dlJOypO3yFKAKH0gVH+zeCHMjmzUs1bEwYFFpFqCwZU X-Received: by 2002:a17:906:e2c8:b0:932:e141:29c7 with SMTP id gr8-20020a170906e2c800b00932e14129c7mr34564083ejb.19.1680454260818; Sun, 02 Apr 2023 09:51:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680454260; cv=none; d=google.com; s=arc-20160816; b=lq6shgKyx/JZIOrbd+W9JHVIHPFKyoxYGM2HioNMff0Pt6QCfz7rgX+DgyVLY3TlVH ekN8+iR/1CqRmQ2XKD9rDOhUFS7S1iiHfLTAoVI+42/KDbJReKhzG0pWKhHq6xyrez5b qQ8wDTEEyZ0q8gNrxVGc2KiqXl3N4/Rb/XNJnMjrkZAvnXo33ALbb+ljs7bQ5aGrBge4 zW9JGQ4J+G/lrY2MyGKifPYUPR0JoEZfTMUlzi9aREnl2d/JlONDlqELasFPWLLGTHR8 xqMBxTataiI5yppFIcEGMW3aog18ECjinlbsCEDsZHMU+Uk7H9sAmuLW4XwHiyLodF/k ZfIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/JZlpU6QnBH6e6+9I3zSciLyYYMKoTUhqGsadZ2G094=; b=Og2OgmIH5eClwdOcFB3GCMp+ii9CvG0Ghr16uKTPVGhdnssq3B2BNXA0IxVjF81ZSw 7FaIfia2PO0e02IHFXP+m8mVSfNCIYjQ2TT27I/orx/F4+tbnzvtvuC2iIxcwddN0YR0 nKI7rfVAShrY+DCX8e7eARhMNRTPWlroxUV1C01WOlNOyZ6qcJ7zACr0uL8PLAh0cXgH H7gSzplQRvsEtn7y+HZscrNTp1kB+iRpWNQtIIKVV3w/bt8C2LFjDCSv3oy99eeLGtaV DDPHCRUwQMgPOqiDO4uZrF3fSCHxGTcRJEbQH8tFsTEIo1sX9ipbhPy1hWabsuol9b+t roiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=jQP7ZZqR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u13-20020a17090657cd00b0093e842cedb4si2773516ejr.195.2023.04.02.09.50.37; Sun, 02 Apr 2023 09:51:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=jQP7ZZqR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231148AbjDBQtT (ORCPT + 99 others); Sun, 2 Apr 2023 12:49:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230502AbjDBQtQ (ORCPT ); Sun, 2 Apr 2023 12:49:16 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C4076585; Sun, 2 Apr 2023 09:49:16 -0700 (PDT) Received: from workpc.. (109-252-124-32.nat.spd-mgts.ru [109.252.124.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: dmitry.osipenko) by madras.collabora.co.uk (Postfix) with ESMTPSA id BC2A26602173; Sun, 2 Apr 2023 17:49:12 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680454154; bh=Zh5cvTzj2a8NxDnNkVroKBO5r9OAQUOq3SLNBXRAqp8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jQP7ZZqRCHn24TbItK78l/yOP4umFfqdr5Gez6EehC+28rxi+AnWMVeOiOT6fTZfU iSgrTwvEaJ3GU0j+mWtSsVsLFVM9PK9dWumZ94SGp/zbwIfoHF+uO25L8y/dY0JN5L BXFOucrqZ4q3QaZQKdwCix9q6dULiIRU6DqKmr/SRslqJhqQp8G6GsLuHvL6TD6x9j qDfR7qlh/xeSFScUFBll1nMOQ+sWCMeUoxRFKRsRTrGs7Wxm13tzIdvz7MoNJi3XMy tVH4rfC1ADrnWDnnHaW3rFgmVP9k7GR48YvWFg0WRkRrhamNNNNsRMuSAWB8taLvd8 poaMUunBdnR6g== From: Dmitry Osipenko To: Sumit Semwal , =?utf-8?q?Christian_K=C3=B6nig?= , Benjamin Gaignard , Liam Mark , Brian Starkey , John Stultz , Gerd Hoffmann , Daniel Vetter , Jani Nikula , Arnd Bergmann , Greg Kroah-Hartman , Thomas Zimmermann , Tomi Valkeinen , Thierry Reding , Tomasz Figa , Marek Szyprowski , Mauro Carvalho Chehab , Srinivas Kandagatla , Amol Maheshwari Cc: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, linux-tegra@vger.kernel.org, linux-arm-msm@vger.kernel.org, kernel@collabora.com Subject: [PATCH v1 1/7] Revert "media: videobuf2: Assert held reservation lock for dma-buf mmapping" Date: Sun, 2 Apr 2023 19:48:20 +0300 Message-Id: <20230402164826.752842-2-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230402164826.752842-1-dmitry.osipenko@collabora.com> References: <20230402164826.752842-1-dmitry.osipenko@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762084007042843800?= X-GMAIL-MSGID: =?utf-8?q?1762084007042843800?= Don't assert held dma-buf reservation lock on memory mapping of exported buffer. We're going to change dma-buf mmap() locking policy such that exporters will have to handle the lock. The previous locking policy caused deadlock problem for DRM drivers in a case of self-imported dma-bufs, it's solved by moving the lock down to exporters. Fixes: 3a6ca1810f77 ("media: videobuf2: Assert held reservation lock for dma-buf mmapping") Signed-off-by: Dmitry Osipenko --- drivers/media/common/videobuf2/videobuf2-dma-contig.c | 3 --- drivers/media/common/videobuf2/videobuf2-dma-sg.c | 3 --- drivers/media/common/videobuf2/videobuf2-vmalloc.c | 3 --- 3 files changed, 9 deletions(-) diff --git a/drivers/media/common/videobuf2/videobuf2-dma-contig.c b/drivers/media/common/videobuf2/videobuf2-dma-contig.c index 205d3cac425c..2fa455d4a048 100644 --- a/drivers/media/common/videobuf2/videobuf2-dma-contig.c +++ b/drivers/media/common/videobuf2/videobuf2-dma-contig.c @@ -11,7 +11,6 @@ */ #include -#include #include #include #include @@ -456,8 +455,6 @@ static int vb2_dc_dmabuf_ops_vmap(struct dma_buf *dbuf, struct iosys_map *map) static int vb2_dc_dmabuf_ops_mmap(struct dma_buf *dbuf, struct vm_area_struct *vma) { - dma_resv_assert_held(dbuf->resv); - return vb2_dc_mmap(dbuf->priv, vma); } diff --git a/drivers/media/common/videobuf2/videobuf2-dma-sg.c b/drivers/media/common/videobuf2/videobuf2-dma-sg.c index 183037fb1273..28f3fdfe23a2 100644 --- a/drivers/media/common/videobuf2/videobuf2-dma-sg.c +++ b/drivers/media/common/videobuf2/videobuf2-dma-sg.c @@ -10,7 +10,6 @@ * the Free Software Foundation. */ -#include #include #include #include @@ -498,8 +497,6 @@ static int vb2_dma_sg_dmabuf_ops_vmap(struct dma_buf *dbuf, static int vb2_dma_sg_dmabuf_ops_mmap(struct dma_buf *dbuf, struct vm_area_struct *vma) { - dma_resv_assert_held(dbuf->resv); - return vb2_dma_sg_mmap(dbuf->priv, vma); } diff --git a/drivers/media/common/videobuf2/videobuf2-vmalloc.c b/drivers/media/common/videobuf2/videobuf2-vmalloc.c index a6c6d2fcaaa4..7c635e292106 100644 --- a/drivers/media/common/videobuf2/videobuf2-vmalloc.c +++ b/drivers/media/common/videobuf2/videobuf2-vmalloc.c @@ -10,7 +10,6 @@ * the Free Software Foundation. */ -#include #include #include #include @@ -319,8 +318,6 @@ static int vb2_vmalloc_dmabuf_ops_vmap(struct dma_buf *dbuf, static int vb2_vmalloc_dmabuf_ops_mmap(struct dma_buf *dbuf, struct vm_area_struct *vma) { - dma_resv_assert_held(dbuf->resv); - return vb2_vmalloc_mmap(dbuf->priv, vma); }