Skip to content
Permalink
Li-RongQing/sc…
Switch branches/tags

Commits on Jul 20, 2021

  1. sched/cpuacct: Fix cpuacct charge

    get_irq_regs only work for current running cpu, but the task, whose
    cpuacct will be charged, maybe run different cpu, like Cpu 2 wake
    up a kernel thread to CPU 3, cause CPU 3 task are charged with the
    following stack
    
      cpuacct_charge+0xd8/0x100
      update_curr+0xe1/0x1e0
      enqueue_entity+0x144/0x6e0
      enqueue_task_fair+0x93/0x900
      ttwu_do_activate+0x4b/0x90
      try_to_wake_up+0x20b/0x530
      ? update_dl_rq_load_avg+0x10f/0x210
      swake_up_locked.part.1+0x13/0x40
      swake_up_one+0x27/0x40
      rcu_process_callbacks+0x484/0x4f0
      ? run_rebalance_domains_bt+0x5a/0x180
      __do_softirq+0xe3/0x308
      irq_exit+0xf0/0x100
      smp_apic_timer_interrupt+0x74/0x160
      apic_timer_interrupt+0xf/0x20
      </IRQ>
     RIP: 0033:0x456947
    
    so define a get_irq_regs_cpu which returns the required cpu irq registers
    
    BUT it should be not safe, and do not know what it should be like in MIPS?
    
    Fixes: dbe9337 "(sched/cpuacct: Fix charge cpuacct.usage_sys)"
    Co-developed-by: Zhao Jie <zhaojie17@baidu.com>
    Signed-off-by: Zhao Jie <zhaojie17@baidu.com>
    Signed-off-by: Li RongQing <lirongqing@baidu.com>
    lrq-max authored and intel-lab-lkp committed Jul 20, 2021

Commits on May 22, 2021

  1. Merge branch 'asm-generic-unaligned' into asm-generic

    The get_unaligned()/put_unaligned() helpers are traditionally architecture
    specific, with the two main variants being the "access-ok.h" version
    that assumes unaligned pointer accesses always work on a particular
    architecture, and the "le-struct.h" version that casts the data to a
    byte aligned type before dereferencing, for architectures that cannot
    always do unaligned accesses in hardware.
    
    Based on the discussion linked below, it appears that the access-ok
    version is not realiable on any architecture, but the struct version
    probably has no downsides. This series changes the code to use the
    same implementation on all architectures, addressing the few exceptions
    separately.
    
    * asm-generic-unaligned:
      asm-generic: simplify asm/unaligned.h
      asm-generic: uaccess: 1-byte access is always aligned
      netpoll: avoid put_unaligned() on single character
      mwifiex: re-fix for unaligned accesses
      apparmor: use get_unaligned() only for multi-byte words
      partitions: msdos: fix one-byte get_unaligned()
      asm-generic: unaligned always use struct helpers
      asm-generic: unaligned: remove byteshift helpers
      powerpc: use linux/unaligned/le_struct.h on LE power7
      m68k: select CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
      sh: remove unaligned access for sh4a
      openrisc: always use unaligned-struct header
      asm-generic: use asm-generic/unaligned.h for most architectures
    
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    arndb committed May 22, 2021

