1. 13 8月, 2020 4 次提交
  2. 29 7月, 2020 1 次提交
  3. 27 7月, 2020 1 次提交
    • P
      locking/lockdep: Fix TRACE_IRQFLAGS vs. NMIs · ed004953
      peterz@infradead.org 提交于
      Prior to commit:
      
        859d069e ("lockdep: Prepare for NMI IRQ state tracking")
      
      IRQ state tracking was disabled in NMIs due to nmi_enter()
      doing lockdep_off() -- with the obvious requirement that NMI entry
      call nmi_enter() before trace_hardirqs_off().
      
      [ AFAICT, PowerPC and SH violate this order on their NMI entry ]
      
      However, that commit explicitly changed lockdep_hardirqs_*() to ignore
      lockdep_off() and breaks every architecture that has irq-tracing in
      it's NMI entry that hasn't been fixed up (x86 being the only fixed one
      at this point).
      
      The reason for this change is that by ignoring lockdep_off() we can:
      
        - get rid of 'current->lockdep_recursion' in lockdep_assert_irqs*()
          which was going to to give header-recursion issues with the
          seqlock rework.
      
        - allow these lockdep_assert_*() macros to function in NMI context.
      
      Restore the previous state of things and allow an architecture to
      opt-in to the NMI IRQ tracking support, however instead of relying on
      lockdep_off(), rely on in_nmi(), both are part of nmi_enter() and so
      over-all entry ordering doesn't need to change.
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      Link: https://lore.kernel.org/r/20200727124852.GK119549@hirez.programming.kicks-ass.net
      ed004953
  4. 23 7月, 2020 1 次提交
    • P
      debugfs: Add access restriction option · a24c6f7b
      Peter Enderborg 提交于
      Since debugfs include sensitive information it need to be treated
      carefully. But it also has many very useful debug functions for userspace.
      With this option we can have same configuration for system with
      need of debugfs and a way to turn it off. This gives a extra protection
      for exposure on systems where user-space services with system
      access are attacked.
      
      It is controlled by a configurable default value that can be override
      with a kernel command line parameter. (debugfs=)
      
      It can be on or off, but also internally on but not seen from user-space.
      This no-mount mode do not register a debugfs as filesystem, but client can
      register their parts in the internal structures. This data can be readed
      with a debugger or saved with a crashkernel. When it is off clients
      get EPERM error when accessing the functions for registering their
      components.
      Signed-off-by: NPeter Enderborg <peter.enderborg@sony.com>
      Link: https://lore.kernel.org/r/20200716071511.26864-3-peter.enderborg@sony.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a24c6f7b
  5. 03 7月, 2020 1 次提交
  6. 29 6月, 2020 1 次提交
    • P
      selftests/fpu: Add an FPU selftest · 4185b3b9
      Petteri Aimonen 提交于
      Add a selftest for the usage of FPU code in kernel mode.
      
      Currently only implemented for x86. In the future, kernel FPU testing
      could be unified between the different architectures supporting it.
      
       [ bp:
      
        - Split out from a conglomerate patch, put comments over statements.
        - run the test only on debugfs write.
        - Add bare-minimum run_test_fpu.sh, run 1000 iterations on all CPUs
          by default.
        - Add conditionally -msse2 so that clang doesn't generate library
          calls.
        - Use cc-option to detect gcc 7.1 not supporting -mpreferred-stack-boundary=3 (amluto).
        - Document stuff so that we don't forget.
        - Fix:
           ld: lib/test_fpu.o: in function `test_fpu_get':
           >> test_fpu.c:(.text+0x16e): undefined reference to `__sanitizer_cov_trace_cmpd'
           >> ld: test_fpu.c:(.text+0x1a7): undefined reference to `__sanitizer_cov_trace_cmpd'
           ld: test_fpu.c:(.text+0x1e0): undefined reference to `__sanitizer_cov_trace_cmpd'
        ]
      Reported-by: Nkernel test robot <lkp@intel.com>
      Signed-off-by: NPetteri Aimonen <jpa@git.mail.kapsi.fi>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Reviewed-by: NNick Desaulniers <ndesaulniers@google.com>
      Link: https://lkml.kernel.org/r/20200624114646.28953-3-bp@alien8.de
      4185b3b9
  7. 17 6月, 2020 1 次提交
    • M
      kconfig: unify cc-option and as-option · 4d0831e8
      Masahiro Yamada 提交于
      cc-option and as-option are almost the same; both pass the flag to
      $(CC). The main difference is the cc-option stops before the assemble
      stage (-S option) whereas as-option stops after (-c option).
      
      I chose -S because it is slightly faster, but $(cc-option,-gz=zlib)
      returns a wrong result (https://lkml.org/lkml/2020/6/9/1529).
      It has been fixed by commit 7b169944 ("Makefile: Improve compressed
      debug info support detection"), but the assembler should always be
      invoked for more reliable compiler option tests.
      
      However, you cannot simply replace -S with -c because the following
      code in lib/Kconfig.debug would break:
      
          depends on $(cc-option,-gsplit-dwarf)
      
      The combination of -c and -gsplit-dwarf does not accept /dev/null as
      output.
      
        $ cat /dev/null | gcc -gsplit-dwarf -S -x c - -o /dev/null
        $ echo $?
        0
      
        $ cat /dev/null | gcc -gsplit-dwarf -c -x c - -o /dev/null
        objcopy: Warning: '/dev/null' is not an ordinary file
        $ echo $?
        1
      
        $ cat /dev/null | gcc -gsplit-dwarf -c -x c - -o tmp.o
        $ echo $?
        0
      
      There is another flag that creates an separate file based on the
      object file path:
      
        $ cat /dev/null | gcc -ftest-coverage -c -x c - -o /dev/null
        <stdin>:1: error: cannot open /dev/null.gcno
      
      So, we cannot use /dev/null to sink the output.
      
      Align the cc-option implementation with scripts/Kbuild.include.
      
      With -c option used in cc-option, as-option is unneeded.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      Acked-by: NWill Deacon <will@kernel.org>
      4d0831e8
  8. 15 6月, 2020 1 次提交
    • A
      Makefile: Improve compressed debug info support detection · 7b169944
      Arvind Sankar 提交于
      Commit
        10e68b02 ("Makefile: support compressed debug info")
      added support for compressed debug sections.
      
      Support is detected by checking
      - does the compiler support -gz=zlib
      - does the assembler support --compressed-debug-sections=zlib
      - does the linker support --compressed-debug-sections=zlib
      
      However, the gcc driver's support for this option is somewhat
      convoluted. The driver's builtin specs are set based on the version of
      binutils that it was configured with. It reports an error if the
      configure-time linker/assembler (i.e., not necessarily the actual
      assembler that will be run) do not support the option, but only if the
      assembler (or linker) is actually invoked when -gz=zlib is passed.
      
      The cc-option check in scripts/Kconfig.include does not invoke the
      assembler, so the gcc driver reports success even if it does not support
      the option being passed to the assembler.
      
      Because the as-option check passes the option directly to the assembler
      via -Wa,--compressed-debug-sections=zlib, the gcc driver does not see
      this option and will never report an error.
      
      Combined with an installed version of binutils that is more recent than
      the one the compiler was built with, it is possible for all three tests
      to succeed, yet an actual compilation with -gz=zlib to fail.
      
      Moreover, it is unnecessary to explicitly pass
      --compressed-debug-sections=zlib to the assembler via -Wa, since the
      driver will do that automatically when it supports -gz=zlib.
      
      Convert the as-option to just -gz=zlib, simplifying it as well as
      performing a better test of the gcc driver's capabilities.
      Reported-by: Nkernel test robot <lkp@intel.com>
      Signed-off-by: NArvind Sankar <nivedita@alum.mit.edu>
      Reviewed-by: NNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      7b169944
  9. 14 6月, 2020 1 次提交
    • M
      treewide: replace '---help---' in Kconfig files with 'help' · a7f7f624
      Masahiro Yamada 提交于
      Since commit 84af7a61 ("checkpatch: kconfig: prefer 'help' over
      '---help---'"), the number of '---help---' has been gradually
      decreasing, but there are still more than 2400 instances.
      
      This commit finishes the conversion. While I touched the lines,
      I also fixed the indentation.
      
      There are a variety of indentation styles found.
      
        a) 4 spaces + '---help---'
        b) 7 spaces + '---help---'
        c) 8 spaces + '---help---'
        d) 1 space + 1 tab + '---help---'
        e) 1 tab + '---help---'    (correct indentation)
        f) 1 tab + 1 space + '---help---'
        g) 1 tab + 2 spaces + '---help---'
      
      In order to convert all of them to 1 tab + 'help', I ran the
      following commend:
      
        $ find . -name 'Kconfig*' | xargs sed -i 's/^[[:space:]]*---help---/\thelp/'
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      a7f7f624
  10. 11 6月, 2020 1 次提交
  11. 09 6月, 2020 1 次提交
  12. 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
  13. 02 6月, 2020 1 次提交
  14. 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
  15. 20 5月, 2020 1 次提交
  16. 16 5月, 2020 1 次提交
  17. 09 5月, 2020 1 次提交
  18. 22 4月, 2020 1 次提交
  19. 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
  20. 03 4月, 2020 1 次提交
  21. 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
  22. 12 3月, 2020 1 次提交
  23. 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
  24. 06 3月, 2020 1 次提交
  25. 02 3月, 2020 1 次提交
  26. 13 2月, 2020 1 次提交
  27. 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
  28. 18 12月, 2019 1 次提交
  29. 08 12月, 2019 5 次提交