17 Oct, 2020

1 commit

  • 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
    Signed-off-by: Andrew Morton
    Reviewed-by: Ralph Campbell
    Cc: Jerome Glisse
    Cc: Stephen Rothwell
    Cc: Jason Gunthorpe
    Cc: Dan Williams
    Link: https://lkml.kernel.org/r/20201010200812.GA1886610@mwanda
    Signed-off-by: Linus Torvalds

    Dan Carpenter
     

14 Oct, 2020

3 commits

  • 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
    Signed-off-by: Andrew Morton
    Cc: Jerome Glisse
    Link: https://lkml.kernel.org/r/20200914213801.16520-1-rcampbell@nvidia.com
    Signed-off-by: Linus Torvalds

    Ralph Campbell
     
  • 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
    Signed-off-by: Andrew Morton
    Cc: Paul Mackerras
    Cc: Michael Ellerman
    Cc: Benjamin Herrenschmidt
    Cc: Vishal Verma
    Cc: Vivek Goyal
    Cc: Dave Jiang
    Cc: Ben Skeggs
    Cc: David Airlie
    Cc: Daniel Vetter
    Cc: Ira Weiny
    Cc: Bjorn Helgaas
    Cc: Boris Ostrovsky
    Cc: Juergen Gross
    Cc: Stefano Stabellini
    Cc: "Jérôme Glisse"
    Cc: Ard Biesheuvel
    Cc: Ard Biesheuvel
    Cc: Borislav Petkov
    Cc: Brice Goglin
    Cc: Catalin Marinas
    Cc: Dave Hansen
    Cc: David Hildenbrand
    Cc: Greg Kroah-Hartman
    Cc: "H. Peter Anvin"
    Cc: Hulk Robot
    Cc: Ingo Molnar
    Cc: Jason Gunthorpe
    Cc: Jason Yan
    Cc: Jeff Moyer
    Cc: "Jérôme Glisse"
    Cc: Jia He
    Cc: Joao Martins
    Cc: Jonathan Cameron
    Cc: kernel test robot
    Cc: Mike Rapoport
    Cc: Pavel Tatashin
    Cc: Peter Zijlstra
    Cc: "Rafael J. Wysocki"
    Cc: Randy Dunlap
    Cc: Thomas Gleixner
    Cc: Tom Lendacky
    Cc: Wei Yang
    Cc: Will Deacon
    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

    Dan Williams
     
  • 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
    Signed-off-by: Dan Carpenter
    Signed-off-by: Andrew Morton
    Reviewed-by: Boris Ostrovsky [xen]
    Cc: Paul Mackerras
    Cc: Michael Ellerman
    Cc: Benjamin Herrenschmidt
    Cc: Vishal Verma
    Cc: Vivek Goyal
    Cc: Dave Jiang
    Cc: Ben Skeggs
    Cc: David Airlie
    Cc: Daniel Vetter
    Cc: Ira Weiny
    Cc: Bjorn Helgaas
    Cc: Juergen Gross
    Cc: Stefano Stabellini
    Cc: "Jérôme Glisse"
    Cc: Andy Lutomirski
    Cc: Ard Biesheuvel
    Cc: Ard Biesheuvel
    Cc: Borislav Petkov
    Cc: Brice Goglin
    Cc: Catalin Marinas
    Cc: Dave Hansen
    Cc: David Hildenbrand
    Cc: Greg Kroah-Hartman
    Cc: "H. Peter Anvin"
    Cc: Hulk Robot
    Cc: Ingo Molnar
    Cc: Jason Gunthorpe
    Cc: Jason Yan
    Cc: Jeff Moyer
    Cc: Jia He
    Cc: Joao Martins
    Cc: Jonathan Cameron
    Cc: kernel test robot
    Cc: Mike Rapoport
    Cc: Pavel Tatashin
    Cc: Peter Zijlstra
    Cc: "Rafael J. Wysocki"
    Cc: Randy Dunlap
    Cc: Thomas Gleixner
    Cc: Tom Lendacky
    Cc: Wei Yang
    Cc: Will Deacon
    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

    Dan Williams
     

29 Jul, 2020

2 commits

  • 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
    Signed-off-by: Jason Gunthorpe

    Ralph Campbell
     
  • 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
    Reviewed-by: Bharata B Rao
    Signed-off-by: Jason Gunthorpe

    Ralph Campbell
     

11 Jul, 2020

1 commit


26 Jun, 2020

1 commit

  • 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
    Reviewed-by: Ralph Campbell
    Cc: Jérôme Glisse
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Randy Dunlap
     

10 Jun, 2020

1 commit

  • 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
    Signed-off-by: Andrew Morton
    Reviewed-by: Daniel Jordan
    Reviewed-by: Laurent Dufour
    Reviewed-by: Vlastimil Babka
    Cc: Davidlohr Bueso
    Cc: David Rientjes
    Cc: Hugh Dickins
    Cc: Jason Gunthorpe
    Cc: Jerome Glisse
    Cc: John Hubbard
    Cc: Liam Howlett
    Cc: Matthew Wilcox
    Cc: Peter Zijlstra
    Cc: Ying Han
    Link: http://lkml.kernel.org/r/20200520052908.204642-6-walken@google.com
    Signed-off-by: Linus Torvalds

    Michel Lespinasse
     

20 May, 2020

1 commit

  • 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
    Signed-off-by: Jérôme Glisse
    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
    Link: https://lore.kernel.org/r/20200511183704.GA225608@mwanda
    Signed-off-by: Dan Carpenter
    Signed-off-by: Jason Gunthorpe

    Ralph Campbell