Commits on May 17, 2021

  1. asm-generic: simplify asm/unaligned.h

    The get_unaligned()/put_unaligned() implementations are much more complex
    than necessary, now that all architectures use the same code.
    
    Move everything into one file and use a much more compact way to express
    the same logic.
    
    I've compared the binary output using gcc-11 across defconfig builds for
    all architectures and found this patch to make no difference, except for
    a single function on powerpc that needs two additional register moves
    because of random differences in register allocation.
    
    There are a handful of callers of the low-level __get_unaligned_cpu32,
    so leave that in place for the time being even though the common code
    no longer uses it.
    
    This adds a warning for any caller of get_unaligned()/put_unaligned()
    that passes in a single-byte pointer, but I've sent patches for all
    instances that show up in x86 and randconfig builds. It would be nice
    to change the arguments of the endian-specific accessors to take the
    matching __be16/__be32/__be64/__le16/__le32/__le64 arguments instead of
    a void pointer, but that requires more changes to the rest of the kernel.
    
    This new version does allow aggregate types into get_unaligned(), which
    was not the original goal but might come in handy.
    
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    arndb committed May 17, 2021
  2. asm-generic: uaccess: 1-byte access is always aligned

    With the cleaned up version of asm-generic/unaligned.h,
    there is a warning about the get_user/put_user helpers using
    unaligned access for single-byte variables:
    
    include/asm-generic/uaccess.h: In function ‘__get_user_fn’:
    include/asm-generic/unaligned.h:13:15: warning: ‘packed’ attribute ignored for field of type ‘u8’ {aka ‘unsigned char’} [-Wattributes]
      const struct { type x __packed; } *__pptr = (typeof(__pptr))(ptr); \
    
    Change these to use a direct pointer dereference to avoid the
    warnings.
    
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    arndb committed May 17, 2021
  3. netpoll: avoid put_unaligned() on single character

    With a planned cleanup, using put_unaligned() on a single character
    results in a harmless warning:
    
    In file included from ./arch/x86/include/generated/asm/unaligned.h:1,
                     from include/linux/etherdevice.h:24,
                     from net/core/netpoll.c:18:
    net/core/netpoll.c: In function 'netpoll_send_udp':
    include/asm-generic/unaligned.h:23:9: error: 'packed' attribute ignored for field of type 'unsigned char' [-Werror=attributes]
    net/core/netpoll.c:431:3: note: in expansion of macro 'put_unaligned'
      431 |   put_unaligned(0x60, (unsigned char *)ip6h);
          |   ^~~~~~~~~~~~~
    include/asm-generic/unaligned.h:23:9: error: 'packed' attribute ignored for field of type 'unsigned char' [-Werror=attributes]
    net/core/netpoll.c:459:3: note: in expansion of macro 'put_unaligned'
      459 |   put_unaligned(0x45, (unsigned char *)iph);
          |   ^~~~~~~~~~~~~
    
    Replace this with an open-coded pointer dereference.
    
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    arndb committed May 17, 2021
  4. mwifiex: re-fix for unaligned accesses

    A patch from 2017 changed some accesses to DMA memory to use
    get_unaligned_le32() and similar interfaces, to avoid problems
    with doing unaligned accesson uncached memory.
    
    However, the change in the mwifiex_pcie_alloc_sleep_cookie_buf()
    function ended up changing the size of the access instead,
    as it operates on a pointer to u8.
    
    Change this function back to actually access the entire 32 bits.
    Note that the pointer is aligned by definition because it came
    from dma_alloc_coherent().
    
    Fixes: 92c70a9 ("mwifiex: fix for unaligned reads")
    Acked-by: Kalle Valo <kvalo@codeaurora.org>
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    arndb committed May 17, 2021
  5. apparmor: use get_unaligned() only for multi-byte words

    Using get_unaligned() on a u8 pointer is pointless, and will
    result in a compiler warning after a planned cleanup:
    
    In file included from arch/x86/include/generated/asm/unaligned.h:1,
                     from security/apparmor/policy_unpack.c:16:
    security/apparmor/policy_unpack.c: In function 'unpack_u8':
    include/asm-generic/unaligned.h:13:15: error: 'packed' attribute ignored for field of type 'u8' {aka 'unsigned char'} [-Werror=attributes]
       13 |  const struct { type x __packed; } *__pptr = (typeof(__pptr))(ptr); \
          |               ^
    
    Simply dereference this pointer directly.
    
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Acked-by: John Johansen <john.johansen@canonical.com>
    arndb committed May 17, 2021
  6. partitions: msdos: fix one-byte get_unaligned()

    A simplification of get_unaligned() clashes with callers that pass
    in a character pointer, causing a harmless warning like:
    
    block/partitions/msdos.c: In function 'msdos_partition':
    include/asm-generic/unaligned.h:13:22: warning: 'packed' attribute ignored for field of type 'u8' {aka 'unsigned char'} [-Wattributes]
    
    Remove the SYS_IND() macro with the get_unaligned() call
    and just use the ->ind field directly.
    
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    arndb committed May 17, 2021

Commits on May 12, 2021

  1. Merge branch 'asm-generic-pci-iobase' into asm-generic

    A rework for PCI I/O space access from Niklas Schnelle:
    
      "This is version 5 of my attempt to get rid of a clang
       -Wnull-pointer-arithmetic warning for the use of PCI_IOBASE in
       asm-generic/io.h. This was originally found on s390 but should apply to
       all platforms leaving PCI_IOBASE undefined while making use of the inb()
       and friends helpers from asm-generic/io.h.
    
       This applies cleanly and was compile tested on top of v5.12 for the
       previously broken ARC, nds32, h8300 and risc-v architecture. It also
       applies cleanly on v5.13-rc1 for which I boot tested it on s390.
    
       I did boot test this only on x86_64 and s390x the former implements
       inb() itself while the latter would emit a WARN_ONCE() but no drivers
       use inb()."
    
    * asm-generic-pci-iobase:
      asm-generic/io.h: warn in inb() and friends with undefined PCI_IOBASE
      risc-v: Use generic io.h helpers for nommu
      sparc: explicitly set PCI_IOBASE to 0
    
    Link: https://lore.kernel.org/lkml/20210510145234.594814-1-schnelle@linux.ibm.com/
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    arndb committed May 12, 2021

