1. 07 Mar, 2019 2 commits
  2. 06 Mar, 2019 38 commits
    • Linus Torvalds's avatar
      Merge tag 'pm-5.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · ef800684
      Linus Torvalds authored
      Pull power management updates from Rafael Wysocki:
       "These are PM-runtime framework changes to use ktime instead of jiffies
        for accounting, new PM core flag to mark devices that don't need any
        form of power management, cpuidle updates including driver API
        documentation and a new governor, cpufreq updates including a new
        driver for Armada 8K, thermal cleanups and more, some energy-aware
        scheduling (EAS) enabling changes, new chips support in the intel_idle
        and RAPL drivers and assorted cleanups in some other places.
      
        Specifics:
      
         - Update the PM-runtime framework to use ktime instead of jiffies for
           accounting (Thara Gopinath, Vincent Guittot)
      
         - Optimize the autosuspend code in the PM-runtime framework somewhat
           (Ladislav Michl)
      
         - Add a PM core flag to mark devices that don't need any form of
           power management (Sudeep Holla)
      
         - Introduce driver API documentation for cpuidle and add a new
           cpuidle governor for tickless systems (Rafael Wysocki)
      
         - Add Jacobsville support to the intel_idle driver (Zhang Rui)
      
         - Clean up a cpuidle core header file and the cpuidle-dt and ACPI
           processor-idle drivers (Yangtao Li, Joseph Lo, Yazen Ghannam)
      
         - Add new cpufreq driver for Armada 8K (Gregory Clement)
      
         - Fix and clean up cpufreq core (Rafael Wysocki, Viresh Kumar, Amit
           Kucheria)
      
         - Add support for light-weight tear-down and bring-up of CPUs to the
           cpufreq core and use it in the cpufreq-dt driver (Viresh Kumar)
      
         - Fix cpu_cooling Kconfig dependencies, add support for CPU cooling
           auto-registration to the cpufreq core and use it in multiple
           cpufreq drivers (Amit Kucheria)
      
         - Fix some minor issues and do some cleanups in the davinci,
           e_powersaver, ap806, s5pv210, qcom and kryo cpufreq drivers
           (Bartosz Golaszewski, Gustavo Silva, Julia Lawall, Paweł Chmiel,
           Taniya Das, Viresh Kumar)
      
         - Add a Hisilicon CPPC quirk to the cppc_cpufreq driver (Xiongfeng
           Wang)
      
         - Clean up the intel_pstate and acpi-cpufreq drivers (Erwan Velu,
           Rafael Wysocki)
      
         - Clean up multiple cpufreq drivers (Yangtao Li)
      
         - Update cpufreq-related MAINTAINERS entries (Baruch Siach, Lukas
           Bulwahn)
      
         - Add support for exposing the Energy Model via debugfs and make
           multiple cpufreq drivers register an Energy Model to support
           energy-aware scheduling (Quentin Perret, Dietmar Eggemann, Matthias
           Kaehlcke)
      
         - Add Ice Lake mobile and Jacobsville support to the Intel RAPL
           power-capping driver (Gayatri Kammela, Zhang Rui)
      
         - Add a power estimation helper to the operating performance points
           (OPP) framework and clean up a core function in it (Quentin Perret,
           Viresh Kumar)
      
         - Make minor improvements in the generic power domains (genpd), OPP
           and system suspend frameworks and in the PM core (Aditya Pakki,
           Douglas Anderson, Greg Kroah-Hartman, Rafael Wysocki, Yangtao Li)"
      
      * tag 'pm-5.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (80 commits)
        cpufreq: kryo: Release OPP tables on module removal
        cpufreq: ap806: add missing of_node_put after of_device_is_available
        cpufreq: acpi-cpufreq: Report if CPU doesn't support boost technologies
        cpufreq: Pass updated policy to driver ->setpolicy() callback
        cpufreq: Fix two debug messages in cpufreq_set_policy()
        cpufreq: Reorder and simplify cpufreq_update_policy()
        cpufreq: Add kerneldoc comments for two core functions
        PM / core: Add support to skip power management in device/driver model
        cpufreq: intel_pstate: Rework iowait boosting to be less aggressive
        cpufreq: intel_pstate: Eliminate intel_pstate_get_base_pstate()
        cpufreq: intel_pstate: Avoid redundant initialization of local vars
        powercap/intel_rapl: add Ice Lake mobile
        ACPI / processor: Set P_LVL{2,3} idle state descriptions
        cpufreq / cppc: Work around for Hisilicon CPPC cpufreq
        ACPI / CPPC: Add a helper to get desired performance
        cpufreq: davinci: move configuration to include/linux/platform_data
        cpufreq: speedstep: convert BUG() to BUG_ON()
        cpufreq: powernv: fix missing check of return value in init_powernv_pstates()
        cpufreq: longhaul: remove unneeded semicolon
        cpufreq: pcc-cpufreq: remove unneeded semicolon
        ..
      ef800684
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · 8dcd175b
      Linus Torvalds authored
      Merge misc updates from Andrew Morton:
      
       - a few misc things
      
       - ocfs2 updates
      
       - most of MM
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (159 commits)
        tools/testing/selftests/proc/proc-self-syscall.c: remove duplicate include
        proc: more robust bulk read test
        proc: test /proc/*/maps, smaps, smaps_rollup, statm
        proc: use seq_puts() everywhere
        proc: read kernel cpu stat pointer once
        proc: remove unused argument in proc_pid_lookup()
        fs/proc/thread_self.c: code cleanup for proc_setup_thread_self()
        fs/proc/self.c: code cleanup for proc_setup_self()
        proc: return exit code 4 for skipped tests
        mm,mremap: bail out earlier in mremap_to under map pressure
        mm/sparse: fix a bad comparison
        mm/memory.c: do_fault: avoid usage of stale vm_area_struct
        writeback: fix inode cgroup switching comment
        mm/huge_memory.c: fix "orig_pud" set but not used
        mm/hotplug: fix an imbalance with DEBUG_PAGEALLOC
        mm/memcontrol.c: fix bad line in comment
        mm/cma.c: cma_declare_contiguous: correct err handling
        mm/page_ext.c: fix an imbalance with kmemleak
        mm/compaction: pass pgdat to too_many_isolated() instead of zone
        mm: remove zone_lru_lock() function, access ->lru_lock directly
        ...
      8dcd175b
    • Linus Torvalds's avatar
      Merge tag 'armsoc-late' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · afe6fe70
      Linus Torvalds authored
      Pull ARM SoC late updates from Arnd Bergmann:
       "Here are two branches that came relatively late during the linux-5.0
        development cycle and have dependencies on the other branches:
      
         - On the TI OMAP platform, the CPSW Ethernet PHY mode selection
           driver is being replaced, this puts the final pieces in place
      
         - On the DaVinci platform, the interrupt handling code in arch/arm
           gets moved into a regular device driver in drivers/irqchip.
      
        Since they both had some time in linux-next after the 5.0-rc8 release,
        I'm sending them along with the other updates"
      
      * tag 'armsoc-late' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (38 commits)
        net: ethernet: ti: cpsw: deprecate cpsw-phy-sel driver
        ARM: davinci: remove intc related fields from davinci_soc_info
        irqchip: davinci-cp-intc: move the driver to drivers/irqchip
        ARM: davinci: cp-intc: remove redundant comments
        ARM: davinci: cp-intc: drop GPL license boilerplate
        ARM: davinci: cp-intc: use readl/writel_relaxed()
        ARM: davinci: cp-intc: unify error handling
        ARM: davinci: cp-intc: improve coding style
        ARM: davinci: cp-intc: request the memory region before remapping it
        ARM: davinci: cp-intc: use the new-style config structure
        ARM: davinci: cp-intc: convert all hex numbers to lowercase
        ARM: davinci: cp-intc: use a common prefix for all symbols
        ARM: davinci: cp-intc: add the new config structures for da8xx SoCs
        irqchip: davinci-cp-intc: add a new config structure
        ARM: davinci: cp-intc: add a wrapper around cp_intc_init()
        ARM: davinci: cp-intc: remove cp_intc.h
        irqchip: davinci-aintc: move the driver to drivers/irqchip
        ARM: davinci: aintc: remove unnecessary includes
        ARM: davinci: aintc: remove the timer-specific irq_set_handler()
        ARM: davinci: aintc: request memory region before remapping it
        ...
      afe6fe70
    • Linus Torvalds's avatar
      Merge tag 'armsoc-newsoc' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · 64b1b217
      Linus Torvalds authored
      Pull ARM new SoC family support from Arnd Bergmann:
       "Two new SoC families are added this time.
      
        Sugaya Taichi submitted support for the Milbeaut SoC family from
        Socionext and explains:
      
          "SC2000 is a SoC of the Milbeaut series. equipped with a DSP
           optimized for computer vision. It also features advanced
           functionalities such as 360-degree, real-time spherical stitching
           with multi cameras, image stabilization for without mechanical
           gimbals, and rolling shutter correction. More detail is below:
      
             https://www.socionext.com/en/products/assp/milbeaut/SC2000.html"
      
        Interestingly, this one has a history dating back to older chips made
        by Socionext and previously Matsushita/Panasonic based on their own
        mn10300 CPU architecture that was removed from the kernel last year.
      
        Manivannan Sadhasivam adds support for another SoC family, this is the
        Bitmain BM1880 chip used in the Sophon Edge TPU developer board.
      
        The chip is intended for Deep Learning applications, and comes with
        dual-core Arm Cortex-A53 to run Linux as well as a RISC-V
        microcontroller core to control the tensor unit. For the moment, the
        TPU is not accessible in mainline Linux, so we treat it as a generic
        Arm SoC.
      
        More information is available at
      
             https://www.sophon.ai/"
      
      * tag 'armsoc-newsoc' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc:
        ARM: multi_v7_defconfig: add ARCH_MILBEAUT and ARCH_MILBEAUT_M10V
        ARM: configs: Add Milbeaut M10V defconfig
        ARM: dts: milbeaut: Add device tree set for the Milbeaut M10V board
        clocksource/drivers/timer-milbeaut: Introduce timer for Milbeaut SoCs
        dt-bindings: timer: Add Milbeaut M10V timer description
        ARM: milbeaut: Add basic support for Milbeaut m10v SoC
        dt-bindings: Add documentation for Milbeaut SoCs
        dt-bindings: arm: Add SMP enable-method for Milbeaut
        dt-bindings: sram: milbeaut: Add binding for Milbeaut smp-sram
        MAINTAINERS: Add entry for Bitmain SoC platform
        arm64: dts: bitmain: Add Sophon Egde board support
        arm64: dts: bitmain: Add BM1880 SoC support
        arm64: Add ARCH_BITMAIN platform
        dt-bindings: arm: Document Bitmain BM1880 SoC
      64b1b217
    • Linus Torvalds's avatar
      Merge tag 'armsoc-defconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · fb686ad2
      Linus Torvalds authored
      Pull ARM SoC defconfig updates from Arnd Bergmann:
       "We regenerated the defconfig files for samsung, shmobile, lpc18xx,
        lpc32xx, omap2, and nhk8815.
      
        Lots of additional drivers added on samsung and nhk8815, as well as
        the new pl110 driver on all machines that have it.
      
        The remaining changes are mostly to enable newly added drivers, and in
        case of imx8mq together with the SoC getting merged"
      
      * tag 'armsoc-defconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (47 commits)
        ARM: spear3xx_defconfig: Activate PL111 DRM driver
        ARM: nhk8815_defconfig: Add new options
        ARM: nhk8815_defconfig: Update defconfig
        ARM: pxa: remove CONFIG_SND_PXA2XX_AC97 in pxa_defconfig
        ARM: defconfig: integrator: Switch to DRM
        arm64: defconfig: Add IMX2+ watchdog
        arm64: defconfig: Enable PFUZE100 regulator
        arm64: defconfig: enable NXP FlexSPI driver
        arm64: defconfig: Add i.MX8MQ boot necessary configs
        arm64: defconfig: add imx8qxp support
        arm64: defconfig: add i.MX system controller RTC support
        arm64: defconfig: Enable Tegra TCU
        arm64: defconfig: Enable MAX8973 regulator
        ARM: socfpga_defconfig: enable BLK_DEV_LOOP config option
        ARM: defconfig: lpc32xx: enable DRM simple panel driver
        ARM: defconfig: lpc32xx: enable fixed voltage regulator support
        arm64: defconfig: Enable SUN6I Camera sensor interface
        arm64: defconfig: Enable I2C_GPIO
        ARM: omap2plus_defconfig: Update for moved options
        ARM: omap2plus_defconfig: Update for dropped options
        ...
      fb686ad2
    • Linus Torvalds's avatar
      Merge tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · 384d11fa
      Linus Torvalds authored
      Pull ARM SoC driver updates from Arnd Bergmann:
       "As usual, the drivers/tee and drivers/reset subsystems get merged
        here, with the expected set of smaller updates and some new hardware
        support. The tee subsystem now supports device drivers to be attached
        to a tee, the first example here is a random number driver with its
        implementation in the secure world.
      
        Three new power domain drivers get added for specific chip families:
         - Broadcom BCM283x chips (used in Raspberry Pi)
         - Qualcomm Snapdragon phone chips
         - Xilinx ZynqMP FPGA SoCs
      
        One new driver is added to talk to the BPMP firmware on NVIDIA
        Tegra210
      
        Existing drivers are extended for new SoC variants from NXP, NVIDIA,
        Amlogic and Qualcomm"
      
      * tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (113 commits)
        tee: optee: update optee_msg.h and optee_smc.h to dual license
        tee: add cancellation support to client interface
        dpaa2-eth: configure the cache stashing amount on a queue
        soc: fsl: dpio: configure cache stashing destination
        soc: fsl: dpio: enable frame data cache stashing per software portal
        soc: fsl: guts: make fsl_guts_get_svr() static
        hwrng: make symbol 'optee_rng_id_table' static
        tee: optee: Fix unsigned comparison with less than zero
        hwrng: Fix unsigned comparison with less than zero
        tee: fix possible error pointer ctx dereferencing
        hwrng: optee: Initialize some structs using memset instead of braces
        tee: optee: Initialize some structs using memset instead of braces
        soc: fsl: dpio: fix memory leak of a struct qbman on error exit path
        clk: tegra: dfll: Make symbol 'tegra210_cpu_cvb_tables' static
        soc: qcom: llcc-slice: Fix typos
        qcom: soc: llcc-slice: Consolidate some code
        qcom: soc: llcc-slice: Clear the global drv_data pointer on error
        drivers: soc: xilinx: Add ZynqMP power domain driver
        firmware: xilinx: Add APIs to control node status/power
        dt-bindings: power: Add ZynqMP power domain bindings
        ...
      384d11fa
    • Linus Torvalds's avatar
      Merge tag 'armsoc-dt' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · 6ad63dec
      Linus Torvalds authored
      Pull ARM SoC device tree updates from Arnd Bergmann:
       "This is a smaller update than the past few times, but with just over
        500 non-merge changesets still dwarfes the rest of the SoC tree.
      
        Three new SoC platforms get added, each one a follow-up to an existing
        product, and added here in combination with a reference platform:
      
         - Renesas RZ/A2M (R7S9210) 32-bit Cortex-A9 Real-time imaging
           processor:
      
             https://www.renesas.com/eu/en/products/microcontrollers-microprocessors/rz/rza/rza2m.html
      
         - Renesas RZ/G2E (r8a774c0) 64-bit Cortex-A53 SoC "for Rich Graphics
           Applications":
      
             https://www.renesas.com/eu/en/products/microcontrollers-microprocessors/rz/rzg/rzg2e.html
      
         - NXP i.MX8QuadXPlus 64-bit Cortex-A35 SoC:
      
             https://www.nxp.com/products/processors-and-microcontrollers/arm-based-processors-and-mcus/i.mx-applications-processors/i.mx-8-processors/i.mx-8x-family-arm-cortex-a35-3d-graphics-4k-video-dsp-error-correcting-code-on-ddr:i.MX8X
      
        These are actual commercial products we now support with an in-kernel
        device tree source file:
      
         - Bosch Guardian is a product made by Bosch Power Tools GmbH, based
           on the Texas Instruments AM335x chip
      
         - Winterland IceBoard is a Texas Instruments AM3874 based machine
           used in telescopes at the south pole and elsewhere, see commit
           d0317731 for some pointers:
      
         - Inspur on5263m5 is an x86 server platform with an Aspeed ast2500
           baseboard management controller. This is for running on the BMC.
      
         - Zodiac Digital Tapping Unit, apparently a kind of ethernet switch
           used in airplanes.
      
         - Phicomm K3 is a WiFi router based on Broadcom bcm47094
      
         - Methode Electronics uDPU FTTdp distribution point unit
      
         - X96 Max, a generic TV box based on Amlogic G12a (S905X2)
      
         - NVIDIA Shield TV (Darcy) based on Tegra210
      
        And then there are several new SBC, evaluation, development or modular
        systems that we add:
      
         - Three new Rockchips rk3399 based boards:
             - FriendlyElec NanoPC-T4 and NanoPi M4
             - Radxa ROCK Pi 4
      
         - Five new i.MX6 family SoM modules and boards for industrial
           products:
             - Logic PD i.MX6QD SoM and evaluation baseboad
             - Y Soft IOTA Draco/Hydra/Ursa family boards based on i.MX6DL
             - Phytec phyCORE i.MX6 UltraLite SoM and evaluation module
      
         - MYIR Tech MYD-LPC4357 development based on the NXP lpc4357
           microcontroller
      
         - Chameleon96, an Intel/Altera Cyclone5 based FPGA development system
           in 96boards form factor
      
         - Arm Fixed Virtual Platforms(FVP) Base RevC, a purely virtual
           platform for corresponding to the latest "fast model"
      
         - Another Raspberry Pi variant: Model 3 A+, supported both in 32-bit
           and 64-bit mode.
      
         - Oxalis Evalkit V100 based on NXP Layerscape LS1012a, in 96Boards
           enterprise form factor
      
         - Elgin RV1108 R1 development board based on 32-bit Rockchips RV1108
      
        For already supported boards and SoCs, we often add support for new
        devices after merging the drivers. This time, the largest changes
        include updates for
      
         - STMicroelectronics stm32mp1, which was now formally launched last
           week
      
         - Qualcomm Snapdragon 845, a high-end phone and low-end laptop chip
      
         - Action Semi S700
      
         - TI AM654x, their recently merged 64-bit SoC from the OMAP family
      
         - Various Amlogic Meson SoCs
      
         - Mediatek MT2712
      
         - NVIDIA Tegra186 and Tegra210
      
         - The ancient NXP lpc32xx family
      
         - Samsung s5pv210, used in some older mobile phones
      
        Many other chips see smaller updates and bugfixes beyond that"
      
      * tag 'armsoc-dt' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (506 commits)
        ARM: dts: exynos: Fix max voltage for buck8 regulator on Odroid XU3/XU4
        dt-bindings: net: ti: deprecate cpsw-phy-sel bindings
        ARM: dts: am335x: switch to use phy-gmii-sel
        ARM: dts: am4372: switch to use phy-gmii-sel
        ARM: dts: dm814x: switch to use phy-gmii-sel
        ARM: dts: dra7: switch to use phy-gmii-sel
        arch: arm: dts: kirkwood-rd88f6281: Remove disabled marvell,dsa reference
        ARM: dts: exynos: Add support for secondary DAI to Odroid XU4
        ARM: dts: exynos: Add support for secondary DAI to Odroid XU3
        ARM: dts: exynos: Disable ARM PMU on Odroid XU3-lite
        ARM: dts: exynos: Add stdout path property to Arndale board
        ARM: dts: exynos: Add minimal clkout parameters to Exynos3250 PMU
        ARM: dts: exynos: Enable ADC on Odroid HC1
        arm64: dts: sprd: Remove wildcard compatible string
        arm64: dts: sprd: Add SC27XX fuel gauge device
        arm64: dts: sprd: Add SC2731 charger device
        arm64: dts: sprd: Add ADC calibration support
        arm64: dts: sprd: Remove PMIC INTC irq trigger type
        arm64: dts: rockchip: Enable tsadc device on rock960
        ARM: dts: rockchip: add chosen node on veyron devices
        ...
      6ad63dec
    • Linus Torvalds's avatar
      Merge tag 'armsoc-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · aebbfafc
      Linus Torvalds authored
      Pull ARM SoC platform updates from Arnd Bergmann:
       "The APM X-Gene platform is now maintained by folks from Ampere
        computing that took over the product line a while ago, this gets
        reflected in the MAINTAINERS file.
      
        Cleanups continue on the older mach-davinci and mach-pxa platform, to
        get them to be more like the modern ones. For pxa, we now remove the
        Raumfeld platform code as it now works with device tree based booting.
      
        i.MX adds a couple new features for the i.MX7ULP SoC
      
        Mediatek gains support for a new SoC: MT7629 is a new wireless router
        platform, following MT7623.
      
        Aside from those, there are the usual minor cleanups and bugfixes
        across several platforms"
      
      * tag 'armsoc-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (49 commits)
        MAINTAINERS: Update Ampere email address
        usb: ohci-da8xx: remove unused callbacks from platform data
        ARM: davinci: da830-evm: remove legacy usb helpers
        ARM: davinci: omapl138-hawk: remove legacy usb helpers
        usb: ohci-da8xx: add vbus and overcurrent gpios
        ARM: davinci: da830-evm: use gpio lookup entries for usb gpios
        ARM: davinci: omapl138-hawk: use gpio lookup entries for usb gpios
        usb: ohci-da8xx: add a helper pointer to &pdev->dev
        usb: ohci-da8xx: add a new line after local variables
        arm64: meson: enable g12a clock controller
        MAINTAINERS: Add entry for uDPU board
        ARM: davinci: da850-evm: use GPIO hogs instead of the legacy API
        arm: mediatek: add MT7629 smp bring up code
        Revert "ARM: mediatek: add MT7623a smp bringup code"
        dt-bindings: soc: fix typo of MT8173 power dt-bindings
        ARM: meson: remove COMMON_CLK_AMLOGIC selection
        arm64: meson: remove COMMON_CLK_AMLOGIC selection
        ARM: lpc32xx: remove platform data of ARM PL111 LCD controller
        ARM: lpc32xx: remove platform data of ARM PL180 SD/MMC controller
        ARM: lpc32xx: Use kmemdup to replace duplicating its implementation
        ...
      aebbfafc
    • Linus Torvalds's avatar
      Merge tag 'asm-generic-5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic · fa29f5ba
      Linus Torvalds authored
      Pull asm-generic updates from Arnd Bergmann:
       "Only a few small changes this time:
      
         - Michael S. Tsirkin cleans up linux/mman.h
      
         - Mike Rapoport found a typo
      
        I had originally merged another cleanup series for I/O accessors from
        Hugo Lefeuvre as well, but dropped it after the discussion of the
        barrier semantics and some conflicts. I expect this series to get
        merged for a later release though"
      
      * tag 'asm-generic-5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic:
        asm-generic/page.h: fix typo in #error text requiring a real asm/page.h
        arch: move common mmap flags to linux/mman.h
        drm: tweak header name
        x86/mpx: tweak header name
      fa29f5ba
    • Linus Torvalds's avatar
      Merge tag 'y2038-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground · 78e10b5e
      Linus Torvalds authored
      Pull y2038 build fix for compat mode from Arnd Bergmann:
       "Here is one more patch on top of the y2038 changes already pulled for
        linux-5.1, for some reason this had escaped all testing"
      
      * tag 'y2038-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground:
        ipc: Fix building compat mode without sysvipc
      78e10b5e
    • Linus Torvalds's avatar
      Merge branch 'x86-alternatives-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 6ea98b4b
      Linus Torvalds authored
      Pull x86 alternative instruction updates from Ingo Molnar:
       "Small RDTSCP opimization, enabled by the newly added ALTERNATIVE_3(),
        and other small improvements"
      
      * 'x86-alternatives-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/TSC: Use RDTSCP
        x86/alternatives: Add an ALTERNATIVE_3() macro
        x86/alternatives: Print containing function
        x86/alternatives: Add macro comments
      6ea98b4b
    • Linus Torvalds's avatar
      Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 45802da0
      Linus Torvalds authored
      Pull scheduler updates from Ingo Molnar:
       "The main changes in this cycle were:
      
         - refcount conversions
      
         - Solve the rq->leaf_cfs_rq_list can of worms for real.
      
         - improve power-aware scheduling
      
         - add sysctl knob for Energy Aware Scheduling
      
         - documentation updates
      
         - misc other changes"
      
      * 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (34 commits)
        kthread: Do not use TIMER_IRQSAFE
        kthread: Convert worker lock to raw spinlock
        sched/fair: Use non-atomic cpumask_{set,clear}_cpu()
        sched/fair: Remove unused 'sd' parameter from select_idle_smt()
        sched/wait: Use freezable_schedule() when possible
        sched/fair: Prune, fix and simplify the nohz_balancer_kick() comment block
        sched/fair: Explain LLC nohz kick condition
        sched/fair: Simplify nohz_balancer_kick()
        sched/topology: Fix percpu data types in struct sd_data & struct s_data
        sched/fair: Simplify post_init_entity_util_avg() by calling it with a task_struct pointer argument
        sched/fair: Fix O(nr_cgroups) in the load balancing path
        sched/fair: Optimize update_blocked_averages()
        sched/fair: Fix insertion in rq->leaf_cfs_rq_list
        sched/fair: Add tmp_alone_branch assertion
        sched/core: Use READ_ONCE()/WRITE_ONCE() in move_queued_task()/task_rq_lock()
        sched/debug: Initialize sd_sysctl_cpus if !CONFIG_CPUMASK_OFFSTACK
        sched/pelt: Skip updating util_est when utilization is higher than CPU's capacity
        sched/fair: Update scale invariance of PELT
        sched/fair: Move the rq_of() helper function
        sched/core: Convert task_struct.stack_refcount to refcount_t
        ...
      45802da0
    • Linus Torvalds's avatar
      Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 203b6609
      Linus Torvalds authored
      Pull perf updates from Ingo Molnar:
       "Lots of tooling updates - too many to list, here's a few highlights:
      
         - Various subcommand updates to 'perf trace', 'perf report', 'perf
           record', 'perf annotate', 'perf script', 'perf test', etc.
      
         - CPU and NUMA topology and affinity handling improvements,
      
         - HW tracing and HW support updates:
            - Intel PT updates
            - ARM CoreSight updates
            - vendor HW event updates
      
         - BPF updates
      
         - Tons of infrastructure updates, both on the build system and the
           library support side
      
         - Documentation updates.
      
         - ... and lots of other changes, see the changelog for details.
      
        Kernel side updates:
      
         - Tighten up kprobes blacklist handling, reduce the number of places
           where developers can install a kprobe and hang/crash the system.
      
         - Fix/enhance vma address filter handling.
      
         - Various PMU driver updates, small fixes and additions.
      
         - refcount_t conversions
      
         - BPF updates
      
         - error code propagation enhancements
      
         - misc other changes"
      
      * 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (238 commits)
        perf script python: Add Python3 support to syscall-counts-by-pid.py
        perf script python: Add Python3 support to syscall-counts.py
        perf script python: Add Python3 support to stat-cpi.py
        perf script python: Add Python3 support to stackcollapse.py
        perf script python: Add Python3 support to sctop.py
        perf script python: Add Python3 support to powerpc-hcalls.py
        perf script python: Add Python3 support to net_dropmonitor.py
        perf script python: Add Python3 support to mem-phys-addr.py
        perf script python: Add Python3 support to failed-syscalls-by-pid.py
        perf script python: Add Python3 support to netdev-times.py
        perf tools: Add perf_exe() helper to find perf binary
        perf script: Handle missing fields with -F +..
        perf data: Add perf_data__open_dir_data function
        perf data: Add perf_data__(create_dir|close_dir) functions
        perf data: Fail check_backup in case of error
        perf data: Make check_backup work over directories
        perf tools: Add rm_rf_perf_data function
        perf tools: Add pattern name checking to rm_rf
        perf tools: Add depth checking to rm_rf
        perf data: Add global path holder
        ...
      203b6609
    • Linus Torvalds's avatar
      Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 3478588b
      Linus Torvalds authored
      Pull locking updates from Ingo Molnar:
       "The biggest part of this tree is the new auto-generated atomics API
        wrappers by Mark Rutland.
      
        The primary motivation was to allow instrumentation without uglifying
        the primary source code.
      
        The linecount increase comes from adding the auto-generated files to
        the Git space as well:
      
          include/asm-generic/atomic-instrumented.h     | 1689 ++++++++++++++++--
          include/asm-generic/atomic-long.h             | 1174 ++++++++++---
          include/linux/atomic-fallback.h               | 2295 +++++++++++++++++++++++++
          include/linux/atomic.h                        | 1241 +------------
      
        I preferred this approach, so that the full call stack of the (already
        complex) locking APIs is still fully visible in 'git grep'.
      
        But if this is excessive we could certainly hide them.
      
        There's a separate build-time mechanism to determine whether the
        headers are out of date (they should never be stale if we do our job
        right).
      
        Anyway, nothing from this should be visible to regular kernel
        developers.
      
        Other changes:
      
         - Add support for dynamic keys, which removes a source of false
           positives in the workqueue code, among other things (Bart Van
           Assche)
      
         - Updates to tools/memory-model (Andrea Parri, Paul E. McKenney)
      
         - qspinlock, wake_q and lockdep micro-optimizations (Waiman Long)
      
         - misc other updates and enhancements"
      
      * 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (48 commits)
        locking/lockdep: Shrink struct lock_class_key
        locking/lockdep: Add module_param to enable consistency checks
        lockdep/lib/tests: Test dynamic key registration
        lockdep/lib/tests: Fix run_tests.sh
        kernel/workqueue: Use dynamic lockdep keys for workqueues
        locking/lockdep: Add support for dynamic keys
        locking/lockdep: Verify whether lock objects are small enough to be used as class keys
        locking/lockdep: Check data structure consistency
        locking/lockdep: Reuse lock chains that have been freed
        locking/lockdep: Fix a comment in add_chain_cache()
        locking/lockdep: Introduce lockdep_next_lockchain() and lock_chain_count()
        locking/lockdep: Reuse list entries that are no longer in use
        locking/lockdep: Free lock classes that are no longer in use
        locking/lockdep: Update two outdated comments
        locking/lockdep: Make it easy to detect whether or not inside a selftest
        locking/lockdep: Split lockdep_free_key_range() and lockdep_reset_lock()
        locking/lockdep: Initialize the locks_before and locks_after lists earlier
        locking/lockdep: Make zap_class() remove all matching lock order entries
        locking/lockdep: Reorder struct lock_class members
        locking/lockdep: Avoid that add_chain_cache() adds an invalid chain to the cache
        ...
      3478588b
    • Linus Torvalds's avatar
      Merge branch 'efi-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · c8f5ed6e
      Linus Torvalds authored
      Pull EFI updates from Ingo Molnar:
       "The main EFI changes in this cycle were:
      
         - Use 32-bit alignment for efi_guid_t
      
         - Allow the SetVirtualAddressMap() call to be omitted
      
         - Implement earlycon=efifb based on existing earlyprintk code
      
         - Various minor fixes and code cleanups from Sai, Ard and me"
      
      * 'efi-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        efi: Fix build error due to enum collision between efi.h and ima.h
        efi/x86: Convert x86 EFI earlyprintk into generic earlycon implementation
        x86: Make ARCH_USE_MEMREMAP_PROT a generic Kconfig symbol
        efi/arm/arm64: Allow SetVirtualAddressMap() to be omitted
        efi: Replace GPL license boilerplate with SPDX headers
        efi/fdt: Apply more cleanups
        efi: Use 32-bit alignment for efi_guid_t
        efi/memattr: Don't bail on zero VA if it equals the region's PA
        x86/efi: Mark can_free_region() as an __init function
      c8f5ed6e
    • Arnd Bergmann's avatar
      ipc: Fix building compat mode without sysvipc · 7e89a37c
      Arnd Bergmann authored
      As John Stultz noticed, my y2038 syscall series caused a link
      failure when CONFIG_SYSVIPC is disabled but CONFIG_COMPAT is
      enabled:
      
      arch/arm64/kernel/sys32.o:(.rodata+0x960): undefined reference to `__arm64_compat_sys_old_semctl'
      arch/arm64/kernel/sys32.o:(.rodata+0x980): undefined reference to `__arm64_compat_sys_old_msgctl'
      arch/arm64/kernel/sys32.o:(.rodata+0x9a0): undefined reference to `__arm64_compat_sys_old_shmctl'
      
      Add the missing entries in kernel/sys_ni.c for the new system
      calls.
      
      Cc: Laura Abbott <labbott@redhat.com>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      7e89a37c
    • Souptick Joarder's avatar
    • Alexey Dobriyan's avatar
      proc: more robust bulk read test · 332e0e80
      Alexey Dobriyan authored
      /proc may not be mounted and test will exit successfully.
      
      Ensure proc is mounted at /proc.
      
      Link: http://lkml.kernel.org/r/20190209105613.GA10384@avx2Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      332e0e80
    • Alexey Dobriyan's avatar
      proc: test /proc/*/maps, smaps, smaps_rollup, statm · e483b020
      Alexey Dobriyan authored
      Start testing VM related fiels found in per-process files.
      
      Do it by jiting small executable which brings its address space to
      precisely known state, then comparing /proc/*/maps, smaps, smaps_rollup,
      and statm files to expected values.
      
      Currently only x86_64 is supported.
      
      [adobriyan@gmail.com: exit correctly in /proc/*/maps test]
        Link: http://lkml.kernel.org/r/20190206073659.GB15311@avx2
      Link: http://lkml.kernel.org/r/20190203165806.GA14568@avx2Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e483b020
    • Alexey Dobriyan's avatar
      proc: use seq_puts() everywhere · 08b55775
      Alexey Dobriyan authored
      seq_printf() without format specifiers == faster seq_puts()
      
      Link: http://lkml.kernel.org/r/20190114200545.GC9680@avx2Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      08b55775
    • Alexey Dobriyan's avatar
      proc: read kernel cpu stat pointer once · 5713f35c
      Alexey Dobriyan authored
      Help gcc generate better code:
      
      	$ ./scripts/bloat-o-meter ../vmlinux-000 ../vmlinux-001
      	add/remove: 2/2 grow/shrink: 0/1 up/down: 92/-142 (-50)
      	Function                                     old     new   delta
      	get_iowait_time.isra                           -      46     +46
      	get_idle_time.isra                             -      46     +46
      	show_stat                                   1489    1477     -12
      	get_iowait_time                               65       -     -65
      	get_idle_time                                 65       -     -65
      
      Link: http://lkml.kernel.org/r/20190114195907.GA9680@avx2Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5713f35c
    • Zhikang Zhang's avatar
      867aaccf
    • Chengguang Xu's avatar
      fs/proc/thread_self.c: code cleanup for proc_setup_thread_self() · 45f68ab5
      Chengguang Xu authored
      Remove unnecessary ERR_PTR()/PTR_ERR() cast in proc_setup_thread_self().
      
      Link: http://lkml.kernel.org/r/20190124030150.8472-2-cgxu519@gmx.comSigned-off-by: default avatarChengguang Xu <cgxu519@gmx.com>
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Alexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      45f68ab5
    • Chengguang Xu's avatar
      fs/proc/self.c: code cleanup for proc_setup_self() · 756ca74c
      Chengguang Xu authored
      Remove unnecessary ERR_PTR()/PTR_ERR() cast in proc_setup_self().
      
      Link: http://lkml.kernel.org/r/20190124030150.8472-1-cgxu519@gmx.comSigned-off-by: default avatarChengguang Xu <cgxu519@gmx.com>
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Alexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      756ca74c
    • Alexey Dobriyan's avatar
      proc: return exit code 4 for skipped tests · 0338c838
      Alexey Dobriyan authored
      Test harness uses 4 for SKIP, not 2.
      
      Link: http://lkml.kernel.org/r/20190108193108.GA12259@avx2Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      0338c838
    • Oscar Salvador's avatar
      mm,mremap: bail out earlier in mremap_to under map pressure · ea2c3f6f
      Oscar Salvador authored
      When using mremap() syscall in addition to MREMAP_FIXED flag, mremap()
      calls mremap_to() which does the following:
      
      1) unmaps the destination region where we are going to move the map
      2) If the new region is going to be smaller, we unmap the last part
         of the old region
      
      Then, we will eventually call move_vma() to do the actual move.
      
      move_vma() checks whether we are at least 4 maps below max_map_count
      before going further, otherwise it bails out with -ENOMEM.  The problem
      is that we might have already unmapped the vma's in steps 1) and 2), so
      it is not possible for userspace to figure out the state of the vmas
      after it gets -ENOMEM, and it gets tricky for userspace to clean up
      properly on error path.
      
      While it is true that we can return -ENOMEM for more reasons (e.g: see
      may_expand_vm() or move_page_tables()), I think that we can avoid this
      scenario if we check early in mremap_to() if the operation has high
      chances to succeed map-wise.
      
      Should that not be the case, we can bail out before we even try to unmap
      anything, so we make sure the vma's are left untouched in case we are
      likely to be short of maps.
      
      The thumb-rule now is to rely on the worst-scenario case we can have.
      That is when both vma's (old region and new region) are going to be
      split in 3, so we get two more maps to the ones we already hold (one per
      each).  If current map count + 2 maps still leads us to 4 maps below the
      threshold, we are going to pass the check in move_vma().
      
      Of course, this is not free, as it might generate false positives when
      it is true that we are tight map-wise, but the unmap operation can
      release several vma's leading us to a good state.
      
      Another approach was also investigated [1], but it may be too much
      hassle for what it brings.
      
      [1] https://lore.kernel.org/lkml/20190219155320.tkfkwvqk53tfdojt@d104.suse.de/
      
      Link: http://lkml.kernel.org/r/20190226091314.18446-1-osalvador@suse.deSigned-off-by: default avatarOscar Salvador <osalvador@suse.de>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Acked-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Joel Fernandes (Google) <joel@joelfernandes.org>
      Cc: Yang Shi <yang.shi@linux.alibaba.com>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Joel Fernandes <joel@joelfernandes.org>
      Cc: Cyril Hrubis <chrubis@suse.cz>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ea2c3f6f
    • Qian Cai's avatar
      mm/sparse: fix a bad comparison · d778015a
      Qian Cai authored
      next_present_section_nr() could only return an unsigned number -1, so
      just check it specifically where compilers will convert -1 to unsigned
      if needed.
      
        mm/sparse.c: In function 'sparse_init_nid':
        mm/sparse.c:200:20: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
               ((section_nr >= 0) &&    \
                            ^~
        mm/sparse.c:478:2: note: in expansion of macro
        'for_each_present_section_nr'
          for_each_present_section_nr(pnum_begin, pnum) {
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
        mm/sparse.c:200:20: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
               ((section_nr >= 0) &&    \
                            ^~
        mm/sparse.c:497:2: note: in expansion of macro
        'for_each_present_section_nr'
          for_each_present_section_nr(pnum_begin, pnum) {
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
        mm/sparse.c: In function 'sparse_init':
        mm/sparse.c:200:20: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
               ((section_nr >= 0) &&    \
                            ^~
        mm/sparse.c:520:2: note: in expansion of macro
        'for_each_present_section_nr'
          for_each_present_section_nr(pnum_begin + 1, pnum_end) {
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      Link: http://lkml.kernel.org/r/20190228181839.86504-1-cai@lca.pw
      Fixes: c4e1be9e ("mm, sparsemem: break out of loops early")
      Signed-off-by: default avatarQian Cai <cai@lca.pw>
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d778015a
    • Jan Stancek's avatar
      mm/memory.c: do_fault: avoid usage of stale vm_area_struct · fc8efd2d
      Jan Stancek authored
      LTP testcase mtest06 [1] can trigger a crash on s390x running 5.0.0-rc8.
      This is a stress test, where one thread mmaps/writes/munmaps memory area
      and other thread is trying to read from it:
      
        CPU: 0 PID: 2611 Comm: mmap1 Not tainted 5.0.0-rc8+ #51
        Hardware name: IBM 2964 N63 400 (z/VM 6.4.0)
        Krnl PSW : 0404e00180000000 00000000001ac8d8 (__lock_acquire+0x7/0x7a8)
        Call Trace:
        ([<0000000000000000>]           (null))
         [<00000000001adae4>] lock_acquire+0xec/0x258
         [<000000000080d1ac>] _raw_spin_lock_bh+0x5c/0x98
         [<000000000012a780>] page_table_free+0x48/0x1a8
         [<00000000002f6e54>] do_fault+0xdc/0x670
         [<00000000002fadae>] __handle_mm_fault+0x416/0x5f0
         [<00000000002fb138>] handle_mm_fault+0x1b0/0x320
         [<00000000001248cc>] do_dat_exception+0x19c/0x2c8
         [<000000000080e5ee>] pgm_check_handler+0x19e/0x200
      
      page_table_free() is called with NULL mm parameter, but because "0" is a
      valid address on s390 (see S390_lowcore), it keeps going until it
      eventually crashes in lockdep's lock_acquire.  This crash is
      reproducible at least since 4.14.
      
      Problem is that "vmf->vma" used in do_fault() can become stale.  Because
      mmap_sem may be released, other threads can come in, call munmap() and
      cause "vma" be returned to kmem cache, and get zeroed/re-initialized and
      re-used:
      
      handle_mm_fault                           |
        __handle_mm_fault                       |
          do_fault                              |
            vma = vmf->vma                      |
            do_read_fault                       |
              __do_fault                        |
                vma->vm_ops->fault(vmf);        |
                  mmap_sem is released          |
                                                |
                                                | do_munmap()
                                                |   remove_vma_list()
                                                |     remove_vma()
                                                |       vm_area_free()
                                                |         # vma is released
                                                | ...
                                                | # same vma is allocated
                                                | # from kmem cache
                                                | do_mmap()
                                                |   vm_area_alloc()
                                                |     memset(vma, 0, ...)
                                                |
            pte_free(vma->vm_mm, ...);          |
              page_table_free                   |
                spin_lock_bh(&mm->context.lock);|
                  <crash>                       |
      
      Cache mm_struct to avoid using potentially stale "vma".
      
      [1] https://github.com/linux-test-project/ltp/blob/master/testcases/kernel/mem/mtest06/mmap1.c
      
      Link: http://lkml.kernel.org/r/5b3fdf19e2a5be460a384b936f5b56e13733f1b8.1551595137.git.jstancek@redhat.comSigned-off-by: default avatarJan Stancek <jstancek@redhat.com>
      Reviewed-by: default avatarAndrea Arcangeli <aarcange@redhat.com>
      Reviewed-by: default avatarMatthew Wilcox <willy@infradead.org>
      Acked-by: default avatarRafael Aquini <aquini@redhat.com>
      Reviewed-by: default avatarMinchan Kim <minchan@kernel.org>
      Acked-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Rik van Riel <riel@surriel.com>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Huang Ying <ying.huang@intel.com>
      Cc: Souptick Joarder <jrdr.linux@gmail.com>
      Cc: Jerome Glisse <jglisse@redhat.com>
      Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      fc8efd2d
    • Greg Thelen's avatar
      writeback: fix inode cgroup switching comment · a9519def
      Greg Thelen authored
      Commit 682aa8e1 ("writeback: implement unlocked_inode_to_wb
      transaction and use it for stat updates") refers to
      inode_switch_wb_work_fn() which never got merged.
      
      Switch the comments to inode_switch_wbs_work_fn().
      
      Link: http://lkml.kernel.org/r/20190305004617.142590-1-gthelen@google.com
      Fixes: 682aa8e1 ("writeback: implement unlocked_inode_to_wb transaction and use it for stat updates")
      Signed-off-by: default avatarGreg Thelen <gthelen@google.com>
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Acked-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a9519def
    • Qian Cai's avatar
      mm/huge_memory.c: fix "orig_pud" set but not used · 70516b93
      Qian Cai authored
      Commit a00cc7d9 ("mm, x86: add support for PUD-sized transparent
      hugepages") introduced pudp_huge_get_and_clear_full() but no one uses
      its return code.
      
      In order to not diverge from pmdp_huge_get_and_clear_full(), just change
      zap_huge_pud() to not assign the return value from
      pudp_huge_get_and_clear_full().
      
        mm/huge_memory.c: In function 'zap_huge_pud':
        mm/huge_memory.c:1982:8: warning: variable 'orig_pud' set but not used [-Wunused-but-set-variable]
          pud_t orig_pud;
                ^~~~~~~~
      
      Link: http://lkml.kernel.org/r/20190301221956.97493-1-cai@lca.pwSigned-off-by: default avatarQian Cai <cai@lca.pw>
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Matthew Wilcox <willy@infradead.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      70516b93
    • Qian Cai's avatar
      mm/hotplug: fix an imbalance with DEBUG_PAGEALLOC · cd02cf1a
      Qian Cai authored
      When onlining a memory block with DEBUG_PAGEALLOC, it unmaps the pages
      in the block from kernel, However, it does not map those pages while
      offlining at the beginning.  As the result, it triggers a panic below
      while onlining on ppc64le as it checks if the pages are mapped before
      unmapping.  However, the imbalance exists for all arches where
      double-unmappings could happen.  Therefore, let kernel map those pages
      in generic_online_page() before they have being freed into the page
      allocator for the first time where it will set the page count to one.
      
      On the other hand, it works fine during the boot, because at least for
      IBM POWER8, it does,
      
      early_setup
        early_init_mmu
          harsh__early_init_mmu
            htab_initialize [1]
              htab_bolt_mapping [2]
      
      where it effectively map all memblock regions just like
      kernel_map_linear_page(), so later mem_init() -> memblock_free_all()
      will unmap them just fine without any imbalance.  On other arches
      without this imbalance checking, it still unmap them once at the most.
      
      [1]
      for_each_memblock(memory, reg) {
              base = (unsigned long)__va(reg->base);
              size = reg->size;
      
              DBG("creating mapping for region: %lx..%lx (prot: %lx)\n",
                      base, size, prot);
      
              BUG_ON(htab_bolt_mapping(base, base + size, __pa(base),
                      prot, mmu_linear_psize, mmu_kernel_ssize));
              }
      
      [2] linear_map_hash_slots[paddr >> PAGE_SHIFT] = ret | 0x80;
          kernel BUG at arch/powerpc/mm/hash_utils_64.c:1815!
          Oops: Exception in kernel mode, sig: 5 [#1]
          LE SMP NR_CPUS=256 DEBUG_PAGEALLOC NUMA pSeries
          CPU: 2 PID: 4298 Comm: bash Not tainted 5.0.0-rc7+ #15
          NIP:  c000000000062670 LR: c00000000006265c CTR: 0000000000000000
          REGS: c0000005bf8a75b0 TRAP: 0700   Not tainted  (5.0.0-rc7+)
          MSR:  800000000282b033 <SF,VEC,VSX,EE,FP,ME,IR,DR,RI,LE>  CR: 28422842
          XER: 00000000
          CFAR: c000000000804f44 IRQMASK: 1
          NIP [c000000000062670] __kernel_map_pages+0x2e0/0x4f0
          LR [c00000000006265c] __kernel_map_pages+0x2cc/0x4f0
          Call Trace:
             __kernel_map_pages+0x2cc/0x4f0
             free_unref_page_prepare+0x2f0/0x4d0
             free_unref_page+0x44/0x90
             __online_page_free+0x84/0x110
             online_pages_range+0xc0/0x150
             walk_system_ram_range+0xc8/0x120
             online_pages+0x280/0x5a0
             memory_subsys_online+0x1b4/0x270
             device_online+0xc0/0xf0
             state_store+0xc0/0x180
             dev_attr_store+0x3c/0x60
             sysfs_kf_write+0x70/0xb0
             kernfs_fop_write+0x10c/0x250
             __vfs_write+0x48/0x240
             vfs_write+0xd8/0x210
             ksys_write+0x70/0x120
             system_call+0x5c/0x70
      
      Link: http://lkml.kernel.org/r/20190301220814.97339-1-cai@lca.pwSigned-off-by: default avatarQian Cai <cai@lca.pw>
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>	[powerpc]
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Souptick Joarder <jrdr.linux@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      cd02cf1a
    • Qian Cai's avatar
      mm/memcontrol.c: fix bad line in comment · 82ede7ee
      Qian Cai authored
      Commit 23067153 ("mm: memory.low hierarchical behavior") missed an
      asterisk in one of the comments.
      
        mm/memcontrol.c:5774: warning: bad line:                | 0, otherwise.
      
      Link: http://lkml.kernel.org/r/20190301143734.94393-1-cai@lca.pwAcked-by: default avatarSouptick Joarder <jrdr.linux@gmail.com>
      Signed-off-by: default avatarQian Cai <cai@lca.pw>
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      82ede7ee
    • Peng Fan's avatar
      mm/cma.c: cma_declare_contiguous: correct err handling · 0d3bd18a
      Peng Fan authored
      In case cma_init_reserved_mem failed, need to free the memblock
      allocated by memblock_reserve or memblock_alloc_range.
      
      Quote Catalin's comments:
        https://lkml.org/lkml/2019/2/26/482
      
      Kmemleak is supposed to work with the memblock_{alloc,free} pair and it
      ignores the memblock_reserve() as a memblock_alloc() implementation
      detail. It is, however, tolerant to memblock_free() being called on
      a sub-range or just a different range from a previous memblock_alloc().
      So the original patch looks fine to me. FWIW:
      
      Link: http://lkml.kernel.org/r/20190227144631.16708-1-peng.fan@nxp.comSigned-off-by: default avatarPeng Fan <peng.fan@nxp.com>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Reviewed-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Cc: Laura Abbott <labbott@redhat.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Marek Szyprowski <m.szyprowski@samsung.com>
      Cc: Andrey Konovalov <andreyknvl@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      0d3bd18a
    • Qian Cai's avatar
      mm/page_ext.c: fix an imbalance with kmemleak · 0c815854
      Qian Cai authored
      After offlining a memory block, kmemleak scan will trigger a crash, as
      it encounters a page ext address that has already been freed during
      memory offlining.  At the beginning in alloc_page_ext(), it calls
      kmemleak_alloc(), but it does not call kmemleak_free() in
      free_page_ext().
      
          BUG: unable to handle kernel paging request at ffff888453d00000
          PGD 128a01067 P4D 128a01067 PUD 128a04067 PMD 47e09e067 PTE 800ffffbac2ff060
          Oops: 0000 [#1] SMP DEBUG_PAGEALLOC KASAN PTI
          CPU: 1 PID: 1594 Comm: bash Not tainted 5.0.0-rc8+ #15
          Hardware name: HP ProLiant DL180 Gen9/ProLiant DL180 Gen9, BIOS U20 10/25/2017
          RIP: 0010:scan_block+0xb5/0x290
          Code: 85 6e 01 00 00 48 b8 00 00 30 f5 81 88 ff ff 48 39 c3 0f 84 5b 01 00 00 48 89 d8 48 c1 e8 03 42 80 3c 20 00 0f 85 87 01 00 00 <4c> 8b 3b e8 f3 0c fa ff 4c 39 3d 0c 6b 4c 01 0f 87 08 01 00 00 4c
          RSP: 0018:ffff8881ec57f8e0 EFLAGS: 00010082
          RAX: 0000000000000000 RBX: ffff888453d00000 RCX: ffffffffa61e5a54
          RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffff888453d00000
          RBP: ffff8881ec57f920 R08: fffffbfff4ed588d R09: fffffbfff4ed588c
          R10: fffffbfff4ed588c R11: ffffffffa76ac463 R12: dffffc0000000000
          R13: ffff888453d00ff9 R14: ffff8881f80cef48 R15: ffff8881f80cef48
          FS:  00007f6c0e3f8740(0000) GS:ffff8881f7680000(0000) knlGS:0000000000000000
          CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
          CR2: ffff888453d00000 CR3: 00000001c4244003 CR4: 00000000001606a0
          Call Trace:
           scan_gray_list+0x269/0x430
           kmemleak_scan+0x5a8/0x10f0
           kmemleak_write+0x541/0x6ca
           full_proxy_write+0xf8/0x190
           __vfs_write+0xeb/0x980
           vfs_write+0x15a/0x4f0
           ksys_write+0xd2/0x1b0
           __x64_sys_write+0x73/0xb0
           do_syscall_64+0xeb/0xaaa
           entry_SYSCALL_64_after_hwframe+0x44/0xa9
          RIP: 0033:0x7f6c0dad73b8
          Code: 89 02 48 c7 c0 ff ff ff ff eb b3 0f 1f 80 00 00 00 00 f3 0f 1e fa 48 8d 05 65 63 2d 00 8b 00 85 c0 75 17 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 58 c3 0f 1f 80 00 00 00 00 41 54 49 89 d4 55
          RSP: 002b:00007ffd5b863cb8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
          RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 00007f6c0dad73b8
          RDX: 0000000000000005 RSI: 000055a9216e1710 RDI: 0000000000000001
          RBP: 000055a9216e1710 R08: 000000000000000a R09: 00007ffd5b863840
          R10: 000000000000000a R11: 0000000000000246 R12: 00007f6c0dda9780
          R13: 0000000000000005 R14: 00007f6c0dda4740 R15: 0000000000000005
          Modules linked in: nls_iso8859_1 nls_cp437 vfat fat kvm_intel kvm irqbypass efivars ip_tables x_tables xfs sd_mod ahci libahci igb i2c_algo_bit libata i2c_core dm_mirror dm_region_hash dm_log dm_mod efivarfs
          CR2: ffff888453d00000
          ---[ end trace ccf646c7456717c5 ]---
          Kernel panic - not syncing: Fatal exception
          Shutting down cpus with NMI
          Kernel Offset: 0x24c00000 from 0xffffffff81000000 (relocation range:
          0xffffffff80000000-0xffffffffbfffffff)
          ---[ end Kernel panic - not syncing: Fatal exception ]---
      
      Link: http://lkml.kernel.org/r/20190227173147.75650-1-cai@lca.pwSigned-off-by: default avatarQian Cai <cai@lca.pw>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      0c815854
    • Andrey Ryabinin's avatar
      mm/compaction: pass pgdat to too_many_isolated() instead of zone · 5f438eee
      Andrey Ryabinin authored
      too_many_isolated() in mm/compaction.c looks only at node state, so it
      makes more sense to change argument to pgdat instead of zone.
      
      Link: http://lkml.kernel.org/r/20190228083329.31892-3-aryabinin@virtuozzo.comSigned-off-by: default avatarAndrey Ryabinin <aryabinin@virtuozzo.com>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Acked-by: default avatarRik van Riel <riel@surriel.com>
      Acked-by: default avatarMel Gorman <mgorman@techsingularity.net>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: William Kucharski <william.kucharski@oracle.com>
      Cc: John Hubbard <jhubbard@nvidia.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5f438eee
    • Andrey Ryabinin's avatar
      mm: remove zone_lru_lock() function, access ->lru_lock directly · f4b7e272
      Andrey Ryabinin authored
      We have common pattern to access lru_lock from a page pointer:
      	zone_lru_lock(page_zone(page))
      
      Which is silly, because it unfolds to this:
      	&NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)]->zone_pgdat->lru_lock
      while we can simply do
      	&NODE_DATA(page_to_nid(page))->lru_lock
      
      Remove zone_lru_lock() function, since it's only complicate things.  Use
      'page_pgdat(page)->lru_lock' pattern instead.
      
      [aryabinin@virtuozzo.com: a slightly better version of __split_huge_page()]
        Link: http://lkml.kernel.org/r/20190301121651.7741-1-aryabinin@virtuozzo.com
      Link: http://lkml.kernel.org/r/20190228083329.31892-2-aryabinin@virtuozzo.comSigned-off-by: default avatarAndrey Ryabinin <aryabinin@virtuozzo.com>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Acked-by: default avatarMel Gorman <mgorman@techsingularity.net>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Rik van Riel <riel@surriel.com>
      Cc: William Kucharski <william.kucharski@oracle.com>
      Cc: John Hubbard <jhubbard@nvidia.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f4b7e272
    • Andrey Ryabinin's avatar
      mm/workingset: remove unused @mapping argument in workingset_eviction() · a7ca12f9
      Andrey Ryabinin authored
      workingset_eviction() doesn't use and never did use the @mapping
      argument.  Remove it.
      
      Link: http://lkml.kernel.org/r/20190228083329.31892-1-aryabinin@virtuozzo.comSigned-off-by: default avatarAndrey Ryabinin <aryabinin@virtuozzo.com>
      Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Acked-by: default avatarRik van Riel <riel@surriel.com>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Acked-by: default avatarMel Gorman <mgorman@techsingularity.net>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: William Kucharski <william.kucharski@oracle.com>
      Cc: John Hubbard <jhubbard@nvidia.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a7ca12f9
    • Gustavo A. R. Silva's avatar
      mm/swapfile.c: use struct_size() in kvzalloc() · 96008744
      Gustavo A. R. Silva authored
      One of the more common cases of allocation size calculations is finding
      the size of a structure that has a zero-sized array at the end, along
      with memory for some number of elements for that array.  For example:
      
        struct foo {
            int stuff;
            struct boo entry[];
        };
      
        size = sizeof(struct foo) + count * sizeof(struct boo);
        instance = kvzalloc(size, GFP_KERNEL);
      
      Instead of leaving these open-coded and prone to type mistakes, we can
      now use the new struct_size() helper:
      
        instance = kvzalloc(struct_size(instance, entry, count), GFP_KERNEL);
      
      Notice that, in this case, variable size is not necessary, hence it is
      removed.
      
      This code was detected with the help of Coccinelle.
      
      Link: http://lkml.kernel.org/r/20190221154622.GA19599@embeddedorSigned-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      96008744