<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/mm/hmm.c, branch linux-5.5.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.5.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.5.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2019-11-23T23:56:45Z</updated>
<entry>
<title>mm/hmm: remove hmm_range_dma_map and hmm_range_dma_unmap</title>
<updated>2019-11-23T23:56:45Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2019-11-13T13:45:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=93f4e735b6d98ee4b7a1252d81e815a983e359f2'/>
<id>urn:sha1:93f4e735b6d98ee4b7a1252d81e815a983e359f2</id>
<content type='text'>
These two functions have never been used since they were added.

Link: https://lore.kernel.org/r/20191113134528.21187-1-hch@lst.de
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: John Hubbard &lt;jhubbard@nvidia.com&gt;
Reviewed-by: Jason Gunthorpe &lt;jgg@mellanox.com&gt;
Signed-off-by: Jason Gunthorpe &lt;jgg@mellanox.com&gt;
</content>
</entry>
<entry>
<title>mm/hmm: make full use of walk_page_range()</title>
<updated>2019-11-23T23:56:45Z</updated>
<author>
<name>Ralph Campbell</name>
</author>
<published>2019-11-04T22:21:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d28c2c9a487708b9db519ce7fedc10333032c76b'/>
<id>urn:sha1:d28c2c9a487708b9db519ce7fedc10333032c76b</id>
<content type='text'>
hmm_range_fault() calls find_vma() and walk_page_range() in a loop.  This
is unnecessary duplication since walk_page_range() calls find_vma() in a
loop already.

Simplify hmm_range_fault() by defining a walk_test() callback function to
filter unhandled vmas.

This also fixes a bug where hmm_range_fault() was not checking start &gt;=
vma-&gt;vm_start before checking vma-&gt;vm_flags so hmm_range_fault() could
return an error based on the wrong vma for the requested range.

It also fixes a bug when the vma has no read access and the caller did not
request a fault, there shouldn't be any error return code.

Link: https://lore.kernel.org/r/20191104222141.5173-2-rcampbell@nvidia.com
Signed-off-by: Ralph Campbell &lt;rcampbell@nvidia.com&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
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>
<entry>
<title>mm/hmm: remove hmm_mirror and related</title>
<updated>2019-11-23T23:56:45Z</updated>
<author>
<name>Jason Gunthorpe</name>
</author>
<published>2019-11-12T20:22:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a22dd506400d0f4784ad596f073b9eb5ed7c6a2a'/>
<id>urn:sha1:a22dd506400d0f4784ad596f073b9eb5ed7c6a2a</id>
<content type='text'>
The only two users of this are now converted to use mmu_interval_notifier,
delete all the code and update hmm.rst.

Link: https://lore.kernel.org/r/20191112202231.3856-14-jgg@ziepe.ca
Reviewed-by: Jérôme Glisse &lt;jglisse@redhat.com&gt;
Tested-by: Ralph Campbell &lt;rcampbell@nvidia.com&gt;
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: allow hmm_range to be used with a mmu_interval_notifier or hmm_mirror</title>
<updated>2019-11-23T23:56:44Z</updated>
<author>
<name>Jason Gunthorpe</name>
</author>
<published>2019-11-12T20:22:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=04ec32fbc2b29a640d67872d2f88daac4c73e45b'/>
<id>urn:sha1:04ec32fbc2b29a640d67872d2f88daac4c73e45b</id>
<content type='text'>
hmm_mirror's handling of ranges does not use a sequence count which
results in this bug:

         CPU0                                   CPU1
                                     hmm_range_wait_until_valid(range)
                                         valid == true
                                     hmm_range_fault(range)
hmm_invalidate_range_start()
   range-&gt;valid = false
hmm_invalidate_range_end()
   range-&gt;valid = true
                                     hmm_range_valid(range)
                                          valid == true

Where the hmm_range_valid() should not have succeeded.