Commits on May 10, 2021

  1. asm-generic: unaligned always use struct helpers

    As found by Vineet Gupta and Linus Torvalds, gcc has somewhat unexpected
    behavior when faced with overlapping unaligned pointers. The kernel's
    unaligned/access-ok.h header technically invokes undefined behavior
    that happens to usually work on the architectures using it, but if the
    compiler optimizes code based on the assumption that undefined behavior
    doesn't happen, it can create output that actually causes data corruption.
    
    A related problem was previously found on 32-bit ARMv7, where most
    instructions can be used on unaligned data, but 64-bit ldrd/strd causes
    an exception. The workaround was to always use the unaligned/le_struct.h
    helper instead of unaligned/access-ok.h, in commit 1cce91d ("ARM:
    8715/1: add a private asm/unaligned.h").
    
    The same solution should work on all other architectures as well, so
    remove the access-ok.h variant and use the other one unconditionally on
    all architectures, picking either the big-endian or little-endian version.
    
    With this, the arm specific header can be removed as well, and the
    only file including linux/unaligned/access_ok.h gets moved to including
    the normal file.
    
    Fortunately, this made almost no difference to the object code produced
    by gcc-11. On x86, s390, powerpc, and arc, the resulting binary appears
    to be identical to the previous version, while on arm64 and m68k there
    are minimal differences that looks like an optimization pass went into
    a different direction, usually using fewer stack spills on the new
    version.
    
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100363
    arndb committed May 10, 2021
  2. asm-generic: unaligned: remove byteshift helpers

    In theory, compilers should be able to work this out themselves so we
    can use a simpler version based on the swab() helpers.
    
    I have verified that this works on all supported compiler versions
    (gcc-4.9 and up, clang-10 and up). Looking at the object code produced by
    gcc-11, I found that the impact is mostly a change in inlining decisions
    that lead to slightly larger code.
    
    In other cases, this version produces explicit byte swaps in place of
    separate byte access, or comparing against pre-swapped constants.
    
    While the source code is clearly simpler, I have not seen an indication
    of the new version actually producing better code on Arm, so maybe
    we want to skip this after all. From what I can tell, gcc recognizes
    the byteswap pattern in the byteshift.h header and can turn it into
    explicit instructions, but it does not turn a __builtin_bswap32() back
    into individual bytes when that would result in better output, e.g.
    when storing a byte-reversed constant.
    
    Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    arndb committed May 10, 2021
  3. powerpc: use linux/unaligned/le_struct.h on LE power7

    Little-endian POWER7 kernels disable
    CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS because that is not supported on
    the hardware, but the kernel still uses direct load/store for explicti
    get_unaligned()/put_unaligned().
    
    I assume this is a mistake that leads to power7 having to trap and fix
    up all these unaligned accesses at a noticeable performance cost.
    
    The fix is completely trivial, just remove the file and use the
    generic version that gets it right.
    
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    arndb committed May 10, 2021
  4. m68k: select CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS

    All supported CPUs other than the old dragonball and in theory other 68000
    derivatives use the include/linux/unaligned/access_ok.h implementation
    for accessing unaligned variables, so presumably this works everywhere.
    
    However, m68k never selects CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS,
    so none of the other conditionals in the kernel get the optimized
    implementation.
    
    Select this based on CPU_HAS_NO_UNALIGNED to make the two settings
    always match, and then use the generic version of the header.
    
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
    Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
    arndb committed May 10, 2021
  5. sh: remove unaligned access for sh4a

    Unlike every other architecture, sh4a uses an inline asm implementation
    for get_unaligned(). I have shown that this produces better object
    code than the asm-generic version. However, there are very few users of
    arch/sh/ overall, and most of those seem to use sh4 rather than sh4a CPU
    cores, so it seems not worth keeping the complexity in the architecture
    independent code.
    
    Change over to the generic version to allow simplifying that in a
    follow-up patch.
    
    If there are sh4a users that want the best performance, it would probably
    be best to add support for the movua instruction in gcc itself, as this
    would not just help get_unaligned() callers but any code that accesses
    a __packed variable in user space or kernel.
    
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    arndb committed May 10, 2021
  6. openrisc: always use unaligned-struct header

    openrisc is the only architecture using the linux/unaligned/*memmove
    infrastructure. There is a comment saying that this version is more
    efficient, but this was added in 2011 before the openrisc gcc port
    was merged upstream.
    
    I checked a couple of files to see what the actual difference is with
    the mainline gcc (9.4 and 11.1), and found that the generic header
    seems to produce better code now, regardless of the gcc version.
    
    Specifically, the be_memmove leads to allocating a stack slot and
    copying the data one byte at a time, then reading the whole word
    from the stack:
    
    00000000 <test_get_unaligned_memmove>:
       0:	9c 21 ff f4 	l.addi r1,r1,-12
       4:	d4 01 10 04 	l.sw 4(r1),r2
       8:	8e 63 00 00 	l.lbz r19,0(r3)
       c:	9c 41 00 0c 	l.addi r2,r1,12
      10:	8e 23 00 01 	l.lbz r17,1(r3)
      14:	db e2 9f f4 	l.sb -12(r2),r19
      18:	db e2 8f f5 	l.sb -11(r2),r17
      1c:	8e 63 00 02 	l.lbz r19,2(r3)
      20:	8e 23 00 03 	l.lbz r17,3(r3)
      24:	d4 01 48 08 	l.sw 8(r1),r9
      28:	db e2 9f f6 	l.sb -10(r2),r19
      2c:	db e2 8f f7 	l.sb -9(r2),r17
      30:	85 62 ff f4 	l.lwz r11,-12(r2)
      34:	85 21 00 08 	l.lwz r9,8(r1)
      38:	84 41 00 04 	l.lwz r2,4(r1)
      3c:	44 00 48 00 	l.jr r9
      40:	9c 21 00 0c 	l.addi r1,r1,12
    
    while the be_struct version reads each byte into a register
    and does a shift to the right position:
    
    00000000 <test_get_unaligned_struct>:
       0:	9c 21 ff f8 	l.addi r1,r1,-8
       4:	8e 63 00 00 	l.lbz r19,0(r3)
       8:	aa 20 00 18 	l.ori r17,r0,0x18
       c:	e2 73 88 08 	l.sll r19,r19,r17
      10:	8d 63 00 01 	l.lbz r11,1(r3)
      14:	aa 20 00 10 	l.ori r17,r0,0x10
      18:	e1 6b 88 08 	l.sll r11,r11,r17
      1c:	e1 6b 98 04 	l.or r11,r11,r19
      20:	8e 23 00 02 	l.lbz r17,2(r3)
      24:	aa 60 00 08 	l.ori r19,r0,0x8
      28:	e2 31 98 08 	l.sll r17,r17,r19
      2c:	d4 01 10 00 	l.sw 0(r1),r2
      30:	d4 01 48 04 	l.sw 4(r1),r9
      34:	9c 41 00 08 	l.addi r2,r1,8
      38:	e2 31 58 04 	l.or r17,r17,r11
      3c:	8d 63 00 03 	l.lbz r11,3(r3)
      40:	e1 6b 88 04 	l.or r11,r11,r17
      44:	84 41 00 00 	l.lwz r2,0(r1)
      48:	85 21 00 04 	l.lwz r9,4(r1)
      4c:	44 00 48 00 	l.jr r9
      50:	9c 21 00 08 	l.addi r1,r1,8
    
    According to Stafford Horne, the new version should in fact perform
    better.
    
    In the trivial example, the struct version is a few instructions longer,
    but building a whole kernel shows an overall reduction in code size,
    presumably because it now has to manage fewer stack slots:
    
       text	   data	    bss	    dec	    hex	filename
    4792010	 181480	  82324	5055814	 4d2546	vmlinux-unaligned-memmove
    4790642	 181480	  82324	5054446	 4d1fee	vmlinux-unaligned-struct
    
    Remove the memmove version completely and let openrisc use the same
    code as everyone else, as a simplification.
    
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Acked-by: Stafford Horne <shorne@gmail.com>
    arndb committed May 10, 2021
  7. asm-generic: use asm-generic/unaligned.h for most architectures

    There are several architectures that just duplicate the contents
    of asm-generic/unaligned.h, so change those over to use the
    file directly, to make future modifications easier.
    
    The exceptions are:
    
    - arm32 sets HAVE_EFFICIENT_UNALIGNED_ACCESS, but wants the
      unaligned-struct version
    
    - ppc64le disables HAVE_EFFICIENT_UNALIGNED_ACCESS but includes
      the access-ok version
    
    - most m68k also uses the access-ok version without setting
      HAVE_EFFICIENT_UNALIGNED_ACCESS.
    
    - sh4a has a custom inline asm version
    
    - openrisc is the only one using the memmove version that
      generally leads to worse code.
    
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
    Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
    Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
    arndb committed May 10, 2021
  8. asm-generic/io.h: warn in inb() and friends with undefined PCI_IOBASE

    When PCI_IOBASE is not defined, it is set to 0 such that it is ignored
    in calls to the readX/writeX primitives. This triggers clang's
    -Wnull-pointer-arithmetic warning and will result in illegal accesses on
    platforms that do not support I/O ports.
    
    Make things explicit and silence the warning by letting inb() and
    friends fail with WARN_ONCE() and a 0xff... return in case PCI_IOBASE is
    not defined.
    
    Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
    Link: https://lore.kernel.org/lkml/20210421111759.2059976-1-schnelle@linux.ibm.com/
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    niklas88 authored and arndb committed May 10, 2021
  9. risc-v: Use generic io.h helpers for nommu

    Without MMU support PCI_IOBASE is left undefined because PCI_IO_END is
    VMEMMAP_START. Nevertheless the in*()/out*() helper macros are left
    defined with uses of PCI_IOBASE.
    
    At the moment this only compiles because asm-generic/io.h defines
    PCI_IOBASE as 0 if it is undefined and so at macro expansion PCI_IOBASE
    is defined. This leads to compilation errors when asm-generic/io.h is
    changed to leave PCI_IOBASE undefined.  More importantly it is currently
    broken at runtime, as accessing a fixed I/O port number of an ISA device
    on NOMMU RISC-V would turn into a NULL pointer dereference.
    
    Instead only define the in*()/out*() helper macros with MMU support and
    fall back to the asm-generic/io.h helper stubs otherwise.
    
    Signed-off-by: Niklas Schnelle <niklas@komani.de>
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    niklas88 authored and arndb committed May 10, 2021
  10. sparc: explicitly set PCI_IOBASE to 0

    Instead of relying on the fallback in asm-generic/io.h which sets
    PCI_IOBASE 0 if it is not defined set it explicitly.
    
    Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
    Link: https://lore.kernel.org/lkml/CAK8P3a3PK9zyeP4ymELtc2ZYnymECoACiigw9Za+pvSJpCk5=g@mail.gmail.com/
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    niklas88 authored and arndb committed May 10, 2021

Commits on May 9, 2021

  1. Linux 5.13-rc1

    torvalds committed May 9, 2021
  2. fbmem: fix horribly incorrect placement of __maybe_unused

    Commit b9d79e4 ("fbmem: Mark proc_fb_seq_ops as __maybe_unused")
    places the '__maybe_unused' in an entirely incorrect location between
    the "struct" keyword and the structure name.
    
    It's a wonder that gcc accepts that silently, but clang quite reasonably
    warns about it:
    
        drivers/video/fbdev/core/fbmem.c:736:21: warning: attribute declaration must precede definition [-Wignored-attributes]
        static const struct __maybe_unused seq_operations proc_fb_seq_ops = {
                            ^
    
    Fix it.
    
    Cc: Guenter Roeck <linux@roeck-us.net>
    Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    torvalds committed May 9, 2021
  3. Merge tag 'drm-next-2021-05-10' of git://anongit.freedesktop.org/drm/drm

    Pull drm fixes from Dave Airlie:
     "Bit later than usual, I queued them all up on Friday then promptly
      forgot to write the pull request email. This is mainly amdgpu fixes,
      with some radeon/msm/fbdev and one i915 gvt fix thrown in.
    
      amdgpu:
       - MPO hang workaround
       - Fix for concurrent VM flushes on vega/navi
       - dcefclk is not adjustable on navi1x and newer
       - MST HPD debugfs fix
       - Suspend/resumes fixes
       - Register VGA clients late in case driver fails to load
       - Fix GEM leak in user framebuffer create
       - Add support for polaris12 with 32 bit memory interface
       - Fix duplicate cursor issue when using overlay
       - Fix corruption with tiled surfaces on VCN3
       - Add BO size and stride check to fix BO size verification
    
      radeon:
       - Fix off-by-one in power state parsing
       - Fix possible memory leak in power state parsing
    
      msm:
       - NULL ptr dereference fix
    
      fbdev:
       - procfs disabled warning fix
    
      i915:
       - gvt: Fix a possible division by zero in vgpu display rate
         calculation"
    
    * tag 'drm-next-2021-05-10' of git://anongit.freedesktop.org/drm/drm:
      drm/amdgpu: Use device specific BO size & stride check.
      drm/amdgpu: Init GFX10_ADDR_CONFIG for VCN v3 in DPG mode.
      drm/amd/pm: initialize variable
      drm/radeon: Avoid power table parsing memory leaks
      drm/radeon: Fix off-by-one power_state index heap overwrite
      drm/amd/display: Fix two cursor duplication when using overlay
      drm/amdgpu: add new MC firmware for Polaris12 32bit ASIC
      fbmem: Mark proc_fb_seq_ops as __maybe_unused
      drm/msm/dpu: Delete bonkers code
      drm/i915/gvt: Prevent divided by zero when calculating refresh rate
      amdgpu: fix GEM obj leak in amdgpu_display_user_framebuffer_create
      drm/amdgpu: Register VGA clients after init can no longer fail
      drm/amdgpu: Handling of amdgpu_device_resume return value for graceful teardown
      drm/amdgpu: fix r initial values
      drm/amd/display: fix wrong statement in mst hpd debugfs
      amdgpu/pm: set pp_dpm_dcefclk to readonly on NAVI10 and newer gpus
      amdgpu/pm: Prevent force of DCEFCLK on NAVI10 and SIENNA_CICHLID
      drm/amdgpu: fix concurrent VM flushes on Vega/Navi v2
      drm/amd/display: Reject non-zero src_y and src_x for video planes
    torvalds committed May 9, 2021
  4. Merge tag 'block-5.13-2021-05-09' of git://git.kernel.dk/linux-block

    Pull block fix from Jens Axboe:
     "Turns out the bio max size change still has issues, so let's get it
      reverted for 5.13-rc1. We'll shake out the issues there and defer it
      to 5.14 instead"
    
    * tag 'block-5.13-2021-05-09' of git://git.kernel.dk/linux-block:
      Revert "bio: limit bio max size"
    torvalds committed May 9, 2021
  5. Merge tag '5.13-rc-smb3-part3' of git://git.samba.org/sfrench/cifs-2.6

    Pull cifs fixes from Steve French:
     "Three small SMB3 chmultichannel related changesets (also for stable)
      from the SMB3 test event this week.
    
      The other fixes are still in review/testing"
    
    * tag '5.13-rc-smb3-part3' of git://git.samba.org/sfrench/cifs-2.6:
      smb3: if max_channels set to more than one channel request multichannel
      smb3: do not attempt multichannel to server which does not support it
      smb3: when mounting with multichannel include it in requested capabilities
    torvalds committed May 9, 2021
  6. Merge tag 'sched-urgent-2021-05-09' of git://git.kernel.org/pub/scm/l…

    …inux/kernel/git/tip/tip
    
    Pull scheduler fixes from Thomas Gleixner:
     "A set of scheduler updates:
    
       - Prevent PSI state corruption when schedule() races with cgroup
         move.
    
         A recent commit combined two PSI callbacks to reduce the number of
         cgroup tree updates, but missed that schedule() can drop rq::lock
         for load balancing, which opens the race window for
         cgroup_move_task() which then observes half updated state.
    
         The fix is to solely use task::ps_flags instead of looking at the
         potentially mismatching scheduler state
    
       - Prevent an out-of-bounds access in uclamp caused bu a rounding
         division which can lead to an off-by-one error exceeding the
         buckets array size.
    
       - Prevent unfairness caused by missing load decay when a task is
         attached to a cfs runqueue.
    
         The old load of the task was attached to the runqueue and never
         removed. Fix it by enforcing the load update through the hierarchy
         for unthrottled run queue instances.
    
       - A documentation fix fot the 'sched_verbose' command line option"
    
    * tag 'sched-urgent-2021-05-09' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
      sched/fair: Fix unfairness caused by missing load decay
      sched: Fix out-of-bound access in uclamp
      psi: Fix psi state corruption when schedule() races with cgroup move
      sched,doc: sched_debug_verbose cmdline should be sched_verbose
    torvalds committed May 9, 2021
  7. Merge tag 'locking-urgent-2021-05-09' of git://git.kernel.org/pub/scm…

    …/linux/kernel/git/tip/tip
    
    Pull locking fixes from Thomas Gleixner:
     "A set of locking related fixes and updates:
    
       - Two fixes for the futex syscall related to the timeout handling.
    
         FUTEX_LOCK_PI does not support the FUTEX_CLOCK_REALTIME bit and
         because it's not set the time namespace adjustment for clock
         MONOTONIC is applied wrongly.
    
         FUTEX_WAIT cannot support the FUTEX_CLOCK_REALTIME bit because its
         always a relative timeout.
    
       - Cleanups in the futex syscall entry points which became obvious
         when the two timeout handling bugs were fixed.
    
       - Cleanup of queued_write_lock_slowpath() as suggested by Linus
    
       - Fixup of the smp_call_function_single_async() prototype"
    
    * tag 'locking-urgent-2021-05-09' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
      futex: Make syscall entry points less convoluted
      futex: Get rid of the val2 conditional dance
      futex: Do not apply time namespace adjustment on FUTEX_LOCK_PI
      Revert 337f130 ("futex: Allow FUTEX_CLOCK_REALTIME with FUTEX_WAIT op")
      locking/qrwlock: Cleanup queued_write_lock_slowpath()
      smp: Fix smp_call_function_single_async prototype
    torvalds committed May 9, 2021
  8. Merge tag 'perf_urgent_for_v5.13_rc1' of git://git.kernel.org/pub/scm…

    …/linux/kernel/git/tip/tip
    
    Pull x86 perf fix from Borislav Petkov:
     "Handle power-gating of AMD IOMMU perf counters properly when they are
      used"
    
    * tag 'perf_urgent_for_v5.13_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
      x86/events/amd/iommu: Fix invalid Perf result due to IOMMU PMC power-gating
    torvalds committed May 9, 2021
  9. Merge tag 'x86_urgent_for_v5.13_rc1' of git://git.kernel.org/pub/scm/…

    …linux/kernel/git/tip/tip
    
    Pull x86 fixes from Borislav Petkov:
     "A bunch of things accumulated for x86 in the last two weeks:
    
       - Fix guest vtime accounting so that ticks happening while the guest
         is running can also be accounted to it. Along with a consolidation
         to the guest-specific context tracking helpers.
    
       - Provide for the host NMI handler running after a VMX VMEXIT to be
         able to run on the kernel stack correctly.
    
       - Initialize MSR_TSC_AUX when RDPID is supported and not RDTSCP (virt
         relevant - real hw supports both)
    
       - A code generation improvement to TASK_SIZE_MAX through the use of
         alternatives
    
       - The usual misc and related cleanups and improvements"
    
    * tag 'x86_urgent_for_v5.13_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
      KVM: x86: Consolidate guest enter/exit logic to common helpers
      context_tracking: KVM: Move guest enter/exit wrappers to KVM's domain
      context_tracking: Consolidate guest enter/exit wrappers
      sched/vtime: Move guest enter/exit vtime accounting to vtime.h
      sched/vtime: Move vtime accounting external declarations above inlines
      KVM: x86: Defer vtime accounting 'til after IRQ handling
      context_tracking: Move guest exit vtime accounting to separate helpers
      context_tracking: Move guest exit context tracking to separate helpers
      KVM/VMX: Invoke NMI non-IST entry instead of IST entry
      x86/cpu: Remove write_tsc() and write_rdtscp_aux() wrappers
      x86/cpu: Initialize MSR_TSC_AUX if RDTSCP *or* RDPID is supported
      x86/resctrl: Fix init const confusion
      x86: Delete UD0, UD1 traces
      x86/smpboot: Remove duplicate includes
      x86/cpu: Use alternative to generate the TASK_SIZE_MAX constant
    torvalds committed May 9, 2021
  10. Revert "bio: limit bio max size"

    This reverts commit cd2c754.
    
    Alex reports that the commit causes corruption with LUKS on ext4. Revert
    it for now so that this can be investigated properly.
    
    Link: https://lore.kernel.org/linux-block/1620493841.bxdq8r5haw.none@localhost/
    Reported-by: Alex Xu (Hello71) <alex_y_xu@yahoo.ca>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    axboe committed May 9, 2021

Commits on May 8, 2021

  1. Merge tag 'riscv-for-linus-5.13-mw1' of git://git.kernel.org/pub/scm/…

    …linux/kernel/git/riscv/linux
    
    Pull RISC-V fixes from Palmer Dabbelt:
    
     - A fix to avoid over-allocating the kernel's mapping on !MMU systems,
       which could lead to up to 2MiB of lost memory
    
     - The SiFive address extension errata only manifest on rv64, they are
       now disabled on rv32 where they are unnecessary
    
     - A pair of late-landing cleanups
    
    * tag 'riscv-for-linus-5.13-mw1' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
      riscv: remove unused handle_exception symbol
      riscv: Consistify protect_kernel_linear_mapping_text_rodata() use
      riscv: enable SiFive errata CIP-453 and CIP-1200 Kconfig only if CONFIG_64BIT=y
      riscv: Only extend kernel reservation if mapped read-only
    torvalds committed May 8, 2021
  2. drm/i915/display: fix compiler warning about array overrun

    intel_dp_check_mst_status() uses a 14-byte array to read the DPRX Event
    Status Indicator data, but then passes that buffer at offset 10 off as
    an argument to drm_dp_channel_eq_ok().
    
    End result: there are only 4 bytes remaining of the buffer, yet
    drm_dp_channel_eq_ok() wants a 6-byte buffer.  gcc-11 correctly warns
    about this case:
    
      drivers/gpu/drm/i915/display/intel_dp.c: In function ‘intel_dp_check_mst_status’:
      drivers/gpu/drm/i915/display/intel_dp.c:3491:22: warning: ‘drm_dp_channel_eq_ok’ reading 6 bytes from a region of size 4 [-Wstringop-overread]
       3491 |                     !drm_dp_channel_eq_ok(&esi[10], intel_dp->lane_count)) {
            |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/gpu/drm/i915/display/intel_dp.c:3491:22: note: referencing argument 1 of type ‘const u8 *’ {aka ‘const unsigned char *’}
      In file included from drivers/gpu/drm/i915/display/intel_dp.c:38:
      include/drm/drm_dp_helper.h:1466:6: note: in a call to function ‘drm_dp_channel_eq_ok’
       1466 | bool drm_dp_channel_eq_ok(const u8 link_status[DP_LINK_STATUS_SIZE],
            |      ^~~~~~~~~~~~~~~~~~~~
           6:14 elapsed
    
    This commit just extends the original array by 2 zero-initialized bytes,
    avoiding the warning.
    
    There may be some underlying bug in here that caused this confusion, but
    this is at least no worse than the existing situation that could use
    random data off the stack.
    
    Cc: Jani Nikula <jani.nikula@intel.com>
    Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
    Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
    Cc: Dave Airlie <airlied@redhat.com>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    torvalds committed May 8, 2021
  3. Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/gi…

    …t/jejb/scsi
    
    Pull more SCSI updates from James Bottomley:
     "This is a set of minor fixes in various drivers (qla2xxx, ufs,
      scsi_debug, lpfc) one doc fix and a fairly large update to the fnic
      driver to remove the open coded iteration functions in favour of the
      scsi provided ones"
    
    * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
      scsi: fnic: Use scsi_host_busy_iter() to traverse commands
      scsi: fnic: Kill 'exclude_id' argument to fnic_cleanup_io()
      scsi: scsi_debug: Fix cmd_per_lun, set to max_queue
      scsi: ufs: core: Narrow down fast path in system suspend path
      scsi: ufs: core: Cancel rpm_dev_flush_recheck_work during system suspend
      scsi: ufs: core: Do not put UFS power into LPM if link is broken
      scsi: qla2xxx: Prevent PRLI in target mode
      scsi: qla2xxx: Add marginal path handling support
      scsi: target: tcmu: Return from tcmu_handle_completions() if cmd_id not found
      scsi: ufs: core: Fix a typo in ufs-sysfs.c
      scsi: lpfc: Fix bad memory access during VPD DUMP mailbox command
      scsi: lpfc: Fix DMA virtual address ptr assignment in bsg
      scsi: lpfc: Fix illegal memory access on Abort IOCBs
      scsi: blk-mq: Fix build warning when making htmldocs
    torvalds committed May 8, 2021
  4. Merge tag 'kbuild-v5.13-2' of git://git.kernel.org/pub/scm/linux/kern…

    …el/git/masahiroy/linux-kbuild
    
    Pull more Kbuild updates from Masahiro Yamada:
    
     - Convert sh and sparc to use generic shell scripts to generate the
       syscall headers
    
     - refactor .gitignore files
    
     - Update kernel/config_data.gz only when the content of the .config
       is really changed, which avoids the unneeded re-link of vmlinux
    
     - move "remove stale files" workarounds to scripts/remove-stale-files
    
     - suppress unused-but-set-variable warnings by default for Clang
       as well
    
     - fix locale setting LANG=C to LC_ALL=C
    
     - improve 'make distclean'
    
     - always keep intermediate objects from scripts/link-vmlinux.sh
    
     - move IF_ENABLED out of <linux/kconfig.h> to make it self-contained
    
     - misc cleanups
    
    * tag 'kbuild-v5.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (25 commits)
      linux/kconfig.h: replace IF_ENABLED() with PTR_IF() in <linux/kernel.h>
      kbuild: Don't remove link-vmlinux temporary files on exit/signal
      kbuild: remove the unneeded comments for external module builds
      kbuild: make distclean remove tag files in sub-directories
      kbuild: make distclean work against $(objtree) instead of $(srctree)
      kbuild: refactor modname-multi by using suffix-search
      kbuild: refactor fdtoverlay rule
      kbuild: parameterize the .o part of suffix-search
      arch: use cross_compiling to check whether it is a cross build or not
      kbuild: remove ARCH=sh64 support from top Makefile
      .gitignore: prefix local generated files with a slash
      kbuild: replace LANG=C with LC_ALL=C
      Makefile: Move -Wno-unused-but-set-variable out of GCC only block
      kbuild: add a script to remove stale generated files
      kbuild: update config_data.gz only when the content of .config is changed
      .gitignore: ignore only top-level modules.builtin
      .gitignore: move tags and TAGS close to other tag files
      kernel/.gitgnore: remove stale timeconst.h and hz.bc
      usr/include: refactor .gitignore
      genksyms: fix stale comment
      ...
    torvalds committed May 8, 2021
  5. smb3: if max_channels set to more than one channel request multichannel

    Mounting with "multichannel" is obviously implied if user requested
    more than one channel on mount (ie mount parm max_channels>1).
    Currently both have to be specified. Fix that so that if max_channels
    is greater than 1 on mount, enable multichannel rather than silently
    falling back to non-multichannel.
    
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Reviewed-By: Tom Talpey <tom@talpey.com>
    Cc: <stable@vger.kernel.org> # v5.11+
    Reviewed-by: Shyam Prasad N <sprasad@microsoft.com>
    Steve French committed May 8, 2021
  6. smb3: do not attempt multichannel to server which does not support it

    We were ignoring CAP_MULTI_CHANNEL in the server response - if the
    server doesn't support multichannel we should not be attempting it.
    
    See MS-SMB2 section 3.2.5.2
    
    Reviewed-by: Shyam Prasad N <sprasad@microsoft.com>
    Reviewed-By: Tom Talpey <tom@talpey.com>
    Cc: <stable@vger.kernel.org> # v5.8+
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Steve French committed May 8, 2021
Older