Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3716420rwd; Mon, 29 May 2023 15:49:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7YoaEtiozIEvFYJvPIvsLpBz/oiszIJepbJOJaeUhW3v/p7pSZoCUdIpcheK5OUq5Me1oj X-Received: by 2002:a05:6a20:734c:b0:10c:2c30:4765 with SMTP id v12-20020a056a20734c00b0010c2c304765mr459268pzc.1.1685400585183; Mon, 29 May 2023 15:49:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685400585; cv=none; d=google.com; s=arc-20160816; b=YwaAAoKg5Z5cA2sal3Z2FbaNVmAVek0UJKPrfciTASfhTmDkrZMLRyXOj1eJVlr5Xk /iAp6/S7E6Z53YT/5s2uJf6IB8ku3ry7pASYHwDZ8fQfEUGMjgOenGDjnbrX41NyYhWD 6SUAYEL6zLJhl8ep8Q40AUxiu+p6Iy38UKwLtLwUBzl+7nUBksNvm7KU3nEtHDgZmp5D d3vdXH5Jk08z8Gxh0ZHNVh7DmBoGvyOQHlmE+ZPtM/wnK8vydSRXASj4irGjCF3DUOlW 5/OjjlnXTTnd2QMoA+xD94r7qPpqErzmrOzx9QR7BOvn/+kKJCot7JfXd422d3R+kiKv YxQQ== 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=24N4CsN9Y4xO8BGFAsr/tq7jNfIe9Z6040AHEd679GM=; b=aOl4k9ZbeEM70C/9piL7+6IJSWfGl7voXgGsIkOpfXL8V4fNevYAtT39LncshtwQhn RPuLH4Nk7Iab9+QK93dxqnTm3oHz/TIYHXomIdyakCuTmpIbsnjBs9lKl+lQwYg16ATB avab8DTHvKfG1RwLOXoPEhomRTge59bUF7O8TRu7g+5g0d/gS2j1Ol94Z9oUrtIzSzDy PvrzCKmlENxoA6kvPAOWrZlZo+VgLrXRQyoKjp/U6CVk10LayXnPhf40tlo72fYb+Kwf VVWtzoJD/oXtiIWh4JVXzisTQz8lXr11ZLDdjW6M/6eG8Xc8F6Wz8/dh+9xJcnJneZ7X 97VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=UClCPfJm; 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 j23-20020a633c17000000b0053ef0ac79c8si4668pga.263.2023.05.29.15.49.33; Mon, 29 May 2023 15:49:45 -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=UClCPfJm; 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 S229674AbjE2Wqd (ORCPT + 99 others); Mon, 29 May 2023 18:46:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230034AbjE2WqU (ORCPT ); Mon, 29 May 2023 18:46:20 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFD42E4; Mon, 29 May 2023 15:46:15 -0700 (PDT) Received: from workpc.. (109-252-150-34.dynamic.spd-mgts.ru [109.252.150.34]) (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 3CBFF66065B2; Mon, 29 May 2023 23:46:13 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1685400374; bh=+6RJQyz1SQvOuneJSGlfQv6Mf5mBzyHbdAeoEcurylU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UClCPfJmZXkUcPnwalgQpy/q53+uEpKKe3rNHHPWFetgO3TZ+d1oAd02kvR87Z3Fj 3Vst0MA6fuKZJkED8bs1qJ7PUvWIaPmAuEd9/w4cVC7jBteCsKCGv3vigWnIn+V2Q+ 2XCxIcNHVdHSky5m+DycMmk2Dk1EnyO7C2HT4i/0daR17uHOoagoaz9OBgWXSozusu KIl6rgYd5BFLJCy37/DCU50HFbsKxysvJLrhUPX5eSvtrjpT3R30gkcTs3UVPqx7Ds /rWdZCgsgADV0j1sfa6TGqnzE122EDYTiydoy8NnKQZujFi2LRNQj/W6rBI1eVZLnM 01fAA0MdUd2NA== From: Dmitry Osipenko To: Sumit Semwal , =?UTF-8?q?Christian=20K=C3=B6nig?= , Benjamin Gaignard , Brian Starkey , John Stultz , Gerd Hoffmann , Daniel Vetter , Jani Nikula , Arnd Bergmann , Thomas Zimmermann , Tomi Valkeinen , Thierry Reding , Tomasz Figa , Marek Szyprowski , Mauro Carvalho Chehab , 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, kernel@collabora.com Subject: [PATCH v4 4/6] drm: Don't assert held reservation lock for dma-buf mmapping Date: Tue, 30 May 2023 01:39:33 +0300 Message-Id: <20230529223935.2672495-5-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230529223935.2672495-1-dmitry.osipenko@collabora.com> References: <20230529223935.2672495-1-dmitry.osipenko@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 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 DRM drivers for the locking policy update. Reviewed-by: Emil Velikov Acked-by: Christian König Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_prime.c | 2 -- drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 2 -- drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c | 2 -- drivers/gpu/drm/tegra/gem.c | 2 -- 4 files changed, 8 deletions(-) diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c index 149cd4ff6a3b..cea85e84666f 100644 --- a/drivers/gpu/drm/drm_prime.c +++ b/drivers/gpu/drm/drm_prime.c @@ -781,8 +781,6 @@ int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct vm_area_struct *vma) struct drm_gem_object *obj = dma_buf->priv; struct drm_device *dev = obj->dev; - dma_resv_assert_held(dma_buf->resv); - if (!dev->driver->gem_prime_mmap) return -ENOSYS; diff --git a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c index fd556a076d05..1df74f7aa3dc 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c @@ -97,8 +97,6 @@ static int i915_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct vm_area_struct * struct drm_i915_private *i915 = to_i915(obj->base.dev); int ret; - dma_resv_assert_held(dma_buf->resv); - if (obj->base.size < vma->vm_end - vma->vm_start) return -EINVAL; diff --git a/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c b/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c index 3abc47521b2c..8e194dbc9506 100644 --- a/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c +++ b/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c @@ -66,8 +66,6 @@ static int omap_gem_dmabuf_mmap(struct dma_buf *buffer, struct drm_gem_object *obj = buffer->priv; int ret = 0; - dma_resv_assert_held(buffer->resv); - ret = drm_gem_mmap_obj(obj, omap_gem_mmap_size(obj), vma); if (ret < 0) return ret; diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c index bce991a2ccc0..871ef5d26523 100644 --- a/drivers/gpu/drm/tegra/gem.c +++ b/drivers/gpu/drm/tegra/gem.c @@ -693,8 +693,6 @@ static int tegra_gem_prime_mmap(struct dma_buf *buf, struct vm_area_struct *vma) struct drm_gem_object *gem = buf->priv; int err; - dma_resv_assert_held(buf->resv); - err = drm_gem_mmap_obj(gem, gem->size, vma); if (err < 0) return err; -- 2.40.1