<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/mm/hmm.c, branch linux-5.7.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.7.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.7.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2020-03-30T19:58:36Z</updated>
<entry>
<title>mm/hmm: return error for non-vma snapshots</title>
<updated>2020-03-30T19:58:36Z</updated>
<author>
<name>Jason Gunthorpe</name>
</author>
<published>2020-03-27T20:00:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=bd5d3587b218d33d70a835582dfe1d8f8498e702'/>
<id>urn:sha1:bd5d3587b218d33d70a835582dfe1d8f8498e702</id>
<content type='text'>
The pagewalker does not call most ops with NULL vma, those are all routed
to hmm_vma_walk_hole() via ops-&gt;pte_hole instead.

Thus hmm_vma_fault() is only called with a NULL vma from
hmm_vma_walk_hole(), so hoist the NULL vma check to there.

Now it is clear that snapshotting with no vma is a HMM_PFN_ERROR as
without a vma we have no path to call hmm_vma_fault().

Link: https://lore.kernel.org/r/20200327200021.29372-10-jgg@ziepe.ca
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Jason Gunthorpe &lt;jgg@mellanox.com&gt;
</content>
</entry>
<entry>
<title>mm/hmm: do not set pfns when returning an error code</title>
<updated>2020-03-30T19:58:36Z</updated>
<author>
<name>Jason Gunthorpe</name>
</author>
<published>2020-03-27T20:00:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=53bfe17ff88faaadf024956e7cb2b295fae7744b'/>
<id>urn:sha1:53bfe17ff88faaadf024956e7cb2b295fae7744b</id>
<content type='text'>
Most places that return an error code, like -EFAULT, do not set
HMM_PFN_ERROR, only two places do this.

Resolve this inconsistency by never setting the pfns on an error
exit. This doesn't seem like a worthwhile thing to do anyhow.

If for some reason it becomes important, it makes more sense to directly
return the address of the failing page rather than have the caller scan
for the HMM_PFN_ERROR.

No caller inspects the pnfs output array if hmm_range_fault() fails.

Link: https://lore.kernel.org/r/20200327200021.29372-9-jgg@ziepe.ca
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Jason Gunthorpe &lt;jgg@mellanox.com&gt;
</content>
</entry>
<entry>
<title>mm/hmm: do not unconditionally set pfns when returning EBUSY</title>
<updated>2020-03-30T19:58:36Z</updated>
<author>
<name>Jason Gunthorpe</name>
</author>
<published>2020-03-27T20:00:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=846babe85efdda49feba5b169668333dcf3edf25'/>
<id>urn:sha1:846babe85efdda49feba5b169668333dcf3edf25</id>
<content type='text'>
In hmm_vma_handle_pte() and hmm_vma_walk_hugetlb_entry() if fault happens
then -EBUSY will be returned and the pfns input flags will have been
destroyed.

For hmm_vma_handle_pte() set HMM_PFN_NONE only on the success returns that
don't otherwise store to pfns.

For hmm_vma_walk_hugetlb_entry() all exit paths already set pfns, so
remove the redundant store.

Fixes: 2aee09d8c116 ("mm/hmm: change hmm_vma_fault() to allow write fault on page basis")
Link: https://lore.kernel.org/r/20200327200021.29372-8-jgg@ziepe.ca
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Jason Gunthorpe &lt;jgg@mellanox.com&gt;
</content>
</entry>
<entry>
<title>mm/hmm: use device_private_entry_to_pfn()</title>
<updated>2020-03-30T19:58:36Z</updated>
<author>
<name>Jason Gunthorpe</name>
</author>
<published>2020-03-27T20:00:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f66c9a33aee943aa43b3698c1f6f2619e28a1c77'/>
<id>urn:sha1:f66c9a33aee943aa43b3698c1f6f2619e28a1c77</id>
<content type='text'>
swp_offset() should not be called directly, the wrappers are supposed to
abstract away the encoding of the device_private specific information in
the swap entry.

Link: https://lore.kernel.org/r/20200327200021.29372-7-jgg@ziepe.ca
Reviewed-by: Ralph Campbell &lt;rcampbell@nvidia.com&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Tested-by: Ralph Campbell &lt;rcampbell@nvidia.com&gt;
Signed-off-by: Jason Gunthorpe &lt;jgg@mellanox.com&gt;
</content>
</entry>
<entry>
<title>mm/hmm: remove HMM_FAULT_SNAPSHOT</title>
<updated>2020-03-27T23:19:24Z</updated>
<author>
<name>Jason Gunthorpe</name>
</author>
<published>2020-03-27T20:00:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6bfef2f9194519ca23dee405a9f4db461a7a7826'/>
<id>urn:sha1:6bfef2f9194519ca23dee405a9f4db461a7a7826</id>
<content type='text'>
Now that flags are handled on a fine-grained per-page basis this global
flag is redundant and has a confusing overlap with the pfn_flags_mask and
default_flags.

Normalize the HMM_FAULT_SNAPSHOT behavior into one place. Callers needing
the SNAPSHOT behavior should set a pfn_flags_mask and default_flags that
always results in a cleared HMM_PFN_VALID. Then no pages will be faulted,
and HMM_FAULT_SNAPSHOT is not a special flow that overrides the masking
mechanism.

