Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2358273rwl; Thu, 6 Apr 2023 09:08:06 -0700 (PDT) X-Google-Smtp-Source: AKy350baSTFZvDxqC9MYFKEB1+BysFbi3rXCpZUxhJAsjWs90FDHvQnwTp/85lNGx9qcZ/5A7WFy X-Received: by 2002:a05:6a00:8f:b0:62b:107d:c3cb with SMTP id c15-20020a056a00008f00b0062b107dc3cbmr10318575pfj.33.1680797286034; Thu, 06 Apr 2023 09:08:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680797286; cv=none; d=google.com; s=arc-20160816; b=lVOHzp2GiSSTXS0L1tqs3O/HXv/mpsvmlX8jGB46QRRfIE2VPVKEHLDAy8r9g928sa f51wyxhhO+lx1pHR34y961vNxAStLgSXcwHtBuKMhiLB7HOaByqlSKcIhzOBmhEncR2I h1fssMuFhQHDB77ol4EiFn9eHqUJaUOqRMZGGGhmBVSba6hgbFKbQOJ80yp1G+nCuosL YVoO7fPSVk+gibbLCnwG0/lqUkKXjrFpczeKKb/4StdD53A0jru98T02vMrLjbmqGFC3 T8IE50dF1kQAN22TatmeW9SN5cWvL2KV7YrHoQzeT98rUZTcR3FB4hrBwGTTYQtTNpGq nX/Q== 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=S0Y9fHeUBuwV/5Jd6fOqaTYQ7bQUlveh9TyjrPnTWUE=; b=B6YM+EZCX/MQQLBK8lKZH0PYWg+bCwfM2yWwhLzATzjLl1aQyhqo4iODb94KDX8/X2 dXczyv4aJeOYBWyApW6N1HCAJYxKrJRJikyMh0jswai5AkpScZTqLPJ2jNfwM8+SDiQS n3evTUHPA/dE7gFlln6Y4Hxrp8gUBi8FS+UhV/kcxUPtsxfY9Jbk0SXvEWxtN4wm30q8 aiEWJ+WIHavUYlGuw665iReg4lrKVjwSbDm/nel0OHp3ZxP8DkrkOeoqu8Tk8MWoqU9E 1XSCda9b7evv6Ysq8TsP9WUTR1g7myYXSLC4XkTHmH69SkzKZMgsUCWxngyppCB6p+gx XPqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Vg0pe0ix; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s197-20020a632cce000000b004f2022f3cc2si1638281pgs.813.2023.04.06.09.07.45; Thu, 06 Apr 2023 09:08:05 -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=Vg0pe0ix; 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 S239905AbjDFQHV (ORCPT + 99 others); Thu, 6 Apr 2023 12:07:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239844AbjDFQHS (ORCPT ); Thu, 6 Apr 2023 12:07:18 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D3C9A273; Thu, 6 Apr 2023 09:07:02 -0700 (PDT) Received: from workpc.. (109-252-119-170.nat.spd-mgts.ru [109.252.119.170]) (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 1405066031C7; Thu, 6 Apr 2023 17:06:59 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680797221; bh=J/NjrW07xAKPsgTOVlsTpuUa/MmUjyQmfwWP2+i3cC4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vg0pe0ix1CzHqiooWmXyE1zukDucl835eaQmnoaEQud/sV3MsqCFI05+UXtXUA5Xk ZSdh2zEml7TICexbRqo8X5nQ96P27SWSrPqzp9FhLGONDTDO4lZVhkOPLu95M8EoN7 CbIr+LlyrCkm1O6ikBX6a9cv5xxccU9ePHm+BEV9AW1X6rCXeMigETvoGdaISOtR6U g4Bq1A4t95nIgSOMoSgcZml+xIdFjR5tCRnTtN/ulwYZY3hb2pGrhOStcN/22Z5D6e H+VM1rW+/6qkORdvrsujVuxIy2bszxREpKFGeT+4EQKULuA3KSotBkRMw3yc8Lav7k EQFVAefFCvbDw== From: Dmitry Osipenko To: Sumit Semwal , =?UTF-8?q?Christian=20K=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 , Emil Velikov 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 v2 1/7] media: videobuf2: Don't assert held reservation lock for dma-buf mmapping Date: Thu, 6 Apr 2023 19:06:31 +0300 Message-Id: <20230406160637.541702-2-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230406160637.541702-1-dmitry.osipenko@collabora.com> References: <20230406160637.541702-1-dmitry.osipenko@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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 once these drivers are moved to use reservation lock universally. The problem is solved by moving the lock down to exporters. This patch prepares videobuf2 for the locking policy update. Reviewed-by: Emil Velikov 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); } -- 2.39.2