Commit Graph

28 Commits

Author SHA1 Message Date
cki-backport-bot 6089b88282 lib/test_hmm.c: handle src_pfns and dst_pfns allocation failure
JIRA: https://issues.redhat.com/browse/RHEL-44261
CVE: CVE-2024-38543

commit c2af060d1c18beaec56351cf9c9bcbbc5af341a3
Author: Duoming Zhou <duoming@zju.edu.cn>
Date:   Tue Mar 12 08:59:05 2024 +0800

    lib/test_hmm.c: handle src_pfns and dst_pfns allocation failure

    The kcalloc() in dmirror_device_evict_chunk() will return null if the
    physical memory has run out.  As a result, if src_pfns or dst_pfns is
    dereferenced, the null pointer dereference bug will happen.

    Moreover, the device is going away.  If the kcalloc() fails, the pages
    mapping a chunk could not be evicted.  So add a __GFP_NOFAIL flag in
    kcalloc().

    Finally, as there is no need to have physically contiguous memory, Switch
    kcalloc() to kvcalloc() in order to avoid failing allocations.

    Link: https://lkml.kernel.org/r/20240312005905.9939-1-duoming@zju.edu.cn
    Fixes: b2ef9f5a5c ("mm/hmm/test: add selftest driver for HMM")
    Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
    Cc: Jérôme Glisse <jglisse@redhat.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Signed-off-by: cki-backport-bot <cki-ci-bot+cki-gitlab-backport-bot@redhat.com>
2024-06-25 16:13:39 +00:00
Nico Pache 027904c924 lib: replace kmap() with kmap_local_page()
commit ae96e0cdc78c816b93f9617d65d144162692c09c
Author: Sumitra Sharma <sumitraartsy@gmail.com>
Date:   Sat Jun 10 10:57:12 2023 -0700

    lib: replace kmap() with kmap_local_page()

    kmap() has been deprecated in favor of the kmap_local_page() due to high
    cost, restricted mapping space, the overhead of a global lock for
    synchronization, and making the process sleep in the absence of free
    slots.

    kmap_local_page() is faster than kmap() and offers thread-local and
    CPU-local mappings, take pagefaults in a local kmap region and preserves
    preemption by saving the mappings of outgoing tasks and restoring those of
    the incoming one during a context switch.

    The mappings are kept thread local in the functions “dmirror_do_read”
    and “dmirror_do_write” in test_hmm.c

    Therefore, replace kmap() with kmap_local_page() and use
    mempcy_from/to_page() to avoid open coding kmap_local_page() + memcpy() +
    kunmap_local().

    Remove the unused variable “tmp”.

    Link: https://lkml.kernel.org/r/20230610175712.GA348514@sumitra.com
    Signed-off-by: Sumitra Sharma <sumitraartsy@gmail.com>
    Suggested-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
    Reviewed-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
    Reviewed-by: Ira Weiny <ira.weiny@intel.com>
    Cc: Deepak R Varma <drv@mailo.com>
    Cc: Jérôme Glisse <jglisse@redhat.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

JIRA: https://issues.redhat.com/browse/RHEL-5617
Signed-off-by: Nico Pache <npache@redhat.com>
2024-01-19 10:10:59 -07:00
Donald Dutile 18c3e9737d hmm-tests: add test for migrate_device_range()
Bugzilla: http://bugzilla.redhat.com/2159905

commit ad4c365221b0f92f9c24a203119f2bade30c970e
Author: Alistair Popple <apopple@nvidia.com>
Date:   Wed Sep 28 22:01:22 2022 +1000

    hmm-tests: add test for migrate_device_range()

    Link: https://lkml.kernel.org/r/a73cf109de0224cfd118d22be58ddebac3ae2897.1664366292.git-series.apopple@nvidia.com
    Signed-off-by: Alistair Popple <apopple@nvidia.com>
    Cc: Jason Gunthorpe <jgg@nvidia.com>
    Cc: Ralph Campbell <rcampbell@nvidia.com>
    Cc: John Hubbard <jhubbard@nvidia.com>
    Cc: Alex Sierra <alex.sierra@amd.com>
    Cc: Felix Kuehling <Felix.Kuehling@amd.com>
    Cc: Alex Deucher <alexander.deucher@amd.com>
    Cc: Ben Skeggs <bskeggs@redhat.com>
    Cc: Christian König <christian.koenig@amd.com>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: "Huang, Ying" <ying.huang@intel.com>
    Cc: Lyude Paul <lyude@redhat.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: Michael Ellerman <mpe@ellerman.id.au>
    Cc: Yang Shi <shy828301@gmail.com>
    Cc: Zi Yan <ziy@nvidia.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Signed-off-by: Donald Dutile <ddutile@redhat.com>
2023-05-02 16:47:26 -04:00
Donald Dutile f35c38369a mm: free device private pages have zero refcount
Bugzilla: http://bugzilla.redhat.com/2159905