As this is the last flag, also remove the flags argument. If future flags
are needed they can be part of the struct hmm_range function arguments.

Link: https://lore.kernel.org/r/20200327200021.29372-5-jgg@ziepe.ca
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Jason Gunthorpe &lt;jgg@mellanox.com&gt;
</content>
</entry>
<entry>
<title>mm/hmm: remove unused code and tidy comments</title>
<updated>2020-03-27T23:19:24Z</updated>
<author>
<name>Jason Gunthorpe</name>
</author>
<published>2020-03-27T20:00:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f970b977e068aa54e6eaf916a964a0abaf028afe'/>
<id>urn:sha1:f970b977e068aa54e6eaf916a964a0abaf028afe</id>
<content type='text'>
Delete several functions that are never called, fix some desync between
comments and structure content, toss the now out of date top of file
header, and move one function only used by hmm.c into hmm.c

Link: https://lore.kernel.org/r/20200327200021.29372-4-jgg@ziepe.ca
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Jason Gunthorpe &lt;jgg@mellanox.com&gt;
</content>
</entry>
<entry>
<title>mm/hmm: return the fault type from hmm_pte_need_fault()</title>
<updated>2020-03-27T23:19:24Z</updated>
<author>
<name>Jason Gunthorpe</name>
</author>
<published>2020-03-27T20:00:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a3eb13c1579ba97d79fbbc98bc5b1296a3688a25'/>
<id>urn:sha1:a3eb13c1579ba97d79fbbc98bc5b1296a3688a25</id>
<content type='text'>
Using two bools instead of flags return is not necessary and leads to
bugs. Returning a value is easier for the compiler to check and easier to
pass around the code flow.

Convert the two bools into flags and push the change to all callers.

Link: https://lore.kernel.org/r/20200327200021.29372-3-jgg@ziepe.ca
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Jason Gunthorpe &lt;jgg@mellanox.com&gt;
</content>
</entry>
<entry>
<title>mm/hmm: remove pgmap checking for devmap pages</title>
<updated>2020-03-27T23:19:23Z</updated>
<author>
<name>Jason Gunthorpe</name>
</author>
<published>2020-03-27T20:00:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=068354ade5dd9e2b07d9b0c57055a681db6f4e37'/>
<id>urn:sha1:068354ade5dd9e2b07d9b0c57055a681db6f4e37</id>
<content type='text'>
The checking boils down to some racy check if the pagemap is still
available or not. Instead of checking this, rely entirely on the
notifiers, if a pagemap is destroyed then all pages that belong to it must
be removed from the tables and the notifiers triggered.

Link: https://lore.kernel.org/r/20200327200021.29372-2-jgg@ziepe.ca
Reviewed-by: Ralph Campbell &lt;rcampbell@nvidia.com&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Tested-by: Ralph Campbell &lt;rcampbell@nvidia.com&gt;
Signed-off-by: Jason Gunthorpe &lt;jgg@mellanox.com&gt;
</content>
</entry>
<entry>
<title>mm/hmm: check the device private page owner in hmm_range_fault()</title>
<updated>2020-03-26T17:33:38Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2020-03-16T19:32:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=08ddddda667b3b7aaac10641418283f78118c5cd'/>
<id>urn:sha1:08ddddda667b3b7aaac10641418283f78118c5cd</id>
<content type='text'>
hmm_range_fault() will succeed for any kind of device private memory, even
if it doesn't belong to the calling entity.  While nouveau has some crude
checks for that, they are broken because they assume nouveau is the only
user of device private memory.  Fix this by passing in an expected pgmap
owner in the hmm_range_fault structure.

If a device_private page is found and doesn't match the owner then it is
treated as an non-present and non-faultable page.

This prevents a bug in amdgpu, where it doesn't know how to handle
device_private pages, but hmm_range_fault would return them anyhow.

Fixes: 4ef589dc9b10 ("mm/hmm/devmem: device memory hotplug using ZONE_DEVICE")
Link: https://lore.kernel.org/r/20200316193216.920734-5-hch@lst.de
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Jason Gunthorpe &lt;jgg@mellanox.com&gt;
Reviewed-by: Ralph Campbell &lt;rcampbell@nvidia.com&gt;
Signed-off-by: Jason Gunthorpe &lt;jgg@mellanox.com&gt;
</content>
</entry>
<entry>
<title>mm: simplify device private page handling in hmm_range_fault</title>
<updated>2020-03-26T17:33:38Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2020-03-16T19:32:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=17ffdc482982af92bddb59692af1c5e1de23d184'/>
<id>urn:sha1:17ffdc482982af92bddb59692af1c5e1de23d184</id>
<content type='text'>
Remove the HMM_PFN_DEVICE_PRIVATE flag, no driver has ever set this flag
on input, and the only place that uses it on output can be trivially
changed to use is_device_private_page().

This removes the ability to request that device_private pages are faulted
back into system memory.

Link: https://lore.kernel.org/r/20200316193216.920734-4-hch@lst.de
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Jason Gunthorpe &lt;jgg@mellanox.com&gt;
Signed-off-by: Jason Gunthorpe &lt;jgg@mellanox.com&gt;
</content>
</entry>
</feed>