Adding the required sequence count would make it nearly identical to the
new mmu_interval_notifier. Instead replace the hmm_mirror stuff with
mmu_interval_notifier.

Co-existence of the two APIs is the first step.

Link: https://lore.kernel.org/r/20191112202231.3856-4-jgg@ziepe.ca
Reviewed-by: Jérôme Glisse &lt;jglisse@redhat.com&gt;
Tested-by: Philip Yang &lt;Philip.Yang@amd.com&gt;
Tested-by: Ralph Campbell &lt;rcampbell@nvidia.com&gt;
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: allow snapshot of the special zero page</title>
<updated>2019-10-29T17:26:28Z</updated>
<author>
<name>Ralph Campbell</name>
</author>
<published>2019-10-23T19:55:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ac541f2503722943a9f13e0c92ed07632ba7fd38'/>
<id>urn:sha1:ac541f2503722943a9f13e0c92ed07632ba7fd38</id>
<content type='text'>
If a device driver like nouveau tries to use hmm_range_fault() to access
the special shared zero page in system memory, hmm_range_fault() will
return -EFAULT and kill the process.

Allow hmm_range_fault() to return success (0) when the CPU pagetable entry
points to the special shared zero page.

page_to_pfn() and pfn_to_page() are defined on the zero page so just
handle it like any other page.

Link: https://lore.kernel.org/r/20191023195515.13168-3-rcampbell@nvidia.com
Signed-off-by: Ralph Campbell &lt;rcampbell@nvidia.com&gt;
Reviewed-by: "Jérôme Glisse" &lt;jglisse@redhat.com&gt;
Acked-by: David Hildenbrand &lt;david@redhat.com&gt;
Signed-off-by: Jason Gunthorpe &lt;jgg@mellanox.com&gt;
</content>
</entry>
<entry>
<title>pagewalk: separate function pointers from iterator data</title>
<updated>2019-09-07T07:28:04Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2019-08-28T14:19:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7b86ac3371b70c3fd8fd95501719beb1faab719f'/>
<id>urn:sha1:7b86ac3371b70c3fd8fd95501719beb1faab719f</id>
<content type='text'>
The mm_walk structure currently mixed data and code.  Split out the
operations vectors into a new mm_walk_ops structure, and while we are
changing the API also declare the mm_walk structure inside the
walk_page_range and walk_page_vma functions.

Based on patch from Linus Torvalds.

Link: https://lore.kernel.org/r/20190828141955.22210-3-hch@lst.de
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Thomas Hellstrom &lt;thellstrom@vmware.com&gt;
Reviewed-by: Steven Price &lt;steven.price@arm.com&gt;
Reviewed-by: Jason Gunthorpe &lt;jgg@mellanox.com&gt;
Signed-off-by: Jason Gunthorpe &lt;jgg@mellanox.com&gt;
</content>
</entry>
<entry>
<title>mm: split out a new pagewalk.h header from mm.h</title>
<updated>2019-09-07T07:28:04Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2019-08-28T14:19:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a520110e4a15ceb385304d9cab22bb51438f6080'/>
<id>urn:sha1:a520110e4a15ceb385304d9cab22bb51438f6080</id>
<content type='text'>
Add a new header for the two handful of users of the walk_page_range /
walk_page_vma interface instead of polluting all users of mm.h with it.

