1. 13 8月, 2020 1 次提交
  2. 10 8月, 2020 1 次提交
    • M
      kbuild: introduce ccflags-remove-y and asflags-remove-y · 15d5761a
      Masahiro Yamada 提交于
      CFLAGS_REMOVE_<file>.o filters out flags when compiling a particular
      object, but there is no convenient way to do that for every object in
      a directory.
      
      Add ccflags-remove-y and asflags-remove-y to make it easily.
      
      Use ccflags-remove-y to clean up some Makefiles.
      
      The add/remove order works as follows:
      
       [1] KBUILD_CFLAGS specifies compiler flags used globally
      
       [2] ccflags-y adds compiler flags for all objects in the
           current Makefile
      
       [3] ccflags-remove-y removes compiler flags for all objects in the
           current Makefile (New feature)
      
       [4] CFLAGS_<file> adds compiler flags per file.
      
       [5] CFLAGS_REMOVE_<file> removes compiler flags per file.
      
      Having [3] before [4] allows us to remove flags from most (but not all)
      objects in the current Makefile.
      
      For example, kernel/trace/Makefile removes $(CC_FLAGS_FTRACE)
      from all objects in the directory, then adds it back to
      trace_selftest_dynamic.o and CFLAGS_trace_kprobe_selftest.o
      
      The same applies to lib/livepatch/Makefile.
      
      Please note ccflags-remove-y has no effect to the sub-directories.
      In contrast, the previous notation got rid of compiler flags also from
      all the sub-directories.
      
      The following are not affected because they have no sub-directories:
      
        arch/arm/boot/compressed/
        arch/powerpc/xmon/
        arch/sh/
        kernel/trace/
      
      However, lib/ has several sub-directories.
      
      To keep the behavior, I added ccflags-remove-y to all Makefiles
      in subdirectories of lib/, except the following:
      
        lib/vdso/Makefile        - Kbuild does not descend into this Makefile
        lib/raid/test/Makefile   - This is not used for the kernel build
      
      I think commit 2464a609 ("ftrace: do not trace library functions")
      excluded too much. In the next commit, I will remove ccflags-remove-y
      from the sub-directories of lib/.
      Suggested-by: NSami Tolvanen <samitolvanen@google.com>
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      Acked-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
      Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
      Acked-by: Brendan Higgins <brendanhiggins@google.com> (KUnit)
      Tested-by: NAnders Roxell <anders.roxell@linaro.org>
      15d5761a
  3. 08 8月, 2020 1 次提交
  4. 31 7月, 2020 1 次提交
  5. 29 7月, 2020 1 次提交
    • J
      Add pldmfw library for PLDM firmware update · b8265621
      Jacob Keller 提交于
      The pldmfw library is used to implement common logic needed to flash
      devices based on firmware files using the format described by the PLDM
      for Firmware Update standard.
      
      This library consists of logic to parse the PLDM file format from
      a firmware file object, as well as common logic for sending the relevant
      PLDM header data to the device firmware.
      
      A simple ops table is provided so that device drivers can implement
      device specific hardware interactions while keeping the common logic to
      the pldmfw library.
      
      This library will be used by the Intel ice networking driver as part of
      implementing device flash update via devlink. The library aims to be
      vendor and device agnostic. For this reason, it has been placed in
      lib/pldmfw, in the hopes that other devices which use the PLDM firmware
      file format may benefit from it in the future. However, do note that not
      all features defined in the PLDM standard have been implemented.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b8265621
  6. 07 7月, 2020 1 次提交
  7. 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
  8. 09 6月, 2020 1 次提交
  9. 05 6月, 2020 1 次提交
    • 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
  10. 20 5月, 2020 1 次提交
  11. 09 5月, 2020 2 次提交
  12. 08 4月, 2020 4 次提交
    • K
      ubsan: add trap instrumentation option · 0887a7eb
      Kees Cook 提交于
      Patch series "ubsan: Split out bounds checker", v5.
      
      This splits out the bounds checker so it can be individually used.  This
      is enabled in Android and hopefully for syzbot.  Includes LKDTM tests for
      behavioral corner-cases (beyond just the bounds checker), and adjusts
      ubsan and kasan slightly for correct panic handling.
      
      This patch (of 6):
      
      The Undefined Behavior Sanitizer can operate in two modes: warning
      reporting mode via lib/ubsan.c handler calls, or trap mode, which uses
      __builtin_trap() as the handler.  Using lib/ubsan.c means the kernel image
      is about 5% larger (due to all the debugging text and reporting structures
      to capture details about the warning conditions).  Using the trap mode,
      the image size changes are much smaller, though at the loss of the
      "warning only" mode.
      
      In order to give greater flexibility to system builders that want minimal
      changes to image size and are prepared to deal with kernel code being
      aborted and potentially destabilizing the system, this introduces
      CONFIG_UBSAN_TRAP.  The resulting image sizes comparison:
      
         text    data     bss       dec       hex     filename
      19533663   6183037  18554956  44271656  2a38828 vmlinux.stock
      19991849   7618513  18874448  46484810  2c54d4a vmlinux.ubsan
      19712181   6284181  18366540  44362902  2a4ec96 vmlinux.ubsan-trap
      
      CONFIG_UBSAN=y:      image +4.8% (text +2.3%, data +18.9%)
      CONFIG_UBSAN_TRAP=y: image +0.2% (text +0.9%, data +1.6%)
      
      Additionally adjusts the CONFIG_UBSAN Kconfig help for clarity and removes
      the mention of non-existing boot param "ubsan_handle".
      Suggested-by: NElena Petrova <lenaptr@google.com>
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Acked-by: NDmitry Vyukov <dvyukov@google.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Andrey Konovalov <andreyknvl@google.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Dan Carpenter <dan.carpenter@oracle.com>
      Cc: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Link: http://lkml.kernel.org/r/20200227193516.32566-2-keescook@chromium.orgSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      0887a7eb
    • A
      lib/stackdepot.c: build with -fno-builtin · 7b65942f
      Alexander Potapenko 提交于
      Clang may replace stackdepot_memcmp() with a call to instrumented bcmp(),
      which is exactly what we wanted to avoid creating stackdepot_memcmp().
      Building the file with -fno-builtin prevents such optimizations.
      
      This patch has been previously mailed as part of KMSAN RFC patch series.
      Signed-off-by: NAlexander Potapenko <glider@google.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Cc: Vegard Nossum <vegard.nossum@oracle.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Marco Elver <elver@google.com>
      Cc: Andrey Konovalov <andreyknvl@google.com>
      Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Link: http://lkml.kernel.org/r/20200220141916.55455-2-glider@google.comSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      7b65942f
    • K
      lib: test_stackinit.c: XFAIL switch variable init tests · 9cf016e6
      Kees Cook 提交于
      The tests for initializing a variable defined between a switch statement's
      test and its first "case" statement are currently not initialized in
      Clang[1] nor the proposed auto-initialization feature in GCC.
      
      We should retain the test (so that we can evaluate compiler fixes), but
      mark it as an "expected fail".  The rest of the kernel source will be
      adjusted to avoid this corner case.
      
      Also disable -Wswitch-unreachable for the test so that the intentionally
      broken code won't trigger warnings for GCC (nor future Clang) when
      initialization happens this unhandled place.
      
      [1] https://bugs.llvm.org/show_bug.cgi?id=44916Suggested-by: NAlexander Potapenko <glider@google.com>
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Cc: Jann Horn <jannh@google.com>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Link: http://lkml.kernel.org/r/202002191358.2897A07C6@keescookSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      9cf016e6
    • 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
  13. 06 3月, 2020 1 次提交
  14. 11 2月, 2020 1 次提交
  15. 04 2月, 2020 1 次提交
    • M
      kbuild: rename hostprogs-y/always to hostprogs/always-y · 5f2fb52f
      Masahiro Yamada 提交于
      In old days, the "host-progs" syntax was used for specifying host
      programs. It was renamed to the current "hostprogs-y" in 2004.
      
      It is typically useful in scripts/Makefile because it allows Kbuild to
      selectively compile host programs based on the kernel configuration.
      
      This commit renames like follows:
      
        always       ->  always-y
        hostprogs-y  ->  hostprogs
      
      So, scripts/Makefile will look like this:
      
        always-$(CONFIG_BUILD_BIN2C) += ...
        always-$(CONFIG_KALLSYMS)    += ...
            ...
        hostprogs := $(always-y) $(always-m)
      
      I think this makes more sense because a host program is always a host
      program, irrespective of the kernel configuration. We want to specify
      which ones to compile by CONFIG options, so always-y will be handier.
      
      The "always", "hostprogs-y", "hostprogs-m" will be kept for backward
      compatibility for a while.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      5f2fb52f
  16. 01 2月, 2020 2 次提交
    • D
      kcov: ignore fault-inject and stacktrace · 43e76af8
      Dmitry Vyukov 提交于
      Don't instrument 3 more files that contain debugging facilities and
      produce large amounts of uninteresting coverage for every syscall.
      
      The following snippets are sprinkled all over the place in kcov traces
      in a debugging kernel.  We already try to disable instrumentation of
      stack unwinding code and of most debug facilities.  I guess we did not
      use fault-inject.c at the time, and stacktrace.c was somehow missed (or
      something has changed in kernel/configs).  This change both speeds up
      kcov (kernel doesn't need to store these PCs, user-space doesn't need to
      process them) and frees trace buffer capacity for more useful coverage.
      
        should_fail
        lib/fault-inject.c:149
        fail_dump
        lib/fault-inject.c:45
      
        stack_trace_save
        kernel/stacktrace.c:124
        stack_trace_consume_entry
        kernel/stacktrace.c:86
        stack_trace_consume_entry
        kernel/stacktrace.c:89
        ... a hundred frames skipped ...
        stack_trace_consume_entry
        kernel/stacktrace.c:93
        stack_trace_consume_entry
        kernel/stacktrace.c:86
      
      Link: http://lkml.kernel.org/r/20200116111449.217744-1-dvyukov@gmail.comSigned-off-by: NDmitry Vyukov <dvyukov@google.com>
      Reviewed-by: NAndrey Konovalov <andreyknvl@google.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      43e76af8
    • M
      lib/zlib: add s390 hardware support for kernel zlib_deflate · aa5b395b
      Mikhail Zaslonko 提交于
      Patch series "S390 hardware support for kernel zlib", v3.
      
      With IBM z15 mainframe the new DFLTCC instruction is available.  It
      implements deflate algorithm in hardware (Nest Acceleration Unit - NXU)
      with estimated compression and decompression performance orders of
      magnitude faster than the current zlib.
      
      This patchset adds s390 hardware compression support to kernel zlib.
      The code is based on the userspace zlib implementation:
      
      	https://github.com/madler/zlib/pull/410
      
      The coding style is also preserved for future maintainability.  There is
      only limited set of userspace zlib functions represented in kernel.
      Apart from that, all the memory allocation should be performed in
      advance.  Thus, the workarea structures are extended with the parameter
      lists required for the DEFLATE CONVENTION CALL instruction.
      
      Since kernel zlib itself does not support gzip headers, only Adler-32
      checksum is processed (also can be produced by DFLTCC facility).  Like
      it was implemented for userspace, kernel zlib will compress in hardware
      on level 1, and in software on all other levels.  Decompression will
      always happen in hardware (when enabled).
      
      Two DFLTCC compression calls produce the same results only when they
      both are made on machines of the same generation, and when the
      respective buffers have the same offset relative to the start of the
      page.  Therefore care should be taken when using hardware compression
      when reproducible results are desired.  However it does always produce
      the standard conform output which can be inflated anyway.
      
      The new kernel command line parameter 'dfltcc' is introduced to
      configure s390 zlib hardware support:
      
          Format: { on | off | def_only | inf_only | always }
           on:       s390 zlib hardware support for compression on
                     level 1 and decompression (default)
           off:      No s390 zlib hardware support
           def_only: s390 zlib hardware support for deflate
                     only (compression on level 1)
           inf_only: s390 zlib hardware support for inflate
                     only (decompression)
           always:   Same as 'on' but ignores the selected compression
                     level always using hardware support (used for debugging)
      
      The main purpose of the integration of the NXU support into the kernel
      zlib is the use of hardware deflate in btrfs filesystem with on-the-fly
      compression enabled.  Apart from that, hardware support can also be used
      during boot for decompressing the kernel or the ramdisk image
      
      With the patch for btrfs expanding zlib buffer from 1 to 4 pages (patch
      6) the following performance results have been achieved using the
      ramdisk with btrfs.  These are relative numbers based on throughput rate
      and compression ratio for zlib level 1:
      
        Input data              Deflate rate   Inflate rate   Compression ratio
                                NXU/Software   NXU/Software   NXU/Software
        stream of zeroes        1.46           1.02           1.00
        random ASCII data       10.44          3.00           0.96
        ASCII text (dickens)    6,21           3.33           0.94
        binary data (vmlinux)   8,37           3.90           1.02
      
      This means that s390 hardware deflate can provide up to 10 times faster
      compression (on level 1) and up to 4 times faster decompression (refers
      to all compression levels) for btrfs zlib.
      
      Disclaimer: Performance results are based on IBM internal tests using DD
      command-line utility on btrfs on a Fedora 30 based internal driver in
      native LPAR on a z15 system.  Results may vary based on individual
      workload, configuration and software levels.
      
      This patch (of 9):
      
      Create zlib_dfltcc library with the s390 DEFLATE CONVERSION CALL
      implementation and related compression functions.  Update zlib_deflate
      functions with the hooks for s390 hardware support and adjust workspace
      structures with extra parameter lists required for hardware deflate.
      
      Link: http://lkml.kernel.org/r/20200103223334.20669-2-zaslonko@linux.ibm.comSigned-off-by: NIlya Leoshkevich <iii@linux.ibm.com>
      Signed-off-by: NMikhail Zaslonko <zaslonko@linux.ibm.com>
      Co-developed-by: NIlya Leoshkevich <iii@linux.ibm.com>
      Cc: Chris Mason <clm@fb.com>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: David Sterba <dsterba@suse.com>
      Cc: Eduard Shishkin <edward6@linux.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Josef Bacik <josef@toxicpanda.com>
      Cc: Richard Purdie <rpurdie@rpsys.net>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      aa5b395b
  17. 14 1月, 2020 1 次提交
  18. 09 1月, 2020 1 次提交
  19. 07 1月, 2020 1 次提交
  20. 17 11月, 2019 1 次提交
    • A
      crypto: chacha - move existing library code into lib/crypto · 5fb8ef25
      Ard Biesheuvel 提交于
      Currently, our generic ChaCha implementation consists of a permute
      function in lib/chacha.c that operates on the 64-byte ChaCha state
      directly [and which is always included into the core kernel since it
      is used by the /dev/random driver], and the crypto API plumbing to
      expose it as a skcipher.
      
      In order to support in-kernel users that need the ChaCha streamcipher
      but have no need [or tolerance] for going through the abstractions of
      the crypto API, let's expose the streamcipher bits via a library API
      as well, in a way that permits the implementation to be superseded by
      an architecture specific one if provided.
      
      So move the streamcipher code into a separate module in lib/crypto,
      and expose the init() and crypt() routines to users of the library.
      Signed-off-by: NArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      5fb8ef25
  21. 16 11月, 2019 1 次提交
  22. 07 11月, 2019 1 次提交
  23. 05 11月, 2019 1 次提交
  24. 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
  25. 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
  26. 01 10月, 2019 1 次提交
  27. 14 8月, 2019 1 次提交
    • M
      lib: Remove redundant ftrace flag removal · 41b57d1b
      Mark Rutland 提交于
      Since architectures can implement ftrace using a variety of mechanisms,
      generic code should always use CC_FLAGS_FTRACE rather than assuming that
      ftrace is built using -pg.
      
      Since commit:
      
        2464a609 ("ftrace: do not trace library functions")
      
      ... lib/Makefile has removed CC_FLAGS_FTRACE from KBUILD_CFLAGS, so ftrace is
      disabled for all files under lib/.
      
      Given that, we shouldn't explicitly remove -pg when building
      lib/string.o, as this is redundant and bad form.
      
      Clean things up accordingly.
      
      There should be no functional change as a result of this patch.
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Coly Li <colyli@suse.de>
      Cc: Gary R Hook <gary.hook@amd.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Kent Overstreet <kent.overstreet@gmail.com>
      Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Link: https://lkml.kernel.org/r/20190806162539.51918-1-mark.rutland@arm.com
      41b57d1b
  28. 03 8月, 2019 1 次提交
    • A
      ubsan: build ubsan.c more conservatively · af700eae
      Arnd Bergmann 提交于
      objtool points out several conditions that it does not like, depending
      on the combination with other configuration options and compiler
      variants:
      
      stack protector:
        lib/ubsan.o: warning: objtool: __ubsan_handle_type_mismatch()+0xbf: call to __stack_chk_fail() with UACCESS enabled
        lib/ubsan.o: warning: objtool: __ubsan_handle_type_mismatch_v1()+0xbe: call to __stack_chk_fail() with UACCESS enabled
      
      stackleak plugin:
        lib/ubsan.o: warning: objtool: __ubsan_handle_type_mismatch()+0x4a: call to stackleak_track_stack() with UACCESS enabled
        lib/ubsan.o: warning: objtool: __ubsan_handle_type_mismatch_v1()+0x4a: call to stackleak_track_stack() with UACCESS enabled
      
      kasan:
        lib/ubsan.o: warning: objtool: __ubsan_handle_type_mismatch()+0x25: call to memcpy() with UACCESS enabled
        lib/ubsan.o: warning: objtool: __ubsan_handle_type_mismatch_v1()+0x25: call to memcpy() with UACCESS enabled
      
      The stackleak and kasan options just need to be disabled for this file
      as we do for other files already.  For the stack protector, we already
      attempt to disable it, but this fails on clang because the check is
      mixed with the gcc specific -fno-conserve-stack option.  According to
      Andrey Ryabinin, that option is not even needed, dropping it here fixes
      the stackprotector issue.
      
      Link: http://lkml.kernel.org/r/20190722125139.1335385-1-arnd@arndb.de
      Link: https://lore.kernel.org/lkml/20190617123109.667090-1-arnd@arndb.de/t/
      Link: https://lore.kernel.org/lkml/20190722091050.2188664-1-arnd@arndb.de/t/
      Fixes: d08965a2 ("x86/uaccess, ubsan: Fix UBSAN vs. SMAP")
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Reviewed-by: NAndrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      af700eae
  29. 17 7月, 2019 1 次提交
  30. 02 7月, 2019 1 次提交
  31. 26 6月, 2019 1 次提交
  32. 20 6月, 2019 1 次提交
  33. 17 6月, 2019 1 次提交
  34. 15 5月, 2019 1 次提交
  35. 03 5月, 2019 1 次提交