Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2358972rwl; Thu, 6 Apr 2023 09:08:30 -0700 (PDT) X-Google-Smtp-Source: AKy350Y3w4qnTsnVYY/2hUVbY1eEXMc8GYy5FOohTxS8gTkW8gL8vL5nJaE2WtSe+5lv1bhZOGbk X-Received: by 2002:a05:6a20:6a85:b0:dd:c5cb:ac86 with SMTP id bi5-20020a056a206a8500b000ddc5cbac86mr28065pzb.41.1680797309798; Thu, 06 Apr 2023 09:08:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680797309; cv=none; d=google.com; s=arc-20160816; b=V8J233ImPazCfOSDHEEu0Ywgd5vrLDNMCtIXoke1mssknd46rFHTky0GcNEVrCMAWV Ls0G9e50q+lcbjfMXusrWD2bogMuJArU8ae615i3BPvo+gtyf96+QuKGsTzUR18wcFbu yb7MV8gObk3jbnLGUT+uyhjL/J4IUkHx9R+rdT2QeeAPNTE9gqG2X77MOwoqRTjbw1B1 +QBW54DICVG7/rwz5fQ2rcl7zoJxUqowqWC+4TI2i/frJhaIjJ/oIW9eosj5LzvNfnvS MTFRWn5d1jfNJG3wCMhm8P0a9fdq9wa42SK54CHp22lAX0UUvLaVEaGZU1ff/tnsI1uq 75Qg== 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=H1hC4lzqcMffmCdV8pF78AMBVOVhV2ibGnHXpzBtbg4=; b=DGZuOj2jaZfbj75fODGklFFGvwDsO4KVrjcyXVgEOUG/rrrPrZ5uUrrnAfK7DhaMwN oChKd3zKz2y0ic8GAO2si6UbhTk71hU3eTGDWTOIAA+PHocNQasrC7OqcQxFahJ+JrKl V8GLZo1+mUT+3chINnHLxXY7n7Oeoubl7WbLND6s9SclOPoFORxYtw7U5dTtYS98L89q w3qfZ7PYEzNKwvJ5EmoHjhm0PsXFvC7kxxqlRXcTJ7M8Ef20L4cfBfm44ahNvQ4LvPxp qKuE/xRNJUhH3TZR7jjJkRTgm7aKdoSE5KOOkAu8zJO2ZZmRECF1TibVRR4IGItCM/kP wacw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=ecq5yJJW; 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 bs189-20020a6328c6000000b005143d5f9ff0si1564923pgb.357.2023.04.06.09.07.48; Thu, 06 Apr 2023 09:08:29 -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=ecq5yJJW; 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 S239925AbjDFQHY (ORCPT + 99 others); Thu, 6 Apr 2023 12:07:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239893AbjDFQHT (ORCPT ); Thu, 6 Apr 2023 12:07:19 -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 A72ED9ED1; Thu, 6 Apr 2023 09:07:05 -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 4E78366031CE; Thu, 6 Apr 2023 17:07:01 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680797223; bh=3Ek/yYDXiV8p6oUK9bZEdI6kiU1RzQXW4TBUlTZgIOc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ecq5yJJW4mYu2cixJiY2SKovl+cm60t70r+zw9E9b91J7lWjb8tudECvcjvpzoNLD 4D2+Ib49s3Ibz8dmwFhbc4+Ho8MBZGOV6CeotCGC36/E9yx3IRbNQvgqcoJyzwCUGD h5VIC38jPAdCauuNsTxGLCuoq3gtydfRf97Sh7pU58lzFGZIe4Eaam+XSet0Z/FweB nds0u6VZ7Zf9AEmPXmd/5fcVKzXhcr9jHSAroQ9eF0UTNhOWR431KWkfWCzxy6WZ2d eXABhPCUKGr7NolBdq0MTVUzyAoSdg74r8ipNLBzBsh8et72HdMUjK2EwNUaypLIP8 a9e1PLca8QcFQ== 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 2/7] dma-buf/heaps: Don't assert held reservation lock for dma-buf mmapping Date: Thu, 6 Apr 2023 19:06:32 +0300 Message-Id: <20230406160637.541702-3-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 solved by moving the lock down to exporters. This patch prepares dma-buf heaps for the locking policy update. Reviewed-by: Emil Velikov Signed-off-by: Dmitry Osipenko --- drivers/dma-buf/heaps/cma_heap.c | 3 --- drivers/dma-buf/heaps/system_heap.c | 3 --- 2 files changed, 6 deletions(-) diff --git a/drivers/dma-buf/heaps/cma_heap.c b/drivers/dma-buf/heaps/cma_heap.c index 1131fb943992..28fb04eccdd0 100644 --- a/drivers/dma-buf/heaps/cma_heap.c +++ b/drivers/dma-buf/heaps/cma_heap.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -183,8 +182,6 @@ static int cma_heap_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma) { struct cma_heap_buffer *buffer = dmabuf->priv; - dma_resv_assert_held(dmabuf->resv); - if ((vma->vm_flags & (VM_SHARED | VM_MAYSHARE)) == 0) return -EINVAL; diff --git a/drivers/dma-buf/heaps/system_heap.c b/drivers/dma-buf/heaps/system_heap.c index e8bd10e60998..fcf836ba9c1f 100644 --- a/drivers/dma-buf/heaps/system_heap.c +++ b/drivers/dma-buf/heaps/system_heap.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -202,8 +201,6 @@ static int system_heap_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma) struct sg_page_iter piter; int ret; - dma_resv_assert_held(dmabuf->resv); - for_each_sgtable_page(table, &piter, vma->vm_pgoff) { struct page *page = sg_page_iter_page(&piter); -- 2.39.2