1. 23 Aug, 2018 21 commits
    • Linus Torvalds's avatar
      Merge tag 'pwm/for-4.19-rc1' of... · b39d7efc
      Linus Torvalds authored
      Merge tag 'pwm/for-4.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm
      
      Pull pwm updates from Thierry Reding:
       "This contains mostly minor bug fixes as well as some new chip support
        for existing drivers"
      
      * tag 'pwm/for-4.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm:
        pwm: mediatek: Add MT7628 support
        dt-bindings: pwm: Add MT7628 information
        dt-bindings: pwm: rcar: Add bindings for R-Car E3 support
        pwm: meson: Fix mux clock names
        pwm: stm32-lp: Remove useless loop in stm32_pwm_lp_remove()
        pwm: omap-dmtimer: Return -EPROBE_DEFER if no dmtimer platform data
        pwm: mxs: Switch to SPDX identifier
        dt-bindings: pwm: fsl-ftm: Add compatible string for i.MX8QM
        pwm: fsl-ftm: Enable support for the new SoC i.MX8QM
        pwm: fsl-ftm: Added the support of per-compatible data
        pwm: fsl-ftm: Added a dedicated IP interface clock
        pwm: cros-ec: Switch to SPDX identifier
        pwm: imx: Switch to SPDX identifier
        pwm: tiehrpwm: Fix disabling of output of PWMs
        pwm: tiehrpwm: Don't use emulation mode bits to control PWM output
        pwm: berlin: Don't use broken prescaler values
      b39d7efc
    • Linus Torvalds's avatar
      Merge tag 'fbdev-v4.19' of https://github.com/bzolnier/linux · 06e386a1
      Linus Torvalds authored
      Pull fbdev updates from Bartlomiej Zolnierkiewicz:
       "Mostly small fixes and cleanups for fb drivers (the biggest updates
        are for udlfb and pxafb drivers). This also adds deferred console
        takeover support to the console code and efifb driver.
      
        Summary:
      
         - add support for deferred console takeover, when enabled defers
           fbcon taking over the console from the dummy console until the
           first text is displayed on the console - together with the "quiet"
           kernel commandline option this allows fbcon to still be used
           together with a smooth graphical bootup (Hans de Goede)
      
         - improve console locking debugging code (Thomas Zimmermann)
      
         - copy the ACPI BGRT boot graphics to the framebuffer when deferred
           console takeover support is used in efifb driver (Hans de Goede)
      
         - update udlfb driver - fix lost console when the user unplugs a USB
           adapter, fix the screen corruption issue, fix locking and add some
           performance optimizations (Mikulas Patocka)
      
         - update pxafb driver - fix using uninitialized memory, switch to
           devm_* API, handle initialization errors and add support for
           lcd-supply regulator (Daniel Mack)
      
         - add support for boards booted with a DeviceTree in pxa3xx_gcu
           driver (Daniel Mack)
      
         - rename omap2 module to omap2fb.ko to avoid conflicts with omap1
           driver (Arnd Bergmann)
      
         - enable ACPI-based enumeration for goldfishfb driver (Yu Ning)
      
         - fix goldfishfb driver to make user space Android code use 60 fps
           (Christoffer Dall)
      
         - print big fat warning when nomodeset kernel parameter is used in
           vgacon driver (Lyude Paul)
      
         - remove VLA usage from fsl-diu-fb driver (Kees Cook)
      
         - misc fixes (Julia Lawall, Geert Uytterhoeven, Fredrik Noring,
           Yisheng Xie, Dan Carpenter, Daniel Vetter, Anton Vasilyev, Randy
           Dunlap, Gustavo A. R. Silva, Colin Ian King, Fengguang Wu)
      
         - misc cleanups (Roman Kiryanov, Yisheng Xie, Colin Ian King)"
      
      * tag 'fbdev-v4.19' of https://github.com/bzolnier/linux: (54 commits)
        Documentation/fb: corrections for fbcon.txt
        fbcon: Do not takeover the console from atomic context
        dummycon: Stop exporting dummycon_[un]register_output_notifier
        fbcon: Only defer console takeover if the current console driver is the dummycon
        fbcon: Only allow FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER if fbdev is builtin
        fbdev: omap2: omapfb: fix ifnullfree.cocci warnings
        fbdev: omap2: omapfb: fix bugon.cocci warnings
        fbdev: omap2: omapfb: fix boolreturn.cocci warnings
        fb: amifb: fix build warnings when not builtin
        fbdev/core: Disable console-lock warnings when fb.lockless_register_fb is set
        console: Replace #if 0 with atomic var 'ignore_console_lock_warning'
        udlfb: use spin_lock_irq instead of spin_lock_irqsave
        udlfb: avoid prefetch
        udlfb: optimization - test the backing buffer
        udlfb: allow reallocating the framebuffer
        udlfb: set line_length in dlfb_ops_set_par
        udlfb: handle allocation failure
        udlfb: set optimal write delay
        udlfb: make a local copy of fb_ops
        udlfb: don't switch if we are switching to the same videomode
        ...
      06e386a1
    • Linus Torvalds's avatar
      Merge tag 'sound-fix-4.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · 99897b1e
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "No surprises here: a regression fix for virmidi code refactoring,
        three fixes for the new AC97 bus compat and runtime PM, and a usual
        HD-audio quirk"
      
      * tag 'sound-fix-4.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
        ALSA: hda/realtek - Fix HP Headset Mic can't record
        ALSA: ac97: fix unbalanced pm_runtime_enable
        ALSA: ac97: fix check of pm_runtime_get_sync failure
        ALSA: ac97: fix device initialization in the compat layer
        ALSA: seq: virmidi: Fix discarding the unsubscribed output
      99897b1e
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma · 1290290c
      Linus Torvalds authored
      Pull more rdma updates from Jason Gunthorpe:
       "This is the SMC cleanup promised, a randconfig regression fix, and
        kernel oops fix.
      
        Summary:
      
         - Switch SMC over to rdma_get_gid_attr and remove the compat
      
         - Fix a crash in HFI1 with some BIOS's
      
         - Fix a randconfig failure"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma:
        IB/ucm: fix UCM link error
        IB/hfi1: Invalid NUMA node information can cause a divide by zero
        RDMA/smc: Replace ib_query_gid with rdma_get_gid_attr
      1290290c
    • Linus Torvalds's avatar
      Merge branch 'tlb-fixes' · 706a1ea6
      Linus Torvalds authored
      Merge fixes for missing TLB shootdowns.
      
      This fixes a couple of cases that involved us possibly freeing page
      table structures before the required TLB shootdown had been done.
      
      There are a few cleanup patches to make the code easier to follow, and
      to avoid some of the more problematic cases entirely when not necessary.
      
      To make this easier for backports, it undoes the recent lazy TLB
      patches, because the cleanups and fixes are more important, and Rik is
      ok with re-doing them later when things have calmed down.
      
      The missing TLB flush was only delayed, and the wrong ordering only
      happened under memory pressure (and in theory under a couple of other
      fairly theoretical situations), so this may have been all very unlikely
      to have hit people in practice.
      
      But getting the TLB shootdown wrong is _so_ hard to debug and see that I
      consider this a crticial fix.
      
      Many thanks to Jann Horn for having debugged this.
      
      * tlb-fixes:
        x86/mm: Only use tlb_remove_table() for paravirt
        mm: mmu_notifier fix for tlb_end_vma
        mm/tlb, x86/mm: Support invalidating TLB caches for RCU_TABLE_FREE
        mm/tlb: Remove tlb_remove_table() non-concurrent condition
        mm: move tlb_table_flush to tlb_flush_mmu_free
        x86/mm/tlb: Revert the recent lazy TLB patches
      706a1ea6
    • Linus Torvalds's avatar
      Merge tag 'for-linus-4.19b-rc1b-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip · d40acad1
      Linus Torvalds authored
      Pull xen fixes and cleanups from Juergen Gross:
       "Some cleanups, some minor fixes and a fix for a bug introduced in this
        merge window hitting 32-bit PV guests"
      
      * tag 'for-linus-4.19b-rc1b-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
        x86/xen: enable early use of set_fixmap in 32-bit Xen PV guest
        xen: remove unused hypercall functions
        x86/xen: remove unused function xen_auto_xlated_memory_setup()
        xen/ACPI: don't upload Px/Cx data for disabled processors
        x86/Xen: further refine add_preferred_console() invocations
        xen/mcelog: eliminate redundant setting of interface version
        x86/Xen: mark xen_setup_gdt() __init
      d40acad1
    • Linus Torvalds's avatar
      Merge tag 'mips_4.19_2' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux · 0c4b0f81
      Linus Torvalds authored
      Pull MIPS fixes from Paul Burton:
      
        - Fix microMIPS build failures by adding a .insn directive to the
          barrier_before_unreachable() asm statement in order to convince the
          toolchain that the asm statement is a valid branch target rather
          than a bogus attempt to switch ISA.
      
        - Clean up our declarations of TLB functions that we overwrite with
          generated code in order to prevent the compiler making assumptions
          about alignment that cause microMIPS kernels built with GCC 7 &
          above to die early during boot.
      
        - Fix up a regression for MIPS32 kernels which slipped into the main
          MIPS pull for 4.19, causing CONFIG_32BIT=y kernels to contain
          inappropriate MIPS64 instructions.
      
        - Extend our existing workaround for MIPSr6 builds that end up using
          the __multi3 intrinsic to GCC 7 & below, rather than just GCC 7.
      
      * tag 'mips_4.19_2' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux:
        MIPS: lib: Provide MIPS64r6 __multi3() for GCC < 7
        MIPS: Workaround GCC __builtin_unreachable reordering bug
        compiler.h: Allow arch-specific asm/compiler.h
        MIPS: Avoid move psuedo-instruction whilst using MIPS_ISA_LEVEL
        MIPS: Consistently declare TLB functions
        MIPS: Export tlbmiss_handler_setup_pgd near its definition
      0c4b0f81
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://github.com/openrisc/linux · 2ab054fd
      Linus Torvalds authored
      Pull OpenRISC update from Stafford Horne:
       "Just one change for 4.19: refactoring from Christoph Hellwig to use
        generic DMA facilities"
      
      * tag 'for-linus' of git://github.com/openrisc/linux:
        openrisc: use generic dma_noncoherent_ops
        openrisc: fix cache maintainance the the sync_single_for_device DMA operation
        openrisc: remove the no-op unmap_page and unmap_sg DMA operations
        openrisc: remove the sync_single_for_cpu DMA operation
      2ab054fd
    • Linus Torvalds's avatar
      Merge tag 'armsoc-dt' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc · 2f34a64a
      Linus Torvalds authored
      Pull ARM device-tree updates from Olof Johansson:
       "Business as usual -- the bulk of our changes are to devicetree files
        with new hardware support, new SoCs and platforms, and new board
        types.
      
        New SoCs/platforms:
         - Raspberry Pi Compute Module (CM1) and IO board
         - i.MX6SSL from NXP
         - Renesas RZ/N1D SoC (R9A06G032), Dual Cortex-A7 with Ethernet, CAN
           and PLC interfaces
         - TI AM654 SoC, Quad Cortex-A53, safety subsystem with Cortex-R5
           controllers, communication and PRU subsystem and lots of other
           interfaces (PCIe, USB3, etc).
      
        New boards and systems:
         - Several Atmel at91-based boards from Laird
         - Marvell Armada388-based Helios4 board from SolidRun
         - Samsung Aires-based phones (s5pv210)
         - Allwinner A64-based Pinebook laptop
      
        In addition to the above, there's the usual amount of new devices
        described on existing platforms, fixes and tweaks and new minor
        variants of boards/platforms"
      
      * tag 'armsoc-dt' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (478 commits)
        arm64: dts: sdm845: Add tsens nodes
        arm64: dts: msm8996: thermal: Initialise via DT and add second controller
        arm64: dts: sprd: Add one suspend timer
        arm64: dts: sprd: Add SC27XX ADC device
        arm64: dts: sprd: Add SC27XX eFuse device
        arm64: dts: sprd: Add SC27XX vibrator device
        arm64: dts: sprd: Add SC27XX breathing light controller device
        arm64: dts: meson-axg: add spdif-dit codec
        arm64: dts: meson-axg: add lineout codec
        arm64: dts: meson-axg: add linein codec
        arm64: dts: meson-axg: add tdm interfaces
        arm64: dts: meson-axg: add tdmout formatters
        arm64: dts: meson-axg: add tdmin formatters
        arm64: dts: meson-axg: add spdifout
        arm64: dts: rockchip: add led support for Firefly-RK3399
        arm64: dts: rockchip: remove deprecated Type-C PHY properties on rk3399
        arm64: dts: rockchip: add power button support for Firefly-RK3399
        ARM: dts: aspeed: Add coprocessor interrupt controller
        arm64: dts: meson-axg: add audio arb reset controller
        arm64: dts: meson-axg: add usb power regulator
        ...
      2f34a64a
    • Linus Torvalds's avatar
      Merge tag 'armsoc-defconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc · ee090756
      Linus Torvalds authored
      Pull ARM SoC defconfig updates from Olof Johansson:
       "We keep these separate since some files are shared and conflict-prone,
        but there isn't really much to write about here.
      
        Some of the churnier pieces is for the Aspeed platforms, which did an
        overdue refresh of the defconfig, and enabled USB gadget and some
        drivers from there. Most of the rest are minor additions here and
        there to turn on drivers that are needed or useful on the various
        platforms"
      
      * tag 'armsoc-defconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (39 commits)
        ARM: multi_v7_defconfig: add CONFIG_UNIPHIER_THERMAL and CONFIG_SNI_AVE
        ARM: config: aspeed: Enable new FSI drivers
        ARM: config: multi_v5: Enable ASPEED drivers
        ARM: config: multi_v5: Refresh configuration
        ARM: config: aspeed: Update defconfig
        ARM: multi_v7_defconfig: Enable support for RZN1D-DB
        ARM: shmobile: defconfig: Disable /sbin/hotplug fork-bomb
        ARM: shmobile: defconfig: Enable support for RZN1D-DB
        ARM: shmobile: defconfig: Enable reset controller support
        ARM: shmobile: defconfig: Drop NET_VENDOR_<FOO>=n
        arm64: defconfig: Enable more peripherals for Samsung Chromebook Plus.
        arm64: defconfig: Enable CONFIG_MTD_NAND_QCOM for IPQ8074
        ARM: qcom_defconfig: Enable QCOM NAND related configs
        ARM: imx_v6_v7_defconfig: add DMATEST support
        ARM: mvebu_v7_defconfig: enable SFP support
        ARM: mvebu_v7_defconfig: sync defconfig
        ARM: multi_v7_defconfig: Add Marvell NAND controller support
        arm: configs: Add USB gadget to Aspeed G5 defconfig
        arm: configs: Add USB gadget to Aspeed G4 defconfig
        arm64: defconfig: enable HiSilicon PMU driver
        ...
      ee090756
    • Linus Torvalds's avatar
      Merge tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc · f3ea4962
      Linus Torvalds authored
      Pull ARM SoC driver updates from Olof Johansson:
       "Some of the larger changes this merge window:
      
         - Removal of drivers for Exynos5440, a Samsung SoC that never saw
           widespread use.
      
         - Uniphier support for USB3 and SPI reset handling
      
         - Syste control and SRAM drivers and bindings for Allwinner platforms
      
         - Qualcomm AOSS (Always-on subsystem) reset controller drivers
      
         - Raspberry Pi hwmon driver for voltage
      
         - Mediatek pwrap (pmic) support for MT6797 SoC"
      
      * tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (52 commits)
        drivers/firmware: psci_checker: stash and use topology_core_cpumask for hotplug tests
        soc: fsl: cleanup Kconfig menu
        soc: fsl: dpio: Convert DPIO documentation to .rst
        staging: fsl-mc: Remove remaining files
        staging: fsl-mc: Move DPIO from staging to drivers/soc/fsl
        staging: fsl-dpaa2: eth: move generic FD defines to DPIO
        soc: fsl: qe: gpio: Add qe_gpio_set_multiple
        usb: host: exynos: Remove support for Exynos5440
        clk: samsung: Remove support for Exynos5440
        soc: sunxi: Add the A13, A23 and H3 system control compatibles
        reset: uniphier: add reset control support for SPI
        cpufreq: exynos: Remove support for Exynos5440
        ata: ahci-platform: Remove support for Exynos5440
        soc: imx6qp: Use GENPD_FLAG_ALWAYS_ON for PU errata
        soc: mediatek: pwrap: add mt6351 driver for mt6797 SoCs
        soc: mediatek: pwrap: add pwrap driver for mt6797 SoCs
        soc: mediatek: pwrap: fix cipher init setting error
        dt-bindings: pwrap: mediatek: add pwrap support for MT6797
        reset: uniphier: add USB3 core reset control
        dt-bindings: reset: uniphier: add USB3 core reset support
        ...
      f3ea4962
    • Linus Torvalds's avatar
      Merge tag 'armsoc-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc · 9e259f93
      Linus Torvalds authored
      Pull ARM 32-bit SoC platform updates from Olof Johansson:
       "Most of the SoC updates in this cycle are cleanups and moves to more
        modern infrastructure:
      
         - Davinci was moved to common clock framework
      
         - OMAP1-based Amstrad E3 "Superphone" saw a bunch of cleanups to the
           keyboard interface (bitbanged AT keyboard via GPIO).
      
         - Removal of some stale code for Renesas platforms
      
         - Power management improvements for i.MX6LL"
      
      * tag 'armsoc-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (112 commits)
        ARM: uniphier: select RESET_CONTROLLER
        arm64: uniphier: select RESET_CONTROLLER
        ARM: uniphier: remove empty Makefile
        ARM: exynos: Clear global variable on init error path
        ARM: exynos: Remove outdated maintainer information
        ARM: shmobile: Always enable ARCH_TIMER on SoCs with A7 and/or A15
        ARM: shmobile: r8a7779: hide unused r8a7779_platform_cpu_kill
        soc: r9a06g032: don't build SMP files for non-SMP config
        ARM: shmobile: Add the R9A06G032 SMP enabler driver
        ARM: at91: pm: configure wakeup sources for ULP1 mode
        ARM: at91: pm: add PMC fast startup registers defines
        ARM: at91: pm: Add ULP1 mode support
        ARM: at91: pm: Use ULP0 naming instead of slow clock
        ARM: hisi: handle of_iomap and fix missing of_node_put
        ARM: hisi: check of_iomap and fix missing of_node_put
        ARM: hisi: fix error handling and missing of_node_put
        ARM: mx5: Set the DBGEN bit in ARM_GPC register
        ARM: imx51: Configure M4IF to avoid visual artifacts
        ARM: imx: call imx6sx_cpuidle_init() conditionally for 6sll
        ARM: imx: fix i.MX6SLL build
        ...
      9e259f93
    • Linus Torvalds's avatar
      Merge tag 'riscv-for-linus-4.19-mw1' of... · 5563ae9b
      Linus Torvalds authored
      Merge tag 'riscv-for-linus-4.19-mw1' of git://git.kernel.org/pub/scm/linux/kernel/git/palmer/riscv-linux
      
      Pull RISC-V fixes from Palmer Dabbelt:
       "This contains a pair of fixes to the RISC-V port:
      
         - The removal of our compat.h, which didn't do anything.
      
         - Fixes to sys_riscv_flush_icache to ensure it actually shows up.
      
           We're going to just call this a bug in the ABI, as it was always
           supposed to be there.
      
        I've given these a simple build+boot test, both individually and as
        the actual tag"
      
      * tag 'riscv-for-linus-4.19-mw1' of git://git.kernel.org/pub/scm/linux/kernel/git/palmer/riscv-linux:
        riscv: Delete asm/compat.h
        RISC-V: Don't use a global include guard for uapi/asm/syscalls.h
        RISC-V: Define sys_riscv_flush_icache when SMP=n
      5563ae9b
    • Linus Torvalds's avatar
      Merge tag 'trace-v4.19-1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace · 452938cb
      Linus Torvalds authored
      Pull tracing fixes from Steven Rostedt:
       "Masami found an off by one bug in the code that keeps "notrace"
        functions from being traced by kprobes. During my testing, I found
        that there's places that we may want to add kprobes to notrace, thus
        we may end up changing this code before 4.19 is released.
      
        The history behind this change is that we found that adding kprobes to
        various notrace functions caused the kernel to crashed. We took the
        safe route and decided not to allow kprobes to trace any notrace
        function.
      
        But because notrace is added to functions that just cause weird side
        effects to the function tracer, but are still safe, preventing kprobes
        for all notrace functios may be too much of a big hammer.
      
        One such place is __schedule() is marked notrace, to keep function
        tracer from doing strange recursive loops when it gets traced with
        NEED_RESCHED set. With this change, one can not add kprobes to the
        scheduler.
      
        Masami also added code to use gcov on ftrace"
      
      * tag 'trace-v4.19-1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
        tracing/kprobes: Fix to check notrace function with correct range
        tracing: Allow gcov profiling on only ftrace subsystem
      452938cb
    • Peter Zijlstra's avatar
      x86/mm: Only use tlb_remove_table() for paravirt · 48a8b97c
      Peter Zijlstra authored
      If we don't use paravirt; don't play unnecessary and complicated games
      to free page-tables.
      Suggested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: default avatarRik van Riel <riel@surriel.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      48a8b97c
    • Nicholas Piggin's avatar
      mm: mmu_notifier fix for tlb_end_vma · fd1102f0
      Nicholas Piggin authored
      The generic tlb_end_vma does not call invalidate_range mmu notifier, and
      it resets resets the mmu_gather range, which means the notifier won't be
      called on part of the range in case of an unmap that spans multiple
      vmas.
      
      ARM64 seems to be the only arch I could see that has notifiers and uses
      the generic tlb_end_vma.  I have not actually tested it.
      
      [ Catalin and Will point out that ARM64 currently only uses the
        notifiers for KVM, which doesn't use the ->invalidate_range()
        callback right now, so it's a bug, but one that happens to
        not affect them.  So not necessary for stable.  - Linus ]
      Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
      Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Acked-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      fd1102f0
    • Peter Zijlstra's avatar
      mm/tlb, x86/mm: Support invalidating TLB caches for RCU_TABLE_FREE · d86564a2
      Peter Zijlstra authored
      Jann reported that x86 was missing required TLB invalidates when he
      hit the !*batch slow path in tlb_remove_table().
      
      This is indeed the case; RCU_TABLE_FREE does not provide TLB (cache)
      invalidates, the PowerPC-hash where this code originated and the
      Sparc-hash where this was subsequently used did not need that. ARM
      which later used this put an explicit TLB invalidate in their
      __p*_free_tlb() functions, and PowerPC-radix followed that example.
      
      But when we hooked up x86 we failed to consider this. Fix this by
      (optionally) hooking tlb_remove_table() into the TLB invalidate code.
      
      NOTE: s390 was also needing something like this and might now
            be able to use the generic code again.
      
      [ Modified to be on top of Nick's cleanups, which simplified this patch
        now that tlb_flush_mmu_tlbonly() really only flushes the TLB - Linus ]
      
      Fixes: 9e52fc2b ("x86/mm: Enable RCU based page table freeing (CONFIG_HAVE_RCU_TABLE_FREE=y)")
      Reported-by: default avatarJann Horn <jannh@google.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: default avatarRik van Riel <riel@surriel.com>
      Cc: Nicholas Piggin <npiggin@gmail.com>
      Cc: David Miller <davem@davemloft.net>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: stable@kernel.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d86564a2
    • Peter Zijlstra's avatar
      mm/tlb: Remove tlb_remove_table() non-concurrent condition · a6f57208
      Peter Zijlstra authored
      Will noted that only checking mm_users is incorrect; we should also
      check mm_count in order to cover CPUs that have a lazy reference to
      this mm (and could do speculative TLB operations).
      
      If removing this turns out to be a performance issue, we can
      re-instate a more complete check, but in tlb_table_flush() eliding the
      call_rcu_sched().
      
      Fixes: 26723911 ("mm, powerpc: move the RCU page-table freeing into generic code")
      Reported-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: default avatarRik van Riel <riel@surriel.com>
      Acked-by: default avatarWill Deacon <will.deacon@arm.com>
      Cc: Nicholas Piggin <npiggin@gmail.com>
      Cc: David Miller <davem@davemloft.net>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: stable@kernel.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a6f57208
    • Nicholas Piggin's avatar
      mm: move tlb_table_flush to tlb_flush_mmu_free · db7ddef3
      Nicholas Piggin authored
      There is no need to call this from tlb_flush_mmu_tlbonly, it logically
      belongs with tlb_flush_mmu_free.  This makes future fixes simpler.
      
      [ This was originally done to allow code consolidation for the
        mmu_notifier fix, but it also ends up helping simplify the
        HAVE_RCU_TABLE_INVALIDATE fix.    - Linus ]
      Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
      Acked-by: default avatarWill Deacon <will.deacon@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: stable@kernel.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      db7ddef3
    • Peter Zijlstra's avatar
      x86/mm/tlb: Revert the recent lazy TLB patches · 52a288c7
      Peter Zijlstra authored
      Revert commits:
      
        95b0e635 x86/mm/tlb: Always use lazy TLB mode
        64482aaf x86/mm/tlb: Only send page table free TLB flush to lazy TLB CPUs
        ac031589 x86/mm/tlb: Make lazy TLB mode lazier
        61d0beb5 x86/mm/tlb: Restructure switch_mm_irqs_off()
        2ff6ddf1 x86/mm/tlb: Leave lazy TLB mode at page table free time
      
      In order to simplify the TLB invalidate fixes for x86 and unify the
      parts that need backporting.  We'll try again later.
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: default avatarRik van Riel <riel@surriel.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      52a288c7
    • Nick Desaulniers's avatar
      include/linux/compiler*.h: make compiler-*.h mutually exclusive · 815f0ddb
      Nick Desaulniers authored
      Commit cafa0010 ("Raise the minimum required gcc version to 4.6")
      recently exposed a brittle part of the build for supporting non-gcc
      compilers.
      
      Both Clang and ICC define __GNUC__, __GNUC_MINOR__, and
      __GNUC_PATCHLEVEL__ for quick compatibility with code bases that haven't
      added compiler specific checks for __clang__ or __INTEL_COMPILER.
      
      This is brittle, as they happened to get compatibility by posing as a
      certain version of GCC.  This broke when upgrading the minimal version
      of GCC required to build the kernel, to a version above what ICC and
      Clang claim to be.
      
      Rather than always including compiler-gcc.h then undefining or
      redefining macros in compiler-intel.h or compiler-clang.h, let's
      separate out the compiler specific macro definitions into mutually
      exclusive headers, do more proper compiler detection, and keep shared
      definitions in compiler_types.h.
      
      Fixes: cafa0010 ("Raise the minimum required gcc version to 4.6")
      Reported-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Suggested-by: default avatarEli Friedman <efriedma@codeaurora.org>
      Suggested-by: default avatarJoe Perches <joe@perches.com>
      Signed-off-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      815f0ddb
  2. 22 Aug, 2018 19 commits
    • Linus Torvalds's avatar
      Merge tag 'platform-drivers-x86-v4.19-1' of git://git.infradead.org/linux-platform-drivers-x86 · 899fbc33
      Linus Torvalds authored
      Pull x86 platform driver updates from Andy Shevchenko:
      
       - The driver for Silead touchscreen configurations has been renamed
         from silead_dmi to touchscreen_dmi since it starts supporting other
         touchscreens which require some DMI quirks
      
         It also gets expanded to cover cases for Chuwi Vi10, ONDA V891W,
         Connect Tablet 9, Onda V820w, and Cube KNote i1101 tablets.
      
       - Another bunch of changes is related to Mellanox platform code to
         allow user space to communicate with Mellanox for system control and
         monitoring purposes. The driver notifies user on hotplug device
         signal receiving.
      
       - ASUS WMI drivers recognize lid flip action on UX360, and correctly
         toggles airplane mode LED. In addition the keyboard backlight toggle
         gets support.
      
       - ThinkPad ACPI driver enables support for calculator key (on at least
         P52). It also has been fixed to support three characters model
         designators, which are used for modern laptops. Earlier the battery,
         marked as BAT1, on ThinkPad laptops has not been configured properly,
         which is fixed. On the opposite the multi-battery configurations now
         probed correctly.
      
       - Dell SMBIOS driver starts working on some Dell servers which do not
         support token interface. The regression with backlight detection has
         also been fixed. In order to support dock mode on some laptops, Intel
         virtual button driver has been fixed. The last but not least is the
         fix to Intel HID driver due to changes in Dell systems that prevented
         to use power button.
      
      * tag 'platform-drivers-x86-v4.19-1' of git://git.infradead.org/linux-platform-drivers-x86: (47 commits)
        platform/x86: acer-wmi: Silence "unsupported" message a bit
        platform/x86: intel_punit_ipc: fix build errors
        platform/x86: ideapad: Add Y520-15IKBM and Y720-15IKBM to no_hw_rfkill
        platform/x86: asus-nb-wmi: Add keymap entry for lid flip action on UX360
        platform/x86: acer-wmi: refactor function has_cap
        platform/x86: thinkpad_acpi: Fix multi-battery bug
        platform/x86: thinkpad_acpi: extend battery quirk coverage
        platform/x86: touchscreen_dmi: Add info for the Cube KNote i1101 tablet
        platform/x86: mlx-platform: Fix copy-paste error in mlxplat_init()
        platform/x86: mlx-platform: Remove unused define
        platform/x86: mlx-platform: Change mlxreg-io configuration for MSN274x systems
        Documentation/ABI: Add new attribute for mlxreg-io sysfs interfaces
        platform/x86: mlx-platform: Allow mlxreg-io driver activation for more systems
        platform/x86: mlx-platform: Add ASIC hotplug device configuration
        platform/mellanox: mlxreg-hotplug: Add hotplug hwmon uevent notification
        platform/mellanox: mlxreg-hotplug: Improve mechanism of ASIC health discovery
        platform/x86: mlx-platform: Add mlxreg-fan platform driver activation
        platform/x86: dell-laptop: Fix backlight detection
        platform/x86: toshiba_acpi: Fix defined but not used build warnings
        platform/x86: thinkpad_acpi: Support battery quirk
        ...
      899fbc33
    • Tony Luck's avatar
      ia64: Fix allnoconfig section mismatch for ioc_init/ioc_iommu_info · 2edd73a4
      Tony Luck authored
      This has been broken for an embarassingly long time (since v4.4).
      
      Just needs a couple of __init tags on functions to make the sections
      match up.
      Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      2edd73a4
    • Linus Torvalds's avatar
      Merge branch 'parisc-4.19-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux · 45b74a65
      Linus Torvalds authored
      Pull more parisc updates from Helge Deller:
      
       - fix boot failure of 64-bit kernel. It got broken by the unwind
         optimization commit in merge window.
      
       - fix 64-bit userspace support (static 64-bit applications only, e.g.
         we don't yet have 64-bit userspace support in glibc).
      
       - consolidate unwind initialization code.
      
       - add machine model description to stack trace.
      
      * 'parisc-4.19-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
        parisc: Add hardware description to stack traces
        parisc: Fix boot failure of 64-bit kernel
        parisc: Consolidate unwind initialization calls
        parisc: Update comments in syscall.S regarding wide userland
        parisc: Fix ptraced 64-bit applications to call 64-bit syscalls
        parisc: Restore possibility to execute 64-bit applications
      45b74a65
    • Linus Torvalds's avatar
      Merge tag 'xtensa-20180820' of git://github.com/jcmvbkbc/linux-xtensa · 433bcf67
      Linus Torvalds authored
      Pull Xtensa updates from Max Filippov:
      
       - switch xtensa arch to the generic noncoherent direct mapping
         operations
      
       - add support for DMA_ATTR_NO_KERNEL_MAPPING attribute
      
       - clean up users of platform/hardware.h in generic Xtensa code
      
       - fix assembly cache maintenance code for long cache lines
      
       - rework noMMU cache attributes initialization
      
       - add big-endian HiFi2 test_kc705_be CPU variant
      
      * tag 'xtensa-20180820' of git://github.com/jcmvbkbc/linux-xtensa:
        xtensa: add test_kc705_be variant
        xtensa: clean up boot-elf/bootstrap.S
        xtensa: make bootparam parsing optional
        xtensa: drop variant IRQ support
        xtensa: drop unneeded platform/hardware.h headers
        xtensa: move PLATFORM_NR_IRQS to Kconfig
        xtensa: rework {CONFIG,PLATFORM}_DEFAULT_MEM_START
        xtensa: drop unused {CONFIG,PLATFORM}_DEFAULT_MEM_SIZE
        xtensa: rework noMMU cache attributes initialization
        xtensa: increase ranges in ___invalidate_{i,d}cache_all
        xtensa: limit offsets in __loop_cache_{all,page}
        xtensa: platform-specific handling of coherent memory
        xtensa: support DMA_ATTR_NO_KERNEL_MAPPING attribute
        xtensa: use generic dma_noncoherent_ops
      433bcf67
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · b3721153
      Linus Torvalds authored
      Pull second set of KVM updates from Paolo Bonzini:
       "ARM:
         - Support for Group0 interrupts in guests
         - Cache management optimizations for ARMv8.4 systems
         - Userspace interface for RAS
         - Fault path optimization
         - Emulated physical timer fixes
         - Random cleanups
      
        x86:
         - fixes for L1TF
         - a new test case
         - non-support for SGX (inject the right exception in the guest)
         - fix lockdep false positive"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (49 commits)
        KVM: VMX: fixes for vmentry_l1d_flush module parameter
        kvm: selftest: add dirty logging test
        kvm: selftest: pass in extra memory when create vm
        kvm: selftest: include the tools headers
        kvm: selftest: unify the guest port macros
        tools: introduce test_and_clear_bit
        KVM: x86: SVM: Call x86_spec_ctrl_set_guest/host() with interrupts disabled
        KVM: vmx: Inject #UD for SGX ENCLS instruction in guest
        KVM: vmx: Add defines for SGX ENCLS exiting
        x86/kvm/vmx: Fix coding style in vmx_setup_l1d_flush()
        x86: kvm: avoid unused variable warning
        KVM: Documentation: rename the capability of KVM_CAP_ARM_SET_SERROR_ESR
        KVM: arm/arm64: Skip updating PTE entry if no change
        KVM: arm/arm64: Skip updating PMD entry if no change
        KVM: arm: Use true and false for boolean values
        KVM: arm/arm64: vgic: Do not use spin_lock_irqsave/restore with irq disabled
        KVM: arm/arm64: vgic: Move DEBUG_SPINLOCK_BUG_ON to vgic.h
        KVM: arm: vgic-v3: Add support for ICC_SGI0R and ICC_ASGI1R accesses
        KVM: arm64: vgic-v3: Add support for ICC_SGI0R_EL1 and ICC_ASGI1R_EL1 accesses
        KVM: arm/arm64: vgic-v3: Add core support for Group0 SGIs
        ...
      b3721153
    • Linus Torvalds's avatar
      Merge tag 'for-4.19/post-20180822' of git://git.kernel.dk/linux-block · 5bed49ad
      Linus Torvalds authored
      Pull more block updates from Jens Axboe:
      
       - Set of bcache fixes and changes (Coly)
      
       - The flush warn fix (me)
      
       - Small series of BFQ fixes (Paolo)
      
       - wbt hang fix (Ming)
      
       - blktrace fix (Steven)
      
       - blk-mq hardware queue count update fix (Jianchao)
      
       - Various little fixes
      
      * tag 'for-4.19/post-20180822' of git://git.kernel.dk/linux-block: (31 commits)
        block/DAC960.c: make some arrays static const, shrinks object size
        blk-mq: sync the update nr_hw_queues with blk_mq_queue_tag_busy_iter
        blk-mq: init hctx sched after update ctx and hctx mapping
        block: remove duplicate initialization
        tracing/blktrace: Fix to allow setting same value
        pktcdvd: fix setting of 'ret' error return for a few cases
        block: change return type to bool
        block, bfq: return nbytes and not zero from struct cftype .write() method
        block, bfq: improve code of bfq_bfqq_charge_time
        block, bfq: reduce write overcharge
        block, bfq: always update the budget of an entity when needed
        block, bfq: readd missing reset of parent-entity service
        blk-wbt: fix IO hang in wbt_wait()
        block: don't warn for flush on read-only device
        bcache: add the missing comments for smp_mb()/smp_wmb()
        bcache: remove unnecessary space before ioctl function pointer arguments
        bcache: add missing SPDX header
        bcache: move open brace at end of function definitions to next line
        bcache: add static const prefix to char * array declarations
        bcache: fix code comments style
        ...
      5bed49ad
    • Linus Torvalds's avatar
      Merge tag 'f2fs-for-4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs · fe6f0ed0
      Linus Torvalds authored
      Pull f2fs updates from Jaegeuk Kim:
       "In this round, we've tuned f2fs to improve general performance by
        serializing block allocation and enhancing discard flows like fstrim
        which avoids user IO contention. And we've added fsync_mode=nobarrier
        which gives an option to user where it skips issuing cache_flush
        commands to underlying flash storage. And there are many bug fixes
        related to fuzzed images, revoked atomic writes, quota ops, and minor
        direct IO.
      
        Enhancements:
         - add fsync_mode=nobarrier which bypasses cache_flush command
         - enhance the discarding flow which avoids user IOs and issues in
           LBA order
         - readahead some encrypted blocks during GC
         - enable in-memory inode checksum to verify the blocks if
           F2FS_CHECK_FS is set
         - enhance nat_bits behavior
         - set -o discard by default
         - set REQ_RAHEAD to bio in ->readpages
      
        Bug fixes:
         - fix a corner case to corrupt atomic_writes revoking flow
         - revisit i_gc_rwsem to fix race conditions
         - fix some dio behaviors captured by xfstests
         - correct handling errors given by quota-related failures
         - add many sanity check flows to avoid fuzz test failures
         - add more error number propagation to their callers
         - fix several corner cases to continue fault injection w/ shutdown
           loop"
      
      * tag 'f2fs-for-4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs: (89 commits)
        f2fs: readahead encrypted block during GC
        f2fs: avoid fi->i_gc_rwsem[WRITE] lock in f2fs_gc
        f2fs: fix performance issue observed with multi-thread sequential read
        f2fs: fix to skip verifying block address for non-regular inode
        f2fs: rework fault injection handling to avoid a warning
        f2fs: support fault_type mount option
        f2fs: fix to return success when trimming meta area
        f2fs: fix use-after-free of dicard command entry
        f2fs: support discard submission error injection
        f2fs: split discard command in prior to block layer
        f2fs: wake up gc thread immediately when gc_urgent is set
        f2fs: fix incorrect range->len in f2fs_trim_fs()
        f2fs: refresh recent accessed nat entry in lru list
        f2fs: fix avoid race between truncate and background GC
        f2fs: avoid race between zero_range and background GC
        f2fs: fix to do sanity check with block address in main area v2
        f2fs: fix to do sanity check with inline flags
        f2fs: fix to reset i_gc_failures correctly
        f2fs: fix invalid memory access
        f2fs: fix to avoid broken of dnode block list
        ...
      fe6f0ed0
    • Miklos Szeredi's avatar
      ovl: set I_CREATING on inode being created · 6faf05c2
      Miklos Szeredi authored
      ...otherwise there will be list corruption due to inode_sb_list_add() being
      called for inode already on the sb list.
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      Fixes: e950564b ("vfs: don't evict uninitialized inode")
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      6faf05c2
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · cd9b44f9
      Linus Torvalds authored
      Merge more updates from Andrew Morton:
      
       - the rest of MM
      
       - procfs updates
      
       - various misc things
      
       - more y2038 fixes
      
       - get_maintainer updates
      
       - lib/ updates
      
       - checkpatch updates
      
       - various epoll updates
      
       - autofs updates
      
       - hfsplus
      
       - some reiserfs work
      
       - fatfs updates
      
       - signal.c cleanups
      
       - ipc/ updates
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (166 commits)
        ipc/util.c: update return value of ipc_getref from int to bool
        ipc/util.c: further variable name cleanups
        ipc: simplify ipc initialization
        ipc: get rid of ids->tables_initialized hack
        lib/rhashtable: guarantee initial hashtable allocation
        lib/rhashtable: simplify bucket_table_alloc()
        ipc: drop ipc_lock()
        ipc/util.c: correct comment in ipc_obtain_object_check
        ipc: rename ipcctl_pre_down_nolock()
        ipc/util.c: use ipc_rcu_putref() for failues in ipc_addid()
        ipc: reorganize initialization of kern_ipc_perm.seq
        ipc: compute kern_ipc_perm.id under the ipc lock
        init/Kconfig: remove EXPERT from CHECKPOINT_RESTORE
        fs/sysv/inode.c: use ktime_get_real_seconds() for superblock stamp
        adfs: use timespec64 for time conversion
        kernel/sysctl.c: fix typos in comments
        drivers/rapidio/devices/rio_mport_cdev.c: remove redundant pointer md
        fork: don't copy inconsistent signal handler state to child
        signal: make get_signal() return bool
        signal: make sigkill_pending() return bool
        ...
      cd9b44f9
    • Manfred Spraul's avatar
      ipc/util.c: update return value of ipc_getref from int to bool · 2a9d6481
      Manfred Spraul authored
      ipc_getref has still a return value of type "int", matching the atomic_t
      interface of atomic_inc_not_zero()/atomic_add_unless().
      
      ipc_getref now uses refcount_inc_not_zero, which has a return value of
      type "bool".
      
      Therefore, update the return code to avoid implicit conversions.
      
      Link: http://lkml.kernel.org/r/20180712185241.4017-13-manfred@colorfullife.comSigned-off-by: default avatarManfred Spraul <manfred@colorfullife.com>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Davidlohr Bueso <dbueso@suse.de>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: Michal Hocko <mhocko@suse.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      2a9d6481
    • Manfred Spraul's avatar
      ipc/util.c: further variable name cleanups · 27c331a1
      Manfred Spraul authored
      The varable names got a mess, thus standardize them again:
      
      id: user space id. Called semid, shmid, msgid if the type is known.
          Most functions use "id" already.
      idx: "index" for the idr lookup
          Right now, some functions use lid, ipc_addid() already uses idx as
          the variable name.
      seq: sequence number, to avoid quick collisions of the user space id
      key: user space key, used for the rhash tree
      
      Link: http://lkml.kernel.org/r/20180712185241.4017-12-manfred@colorfullife.comSigned-off-by: default avatarManfred Spraul <manfred@colorfullife.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Davidlohr Bueso <dbueso@suse.de>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: Michal Hocko <mhocko@suse.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      27c331a1
    • Davidlohr Bueso's avatar
      ipc: simplify ipc initialization · eae04d25
      Davidlohr Bueso authored
      Now that we know that rhashtable_init() will not fail, we can get rid of a
      lot of the unnecessary cleanup paths when the call errored out.
      
      [manfred@colorfullife.com: variable name added to util.h to resolve checkpatch warning]
      Link: http://lkml.kernel.org/r/20180712185241.4017-11-manfred@colorfullife.comSigned-off-by: default avatarDavidlohr Bueso <dbueso@suse.de>
      Signed-off-by: default avatarManfred Spraul <manfred@colorfullife.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: Michal Hocko <mhocko@suse.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      eae04d25
    • Davidlohr Bueso's avatar
      ipc: get rid of ids->tables_initialized hack · dc2c8c84
      Davidlohr Bueso authored
      In sysvipc we have an ids->tables_initialized regarding the rhashtable,
      introduced in 0cfb6aee ("ipc: optimize semget/shmget/msgget for lots
      of keys")
      
      It's there, specifically, to prevent nil pointer dereferences, from using
      an uninitialized api.  Considering how rhashtable_init() can fail
      (probably due to ENOMEM, if anything), this made the overall ipc
      initialization capable of failure as well.  That alone is ugly, but fine,
      however I've spotted a few issues regarding the semantics of
      tables_initialized (however unlikely they may be):
      
      - There is inconsistency in what we return to userspace: ipc_addid()
        returns ENOSPC which is certainly _wrong_, while ipc_obtain_object_idr()
        returns EINVAL.
      
      - After we started using rhashtables, ipc_findkey() can return nil upon
        !tables_initialized, but the caller expects nil for when the ipc
        structure isn't found, and can therefore call into ipcget() callbacks.
      
      Now that rhashtable initialization cannot fail, we can properly get rid of
      the hack altogether.
      
      [manfred@colorfullife.com: commit id extended to 12 digits]
      Link: http://lkml.kernel.org/r/20180712185241.4017-10-manfred@colorfullife.comSigned-off-by: default avatarDavidlohr Bueso <dbueso@suse.de>
      Signed-off-by: default avatarManfred Spraul <manfred@colorfullife.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: Michal Hocko <mhocko@suse.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      dc2c8c84
    • Davidlohr Bueso's avatar
      lib/rhashtable: guarantee initial hashtable allocation · 2d22ecf6
      Davidlohr Bueso authored
      rhashtable_init() may fail due to -ENOMEM, thus making the entire api
      unusable.  This patch removes this scenario, however unlikely.  In order
      to guarantee memory allocation, this patch always ends up doing
      GFP_KERNEL|__GFP_NOFAIL for both the tbl as well as
      alloc_bucket_spinlocks().
      
      Upon the first table allocation failure, we shrink the size to the
      smallest value that makes sense and retry with __GFP_NOFAIL semantics.
      With the defaults, this means that from 64 buckets, we retry with only 4.
      Any later issues regarding performance due to collisions or larger table
      resizing (when more memory becomes available) is the least of our
      problems.
      
      Link: http://lkml.kernel.org/r/20180712185241.4017-9-manfred@colorfullife.comSigned-off-by: default avatarDavidlohr Bueso <dbueso@suse.de>
      Signed-off-by: default avatarManfred Spraul <manfred@colorfullife.com>
      Acked-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: Michal Hocko <mhocko@suse.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      2d22ecf6
    • Davidlohr Bueso's avatar
      lib/rhashtable: simplify bucket_table_alloc() · 93f976b5
      Davidlohr Bueso authored
      As of ce91f6ee ("mm: kvmalloc does not fallback to vmalloc for
      incompatible gfp flags") we can simplify the caller and trust kvzalloc()
      to just do the right thing.  For the case of the GFP_ATOMIC context, we
      can drop the __GFP_NORETRY flag for obvious reasons, and for the
      __GFP_NOWARN case, however, it is changed such that the caller passes the
      flag instead of making bucket_table_alloc() handle it.
      
      This slightly changes the gfp flags passed on to nested_table_alloc() as
      it will now also use GFP_ATOMIC | __GFP_NOWARN.  However, I consider this
      a positive consequence as for the same reasons we want nowarn semantics in
      bucket_table_alloc().
      
      [manfred@colorfullife.com: commit id extended to 12 digits, line wraps updated]
      Link: http://lkml.kernel.org/r/20180712185241.4017-8-manfred@colorfullife.comSigned-off-by: default avatarDavidlohr Bueso <dbueso@suse.de>
      Signed-off-by: default avatarManfred Spraul <manfred@colorfullife.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      93f976b5
    • Davidlohr Bueso's avatar
      ipc: drop ipc_lock() · 82061c57
      Davidlohr Bueso authored
      ipc/util.c contains multiple functions to get the ipc object pointer given
      an id number.
      
      There are two sets of function: One set verifies the sequence counter part
      of the id number, other functions do not check the sequence counter.
      
      The standard for function names in ipc/util.c is
      - ..._check() functions verify the sequence counter
      - ..._idr() functions do not verify the sequence counter
      
      ipc_lock() is an exception: It does not verify the sequence counter value,
      but this is not obvious from the function name.
      
      Furthermore, shm.c is the only user of this helper.  Thus, we can simply
      move the logic into shm_lock() and get rid of the function altogether.
      
      [manfred@colorfullife.com: most of changelog]
      Link: http://lkml.kernel.org/r/20180712185241.4017-7-manfred@colorfullife.comSigned-off-by: default avatarDavidlohr Bueso <dbueso@suse.de>
      Signed-off-by: default avatarManfred Spraul <manfred@colorfullife.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: Michal Hocko <mhocko@suse.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      82061c57
    • Manfred Spraul's avatar
      ipc/util.c: correct comment in ipc_obtain_object_check · 2e5ceb45
      Manfred Spraul authored
      The comment that explains ipc_obtain_object_check is wrong: The function
      checks the sequence number, not the reference counter.
      
      Note that checking the reference counter would be meaningless: The
      reference counter is decreased without holding any locks, thus an object
      with kern_ipc_perm.deleted=true may disappear at the end of the next rcu
      grace period.
      
      Link: http://lkml.kernel.org/r/20180712185241.4017-6-manfred@colorfullife.comSigned-off-by: default avatarManfred Spraul <manfred@colorfullife.com>
      Reviewed-by: default avatarDavidlohr Bueso <dbueso@suse.de>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: Michal Hocko <mhocko@suse.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      2e5ceb45
    • Manfred Spraul's avatar
      ipc: rename ipcctl_pre_down_nolock() · 4241c1a3
      Manfred Spraul authored
      Both the comment and the name of ipcctl_pre_down_nolock() are misleading:
      The function must be called while holdling the rw semaphore.
      
      Therefore the patch renames the function to ipcctl_obtain_check(): This
      name matches the other names used in util.c:
      
      - "obtain" function look up a pointer in the idr, without
        acquiring the object lock.
      - The caller is responsible for locking.
      - _check means that the sequence number is checked.
      
      Link: http://lkml.kernel.org/r/20180712185241.4017-5-manfred@colorfullife.comSigned-off-by: default avatarManfred Spraul <manfred@colorfullife.com>
      Reviewed-by: default avatarDavidlohr Bueso <dbueso@suse.de>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: Michal Hocko <mhocko@suse.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      4241c1a3
    • Manfred Spraul's avatar
      ipc/util.c: use ipc_rcu_putref() for failues in ipc_addid() · 39cfffd7
      Manfred Spraul authored
      ipc_addid() is impossible to use:
      - for certain failures, the caller must not use ipc_rcu_putref(),
        because the reference counter is not yet initialized.
      - for other failures, the caller must use ipc_rcu_putref(),
        because parallel operations could be ongoing already.
      
      The patch cleans that up, by initializing the refcount early, and by
      modifying all callers.
      
      The issues is related to the finding of
      syzbot+2827ef6b3385deb07eaf@syzkaller.appspotmail.com: syzbot found an
      issue with reading kern_ipc_perm.seq, here both read and write to already
      released memory could happen.
      
      Link: http://lkml.kernel.org/r/20180712185241.4017-4-manfred@colorfullife.comSigned-off-by: default avatarManfred Spraul <manfred@colorfullife.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Davidlohr Bueso <dbueso@suse.de>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: Michal Hocko <mhocko@suse.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      39cfffd7