From: Daniel Vetter <daniel@ffwll.ch>
To: "Christian König" <christian.koenig@amd.com>
Cc: Thomas Hellstrom <thellstrom@vmware.com>,
Daniel Vetter <daniel.vetter@ffwll.ch>,
Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
LKML <linux-kernel@vger.kernel.org>,
DRI Development <dri-devel@lists.freedesktop.org>,
linux-xfs@vger.kernel.org, Linux MM <linux-mm@kvack.org>,
Huang Rui <ray.huang@amd.com>, Brian Paul <brianp@vmware.com>,
linux-fsdevel@vger.kernel.org,
Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [PATCH] drm/ttm: don't set page->mapping
Date: Fri, 20 Nov 2020 16:01:48 +0100 [thread overview]
Message-ID: <20201120150148.GJ401619@phenom.ffwll.local> (raw)
In-Reply-To: <0b853a0e-b737-e02c-b885-0b0249449cb3@amd.com>
On Fri, Nov 20, 2020 at 11:08:31AM +0100, Christian König wrote:
> Am 20.11.20 um 11:05 schrieb Daniel Vetter:
> > On Fri, Nov 20, 2020 at 11:04 AM Christian König
> > <christian.koenig@amd.com> wrote:
> > > Am 20.11.20 um 10:54 schrieb Daniel Vetter:
> > > > Random observation while trying to review Christian's patch series to
> > > > stop looking at struct page for dma-buf imports.
> > > >
> > > > This was originally added in
> > > >
> > > > commit 58aa6622d32af7d2c08d45085f44c54554a16ed7
> > > > Author: Thomas Hellstrom <thellstrom@vmware.com>
> > > > Date: Fri Jan 3 11:47:23 2014 +0100
> > > >
> > > > drm/ttm: Correctly set page mapping and -index members
> > > >
> > > > Needed for some vm operations; most notably unmap_mapping_range() with
> > > > even_cows = 0.
> > > >
> > > > Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
> > > > Reviewed-by: Brian Paul <brianp@vmware.com>
> > > >
> > > > but we do not have a single caller of unmap_mapping_range with
> > > > even_cows == 0. And all the gem drivers don't do this, so another
> > > > small thing we could standardize between drm and ttm drivers.
> > > >
> > > > Plus I don't really see a need for unamp_mapping_range where we don't
> > > > want to indiscriminately shoot down all ptes.
> > > >
> > > > Cc: Thomas Hellstrom <thellstrom@vmware.com>
> > > > Cc: Brian Paul <brianp@vmware.com>
> > > > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > > > Cc: Christian Koenig <christian.koenig@amd.com>
> > > > Cc: Huang Rui <ray.huang@amd.com>
> > > This is still a NAK as long as we can't come up with a better way to
> > > track TTMs page allocations.
> > >
> > > Additional to that page_mapping() is used quite extensively in the mm
> > > code and I'm not sure if that isn't needed for other stuff as well.
> > Apologies, I'm honestly not quite sure how this lone patch here ended
> > up in this submission. I didn't want to send it out.
>
> No problem.
>
> But looking a bit deeper into the mm code that other drm drivers don't set
> this correctly and still use unmap_mapping_range() sounds like quite a bug
> to me.
>
> Going to track down what exactly that is used for.
Pagecache shootdown. unmap_mapping_range only shoots down from the virtual
side. Since that's all we care about, we don't need to set up the
address_space in the page.
-Daniel
>
> Christian.
>
> > -Daniel
> >
> > > Regards,
> > > Christian.
> > >
> > > > ---
> > > > drivers/gpu/drm/ttm/ttm_tt.c | 12 ------------
> > > > 1 file changed, 12 deletions(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
> > > > index da9eeffe0c6d..5b2eb6d58bb7 100644
> > > > --- a/drivers/gpu/drm/ttm/ttm_tt.c
> > > > +++ b/drivers/gpu/drm/ttm/ttm_tt.c
> > > > @@ -284,17 +284,6 @@ int ttm_tt_swapout(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
> > > > return ret;
> > > > }
> > > >
> > > > -static void ttm_tt_add_mapping(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
> > > > -{
> > > > - pgoff_t i;
> > > > -
> > > > - if (ttm->page_flags & TTM_PAGE_FLAG_SG)
> > > > - return;
> > > > -
> > > > - for (i = 0; i < ttm->num_pages; ++i)
> > > > - ttm->pages[i]->mapping = bdev->dev_mapping;
> > > > -}
> > > > -
> > > > int ttm_tt_populate(struct ttm_bo_device *bdev,
> > > > struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
> > > > {
> > > > @@ -313,7 +302,6 @@ int ttm_tt_populate(struct ttm_bo_device *bdev,
> > > > if (ret)
> > > > return ret;
> > > >
> > > > - ttm_tt_add_mapping(bdev, ttm);
> > > > ttm->page_flags |= TTM_PAGE_FLAG_PRIV_POPULATED;
> > > > if (unlikely(ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)) {
> > > > ret = ttm_tt_swapin(ttm);
> >
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2020-11-20 15:02 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-20 9:54 [PATCH 0/3] mmu_notifier fs fs_reclaim lockdep annotations Daniel Vetter
2020-11-20 9:54 ` [PATCH 1/3] mm: Track mmu notifiers in fs_reclaim_acquire/release Daniel Vetter
2020-11-20 18:23 ` Jason Gunthorpe
2020-11-20 9:54 ` [PATCH 2/3] mm: Extract might_alloc() debug check Daniel Vetter
2020-11-20 17:19 ` Randy Dunlap
2020-11-20 17:31 ` Daniel Vetter
2020-11-20 18:07 ` Jason Gunthorpe
2020-11-24 14:34 ` Daniel Vetter
2020-11-24 15:27 ` Jason Gunthorpe
2020-11-20 9:54 ` [PATCH 3/3] locking/selftests: Add testcases for fs_reclaim Daniel Vetter
2020-11-20 12:31 ` Peter Zijlstra
2020-11-20 9:54 ` [PATCH] drm/ttm: don't set page->mapping Daniel Vetter
2020-11-20 10:04 ` Christian König
2020-11-20 10:05 ` Daniel Vetter
2020-11-20 10:08 ` Christian König
2020-11-20 15:01 ` Daniel Vetter [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-11-25 16:25 [PATCH v4 0/3] mmu_notifier vs fs_reclaim lockdep annotations Daniel Vetter
2020-11-25 16:25 ` [PATCH] drm/ttm: don't set page->mapping Daniel Vetter
2020-11-25 16:28 ` Daniel Vetter
2020-11-25 18:06 ` Jason Gunthorpe
2020-11-25 18:16 ` Daniel Stone
[not found] ` <20201125181129.GA1858@infradead.org>
2020-11-25 23:57 ` Jason Gunthorpe
2020-11-04 16:50 Daniel Vetter
2020-11-05 7:59 ` Christian König
2020-11-05 9:11 ` Daniel Vetter
2020-11-05 12:29 ` Christian König
2020-11-05 12:50 ` Daniel Vetter
2020-11-05 12:56 ` Christian König
2020-11-05 13:20 ` Daniel Vetter
2020-11-05 13:22 ` Christian König
2020-11-05 14:31 ` Daniel Vetter
2020-11-05 14:38 ` Daniel Vetter
2020-11-05 15:15 ` Christian König
2020-11-05 16:37 ` Daniel Vetter
2020-11-06 8:30 ` Christian König
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=20201120150148.GJ401619@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=brianp@vmware.com \
--cc=christian.koenig@amd.com \
--cc=daniel.vetter@ffwll.ch \
--cc=daniel.vetter@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-xfs@vger.kernel.org \
--cc=ray.huang@amd.com \
--cc=thellstrom@vmware.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).