Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1065074rwl; Wed, 12 Apr 2023 07:52:15 -0700 (PDT) X-Google-Smtp-Source: AKy350a1W72zizLdgaUxPQVeKfuR32JoTeJFM8U9myFiMVHXAINk3QgUrBRgQ3NJk8Wg+d+5w8wA X-Received: by 2002:a17:907:3ea3:b0:94a:62d3:ce1e with SMTP id hs35-20020a1709073ea300b0094a62d3ce1emr14787517ejc.40.1681311135317; Wed, 12 Apr 2023 07:52:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681311135; cv=none; d=google.com; s=arc-20160816; b=H9hKbf3h6icuY1rE3bW/EMjFGsiIMucPYqdVks+B542DgVrPZ6vpqmKH9jdIACo0Zj T2mydaupu9KqRJcSapPmXof0NFCPKq2/hbNE+7c1ejr/MPh/TIMqTSZenQg9Is77oJLc 9WwlsStxQ2nJiGWP9vmPwWbvBFPSOYsdKNCP7FHqAabWBXimVm+u3is5BKXTOqhd4MiD BIlx/pNojFuEvXNcEzVitZE5n9WBs52epTfCHnDrR1l2ldPo7zhF+mZGkpmaeZpe/f8A 6dSJ3Fia12ZUTjwipukevmdgC6e8MLcRL62ajclWUdMpX8xvaQzhdLm1VlgwULzUTNpA uJgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=Ra4mNXa1FKANNRU9oXHoYIOLruzsrHplXXFmibUu1Ew=; b=Pg7zI3g48Fwo489sFOOaogz6DULpbt6I5v0vGVGaR3PhHKFv0hVX+c5dZJFY5MPI0h kJ+kWJNQ0uqneCYjs5JJnGM4zyIk8bJFRa7pq/o0CsU2yGLNxGQkIhERZ5EjRW6he6sF I+THPVtybccO3MHLbkTBCJx79vbE0ynBwPikUXBnKx4mTzRFQvXGd/WTBp1Q/dtuuzK2 oMJqeBrFuGqUfn4DSQDf8zyiz5bBcTchSmyL+T4efZ39VbHa5JcprMYCikrqBRw/KbSy dIGNUphLEcsiXpFWcSQCt6JftSrLQxORY44qSzOLh34LIB0VsnVXDDJ6DDIsZWBRNwDD fYiA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c6-20020aa7df06000000b005048be122e2si1226286edy.514.2023.04.12.07.51.50; Wed, 12 Apr 2023 07:52:15 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231714AbjDLOkY (ORCPT + 99 others); Wed, 12 Apr 2023 10:40:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231724AbjDLOkN (ORCPT ); Wed, 12 Apr 2023 10:40:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CBAC4EDD; Wed, 12 Apr 2023 07:39:53 -0700 (PDT) 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 dfw.source.kernel.org (Postfix) with ESMTPS id A069562A00; Wed, 12 Apr 2023 14:39:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2520DC4339E; Wed, 12 Apr 2023 14:39:45 +0000 (UTC) Message-ID: Date: Wed, 12 Apr 2023 16:39:44 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH v2 1/7] media: videobuf2: Don't assert held reservation lock for dma-buf mmapping Content-Language: en-US To: Dmitry Osipenko , 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 , 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 References: <20230406160637.541702-1-dmitry.osipenko@collabora.com> <20230406160637.541702-2-dmitry.osipenko@collabora.com> From: Hans Verkuil In-Reply-To: <20230406160637.541702-2-dmitry.osipenko@collabora.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 On 06/04/2023 18:06, Dmitry Osipenko wrote: > 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 Reviewed-by: Hans Verkuil Regards, Hans > --- > 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); > } >