From: Jason Gunthorpe <jgg@ziepe.ca>
To: Alistair Popple <apopple@nvidia.com>
Cc: akpm@linux-foundation.org, Felix.Kuehling@amd.com,
linux-mm@kvack.org, rcampbell@nvidia.com,
linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org,
Alex Sierra <alex.sierra@amd.com>,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
hch@lst.de, jglisse@redhat.com, willy@infradead.org
Subject: Re: [PATCH v2 03/11] mm/gup: migrate PIN_LONGTERM dev coherent pages to system
Date: Wed, 8 Dec 2021 22:53:22 -0400 [thread overview]
Message-ID: <20211209025322.GE6467@ziepe.ca> (raw)
In-Reply-To: <117075453.Ddeq1f3ylz@nvdebian>
On Thu, Dec 09, 2021 at 12:45:24PM +1100, Alistair Popple wrote:
> On Thursday, 9 December 2021 12:53:45 AM AEDT Jason Gunthorpe wrote:
> > > I think a similar problem exists for device private fault handling as well and
> > > it has been on my list of things to fix for a while. I think the solution is to
> > > call try_get_page(), except it doesn't work with device pages due to the whole
> > > refcount thing. That issue is blocking a fair bit of work now so I've started
> > > looking into it.
> >
> > Where is this?
>
> Nothing posted yet. I've been going through the mailing list and the old
> thread[1] to get an understanding of what is left to do. If you have any
> suggestions they would be welcome.
Oh, that
Joao's series here is the first step:
https://lore.kernel.org/linux-mm/20211202204422.26777-1-joao.m.martins@oracle.com/
I already sent a patch to remove the DRM usage of PUD/PMD -
0d979509539e ("drm/ttm: remove ttm_bo_vm_insert_huge()")
Next, someone needs to change FSDAX to have a folio covering the
ZONE_DEVICE pages before it installs a PUD or PMD. I don't know
anything about FS's to know how to do this at all.
Thus all PUD/PMD entries will point at a head page or larger of a
compound. This is important because all the existing machinery for THP
assumes 1 PUD/PMD means 1 struct page to manipulate.
Then, consolidate all the duplicated code that runs when a page is
removed from a PTE/PMD/PUD etc into a function. Figure out why the
duplications are different to make them the same (I have some rough
patches for this step)
Start with PUD and have zap on PUD call the consolidated function and
make vmf_insert_pfn_pud_prot() accept a struct page not pfn and incr
the refcount. PUD is easy because there is no THP
Then do the same to PMD without breaking the THP code
Then make the PTE also incr the refcount on insert and zap
Exterminate vma_is_special_huge() along the way, there is no such
thing as a special huge VMA without a pud/pmd_special flag so all
things installed here must be struct page and not special.
Then the patches that are already posted are applicable and we can
kill the refcount == 1 stuff. No 0 ref count pages installed in page
tables.
Once all of that is done it is fairly straightforward to remove
pud/pmd/pte_devmap entirely and the pgmap stuff from gup.c
Jason
next prev parent reply other threads:[~2021-12-09 2:53 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-06 18:52 [PATCH v2 00/11] Add MEMORY_DEVICE_COHERENT for coherent device memory mapping Alex Sierra
2021-12-06 18:52 ` [PATCH v2 01/11] mm: add zone device coherent type memory support Alex Sierra
2021-12-06 18:52 ` [PATCH v2 02/11] mm: add device coherent vma selection for memory migration Alex Sierra
2021-12-06 18:52 ` [PATCH v2 03/11] mm/gup: migrate PIN_LONGTERM dev coherent pages to system Alex Sierra
2021-12-08 11:31 ` Alistair Popple
2021-12-08 13:53 ` Jason Gunthorpe
2021-12-09 1:45 ` Alistair Popple
2021-12-09 2:53 ` Jason Gunthorpe [this message]
2021-12-08 16:58 ` Felix Kuehling
2021-12-08 17:30 ` Felix Kuehling
2021-12-08 18:55 ` Sierra Guiza, Alejandro (Alex)
2021-12-09 10:53 ` Alistair Popple
2021-12-09 16:29 ` Felix Kuehling
[not found] ` <72fe6b48-4aa5-b766-3f33-8c3445fdcc99@amd.com>
2021-12-10 1:31 ` Alistair Popple
2021-12-10 16:39 ` Felix Kuehling
2021-12-06 18:52 ` [PATCH v2 04/11] drm/amdkfd: add SPM support for SVM Alex Sierra
2021-12-06 18:52 ` [PATCH v2 05/11] drm/amdkfd: coherent type as sys mem on migration to ram Alex Sierra
2021-12-06 18:52 ` [PATCH v2 06/11] lib: test_hmm add ioctl to get zone device type Alex Sierra
2021-12-06 18:52 ` [PATCH v2 07/11] lib: test_hmm add module param for " Alex Sierra
2021-12-06 18:52 ` [PATCH v2 08/11] lib: add support for device coherent type in test_hmm Alex Sierra
2022-01-03 20:24 ` Liam Howlett
2021-12-06 18:52 ` [PATCH v2 09/11] tools: update hmm-test to support device coherent type Alex Sierra
2021-12-06 18:52 ` [PATCH v2 10/11] tools: update test_hmm script to support SP config Alex Sierra
2021-12-06 18:52 ` [PATCH v2 11/11] tools: add hmm gup test for long term pinned device pages Alex Sierra
2021-12-07 19:31 ` Jason Gunthorpe
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=20211209025322.GE6467@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=Felix.Kuehling@amd.com \
--cc=akpm@linux-foundation.org \
--cc=alex.sierra@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=apopple@nvidia.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=hch@lst.de \
--cc=jglisse@redhat.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-xfs@vger.kernel.org \
--cc=rcampbell@nvidia.com \
--cc=willy@infradead.org \
/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).