Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2359883rwl; Thu, 6 Apr 2023 09:09:06 -0700 (PDT) X-Google-Smtp-Source: AKy350b1Izy4/xVD6U4W9uj0IXzOcRJSixK+ARknjDu1wiv6cP432x8AHI2EcKa41MnDRcvuqoFa X-Received: by 2002:a17:903:22c1:b0:1a0:42c0:b2a5 with SMTP id y1-20020a17090322c100b001a042c0b2a5mr13203639plg.24.1680797345857; Thu, 06 Apr 2023 09:09:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680797345; cv=none; d=google.com; s=arc-20160816; b=nWpGhcL1IhXSpaCssXDQWtyB/BbN9dh7ouU00nWCdM6MhYEfOsczxqMtO305zsPYQw vGEK2tqmMo5mzNh0t2Y4r+aa7xr4W1JYvMdunfC9O+VztVzee7R/EQad9l3ZCut1Tbb2 8L7DL9IOOrt6xQnPvIXv8fTSpp96JnP8IJAc5NJttzr2iZMq2yfw7aLSqPOw1nXyR/fe JRBMO5XiimHfN3zxbTyscZHfCdaWEtr15tQYg2V+F/6ysjcQBhMPGyPQ1nZXBQctOMrr gii34Pt8zMDmrrCjXv2VPqgYSQ4L2wdeFOANPwqRYwK9TAiTA8Q9dxJo50mkmCR57E8p ZpQQ== 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=iUMSbPSPKB1GYhqPk/WW3jIAWff64aVNpOEjNVeZmYY=; b=hALURXcxIej5JTRJMXtD7GZit5NbtvAGRuigqfRkOwqTJVP1vBd+N3q62/tgdYoYY6 s+YKcb/Dq+vmEVTCA3uJr3hpotnHZInPxv47HmrudECPZvZbdLdeOYWwNj3YCgRXMRUm NNoUDgf47EhLs5Ub6vwx/xggJ6OZiqc2+WPRF96e1/bOzGVDcIe0OLXsdwC5L8lX/x8j o5vXNVE4k9sayW9Tn5A37UX0HePKDf2k5Jw5RBtS5Bsz9V91va0RgH4YSZlp0kEi0q2N D++WIzoi/quEXuyPmt4in46NbOhxSoEMeKHIkkysPKejWWt7t1ixFu9hqiMvNtxLjIPs PtGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=dDh9Oxap; 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 s27-20020a63ff5b000000b0050bedf49bbasi1586565pgk.574.2023.04.06.09.08.47; Thu, 06 Apr 2023 09:09: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=dDh9Oxap; 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 S240020AbjDFQHr (ORCPT + 99 others); Thu, 6 Apr 2023 12:07:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239945AbjDFQHh (ORCPT ); Thu, 6 Apr 2023 12:07:37 -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 A0A469EE4; Thu, 6 Apr 2023 09:07:17 -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 E9B2466031D1; Thu, 6 Apr 2023 17:07:07 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680797229; bh=wj+P+EtiPQCYCAqaOfmF5IaGcLMSp7ArisVFY//b40U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dDh9OxapAut2zQhFRSrbI/+hjrpKAvecRLRtluAeSqQ3GU5A6dgzGCPej98M2C4Pb t5B7IeeGk4qNEZNDe9U7sEGUg0WuWZpOW/0Vp0Qs4y3lX6GwFF+fFdmpatY4V5Mlmt KM0wByYF0IBApZsQ4NuvG/0nrVSrcHmDl5itivQyySQ0cSVHV4I/0bYSyE7R3QDO+a U0rZ5dSyCUN4FKN06SWLVi1bCNw+iNkZxwffS2HB2ESb0xsbofPCVdsjt8OMltO+Fk UIkA0VDBY9UN6MWnpj3Bg4I4Cg1goyscSabpnRECxuMpjv9Gc6C0onSx0LrESjvibf 9Q74VGdT/vuAA== 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 5/7] drm: Don't assert held reservation lock for dma-buf mmapping Date: Thu, 6 Apr 2023 19:06:35 +0300 Message-Id: <20230406160637.541702-6-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-Type: text/plain; charset=UTF-8 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 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.39.2