]> asedeno.scripts.mit.edu Git - linux.git/commit
mm/hmm: allow hmm_range to be used with a mmu_interval_notifier or hmm_mirror
authorJason Gunthorpe <jgg@mellanox.com>
Tue, 12 Nov 2019 20:22:20 +0000 (16:22 -0400)
committerJason Gunthorpe <jgg@mellanox.com>
Sat, 23 Nov 2019 23:56:44 +0000 (19:56 -0400)
commit04ec32fbc2b29a640d67872d2f88daac4c73e45b
tree35b141b60ac0b95cbaad2418b39fa7ec662c6cc1
parent99cb252f5e68d72afa3245a4e73d216d295cd335
mm/hmm: allow hmm_range to be used with a mmu_interval_notifier or hmm_mirror

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->valid = false
hmm_invalidate_range_end()
   range->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 <jglisse@redhat.com>
Tested-by: Philip Yang <Philip.Yang@amd.com>
Tested-by: Ralph Campbell <rcampbell@nvidia.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
include/linux/hmm.h
mm/hmm.c