1. 05 6月, 2020 3 次提交
    • J
      lib: make a test module with set/clear bit · c348c163
      Jesse Brandeburg 提交于
      Test some bit clears/sets to make sure assembly doesn't change, and that
      the set_bit and clear_bit functions work and don't cause sparse warnings.
      
      Instruct Kbuild to build this file with extra warning level -Wextra, to
      catch new issues, and also doesn't hurt to build with C=1.
      
      This was used to test changes to arch/x86/include/asm/bitops.h.
      
      In particular, sparse (C=1) was very concerned when the last bit before a
      natural boundary, like 7, or 31, was being tested, as this causes sign
      extension (0xffffff7f) for instance when clearing bit 7.
      
      Recommended usage:
      
        make defconfig
        scripts/config -m CONFIG_TEST_BITOPS
        make modules_prepare
        make C=1 W=1 lib/test_bitops.ko
        objdump -S -d lib/test_bitops.ko
        insmod lib/test_bitops.ko
        rmmod lib/test_bitops.ko
      
      <check dmesg>, there should be no compiler/sparse warnings and no
      error messages in log.
      
      Link: http://lkml.kernel.org/r/20200310221747.2848474-2-jesse.brandeburg@intel.comSigned-off-by: NJesse Brandeburg <jesse.brandeburg@intel.com>
      Reviewed-by: NAndy Shevchenko <andriy.shevchenko@intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      CcL Ingo Molnar <mingo@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Wei Yang <richard.weiyang@gmail.com>
      Cc: Christian Brauner <christian.brauner@ubuntu.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c348c163
    • A
      mm/debug: add tests validating architecture page table helpers · 399145f9
      Anshuman Khandual 提交于
      This adds tests which will validate architecture page table helpers and
      other accessors in their compliance with expected generic MM semantics.
      This will help various architectures in validating changes to existing
      page table helpers or addition of new ones.
      
      This test covers basic page table entry transformations including but not
      limited to old, young, dirty, clean, write, write protect etc at various
      level along with populating intermediate entries with next page table page
      and validating them.
      
      Test page table pages are allocated from system memory with required size
      and alignments.  The mapped pfns at page table levels are derived from a
      real pfn representing a valid kernel text symbol.  This test gets called
      via late_initcall().
      
      This test gets built and run when CONFIG_DEBUG_VM_PGTABLE is selected.
      Any architecture, which is willing to subscribe this test will need to
      select ARCH_HAS_DEBUG_VM_PGTABLE.  For now this is limited to arc, arm64,
      x86, s390 and powerpc platforms where the test is known to build and run
      successfully Going forward, other architectures too can subscribe the test
      after fixing any build or runtime problems with their page table helpers.
      
      Folks interested in making sure that a given platform's page table helpers
      conform to expected generic MM semantics should enable the above config
      which will just trigger this test during boot.  Any non conformity here
      will be reported as an warning which would need to be fixed.  This test
      will help catch any changes to the agreed upon semantics expected from
      generic MM and enable platforms to accommodate it thereafter.
      
      [anshuman.khandual@arm.com: v17]
        Link: http://lkml.kernel.org/r/1587436495-22033-3-git-send-email-anshuman.khandual@arm.com
      [anshuman.khandual@arm.com: v18]
        Link: http://lkml.kernel.org/r/1588564865-31160-3-git-send-email-anshuman.khandual@arm.comSuggested-by: NCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: NAnshuman Khandual <anshuman.khandual@arm.com>
      Signed-off-by: NChristophe Leroy <christophe.leroy@c-s.fr>
      Signed-off-by: NQian Cai <cai@lca.pw>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Tested-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>	[s390]
      Tested-by: Christophe Leroy <christophe.leroy@c-s.fr>	[ppc32]
      Reviewed-by: NIngo Molnar <mingo@kernel.org>
      Cc: Mike Rapoport <rppt@linux.ibm.com>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Christian Borntraeger <borntraeger@de.ibm.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: Kirill A. Shutemov <kirill@shutemov.name>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Link: http://lkml.kernel.org/r/1583919272-24178-1-git-send-email-anshuman.khandual@arm.comSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      399145f9
    • A
      kcov: collect coverage from interrupts · 5ff3b30a
      Andrey Konovalov 提交于
      This change extends kcov remote coverage support to allow collecting
      coverage from soft interrupts in addition to kernel background threads.
      
      To collect coverage from code that is executed in softirq context, a part
      of that code has to be annotated with kcov_remote_start/stop() in a
      similar way as how it is done for global kernel background threads.  Then
      the handle used for the annotations has to be passed to the
      KCOV_REMOTE_ENABLE ioctl.
      
      Internally this patch adjusts the __sanitizer_cov_trace_pc() compiler
      inserted callback to not bail out when called from softirq context.
      kcov_remote_start/stop() are updated to save/restore the current per task
      kcov state in a per-cpu area (in case the softirq came when the kernel was
      already collecting coverage in task context).  Coverage from softirqs is
      collected into pre-allocated per-cpu areas, whose size is controlled by
      the new CONFIG_KCOV_IRQ_AREA_SIZE.
      
      [andreyknvl@google.com: turn current->kcov_softirq into unsigned int to fix objtool warning]
        Link: http://lkml.kernel.org/r/841c778aa3849c5cb8c3761f56b87ce653a88671.1585233617.git.andreyknvl@google.comSigned-off-by: NAndrey Konovalov <andreyknvl@google.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: NDmitry Vyukov <dvyukov@google.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Andrey Konovalov <andreyknvl@gmail.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Marco Elver <elver@google.com>
      Link: http://lkml.kernel.org/r/469bd385c431d050bc38a593296eff4baae50666.1584655448.git.andreyknvl@google.comSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      5ff3b30a
  2. 29 5月, 2020 1 次提交
    • N
      Makefile: support compressed debug info · 10e68b02
      Nick Desaulniers 提交于
      As debug information gets larger and larger, it helps significantly save
      the size of vmlinux images to compress the information in the debug
      information sections. Note: this debug info is typically split off from
      the final compressed kernel image, which is why vmlinux is what's used
      in conjunction with GDB. Minimizing the debug info size should have no
      impact on boot times, or final compressed kernel image size.
      
      All of the debug sections will have a `C` flag set.
      $ readelf -S <object file>
      
      $ bloaty vmlinux.gcc75.compressed.dwarf4 -- \
          vmlinux.gcc75.uncompressed.dwarf4
      
          FILE SIZE        VM SIZE
       --------------  --------------
        +0.0%     +18  [ = ]       0    [Unmapped]
       -73.3%  -114Ki  [ = ]       0    .debug_aranges
       -76.2% -2.01Mi  [ = ]       0    .debug_frame
       -73.6% -2.89Mi  [ = ]       0    .debug_str
       -80.7% -4.66Mi  [ = ]       0    .debug_abbrev
       -82.9% -4.88Mi  [ = ]       0    .debug_ranges
       -70.5% -9.04Mi  [ = ]       0    .debug_line
       -79.3% -10.9Mi  [ = ]       0    .debug_loc
       -39.5% -88.6Mi  [ = ]       0    .debug_info
       -18.2%  -123Mi  [ = ]       0    TOTAL
      
      $ bloaty vmlinux.clang11.compressed.dwarf4 -- \
          vmlinux.clang11.uncompressed.dwarf4
      
          FILE SIZE        VM SIZE
       --------------  --------------
        +0.0%     +23  [ = ]       0    [Unmapped]
       -65.6%    -871  [ = ]       0    .debug_aranges
       -77.4% -1.84Mi  [ = ]       0    .debug_frame
       -82.9% -2.33Mi  [ = ]       0    .debug_abbrev
       -73.1% -2.43Mi  [ = ]       0    .debug_str
       -84.8% -3.07Mi  [ = ]       0    .debug_ranges
       -65.9% -8.62Mi  [ = ]       0    .debug_line
       -86.2% -40.0Mi  [ = ]       0    .debug_loc
       -42.0% -64.1Mi  [ = ]       0    .debug_info
       -22.1%  -122Mi  [ = ]       0    TOTAL
      
      For x86_64 defconfig + LLVM=1 (before):
      Elapsed (wall clock) time (h:mm:ss or m:ss): 3:22.03
      Maximum resident set size (kbytes): 43856
      
      For x86_64 defconfig + LLVM=1 (after):
      Elapsed (wall clock) time (h:mm:ss or m:ss): 3:32.52
      Maximum resident set size (kbytes): 1566776
      
      Thanks to:
      Nick Clifton helped us to provide the minimal binutils version.
      Sedat Dilek found an increase in size of debug .deb package.
      
      Cc: Nick Clifton <nickc@redhat.com>
      Suggested-by: NDavid Blaikie <blaikie@google.com>
      Reviewed-by: NFangrui Song <maskray@google.com>
      Tested-by: NSedat Dilek <sedat.dilek@gmail.com>
      Signed-off-by: NNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      10e68b02
  3. 20 5月, 2020 1 次提交
  4. 16 5月, 2020 1 次提交
  5. 09 5月, 2020 1 次提交
  6. 22 4月, 2020 1 次提交
  7. 08 4月, 2020 3 次提交
    • Q
    • K
      lib/test_lockup: test module to generate lockups · 30428ef5
      Konstantin Khlebnikov 提交于
      CONFIG_TEST_LOCKUP=m adds module "test_lockup" that helps to make sure
      that watchdogs and lockup detectors are working properly.
      
      Depending on module parameters test_lockup could emulate soft or hard
      lockup, "hung task", hold arbitrary lock, allocate bunch of pages.
      
      Also it could generate series of lockups with cooling-down periods, in
      this way it could be used as "ping" for locks or page allocator.  Loop
      checks signals between iteration thus could be stopped by ^C.
      
      # modinfo test_lockup
      ...
      parm:           time_secs:lockup time in seconds, default 0 (uint)
      parm:           time_nsecs:nanoseconds part of lockup time, default 0 (uint)
      parm:           cooldown_secs:cooldown time between iterations in seconds, default 0 (uint)
      parm:           cooldown_nsecs:nanoseconds part of cooldown, default 0 (uint)
      parm:           iterations:lockup iterations, default 1 (uint)
      parm:           all_cpus:trigger lockup at all cpus at once (bool)
      parm:           state:wait in 'R' running (default), 'D' uninterruptible, 'K' killable, 'S' interruptible state (charp)
      parm:           use_hrtimer:use high-resolution timer for sleeping (bool)
      parm:           iowait:account sleep time as iowait (bool)
      parm:           lock_read:lock read-write locks for read (bool)
      parm:           lock_single:acquire locks only at one cpu (bool)
      parm:           reacquire_locks:release and reacquire locks/irq/preempt between iterations (bool)
      parm:           touch_softlockup:touch soft-lockup watchdog between iterations (bool)
      parm:           touch_hardlockup:touch hard-lockup watchdog between iterations (bool)
      parm:           call_cond_resched:call cond_resched() between iterations (bool)
      parm:           measure_lock_wait:measure lock wait time (bool)
      parm:           lock_wait_threshold:print lock wait time longer than this in nanoseconds, default off (ulong)
      parm:           disable_irq:disable interrupts: generate hard-lockups (bool)
      parm:           disable_softirq:disable bottom-half irq handlers (bool)
      parm:           disable_preempt:disable preemption: generate soft-lockups (bool)
      parm:           lock_rcu:grab rcu_read_lock: generate rcu stalls (bool)
      parm:           lock_mmap_sem:lock mm->mmap_sem: block procfs interfaces (bool)
      parm:           lock_rwsem_ptr:lock rw_semaphore at address (ulong)
      parm:           lock_mutex_ptr:lock mutex at address (ulong)
      parm:           lock_spinlock_ptr:lock spinlock at address (ulong)
      parm:           lock_rwlock_ptr:lock rwlock at address (ulong)
      parm:           alloc_pages_nr:allocate and free pages under locks (uint)
      parm:           alloc_pages_order:page order to allocate (uint)
      parm:           alloc_pages_gfp:allocate pages with this gfp_mask, default GFP_KERNEL (uint)
      parm:           alloc_pages_atomic:allocate pages with GFP_ATOMIC (bool)
      parm:           reallocate_pages:free and allocate pages between iterations (bool)
      
      Parameters for locking by address are unsafe and taints kernel. With
      CONFIG_DEBUG_SPINLOCK=y they at least check magics for embedded spinlocks.
      
      Examples:
      
      task hang in D-state:
      modprobe test_lockup time_secs=1 iterations=60 state=D
      
      task hang in io-wait D-state:
      modprobe test_lockup time_secs=1 iterations=60 state=D iowait
      
      softlockup:
      modprobe test_lockup time_secs=1 iterations=60 state=R
      
      hardlockup:
      modprobe test_lockup time_secs=1 iterations=60 state=R disable_irq
      
      system-wide hardlockup:
      modprobe test_lockup time_secs=1 iterations=60 state=R \
       disable_irq all_cpus
      
      rcu stall:
      modprobe test_lockup time_secs=1 iterations=60 state=R \
       lock_rcu touch_softlockup
      
      lock mmap_sem / block procfs interfaces:
      modprobe test_lockup time_secs=1 iterations=60 state=S lock_mmap_sem
      
      lock tasklist_lock for read / block forks:
      TASKLIST_LOCK=$(awk '$3 == "tasklist_lock" {print "0x"$1}' /proc/kallsyms)
      modprobe test_lockup time_secs=1 iterations=60 state=R \
       disable_irq lock_read lock_rwlock_ptr=$TASKLIST_LOCK
      
      lock namespace_sem / block vfs mount operations:
      NAMESPACE_SEM=$(awk '$3 == "namespace_sem" {print "0x"$1}' /proc/kallsyms)
      modprobe test_lockup time_secs=1 iterations=60 state=S \
       lock_rwsem_ptr=$NAMESPACE_SEM
      
      lock cgroup mutex / block cgroup operations:
      CGROUP_MUTEX=$(awk '$3 == "cgroup_mutex" {print "0x"$1}' /proc/kallsyms)
      modprobe test_lockup time_secs=1 iterations=60 state=S \
       lock_mutex_ptr=$CGROUP_MUTEX
      
      ping cgroup_mutex every second and measure maximum lock wait time:
      modprobe test_lockup cooldown_secs=1 iterations=60 state=S \
       lock_mutex_ptr=$CGROUP_MUTEX reacquire_locks measure_lock_wait
      
      [linux@roeck-us.net: rename disable_irq to fix build error]
        Link: http://lkml.kernel.org/r/20200317133614.23152-1-linux@roeck-us.netSigned-off-by: NKonstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Cc: Sasha Levin <sashal@kernel.org>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Cc: Dmitry Monakhov <dmtrmonakhov@yandex-team.ru
      Cc: Colin Ian King <colin.king@canonical.com>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Link: http://lkml.kernel.org/r/158132859146.2797.525923171323227836.stgit@buzzSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      30428ef5
    • M
      compiler: remove CONFIG_OPTIMIZE_INLINING entirely · 889b3c12
      Masahiro Yamada 提交于
      Commit ac7c3e4f ("compiler: enable CONFIG_OPTIMIZE_INLINING
      forcibly") made this always-on option. We released v5.4 and v5.5
      including that commit.
      
      Remove the CONFIG option and clean up the code now.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: NMiguel Ojeda <miguel.ojeda.sandonis@gmail.com>
      Reviewed-by: NNathan Chancellor <natechancellor@gmail.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: David Miller <davem@davemloft.net>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/20200220110807.32534-2-masahiroy@kernel.orgSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      889b3c12
  8. 03 4月, 2020 1 次提交
  9. 21 3月, 2020 1 次提交
    • P
      lockdep: Introduce wait-type checks · de8f5e4f
      Peter Zijlstra 提交于
      Extend lockdep to validate lock wait-type context.
      
      The current wait-types are:
      
      	LD_WAIT_FREE,		/* wait free, rcu etc.. */
      	LD_WAIT_SPIN,		/* spin loops, raw_spinlock_t etc.. */
      	LD_WAIT_CONFIG,		/* CONFIG_PREEMPT_LOCK, spinlock_t etc.. */
      	LD_WAIT_SLEEP,		/* sleeping locks, mutex_t etc.. */
      
      Where lockdep validates that the current lock (the one being acquired)
      fits in the current wait-context (as generated by the held stack).
      
      This ensures that there is no attempt to acquire mutexes while holding
      spinlocks, to acquire spinlocks while holding raw_spinlocks and so on. In
      other words, its a more fancy might_sleep().
      
      Obviously RCU made the entire ordeal more complex than a simple single
      value test because RCU can be acquired in (pretty much) any context and
      while it presents a context to nested locks it is not the same as it
      got acquired in.
      
      Therefore its necessary to split the wait_type into two values, one
      representing the acquire (outer) and one representing the nested context
      (inner). For most 'normal' locks these two are the same.
      
      [ To make static initialization easier we have the rule that:
        .outer == INV means .outer == .inner; because INV == 0. ]
      
      It further means that its required to find the minimal .inner of the held
      stack to compare against the outer of the new lock; because while 'normal'
      RCU presents a CONFIG type to nested locks, if it is taken while already
      holding a SPIN type it obviously doesn't relax the rules.
      
      Below is an example output generated by the trivial test code:
      
        raw_spin_lock(&foo);
        spin_lock(&bar);
        spin_unlock(&bar);
        raw_spin_unlock(&foo);
      
       [ BUG: Invalid wait context ]
       -----------------------------
       swapper/0/1 is trying to lock:
       ffffc90000013f20 (&bar){....}-{3:3}, at: kernel_init+0xdb/0x187
       other info that might help us debug this:
       1 lock held by swapper/0/1:
        #0: ffffc90000013ee0 (&foo){+.+.}-{2:2}, at: kernel_init+0xd1/0x187
      
      The way to read it is to look at the new -{n,m} part in the lock
      description; -{3:3} for the attempted lock, and try and match that up to
      the held locks, which in this case is the one: -{2,2}.
      
      This tells that the acquiring lock requires a more relaxed environment than
      presented by the lock stack.
      
      Currently only the normal locks and RCU are converted, the rest of the
      lockdep users defaults to .inner = INV which is ignored. More conversions
      can be done when desired.
      
      The check for spinlock_t nesting is not enabled by default. It's a separate
      config option for now as there are known problems which are currently
      addressed. The config option allows to identify these problems and to
      verify that the solutions found are indeed solving them.
      
      The config switch will be removed and the checks will permanently enabled
      once the vast majority of issues has been addressed.
      
      [ bigeasy: Move LD_WAIT_FREE,… out of CONFIG_LOCKDEP to avoid compile
      	   failure with CONFIG_DEBUG_SPINLOCK + !CONFIG_LOCKDEP]
      [ tglx: Add the config option ]
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lkml.kernel.org/r/20200321113242.427089655@linutronix.de
      de8f5e4f
  10. 12 3月, 2020 1 次提交
  11. 07 3月, 2020 1 次提交
    • D
      serial/sysrq: Add MAGIC_SYSRQ_SERIAL_SEQUENCE · 68af4317
      Dmitry Safonov 提交于
      Many embedded boards have a disconnected TTL level serial which can
      generate some garbage that can lead to spurious false sysrq detects.
      
      Currently, sysrq can be either completely disabled for serial console
      or always disabled (with CONFIG_MAGIC_SYSRQ_SERIAL), since
      commit 732dbf3a ("serial: do not accept sysrq characters via serial port")
      
      At Arista, we have such boards that can generate BREAK and random
      garbage. While disabling sysrq for serial console would solve
      the problem with spurious false sysrq triggers, it's also desirable
      to have a way to enable sysrq back.
      
      As a measure of balance between on and off options, add
      MAGIC_SYSRQ_SERIAL_SEQUENCE which is a string sequence that can enable
      sysrq if it follows BREAK on a serial line. The longer the string - the
      less likely it may be in the garbage.
      
      Having the way to enable sysrq was beneficial to debug lockups with
      a manual investigation in field and on the other side preventing false
      sysrq detections.
      Based-on-patch-by: NVasiliy Khoruzhick <vasilykh@arista.com>
      Signed-off-by: NDmitry Safonov <dima@arista.com>
      Link: https://lore.kernel.org/r/20200302175135.269397-3-dima@arista.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      68af4317
  12. 06 3月, 2020 1 次提交
  13. 02 3月, 2020 1 次提交
  14. 13 2月, 2020 1 次提交
  15. 10 1月, 2020 1 次提交
    • A
      kunit: allow kunit tests to be loaded as a module · c475c77d
      Alan Maguire 提交于
      As tests are added to kunit, it will become less feasible to execute
      all built tests together.  By supporting modular tests we provide
      a simple way to do selective execution on a running system; specifying
      
      CONFIG_KUNIT=y
      CONFIG_KUNIT_EXAMPLE_TEST=m
      
      ...means we can simply "insmod example-test.ko" to run the tests.
      
      To achieve this we need to do the following:
      
      o export the required symbols in kunit
      o string-stream tests utilize non-exported symbols so for now we skip
        building them when CONFIG_KUNIT_TEST=m.
      o drivers/base/power/qos-test.c contains a few unexported interface
        references, namely freq_qos_read_value() and freq_constraints_init().
        Both of these could be potentially defined as static inline functions
        in include/linux/pm_qos.h, but for now we simply avoid supporting
        module build for that test suite.
      o support a new way of declaring test suites.  Because a module cannot
        do multiple late_initcall()s, we provide a kunit_test_suites() macro
        to declare multiple suites within the same module at once.
      o some test module names would have been too general ("test-test"
        and "example-test" for kunit tests, "inode-test" for ext4 tests);
        rename these as appropriate ("kunit-test", "kunit-example-test"
        and "ext4-inode-test" respectively).
      
      Also define kunit_test_suite() via kunit_test_suites()
      as callers in other trees may need the old definition.
      Co-developed-by: NKnut Omang <knut.omang@oracle.com>
      Signed-off-by: NKnut Omang <knut.omang@oracle.com>
      Signed-off-by: NAlan Maguire <alan.maguire@oracle.com>
      Reviewed-by: NBrendan Higgins <brendanhiggins@google.com>
      Acked-by: Theodore Ts'o <tytso@mit.edu> # for ext4 bits
      Acked-by: David Gow <davidgow@google.com> # For list-test
      Reported-by: Nkbuild test robot <lkp@intel.com>
      Signed-off-by: NShuah Khan <skhan@linuxfoundation.org>
      c475c77d
  16. 18 12月, 2019 1 次提交
  17. 08 12月, 2019 11 次提交
  18. 22 11月, 2019 1 次提交
  19. 14 11月, 2019 1 次提交
    • M
      kbuild: move headers_check rule to usr/include/Makefile · 7ecaf069
      Masahiro Yamada 提交于
      Currently, some sanity checks for uapi headers are done by
      scripts/headers_check.pl, which is wired up to the 'headers_check'
      target in the top Makefile.
      
      It is true compiling headers has better test coverage, but there
      are still several headers excluded from the compile test. I like
      to keep headers_check.pl for a while, but we can delete a lot of
      code by moving the build rule to usr/include/Makefile.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      7ecaf069
  20. 02 11月, 2019 1 次提交
    • D
      lib/list-test: add a test for the 'list' doubly linked list · ea2dd7c0
      David Gow 提交于
      Add a KUnit test for the kernel doubly linked list implementation in
      include/linux/list.h
      
      Each test case (list_test_x) is focused on testing the behaviour of the
      list function/macro 'x'. None of the tests pass invalid lists to these
      macros, and so should behave identically with DEBUG_LIST enabled and
      disabled.
      
      Note that, at present, it only tests the list_ types (not the
      singly-linked hlist_), and does not yet test all of the
      list_for_each_entry* macros (and some related things like
      list_prepare_entry).
      
      Ignoring checkpatch.pl spurious errors related to its handling of for_each
      and other list macros. checkpatch.pl expects anything with for_each in its
      name to be a loop and expects that the open brace is placed on the same
      line as for a for loop. In this case, test case naming scheme includes
      name of the macro it is testing, which results in the spurious errors.
      Commit message updated by Shuah Khan <skhan@linuxfoundation.org>
      Signed-off-by: NDavid Gow <davidgow@google.com>
      Reviewed-by: NBrendan Higgins <brendanhiggins@google.com>
      Tested-by: NBrendan Higgins <brendanhiggins@google.com>
      Signed-off-by: NShuah Khan <skhan@linuxfoundation.org>
      ea2dd7c0
  21. 17 10月, 2019 1 次提交
    • R
      printf: add support for printing symbolic error names · 57f5677e
      Rasmus Villemoes 提交于
      It has been suggested several times to extend vsnprintf() to be able
      to convert the numeric value of ENOSPC to print "ENOSPC". This
      implements that as a %p extension: With %pe, one can do
      
        if (IS_ERR(foo)) {
          pr_err("Sorry, can't do that: %pe\n", foo);
          return PTR_ERR(foo);
        }
      
      instead of what is seen in quite a few places in the kernel:
      
        if (IS_ERR(foo)) {
          pr_err("Sorry, can't do that: %ld\n", PTR_ERR(foo));
          return PTR_ERR(foo);
        }
      
      If the value passed to %pe is an ERR_PTR, but the library function
      errname() added here doesn't know about the value, the value is simply
      printed in decimal. If the value passed to %pe is not an ERR_PTR, we
      treat it as an ordinary %p and thus print the hashed value (passing
      non-ERR_PTR values to %pe indicates a bug in the caller, but we can't
      do much about that).
      
      With my embedded hat on, and because it's not very invasive to do,
      I've made it possible to remove this. The errname() function and
      associated lookup tables take up about 3K. For most, that's probably
      quite acceptable and a price worth paying for more readable
      dmesg (once this starts getting used), while for those that disable
      printk() it's of very little use - I don't see a
      procfs/sysfs/seq_printf() file reasonably making use of this - and
      they clearly want to squeeze vmlinux as much as possible. Hence the
      default y if PRINTK.
      
      The symbols to include have been found by massaging the output of
      
        find arch include -iname 'errno*.h' | xargs grep -E 'define\s*E'
      
      In the cases where some common aliasing exists
      (e.g. EAGAIN=EWOULDBLOCK on all platforms, EDEADLOCK=EDEADLK on most),
      I've moved the more popular one (in terms of 'git grep -w Efoo | wc)
      to the bottom so that one takes precedence.
      
      Link: http://lkml.kernel.org/r/20191015190706.15989-1-linux@rasmusvillemoes.dk
      To: "Jonathan Corbet" <corbet@lwn.net>
      To: linux-kernel@vger.kernel.org
      Cc: "Andy Shevchenko" <andy.shevchenko@gmail.com>
      Cc: "Andrew Morton" <akpm@linux-foundation.org>
      Cc: "Joe Perches" <joe@perches.com>
      Cc: linux-doc@vger.kernel.org
      Signed-off-by: NRasmus Villemoes <linux@rasmusvillemoes.dk>
      Acked-by: NUwe Kleine-König <uwe@kleine-koenig.org>
      Reviewed-by: NPetr Mladek <pmladek@suse.com>
      [andy.shevchenko@gmail.com: use abs()]
      Acked-by: NAndy Shevchenko <andy.shevchenko@gmail.com>
      Signed-off-by: NPetr Mladek <pmladek@suse.com>
      57f5677e
  22. 01 10月, 2019 2 次提交
  23. 26 9月, 2019 1 次提交
  24. 25 9月, 2019 2 次提交