• John Hubbard's avatar
    selftests/vm: gup_test: introduce the dump_pages() sub-test · f4f9bda4
    John Hubbard authored
    For quite a while, I was doing a quick hack to gup_test.c (previously,
    gup_benchmark.c) whenever I wanted to try out my changes to dump_page().
    This makes that hack unnecessary, and instead allows anyone to easily get
    the same coverage from a user space program.  That saves a lot of time
    because you don't have to change the kernel, in order to test different
    pages and options.
    
    The new sub-test takes advantage of the existing gup_test infrastructure,
    which already provides a simple user space program, some allocated user
    space pages, an ioctl call, pinning of those pages (via either
    get_user_pages or pin_user_pages) and a corresponding kernel-side test
    invocation.  There's not much more required, mainly just a couple of
    inputs from the user.
    
    In fact, the new test re-uses the existing command line options in order
    to get various helpful combinations (THP or normal, _fast or slow gup, gup
    vs.  pup, and more).
    
    New command line options are: which pages to dump, and what type of
    "get/pin" to use.
    
    In order to figure out which pages to dump, the logic is:
    
    * If the user doesn't specify anything, the page 0 (the first page in
      the address range that the program sets up for testing) is dumped.
    
    * Or, the user can type up to 8 page indices anywhere on the command
      line.  If you type more than 8, then it uses the first 8 and ignores the
      remaining items.
    
    For example:
    
        ./gup_test -ct -F 1 0 19 0x1000
    
    Meaning:
        -c:          dump pages sub-test
        -t:          use THP pages
        -F 1:        use pin_user_pages() instead of get_user_pages()
        0 19 0x1000: dump pages 0, 19, and 4096
    
    Link: https://lkml.kernel.org/r/20201026064021.3545418-7-jhubbard@nvidia.comSigned-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>
    f4f9bda4
gup_test.h 915 Bytes