1. 22 Mar, 2022 1 commit
  2. 17 Mar, 2022 1 commit
  3. 06 Nov, 2021 1 commit
  4. 03 Sep, 2021 2 commits
  5. 08 Jul, 2021 1 commit
    • Mike Rapoport's avatar
      secretmem: test: add basic selftest for memfd_secret(2) · 76fe17ef
      Mike Rapoport authored
      The test verifies that file descriptor created with memfd_secret does not
      allow read/write operations, that secret memory mappings respect
      RLIMIT_MEMLOCK and that remote accesses with process_vm_read() and
      ptrace() to the secret memory fail.
      
      Link: https://lkml.kernel.org/r/20210518072034.31572-8-rppt@kernel.org
      
      Signed-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Acked-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christopher Lameter <cl@linux.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Elena Reshetova <elena.reshetova@intel.com>
      Cc: Hagen Paul Pfeifer <hagen@jauu.net>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Bottomley <jejb@linux.ibm.com>
      Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Palmer Dabbelt <palmerdabbelt@google.com>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rick Edgecombe <rick.p.edgecombe@intel.com>
      Cc: Roman Gushchin <guro@fb.com>
      Cc: Shakeel Butt <shakeelb@google.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tycho Andersen <tycho@tycho.ws>
      Cc: Will Deacon <will@kernel.org>
      Cc: kernel test robot <lkp@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      76fe17ef
  6. 01 Jul, 2021 2 commits
    • Dave Hansen's avatar
      selftests/vm/pkeys: exercise x86 XSAVE init state · d892454b
      Dave Hansen authored
      On x86, there is a set of instructions used to save and restore register
      state collectively known as the XSAVE architecture.  There are about a
      dozen different features managed with XSAVE.  The protection keys
      register, PKRU, is one of those features.
      
      The hardware optimizes XSAVE by tracking when the state has not changed
      from its initial (init) state.  In this case, it can avoid the cost of
      writing state to memory (it would usually just be a bunch of 0's).
      
      When the pkey register is 0x0 the hardware optionally choose to track the
      register as being in the init state (optimize away the writes).  AMD CPUs
      do this more aggressively compared to Intel.
      
      On x86, PKRU is rarely in its (very permissive) init state.  Instead, the
      value defaults to something very restrictive.  It is not surprising that
      bugs have popped up in the rare cases when PKRU reaches its init state.
      
      Add a protection key selftest which gets the protection keys register into
      its init state in a way that should work on Intel and AMD.  Then, do a
      bunch of pkey register reads to watch for inadvertent changes.
      
      This adds "-mxsave" to CFLAGS for all the x86 vm selftests in order to
      allow use of the XSAVE instruction __builtin functions.  This will make
      the builtins available on all of the vm selftests, but is expected to be
      harmless.
      
      Link: https://lkml.kernel.org/r/20210611164202.1849B712@viggo.jf.intel.com
      
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Tested-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
      Cc: Ram Pai <linuxram@us.ibm.com>
      Cc: Sandipan Das <sandipan@linux.ibm.com>
      Cc: Florian Weimer <fweimer@redhat.com>
      Cc: "Desnes A. Nunes do Rosario" <desnesn@linux.vnet.ibm.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Thiago Jung Bauermann <bauerman@linux.ibm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Michal Suchanek <msuchanek@suse.de>
      Cc: Shuah Khan <shuah@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d892454b
    • David Hildenbrand's avatar
      selftests/vm: add test for MADV_POPULATE_(READ|WRITE) · e5bfac53
      David Hildenbrand authored
      Let's add a simple test for MADV_POPULATE_READ and MADV_POPULATE_WRITE,
      verifying some error handling, that population works, and that softdirty
      tracking works as expected.  For now, limit the test to private anonymous
      memory.
      
      Link: https://lkml.kernel.org/r/20210419135443.12822-6-david@redhat.com
      
      Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Oscar Salvador <osalvador@suse.de>
      Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Jann Horn <jannh@google.com>
      Cc: Jason Gunthorpe <jgg@ziepe.ca>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Rik van Riel <riel@surriel.com>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Mike Kravetz <mike.kravetz@oracle.com>
      Cc: Peter Xu <peterx@redhat.com>
      Cc: Rolf Eike Beer <eike-kernel@sf-tec.de>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Ram Pai <linuxram@us.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e5bfac53
  7. 05 May, 2021 1 commit
    • Zi Yan's avatar
      mm: huge_memory: a new debugfs interface for splitting THP tests · fa6c0231
      Zi Yan authored
      We did not have a direct user interface of splitting the compound page
      backing a THP and there is no need unless we want to expose the THP
      implementation details to users.  Make <debugfs>/split_huge_pages accept a
      new command to do that.
      
      By writing "<pid>,<vaddr_start>,<vaddr_end>" to
      <debugfs>/split_huge_pages, THPs within the given virtual address range
      from the process with the given pid are split. It is used to test
      split_huge_page function. In addition, a selftest program is added to
      tools/testing/selftests/vm to utilize the interface by splitting
      PMD THPs and PTE-mapped THPs.
      
      This does not change the old behavior, i.e., writing 1 to the interface
      to split all THPs in the system.
      
      Link: https://lkml.kernel.org/r/20210331235309.332292-1-zi.yan@sent.com
      
      Signed-off-by: default avatarZi Yan <ziy@nvidia.com>
      Reviewed-by: default avatarYang Shi <shy828301@gmail.com>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: John Hubbard <jhubbard@nvidia.com>
      Cc: "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Mika Penttila <mika.penttila@nextfour.com>
      Cc: Sandipan Das <sandipan@linux.ibm.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      fa6c0231
  8. 25 Mar, 2021 1 commit
  9. 29 Dec, 2020 1 commit
  10. 15 Dec, 2020 6 commits
    • Kalesh Singh's avatar
      kselftests: vm: add mremap tests · 7df66625
      Kalesh Singh authored
      Patch series "Speed up mremap on large regions", v4.
      
      mremap time can be optimized by moving entries at the PMD/PUD level if the
      source and destination addresses are PMD/PUD-aligned and PMD/PUD-sized.
      Enable moving at the PMD and PUD levels on arm64 and x86.  Other
      architectures where this type of move is supported and known to be safe
      can also opt-in to these optimizations by enabling HAVE_MOVE_PMD and
      HAVE_MOVE_PUD.
      
      Observed Performance Improvements for remapping a PUD-aligned 1GB-sized
      region on x86 and arm64:
      
          - HAVE_MOVE_PMD is already enabled on x86 : N/A
          - Enabling HAVE_MOVE_PUD on x86   : ~13x speed up
      
          - Enabling HAVE_MOVE_PMD on arm64 : ~ 8x speed up
          - Enabling HAVE_MOVE_PUD on arm64 : ~19x speed up
      
                Altogether, HAVE_MOVE_PMD and HAVE_MOVE_PUD
                give a total of ~150x speed up on arm64.
      
      This patch (of 4):
      
      Test mremap on regions of various sizes and alignments and validate data
      after remapping.  Also provide total time for remapping the region which
      is useful for performance comparison of the mremap optimizations that move
      pages at the PMD/PUD levels if HAVE_MOVE_PMD and/or HAVE_MOVE_PUD are
      enabled.
      
      Link: https://lkml.kernel.org/r/20201014005320.2233162-1-kaleshsingh@google.com
      Link: https://lkml.kernel.org/r/20201014005320.2233162-2-kaleshsingh@google.com
      
      Signed-off-by: default avatarKalesh Singh <kaleshsingh@google.com>
      Reviewed-by: default avatarJohn Hubbard <jhubbard@nvidia.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Suren Baghdasaryan <surenb@google.com>
      Cc: Minchan Kim <minchan@google.com>
      Cc: Lokesh Gidra <lokeshgidra@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Sami Tolvanen <samitolvanen@google.com>
      Cc: Masahiro Yamada <masahiroy@kernel.org>
      Cc: Krzysztof Kozlowski <krzk@kernel.org>
      Cc: Frederic Weisbecker <frederic@kernel.org>
      Cc: Hassan Naveed <hnaveed@wavecomp.com>
      Cc: Christian Brauner <christian.brauner@ubuntu.com>
      Cc: Anshuman Khandual <anshuman.khandual@arm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Gavin Shan <gshan@redhat.com>
      Cc: Mike Rapoport <rppt@kernel.org>
      Cc: Steven Price <steven.price@arm.com>
      Cc: Jia He <justin.he@arm.com>
      Cc: Ram Pai <linuxram@us.ibm.com>
      Cc: Sandipan Das <sandipan@linux.ibm.com>
      Cc: Zi Yan <ziy@nvidia.com>
      Cc: Mina Almasry <almasrymina@google.com>
      Cc: Ralph Campbell <rcampbell@nvidia.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Brian Geffon <bgeffon@google.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: SeongJae Park <sjpark@amazon.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7df66625
    • John Hubbard's avatar
      selftests/vm: hmm-tests: remove the libhugetlbfs dependency · f3a45709
      John Hubbard authored
      HMM selftests are incredibly useful, but they are only effective if people
      actually build and run them.  All the other tests in selftests/vm can be
      built with very standard, always-available libraries: libpthread, librt.
      The hmm-tests.c program, on the other hand, requires something that is
      (much) less readily available: libhugetlbfs.  And so the build will
      typically fail for many developers.
      
      A simple attempt to install libhugetlbfs will also run into complications
      on some common distros these days: Fedora and Arch Linux (yes, Arch AUR
      has it, but that's fragile, as always with AUR).  The library is not
      maintained actively enough at the moment, for distros to deal with it.  I
      had to build it from source, for Fedora, and that didn't go too smoothly
      either.
      
      It turns out that, out of 21 tests in hmm-tests.c, only 2 actually require
      functionality from libhugetlbfs.  Therefore, if libhugetlbfs is missing,
      simply ifdef those two tests out and allow the developer to at least have
      the other 19 tests, if they don't want to pause to work through the above
      issues.  Also issue a warning, so that it's clear that there is an
      imperfection in the build.
      
      In order to do that, a tiny shell script (check_config.sh) runs a quick
      compile (not link, that's too prone to false failures with library paths),
      and basically, if the compiler doesn't find hugetlbfs.h in its standard
      locations, then the script concludes that libhugetlbfs is not available.
      The output is in two files, one for inclusion in hmm-test.c
      (local_config.h), and one for inclusion in the Makefile (local_config.mk).
      
      Link: https://lkml.kernel.org/r/20201026064021.3545418-9-jhubbard@nvidia.com
      
      Signed-off-by: default avatarJohn Hubbard <jhubbard@nvidia.com>
      Cc: Ralph Campbell <rcampbell@nvidia.com>
      Cc: Jérôme Glisse <jglisse@redhat.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Shuah Khan <shuah@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f3a45709
    • John Hubbard's avatar
      selftests/vm: minor cleanup: Makefile and gup_test.c · f545605c
      John Hubbard authored
      A few cleanups that don't deserve separate patches, but that also should
      not clutter up other functional changes:
      
      1. Remove an unnecessary #include <prctl.h>
      
      2. Restore the sorted order of TEST_GEN_FILES.
      
      3. Add -lpthread to the common LDLIBS, as it is harmless and several
         tests use it. This gets rid of one special rule already.
      
      Link: https://lkml.kernel.org/r/20201026064021.3545418-5-jhubbard@nvidia.com
      
      Signed-off-by: default avatarJohn Hubbard <jhubbard@nvidia.com>
      Cc: Jérôme Glisse <jglisse@redhat.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Ralph Campbell <rcampbell@nvidia.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f545605c
    • John Hubbard's avatar
      selftests/vm: rename run_vmtests --> run_vmtests.sh · c2aa8afc
      John Hubbard authored
      Rename to *.sh, in order to match the conventions of all of the other
      items in selftest/vm.
      
      The only reason not to use a .sh suffix a shell script like this, might be
      to make it look more like a normal program, but that's not an issue here.
      
      Link: https://lkml.kernel.org/r/20201026064021.3545418-4-jhubbard@nvidia.com
      
      Signed-off-by: default avatarJohn Hubbard <jhubbard@nvidia.com>
      Cc: Jérôme Glisse <jglisse@redhat.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Ralph Campbell <rcampbell@nvidia.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c2aa8afc
    • John Hubbard's avatar
      selftests/vm: use a common gup_test.h · b9dcfdff
      John Hubbard authored
      Avoid the need to copy-paste the gup_test ioctl commands and the struct
      gup_test definition, between the kernel and the user space application, by
      providing a new header file for these.  This allows easier and safer
      adding of new ioctl calls, as well as reducing the overall line count.
      
      Details: The header file has to be able to compile independently, because
      of the arguably unfortunate way that the Makefile is written: the Makefile
      tries to build all of its prerequisites, when really it should be only
      building the .c files, and leaving the other prerequisites (LOCAL_HDRS) as
      pure dependencies.
      
      That Makefile limitation is probably not worth fixing, but it explains why
      one of the includes had to be moved into the new header file.
      
      Also: simplify the ioctl struct (struct gup_test), by deleting the unused
      __expansion[10] field.  This sort of thing is what you might see in a
      stable ABI, but this low-level, kernel-developer-oriented selftests/vm
      system is very much not subject to ABI stability.  So "expansion" and
      "reserved" fields are unnecessary here.
      
      Link: https://lkml.kernel.org/r/20201026064021.3545418-3-jhubbard@nvidia.com
      
      Signed-off-by: default avatarJohn Hubbard <jhubbard@nvidia.com>
      Cc: Jérôme Glisse <jglisse@redhat.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Ralph Campbell <rcampbell@nvidia.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b9dcfdff
    • John Hubbard's avatar
      mm/gup_benchmark: rename to mm/gup_test · 9c84f229
      John Hubbard authored
      Patch series "selftests/vm: gup_test, hmm-tests, assorted improvements", v3.
      
      Summary: This series provides two main things, and a number of smaller
      supporting goodies.  The two main points are:
      
      1) Add a new sub-test to gup_test, which in turn is a renamed version
         of gup_benchmark.  This sub-test allows nicer testing of dump_pages(),
         at least on user-space pages.
      
         For quite a while, I was doing a quick hack to gup_test.c whenever I
         wanted to try out changes to dump_page().  Then Matthew Wilcox asked me
         what I meant when I said "I used my dump_page() unit test", and I
         realized that it might be nice to check in a polished up version of
         that.
      
         Details about how it works and how to use it are in the commit
         description for patch #6 ("selftests/vm: gup_test: introduce the
         dump_pages() sub-test").
      
      2) Fixes a limitation of hmm-tests: these tests are incredibly useful,
         but only if people actually build and run them.  And it turns out that
         libhugetlbfs is a little too effective at throwing a wrench in the
         works, there.  So I've added a little configuration check that removes
         just two of the 21 hmm-tests, if libhugetlbfs is not available.
      
         Further details in the commit description of patch #8
         ("selftests/vm: hmm-tests: remove the libhugetlbfs dependency").
      
      Other smaller things that this series does:
      
      a) Remove code duplication by creating gup_test.h.
      
      b) Clear up the sub-test organization, and their invocation within
         run_vmtests.sh.
      
      c) Other minor assorted improvements.
      
      [1] v2 is here:
      https://lore.kernel.org/linux-doc/20200929212747.251804-1-jhubbard@nvidia.com/
      
      [2] https://lore.kernel.org/r/CAHk-=wgh-TMPHLY3jueHX7Y2fWh3D+nMBqVS__AZm6-oorquWA@mail.gmail.com
      
      This patch (of 9):
      
      Rename nearly every "gup_benchmark" reference and file name to "gup_test".
      The one exception is for the actual gup benchmark test itself.
      
      The current code already does a *little* bit more than benchmarking, and
      definitely covers more than get_user_pages_fast().  More importantly,
      however, subsequent patches are about to add some functionality that is
      non-benchmark related.
      
      Closely related changes:
      
      * Kconfig: in addition to renaming the options from GUP_BENCHMARK to
        GUP_TEST, update the help text to reflect that it's no longer a
        benchmark-only test.
      
      Link: https://lkml.kernel.org/r/20201026064021.3545418-1-jhubbard@nvidia.com
      Link: https://lkml.kernel.org/r/20201026064021.3545418-2-jhubbard@nvidia.com
      
      Signed-off-by: default avatarJohn Hubbard <jhubbard@nvidia.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Jérôme Glisse <jglisse@redhat.com>
      Cc: Ralph Campbell <rcampbell@nvidia.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9c84f229
  11. 06 Dec, 2020 1 commit
    • Xingxing Su's avatar
      tools/testing/selftests/vm: fix build error · d8cbe8bf
      Xingxing Su authored
      
      Only x86 and PowerPC implement the pkey-xxx.h, and an error was reported
      when compiling protection_keys.c.
      
      Add a Arch judgment to compile "protection_keys" in the Makefile.
      
      If other arch implement this, add the arch name to the Makefile.
      eg:
          ifneq (,$(findstring $(ARCH),powerpc mips ... ))
      
      Following build errors:
      
          pkey-helpers.h:93:2: error: #error Architecture not supported
           #error Architecture not supported
          pkey-helpers.h:96:20: error: `PKEY_DISABLE_ACCESS' undeclared
           #define PKEY_MASK (PKEY_DISABLE_ACCESS | PKEY_DISABLE_WRITE)
                              ^
          protection_keys.c:218:45: error: `PKEY_DISABLE_WRITE' undeclared
           pkey_assert(flags & (PKEY_DISABLE_ACCESS | PKEY_DISABLE_WRITE));
                                                      ^
      Signed-off-by: default avatarXingxing Su <suxingxing@loongson.cn>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Sandipan Das <sandipan@linux.ibm.com>
      Cc: John Hubbard <jhubbard@nvidia.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
      Cc: Brian Geffon <bgeffon@google.com>
      Cc: Mina Almasry <almasrymina@google.com>
      Link: https://lkml.kernel.org/r/1606826876-30656-1-git-send-email-suxingxing@loongson.cn
      
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d8cbe8bf
  12. 14 Oct, 2020 2 commits
    • John Hubbard's avatar
      selftests/vm: fix incorrect gcc invocation in some cases · 34d10913
      John Hubbard authored
      
      Avoid accidental wrong builds, due to built-in rules working just a little
      bit too well--but not quite as well as required for our situation here.
      
      In other words, "make userfaultfd" (for example) is supposed to fail to
      build at all, because this Makefile only supports either "make" (all), or
      "make /full/path".  However, the built-in rules, if not suppressed, will
      pick up CFLAGS and the initial LDLIBS (but not the target-specific LDLIBS,
      because those are only set for the full path target!).  This causes it to
      get pretty far into building things despite using incorrect values such as
      an *occasionally* incomplete LDLIBS value.
      Signed-off-by: default avatarJohn Hubbard <jhubbard@nvidia.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Jason Gunthorpe <jgg@ziepe.ca>
      Link: https://lkml.kernel.org/r/20200915012901.1655280-3-jhubbard@nvidia.com
      
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      34d10913
    • John Hubbard's avatar
      selftests/vm: fix false build success on the second and later attempts · efc9511c
      John Hubbard authored
      
      Patch series "selftests/vm: fix some minor aggravating factors in the Makefile".
      
      This fixes a couple of minor aggravating factors that I ran across while
      trying to do some changes in selftests/vm.  These are simple things, but
      like most things with GNU Make, it's rarely obvious what's wrong until you
      understand *the entire Makefile and all of its includes*.
      
      So while there is, of course, joy in learning those details, I thought I'd
      fix these little things, so as to allow others to skip out on the Joy if
      they so choose.  :)
      
      First of all, if you have an item (let's choose userfaultfd for an
      example) that fails to build, you might do this:
      
      $ make -j32
      
          # ...you observe a failed item in the threaded output
      
      # OK, let's get a closer look
      
      $ make
          # ...but now the build quietly "succeeds".
      
      That's what Patch 0001 fixes.
      
      Second, if you instead attempt this approach for your closer look (a casual
      mistake, as it's not supported):
      
      $ make userfaultfd
      
          # ...userfaultfd fails to link, due to incomplete LDLIBS
      
      That's what Patch 0002 fixes.
      
      This patch (of 2):
      
      If one or more of these selftest fail to build, then after the first
      failure, subsequent invocations of "make" will make it appear that there
      are no build failures, after all.
      
      That's because the failed build products remain, with up-to-date
      timestamps, thus tricking Make (and you!) into believing that there's
      nothing else to build.
      
      Fix this by telling Make to delete targets that didn't completely
      succeed.
      Signed-off-by: default avatarJohn Hubbard <jhubbard@nvidia.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Jason Gunthorpe <jgg@ziepe.ca>
      Link: https://lkml.kernel.org/r/20200915012901.1655280-1-jhubbard@nvidia.com
      Link: https://lkml.kernel.org/r/20200915012901.1655280-2-jhubbard@nvidia.com
      
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      efc9511c
  13. 05 Jun, 2020 2 commits
  14. 04 Jun, 2020 1 commit
  15. 19 May, 2020 1 commit
  16. 13 Apr, 2020 2 commits
  17. 02 Apr, 2020 2 commits
  18. 07 Nov, 2019 1 commit
  19. 05 Jun, 2019 1 commit
    • Shuah Khan's avatar
      selftests: vm: Fix test build failure when built by itself · e2e88325
      Shuah Khan authored
      vm test build fails when test is built by itself using
      
      make -C tools/testing/selftests/vm
      or
      cd tools/testing/selftests/vm; make
      
      When the test is built invoking its Makefile directly, it defines
      OUTPUT which conflicts with lib.mk's logic to install headers.
      
      make --no-builtin-rules INSTALL_HDR_PATH=$OUTPUT/usr \
              ARCH=x86 -C ../../../.. headers_install
      make[1]: Entering directory '/mnt/data/lkml/linux_5.2'
        REMOVE  shmparam.h
      rm: cannot remove '/usr/include/asm-generic/shmparam.h': Permission denied
      scripts/Makefile.headersinst:96: recipe for target '/usr/include/asm-generic/.install' failed
      make[3]: *** [/usr/include/asm-generic/.install] Error 1
      scripts/Makefile.headersinst:32: recipe for target 'asm-generic' failed
      make[2]: *** [asm-generic] Error 2
      Makefile:1199: recipe for target 'headers_install' failed
      make[1]: *** [headers_install] Error 2
      make[1]: Leaving directory '/mnt/data/lkml/linux_5.2'
      ../lib.mk:52: recipe for target 'khdr' failed
      make: *** [khdr] Error 2
      
      Fixes: 8ce72dc3
      
       ("selftests: fix headers_install circular dependency")
      Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
      e2e88325
  20. 30 May, 2019 1 commit
  21. 17 Dec, 2018 1 commit
    • Shuah Khan's avatar
      selftests: Fix test errors related to lib.mk khdr target · 283ac6d5
      Shuah Khan authored
      Commit b2d35fa5 ("selftests: add headers_install to lib.mk") added
      khdr target to run headers_install target from the main Makefile. The
      logic uses KSFT_KHDR_INSTALL and top_srcdir as controls to initialize
      variables and include files to run headers_install from the top level
      Makefile. There are a few problems with this logic.
      
      1. Exposes top_srcdir to all tests
      2. Common logic impacts all tests
      3. Uses KSFT_KHDR_INSTALL, top_srcdir, and khdr in an adhoc way. Tests
         add "khdr" dependency in their Makefiles to TEST_PROGS_EXTENDED in
         some cases, and STATIC_LIBS in other cases. This makes this framework
         confusing to use.
      
      The common logic that runs for all tests even when KSFT_KHDR_INSTALL
      isn't defined by the test. top_srcdir is initialized to a default value
      when test doesn't initialize it. It works for all tests without a sub-dir
      structure and tests with sub-dir structure fail to build.
      
      e.g: make -C sparc64/drivers/ or make -C drivers/dma-buf
      
      ../../lib.mk:20: ../../../../scripts/subarch.include: No such file or directory
      make: *** No rule to make target '../../../../scripts/subarch.include'.  Stop.
      
      There is no reason to require all tests to define top_srcdir and there is
      no need to require tests to add khdr dependency using adhoc changes to
      TEST_* and other variables.
      
      Fix it with a consistent use of KSFT_KHDR_INSTALL and top_srcdir from tests
      that have the dependency on headers_install.
      
      Change common logic to include khdr target define and "all" target with
      dependency on khdr when KSFT_KHDR_INSTALL is defined.
      
      Only tests that have dependency on headers_install have to define just
      the KSFT_KHDR_INSTALL, and top_srcdir variables and there is no need to
      specify khdr dependency in the test Makefiles.
      
      Fixes: b2d35fa5
      
       ("selftests: add headers_install to lib.mk")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarShuah Khan <shuah@kernel.org>
      Reviewed-by: default avatarKhalid Aziz <khalid.aziz@oracle.com>
      Reviewed-by: default avatarAnders Roxell <anders.roxell@linaro.org>
      Signed-off-by: default avatarShuah Khan <shuah@kernel.org>
      283ac6d5
  22. 13 Dec, 2018 1 commit
    • Shuah Khan's avatar
      selftests: Fix test errors related to lib.mk khdr target · 211929fd
      Shuah Khan authored
      Commit b2d35fa5 ("selftests: add headers_install to lib.mk") added
      khdr target to run headers_install target from the main Makefile. The
      logic uses KSFT_KHDR_INSTALL and top_srcdir as controls to initialize
      variables and include files to run headers_install from the top level
      Makefile. There are a few problems with this logic.
      
      1. Exposes top_srcdir to all tests
      2. Common logic impacts all tests
      3. Uses KSFT_KHDR_INSTALL, top_srcdir, and khdr in an adhoc way. Tests
         add "khdr" dependency in their Makefiles to TEST_PROGS_EXTENDED in
         some cases, and STATIC_LIBS in other cases. This makes this framework
         confusing to use.
      
      The common logic that runs for all tests even when KSFT_KHDR_INSTALL
      isn't defined by the test. top_srcdir is initialized to a default value
      when test doesn't initialize it. It works for all tests without a sub-dir
      structure and tests with sub-dir structure fail to build.
      
      e.g: make -C sparc64/drivers/ or make -C drivers/dma-buf
      
      ../../lib.mk:20: ../../../../scripts/subarch.include: No such file or directory
      make: *** No rule to make target '../../../../scripts/subarch.include'.  Stop.
      
      There is no reason to require all tests to define top_srcdir and there is
      no need to require tests to add khdr dependency using adhoc changes to
      TEST_* and other variables.
      
      Fix it with a consistent use of KSFT_KHDR_INSTALL and top_srcdir from tests
      that have the dependency on headers_install.
      
      Change common logic to include khdr target define and "all" target with
      dependency on khdr when KSFT_KHDR_INSTALL is defined.
      
      Only tests that have dependency on headers_install have to define just
      the KSFT_KHDR_INSTALL, and top_srcdir variables and there is no need to
      specify khdr dependency in the test Makefiles.
      
      Fixes: b2d35fa5
      
       ("selftests: add headers_install to lib.mk")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarShuah Khan <shuah@kernel.org>
      211929fd
  23. 26 Oct, 2018 1 commit
  24. 05 Sep, 2018 1 commit
  25. 22 Aug, 2018 1 commit
  26. 01 Feb, 2018 1 commit
    • Aneesh Kumar K.V's avatar
      selftests/vm: move 128TB mmap boundary test to generic directory · 235266b8
      Aneesh Kumar K.V authored
      Architectures like PPC64 support mmap hint address based large address
      space selection.  This test can be run on those architectures too.  Move
      the test from the x86 selftests to selftest/vm so that other
      architectures can use it too.
      
      We also add a few new test scenarios in this patch.  We do test a few
      boundary conditions before we do a high address mmap.  PPC64 uses the
      address limit to validate the address in the fault path.  We had bugs in
      this area w.r.t SLB fault handling before we updated the addess limit.
      
      We also touch the allocated space to make sure we don't have any bugs in
      the fault handling path.
      
      [akpm@linux-foundation.org: restore tools/testing/selftests/vm/Makefile alpha ordering]
      Link: http://lkml.kernel.org/r/20171123165226.32582-1-aneesh.kumar@linux.vnet.ibm.com
      
      Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Cc: "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      ...
      235266b8
  27. 18 Nov, 2017 1 commit
  28. 02 Nov, 2017 1 commit
    • Greg Kroah-Hartman's avatar
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman authored
      Many source files in the tree are missing licensing information, which
      makes it harder for compliance tools to determine the correct license.
      
      By default all files without license information are under the default
      license of the kernel, which is GPL version 2.
      
      Update the files which contain no license information with the 'GPL-2.0'
      SPDX license identifier.  The SPDX identifier is a legally binding
      shorthand, which can be used instead of the full boiler plate text.
      
      This patch is based on work done by Thomas Gleixner and Kate Stewart and
      Philippe Ombredanne.
      
      How this work was done:
      
      Patches were generated and checked against linux-4.14-rc6 for a subset of
      the use cases:
       - file had no licensing information it it.
       - file was a */uapi/* one with no licensing information in it,
       - file was a */uapi/* one with existing licensing information,
      
      Further patches will be generated in subsequent months to fix up cases
      where non-standard...
      b2441318
  29. 09 May, 2017 1 commit