commit ef233450898f8893dafa193a9f3211fa077a3d05
Author: Alistair Popple <apopple@nvidia.com>
Date:   Wed Sep 28 22:01:16 2022 +1000

    mm: free device private pages have zero refcount

    Since 27674ef6c73f ("mm: remove the extra ZONE_DEVICE struct page
    refcount") device private pages have no longer had an extra reference
    count when the page is in use.  However before handing them back to the
    owning device driver we add an extra reference count such that free pages
    have a reference count of one.

    This makes it difficult to tell if a page is free or not because both free
    and in use pages will have a non-zero refcount.  Instead we should return
    pages to the drivers page allocator with a zero reference count.  Kernel
    code can then safely use kernel functions such as get_page_unless_zero().

    Link: https://lkml.kernel.org/r/cf70cf6f8c0bdb8aaebdbfb0d790aea4c683c3c6.1664366292.git-series.apopple@nvidia.com
    Signed-off-by: Alistair Popple <apopple@nvidia.com>
    Acked-by: Felix Kuehling <Felix.Kuehling@amd.com>
    Cc: Jason Gunthorpe <jgg@nvidia.com>
    Cc: Michael Ellerman <mpe@ellerman.id.au>
    Cc: Alex Deucher <alexander.deucher@amd.com>
    Cc: Christian König <christian.koenig@amd.com>
    Cc: Ben Skeggs <bskeggs@redhat.com>
    Cc: Lyude Paul <lyude@redhat.com>
    Cc: Ralph Campbell <rcampbell@nvidia.com>
    Cc: Alex Sierra <alex.sierra@amd.com>
    Cc: John Hubbard <jhubbard@nvidia.com>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: "Huang, Ying" <ying.huang@intel.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: Yang Shi <shy828301@gmail.com>
    Cc: Zi Yan <ziy@nvidia.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Signed-off-by: Donald Dutile <ddutile@redhat.com>
2023-05-02 16:47:26 -04:00
Donald Dutile 6217af187c mm/memory.c: fix race when faulting a device private page
Bugzilla: http://bugzilla.redhat.com/2159905

commit 16ce101db85db694a91380aa4c89b25530871d33
Author: Alistair Popple <apopple@nvidia.com>
Date:   Wed Sep 28 22:01:15 2022 +1000

    mm/memory.c: fix race when faulting a device private page

    Patch series "Fix several device private page reference counting issues",
    v2

    This series aims to fix a number of page reference counting issues in
    drivers dealing with device private ZONE_DEVICE pages.  These result in
    use-after-free type bugs, either from accessing a struct page which no
    longer exists because it has been removed or accessing fields within the
    struct page which are no longer valid because the page has been freed.

    During normal usage it is unlikely these will cause any problems.  However
    without these fixes it is possible to crash the kernel from userspace.
    These crashes can be triggered either by unloading the kernel module or
    unbinding the device from the driver prior to a userspace task exiting.
    In modules such as Nouveau it is also possible to trigger some of these
    issues by explicitly closing the device file-descriptor prior to the task
    exiting and then accessing device private memory.

    This involves some minor changes to both PowerPC and AMD GPU code.
    Unfortunately I lack hardware to test either of those so any help there
    would be appreciated.  The changes mimic what is done in for both Nouveau
    and hmm-tests though so I doubt they will cause problems.

    This patch (of 8):

    When the CPU tries to access a device private page the migrate_to_ram()
    callback associated with the pgmap for the page is called.  However no
    reference is taken on the faulting page.  Therefore a concurrent migration
    of the device private page can free the page and possibly the underlying
    pgmap.  This results in a race which can crash the kernel due to the
    migrate_to_ram() function pointer becoming invalid.  It also means drivers
    can't reliably read the zone_device_data field because the page may have
    been freed with memunmap_pages().

    Close the race by getting a reference on the page while holding the ptl to
    ensure it has not been freed.  Unfortunately the elevated reference count
    will cause the migration required to handle the fault to fail.  To avoid
    this failure pass the faulting page into the migrate_vma functions so that
    if an elevated reference count is found it can be checked to see if it's
    expected or not.

    [mpe@ellerman.id.au: fix build]
      Link: https://lkml.kernel.org/r/87fsgbf3gh.fsf@mpe.ellerman.id.au
    Link: https://lkml.kernel.org/r/cover.60659b549d8509ddecafad4f498ee7f03bb23c69.1664366292.git-series.apopple@nvidia.com
    Link: https://lkml.kernel.org/r/d3e813178a59e565e8d78d9b9a4e2562f6494f90.1664366292.git-series.apopple@nvidia.com
    Signed-off-by: Alistair Popple <apopple@nvidia.com>
    Acked-by: Felix Kuehling <Felix.Kuehling@amd.com>
    Cc: Jason Gunthorpe <jgg@nvidia.com>
    Cc: John Hubbard <jhubbard@nvidia.com>
    Cc: Ralph Campbell <rcampbell@nvidia.com>
    Cc: Michael Ellerman <mpe@ellerman.id.au>
    Cc: Lyude Paul <lyude@redhat.com>
    Cc: Alex Deucher <alexander.deucher@amd.com>
    Cc: Alex Sierra <alex.sierra@amd.com>
    Cc: Ben Skeggs <bskeggs@redhat.com>
    Cc: Christian König <christian.koenig@amd.com>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: "Huang, Ying" <ying.huang@intel.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: Yang Shi <shy828301@gmail.com>
    Cc: Zi Yan <ziy@nvidia.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Signed-off-by: Donald Dutile <ddutile@redhat.com>
2023-05-02 16:47:26 -04:00
Chris von Recklinghausen 97fa2c7817 lib: add support for device coherent type in test_hmm
Bugzilla: https://bugzilla.redhat.com/2160210

commit 4c2e0f764eb4444272cfd2fa4afeb84c453a1a34
Author: Alex Sierra <alex.sierra@amd.com>
Date:   Fri Jul 15 10:05:17 2022 -0500

    lib: add support for device coherent type in test_hmm

    Device Coherent type uses device memory that is coherently accesible by
    the CPU.  This could be shown as SP (special purpose) memory range at the
    BIOS-e820 memory enumeration.  If no SP memory is supported in system,
    this could be faked by setting CONFIG_EFI_FAKE_MEMMAP.

    Currently, test_hmm only supports two different SP ranges of at least
    256MB size. This could be specified in the kernel parameter variable
    efi_fake_mem. Ex. Two SP ranges of 1GB starting at 0x100000000 &
    0x140000000 physical address. Ex.
    efi_fake_mem=1G@0x100000000:0x40000,1G@0x140000000:0x40000

    Private and coherent device mirror instances can be created in the same
    probed.  This is done by passing the module parameters spm_addr_dev0 &
    spm_addr_dev1.  In this case, it will create four instances of
    device_mirror.  The first two correspond to private device type, the last
    two to coherent type.  Then, they can be easily accessed from user space
    through /dev/hmm_mirror<num_device>.  Usually num_device 0 and 1 are for
    private, and 2 and 3 for coherent types.  If no module parameters are
    passed, two instances of private type device_mirror will be created only.

    Link: https://lkml.kernel.org/r/20220715150521.18165-11-alex.sierra@amd.com
    Signed-off-by: Alex Sierra <alex.sierra@amd.com>
    Acked-by: Felix Kuehling <Felix.Kuehling@amd.com>
    Reviewed-by: Alistair Poppple <apopple@nvidia.com>
    Cc: Christoph Hellwig <hch@lst.de>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: Jason Gunthorpe <jgg@nvidia.com>
    Cc: Jerome Glisse <jglisse@redhat.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: Ralph Campbell <rcampbell@nvidia.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2023-03-24 11:19:23 -04:00
Chris von Recklinghausen 0b3fd58777 lib: test_hmm add module param for zone device type
Bugzilla: https://bugzilla.redhat.com/2160210

commit 25b80162d550408058b2d8fff2e63807bceda64c
Author: Alex Sierra <alex.sierra@amd.com>
Date:   Fri Jul 15 10:05:16 2022 -0500

    lib: test_hmm add module param for zone device type

    In order to configure device coherent in test_hmm, two module parameters
    should be passed, which correspond to the SP start address of each device
    (2) spm_addr_dev0 & spm_addr_dev1.  If no parameters are passed, private
    device type is configured.

    Link: https://lkml.kernel.org/r/20220715150521.18165-10-alex.sierra@amd.com
    Signed-off-by: Alex Sierra <alex.sierra@amd.com>
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Acked-by: Felix Kuehling <Felix.Kuehling@amd.com>
    Reviewed-by: Alistair Poppple <apopple@nvidia.com>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: Jason Gunthorpe <jgg@nvidia.com>
    Cc: Jerome Glisse <jglisse@redhat.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: Ralph Campbell <rcampbell@nvidia.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2023-03-24 11:19:23 -04:00
Chris von Recklinghausen 81762bad80 lib: test_hmm add ioctl to get zone device type
Bugzilla: https://bugzilla.redhat.com/2160210

commit 188f48268d04f3851cf30151af9025f1f661cc6f
Author: Alex Sierra <alex.sierra@amd.com>
Date:   Fri Jul 15 10:05:15 2022 -0500

    lib: test_hmm add ioctl to get zone device type

    Add new ioctl cmd to query zone device type.  This will be used once the
    test_hmm adds zone device coherent type.

    Link: https://lkml.kernel.org/r/20220715150521.18165-9-alex.sierra@amd.com
    Signed-off-by: Alex Sierra <alex.sierra@amd.com>
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Acked-by: Felix Kuehling <Felix.Kuehling@amd.com>
    Reviewed-by: Alistair Poppple <apopple@nvidia.com>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: Jason Gunthorpe <jgg@nvidia.com>
    Cc: Jerome Glisse <jglisse@redhat.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: Ralph Campbell <rcampbell@nvidia.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2023-03-24 11:19:23 -04:00
Chris von Recklinghausen 1286d3dde9 lib/test_hmm: avoid accessing uninitialized pages
Bugzilla: https://bugzilla.redhat.com/2160210

commit ed913b055a74b723976f8e885a3395162a0371e6
Author: Miaohe Lin <linmiaohe@huawei.com>
Date:   Thu Jun 9 21:08:35 2022 +0800

    lib/test_hmm: avoid accessing uninitialized pages

    If make_device_exclusive_range() fails or returns pages marked for
    exclusive access less than required, remaining fields of pages will left
    uninitialized.  So dmirror_atomic_map() will access those yet
    uninitialized fields of pages.  To fix it, do dmirror_atomic_map() iff all
    pages are marked for exclusive access (we will break if mapped is less
    than required anyway) so we won't access those uninitialized fields of
    pages.

    Link: https://lkml.kernel.org/r/20220609130835.35110-1-linmiaohe@huawei.com
    Fixes: b659baea75 ("mm: selftests for exclusive device memory")
    Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
    Cc: Jerome Glisse <jglisse@redhat.com>
    Cc: Alistair Popple <apopple@nvidia.com>
    Cc: Jason Gunthorpe <jgg@ziepe.ca>
    Cc: Ralph Campbell <rcampbell@nvidia.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2023-03-24 11:19:14 -04:00
Chris von Recklinghausen 95e2ef603e mm: remove pointless includes from <linux/hmm.h>
Conflicts:
	drivers/gpu/drm/amd/amdkfd/kfd_migrate.c - Change was made in
		RHEL commit
		99fc716fc4 ("Merge DRM changes from upstream v5.17..v5.18")
	drivers/gpu/drm/nouveau/nouveau_dmem.c - We already have
		dc90f0846df4 ("mm: don't include <linux/memremap.h> in <linux/mm.h>")
		so keep include of linus/memremap.h

Bugzilla: https://bugzilla.redhat.com/2160210

commit 730ff52194cdb324b7680e5054c546f7b52de8a2
Author: Christoph Hellwig <hch@lst.de>
Date:   Wed Feb 16 15:31:35 2022 +1100

    mm: remove pointless includes from <linux/hmm.h>

    hmm.h pulls in the world for no good reason at all.  Remove the
    includes and push a few ones into the users instead.

    Link: https://lkml.kernel.org/r/20220210072828.2930359-4-hch@lst.de
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
    Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
    Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
    Reviewed-by: Muchun Song <songmuchun@bytedance.com>
    Tested-by: "Sierra Guiza, Alejandro (Alex)" <alex.sierra@amd.com>

    Cc: Alex Deucher <alexander.deucher@amd.com>
    Cc: Alistair Popple <apopple@nvidia.com>
    Cc: Ben Skeggs <bskeggs@redhat.com>
    Cc: Christian Knig <christian.koenig@amd.com>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Cc: Felix Kuehling <Felix.Kuehling@amd.com>
    Cc: Karol Herbst <kherbst@redhat.com>
    Cc: Lyude Paul <lyude@redhat.com>
    Cc: Miaohe Lin <linmiaohe@huawei.com>
    Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
    Cc: Ralph Campbell <rcampbell@nvidia.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2023-03-24 11:18:46 -04:00
Chris von Recklinghausen 4cc30e4e8f mm: remove the extra ZONE_DEVICE struct page refcount
Conflicts: mm/internal.h - We already have
	09f49dca570a ("mm: handle uninitialized numa nodes gracefully")
	ece1ed7bfa12 ("mm/gup: Add try_get_folio() and try_grab_folio()")
	so keep declarations for boot_nodestats and try_grab_folio

Bugzilla: https://bugzilla.redhat.com/2120352
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2099722

commit 27674ef6c73f0c9096a9827dc5d6ba9fc7808422
Author: Christoph Hellwig <hch@lst.de>
Date:   Wed Feb 16 15:31:36 2022 +1100

    mm: remove the extra ZONE_DEVICE struct page refcount

    ZONE_DEVICE struct pages have an extra reference count that complicates
    the code for put_page() and several places in the kernel that need to
    check the reference count to see that a page is not being used (gup,
    compaction, migration, etc.). Clean up the code so the reference count
    doesn't need to be treated specially for ZONE_DEVICE pages.

    Note that this excludes the special idle page wakeup for fsdax pages,
    which still happens at refcount 1.  This is a separate issue and will
    be sorted out later.  Given that only fsdax pages require the
    notifiacation when the refcount hits 1 now, the PAGEMAP_OPS Kconfig
    symbol can go away and be replaced with a FS_DAX check for this hook
    in the put_page fastpath.

    Based on an earlier patch from Ralph Campbell <rcampbell@nvidia.com>.

    Link: https://lkml.kernel.org/r/20220210072828.2930359-8-hch@lst.de
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
    Reviewed-by: Ralph Campbell <rcampbell@nvidia.com>
    Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
    Reviewed-by: Dan Williams <dan.j.williams@intel.com>
    Acked-by: Felix Kuehling <Felix.Kuehling@amd.com>
    Tested-by: "Sierra Guiza, Alejandro (Alex)" <alex.sierra@amd.com>

    Cc: Alex Deucher <alexander.deucher@amd.com>
    Cc: Alistair Popple <apopple@nvidia.com>
    Cc: Ben Skeggs <bskeggs@redhat.com>
    Cc: Chaitanya Kulkarni <kch@nvidia.com>
    Cc: Christian Knig <christian.koenig@amd.com>
    Cc: Karol Herbst <kherbst@redhat.com>
    Cc: Lyude Paul <lyude@redhat.com>
    Cc: Miaohe Lin <linmiaohe@huawei.com>
    Cc: Muchun Song <songmuchun@bytedance.com>
    Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2022-10-12 07:27:45 -04:00
Chris von Recklinghausen 5b3d7189c0 mm/hmm.c: allow VM_MIXEDMAP to work with hmm_range_fault
Bugzilla: https://bugzilla.redhat.com/2120352

commit 87c01d57fa23de82fff593a7d070933d08755801
Author: Alistair Popple <apopple@nvidia.com>
Date:   Fri Jan 14 14:09:31 2022 -0800

    mm/hmm.c: allow VM_MIXEDMAP to work with hmm_range_fault

    hmm_range_fault() can be used instead of get_user_pages() for devices
    which allow faulting however unlike get_user_pages() it will return an
    error when used on a VM_MIXEDMAP range.

    To make hmm_range_fault() more closely match get_user_pages() remove
    this restriction.  This requires dealing with the !ARCH_HAS_PTE_SPECIAL
    case in hmm_vma_handle_pte().  Rather than replicating the logic of
    vm_normal_page() call it directly and do a check for the zero pfn
    similar to what get_user_pages() currently does.

    Also add a test to hmm selftest to verify functionality.

    Link: https://lkml.kernel.org/r/20211104012001.2555676-1-apopple@nvidia.com
    Fixes: da4c3c735e ("mm/hmm/mirror: helper to snapshot CPU page table")
    Signed-off-by: Alistair Popple <apopple@nvidia.com>
    Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
    Cc: Jerome Glisse <jglisse@redhat.com>
    Cc: John Hubbard <jhubbard@nvidia.com>
    Cc: Zi Yan <ziy@nvidia.com>
    Cc: Ralph Campbell <rcampbell@nvidia.com>
    Cc: Felix Kuehling <Felix.Kuehling@amd.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2022-10-12 07:27:41 -04:00
Chris von Recklinghausen 46a6ceff68 mm/migrate.c: remove MIGRATE_PFN_LOCKED
Conflicts:
	drivers/gpu/drm/amd/amdkfd/kfd_migrate.c,
	drivers/gpu/drm/nouveau/nouveau_dmem.c -
		Changes done as part of CS9 commit
		75030c7eac ("Merge DRM changes from upstream v5.15..v5.16")
	mm/migrate.c -
		CS9 commit
		413248faac ("mm/rmap: Convert try_to_migrate() to folios")
		changed try_to_migrate to take a folio. Change the
		try_to_migrate call that this patch adds to call page_folio on
		the page argument.
		The conflict in CS9 commit
		ca19554894 ("mm/rmap: Convert rmap_walk() to take a folio")
		changed the first argument to remove_migration_pte, which
		causes a merge conflict with this patch. Remove lines in this
		hunk as if it were called with the old arguments.
		CS9 commit
		86b6e00a7b ("mm/migrate: Convert remove_migration_ptes() to folios")
		changed the unlock_page call to folio_unlock. The put_page call
		this patch adds would be redundant since folio_unlock does an
		implied put_page, so just leave the folio_unlock call

Bugzilla: https://bugzilla.redhat.com/2120352

commit ab09243aa95a72bac5c71e852773de34116f8d0f
Author: Alistair Popple <apopple@nvidia.com>
Date:   Wed Nov 10 20:32:40 2021 -0800

    mm/migrate.c: remove MIGRATE_PFN_LOCKED

    MIGRATE_PFN_LOCKED is used to indicate to migrate_vma_prepare() that a
    source page was already locked during migrate_vma_collect().  If it
    wasn't then the a second attempt is made to lock the page.  However if
    the first attempt failed it's unlikely a second attempt will succeed,
    and the retry adds complexity.  So clean this up by removing the retry
    and MIGRATE_PFN_LOCKED flag.

    Destination pages are also meant to have the MIGRATE_PFN_LOCKED flag
    set, but nothing actually checks that.

    Link: https://lkml.kernel.org/r/20211025041608.289017-1-apopple@nvidia.com
    Signed-off-by: Alistair Popple <apopple@nvidia.com>
    Reviewed-by: Ralph Campbell <rcampbell@nvidia.com>
    Acked-by: Felix Kuehling <Felix.Kuehling@amd.com>
    Cc: Alex Deucher <alexander.deucher@amd.com>
    Cc: Jerome Glisse <jglisse@redhat.com>
    Cc: John Hubbard <jhubbard@nvidia.com>
    Cc: Zi Yan <ziy@nvidia.com>
    Cc: Christoph Hellwig <hch@lst.de>
    Cc: Ben Skeggs <bskeggs@redhat.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2022-10-12 07:27:31 -04:00
Aristeu Rozanski 91c006ec4a mm: don't include <linux/memremap.h> in <linux/mm.h>
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2083861
Tested: by me with multiple test suites
Conflicts: context differences due missing 730ff52194cdb32 and c4386bd8ee3a92

commit dc90f0846df4870b6cc8528c31e5c60f18fb68be
Author: Christoph Hellwig <hch@lst.de>
Date:   Wed Feb 16 15:31:36 2022 +1100

    mm: don't include <linux/memremap.h> in <linux/mm.h>

    Move the check for the actual pgmap types that need the free at refcount
    one behavior into the out of line helper, and thus avoid the need to
    pull memremap.h into mm.h.

    Link: https://lkml.kernel.org/r/20220210072828.2930359-7-hch@lst.de
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
    Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
    Reviewed-by: Dan Williams <dan.j.williams@intel.com>
    Acked-by: Felix Kuehling <Felix.Kuehling@amd.com>
    Tested-by: "Sierra Guiza, Alejandro (Alex)" <alex.sierra@amd.com>

    Cc: Alex Deucher <alexander.deucher@amd.com>
    Cc: Alistair Popple <apopple@nvidia.com>
    Cc: Ben Skeggs <bskeggs@redhat.com>
    Cc: Chaitanya Kulkarni <kch@nvidia.com>
    Cc: Karol Herbst <kherbst@redhat.com>
    Cc: Lyude Paul <lyude@redhat.com>
    Cc: Miaohe Lin <linmiaohe@huawei.com>
    Cc: Muchun Song <songmuchun@bytedance.com>
    Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
    Cc: Ralph Campbell <rcampbell@nvidia.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Signed-off-by: Aristeu Rozanski <arozansk@redhat.com>
2022-07-10 10:44:13 -04:00
Alistair Popple c52114d9df lib/test_hmm: remove set but unused page variable
The HMM selftests use atomic_check_access() to check atomic access to a
page has been revoked.  It doesn't matter if the page mapping has been
removed from the mirrored page tables as that also implies atomic access
has been revoked.  Therefore remove the unused page variable to fix this
compiler warning:

  lib/test_hmm.c:631:16: warning: variable `page' set but not used [-Wunused-but-set-variable]

Link: https://lkml.kernel.org/r/20210706025603.4059-1-apopple@nvidia.com
Fixes: b659baea75 ("mm: selftests for exclusive device memory")
Signed-off-by: Alistair Popple <apopple@nvidia.com>
Reported-by: Hulk Robot <hulkci@huawei.com>
Reported-by: kernel test robot <oliver.sang@intel.com>
Reported-by: Yang Yingliang <yangyingliang@huawei.com>
Acked-by: Souptick Joarder <jrdr.linux@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-07-15 10:13:49 -07:00
Alistair Popple b659baea75 mm: selftests for exclusive device memory
Adds some selftests for exclusive device memory.

Link: https://lkml.kernel.org/r/20210616105937.23201-9-apopple@nvidia.com
Signed-off-by: Alistair Popple <apopple@nvidia.com>
Acked-by: Jason Gunthorpe <jgg@nvidia.com>
Tested-by: Ralph Campbell <rcampbell@nvidia.com>
Reviewed-by: Ralph Campbell <rcampbell@nvidia.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hugh Dickins <hughd@google.com>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: Peter Xu <peterx@redhat.com>
Cc: Shakeel Butt <shakeelb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-07-01 11:06:03 -07:00
Alistair Popple 6b49bf6ddb mm: rename migrate_pgmap_owner
MMU notifier ranges have a migrate_pgmap_owner field which is used by
drivers to store a pointer.  This is subsequently used by the driver
callback to filter MMU_NOTIFY_MIGRATE events.  Other notifier event types
can also benefit from this filtering, so rename the 'migrate_pgmap_owner'
field to 'owner' and create a new notifier initialisation function to
initialise this field.

Link: https://lkml.kernel.org/r/20210616105937.23201-6-apopple@nvidia.com
Signed-off-by: Alistair Popple <apopple@nvidia.com>
Suggested-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hugh Dickins <hughd@google.com>
Cc: Jason Gunthorpe <jgg@nvidia.com>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: Ralph Campbell <rcampbell@nvidia.com>
Cc: Shakeel Butt <shakeelb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-07-01 11:06:03 -07:00
Liam Howlett 46e6b31d46 lib/test_hmm: use vma_lookup() in dmirror_migrate()
Use vma_lookup() to find the VMA at a specific address.  As vma_lookup()
will return NULL if the address is not within any VMA, the start address
no longer needs to be validated.

Link: https://lkml.kernel.org/r/20210521174745.2219620-18-Liam.Howlett@Oracle.com
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Reviewed-by: Laurent Dufour <ldufour@linux.ibm.com>
Acked-by: David Hildenbrand <david@redhat.com>
Acked-by: Davidlohr Bueso <dbueso@suse.de>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-06-29 10:53:52 -07:00
Dan Carpenter f3c9d0a3fe lib/test_hmm.c: fix an error code in dmirror_allocate_chunk()
This is supposed to return false on failure, not a negative error code.

Fixes: 170e38548b81 ("mm/hmm/test: use after free in dmirror_allocate_chunk()")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Ralph Campbell <rcampbell@nvidia.com>
Cc: Jerome Glisse <jglisse@redhat.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Dan Williams <dan.j.williams@intel.com>
Link: https://lkml.kernel.org/r/20201010200812.GA1886610@mwanda
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-10-16 11:11:20 -07:00
Ralph Campbell 9b53122f61 lib/test_hmm.c: remove unused dmirror_zero_page
The variable dmirror_zero_page is unused in the HMM self test driver which
was probably intended to demonstrate how a driver could use
migrate_vma_setup() to share a single read-only device private zero page
similar to how the CPU does.  However, this isn't needed for the self
tests so remove it.

Signed-off-by: Ralph Campbell <rcampbell@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Jerome Glisse <jglisse@redhat.com>
Link: https://lkml.kernel.org/r/20200914213801.16520-1-rcampbell@nvidia.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-10-13 18:38:32 -07:00
Dan Williams b7b3c01b19 mm/memremap_pages: support multiple ranges per invocation
In support of device-dax growing the ability to front physically
dis-contiguous ranges of memory, update devm_memremap_pages() to track
multiple ranges with a single reference counter and devm instance.

Convert all [devm_]memremap_pages() users to specify the number of ranges
they are mapping in their 'struct dev_pagemap' instance.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Paul Mackerras <paulus@ozlabs.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Vishal Verma <vishal.l.verma@intel.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Dave Jiang <dave.jiang@intel.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Ira Weiny <ira.weiny@intel.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: "Jérôme Glisse" <jglisse@redhat.co
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brice Goglin <Brice.Goglin@inria.fr>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Hulk Robot <hulkci@huawei.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jason Gunthorpe <jgg@mellanox.com>
Cc: Jason Yan <yanaijie@huawei.com>
Cc: Jeff Moyer <jmoyer@redhat.com>
Cc: "Jérôme Glisse" <jglisse@redhat.com>
Cc: Jia He <justin.he@arm.com>
Cc: Joao Martins <joao.m.martins@oracle.com>
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: kernel test robot <lkp@intel.com>
Cc: Mike Rapoport <rppt@linux.ibm.com>
Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Wei Yang <richard.weiyang@linux.alibaba.com>
Cc: Will Deacon <will@kernel.org>
Link: https://lkml.kernel.org/r/159643103789.4062302.18426128170217903785.stgit@dwillia2-desk3.amr.corp.intel.com
Link: https://lkml.kernel.org/r/160106116293.30709.13350662794915396198.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-10-13 18:38:28 -07:00
Dan Williams a4574f63ed mm/memremap_pages: convert to 'struct range'
The 'struct resource' in 'struct dev_pagemap' is only used for holding
resource span information.  The other fields, 'name', 'flags', 'desc',
'parent', 'sibling', and 'child' are all unused wasted space.

This is in preparation for introducing a multi-range extension of
devm_memremap_pages().

The bulk of this change is unwinding all the places internal to libnvdimm
that used 'struct resource' unnecessarily, and replacing instances of
'struct dev_pagemap'.res with 'struct dev_pagemap'.range.

P2PDMA had a minor usage of the resource flags field, but only to report
failures with "%pR".  That is replaced with an open coded print of the
range.

[dan.carpenter@oracle.com: mm/hmm/test: use after free in dmirror_allocate_chunk()]
  Link: https://lkml.kernel.org/r/20200926121402.GA7467@kadam

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>	[xen]
Cc: Paul Mackerras <paulus@ozlabs.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Vishal Verma <vishal.l.verma@intel.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Dave Jiang <dave.jiang@intel.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Ira Weiny <ira.weiny@intel.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: "Jérôme Glisse" <jglisse@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brice Goglin <Brice.Goglin@inria.fr>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Hulk Robot <hulkci@huawei.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jason Gunthorpe <jgg@mellanox.com>
Cc: Jason Yan <yanaijie@huawei.com>
Cc: Jeff Moyer <jmoyer@redhat.com>
Cc: Jia He <justin.he@arm.com>
Cc: Joao Martins <joao.m.martins@oracle.com>
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: kernel test robot <lkp@intel.com>
Cc: Mike Rapoport <rppt@linux.ibm.com>
Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Wei Yang <richard.weiyang@linux.alibaba.com>
Cc: Will Deacon <will@kernel.org>
Link: https://lkml.kernel.org/r/159643103173.4062302.768998885691711532.stgit@dwillia2-desk3.amr.corp.intel.com
Link: https://lkml.kernel.org/r/160106115761.30709.13539840236873663620.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-10-13 18:38:28 -07:00
Ralph Campbell 7d17e83abe mm/hmm/test: use the new migration invalidation
Use the new MMU_NOTIFY_MIGRATE event to skip MMU invalidations of device
private memory and handle the invalidation in the driver as part of
migrating device private memory.

Link: https://lore.kernel.org/r/20200723223004.9586-6-rcampbell@nvidia.com
Signed-off-by: Ralph Campbell <rcampbell@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
2020-07-28 16:20:33 -03:00
Ralph Campbell 5143192cd4 mm/migrate: add a flags parameter to migrate_vma
The src_owner field in struct migrate_vma is being used for two purposes,
it acts as a selection filter for which types of pages are to be migrated
and it identifies device private pages owned by the caller.

Split this into separate parameters so the src_owner field can be used
just to identify device private pages owned by the caller of
migrate_vma_setup().

Rename the src_owner field to pgmap_owner to reflect it is now used only
to identify which device private pages to migrate.

Link: https://lore.kernel.org/r/20200723223004.9586-3-rcampbell@nvidia.com
Signed-off-by: Ralph Campbell <rcampbell@nvidia.com>
Reviewed-by: Bharata B Rao <bharata@linux.ibm.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
2020-07-28 16:20:33 -03:00
Ralph Campbell e478425bec mm/hmm: add tests for hmm_pfn_to_map_order()
Add a sanity test for hmm_range_fault() returning the page mapping size
order.

Link: https://lore.kernel.org/r/20200701225352.9649-6-rcampbell@nvidia.com
Signed-off-by: Ralph Campbell <rcampbell@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
2020-07-10 16:24:28 -03:00
Randy Dunlap 786ae133e0 lib: fix test_hmm.c reference after free
Coccinelle scripts report the following errors:

  lib/test_hmm.c:523:20-26: ERROR: reference preceded by free on line 521
  lib/test_hmm.c:524:21-27: ERROR: reference preceded by free on line 521
  lib/test_hmm.c:523:28-35: ERROR: devmem is NULL but dereferenced.
  lib/test_hmm.c:524:29-36: ERROR: devmem is NULL but dereferenced.

Fix these by using the local variable 'res' instead of devmem.

Link: http://lkml.kernel.org/r/c845c158-9c65-9665-0d0b-00342846dd07@infradead.org
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reviewed-by: Ralph Campbell <rcampbell@nvidia.com>
Cc: Jérôme Glisse <jglisse@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-06-26 00:27:37 -07:00
Michel Lespinasse 89154dd531 mmap locking API: convert mmap_sem call sites missed by coccinelle
Convert the last few remaining mmap_sem rwsem calls to use the new mmap
locking API.  These were missed by coccinelle for some reason (I think
coccinelle does not support some of the preprocessor constructs in these
files ?)

[akpm@linux-foundation.org: convert linux-next leftovers]
[akpm@linux-foundation.org: more linux-next leftovers]
[akpm@linux-foundation.org: more linux-next leftovers]

Signed-off-by: Michel Lespinasse <walken@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Reviewed-by: Laurent Dufour <ldufour@linux.ibm.com>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Davidlohr Bueso <dbueso@suse.de>
Cc: David Rientjes <rientjes@google.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Jerome Glisse <jglisse@redhat.com>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Liam Howlett <Liam.Howlett@oracle.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ying Han <yinghan@google.com>
Link: http://lkml.kernel.org/r/20200520052908.204642-6-walken@google.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-06-09 09:39:14 -07:00
Ralph Campbell b2ef9f5a5c mm/hmm/test: add selftest driver for HMM
This driver is for testing device private memory migration and devices
which use hmm_range_fault() to access system memory via device page tables.

Link: https://lore.kernel.org/r/20200422195028.3684-2-rcampbell@nvidia.com
Link: https://lore.kernel.org/r/20200516010424.2013-1-rcampbell@nvidia.com
Signed-off-by: Ralph Campbell <rcampbell@nvidia.com>
Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
Link: https://lore.kernel.org/r/20200509030225.14592-1-weiyongjun1@huawei.com
Link: https://lore.kernel.org/r/20200509030234.14747-1-weiyongjun1@huawei.com
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Link: https://lore.kernel.org/r/20200511183704.GA225608@mwanda
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
2020-05-19 16:48:30 -03:00