1. 10 Dec, 2020 2 commits
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma · 9fca90cf
      Linus Torvalds authored
      Pull rdma fixes from Jason Gunthorpe:
       "Two user triggerable crashers and a some EFA related regressions:
      
         - Syzkaller found a bug in CM
      
         - Restore access to the GID table and fix modify_qp for EFA
      
         - Crasher in qedr"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma:
        RDMA/cm: Fix an attempt to use non-valid pointer when cleaning timewait
        RDMA/core: Fix empty gid table for non IB/RoCE devices
        RDMA/efa: Use the correct current and new states in modify QP
        RDMA/qedr: iWARP invalid(zero) doorbell address fix
      9fca90cf
    • Linus Torvalds's avatar
      Merge tag 'media/v5.10-4' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media · 40201575
      Linus Torvalds authored
      Pull media fixes from Mauro Carvalho Chehab:
       "A couple of fixes:
      
         - videobuf2: fix a DMABUF bug, preventing it to properly handle cache
           sync/flush
      
         - vidtv: an usage after free and a few sparse/smatch warning fixes
      
         - pulse8-cec: a duplicate free and a bug related to new firmware
           usage
      
         - mtk-cir: fix a regression on a clock setting"
      
      * tag 'media/v5.10-4' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
        media: vidtv: fix some warnings
        media: vidtv: fix kernel-doc markups
        media: [next] media: vidtv: fix a read from an object after it has been freed
        media: vb2: set cache sync hints when init buffers
        media: pulse8-cec: add support for FW v10 and up
        media: pulse8-cec: fix duplicate free at disconnect or probe error
        media: mtk-cir: fix calculation of chk period
      40201575
  2. 09 Dec, 2020 6 commits
    • Linus Torvalds's avatar
      Merge tag 'arm-soc-fixes-v5.10-4b' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · a2f5ea9e
      Linus Torvalds authored
      Pull ARM SoC fixes from Arnd Bergmann:
       "There are a few more PHY mode changes for allwinner SoC based boards
        with a Realtek PHY after the driver changed its behavior, I assume
        there will be more of these in the future. Also on for Allwinner, the
        Banana Pi M2 board had a regression that led to some devices not
        working because of a slightly incorrect voltage being applied.
      
        By popular demand, I picked up a change from Krzysztof Kozlowski to
        actually list the SoC tree in the MAINTAINERS file. We don't want to
        get Cc'd on normal patches that are picked up by platform maintainers,
        but the lack of an entry has led to confusion in the past.
      
        All the other changes are fairly benign, fixing boot-time or
        compile-time warning messages in various places:
      
         - A dtc warning on the OLPC XO-1.75
      
         - A boot-time warning on i.MX6 wandboard
      
         - A harmless compile-time warning
      
         - A regression causing one of the i.MX6 SoCs to be identified as
           another
      
         - Missing SoC identification of Allwinner V3 and S3"
      
      * tag 'arm-soc-fixes-v5.10-4b' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc:
        firmware: xilinx: Mark pm_api_features_map with static keyword
        ARM: dts: mmp2-olpc-xo-1-75: clear the warnings when make dtbs
        MAINTAINERS: add a limited ARM and ARM64 SoC entry
        MAINTAINERS: correct SoC Git address (formerly: arm-soc)
        ARM: keystone: remove SECTION_SIZE_BITS/MAX_PHYSMEM_BITS
        arm64: dts: allwinner: H5: NanoPi Neo Plus2: phy-mode rgmii-id
        arm64: dts: allwinner: A64 Sopine: phy-mode rgmii-id
        ARM: dts: imx6qdl-kontron-samx6i: fix I2C_PM scl pin
        ARM: dts: imx6qdl-wandboard-revd1: Remove PAD_GPIO_6 from enetgrp
        ARM: imx: Use correct SRC base address
        ARM: dts: sun7i: pcduino3-nano: enable RGMII RX/TX delay on PHY
        ARM: dts: sun8i: v3s: fix GIC node memory range
        ARM: dts: sun8i: v40: bananapi-m2-berry: Fix ethernet node
        ARM: dts: sun8i: r40: bananapi-m2-berry: Fix dcdc1 regulator
        ARM: dts: sun7i: bananapi: Enable RGMII RX/TX delay on Ethernet PHY
        ARM: dts: s3: pinecube: align compatible property to other S3 boards
        ARM: sunxi: Add machine match for the Allwinner V3 SoC
        arm64: dts: allwinner: h6: orangepi-one-plus: Fix ethernet
      a2f5ea9e
    • Zou Wei's avatar
      firmware: xilinx: Mark pm_api_features_map with static keyword · 69fe24d1
      Zou Wei authored
      Fix the following sparse warning:
      
      drivers/firmware/xilinx/zynqmp.c:32:1: warning: symbol 'pm_api_features_map' was not declared. Should it be static?
      Signed-off-by: default avatarZou Wei <zou_wei@huawei.com>
      Link: https://lore.kernel.org/r/1606823513-121578-1-git-send-email-zou_wei@huawei.comSigned-off-by: default avatarMichal Simek <michal.simek@xilinx.com>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      69fe24d1
    • Zhen Lei's avatar
      ARM: dts: mmp2-olpc-xo-1-75: clear the warnings when make dtbs · 387270cb
      Zhen Lei authored
      The check_spi_bus_bridge() in scripts/dtc/checks.c requires that the node
      have "spi-slave" property must with "#address-cells = <0>" and
      "#size-cells = <0>". But currently both "#address-cells" and "#size-cells"
      properties are deleted, the corresponding default values are 2 and 1. As a
      result, the check fails and below warnings is displayed.
      
      arch/arm/boot/dts/mmp2.dtsi:472.23-480.6: Warning (spi_bus_bridge): \
      /soc/apb@d4000000/spi@d4037000: incorrect #address-cells for SPI bus
        also defined at arch/arm/boot/dts/mmp2-olpc-xo-1-75.dts:225.7-237.3
      arch/arm/boot/dts/mmp2.dtsi:472.23-480.6: Warning (spi_bus_bridge): \
      /soc/apb@d4000000/spi@d4037000: incorrect #size-cells for SPI bus
        also defined at arch/arm/boot/dts/mmp2-olpc-xo-1-75.dts:225.7-237.3
      arch/arm/boot/dts/mmp2-olpc-xo-1-75.dtb: Warning (spi_bus_reg): \
      Failed prerequisite 'spi_bus_bridge'
      
      Because the value of "#size-cells" is already defined as zero in the node
      "ssp3: spi@d4037000" in arch/arm/boot/dts/mmp2.dtsi. So we only need to
      explicitly add "#address-cells = <0>" and keep "#size-cells" no change.
      Signed-off-by: default avatarZhen Lei <thunder.leizhen@huawei.com>
      Link: https://lore.kernel.org/r/20201207084752.1665-2-thunder.leizhen@huawei.com'
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      387270cb
    • Leon Romanovsky's avatar
      RDMA/cm: Fix an attempt to use non-valid pointer when cleaning timewait · 340b940e
      Leon Romanovsky authored
      If cm_create_timewait_info() fails, the timewait_info pointer will contain
      an error value and will be used in cm_remove_remote() later.
      
        general protection fault, probably for non-canonical address 0xdffffc0000000024: 0000 [#1] SMP KASAN PTI
        KASAN: null-ptr-deref in range [0×0000000000000120-0×0000000000000127]
        CPU: 2 PID: 12446 Comm: syz-executor.3 Not tainted 5.10.0-rc5-5d4c0742a60e #27
        Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
        RIP: 0010:cm_remove_remote.isra.0+0x24/0×170 drivers/infiniband/core/cm.c:978
        Code: 84 00 00 00 00 00 41 54 55 53 48 89 fb 48 8d ab 2d 01 00 00 e8 7d bf 4b fe 48 89 ea 48 b8 00 00 00 00 00 fc ff df 48 c1 ea 03 <0f> b6 04 02 48 89 ea 83 e2 07 38 d0 7f 08 84 c0 0f 85 fc 00 00 00
        RSP: 0018:ffff888013127918 EFLAGS: 00010006
        RAX: dffffc0000000000 RBX: fffffffffffffff4 RCX: ffffc9000a18b000
        RDX: 0000000000000024 RSI: ffffffff82edc573 RDI: fffffffffffffff4
        RBP: 0000000000000121 R08: 0000000000000001 R09: ffffed1002624f1d
        R10: 0000000000000003 R11: ffffed1002624f1c R12: ffff888107760c70
        R13: ffff888107760c40 R14: fffffffffffffff4 R15: ffff888107760c9c
        FS:  00007fe1ffcc1700(0000) GS:ffff88811a600000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: 0000001b2ff21000 CR3: 000000010f504001 CR4: 0000000000370ee0
        DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
        DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
        Call Trace:
         cm_destroy_id+0x189/0×15b0 drivers/infiniband/core/cm.c:1155
         cma_connect_ib drivers/infiniband/core/cma.c:4029 [inline]
         rdma_connect_locked+0x1100/0×17c0 drivers/infiniband/core/cma.c:4107
         rdma_connect+0x2a/0×40 drivers/infiniband/core/cma.c:4140
         ucma_connect+0x277/0×340 drivers/infiniband/core/ucma.c:1069
         ucma_write+0x236/0×2f0 drivers/infiniband/core/ucma.c:1724
         vfs_write+0x220/0×830 fs/read_write.c:603
         ksys_write+0x1df/0×240 fs/read_write.c:658
         do_syscall_64+0x33/0×40 arch/x86/entry/common.c:46
         entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      Fixes: a977049d ("[PATCH] IB: Add the kernel CM implementation")
      Link: https://lore.kernel.org/r/20201204064205.145795-1-leon@kernel.orgReviewed-by: default avatarMaor Gottlieb <maorg@nvidia.com>
      Reported-by: default avatarAmit Matityahu <mitm@nvidia.com>
      Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      340b940e
    • Linus Torvalds's avatar
      Merge tag 'iommu-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux · ca4bbdaf
      Linus Torvalds authored
      Pull iommu fix from Will Deacon:
       "Fix interrupt table length definition for AMD IOMMU.
      
        It's actually a fix for a fix, where the size of the interrupt
        remapping table was increased but a related constant for the
        size of the interrupt table was forgotten"
      
      * tag 'iommu-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
        iommu/amd: Set DTE[IntTabLen] to represent 512 IRTEs
      ca4bbdaf
    • Minchan Kim's avatar
      mm/madvise: remove racy mm ownership check · a68a0262
      Minchan Kim authored
      Jann spotted the security hole due to race of mm ownership check.
      
      If the task is sharing the mm_struct but goes through execve() before
      mm_access(), it could skip process_madvise_behavior_valid check.  That
      makes *any advice hint* to reach into the remote process.
      
      This patch removes the mm ownership check.  With it, it will lose the
      ability that local process could give *any* advice hint with vector
      interface for some reason (e.g., performance).  Since there is no
      concrete example in upstream yet, it would be better to remove the
      abiliity at this moment and need to review when such new advice comes
      up.
      
      Fixes: ecb8ac8b ("mm/madvise: introduce process_madvise() syscall: an external memory hinting API")
      Reported-by: default avatarJann Horn <jannh@google.com>
      Suggested-by: default avatarJann Horn <jannh@google.com>
      Signed-off-by: default avatarMinchan Kim <minchan@kernel.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a68a0262
  3. 08 Dec, 2020 7 commits
  4. 07 Dec, 2020 8 commits
  5. 06 Dec, 2020 17 commits
    • Linus Torvalds's avatar
      Linux 5.10-rc7 · 0477e928
      Linus Torvalds authored
      0477e928
    • Linus Torvalds's avatar
      Merge tag 'char-misc-5.10-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · ab91292c
      Linus Torvalds authored
      Pull char/misc driver fixes from Greg KH:
       "Here are some small driver fixes, and one "large" revert, for
        5.10-rc7.
      
        They include:
      
         - revert mei patch from 5.10-rc1 that was using a reserved userspace
           value. It will be resubmitted once the proper id has been assigned
           by the virtio people.
      
         - habanalabs fixes found by the fall-through audit from Gustavo
      
         - speakup driver fixes for reported issues
      
         - fpga config build fix for reported issue.
      
        All of these except the revert have been in linux-next with no
        reported issues. The revert is "clean" and just removes a
        previously-added driver, so no real issue there"
      
      * tag 'char-misc-5.10-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
        Revert "mei: virtio: virtualization frontend driver"
        fpga: Specify HAS_IOMEM dependency for FPGA_DFL
        habanalabs: put devices before driver removal
        habanalabs: free host huge va_range if not used
        speakup: Reject setting the speakup line discipline outside of speakup
      ab91292c
    • Linus Torvalds's avatar
      Merge tag 'tty-5.10-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty · d49248eb
      Linus Torvalds authored
      Pull tty fixes from Greg KH:
       "Here are two tty core fixes for 5.10-rc7.
      
        They resolve some reported locking issues in the tty core. While they
        have not been in a released linux-next yet, they have passed all of
        the 0-day bot testing as well as the submitter's testing"
      
      * tag 'tty-5.10-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
        tty: Fix ->session locking
        tty: Fix ->pgrp locking in tiocspgrp()
      d49248eb
    • Linus Torvalds's avatar
      Merge tag 'usb-5.10-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · f5226f1d
      Linus Torvalds authored
      Pull USB fixes from Greg KH:
       "Here are some small USB fixes for 5.10-rc7 that resolve a number of
        reported issues, and add some new device ids.
      
        Nothing major here, but these solve some problems that people were
        having with the 5.10-rc tree:
      
         - reverts for USB storage dma settings that broke working devices
      
         - thunderbolt use-after-free fix
      
         - cdns3 driver fixes
      
         - gadget driver userspace copy fix
      
         - new device ids
      
        All of these except for the reverts have been in linux-next with no
        reported issues. The reverts are "clean" and were tested by Hans, as
        well as passing the 0-day tests"
      
      * tag 'usb-5.10-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
        usb: gadget: f_fs: Use local copy of descriptors for userspace copy
        usb: ohci-omap: Fix descriptor conversion
        Revert "usb-storage: fix sdev->host->dma_dev"
        Revert "uas: fix sdev->host->dma_dev"
        Revert "uas: bump hw_max_sectors to 2048 blocks for SS or faster drives"
        USB: serial: kl5kusb105: fix memleak on open
        USB: serial: ch341: sort device-id entries
        USB: serial: ch341: add new Product ID for CH341A
        USB: serial: option: fix Quectel BG96 matching
        usb: cdns3: core: fix goto label for error path
        usb: cdns3: gadget: clear trb->length as zero after preparing every trb
        usb: cdns3: Fix hardware based role switch
        USB: serial: option: add support for Thales Cinterion EXS82
        USB: serial: option: add Fibocom NL668 variants
        thunderbolt: Fix use-after-free in remove_unplugged_switch()
      f5226f1d
    • Linus Torvalds's avatar
      Merge tag 'x86-urgent-2020-12-06' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 8100a580
      Linus Torvalds authored
      Pull x86 fixes from Thomas Gleixner:
       "A set of fixes for x86:
      
         - Make the AMD L3 QoS code and data priorization enable/disable
           mechanism work correctly.
      
           The control bit was only set/cleared on one of the CPUs in a L3
           domain, but it has to be modified on all CPUs in the domain. The
           initial documentation was not clear about this, but the updated one
           from Oct 2020 spells it out.
      
         - Fix an off by one in the UV platform detection code which causes
           the UV hubs to be identified wrongly.
      
           The chip revisions start at 1 not at 0.
      
         - Fix a long standing bug in the evaluation of prefixes in the
           uprobes code which fails to handle repeated prefixes properly.
      
           The aggregate size of the prefixes can be larger than the bytes
           array but the code blindly iterated over the aggregate size beyond
           the array boundary. Add a macro to handle this case properly and
           use it at the affected places"
      
      * tag 'x86-urgent-2020-12-06' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/sev-es: Use new for_each_insn_prefix() macro to loop over prefixes bytes
        x86/insn-eval: Use new for_each_insn_prefix() macro to loop over prefixes bytes
        x86/uprobes: Do not use prefixes.nbytes when looping over prefixes.bytes
        x86/platform/uv: Fix UV4 hub revision adjustment
        x86/resctrl: Fix AMD L3 QOS CDP enable/disable
      8100a580
    • Linus Torvalds's avatar
      Merge tag 'perf-urgent-2020-12-06' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 9f6b28d4
      Linus Torvalds authored
      Pull perf fixes from Thomas Gleixner:
       "Two fixes for performance monitoring on X86:
      
         - Add recursion protection to another callchain invoked from
           x86_pmu_stop() which can recurse back into x86_pmu_stop(). The
           first attempt to fix this missed this extra code path.
      
         - Use the already filtered status variable to check for PEBS counter
           overflow bits and not the unfiltered full status read from
           IA32_PERF_GLOBAL_STATUS which can have unrelated bits check which
           would be evaluated incorrectly"
      
      * tag 'perf-urgent-2020-12-06' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        perf/x86/intel: Check PEBS status correctly
        perf/x86/intel: Fix a warning on x86_pmu_stop() with large PEBS
      9f6b28d4
    • Linus Torvalds's avatar
      Merge tag 'irq-urgent-2020-12-06' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 592d9a08
      Linus Torvalds authored
      Pull irq fixes from Thomas Gleixner:
       "A set of updates for the interrupt subsystem:
      
         - Make multiqueue devices which use the managed interrupt affinity
           infrastructure work on PowerPC/Pseries. PowerPC does not use the
           generic infrastructure for setting up PCI/MSI interrupts and the
           multiqueue changes failed to update the legacy PCI/MSI
           infrastructure. Make this work by passing the affinity setup
           information down to the mapping and allocation functions.
      
         - Move Jason Cooper from MAINTAINERS to CREDITS as his mail is
           bouncing and he's not reachable. We hope all is well with him and
           say thanks for his work over the years"
      
      * tag 'irq-urgent-2020-12-06' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        powerpc/pseries: Pass MSI affinity to irq_create_mapping()
        genirq/irqdomain: Add an irq_create_mapping_affinity() function
        MAINTAINERS: Move Jason Cooper to CREDITS
      592d9a08
    • Linus Torvalds's avatar
      Merge tag 'locking-urgent-2020-12-06' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · ff615c98
      Linus Torvalds authored
      Pull intel_idle build fix from Thomas Gleixner:
       "A tiny build fix for a recent change in the intel_idle driver which
        missed a CONFIG dependency and broke the build for certain
        configurations"
      
      * tag 'locking-urgent-2020-12-06' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        intel_idle: Build fix
      ff615c98
    • Linus Torvalds's avatar
      Merge tag 'kbuild-fixes-v5.10-2' of... · e6585a49
      Linus Torvalds authored
      Merge tag 'kbuild-fixes-v5.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
      
      Pull Kbuild fixes from Masahiro Yamada:
      
       - Move -Wcast-align to W=3, which tends to be false-positive and there
         is no tree-wide solution.
      
       - Pass -fmacro-prefix-map to KBUILD_CPPFLAGS because it is a
         preprocessor option and makes sense for .S files as well.
      
       - Disable -gdwarf-2 for Clang's integrated assembler to avoid warnings.
      
       - Disable --orphan-handling=warn for LLD 10.0.1 to avoid warnings.
      
       - Fix undesirable line breaks in *.mod files.
      
      * tag 'kbuild-fixes-v5.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
        kbuild: avoid split lines in .mod files
        kbuild: Disable CONFIG_LD_ORPHAN_WARN for ld.lld 10.0.1
        kbuild: Hoist '--orphan-handling' into Kconfig
        Kbuild: do not emit debug info for assembly with LLVM_IAS=1
        kbuild: use -fmacro-prefix-map for .S sources
        Makefile.extrawarn: move -Wcast-align to W=3
      e6585a49
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · 12c0ab66
      Linus Torvalds authored
      Merge misc fixes from Andrew Morton:
       "12 patches.
      
        Subsystems affected by this patch series: mm (memcg, zsmalloc, swap,
        mailmap, selftests, pagecache, hugetlb, pagemap), lib, and coredump"
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>:
        mm/mmap.c: fix mmap return value when vma is merged after call_mmap()
        hugetlb_cgroup: fix offline of hugetlb cgroup with reservations
        mm/filemap: add static for function __add_to_page_cache_locked
        userfaultfd: selftests: fix SIGSEGV if huge mmap fails
        tools/testing/selftests/vm: fix build error
        mailmap: add two more addresses of Uwe Kleine-König
        mm/swapfile: do not sleep with a spin lock held
        mm/zsmalloc.c: drop ZSMALLOC_PGTABLE_MAPPING
        mm: list_lru: set shrinker map bit when child nr_items is not zero
        mm: memcg/slab: fix obj_cgroup_charge() return value handling
        coredump: fix core_pattern parse error
        zlib: export S390 symbols for zlib modules
      12c0ab66
    • Liu Zixian's avatar
      mm/mmap.c: fix mmap return value when vma is merged after call_mmap() · 309d08d9
      Liu Zixian authored
      On success, mmap should return the begin address of newly mapped area,
      but patch "mm: mmap: merge vma after call_mmap() if possible" set
      vm_start of newly merged vma to return value addr.  Users of mmap will
      get wrong address if vma is merged after call_mmap().  We fix this by
      moving the assignment to addr before merging vma.
      
      We have a driver which changes vm_flags, and this bug is found by our
      testcases.
      
      Fixes: d70cec89 ("mm: mmap: merge vma after call_mmap() if possible")
      Signed-off-by: default avatarLiu Zixian <liuzixian4@huawei.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
      Cc: Miaohe Lin <linmiaohe@huawei.com>
      Cc: Hongxiang Lou <louhongxiang@huawei.com>
      Cc: Hu Shiyuan <hushiyuan@huawei.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Link: https://lkml.kernel.org/r/20201203085350.22624-1-liuzixian4@huawei.comSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      309d08d9
    • Mike Kravetz's avatar
      hugetlb_cgroup: fix offline of hugetlb cgroup with reservations · 7a5bde37
      Mike Kravetz authored
      Adrian Moreno was ruuning a kubernetes 1.19 + containerd/docker workload
      using hugetlbfs.  In this environment the issue is reproduced by:
      
       - Start a simple pod that uses the recently added HugePages medium
         feature (pod yaml attached)
      
       - Start a DPDK app. It doesn't need to run successfully (as in transfer
         packets) nor interact with real hardware. It seems just initializing
         the EAL layer (which handles hugepage reservation and locking) is
         enough to trigger the issue
      
       - Delete the Pod (or let it "Complete").
      
      This would result in a kworker thread going into a tight loop (top output):
      
         1425 root      20   0       0      0      0 R  99.7   0.0   5:22.45 kworker/28:7+cgroup_destroy
      
      'perf top -g' reports:
      
        -   63.28%     0.01%  [kernel]                    [k] worker_thread
           - 49.97% worker_thread
              - 52.64% process_one_work
                 - 62.08% css_killed_work_fn
                    - hugetlb_cgroup_css_offline
                         41.52% _raw_spin_lock
                       - 2.82% _cond_resched
                            rcu_all_qs
                         2.66% PageHuge
              - 0.57% schedule
                 - 0.57% __schedule
      
      We are spinning in the do-while loop in hugetlb_cgroup_css_offline.
      Worse yet, we are holding the master cgroup lock (cgroup_mutex) while
      infinitely spinning.  Little else can be done on the system as the
      cgroup_mutex can not be acquired.
      
      Do note that the issue can be reproduced by simply offlining a hugetlb
      cgroup containing pages with reservation counts.
      
      The loop in hugetlb_cgroup_css_offline is moving page counts from the
      cgroup being offlined to the parent cgroup.  This is done for each
      hstate, and is repeated until hugetlb_cgroup_have_usage returns false.
      The routine moving counts (hugetlb_cgroup_move_parent) is only moving
      'usage' counts.  The routine hugetlb_cgroup_have_usage is checking for
      both 'usage' and 'reservation' counts.  Discussion about what to do with
      reservation counts when reparenting was discussed here:
      
      https://lore.kernel.org/linux-kselftest/CAHS8izMFAYTgxym-Hzb_JmkTK1N_S9tGN71uS6MFV+R7swYu5A@mail.gmail.com/
      
      The decision was made to leave a zombie cgroup for with reservation
      counts.  Unfortunately, the code checking reservation counts was
      incorrectly added to hugetlb_cgroup_have_usage.
      
      To fix the issue, simply remove the check for reservation counts.  While
      fixing this issue, a related bug in hugetlb_cgroup_css_offline was
      noticed.  The hstate index is not reinitialized each time through the
      do-while loop.  Fix this as well.
      
      Fixes: 1adc4d41 ("hugetlb_cgroup: add interface for charge/uncharge hugetlb reservations")
      Reported-by: default avatarAdrian Moreno <amorenoz@redhat.com>
      Signed-off-by: default avatarMike Kravetz <mike.kravetz@oracle.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Tested-by: default avatarAdrian Moreno <amorenoz@redhat.com>
      Reviewed-by: default avatarShakeel Butt <shakeelb@google.com>
      Cc: Mina Almasry <almasrymina@google.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Greg Thelen <gthelen@google.com>
      Cc: Sandipan Das <sandipan@linux.ibm.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: <stable@vger.kernel.org>
      Link: https://lkml.kernel.org/r/20201203220242.158165-1-mike.kravetz@oracle.comSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7a5bde37
    • Alex Shi's avatar
      mm/filemap: add static for function __add_to_page_cache_locked · 3351b16a
      Alex Shi authored
        mm/filemap.c:830:14: warning: no previous prototype for `__add_to_page_cache_locked' [-Wmissing-prototypes]
      Signed-off-by: default avatarAlex Shi <alex.shi@linux.alibaba.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Souptick Joarder <jrdr.linux@gmail.com>
      Link: https://lkml.kernel.org/r/1604661895-5495-1-git-send-email-alex.shi@linux.alibaba.comSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3351b16a
    • Axel Rasmussen's avatar
      userfaultfd: selftests: fix SIGSEGV if huge mmap fails · 573a2593
      Axel Rasmussen authored
      The error handling in hugetlb_allocate_area() was incorrect for the
      hugetlb_shared test case.
      
      Previously the behavior was:
      
      - mmap a hugetlb area
        - If this fails, set the pointer to NULL, and carry on
      - mmap an alias of the same hugetlb fd
        - If this fails, munmap the original area
      
      If the original mmap failed, it's likely the second one did too.  If
      both failed, we'd blindly try to munmap a NULL pointer, causing a
      SIGSEGV.  Instead, "goto fail" so we return before trying to mmap the
      alias.
      
      This issue can be hit "in real life" by forgetting to set
      /proc/sys/vm/nr_hugepages (leaving it at 0), and then trying to run the
      hugetlb_shared test.
      
      Another small improvement is, when the original mmap fails, don't just
      print "it failed": perror(), so we can see *why*.  :)
      Signed-off-by: default avatarAxel Rasmussen <axelrasmussen@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Peter Xu <peterx@redhat.com>
      Cc: Joe Perches <joe@perches.com>
      Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: David Alan Gilbert <dgilbert@redhat.com>
      Link: https://lkml.kernel.org/r/20201204203443.2714693-1-axelrasmussen@google.comSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      573a2593
    • Xingxing Su's avatar
      tools/testing/selftests/vm: fix build error · d8cbe8bf
      Xingxing Su authored
      Only x86 and PowerPC implement the pkey-xxx.h, and an error was reported
      when compiling protection_keys.c.
      
      Add a Arch judgment to compile "protection_keys" in the Makefile.
      
      If other arch implement this, add the arch name to the Makefile.
      eg:
          ifneq (,$(findstring $(ARCH),powerpc mips ... ))
      
      Following build errors:
      
          pkey-helpers.h:93:2: error: #error Architecture not supported
           #error Architecture not supported
          pkey-helpers.h:96:20: error: `PKEY_DISABLE_ACCESS' undeclared
           #define PKEY_MASK (PKEY_DISABLE_ACCESS | PKEY_DISABLE_WRITE)
                              ^
          protection_keys.c:218:45: error: `PKEY_DISABLE_WRITE' undeclared
           pkey_assert(flags & (PKEY_DISABLE_ACCESS | PKEY_DISABLE_WRITE));
                                                      ^
      Signed-off-by: default avatarXingxing Su <suxingxing@loongson.cn>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Sandipan Das <sandipan@linux.ibm.com>
      Cc: John Hubbard <jhubbard@nvidia.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
      Cc: Brian Geffon <bgeffon@google.com>
      Cc: Mina Almasry <almasrymina@google.com>
      Link: https://lkml.kernel.org/r/1606826876-30656-1-git-send-email-suxingxing@loongson.cnSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d8cbe8bf
    • Uwe Kleine-König's avatar
      mailmap: add two more addresses of Uwe Kleine-König · 4e60340c
      Uwe Kleine-König authored
      This fixes attribution for the commits (among others)
      
       - d4097456 ("video/framebuffer: move the probe func into
         .devinit.text in Blackfin LCD driver")
      
       - 0312e024 ("mfd: mc13xxx: Add support for mc34708")
      Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Link: https://lkml.kernel.org/r/20201127213358.3440830-1-u.kleine-koenig@pengutronix.deSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      4e60340c
    • Qian Cai's avatar
      mm/swapfile: do not sleep with a spin lock held · b11a76b3
      Qian Cai authored
      We can't call kvfree() with a spin lock held, so defer it.  Fixes a
      might_sleep() runtime warning.
      
      Fixes: 873d7bcf ("mm/swapfile.c: use kvzalloc for swap_info_struct allocation")
      Signed-off-by: default avatarQian Cai <qcai@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lkml.kernel.org/r/20201202151549.10350-1-qcai@redhat.comSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b11a76b3