1. 14 9月, 2021 1 次提交
  2. 09 9月, 2021 3 次提交
  3. 03 9月, 2021 1 次提交
    • N
      Makefile: remove stale cc-option checks · 7d73c3e9
      Nick Desaulniers 提交于
      cc-option, cc-option-yn, and cc-disable-warning all invoke the compiler
      during build time, and can slow down the build when these checks become
      stale for our supported compilers, whose minimally supported versions
      increases over time. See Documentation/process/changes.rst for the
      current supported minimal versions (GCC 4.9+, clang 10.0.1+). Compiler
      version support for these flags may be verified on godbolt.org.
      
      The following flags are GCC only and supported since at least GCC 4.9.
      Remove cc-option and cc-disable-warning tests.
      * -fno-tree-loop-im
      * -Wno-maybe-uninitialized
      * -fno-reorder-blocks
      * -fno-ipa-cp-clone
      * -fno-partial-inlining
      * -femit-struct-debug-baseonly
      * -fno-inline-functions-called-once
      * -fconserve-stack
      
      The following flags are supported by all supported versions of GCC and
      Clang. Remove their cc-option, cc-option-yn, and cc-disable-warning tests.
      * -fno-delete-null-pointer-checks
      * -fno-var-tracking
      * -Wno-array-bounds
      
      The following configs are made dependent on GCC, since they use GCC
      specific flags.
      * READABLE_ASM
      * DEBUG_SECTION_MISMATCH
      
      -mfentry was not supported by s390-linux-gnu-gcc until gcc-9+, add a
      comment.
      
      --param=allow-store-data-races=0 was renamed to -fno-allow-store-data-races
      in the GCC 10 release; add a comment.
      
      -Wmaybe-uninitialized (GCC specific) was being added for CONFIG_GCOV,
      then again unconditionally; add it only once.
      
      Also, base RETPOLINE_CFLAGS and RETPOLINE_VDSO_CFLAGS on CONFIC_CC_IS_*
      then remove cc-option tests for Clang.
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/1436Acked-by: NMiguel Ojeda <ojeda@kernel.org>
      Reviewed-by: NNathan Chancellor <nathan@kernel.org>
      Signed-off-by: NNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      7d73c3e9
  4. 30 8月, 2021 1 次提交
  5. 24 8月, 2021 1 次提交
  6. 21 8月, 2021 1 次提交
  7. 18 8月, 2021 1 次提交
  8. 31 7月, 2021 1 次提交
  9. 11 7月, 2021 1 次提交
  10. 09 7月, 2021 2 次提交
    • S
      dump_stack: add vmlinux build ID to stack traces · 22f4e66d
      Stephen Boyd 提交于
      Add the running kernel's build ID[1] to the stacktrace information header.
      This makes it simpler for developers to locate the vmlinux with full
      debuginfo for a particular kernel stacktrace.  Combined with
      scripts/decode_stracktrace.sh, a developer can download the correct
      vmlinux from a debuginfod[2] server and find the exact file and line
      number for the functions plus offsets in a stacktrace.
      
      This is especially useful for pstore crash debugging where the kernel
      crashes are recorded in the pstore logs and the recovery kernel is
      different or the debuginfo doesn't exist on the device due to space
      concerns (the data can be large and a security concern).  The stacktrace
      can be analyzed after the crash by using the build ID to find the matching
      vmlinux and understand where in the function something went wrong.
      
      Example stacktrace from lkdtm:
      
       WARNING: CPU: 4 PID: 3255 at drivers/misc/lkdtm/bugs.c:83 lkdtm_WARNING+0x28/0x30 [lkdtm]
       Modules linked in: lkdtm rfcomm algif_hash algif_skcipher af_alg xt_cgroup uinput xt_MASQUERADE
       CPU: 4 PID: 3255 Comm: bash Not tainted 5.11 #3 aa23f7a1231c229de205662d5a9e0d4c580f19a1
       Hardware name: Google Lazor (rev3+) with KB Backlight (DT)
       pstate: 00400009 (nzcv daif +PAN -UAO -TCO BTYPE=--)
       pc : lkdtm_WARNING+0x28/0x30 [lkdtm]
      
      The hex string aa23f7a1231c229de205662d5a9e0d4c580f19a1 is the build ID,
      following the kernel version number. Put it all behind a config option,
      STACKTRACE_BUILD_ID, so that kernel developers can remove this
      information if they decide it is too much.
      
      Link: https://lkml.kernel.org/r/20210511003845.2429846-5-swboyd@chromium.org
      Link: https://fedoraproject.org/wiki/Releases/FeatureBuildId [1]
      Link: https://sourceware.org/elfutils/Debuginfod.html [2]
      Signed-off-by: NStephen Boyd <swboyd@chromium.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Jessica Yu <jeyu@kernel.org>
      Cc: Evan Green <evgreen@chromium.org>
      Cc: Hsin-Yi Wang <hsinyi@chromium.org>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Baoquan He <bhe@redhat.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Dave Young <dyoung@redhat.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
      Cc: Sasha Levin <sashal@kernel.org>
      Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vivek Goyal <vgoyal@redhat.com>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      22f4e66d
    • Z
      lib: fix spelling mistakes · 9dbbc3b9
      Zhen Lei 提交于
      Fix some spelling mistakes in comments:
      permanentely ==> permanently
      wont ==> won't
      remaning ==> remaining
      succed ==> succeed
      shouldnt ==> shouldn't
      alpha-numeric ==> alphanumeric
      storeing ==> storing
      funtion ==> function
      documenation ==> documentation
      Determin ==> Determine
      intepreted ==> interpreted
      ammount ==> amount
      obious ==> obvious
      interupts ==> interrupts
      occured ==> occurred
      asssociated ==> associated
      taking into acount ==> taking into account
      squence ==> sequence
      stil ==> still
      contiguos ==> contiguous
      matchs ==> matches
      
      Link: https://lkml.kernel.org/r/20210607072555.12416-1-thunder.leizhen@huawei.comSigned-off-by: NZhen Lei <thunder.leizhen@huawei.com>
      Reviewed-by: NJacob Keller <jacob.e.keller@intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      9dbbc3b9
  11. 02 7月, 2021 1 次提交
  12. 30 6月, 2021 2 次提交
  13. 26 6月, 2021 1 次提交
    • D
      lib/test: convert lib/test_list_sort.c to use KUnit · ebd09577
      Daniel Latypov 提交于
      Functionally, this just means that the test output will be slightly
      changed and it'll now depend on CONFIG_KUNIT=y/m.
      
      It'll still run at boot time and can still be built as a loadable
      module.
      
      There was a pre-existing patch to convert this test that I found later,
      here [1]. Compared to [1], this patch doesn't rename files and uses
      KUnit features more heavily (i.e. does more than converting pr_err()
      calls to KUNIT_FAIL()).
      
      What this conversion gives us:
      * a shorter test thanks to KUnit's macros
      * a way to run this a bit more easily via kunit.py (and
      CONFIG_KUNIT_ALL_TESTS=y) [2]
      * a structured way of reporting pass/fail
      * uses kunit-managed allocations to avoid the risk of memory leaks
      * more descriptive error messages:
        * i.e. it prints out which fields are invalid, what the expected
        values are, etc.
      
      What this conversion does not do:
      * change the name of the file (and thus the name of the module)
      * change the name of the config option
      
      Leaving these as-is for now to minimize the impact to people wanting to
      run this test. IMO, that concern trumps following KUnit's style guide
      for both names, at least for now.
      
      [1] https://lore.kernel.org/linux-kselftest/20201015014616.309000-1-vitor@massaru.org/
      [2] Can be run via
      $ ./tools/testing/kunit/kunit.py run --kunitconfig /dev/stdin <<EOF
      CONFIG_KUNIT=y
      CONFIG_TEST_LIST_SORT=y
      EOF
      
      [16:55:56] Configuring KUnit Kernel ...
      [16:55:56] Building KUnit Kernel ...
      [16:56:29] Starting KUnit Kernel ...
      [16:56:32] ============================================================
      [16:56:32] ======== [PASSED] list_sort ========
      [16:56:32] [PASSED] list_sort_test
      [16:56:32] ============================================================
      [16:56:32] Testing complete. 1 tests run. 0 failed. 0 crashed.
      [16:56:32] Elapsed time: 35.668s total, 0.001s configuring, 32.725s building, 0.000s running
      
      Note: the build time is as after a `make mrproper`.
      Signed-off-by: NDaniel Latypov <dlatypov@google.com>
      Tested-by: NDavid Gow <davidgow@google.com>
      Acked-by: NBrendan Higgins <brendanhiggins@google.com>
      Signed-off-by: NShuah Khan <skhan@linuxfoundation.org>
      ebd09577
  14. 22 6月, 2021 1 次提交
    • P
      clocksource: Provide kernel module to test clocksource watchdog · 1253b9b8
      Paul E. McKenney 提交于
      When the clocksource watchdog marks a clock as unstable, this might
      be due to that clock being unstable or it might be due to delays that
      happen to occur between the reads of the two clocks.  It would be good
      to have a way of testing the clocksource watchdog's ability to
      distinguish between these two causes of clock skew and instability.
      
      Therefore, provide a new clocksource-wdtest module selected by a new
      TEST_CLOCKSOURCE_WATCHDOG Kconfig option.  This module has a single module
      parameter named "holdoff" that provides the number of seconds of delay
      before testing should start, which defaults to zero when built as a module
      and to 10 seconds when built directly into the kernel.  Very large systems
      that boot slowly may need to increase the value of this module parameter.
      
      This module uses hand-crafted clocksource structures to do its testing,
      thus avoiding messing up timing for the rest of the kernel and for user
      applications.  This module first verifies that the ->uncertainty_margin
      field of the clocksource structures are set sanely.  It then tests the
      delay-detection capability of the clocksource watchdog, increasing the
      number of consecutive delays injected, first provoking console messages
      complaining about the delays and finally forcing a clock-skew event.
      Unexpected test results cause at least one WARN_ON_ONCE() console splat.
      If there are no splats, the test has passed.  Finally, it fuzzes the
      value returned from a clocksource to test the clocksource watchdog's
      ability to detect time skew.
      
      This module checks the state of its clocksource after each test, and
      uses WARN_ON_ONCE() to emit a console splat if there are any failures.
      This should enable all types of test frameworks to detect any such
      failures.
      
      This facility is intended for diagnostic use only, and should be avoided
      on production systems.
      Reported-by: NChris Mason <clm@fb.com>
      Suggested-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NPaul E. McKenney <paulmck@kernel.org>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Tested-by: NFeng Tang <feng.tang@intel.com>
      Link: https://lore.kernel.org/r/20210527190124.440372-5-paulmck@kernel.org
      1253b9b8
  15. 31 5月, 2021 1 次提交
    • R
      locking/lockdep: Reduce LOCKDEP dependency list · b8e00abe
      Randy Dunlap 提交于
      Some arches (um, sparc64, riscv, xtensa) cause a Kconfig warning for
      LOCKDEP.
      These arch-es select LOCKDEP_SUPPORT but they are not listed as one
      of the arch-es that LOCKDEP depends on.
      
      Since (16) arch-es define the Kconfig symbol LOCKDEP_SUPPORT if they
      intend to have LOCKDEP support, replace the awkward list of
      arch-es that LOCKDEP depends on with the LOCKDEP_SUPPORT symbol.
      
      But wait. LOCKDEP_SUPPORT is included in LOCK_DEBUGGING_SUPPORT,
      which is already a dependency here, so LOCKDEP_SUPPORT is redundant
      and not needed.
      That leaves the FRAME_POINTER dependency, but it is part of an
      expression like this:
      	depends on (A && B) && (FRAME_POINTER || B')
      where B' is a dependency of B so if B is true then B' is true
      and the value of FRAME_POINTER does not matter.
      Thus we can also delete the FRAME_POINTER dependency.
      
      Fixes this kconfig warning: (for um, sparc64, riscv, xtensa)
      
      WARNING: unmet direct dependencies detected for LOCKDEP
        Depends on [n]: DEBUG_KERNEL [=y] && LOCK_DEBUGGING_SUPPORT [=y] && (FRAME_POINTER [=n] || MIPS || PPC || S390 || MICROBLAZE || ARM || ARC || X86)
        Selected by [y]:
        - PROVE_LOCKING [=y] && DEBUG_KERNEL [=y] && LOCK_DEBUGGING_SUPPORT [=y]
        - LOCK_STAT [=y] && DEBUG_KERNEL [=y] && LOCK_DEBUGGING_SUPPORT [=y]
        - DEBUG_LOCK_ALLOC [=y] && DEBUG_KERNEL [=y] && LOCK_DEBUGGING_SUPPORT [=y]
      
      Fixes: 7d37cb2c ("lib: fix kconfig dependency on ARCH_WANT_FRAME_POINTERS")
      Signed-off-by: NRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: NWaiman Long <longman@redhat.com>
      Link: https://lkml.kernel.org/r/20210524224150.8009-1-rdunlap@infradead.org
      b8e00abe
  16. 24 5月, 2021 1 次提交
  17. 19 5月, 2021 1 次提交
  18. 01 5月, 2021 1 次提交
  19. 25 4月, 2021 2 次提交
  20. 21 4月, 2021 1 次提交
    • M
      lib/math: Add a `do_div' test module · 5086ea4b
      Maciej W. Rozycki 提交于
      Implement a module for correctness and performance evaluation for the
      `do_div' function, often handled in an optimised manner by platform
      code.  Use a somewhat randomly generated set of inputs that is supposed
      to be representative, using the same set of divisors twice, expressed as
      a constant and as a variable each, so as to verify the implementation
      for both cases should they be handled by different code execution paths.
      Reference results were produced with GNU bc.
      
      At the conclusion output the total execution time elapsed.
      Signed-off-by: NMaciej W. Rozycki <macro@orcam.me.uk>
      Signed-off-by: NThomas Bogendoerfer <tsbogend@alpha.franken.de>
      5086ea4b
  21. 16 4月, 2021 1 次提交
  22. 10 4月, 2021 1 次提交
  23. 05 4月, 2021 1 次提交
  24. 27 2月, 2021 1 次提交
    • A
      mm: add Kernel Electric-Fence infrastructure · 0ce20dd8
      Alexander Potapenko 提交于
      Patch series "KFENCE: A low-overhead sampling-based memory safety error detector", v7.
      
      This adds the Kernel Electric-Fence (KFENCE) infrastructure. KFENCE is a
      low-overhead sampling-based memory safety error detector of heap
      use-after-free, invalid-free, and out-of-bounds access errors.  This
      series enables KFENCE for the x86 and arm64 architectures, and adds
      KFENCE hooks to the SLAB and SLUB allocators.
      
      KFENCE is designed to be enabled in production kernels, and has near
      zero performance overhead. Compared to KASAN, KFENCE trades performance
      for precision. The main motivation behind KFENCE's design, is that with
      enough total uptime KFENCE will detect bugs in code paths not typically
      exercised by non-production test workloads. One way to quickly achieve a
      large enough total uptime is when the tool is deployed across a large
      fleet of machines.
      
      KFENCE objects each reside on a dedicated page, at either the left or
      right page boundaries. The pages to the left and right of the object
      page are "guard pages", whose attributes are changed to a protected
      state, and cause page faults on any attempted access to them. Such page
      faults are then intercepted by KFENCE, which handles the fault
      gracefully by reporting a memory access error.
      
      Guarded allocations are set up based on a sample interval (can be set
      via kfence.sample_interval). After expiration of the sample interval,
      the next allocation through the main allocator (SLAB or SLUB) returns a
      guarded allocation from the KFENCE object pool. At this point, the timer
      is reset, and the next allocation is set up after the expiration of the
      interval.
      
      To enable/disable a KFENCE allocation through the main allocator's
      fast-path without overhead, KFENCE relies on static branches via the
      static keys infrastructure. The static branch is toggled to redirect the
      allocation to KFENCE.
      
      The KFENCE memory pool is of fixed size, and if the pool is exhausted no
      further KFENCE allocations occur. The default config is conservative
      with only 255 objects, resulting in a pool size of 2 MiB (with 4 KiB
      pages).
      
      We have verified by running synthetic benchmarks (sysbench I/O,
      hackbench) and production server-workload benchmarks that a kernel with
      KFENCE (using sample intervals 100-500ms) is performance-neutral
      compared to a non-KFENCE baseline kernel.
      
      KFENCE is inspired by GWP-ASan [1], a userspace tool with similar
      properties. The name "KFENCE" is a homage to the Electric Fence Malloc
      Debugger [2].
      
      For more details, see Documentation/dev-tools/kfence.rst added in the
      series -- also viewable here:
      
      	https://raw.githubusercontent.com/google/kasan/kfence/Documentation/dev-tools/kfence.rst
      
      [1] http://llvm.org/docs/GwpAsan.html
      [2] https://linux.die.net/man/3/efence
      
      This patch (of 9):
      
      This adds the Kernel Electric-Fence (KFENCE) infrastructure. KFENCE is a
      low-overhead sampling-based memory safety error detector of heap
      use-after-free, invalid-free, and out-of-bounds access errors.
      
      KFENCE is designed to be enabled in production kernels, and has near
      zero performance overhead. Compared to KASAN, KFENCE trades performance
      for precision. The main motivation behind KFENCE's design, is that with
      enough total uptime KFENCE will detect bugs in code paths not typically
      exercised by non-production test workloads. One way to quickly achieve a
      large enough total uptime is when the tool is deployed across a large
      fleet of machines.
      
      KFENCE objects each reside on a dedicated page, at either the left or
      right page boundaries. The pages to the left and right of the object
      page are "guard pages", whose attributes are changed to a protected
      state, and cause page faults on any attempted access to them. Such page
      faults are then intercepted by KFENCE, which handles the fault
      gracefully by reporting a memory access error. To detect out-of-bounds
      writes to memory within the object's page itself, KFENCE also uses
      pattern-based redzones. The following figure illustrates the page
      layout:
      
        ---+-----------+-----------+-----------+-----------+-----------+---
           | xxxxxxxxx | O :       | xxxxxxxxx |       : O | xxxxxxxxx |
           | xxxxxxxxx | B :       | xxxxxxxxx |       : B | xxxxxxxxx |
           | x GUARD x | J : RED-  | x GUARD x | RED-  : J | x GUARD x |
           | xxxxxxxxx | E :  ZONE | xxxxxxxxx |  ZONE : E | xxxxxxxxx |
           | xxxxxxxxx | C :       | xxxxxxxxx |       : C | xxxxxxxxx |
           | xxxxxxxxx | T :       | xxxxxxxxx |       : T | xxxxxxxxx |
        ---+-----------+-----------+-----------+-----------+-----------+---
      
      Guarded allocations are set up based on a sample interval (can be set
      via kfence.sample_interval). After expiration of the sample interval, a
      guarded allocation from the KFENCE object pool is returned to the main
      allocator (SLAB or SLUB). At this point, the timer is reset, and the
      next allocation is set up after the expiration of the interval.
      
      To enable/disable a KFENCE allocation through the main allocator's
      fast-path without overhead, KFENCE relies on static branches via the
      static keys infrastructure. The static branch is toggled to redirect the
      allocation to KFENCE. To date, we have verified by running synthetic
      benchmarks (sysbench I/O, hackbench) that a kernel compiled with KFENCE
      is performance-neutral compared to the non-KFENCE baseline.
      
      For more details, see Documentation/dev-tools/kfence.rst (added later in
      the series).
      
      [elver@google.com: fix parameter description for kfence_object_start()]
        Link: https://lkml.kernel.org/r/20201106092149.GA2851373@elver.google.com
      [elver@google.com: avoid stalling work queue task without allocations]
        Link: https://lkml.kernel.org/r/CADYN=9J0DQhizAGB0-jz4HOBBh+05kMBXb4c0cXMS7Qi5NAJiw@mail.gmail.com
        Link: https://lkml.kernel.org/r/20201110135320.3309507-1-elver@google.com
      [elver@google.com: fix potential deadlock due to wake_up()]
        Link: https://lkml.kernel.org/r/000000000000c0645805b7f982e4@google.com
        Link: https://lkml.kernel.org/r/20210104130749.1768991-1-elver@google.com
      [elver@google.com: add option to use KFENCE without static keys]
        Link: https://lkml.kernel.org/r/20210111091544.3287013-1-elver@google.com
      [elver@google.com: add missing copyright and description headers]
        Link: https://lkml.kernel.org/r/20210118092159.145934-1-elver@google.com
      
      Link: https://lkml.kernel.org/r/20201103175841.3495947-2-elver@google.comSigned-off-by: NMarco Elver <elver@google.com>
      Signed-off-by: NAlexander Potapenko <glider@google.com>
      Reviewed-by: NDmitry Vyukov <dvyukov@google.com>
      Reviewed-by: NSeongJae Park <sjpark@amazon.de>
      Co-developed-by: NMarco Elver <elver@google.com>
      Reviewed-by: NJann Horn <jannh@google.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Paul E. McKenney <paulmck@kernel.org>
      Cc: Andrey Konovalov <andreyknvl@google.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christopher Lameter <cl@linux.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Hillf Danton <hdanton@sina.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Joern Engel <joern@purestorage.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      0ce20dd8
  25. 16 2月, 2021 2 次提交
    • N
      Kconfig: allow explicit opt in to DWARF v5 · 98cd6f52
      Nick Desaulniers 提交于
      DWARF v5 is the latest standard of the DWARF debug info format. GCC 11
      will change the implicit default DWARF version, if left unspecified, to
      DWARF v5.
      
      Allow users of Clang and older versions of GCC that have not changed the
      implicit default DWARF version to DWARF v5 to opt in. This can help
      testing consumers of DWARF debug info in preparation of v5 becoming more
      widespread, as well as result in significant binary size savings of the
      pre-stripped vmlinux image.
      
      DWARF5 wins significantly in terms of size when mixed with compression
      (CONFIG_DEBUG_INFO_COMPRESSED).
      
      363M    vmlinux.clang12.dwarf5.compressed
      434M    vmlinux.clang12.dwarf4.compressed
      439M    vmlinux.clang12.dwarf2.compressed
      457M    vmlinux.clang12.dwarf5
      536M    vmlinux.clang12.dwarf4
      548M    vmlinux.clang12.dwarf2
      
      515M    vmlinux.gcc10.2.dwarf5.compressed
      599M    vmlinux.gcc10.2.dwarf4.compressed
      624M    vmlinux.gcc10.2.dwarf2.compressed
      630M    vmlinux.gcc10.2.dwarf5
      765M    vmlinux.gcc10.2.dwarf4
      809M    vmlinux.gcc10.2.dwarf2
      
      Though the quality of debug info is harder to quantify; size is not a
      proxy for quality.
      
      Jakub notes:
        One thing is GCC DWARF-5 support, that is whether the compiler will
        support -gdwarf-5 flag, and that support should be there from GCC 7
        onwards.
      
        All [GCC] 5.1 - 6.x did was start accepting -gdwarf-5 as experimental
        option that enabled some small DWARF subset (initially only a few
        DW_LANG_* codes newly added to DWARF5 drafts).  Only GCC 7 (released
        after DWARF 5 has been finalized) started emitting DWARF5 section
        headers and got most of the DWARF5 changes in...
      
        Another separate thing is whether the assembler does support
        the -gdwarf-5 option (i.e. if you can compile assembler files
        with -Wa,-gdwarf-5) ... That option is about whether the assembler
        will emit DWARF5 or DWARF2 .debug_line.  It is fine to compile C sources
        with -gdwarf-5 and use DWARF2 .debug_line for assembler files if as
        doesn't support it.
      
      Version check GCC so that we don't need to worry about the difference in
      command line args between GNU readelf and llvm-readelf/llvm-dwarfdump to
      validate the DWARF Version in the assembler feature detection script.
      
      Most issues with clang produced assembler were fixed in binutils 2.35.1,
      but 2.35.2 fixed issues related to requiring the flag -Wa,-gdwarf-5
      explicitly. The added shell script test checks for the latter, and is
      only required when using clang without its integrated assembler, though
      we use for clang regardless as we do not yet have a way to query the
      assembler from Kconfig.
      
      Disabled for now if CONFIG_DEBUG_INFO_BTF is set; pahole doesn't yet
      recognize the new additions to the DWARF debug info.
      
      This only modifies the DWARF version emitted by the compiler, not the
      assembler.
      
      The DWARF version of a binary can be validated with:
      $ llvm-dwarfdump <object file> | head -n 4 | grep version
      or
      $ readelf --debug-dump=info <object file> 2>/dev/null | grep Version
      
      Parts of the tree don't reuse DEBUG_CFLAGS as they should; such cleanup
      is left as a follow up.
      
      Link: http://www.dwarfstd.org/doc/DWARF5.pdf
      Link: https://bugzilla.redhat.com/show_bug.cgi?id=1922707Reported-by: NSedat Dilek <sedat.dilek@gmail.com>
      Suggested-by: NArvind Sankar <nivedita@alum.mit.edu>
      Suggested-by: NCaroline Tice <cmtice@google.com>
      Suggested-by: NFangrui Song <maskray@google.com>
      Suggested-by: NJakub Jelinek <jakub@redhat.com>
      Suggested-by: NMasahiro Yamada <masahiroy@kernel.org>
      Suggested-by: NNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: NNick Desaulniers <ndesaulniers@google.com>
      Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # LLVM/Clang v12.0.0-rc1 x86-64
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      98cd6f52
    • N
      Kbuild: make DWARF version a choice · a66049e2
      Nick Desaulniers 提交于
      Adds a default CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT which allows
      the implicit default version of DWARF emitted by the toolchain to
      progress over time.
      
      Modifies CONFIG_DEBUG_INFO_DWARF4 to be a member of a choice, making it
      mutually exclusive with CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT. Users
      may want to select this if they are using a newer toolchain, but have
      consumers of the DWARF debug info that aren't yet ready for newer DWARF
      versions' debug info.
      
      Does so in a way that's forward compatible with existing
      configs, and makes adding future versions more straightforward. This
      patch does not change the current behavior or selection of DWARF
      version for users upgrading to kernels with this patch.
      
      GCC since ~4.8 has defaulted to DWARF v4 implicitly, and GCC 11 has
      bumped this to v5.
      
      Remove the Kconfig help text  about DWARF v4 being larger.  It's
      empirically false for the latest toolchains for x86_64 defconfig, has no
      point of reference (I suspect it was DWARF v2 but that's stil
      empirically false), and debug info size is not a qualatative measure.
      Suggested-by: NArvind Sankar <nivedita@alum.mit.edu>
      Suggested-by: NFangrui Song <maskray@google.com>
      Suggested-by: NJakub Jelinek <jakub@redhat.com>
      Suggested-by: NMark Wielaard <mark@klomp.org>
      Suggested-by: NMasahiro Yamada <masahiroy@kernel.org>
      Suggested-by: NNathan Chancellor <nathan@kernel.org>
      Tested-by: NSedat Dilek <sedat.dilek@gmail.com>
      Signed-off-by: NNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      a66049e2
  26. 12 2月, 2021 1 次提交
  27. 22 1月, 2021 1 次提交
    • M
      lockdep: report broken irq restoration · 997acaf6
      Mark Rutland 提交于
      We generally expect local_irq_save() and local_irq_restore() to be
      paired and sanely nested, and so local_irq_restore() expects to be
      called with irqs disabled. Thus, within local_irq_restore() we only
      trace irq flag changes when unmasking irqs.
      
      This means that a sequence such as:
      
      | local_irq_disable();
      | local_irq_save(flags);
      | local_irq_enable();
      | local_irq_restore(flags);
      
      ... is liable to break things, as the local_irq_restore() would mask
      irqs without tracing this change. Similar problems may exist for
      architectures whose arch_irq_restore() function depends on being called
      with irqs disabled.
      
      We don't consider such sequences to be a good idea, so let's define
      those as forbidden, and add tooling to detect such broken cases.
      
      This patch adds debug code to WARN() when raw_local_irq_restore() is
      called with irqs enabled. As raw_local_irq_restore() is expected to pair
      with raw_local_irq_save(), it should never be called with irqs enabled.
      
      To avoid the possibility of circular header dependencies between
      irqflags.h and bug.h, the warning is handled in a separate C file.
      
      The new code is all conditional on a new CONFIG_DEBUG_IRQFLAGS symbol
      which is independent of CONFIG_TRACE_IRQFLAGS. As noted above such cases
      will confuse lockdep, so CONFIG_DEBUG_LOCKDEP now selects
      CONFIG_DEBUG_IRQFLAGS.
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lkml.kernel.org/r/20210111153707.10071-1-mark.rutland@arm.com
      997acaf6
  28. 16 12月, 2020 1 次提交
  29. 12 12月, 2020 1 次提交
  30. 02 12月, 2020 2 次提交
  31. 24 11月, 2020 2 次提交
  32. 18 11月, 2020 1 次提交