From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: Daniel Vetter <daniel.vetter@ffwll.ch>,
DRI Development <dri-devel@lists.freedesktop.org>
Cc: linux-xfs@vger.kernel.org,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
linux-rdma@vger.kernel.org,
"Intel Graphics Development" <intel-gfx@lists.freedesktop.org>,
"Dave Chinner" <david@fromorbit.com>,
"Christian König" <christian.koenig@amd.com>,
linaro-mm-sig@lists.linaro.org, linux-mm@kvack.org,
"Jason Gunthorpe" <jgg@mellanox.com>, "Qian Cai" <cai@lca.pw>,
linux-fsdevel@vger.kernel.org,
"Daniel Vetter" <daniel.vetter@intel.com>,
"Andrew Morton" <akpm@linux-foundation.org>,
linux-media@vger.kernel.org
Subject: Re: [Linaro-mm-sig] [PATCH] dma-resv: lockdep-prime address_space->i_mmap_rwsem for dma-resv
Date: Thu, 30 Jul 2020 14:03:09 +0200 [thread overview]
Message-ID: <b9b42b4e-78cd-ed10-5ce5-a9261b018e08@gmail.com> (raw)
In-Reply-To: <20200728135839.1035515-1-daniel.vetter@ffwll.ch>
Am 28.07.20 um 15:58 schrieb Daniel Vetter:
> GPU drivers need this in their shrinkers, to be able to throw out
> mmap'ed buffers. Note that we also need dma_resv_lock in shrinkers,
> but that loop is resolved by trylocking in shrinkers.
>
> So full hierarchy is now (ignore some of the other branches we already
> have primed):
>
> mmap_read_lock -> dma_resv -> shrinkers -> i_mmap_lock_write
>
> I hope that's not inconsistent with anything mm or fs does, adding
> relevant people.
>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Sumit Semwal <sumit.semwal@linaro.org>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: linux-media@vger.kernel.org
> Cc: linaro-mm-sig@lists.linaro.org
> Cc: Dave Chinner <david@fromorbit.com>
> Cc: Qian Cai <cai@lca.pw>
> Cc: linux-xfs@vger.kernel.org
> Cc: linux-fsdevel@vger.kernel.org
> Cc: Thomas Hellström (Intel) <thomas_os@shipmail.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Jason Gunthorpe <jgg@mellanox.com>
> Cc: linux-mm@kvack.org
> Cc: linux-rdma@vger.kernel.org
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
> ---
> drivers/dma-buf/dma-resv.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/dma-buf/dma-resv.c b/drivers/dma-buf/dma-resv.c
> index 0e6675ec1d11..9678162a4ac5 100644
> --- a/drivers/dma-buf/dma-resv.c
> +++ b/drivers/dma-buf/dma-resv.c
> @@ -104,12 +104,14 @@ static int __init dma_resv_lockdep(void)
> struct mm_struct *mm = mm_alloc();
> struct ww_acquire_ctx ctx;
> struct dma_resv obj;
> + struct address_space mapping;
> int ret;
>
> if (!mm)
> return -ENOMEM;
>
> dma_resv_init(&obj);
> + address_space_init_once(&mapping);
>
> mmap_read_lock(mm);
> ww_acquire_init(&ctx, &reservation_ww_class);
> @@ -117,6 +119,9 @@ static int __init dma_resv_lockdep(void)
> if (ret == -EDEADLK)
> dma_resv_lock_slow(&obj, &ctx);
> fs_reclaim_acquire(GFP_KERNEL);
> + /* for unmap_mapping_range on trylocked buffer objects in shrinkers */
> + i_mmap_lock_write(&mapping);
> + i_mmap_unlock_write(&mapping);
> #ifdef CONFIG_MMU_NOTIFIER
> lock_map_acquire(&__mmu_notifier_invalidate_range_start_map);
> __dma_fence_might_wait();
next prev parent reply other threads:[~2020-07-30 12:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-28 13:58 [PATCH] dma-resv: lockdep-prime address_space->i_mmap_rwsem for dma-resv Daniel Vetter
2020-07-30 12:03 ` Christian König [this message]
2020-07-30 12:17 ` Thomas Hellström (Intel)
2020-07-30 13:17 ` Daniel Vetter
2020-07-30 16:45 ` Thomas Hellström (Intel)
2020-09-17 13:19 ` Daniel Vetter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b9b42b4e-78cd-ed10-5ce5-a9261b018e08@gmail.com \
--to=ckoenig.leichtzumerken@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=cai@lca.pw \
--cc=christian.koenig@amd.com \
--cc=daniel.vetter@ffwll.ch \
--cc=daniel.vetter@intel.com \
--cc=david@fromorbit.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jgg@mellanox.com \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).