Link: https://lore.kernel.org/r/20190828141955.22210-2-hch@lst.de
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Thomas Hellstrom &lt;thellstrom@vmware.com&gt;
Reviewed-by: Steven Price &lt;steven.price@arm.com&gt;
Reviewed-by: Jason Gunthorpe &lt;jgg@mellanox.com&gt;
Signed-off-by: Jason Gunthorpe &lt;jgg@mellanox.com&gt;
</content>
</entry>
<entry>
<title>mm/hmm: hmm_range_fault() infinite loop</title>
<updated>2019-08-27T22:27:07Z</updated>
<author>
<name>Ralph Campbell</name>
</author>
<published>2019-08-23T22:17:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c18ce674d548c00faa6b7e760bacbaf1f39315f3'/>
<id>urn:sha1:c18ce674d548c00faa6b7e760bacbaf1f39315f3</id>
<content type='text'>
Normally, callers to handle_mm_fault() are supposed to check the
vma-&gt;vm_flags first. hmm_range_fault() checks for VM_READ but doesn't
check for VM_WRITE if the caller requests a page to be faulted in with
write permission (via the hmm_range.pfns[] value).  If the vma is write
protected, this can result in an infinite loop:

  hmm_range_fault()
    walk_page_range()
      ...
      hmm_vma_walk_hole()
        hmm_vma_walk_hole_()
          hmm_vma_do_fault()
            handle_mm_fault(FAULT_FLAG_WRITE)
            /* returns VM_FAULT_WRITE */
          /* returns -EBUSY */
        /* returns -EBUSY */
      /* returns -EBUSY */
    /* loops on -EBUSY and range-&gt;valid */

Prevent this by checking for vma-&gt;vm_flags &amp; VM_WRITE before calling
handle_mm_fault().

Link: https://lore.kernel.org/r/20190823221753.2514-3-rcampbell@nvidia.com
Signed-off-by: Ralph Campbell &lt;rcampbell@nvidia.com&gt;
Reviewed-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>
<entry>
<title>mm/hmm: hmm_range_fault() NULL pointer bug</title>
<updated>2019-08-27T22:27:07Z</updated>
<author>
<name>Ralph Campbell</name>
</author>
<published>2019-08-23T22:17:52Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6c64f2bbe79cf3b770ac60ae79442322bd76d55e'/>
<id>urn:sha1:6c64f2bbe79cf3b770ac60ae79442322bd76d55e</id>
<content type='text'>
Although hmm_range_fault() calls find_vma() to make sure that a vma exists
before calling walk_page_range(), hmm_vma_walk_hole() can still be called
with walk-&gt;vma == NULL if the start and end address are not contained
within the vma range.

 hmm_range_fault() /* calls find_vma() but no range check */
  walk_page_range() /* calls find_vma(), sets walk-&gt;vma = NULL */
   __walk_page_range()
    walk_pgd_range()
     walk_p4d_range()
      walk_pud_range()
       hmm_vma_walk_hole()
        hmm_vma_walk_hole_()
         hmm_vma_do_fault()
          handle_mm_fault(vma=0)

Link: https://lore.kernel.org/r/20190823221753.2514-2-rcampbell@nvidia.com
Signed-off-by: Ralph Campbell &lt;rcampbell@nvidia.com&gt;
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: fix hmm_range_fault()'s handling of swapped out pages</title>
<updated>2019-08-23T13:22:20Z</updated>
<author>
<name>Yang, Philip</name>
</author>
<published>2019-08-15T20:52:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e3fe8e555dd05cf74168d18555c44320ed50a0e1'/>
<id>urn:sha1:e3fe8e555dd05cf74168d18555c44320ed50a0e1</id>
<content type='text'>
hmm_range_fault() may return NULL pages because some of the pfns are equal
to HMM_PFN_NONE. This happens randomly under memory pressure. The reason
is during the swapped out page pte path, hmm_vma_handle_pte() doesn't
update the fault variable from cpu_flags, so it failed to call
hmm_vam_do_fault() to swap the page in.

The fix is to call hmm_pte_need_fault() to update fault variable.

Fixes: 74eee180b935 ("mm/hmm/mirror: device page fault handler")
Link: https://lore.kernel.org/r/20190815205227.7949-1-Philip.Yang@amd.com
Signed-off-by: Philip Yang &lt;Philip.Yang@amd.com&gt;
Reviewed-by: "Jérôme Glisse" &lt;jglisse@redhat.com&gt;
Signed-off-by: Jason Gunthorpe &lt;jgg@mellanox.com&gt;
</content>
</entry>
</feed>
