1. 18 12月, 2012 1 次提交
    • D
      vm selftests: print failure status instead of cause make error · 000e06b0
      Dave Young 提交于
      Original behavior:
        bash-4.1$ make -C vm run_tests
        make: Entering directory `/home/dave/git/linux-2.6/tools/testing/selftests/vm'
        /bin/sh ./run_vmtests
        ./run_vmtests: line 24: /proc/sys/vm/nr_hugepages: Permission denied
        Please run this test as root
        make: *** [run_tests] Error 1
        make: Leaving directory `/home/dave/git/linux-2.6/tools/testing/selftests/vm'
      
      After applying the patch:
        bash-4.1$ make -C vm run_tests
        make: Entering directory `/home/dave/git/linux-2.6/tools/testing/selftests/vm'
        ./run_vmtests: line 24: /proc/sys/vm/nr_hugepages: Permission denied
        Please run this test as root
        vmtests: [FAIL]
        make: Leaving directory `/home/dave/git/linux-2.6/tools/testing/selftests/vm'
      Signed-off-by: NDave Young <dyoung@redhat.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      000e06b0
  2. 12 12月, 2012 5 次提交
  3. 14 11月, 2012 1 次提交
    • S
      ktest: Add support for grub2 · a15ba913
      Steven Rostedt 提交于
      As only grub or 'script' is supported for rebooting to a new kernel,
      and Fedora 17 has dropped support for grub, I decided to add grub2
      support as well (I also plan on adding syslinux/extlinux support too).
      
      The options GRUB_FILE and GRUB_REBOOT were added to allow the user
      to specify where to find the grub.cfg and what tool to use to reboot
      into the next kernel respectively.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      a15ba913
  4. 09 11月, 2012 1 次提交
    • A
      revert "epoll: support for disabling items, and a self-test app" · a80a6b85
      Andrew Morton 提交于
      Revert commit 03a7beb5 ("epoll: support for disabling items, and a
      self-test app") pending resolution of the issues identified by Michael
      Kerrisk, copied below.
      
      We'll revisit this for 3.8.
      
      : I've taken a look at this patch as it currently stands in 3.7-rc1, and
      : done a bit of testing. (By the way, the test program
      : tools/testing/selftests/epoll/test_epoll.c does not compile...)
      :
      : There are one or two places where the behavior seems a little strange,
      : so I have a question or two at the end of this mail. But other than
      : that, I want to check my understanding so that the interface can be
      : correctly documented.
      :
      : Just to go though my understanding, the problem is the following
      : scenario in a multithreaded application:
      :
      : 1. Multiple threads are performing epoll_wait() operations,
      :    and maintaining a user-space cache that contains information
      :    corresponding to each file descriptor being monitored by
      :    epoll_wait().
      :
      : 2. At some point, a thread wants to delete (EPOLL_CTL_DEL)
      :    a file descriptor from the epoll interest list, and
      :    delete the corresponding record from the user-space cache.
      :
      : 3. The problem with (2) is that some other thread may have
      :    previously done an epoll_wait() that retrieved information
      :    about the fd in question, and may be in the middle of using
      :    information in the cache that relates to that fd. Thus,
      :    there is a potential race.
      :
      : 4. The race can't solved purely in user space, because doing
      :    so would require applying a mutex across the epoll_wait()
      :    call, which would of course blow thread concurrency.
      :
      : Right?
      :
      : Your solution is the EPOLL_CTL_DISABLE operation. I want to
      : confirm my understanding about how to use this flag, since
      : the description that has accompanied the patches so far
      : has been a bit sparse
      :
      : 0. In the scenario you're concerned about, deleting a file
      :    descriptor means (safely) doing the following:
      :    (a) Deleting the file descriptor from the epoll interest list
      :        using EPOLL_CTL_DEL
      :    (b) Deleting the corresponding record in the user-space cache
      :
      : 1. It's only meaningful to use this EPOLL_CTL_DISABLE in
      :    conjunction with EPOLLONESHOT.
      :
      : 2. Using EPOLL_CTL_DISABLE without using EPOLLONESHOT in
      :    conjunction is a logical error.
      :
      : 3. The correct way to code multithreaded applications using
      :    EPOLL_CTL_DISABLE and EPOLLONESHOT is as follows:
      :
      :    a. All EPOLL_CTL_ADD and EPOLL_CTL_MOD operations should
      :       should EPOLLONESHOT.
      :
      :    b. When a thread wants to delete a file descriptor, it
      :       should do the following:
      :
      :       [1] Call epoll_ctl(EPOLL_CTL_DISABLE)
      :       [2] If the return status from epoll_ctl(EPOLL_CTL_DISABLE)
      :           was zero, then the file descriptor can be safely
      :           deleted by the thread that made this call.
      :       [3] If the epoll_ctl(EPOLL_CTL_DISABLE) fails with EBUSY,
      :           then the descriptor is in use. In this case, the calling
      :           thread should set a flag in the user-space cache to
      :           indicate that the thread that is using the descriptor
      :           should perform the deletion operation.
      :
      : Is all of the above correct?
      :
      : The implementation depends on checking on whether
      : (events & ~EP_PRIVATE_BITS) == 0
      : This replies on the fact that EPOLL_CTL_AD and EPOLL_CTL_MOD always
      : set EPOLLHUP and EPOLLERR in the 'events' mask, and EPOLLONESHOT
      : causes those flags (as well as all others in ~EP_PRIVATE_BITS) to be
      : cleared.
      :
      : A corollary to the previous paragraph is that using EPOLL_CTL_DISABLE
      : is only useful in conjunction with EPOLLONESHOT. However, as things
      : stand, one can use EPOLL_CTL_DISABLE on a file descriptor that does
      : not have EPOLLONESHOT set in 'events' This results in the following
      : (slightly surprising) behavior:
      :
      : (a) The first call to epoll_ctl(EPOLL_CTL_DISABLE) returns 0
      :     (the indicator that the file descriptor can be safely deleted).
      : (b) The next call to epoll_ctl(EPOLL_CTL_DISABLE) fails with EBUSY.
      :
      : This doesn't seem particularly useful, and in fact is probably an
      : indication that the user made a logic error: they should only be using
      : epoll_ctl(EPOLL_CTL_DISABLE) on a file descriptor for which
      : EPOLLONESHOT was set in 'events'. If that is correct, then would it
      : not make sense to return an error to user space for this case?
      
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: "Paton J. Lewis" <palewis@adobe.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a80a6b85
  5. 26 10月, 2012 2 次提交
    • S
      ktest: Fix ktest confusion with CONFIG_MODULES_USE_ELF_RELA · 8bc5e4ea
      Steven Rostedt 提交于
      In order to decide if ktest should bother installing modules on the
      target box, it checks if the config file has CONFIG_MODULES=y. But it
      also checks if the '=y' part exists. It only will install modules if the
      config exists and is set with '=y'. But as the regex that was used
      tests:
      
        /^CONFIG_MODULES(=y)?/
      
      this will also match:
      
        CONFIG_MODULES_USE_ELF_RELA
      
      as the '=y' part was optional and it did not test the rest of the line.
      When this happens, ktest will stop checking the rest of the configs but
      it will also think that no modules are needed to be installed. What it
      should do is only jump out of the loop if it actually found a
      CONFIG_MODULES that is set to true.
      
      Otherwise, ktest wont install the necessary modules needed for proper
      booting of the test target.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      8bc5e4ea
    • D
      tools/testing/selftests/epoll/test_epoll.c: fix build · fc314d0a
      Daniel Hazelton 提交于
      Latest Linus head run of "make selftests" in the tools directory failed
      with references to undefined variables.  Reference was to
      'write_thread_data' which is the name of a struct that is being used, not
      the variable itself.  Change reference so it points to the variable.
      Signed-off-by: NDaniel Hazelton <dshadowwolf@gmail.com>
      Cc: "Paton J. Lewis" <palewis@adobe.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      fc314d0a
  6. 06 10月, 2012 1 次提交
  7. 28 9月, 2012 1 次提交
  8. 27 9月, 2012 1 次提交
    • S
      ktest: Fix ELSE IF statements · 95f57838
      Steven Rostedt 提交于
      The ELSE IF statements do not work as expected if another ELSE statement
      follows. This is because the $if_set is not set. If the ELSE IF
      condition is true, the following ELSE should be ignored. But because the
      $if_set is not set, the following ELSE will also be executed.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      95f57838
  9. 01 9月, 2012 1 次提交
  10. 01 8月, 2012 1 次提交
  11. 31 7月, 2012 4 次提交
    • A
      fault-injection: add tool to run command with failslab or fail_page_alloc · c24aa64d
      Akinobu Mita 提交于
      This adds tools/testing/fault-injection/failcmd.sh to run a command while
      injecting slab/page allocation failures via fault injection.
      
      Example:
      
      Run a command "make -C tools/testing/selftests/ run_tests" with
      injecting slab allocation failure.
      
      	# ./tools/testing/fault-injection/failcmd.sh \
      		-- make -C tools/testing/selftests/ run_tests
      
      Same as above except to specify 100 times failures at most instead of
      one time at most by default.
      
      	# ./tools/testing/fault-injection/failcmd.sh --times=100 \
      		-- make -C tools/testing/selftests/ run_tests
      
      Same as above except to inject page allocation failure instead of slab
      allocation failure.
      
      	# env FAILCMD_TYPE=fail_page_alloc \
      		./tools/testing/fault-injection/failcmd.sh --times=100 \
      		-- make -C tools/testing/selftests/ run_tests
      Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c24aa64d
    • A
      fault-injection: add selftests for cpu and memory hotplug · d89dffa9
      Akinobu Mita 提交于
      This adds two selftests
      
      * tools/testing/selftests/cpu-hotplug/on-off-test.sh is testing script
      for CPU hotplug
      
      1. Online all hot-pluggable CPUs
      2. Offline all hot-pluggable CPUs
      3. Online all hot-pluggable CPUs again
      4. Exit if cpu-notifier-error-inject.ko is not available
      5. Offline all hot-pluggable CPUs in preparation for testing
      6. Test CPU hot-add error handling by injecting notifier errors
      7. Online all hot-pluggable CPUs in preparation for testing
      8. Test CPU hot-remove error handling by injecting notifier errors
      
      * tools/testing/selftests/memory-hotplug/on-off-test.sh is doing the
      similar thing for memory hotplug.
      
      1. Online all hot-pluggable memory
      2. Offline 10% of hot-pluggable memory
      3. Online all hot-pluggable memory again
      4. Exit if memory-notifier-error-inject.ko is not available
      5. Offline 10% of hot-pluggable memory in preparation for testing
      6. Test memory hot-add error handling by injecting notifier errors
      7. Online all hot-pluggable memory in preparation for testing
      8. Test memory hot-remove error handling by injecting notifier errors
      Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
      Suggested-by: NAndrew Morton <akpm@linux-foundation.org>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
      Cc: Greg KH <greg@kroah.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Michael Ellerman <michael@ellerman.id.au>
      Cc: Dave Jones <davej@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d89dffa9
    • S
      ktest: Allow perl regex expressions in conditional statements · 8fddbe9b
      Steven Rostedt 提交于
      Add '=~' and '!~' to the list of allowed conditionals for DEFAULT and
      TEST_START section if statements.
      
      ie.
      
       TEST_START IF TEST =~ .*test$
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      8fddbe9b
    • S
      ktest: Ignore errors it tests if IGNORE_ERRORS is set · 9b1d367d
      Steven Rostedt 提交于
      The option IGNORE_ERRORS is used to allow a test to succeed even if a
      warning appears from the kernel. Sometimes kernels will produce warnings
      that are not associated with a test, and the user wants to test
      something else.
      
      The IGNORE_ERRORS works for boot up, but was not preventing test runs to
      succeed if the kernel produced a warning.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      9b1d367d
  12. 21 7月, 2012 1 次提交
  13. 20 7月, 2012 7 次提交
    • S
      ktest: Add check for bug or panic during reboot · 8a80c727
      Steven Rostedt 提交于
      Usually the target is booted into a dependable kernel when a test
      starts. The test will install the test kernel and reboot the box. But
      there may be a time that the kernel is running an unreliable kernel and
      the reboot may crash.
      
      Have ktest detect crashes on a reboot and force a power-cycle instead.
      
      This can usually happen if a test kernel was installed to run manual
      tests, but the user forgot to reboot to the known good kernel.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      8a80c727
    • S
      ktest: Add MAX_MONITOR_WAIT option · 407b95b7
      Steven Rostedt 提交于
      If the console is constantly outputting content, this can cause ktest
      to get stuck waiting on the monitor to settle down.
      
      The option MAX_MONITOR_WAIT is the maximum time (in seconds) for ktest
      to wait for the console to flush.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      407b95b7
    • S
      ktest: Fix config bisect with how make oldnoconfig works · cf79fab6
      Steven Rostedt 提交于
      With a name like 'oldnoconfig' one may think that the config generated
      would disable all configs that were not defined (selecting "no" for all
      options). But this is not the case. It selects the default. If a config
      has a 'default y', then it is added if not specified.
      
      This broke the config bisect, because options not specified by a config
      will just use the default, where it expected to turn off. This caused an
      option to be enabled that disabled an option that would break the build.
      The end result was that we never found the bad config at the end of the
      test.
      
      Instead of using 'make oldnoconfig', ktest now builds the options it
      expects enabled and disabled. When it turns off an option, it will no
      longer remove it, but actually set it to:
      
       # CONFIG_FOO is not set.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      cf79fab6
    • S
      ktest: Add CONFIG_BISECT_CHECK option · b0918612
      Steven Rostedt 提交于
      The config-bisect can take a bad config and bisect it down to find out
      what config actually breaks the config. But as all tests will apply a
      minconfig (defined by a user) to apply before booting, it is possible
      that the minconfig could actually make the bad config work (minconfigs
      can disable configs). The end result is that the config bisect test will
      not find a config that breaks. This can be rather frustrating to the
      user.
      
      The CONFIG_BISECT_CHECK option, when set to 1, will make sure that the
      bad config (with the minconfig applied) still fails before trying to
      bisect.
      
      And yes, I did get burned by this.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      b0918612
    • S
      ktest: Add PRE_INSTALL option · e5c2ec11
      Steven Rostedt 提交于
      Add the PRE_INSTALL option that will allow a user to specify a shell
      command to be executed before the install operation executes.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      e5c2ec11
    • S
      ktest: Add PRE/POST_KTEST and TEST options · 921ed4c7
      Steven Rostedt 提交于
      In order to let the user add commands before and after ktest runs, the
      PRE_KTEST and POST_KTEST options are defined. They hold shell commands
      that will execute befor ktest runs its first test, as well as when it
      completed its last test.
      
      The PRE_TEST and POST_TEST will be run befor and after (respectively)
      for a given test. They can either be global (done for all tests) or
      defined by a single test.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      921ed4c7
    • S
      ktest: Remove commented exit · 958d8435
      Steven Rostedt 提交于
      A debug 'exit' was left in ktest.pl. Remove it.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      958d8435
  14. 01 6月, 2012 3 次提交
    • C
      syscalls, x86: add __NR_kcmp syscall · d97b46a6
      Cyrill Gorcunov 提交于
      While doing the checkpoint-restore in the user space one need to determine
      whether various kernel objects (like mm_struct-s of file_struct-s) are
      shared between tasks and restore this state.
      
      The 2nd step can be solved by using appropriate CLONE_ flags and the
      unshare syscall, while there's currently no ways for solving the 1st one.
      
      One of the ways for checking whether two tasks share e.g.  mm_struct is to
      provide some mm_struct ID of a task to its proc file, but showing such
      info considered to be not that good for security reasons.
      
      Thus after some debates we end up in conclusion that using that named
      'comparison' syscall might be the best candidate.  So here is it --
      __NR_kcmp.
      
      It takes up to 5 arguments - the pids of the two tasks (which
      characteristics should be compared), the comparison type and (in case of
      comparison of files) two file descriptors.
      
      Lookups for pids are done in the caller's PID namespace only.
      
      At moment only x86 is supported and tested.
      
      [akpm@linux-foundation.org: fix up selftests, warnings]
      [akpm@linux-foundation.org: include errno.h]
      [akpm@linux-foundation.org: tweak comment text]
      Signed-off-by: NCyrill Gorcunov <gorcunov@openvz.org>
      Acked-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Pavel Emelyanov <xemul@parallels.com>
      Cc: Andrey Vagin <avagin@openvz.org>
      Cc: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Glauber Costa <glommer@parallels.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Matt Helsley <matthltc@us.ibm.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: Vasiliy Kulikov <segoon@openwall.com>
      Cc: Alexey Dobriyan <adobriyan@gmail.com>
      Cc: Valdis.Kletnieks@vt.edu
      Cc: Michal Marek <mmarek@suse.cz>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d97b46a6
    • D
      tools/selftests: add mq_perf_tests · 7820b071
      Doug Ledford 提交于
      Add the mq_perf_tests tool I used when creating my mq performance patch.
      Also add a local .gitignore to keep the binaries from showing up in git
      status output.
      
      [akpm@linux-foundation.org: checkpatch fixes]
      Signed-off-by: NDoug Ledford <dledford@redhat.com>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Cc: Manfred Spraul <manfred@colorfullife.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Acked-by: NKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      7820b071
    • D
      selftests: add mq_open_tests · 50069a58
      Doug Ledford 提交于
      Add a directory to house POSIX message queue subsystem specific tests.
      Add first test which checks the operation of mq_open() under various
      corner conditions.
      Signed-off-by: NDoug Ledford <dledford@redhat.com>
      Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Cc: Doug Ledford <dledford@redhat.com>
      Cc: Joe Korty <joe.korty@ccur.com>
      Cc: Amerigo Wang <amwang@redhat.com>
      Cc: Serge E. Hallyn <serue@us.ibm.com>
      Cc: Jiri Slaby <jslaby@suse.cz>
      Cc: Manfred Spraul <manfred@colorfullife.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      50069a58
  15. 23 5月, 2012 1 次提交
  16. 22 5月, 2012 7 次提交
  17. 19 5月, 2012 1 次提交
    • S
      ktest: Fix kernelrevision with POST_BUILD · 683a3e64
      Steven Rostedt 提交于
      The PRE_BUILD and POST_BUILD options of ktest are added to allow the
      user to add temporary patch to the system and remove it on builds. This
      is sometimes use to take a change from another git branch and add it to
      a series without the fix so that this series can be tested, when an
      unrelated bug exists in the series.
      
      The problem comes when a tagged commit is being used. For example, if
      v3.2 is being tested, and we add a patch to it, the kernelrelease for
      that commit will be 3.2.0+, but without the patch the version will be
      3.2.0. This can cause problems when the kernelrelease is determined for
      creating the /lib/modules directory. The kernel booting has the '+' but
      the module directory will not, and the modules will be missing for that
      boot, and may not allow the kernel to succeed.
      
      The fix is to put the creation of the kernelrelease in the POST_BUILD
      logic, before it applies the POST_BUILD operation. The POST_BUILD is
      where the patch may be removed, removing the '+' from the kernelrelease.
      
      The calculation of the kernelrelease will also stay in its current
      location but will be ignored if it was already calculated previously.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      683a3e64
  18. 01 5月, 2012 1 次提交
    • S
      ktest: Fix reboot on success stopping all reboots · 759a3cc6
      Steven Rostedt 提交于
      The change to let individual tests decide to reboot the machine on
      success of the entire test also prevented errors from rebooting
      when an error was detected.
      
      The "no_reboot" variable was only cleared if the test had
      reboot_on_success set. But the no_reboot variable also prevents the test
      rebooting when an error was detected even when REBOOT_ON_ERROR was set.
      
      Add a new "reboot_success" variable that is used to determine if the
      test should reboot on success and not touch the no_reboot variable.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      759a3cc6