From patchwork Sun Apr 2 16:48:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 78273 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1831426vqo; Sun, 2 Apr 2023 09:57:31 -0700 (PDT) X-Google-Smtp-Source: AKy350aX/rzdrArXzASXNN6N7HmMd2vC3OvLBDA0+Qnxi7ndSbHJegs5SkWO7oATXsREQRsVtpwB X-Received: by 2002:a05:6402:5a:b0:4fa:7679:d44a with SMTP id f26-20020a056402005a00b004fa7679d44amr28661031edu.11.1680454651111; Sun, 02 Apr 2023 09:57:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680454651; cv=none; d=google.com; s=arc-20160816; b=n25ngEeUEiLAjHvLIP78nsPdSohNZuBbkDqrwHuGDQYqqWshT4VxwxMKzPPdiL/Nj7 vIZBnh4mka+RBThl+0kC+MPrZbch0UiqxvrN597z2dRogxpaRXc0zzydl5yDkMP5WdeT nOEOT58KIW8dczoeEXT2ds2pDbBO759ebi/2kNViLkxyJSudAKfW0CFaXCstklYasqCA +dYcLuibYYeQ9dcJf/s/Mj2uouNbM2X4qJoNk+RgYOOO57v/kjYT/LnEoS5AyUX0qViH QhCuVH9ytPMFxvnl/v7qlxrc5igy8Cv8blBE+gYgSrltv338wtzrn6kSzk/T5FiTZo+c MJGQ== 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=0cYVPCLV+HkS+4jAm6CgK1gArAa2hQVs18Chs69LRYY=; b=CllAKGKEWsN9VA2rpeOShtLjUfDDbtndP/hRmF78e8uvkqIof2sKqObr9QrOYOAWjU tJ4PkW3J0Tcx0SWypv356tWRDWdlfrqKhCoETL0EODUJSwuOfe/EVRWt4z3gpLntBXoT 1u4KnJ5VWIke2f58HkL+eAIwOcjpvlrXL/AO408gDWx2Ysqz0qkB+GXSv/MwvK8ZuzlZ v4DoKVOu2Q6ZrCv6x6UB7qOdIenZYGojMCOxwO7xPYujL4u+msIH2EuTaNSKCPwUdC1G OivntNNntIILK8IsH/X0azoEeCPnVXIEng9hXKfie7DybNZ6BE+Y5uBaGIZv6J+Im6Cv l2cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=cwC+tKlU; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w2-20020aa7d282000000b005024aa3e836si6790710edq.394.2023.04.02.09.57.07; Sun, 02 Apr 2023 09:57:31 -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=cwC+tKlU; 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 S231223AbjDBQtW (ORCPT + 99 others); Sun, 2 Apr 2023 12:49:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231151AbjDBQtT (ORCPT ); Sun, 2 Apr 2023 12:49: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 A8D11F741; Sun, 2 Apr 2023 09:49:18 -0700 (PDT) Received: from workpc.. (109-252-124-32.nat.spd-mgts.ru [109.252.124.32]) (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 EA3226602E9A; Sun, 2 Apr 2023 17:49:14 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680454157; bh=HiyDIkUkEjDEJF+osjkxQkulrceoXx475BclUH016Os=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cwC+tKlUtghtXqFxGAXYwzku4b2+TE0IjQ12simTDuoet2q0PP4V1f6uHSx47V3WP KQ8nFsLvFAGWHb4+uIWHwUB04Mz3cQq98ImYA70IIPzQHvZfaRR5tP5UTfKLm1+F/O ApvhCHuHxl7JOXBkAzMxNf+2LTi4F8RCwUGPHRLlN1USR4t3/KRK48vHaHwIp3VdPF N6vAVjXaBHt0k0q4jEUkOxxF6cC52ghP8fXF/iSoQMNasnzJtfOgHdP2pVeiLnHaef 3xBFze+MosYws9gNT+MOelFRJipTQiL64js8gKnDqMAD63kD7RGXenT5+MOP+lCSzv oI1I1BZswh6jQ== From: Dmitry Osipenko To: 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 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 v1 2/7] Revert "dma-buf/heaps: Assert held reservation lock for dma-buf mmapping" Date: Sun, 2 Apr 2023 19:48:21 +0300 Message-Id: <20230402164826.752842-3-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230402164826.752842-1-dmitry.osipenko@collabora.com> References: <20230402164826.752842-1-dmitry.osipenko@collabora.com> MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762084416223077824?= X-GMAIL-MSGID: =?utf-8?q?1762084416223077824?= 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, it's solved by moving the lock down to exporters. Fixes: 27f3733a1049 ("dma-buf/heaps: Assert held reservation lock for dma-buf mmapping") 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);