• Pavel Tatashin's avatar
    selftests/vm: gup_test: fix test flag · 79dbf135
    Pavel Tatashin authored
    In gup_test both gup_flags and test_flags use the same flags field.
    This is broken.
    
    Farther, in the actual gup_test.c all the passed gup_flags are erased
    and unconditionally replaced with FOLL_WRITE.
    
    Which means that test_flags are ignored, and code like this always
    performs pin dump test:
    
    155  			if (gup->flags & GUP_TEST_FLAG_DUMP_PAGES_USE_PIN)
    156  				nr = pin_user_pages(addr, nr, gup->flags,
    157  						    pages + i, NULL);
    158  			else
    159  				nr = get_user_pages(addr, nr, gup->flags,
    160  						    pages + i, NULL);
    161  			break;
    
    Add a new test_flags field, to allow raw gup_flags to work.  Add a new
    subcommand for DUMP_USER_PAGES_TEST to specify that pin test should be
    performed.
    
    Remove unconditional overwriting of gup_flags via FOLL_WRITE.  But,
    preserve the previous behaviour where FOLL_WRITE was the default flag,
    and add a new option "-W" to unset FOLL_WRITE.
    
    Rename flags with gup_flags.
    
    With the fix, dump works like this:
    
      root@virtme:/# gup_tes...
    79dbf135
gup_test.h 938 Bytes