aboutsummaryrefslogtreecommitdiffstats
path: root/tools (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-08-16selftests: futex: convert test to use ksft TAP13 frameworkShuah Khan8-23/+30
Convert test to use ksft TAP13 framework to print user friendly test output which is consistent across kselftest suite. Acked-by: Darren Hart (VMware) <dvhart@infradead.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-08-14selftests: capabilities: convert error output to TAP13 ksft frameworkShuah Khan2-49/+65
Convert errx() and err() usage to appropriate TAP13 ksft API. Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-08-11selftests: memfd: Align STACK_SIZE for ARM AArch64 systemOrson Zhai1-1/+1
The stack size should be 16 bytes aligned in arm64 system. The similar patch has been merged already. > <commit id: 1f78dda2cf5e4eeb00aee2a01c9515e2e704b4c0> > selftests: memfd_test: Revised STACK_SIZE to make it 16-byte aligned > > There is a mandate of 16-byte aligned stack on AArch64 [1], so the > STACK_SIZE here should also be 16-byte aligned, otherwise we would > get an error when calling clone(). > > [1] http://lxr.free-electrons.com/source/arch/arm64/kernel/process.c#L265 > > Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org> > Acked-by: Arnd Bergmann <arnd@arndb.de> > Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Orson Zhai <orson.zhai@linaro.org> Reviewed-by: Sumit Semwal <sumit.semwal@linaro.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-08-09selftests: warn if failure is due to lack of executable bitLuis R. Rodriguez1-1/+6
Executing selftests is fragile as if someone forgot to set a secript as executable the test will fail, and you won't know for sure if the failure was caused by the lack of proper permissions or something else. Setting scripts as executable is required, this also enable folks to execute selftests as independent units. Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-08-09selftests: kselftest framework: add error counterShuah Khan1-3/+18
Some tests track errors in addition to test failures. Add ksft_error counter, ksft_get_error_cnt(), and ksft_test_result_error() API to get the counter value and print error message. Update ksft_print_cnts(), and ksft_test_num() to include error counter. Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-08-02selftests: capabilities: convert the test to use TAP13 ksft frameworkShuah Khan2-38/+62
Convert the test to use TAP13 ksft framework for test output. Converting error paths using err() and errx() will be done in another patch to make it easier for review and change management. Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-08-02selftests: capabilities: fix to run Non-root +ia, sgidroot => i testShuah Khan1-1/+2
do_tests() runs sgidnonroot test without fork_wait(). As a result the last test "Non-root +ia, sgidroot => i test" is left out. Fix it. Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-08-02selftests: ptp: include default header install pathGrygorii Strashko1-0/+1
Add the usr/include subdirectory of the top-level tree to the include path to fix build when cross compiling for ARM. testptp.c: In function 'main': testptp.c:289:15: error: 'struct ptp_clock_caps' has no member named 'cross_timestamping' caps.cross_timestamping); Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-08-02selftests: sigaltstack: convert to use TAP13 ksft frameworkShuah Khan1-22/+31
Convert to use TAP13 ksft framework to output results. Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-08-02selftests: splice: add .gitignore for generated filesShuah Khan1-0/+1
Add .gitignore for generated files. Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-08-02selftests: pstore: add .gitignore for generated filesShuah Khan1-0/+2
Add .gitignore for generated files. Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-07-28selftests: sync: convert to use TAP13 ksft frameworkShuah Khan2-34/+41
Convert test to use TAP13 ksft framework. Output after conversion: TAP version 13 # [RUN] Testing sync framework ok 1 [RUN] test_alloc_timeline ok 2 [RUN] test_alloc_fence ok 3 [RUN] test_alloc_fence_negative ok 4 [RUN] test_fence_one_timeline_wait ok 5 [RUN] test_fence_one_timeline_merge ok 6 [RUN] test_fence_merge_same_fence ok 7 [RUN] test_fence_multi_timeline_wait ok 8 [RUN] test_stress_two_threads_shared_timeline ok 9 [RUN] test_consumer_stress_multi_producer_single_consumer ok 10 [RUN] test_merge_stress_random_merge Pass 10 Fail 0 Xfail 0 Xpass 0 Skip 0 1..10 Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.com>
2017-07-28selftests: kselftest framework: add API to return pass/fail/* countsShuah Khan1-0/+10
Some tests print final pass/fail message based on fail count. Add ksft_get_*_cnt() API to kselftest framework to return counts. Update ksft_print_cnts() to print the test results summary message with individual pass, fail, ... counters. Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.com>
2017-07-28selftests: sync: differentiate between sync unsupported and access errorsShuah Khan1-4/+19
Sync test doesn't differentiate between sync unsupported and test run by non-root user and treats both as unsupported cases. Fix it to add handling for these two different scenarios. Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.com>
2017-07-26selftests: ftrace: Check given string is not zero-lengthMasami Hiramatsu1-3/+3
Use [ ! -z "$VAR" ] instead of [ "$VAR" ] to check whether the given string variable is not zero-length since it obviously shows what it means. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Acked-by: Steven Rostedt (VMware) <srostedt@goodmis.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-07-26selftests: ftrace: Output only to console with "--logdir -"Masami Hiramatsu1-8/+21
Output logs only to console if "-" is given to --logdir option. In this case, ftracetest doesn't record any log on the disk, and all logs immediately shown (including all command logs.) Since there is no "tee" in the middle of command and console, it outputs the log really soon. This option is useful only when the console is logged. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Acked-by: Steven Rostedt (VMware) <srostedt@goodmis.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-07-26selftests: ftrace: Add more verbosity for immediate logMasami Hiramatsu1-3/+7
Add 3-level verbosity for showing traced command log on console immediately. Since some test cases can cause kernel pacic if there is a probrem (like regression etc.), we can not know which command caused the problem without traced command log. This verbosity (-vvv) solves that because it shows the log on console immediately. User can get continuous command/error log. Note that this is a kind of kernel debug mode, if you don't see any kernel related issue, you don't need this verbosity. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Acked-by: Steven Rostedt (VMware) <srostedt@goodmis.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-07-26selftests: ftrace: Add --fail-unsupported optionMasami Hiramatsu1-1/+7
Add --fail-unsupported option to fail the test result if ftracetest gets UNSUPPORTED result. UNSUPPORTED usually happens when the kernel is old (e.g. stable tree) or some kernel feature is disabled. However, if newer kernel has any bug or regression, it can make test results in UNSUPPORTED too. This option can detect such kernel regression. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Acked-by: Steven Rostedt (VMware) <srostedt@goodmis.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-07-26selftests: ftrace: Do not failure if there is unsupported testsMasami Hiramatsu1-1/+1
Do not return failure exit code (1) for unsupported testcases, since it is expected for stable kernels. Previously, ftracetest is expected to run only on current release for avoiding regressions. However, nowadays we run it on stable kernels. This means some test cases must return unsupported result. In such case, we should NOT exit ftracetest with error status for unsupported results so that kselftest (upper tests wrapper) shows it passed correctly. Note that we continue to treat unresolved results as failure, if test writers would like to notice user that the test result should be reviewed, they can use exit_unresolved. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Acked-by: Steven Rostedt (VMware) <srostedt@goodmis.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-07-26selftests: breakpoint_test: Add missing line breaksShuah Khan1-2/+2
Add missing line breaks between the last two tests. Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-07-24selftests: Fix installation for splice testDaniel Díaz1-4/+1
Simplify the Makefile rules so that the test is automatically installed (and cleaned) by leveraging the TEST_GEN_PROGS_EXTENDED definition. Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org> Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-07-24selftests: watchdog: get boot reason via WDIOC_GETBOOTSTATUSEugeniu Rosca1-1/+17
Some watchdog drivers implement WDIOF_CARDRESET feature. As example, see commit b6ef36d2c1e3 ("watchdog: qcom: Report reboot reason"). This option allows reporting to userspace the cause of the last boot (POR/watchdog reset), being helpful in e.g. automated test-cases. Add support for WDIOC_GETBOOTSTATUS in the test code, to be able to: - check if watchdog drivers properly implement WDIOF_CARDRESET. - check the last boot status, if WDIOF_CARDRESET is implemented. Make the `-b, --bootstatus` option one-shot. That means, skip the keepalive mechanism if `-b` is provided on the command line, as we are only interested in the boot status information. Tested on Rcar-H3 Salvator-X board: ********************** Cold boot finished salvator-x:/home/root# ./watchdog-test -h Usage: ./watchdog-test [options] -b, --bootstatus Get last boot status (Watchdog/POR) -d, --disable Turn off the watchdog timer -e, --enable Turn on the watchdog timer -h, --help Print the help message -p, --pingrate=P Set ping rate to P seconds (default 1) -t, --timeout=T Set timeout to T seconds Parameters are parsed left-to-right in real-time. Example: ./watchdog-test -d -t 10 -p 5 -e salvator-x:/home/root# salvator-x:/home/root# ./watchdog-test -b Last boot is caused by: Power-On-Reset. salvator-x:/home/root# salvator-x:/home/root# ./watchdog-test -d -t 1 -p 2 -e Watchdog card disabled. Watchdog timeout set to 1 seconds. Watchdog ping rate set to 2 seconds. Watchdog card enabled. Watchdog Ticking Away! ********************** Reboot due to watchdog trigger finished salvator-x:/home/root# ./watchdog-test -b Last boot is caused by: Watchdog. salvator-x:/home/root# salvator-x:/home/root# reboot ********************** Reboot due to user action finished salvator-x:/home/root# ./watchdog-test -b Last boot is caused by: Power-On-Reset. salvator-x:/home/root# Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-07-24selftests: watchdog: avoid keepalive floodEugeniu Rosca1-2/+6
Calling `watchdog-test [options] -p 0` results in flooding the kernel with WDIOC_KEEPALIVE. Fix this by enforcing 1 second as minimal/default keepalive/ping rate. Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-07-24selftests: watchdog: point out ioctl() failuresEugeniu Rosca1-0/+6
Report the failure of WDIOC_SETOPTIONS/WDIOC_SETTIMEOUT ioctls. Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-07-24selftests: watchdog: prefer strtoul() over atoi()Eugeniu Rosca1-1/+1
commit f15d7114bbdd ("Documentation/watchdog: add timeout and ping rate control to watchdog-test.c") used both atoi() and strtoul() for string to integer conversion. As usage of atoi() is discouraged in newer code, replace it with strtoul() for consistency. Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-07-24selftests: watchdog: use getopt_long()Eugeniu Rosca1-17/+39
Switch from manual argv[] parsing to getopt_long() argument processing. This creates more readable code and allows easier feature addition. This also fixes some segmentation faults introduced by commit 1dbdcc810928 ("selftests: watchdog: accept multiple params on command line"), when options -t or -p are not given the required value: ./watchdog-test -p 1 -t ./watchdog-test -t 1 -p No changes are intended in the way watchdog-test interacts with the kernel. The only noticible changes, tightly related to the addition of getopt (and done for easier maintenance), are: - help message has been reworked and migrated to a dedicated function. - all short/long options and the help message are sorted alphabetically. - all case statements inside the getopt loop are sorted alphabetically. Fixes: 1dbdcc810928 ("selftests: watchdog: accept multiple params on command line") Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-07-24selftests: watchdog: fix mixed whitespaceEugeniu Rosca1-63/+63
Convert spaces to tabs for checkpatch compliance. Quick way to verify this is by running `git show -w <commit-id>`, which returns an empty commit body. No functional change intended. Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-07-24selftests/nsfs: create kconfig fragmentsNaresh Kamboju1-0/+3
Create a config fragment for nsfs to enable additional config options. The config fragments can be used with the help of scripts/kconfig/merge_config.sh. Signed-off-by: Naresh Kamboju <naresh.kamboju@linaro.org> Acked-by: Andrei Vagin <avagin@virtuozzo.com> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-07-14Merge branch 'akpm' (patches from Andrew)Linus Torvalds3-0/+633
Merge even more updates from Andrew Morton: - a few leftovers - fault-injector rework - add a module loader test driver * emailed patches from Andrew Morton <akpm@linux-foundation.org>: kmod: throttle kmod thread limit kmod: add test driver to stress test the module loader MAINTAINERS: give kmod some maintainer love xtensa: use generic fb.h fault-inject: add /proc/<pid>/fail-nth fault-inject: simplify access check for fail-nth fault-inject: make fail-nth read/write interface symmetric fault-inject: parse as natural 1-based value for fail-nth write interface fault-inject: automatically detect the number base for fail-nth write interface kernel/watchdog.c: use better pr_fmt prefix MAINTAINERS: move the befs tree to kernel.org lib/atomic64_test.c: add a test that atomic64_inc_not_zero() returns an int mm: fix overflow check in expand_upwards()
2017-07-14kmod: throttle kmod thread limitLuis R. Rodriguez1-22/+2
If we reach the limit of modprobe_limit threads running the next request_module() call will fail. The original reason for adding a kill was to do away with possible issues with in old circumstances which would create a recursive series of request_module() calls. We can do better than just be super aggressive and reject calls once we've reached the limit by simply making pending callers wait until the threshold has been reduced, and then throttling them in, one by one. This throttling enables requests over the kmod concurrent limit to be processed once a pending request completes. Only the first item queued up to wait is woken up. The assumption here is once a task is woken it will have no other option to also kick the queue to check if there are more pending tasks -- regardless of whether or not it was successful. By throttling and processing only max kmod concurrent tasks we ensure we avoid unexpected fatal request_module() calls, and we keep memory consumption on module loading to a minimum. With x86_64 qemu, with 4 cores, 4 GiB of RAM it takes the following run time to run both tests: time ./kmod.sh -t 0008 real 0m16.366s user 0m0.883s sys 0m8.916s time ./kmod.sh -t 0009 real 0m50.803s user 0m0.791s sys 0m9.852s Link: http://lkml.kernel.org/r/20170628223155.26472-4-mcgrof@kernel.org Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org> Reviewed-by: Petr Mladek <pmladek@suse.com> Cc: Jessica Yu <jeyu@redhat.com> Cc: Shuah Khan <shuah@kernel.org> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Michal Marek <mmarek@suse.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-07-14kmod: add test driver to stress test the module loaderLuis R. Rodriguez3-0/+653
This adds a new stress test driver for kmod: the kernel module loader. The new stress test driver, test_kmod, is only enabled as a module right now. It should be possible to load this as built-in and load tests early (refer to the force_init_test module parameter), however since a lot of test can get a system out of memory fast we leave this disabled for now. Using a system with 1024 MiB of RAM can *easily* get your kernel OOM fast with this test driver. The test_kmod driver exposes API knobs for us to fine tune simple request_module() and get_fs_type() calls. Since these API calls only allow each one parameter a test driver for these is rather simple. Other factors that can help out test driver though are the number of calls we issue and knowing current limitations of each. This exposes configuration as much as possible through userspace to be able to build tests directly from userspace. Since it allows multiple misc devices its will eventually (once we add a knob to let us create new devices at will) also be possible to perform more tests in parallel, provided you have enough memory. We only enable tests we know work as of right now. Demo screenshots: # tools/testing/selftests/kmod/kmod.sh kmod_test_0001_driver: OK! - loading kmod test kmod_test_0001_driver: OK! - Return value: 256 (MODULE_NOT_FOUND), expected MODULE_NOT_FOUND kmod_test_0001_fs: OK! - loading kmod test kmod_test_0001_fs: OK! - Return value: -22 (-EINVAL), expected -EINVAL kmod_test_0002_driver: OK! - loading kmod test kmod_test_0002_driver: OK! - Return value: 256 (MODULE_NOT_FOUND), expected MODULE_NOT_FOUND kmod_test_0002_fs: OK! - loading kmod test kmod_test_0002_fs: OK! - Return value: -22 (-EINVAL), expected -EINVAL kmod_test_0003: OK! - loading kmod test kmod_test_0003: OK! - Return value: 0 (SUCCESS), expected SUCCESS kmod_test_0004: OK! - loading kmod test kmod_test_0004: OK! - Return value: 0 (SUCCESS), expected SUCCESS kmod_test_0005: OK! - loading kmod test kmod_test_0005: OK! - Return value: 0 (SUCCESS), expected SUCCESS kmod_test_0006: OK! - loading kmod test kmod_test_0006: OK! - Return value: 0 (SUCCESS), expected SUCCESS kmod_test_0005: OK! - loading kmod test kmod_test_0005: OK! - Return value: 0 (SUCCESS), expected SUCCESS kmod_test_0006: OK! - loading kmod test kmod_test_0006: OK! - Return value: 0 (SUCCESS), expected SUCCESS XXX: add test restult for 0007 Test completed You can also request for specific tests: # tools/testing/selftests/kmod/kmod.sh -t 0001 kmod_test_0001_driver: OK! - loading kmod test kmod_test_0001_driver: OK! - Return value: 256 (MODULE_NOT_FOUND), expected MODULE_NOT_FOUND kmod_test_0001_fs: OK! - loading kmod test kmod_test_0001_fs: OK! - Return value: -22 (-EINVAL), expected -EINVAL Test completed Lastly, the current available number of tests: # tools/testing/selftests/kmod/kmod.sh --help Usage: tools/testing/selftests/kmod/kmod.sh [ -t <4-number-digit> ] Valid tests: 0001-0009 0001 - Simple test - 1 thread for empty string 0002 - Simple test - 1 thread for modules/filesystems that do not exist 0003 - Simple test - 1 thread for get_fs_type() only 0004 - Simple test - 2 threads for get_fs_type() only 0005 - multithreaded tests with default setup - request_module() only 0006 - multithreaded tests with default setup - get_fs_type() only 0007 - multithreaded tests with default setup test request_module() and get_fs_type() 0008 - multithreaded - push kmod_concurrent over max_modprobes for request_module() 0009 - multithreaded - push kmod_concurrent over max_modprobes for get_fs_type() The following test cases currently fail, as such they are not currently enabled by default: # tools/testing/selftests/kmod/kmod.sh -t 0008 # tools/testing/selftests/kmod/kmod.sh -t 0009 To be sure to run them as intended please unload both of the modules: o test_module o xfs And ensure they are not loaded on your system prior to testing them. If you use these paritions for your rootfs you can change the default test driver used for get_fs_type() by exporting it into your environment. For example of other test defaults you can override refer to kmod.sh allow_user_defaults(). Behind the scenes this is how we fine tune at a test case prior to hitting a trigger to run it: cat /sys/devices/virtual/misc/test_kmod0/config echo -n "2" > /sys/devices/virtual/misc/test_kmod0/config_test_case echo -n "ext4" > /sys/devices/virtual/misc/test_kmod0/config_test_fs echo -n "80" > /sys/devices/virtual/misc/test_kmod0/config_num_threads cat /sys/devices/virtual/misc/test_kmod0/config echo -n "1" > /sys/devices/virtual/misc/test_kmod0/config_num_threads Finally to trigger: echo -n "1" > /sys/devices/virtual/misc/test_kmod0/trigger_config The kmod.sh script uses the above constructs to build different test cases. A bit of interpretation of the current failures follows, first two premises: a) When request_module() is used userspace figures out an optimized version of module order for us. Once it finds the modules it needs, as per depmod symbol dep map, it will finit_module() the respective modules which are needed for the original request_module() request. b) We have an optimization in place whereby if a kernel uses request_module() on a module already loaded we never bother userspace as the module already is loaded. This is all handled by kernel/kmod.c. A few things to consider to help identify root causes of issues: 0) kmod 19 has a broken heuristic for modules being assumed to be built-in to your kernel and will return 0 even though request_module() failed. Upgrade to a newer version of kmod. 1) A get_fs_type() call for "xfs" will request_module() for "fs-xfs", not for "xfs". The optimization in kernel described in b) fails to catch if we have a lot of consecutive get_fs_type() calls. The reason is the optimization in place does not look for aliases. This means two consecutive get_fs_type() calls will bump kmod_concurrent, whereas request_module() will not. This one explanation why test case 0009 fails at least once for get_fs_type(). 2) If a module fails to load --- for whatever reason (kmod_concurrent limit reached, file not yet present due to rootfs switch, out of memory) we have a period of time during which module request for the same name either with request_module() or get_fs_type() will *also* fail to load even if the file for the module is ready. This explains why *multiple* NULLs are possible on test 0009. 3) finit_module() consumes quite a bit of memory. 4) Filesystems typically also have more dependent modules than other modules, its important to note though that even though a get_fs_type() call does not incur additional kmod_concurrent bumps, since userspace loads dependencies it finds it needs via finit_module_fd(), it *will* take much more memory to load a module with a lot of dependencies. Because of 3) and 4) we will easily run into out of memory failures with certain tests. For instance test 0006 fails on qemu with 1024 MiB of RAM. It panics a box after reaping all userspace processes and still not having enough memory to reap. [arnd@arndb.de: add dependencies for test module] Link: http://lkml.kernel.org/r/20170630154834.3689272-1-arnd@arndb.de Link: http://lkml.kernel.org/r/20170628223155.26472-3-mcgrof@kernel.org Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org> Cc: Jessica Yu <jeyu@redhat.com> Cc: Shuah Khan <shuah@kernel.org> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Michal Marek <mmarek@suse.com> Cc: Petr Mladek <pmladek@suse.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-07-14Merge tag 'ntb-4.13' of git://github.com/jonmason/ntbLinus Torvalds1-2/+9
Pull NTB updates from Jon Mason: "The major change in the series is a rework of the NTB infrastructure to all for IDT hardware to be supported (and resulting fallout from that). There are also a few clean-ups, etc. New IDT NTB driver and changes to the NTB infrastructure to allow for this different kind of NTB HW, some style fixes (per Greg KH recommendation), and some ntb_test tweaks" * tag 'ntb-4.13' of git://github.com/jonmason/ntb: ntb_netdev: set the net_device's parent ntb: Add error path/handling to Debug FS entry creation ntb: Add more debugfs support for ntb_perf testing options ntb: Remove debug-fs variables from the context structure ntb: Add a module option to control affinity of DMA channels NTB: Add IDT 89HPESxNTx PCIe-switches support ntb_hw_intel: Style fixes: open code macros that just obfuscate code ntb_hw_amd: Style fixes: open code macros that just obfuscate code NTB: Add ntb.h comments NTB: Add PCIe Gen4 link speed NTB: Add new Memory Windows API documentation NTB: Add Messaging NTB API NTB: Alter Scratchpads API to support multi-ports devices NTB: Alter MW API to support multi-ports devices NTB: Alter link-state API to support multi-port devices NTB: Add indexed ports NTB API NTB: Make link-state API being declared first NTB: ntb_test: add parameter for doorbell bitmask NTB: ntb_test: modprobe on remote host
2017-07-13Merge tag 'trace-v4.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-traceLinus Torvalds3-2/+66
Pull more tracing updates from Steven Rostedt: "A few more minor updates: - Show the tgid mappings for user space trace tools to use - Fix and optimize the comm and tgid cache recording - Sanitize derived kprobe names - Ftrace selftest updates - trace file header fix - Update of Documentation/trace/ftrace.txt - Compiler warning fixes - Fix possible uninitialized variable" * tag 'trace-v4.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: ftrace: Fix uninitialized variable in match_records() ftrace: Remove an unneeded NULL check ftrace: Hide cached module code for !CONFIG_MODULES tracing: Do note expose stack_trace_filter without DYNAMIC_FTRACE tracing: Update Documentation/trace/ftrace.txt tracing: Fixup trace file header alignment selftests/ftrace: Add a testcase for kprobe event naming selftests/ftrace: Add a test to probe module functions selftests/ftrace: Update multiple kprobes test for powerpc trace/kprobes: Sanitize derived event names tracing: Attempt to record other information even if some fail tracing: Treat recording tgid for idle task as a success tracing: Treat recording comm for idle task as a success tracing: Add saved_tgids file to show cached pid to tgid mappings
2017-07-13Merge branch 'akpm' (patches from Andrew)Linus Torvalds7-221/+777
Merge yet more updates from Andrew Morton: - various misc things - kexec updates - sysctl core updates - scripts/gdb udpates - checkpoint-restart updates - ipc updates - kernel/watchdog updates - Kees's "rough equivalent to the glibc _FORTIFY_SOURCE=1 feature" - "stackprotector: ascii armor the stack canary" - more MM bits - checkpatch updates * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (96 commits) writeback: rework wb_[dec|inc]_stat family of functions ARM: samsung: usb-ohci: move inline before return type video: fbdev: omap: move inline before return type video: fbdev: intelfb: move inline before return type USB: serial: safe_serial: move __inline__ before return type drivers: tty: serial: move inline before return type drivers: s390: move static and inline before return type x86/efi: move asmlinkage before return type sh: move inline before return type MIPS: SMP: move asmlinkage before return type m68k: coldfire: move inline before return type ia64: sn: pci: move inline before type ia64: move inline before return type FRV: tlbflush: move asmlinkage before return type CRIS: gpio: move inline before return type ARM: HP Jornada 7XX: move inline before return type ARM: KVM: move asmlinkage before type checkpatch: improve the STORAGE_CLASS test mm, migration: do not trigger OOM killer when migrating memory drm/i915: use __GFP_RETRY_MAYFAIL ...
2017-07-13Merge tag 'rtc-4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linuxLinus Torvalds3-5/+211
Pull RTC updates from Alexandre Belloni: "Here is the pull-request for the RTC subsystem for 4.13. Subsystem: - expose non volatile RAM using nvmem instead of open coding in many drivers. Unfortunately, this option has to be enabled by default to not break existing users. - rtctest can now test for cutoff dates, showing when an RTC will start failing to properly save time and date. - new RTC registration functions to remove race conditions in drivers Newly supported RTCs: - Broadcom STB wake-timer - Epson RX8130CE - Maxim IC DS1308 - STMicroelectronics STM32H7 Drivers: - ds1307: use regmap, use nvmem, more cleanups - ds3232: temperature reading support - gemini: renamed to ftrtc010 - m41t80: use CCF to expose the clock - rv8803: use nvmem - s3c: many cleanups - st-lpc: fix y2106 bug" * tag 'rtc-4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (51 commits) rtc: Remove wrong deprecation comment nvmem: include linux/err.h from header rtc: st-lpc: make it robust against y2038/2106 bug rtc: rtctest: add check for problematic dates tools: timer: add rtctest_setdate rtc: ds1307: remove ds1307_remove rtc: ds1307: use generic nvmem rtc: ds1307: switch to rtc_register_device rtc: rv8803: remove rv8803_remove rtc: rv8803: use generic nvmem support rtc: rv8803: switch to rtc_register_device rtc: add generic nvmem support rtc: at91rm9200: remove race condition rtc: introduce new registration method rtc: class separate id allocation from registration rtc: class separate device allocation from registration rtc: stm32: add STM32H7 RTC support dt-bindings: rtc: stm32: add support for STM32H7 rtc: ds1307: add ds1308 variant rtc: ds3232: add temperature support ...
2017-07-12Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netLinus Torvalds3-1/+212
Pull networking fixes from David Miller: 1) Fix 64-bit division in mlx5 IPSEC offload support, from Ilan Tayari and Arnd Bergmann. 2) Fix race in statistics gathering in bnxt_en driver, from Michael Chan. 3) Can't use a mutex in RCU reader protected section on tap driver, from Cong WANG. 4) Fix mdb leak in bridging code, from Eduardo Valentin. 5) Fix free of wrong pointer variable in nfp driver, from Dan Carpenter. 6) Buffer overflow in brcmfmac driver, from Arend van SPriel. 7) ioremap_nocache() return value needs to be checked in smsc911x driver, from Alexey Khoroshilov. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (34 commits) net: stmmac: revert "support future possible different internal phy mode" sfc: don't read beyond unicast address list datagram: fix kernel-doc comments socket: add documentation for missing elements smsc911x: Add check for ioremap_nocache() return code brcmfmac: fix possible buffer overflow in brcmf_cfg80211_mgmt_tx() net: hns: Bugfix for Tx timeout handling in hns driver net: ipmr: ipmr_get_table() returns NULL nfp: freeing the wrong variable mlxsw: spectrum_switchdev: Check status of memory allocation mlxsw: spectrum_switchdev: Remove unused variable mlxsw: spectrum_router: Fix use-after-free in route replace mlxsw: spectrum_router: Add missing rollback samples/bpf: fix a build issue bridge: mdb: fix leak on complete_info ptr on fail path tap: convert a mutex to a spinlock cxgb4: fix BUG() on interrupt deallocating path of ULD qed: Fix printk option passed when printing ipv6 addresses net: Fix minor code bug in timestamping.txt net: stmmac: Make 'alloc_dma_[rt]x_desc_resources()' look even closer ...
2017-07-12mm, tree wide: replace __GFP_REPEAT by __GFP_RETRY_MAYFAIL with more useful semanticMichal Hocko1-1/+1
__GFP_REPEAT was designed to allow retry-but-eventually-fail semantic to the page allocator. This has been true but only for allocations requests larger than PAGE_ALLOC_COSTLY_ORDER. It has been always ignored for smaller sizes. This is a bit unfortunate because there is no way to express the same semantic for those requests and they are considered too important to fail so they might end up looping in the page allocator for ever, similarly to GFP_NOFAIL requests. Now that the whole tree has been cleaned up and accidental or misled usage of __GFP_REPEAT flag has been removed for !costly requests we can give the original flag a better name and more importantly a more useful semantic. Let's rename it to __GFP_RETRY_MAYFAIL which tells the user that the allocator would try really hard but there is no promise of a success. This will work independent of the order and overrides the default allocator behavior. Page allocator users have several levels of guarantee vs. cost options (take GFP_KERNEL as an example) - GFP_KERNEL & ~__GFP_RECLAIM - optimistic allocation without _any_ attempt to free memory at all. The most light weight mode which even doesn't kick the background reclaim. Should be used carefully because it might deplete the memory and the next user might hit the more aggressive reclaim - GFP_KERNEL & ~__GFP_DIRECT_RECLAIM (or GFP_NOWAIT)- optimistic allocation without any attempt to free memory from the current context but can wake kswapd to reclaim memory if the zone is below the low watermark. Can be used from either atomic contexts or when the request is a performance optimization and there is another fallback for a slow path. - (GFP_KERNEL|__GFP_HIGH) & ~__GFP_DIRECT_RECLAIM (aka GFP_ATOMIC) - non sleeping allocation with an expensive fallback so it can access some portion of memory reserves. Usually used from interrupt/bh context with an expensive slow path fallback. - GFP_KERNEL - both background and direct reclaim are allowed and the _default_ page allocator behavior is used. That means that !costly allocation requests are basically nofail but there is no guarantee of that behavior so failures have to be checked properly by callers (e.g. OOM killer victim is allowed to fail currently). - GFP_KERNEL | __GFP_NORETRY - overrides the default allocator behavior and all allocation requests fail early rather than cause disruptive reclaim (one round of reclaim in this implementation). The OOM killer is not invoked. - GFP_KERNEL | __GFP_RETRY_MAYFAIL - overrides the default allocator behavior and all allocation requests try really hard. The request will fail if the reclaim cannot make any progress. The OOM killer won't be triggered. - GFP_KERNEL | __GFP_NOFAIL - overrides the default allocator behavior and all allocation requests will loop endlessly until they succeed. This might be really dangerous especially for larger orders. Existing users of __GFP_REPEAT are changed to __GFP_RETRY_MAYFAIL because they already had their semantic. No new users are added. __alloc_pages_slowpath is changed to bail out for __GFP_RETRY_MAYFAIL if there is no progress and we have already passed the OOM point. This means that all the reclaim opportunities have been exhausted except the most disruptive one (the OOM killer) and a user defined fallback behavior is more sensible than keep retrying in the page allocator. [akpm@linux-foundation.org: fix arch/sparc/kernel/mdesc.c] [mhocko@suse.com: semantic fix] Link: http://lkml.kernel.org/r/20170626123847.GM11534@dhcp22.suse.cz [mhocko@kernel.org: address other thing spotted by Vlastimil] Link: http://lkml.kernel.org/r/20170626124233.GN11534@dhcp22.suse.cz Link: http://lkml.kernel.org/r/20170623085345.11304-3-mhocko@kernel.org Signed-off-by: Michal Hocko <mhocko@suse.com> Acked-by: Vlastimil Babka <vbabka@suse.cz> Cc: Alex Belits <alex.belits@cavium.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Christoph Hellwig <hch@infradead.org> Cc: Darrick J. Wong <darrick.wong@oracle.com> Cc: David Daney <david.daney@cavium.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Mel Gorman <mgorman@suse.de> Cc: NeilBrown <neilb@suse.com> Cc: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-07-12test_sysctl: test against int proc_dointvec() array supportLuis R. Rodriguez1-0/+89
Add a few initial respective tests for an array: o Echoing values separated by spaces works o Echoing only first elements will set first elements o Confirm PAGE_SIZE limit still applies even if an array is used Link: http://lkml.kernel.org/r/20170630224431.17374-7-mcgrof@kernel.org Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org> Cc: Kees Cook <keescook@chromium.org> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Shuah Khan <shuah@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-07-12test_sysctl: add simple proc_douintvec() caseLuis R. Rodriguez1-0/+63
Test against a simple proc_douintvec() case. While at it, add a test against UINT_MAX. Make sure UINT_MAX works, and UINT_MAX+1 will fail and that negative values are not accepted. Link: http://lkml.kernel.org/r/20170630224431.17374-6-mcgrof@kernel.org Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org> Cc: Kees Cook <keescook@chromium.org> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Shuah Khan <shuah@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-07-12test_sysctl: add simple proc_dointvec() caseLuis R. Rodriguez1-0/+62
Test against a simple proc_dointvec() case. While at it, add a test against INT_MAX. Make sure INT_MAX works, and INT_MAX+1 will fail. Also test negative values work. Link: http://lkml.kernel.org/r/20170630224431.17374-5-mcgrof@kernel.org Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org> Cc: Kees Cook <keescook@chromium.org> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Shuah Khan <shuah@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-07-12test_sysctl: test against PAGE_SIZE for intLuis R. Rodriguez1-0/+66
Add the following tests to ensure we do not regress: o Test using a buffer full of space (PAGE_SIZE-1) followed by a single digit works o Test using a buffer full of spaces (PAGE_SIZE or over) will fail As tests increase instead of unloading the module and reloading it we can just do a shell reset_vals() with a reset to values we know are set at init on the driver. Link: http://lkml.kernel.org/r/20170630224431.17374-4-mcgrof@kernel.org Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org> Cc: Kees Cook <keescook@chromium.org> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Shuah Khan <shuah@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-07-12test_sysctl: add generic script to expand on testsLuis R. Rodriguez5-220/+495
This adds a generic script to let us more easily add more tests cases. Since we really have only two types of tests cases just fold them into the one file. Each test unit is now identified into its separate function: # ./sysctl.sh -l Test ID list: TEST_ID x NUM_TEST TEST_ID: Test ID NUM_TESTS: Number of recommended times to run the test 0001 x 1 - tests proc_dointvec_minmax() 0002 x 1 - tests proc_dostring() For now we start off with what we had before, and run only each test once. We can now watch a test case until it fails: ./sysctl.sh -w 0002 We can also run a test case x number of times, say we want to run a test case 100 times: ./sysctl.sh -c 0001 100 To run a test case only once, for example: ./sysctl.sh -s 0002 The default settings are specified at the top of sysctl.sh. Link: http://lkml.kernel.org/r/20170630224431.17374-3-mcgrof@kernel.org Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org> Cc: Kees Cook <keescook@chromium.org> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Shuah Khan <shuah@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-07-12test_sysctl: add dedicated proc sysctl test driverLuis R. Rodriguez3-4/+5
The existing tools/testing/selftests/sysctl/ tests include two test cases, but these use existing production kernel sysctl interfaces. We want to expand test coverage but we can't just be looking for random safe production values to poke at, that's just insane! Instead just dedicate a test driver for debugging purposes and port the existing scripts to use it. This will make it easier for further tests to be added. Subsequent patches will extend our test coverage for sysctl. The stress test driver uses a new license (GPL on Linux, copyleft-next outside of Linux). Linus was fine with this [0] and later due to Ted's and Alans's request ironed out an "or" language clause to use [1] which is already present upstream. [0] https://lkml.kernel.org/r/CA+55aFyhxcvD+q7tp+-yrSFDKfR0mOHgyEAe=f_94aKLsOu0Og@mail.gmail.com [1] https://lkml.kernel.org/r/1495234558.7848.122.camel@linux.intel.com Link: http://lkml.kernel.org/r/20170630224431.17374-2-mcgrof@kernel.org Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org> Acked-by: Kees Cook <keescook@chromium.org> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Shuah Khan <shuah@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-07-11samples/bpf: fix a build issueYonghong Song3-1/+212
With latest net-next: ==== clang -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/6.3.1/include -I./arch/x86/include -I./arch/x86/include/generated/uapi -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h -Isamples/bpf \ -D__KERNEL__ -D__ASM_SYSREG_H -Wno-unused-value -Wno-pointer-sign \ -Wno-compare-distinct-pointer-types \ -Wno-gnu-variable-sized-type-not-at-end \ -Wno-address-of-packed-member -Wno-tautological-compare \ -Wno-unknown-warning-option \ -O2 -emit-llvm -c samples/bpf/tcp_synrto_kern.c -o -| llc -march=bpf -filetype=obj -o samples/bpf/tcp_synrto_kern.o samples/bpf/tcp_synrto_kern.c:20:10: fatal error: 'bpf_endian.h' file not found ^~~~~~~~~~~~~~ 1 error generated. ==== net has the same issue. Add support for ntohl and htonl in tools/testing/selftests/bpf/bpf_endian.h. Also move bpf_helpers.h from samples/bpf to selftests/bpf and change compiler include logic so that programs in samples/bpf can access the headers in selftests/bpf, but not the other way around. Signed-off-by: Yonghong Song <yhs@fb.com> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Lawrence Brakmo <brakmo@fb.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2017-07-09rtc: rtctest: add check for problematic datesBenjamin Gaignard1-4/+124
Some dates could be problematic because they reach the limits of RTC hardware capabilities. This patch add various of them but since it will change RTC date it will be activated only when 'd' args is set. Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-09tools: timer: add rtctest_setdateBenjamin Gaignard2-1/+87
This tool allow to set directly the time and date to a RTC device. Unlike other tools isn't doens't use "struct timeval" or "time_t" so it is safe for 32bits platforms when testing for y2038/2106 bug. Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-07-09Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tipLinus Torvalds2-1/+2
Pull perf fixes from Thomas Gleixner: "A couple of fixes for perf and kprobes: - Add he missing exclude_kernel attribute for the precise_ip level so !CAP_SYS_ADMIN users get the proper results. - Warn instead of failing completely when perf has no unwind support for a particular architectiure built in. - Ensure that jprobes are at function entry and not at some random place" * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: kprobes: Ensure that jprobe probepoints are at function entry kprobes: Simplify register_jprobes() kprobes: Rename [arch_]function_offset_within_entry() to [arch_]kprobe_on_func_entry() perf unwind: Do not fail due to missing unwind support perf evsel: Set attr.exclude_kernel when probing max attr.precise_ip
2017-07-09Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tipLinus Torvalds1-2/+11
Pull objtool fix from Thomas Gleixner: "A fix to the objtool sibling call detection logic to distinguish normal jumps inside a function from a real sibling call" * 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: objtool: Fix sibling call detection logic
2017-07-09selftests/ftrace: Add a testcase for kprobe event namingMasami Hiramatsu1-0/+36
Add a testcase for kprobe event naming. This testcase checks whether the kprobe events can automatically ganerate its event name on normal function and dot-suffixed function. Also it checks whether the kprobe events can correctly define new event with given event name and group name. Link: http://lkml.kernel.org/r/61ae96fd1fcd14ee652c8b6525c218b8661bb0d2.1499453040.git.naveen.n.rao@linux.vnet.ibm.com Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> [Updated tests to use vfs_read and symbols with '.isra.', added check for kprobe_events and a command to clear it on exit, various additional checks and tests] Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-07-09selftests/ftrace: Add a test to probe module functionsNaveen N. Rao1-0/+28
Add a kprobes test to ensure that we are able to add a probe on a module function using 'p <mod>:<func>' format, with/without having to specify a probe name. Link: http://lkml.kernel.org/r/2d8087e25a7ad9206f3e2b7b4bb0c3c86eaa38af.1499453040.git.naveen.n.rao@linux.vnet.ibm.com Suggested-by: Masami Hiramatsu <mhiramat@kernel.org> Acked-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>