1. 12 Jun, 2021 15 commits
    • Linus Torvalds's avatar
      Merge tag 'riscv-for-linus-5.13-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux · 8ecfa36c
      Linus Torvalds authored
      Pull RISC-V fixes from Palmer Dabbelt:
      
       - A pair of XIP fixes: one to fix alternatives, and one to turn off the
         rest of the features that require code modification
      
       - A fix to a type that was causing some alternatives to break
      
       - A build fix for BUILTIN_DTB
      
      * tag 'riscv-for-linus-5.13-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
        riscv: Fix BUILTIN_DTB for sifive and microchip soc
        riscv: alternative: fix typo in macro name
        riscv: code patching only works on !XIP_KERNEL
        riscv: xip: support runtime trap patching
      8ecfa36c
    • Feng Tang's avatar
      mm: relocate 'write_protect_seq' in struct mm_struct · 2e302543
      Feng Tang authored
      0day robot reported a 9.2% regression for will-it-scale mmap1 test
      case[1], caused by commit 57efa1fe ("mm/gup: prevent gup_fast from
      racing with COW during fork").
      
      Further debug shows the regression is due to that commit changes the
      offset of hot fields 'mmap_lock' inside structure 'mm_struct', thus some
      cache alignment changes.
      
      From the perf data, the contention for 'mmap_lock' is very severe and
      takes around 95% cpu cycles, and it is a rw_semaphore
      
              struct rw_semaphore {
                      atomic_long_t count;	/* 8 bytes */
                      atomic_long_t owner;	/* 8 bytes */
                      struct optimistic_spin_queue osq; /* spinner MCS lock */
                      ...
      
      Before commit 57efa1fe adds the 'write_protect_seq', it happens to
      have a very optimal cache alignment layout, as Linus explained:
      
       "and before the addition of the 'write_protect_seq' field, the
        mmap_sem was at offset 120 in 'struct mm_struct'.
      
        Which meant that count and owner were in two different cachelines,
        and then when you have contention and spend time in
        rwsem_down_write_slowpath(), this is probably *exactly* the kind
        of layout you want.
      
        Because first the rwsem_write_trylock() will do a cmpxchg on the
        first cacheline (for the optimistic fast-path), and then in the
        case of contention, rwsem_down_write_slowpath() will just access
        the second cacheline.
      
        Which is probably just optimal for a load that spends a lot of
        time contended - new waiters touch that first cacheline, and then
        they queue themselves up on the second cacheline."
      
      After the commit, the rw_semaphore is at offset 128, which means the
      'count' and 'owner' fields are now in the same cacheline, and causes
      more cache bouncing.
      
      Currently there are 3 "#ifdef CONFIG_XXX" before 'mmap_lock' which will
      affect its offset:
      
        CONFIG_MMU
        CONFIG_MEMBARRIER
        CONFIG_HAVE_ARCH_COMPAT_MMAP_BASES
      
      The layout above is on 64 bits system with 0day's default kernel config
      (similar to RHEL-8.3's config), in which all these 3 options are 'y'.
      And the layout can vary with different kernel configs.
      
      Relayouting a structure is usually a double-edged sword, as sometimes it
      can helps one case, but hurt other cases.  For this case, one solution
      is, as the newly added 'write_protect_seq' is a 4 bytes long seqcount_t
      (when CONFIG_DEBUG_LOCK_ALLOC=n), placing it into an existing 4 bytes
      hole in 'mm_struct' will not change other fields' alignment, while
      restoring the regression.
      
      Link: https://lore.kernel.org/lkml/20210525031636.GB7744@xsang-OptiPlex-9020/ [1]
      Reported-by: default avatarkernel test robot <oliver.sang@intel.com>
      Signed-off-by: default avatarFeng Tang <feng.tang@intel.com>
      Reviewed-by: default avatarJohn Hubbard <jhubbard@nvidia.com>
      Reviewed-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Cc: Peter Xu <peterx@redhat.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      2e302543
    • Linus Torvalds's avatar
      Merge tag 'usb-5.13-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · 43cb5d49
      Linus Torvalds authored
      Pull USB fixes from Greg KH:
       "Here are a number of tiny USB fixes for 5.13-rc6.
      
        There are more than I would normally like, but there's been a bunch of
        people banging on the gadget and dwc3 and typec code recently for I
        think an Android release, which has resulted in a number of small
        fixes. It's nice to see companies send fixes upstream for this type of
        work, a notable change from years ago.
      
        Anyway, fixes in here are:
      
         - usb-serial device id updates
      
         - usb-serial cp210x driver fixes for broken firmware versions
      
         - typec fixes for crazy charging devices and other reported problems
      
         - dwc3 fixes for reported problems found
      
         - gadget fixes for reported problems
      
         - tiny xhci fixes
      
         - other small fixes for reported issues.
      
         - revert of a problem fix found by linux-next testing
      
        All of these have passed 0-day and linux-next testing with no reported
        problems (the revert for the found linux-next build problem included)"
      
      * tag 'usb-5.13-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (44 commits)
        Revert "usb: gadget: fsl: Re-enable driver for ARM SoCs"
        usb: typec: mux: Fix copy-paste mistake in typec_mux_match
        usb: typec: ucsi: Clear PPM capability data in ucsi_init() error path
        usb: gadget: fsl: Re-enable driver for ARM SoCs
        usb: typec: wcove: Use LE to CPU conversion when accessing msg->header
        USB: serial: cp210x: fix CP2102N-A01 modem control
        USB: serial: cp210x: fix alternate function for CP2102N QFN20
        usb: misc: brcmstb-usb-pinmap: check return value after calling platform_get_resource()
        usb: dwc3: ep0: fix NULL pointer exception
        usb: gadget: eem: fix wrong eem header operation
        usb: typec: intel_pmc_mux: Put ACPI device using acpi_dev_put()
        usb: typec: intel_pmc_mux: Add missed error check for devm_ioremap_resource()
        usb: typec: intel_pmc_mux: Put fwnode in error case during ->probe()
        usb: typec: tcpm: Do not finish VDM AMS for retrying Responses
        usb: fix various gadget panics on 10gbps cabling
        usb: fix various gadgets null ptr deref on 10gbps cabling.
        usb: pci-quirks: disable D3cold on xhci suspend for s2idle on AMD Renoir
        usb: f_ncm: only first packet of aggregate needs to start timer
        USB: f_ncm: ncm_bitrate (speed) is unsigned
        MAINTAINERS: usb: add entry for isp1760
        ...
      43cb5d49
    • Linus Torvalds's avatar
      Merge tag 'tty-5.13-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty · c46fe4aa
      Linus Torvalds authored
      Pull serial driver fix from Greg KH:
       "A single 8250_exar serial driver fix for a reported problem with a
        change that happened in 5.13-rc1.
      
        It has been in linux-next with no reported problems"
      
      * tag 'tty-5.13-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
        serial: 8250_exar: Avoid NULL pointer dereference at ->exit()
      c46fe4aa
    • Linus Torvalds's avatar
      Merge tag 'staging-5.13-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging · 0d506588
      Linus Torvalds authored
      Pull staging driver fixes from Greg KH:
       "Two tiny staging driver fixes:
      
         - ralink-gdma driver authorship information fixed up
      
         - rtl8723bs driver fix for reported regression
      
        Both have been in linux-next for a while with no reported problems"
      
      * tag 'staging-5.13-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
        staging: ralink-gdma: Remove incorrect author information
        staging: rtl8723bs: Fix uninitialized variables
      0d506588
    • Linus Torvalds's avatar
      Merge tag 'driver-core-5.13-rc6' of... · 87a7f736
      Linus Torvalds authored
      Merge tag 'driver-core-5.13-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
      
      Pull driver core fix from Greg KH:
       "A single debugfs fix for 5.13-rc6, fixing a bug in
        debugfs_read_file_str() that showed up in 5.13-rc1.
      
        It has been in linux-next for a full week with no
        reported problems"
      
      * tag 'driver-core-5.13-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
        debugfs: Fix debugfs_read_file_str()
      87a7f736
    • Linus Torvalds's avatar
      Merge tag 'char-misc-5.13-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · 1dfa2e77
      Linus Torvalds authored
      Pull char/misc driver fixes from Greg KH:
       "Here are some small misc driver fixes for 5.13-rc6 that fix some
        reported problems:
      
         - Tiny phy driver fixes for reported issues
      
         - rtsx regression for when the device suspended
      
         - mhi driver fix for a use-after-free
      
        All of these have been in linux-next for a few days with no reported
        issues"
      
      * tag 'char-misc-5.13-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
        misc: rtsx: separate aspm mode into MODE_REG and MODE_CFG
        bus: mhi: pci-generic: Fix hibernation
        bus: mhi: pci_generic: Fix possible use-after-free in mhi_pci_remove()
        bus: mhi: pci_generic: T99W175: update channel name from AT to DUN
        phy: Sparx5 Eth SerDes: check return value after calling platform_get_resource()
        phy: ralink: phy-mt7621-pci: drop 'of_match_ptr' to fix -Wunused-const-variable
        phy: ti: Fix an error code in wiz_probe()
        phy: phy-mtk-tphy: Fix some resource leaks in mtk_phy_init()
        phy: cadence: Sierra: Fix error return code in cdns_sierra_phy_probe()
        phy: usb: Fix misuse of IS_ENABLED
      1dfa2e77
    • Linus Torvalds's avatar
      Merge tag 'pinctrl-v5.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl · 141415d7
      Linus Torvalds authored
      Pull pin control fixes from Linus Walleij:
      
       - Fix some documentation warnings for Allwinner
      
       - Fix duplicated GPIO groups on Qualcomm SDX55
      
       - Fix a double enablement bug in the Ralink driver
      
       - Fix the Qualcomm SC8180x Kconfig so the driver can be selected.
      
      * tag 'pinctrl-v5.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
        pinctrl: qcom: Make it possible to select SC8180x TLMM
        pinctrl: ralink: rt2880: avoid to error in calls is pin is already enabled
        pinctrl: qcom: Fix duplication in gpio_groups
        pinctrl: aspeed: Fix minor documentation error
      141415d7
    • Linus Torvalds's avatar
      Merge tag 'block-5.13-2021-06-12' of git://git.kernel.dk/linux-block · efc1fd60
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
       "A few fixes that should go into 5.13:
      
         - Fix a regression deadlock introduced in this release between open
           and remove of a bdev (Christoph)
      
         - Fix an async_xor md regression in this release (Xiao)
      
         - Fix bcache oversized read issue (Coly)"
      
      * tag 'block-5.13-2021-06-12' of git://git.kernel.dk/linux-block:
        block: loop: fix deadlock between open and remove
        async_xor: check src_offs is not NULL before updating it
        bcache: avoid oversized read request in cache missing code path
        bcache: remove bcache device self-defined readahead
      efc1fd60
    • Linus Torvalds's avatar
      Merge tag 'io_uring-5.13-2021-06-12' of git://git.kernel.dk/linux-block · b2568eeb
      Linus Torvalds authored
      Pull io_uring fixes from Jens Axboe:
       "Just an API change for the registration changes that went into this
        release. Better to get it sorted out now than before it's too late"
      
      * tag 'io_uring-5.13-2021-06-12' of git://git.kernel.dk/linux-block:
        io_uring: add feature flag for rsrc tags
        io_uring: change registration/upd/rsrc tagging ABI
      b2568eeb
    • Linus Torvalds's avatar
      Merge tag 'sched-urgent-2021-06-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 99f92594
      Linus Torvalds authored
      Pull scheduler fixes from Ingo Molnar:
       "Misc fixes:
      
         - Fix performance regression caused by lack of intended batching of
           RCU callbacks by over-eager NOHZ-full code.
      
         - Fix cgroups related corruption of load_avg and load_sum metrics.
      
         - Three fixes to fix blocked load, util_sum/runnable_sum and util_est
           tracking bugs"
      
      * tag 'sched-urgent-2021-06-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        sched/fair: Fix util_est UTIL_AVG_UNCHANGED handling
        sched/pelt: Ensure that *_sum is always synced with *_avg
        tick/nohz: Only check for RCU deferred wakeup on user/guest entry when needed
        sched/fair: Make sure to update tg contrib for blocked load
        sched/fair: Keep load_avg and load_sum synced
      99f92594
    • Linus Torvalds's avatar
      Merge tag 'perf-urgent-2021-06-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 191aaf6c
      Linus Torvalds authored
      Pull perf fixes from Ingo Molnar:
       "Misc fixes:
      
         - Fix the NMI watchdog on ancient Intel CPUs
      
         - Remove a misguided, NMI-unsafe KASAN callback from the NMI-safe
           irq_work path used by perf.
      
         - Fix uncore events on Ice Lake servers.
      
         - Someone booted maxcpus=1 on an SNB-EP, and the uncore driver
           emitted warnings and was probably buggy. Fix it.
      
         - KCSAN found a genuine data race in the core perf code. Somewhat
           ironically the bug was introduced through a recent race fix. :-/
           In our defense, the new race window was much more narrow. Fix it"
      
      * tag 'perf-urgent-2021-06-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/nmi_watchdog: Fix old-style NMI watchdog regression on old Intel CPUs
        irq_work: Make irq_work_queue() NMI-safe again
        perf/x86/intel/uncore: Fix M2M event umask for Ice Lake server
        perf/x86/intel/uncore: Fix a kernel WARNING triggered by maxcpus=1
        perf: Fix data race between pin_count increment/decrement
      191aaf6c
    • Linus Torvalds's avatar
      Merge tag 'objtool-urgent-2021-06-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 768895fb
      Linus Torvalds authored
      Pull objtool fixes from Ingo Molnar:
       "Two objtool fixes:
      
         - fix a bug that corrupts the code by mistakenly rewriting
           conditional jumps
      
         - fix another bug generating an incorrect ELF symbol table
           during retpoline rewriting"
      
      * tag 'objtool-urgent-2021-06-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        objtool: Only rewrite unconditional retpoline thunk calls
        objtool: Fix .symtab_shndx handling for elf_create_undef_symbol()
      768895fb
    • Alexandre Ghiti's avatar
      riscv: Fix BUILTIN_DTB for sifive and microchip soc · 0ddd7eaf
      Alexandre Ghiti authored
      Fix BUILTIN_DTB config which resulted in a dtb that was actually not
      built into the Linux image: in the same manner as Canaan soc does,
      create an object file from the dtb file that will get linked into the
      Linux image.
      Signed-off-by: default avatarAlexandre Ghiti <alex@ghiti.fr>
      Signed-off-by: default avatarPalmer Dabbelt <palmerdabbelt@google.com>
      0ddd7eaf
    • Linus Torvalds's avatar
      Merge tag 'trace-v5.13-rc5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace · ad347abe
      Linus Torvalds authored
      Pull tracing fixes from Steven Rostedt:
      
       - Fix the length check in the temp buffer filter
      
       - Fix build failure in bootconfig tools for "fallthrough" macro
      
       - Fix error return of bootconfig apply_xbc() routine
      
      * tag 'trace-v5.13-rc5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
        tracing: Correct the length check which causes memory corruption
        ftrace: Do not blindly read the ip address in ftrace_bug()
        tools/bootconfig: Fix a build error accroding to undefined fallthrough
        tools/bootconfig: Fix error return code in apply_xbc()
      ad347abe
  2. 11 Jun, 2021 20 commits
  3. 10 Jun, 2021 5 commits
    • Jisheng Zhang's avatar
      riscv: code patching only works on !XIP_KERNEL · 42e0e0b4
      Jisheng Zhang authored
      Some features which need code patching such as KPROBES, DYNAMIC_FTRACE
      KGDB can only work on !XIP_KERNEL. Add dependencies for these features
      that rely on code patching.
      Signed-off-by: default avatarJisheng Zhang <jszhang@kernel.org>
      Signed-off-by: default avatarPalmer Dabbelt <palmerdabbelt@google.com>
      42e0e0b4
    • Vitaly Wool's avatar
      riscv: xip: support runtime trap patching · 5e63215c
      Vitaly Wool authored
      RISCV_ERRATA_ALTERNATIVE patches text at runtime which is currently
      not possible when the kernel is executed from the flash in XIP mode.
      Since runtime patching concerns only traps at the moment, let's just
      have all the traps reside in RAM anyway if RISCV_ERRATA_ALTERNATIVE
      is set. Thus, these functions will be patch-able even when the .text
      section is in flash.
      Signed-off-by: default avatarVitaly Wool <vitaly.wool@konsulko.com>
      Signed-off-by: default avatarPalmer Dabbelt <palmerdabbelt@google.com>
      5e63215c
    • Pavel Begunkov's avatar
      io_uring: add feature flag for rsrc tags · 9690557e
      Pavel Begunkov authored
      Add IORING_FEAT_RSRC_TAGS indicating that io_uring supports a bunch of
      new IORING_REGISTER operations, in particular
      IORING_REGISTER_[FILES[,UPDATE]2,BUFFERS[2,UPDATE]] that support rsrc
      tagging, and also indicating implemented dynamic fixed buffer updates.
      Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
      Link: https://lore.kernel.org/r/9b995d4045b6c6b4ab7510ca124fd25ac2203af7.1623339162.git.asml.silence@gmail.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
      9690557e
    • Pavel Begunkov's avatar
      io_uring: change registration/upd/rsrc tagging ABI · 992da01a
      Pavel Begunkov authored
      There are ABI moments about recently added rsrc registration/update and
      tagging that might become a nuisance in the future. First,
      IORING_REGISTER_RSRC[_UPD] hide different types of resources under it,
      so breaks fine control over them by restrictions. It works for now, but
      once those are wanted under restrictions it would require a rework.
      
      It was also inconvenient trying to fit a new resource not supporting
      all the features (e.g. dynamic update) into the interface, so better
      to return to IORING_REGISTER_* top level dispatching.
      
      Second, register/update were considered to accept a type of resource,
      however that's not a good idea because there might be several ways of
      registration of a single resource type, e.g. we may want to add
      non-contig buffers or anything more exquisite as dma mapped memory.
      So, remove IORING_RSRC_[FILE,BUFFER] out of the ABI, and place them
      internally for now to limit changes.
      Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
      Link: https://lore.kernel.org/r/9b554897a7c17ad6e3becc48dfed2f7af9f423d5.1623339162.git.asml.silence@gmail.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
      992da01a
    • Eric W. Biederman's avatar
      coredump: Limit what can interrupt coredumps · 06af8679
      Eric W. Biederman authored
      Olivier Langlois has been struggling with coredumps being incompletely written in
      processes using io_uring.
      
      Olivier Langlois <olivier@trillion01.com> writes:
      > io_uring is a big user of task_work and any event that io_uring made a
      > task waiting for that occurs during the core dump generation will
      > generate a TIF_NOTIFY_SIGNAL.
      >
      > Here are the detailed steps of the problem:
      > 1. io_uring calls vfs_poll() to install a task to a file wait queue
      >    with io_async_wake() as the wakeup function cb from io_arm_poll_handler()
      > 2. wakeup function ends up calling task_work_add() with TWA_SIGNAL
      > 3. task_work_add() sets the TIF_NOTIFY_SIGNAL bit by calling
      >    set_notify_signal()
      
      The coredump code deliberately supports being interrupted by SIGKILL,
      and depends upon prepare_signal to filter out all other signals.   Now
      that signal_pending includes wake ups for TIF_NOTIFY_SIGNAL this hack
      in dump_emitted by the coredump code no longer works.
      
      Make the coredump code more robust by explicitly testing for all of
      the wakeup conditions the coredump code supports.  This prevents
      new wakeup conditions from breaking the coredump code, as well
      as fixing the current issue.
      
      The filesystem code that the coredump code uses already limits
      itself to only aborting on fatal_signal_pending.  So it should
      not develop surprising wake-up reasons either.
      
      v2: Don't remove the now unnecessary code in prepare_signal.
      
      Cc: stable@vger.kernel.org
      Fixes: 12db8b69 ("entry: Add support for TIF_NOTIFY_SIGNAL")
      Reported-by: default avatarOlivier Langlois <olivier@trillion01.com>
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      06af8679