1. 04 May, 2023 10 commits
    • Linus Torvalds's avatar
      Merge tag 'mm-hotfixes-stable-2023-05-03-16-27' of... · a1fd058b
      Linus Torvalds authored
      Merge tag 'mm-hotfixes-stable-2023-05-03-16-27' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
      
      Pull hitfixes from Andrew Morton:
       "Five hotfixes.  Three are cc:stable, two for this -rc cycle"
      
      * tag 'mm-hotfixes-stable-2023-05-03-16-27' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm:
        mm: change per-VMA lock statistics to be disabled by default
        MAINTAINERS: update Michal Simek's email
        mm/mempolicy: correctly update prev when policy is equal on mbind
        relayfs: fix out-of-bounds access in relay_file_read
        kasan: hw_tags: avoid invalid virt_to_page()
      a1fd058b
    • Linus Torvalds's avatar
      Merge tag 'mm-stable-2023-05-03-16-22' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm · 15fb96a3
      Linus Torvalds authored
      Pull more MM updates from Andrew Morton:
      
       - Some DAMON cleanups from Kefeng Wang
      
       - Some KSM work from David Hildenbrand, to make the PR_SET_MEMORY_MERGE
         ioctl's behavior more similar to KSM's behavior.
      
      [ Andrew called these "final", but I suspect we'll have a series fixing
        up the fact that the last commit in the dmapools series in the
        previous pull seems to have unintentionally just reverted all the
        other commits in the same series..   - Linus ]
      
      * tag 'mm-stable-2023-05-03-16-22' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm:
        mm: hwpoison: coredump: support recovery from dump_user_range()
        mm/page_alloc: add some comments to explain the possible hole in __pageblock_pfn_to_page()
        mm/ksm: move disabling KSM from s390/gmap code to KSM code
        selftests/ksm: ksm_functional_tests: add prctl unmerge test
        mm/ksm: unmerge and clear VM_MERGEABLE when setting PR_SET_MEMORY_MERGE=0
        mm/damon/paddr: fix missing folio_sz update in damon_pa_young()
        mm/damon/paddr: minor refactor of damon_pa_mark_accessed_or_deactivate()
        mm/damon/paddr: minor refactor of damon_pa_pageout()
      15fb96a3
    • Linus Torvalds's avatar
      Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux · 671e148d
      Linus Torvalds authored
      Pull arm64 fixes from Will Deacon:
       "A few arm64 fixes that came in during the merge window for -rc1.
      
        The main thing is restoring the pointer authentication hwcaps, which
        disappeared during some recent refactoring
      
         - Fix regression in CPU erratum workaround when disabling the MMU
      
         - Fix detection of pointer authentication hwcaps
      
         - Avoid writeable, executable ELF sections in vmlinux"
      
      * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
        arm64: lds: move .got section out of .text
        arm64: kernel: remove SHF_WRITE|SHF_EXECINSTR from .idmap.text
        arm64: cpufeature: Fix pointer auth hwcaps
        arm64: Fix label placement in record_mmu_state()
      671e148d
    • Linus Torvalds's avatar
      Merge tag 'loongarch-6.4' of... · 611c9d88
      Linus Torvalds authored
      Merge tag 'loongarch-6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
      
      Pull LoongArch updates from Huacai Chen:
      
       - Better backtraces for humanization
      
       - Relay BCE exceptions to userland as SIGSEGV
      
       - Provide kernel fpu functions
      
       - Optimize memory ops (memset/memcpy/memmove)
      
       - Optimize checksum and crc32(c) calculation
      
       - Add ARCH_HAS_FORTIFY_SOURCE selection
      
       - Add function error injection support
      
       - Add ftrace with direct call support
      
       - Add basic perf tools support
      
      * tag 'loongarch-6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson: (24 commits)
        tools/perf: Add basic support for LoongArch
        LoongArch: ftrace: Add direct call trampoline samples support
        LoongArch: ftrace: Add direct call support
        LoongArch: ftrace: Implement ftrace_find_callable_addr() to simplify code
        LoongArch: ftrace: Fix build error if DYNAMIC_FTRACE_WITH_REGS is not set
        LoongArch: ftrace: Abstract DYNAMIC_FTRACE_WITH_ARGS accesses
        LoongArch: Add support for function error injection
        LoongArch: Add ARCH_HAS_FORTIFY_SOURCE selection
        LoongArch: crypto: Add crc32 and crc32c hw acceleration
        LoongArch: Add checksum optimization for 64-bit system
        LoongArch: Optimize memory ops (memset/memcpy/memmove)
        LoongArch: Provide kernel fpu functions
        LoongArch: Relay BCE exceptions to userland as SIGSEGV with si_code=SEGV_BNDERR
        LoongArch: Tweak the BADV and CPUCFG.PRID lines in show_regs()
        LoongArch: Humanize the ESTAT line when showing registers
        LoongArch: Humanize the ECFG line when showing registers
        LoongArch: Humanize the EUEN line when showing registers
        LoongArch: Humanize the PRMD line when showing registers
        LoongArch: Humanize the CRMD line when showing registers
        LoongArch: Fix format of CSR lines during show_regs()
        ...
      611c9d88
    • Linus Torvalds's avatar
      Merge tag 'csky-for-linus-6.4' of https://github.com/c-sky/csky-linux · a1f749de
      Linus Torvalds authored
      Pull arch/csky updates from Guo Ren:
      
       - Remove CPU_TLB_SIZE config
      
       - Prevent spurious page faults
      
      * tag 'csky-for-linus-6.4' of https://github.com/c-sky/csky-linux:
        csky: mmu: Prevent spurious page faults
        csky: remove obsolete config CPU_TLB_SIZE
      a1f749de
    • Linus Torvalds's avatar
      Merge tag 'parisc-for-6.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux · 1a5304fe
      Linus Torvalds authored
      Pull parisc updates from Helge Deller:
       "Two important fixes in here:
      
         - The argument pointer register was wrong when calling 64-bit
           firmware functions, which may cause random memory corruption or
           crashes.
      
         - Ensure page alignment in cache flush functions, otherwise not all
           memory might get flushed.
      
        The rest are cleanups (mmap implementation, panic path) and usual
        smaller updates.
      
        Summary:
      
         - Calculate correct argument pointer in real64_call_asm()
      
         - Cleanup mmap implementation regarding color alignment (John David
           Anglin)
      
         - Spinlock fixes in panic path (Guilherme G. Piccoli)
      
         - build doc update for parisc64 (Randy Dunlap)
      
         - Ensure page alignment in flush functions"
      
      * tag 'parisc-for-6.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
        parisc: Fix argument pointer in real64_call_asm()
        parisc: Cleanup mmap implementation regarding color alignment
        parisc: Drop HP-UX constants and structs from grfioctl.h
        parisc: Ensure page alignment in flush functions
        parisc: Replace regular spinlock with spin_trylock on panic path
        parisc: update kbuild doc. aliases for parisc64
        parisc: Limit amount of kgdb breakpoints on parisc
      1a5304fe
    • Linus Torvalds's avatar
      Merge tag 'modules-6.4-rc1-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux · b4082428
      Linus Torvalds authored
      Pull modules fix from Luis Chamberlain:
       "One fix by Arnd far for modules which came in after the first pull
        request.
      
        The issue was found as part of some late compile tests with 0-day. I
        take it 0-day does some secondary late builds with after some initial
        ones"
      
      * tag 'modules-6.4-rc1-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux:
        module: include internal.h in module/dups.c
      b4082428
    • Linus Torvalds's avatar
      Merge tag 'sysctl-6.4-rc1-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux · 049a18f2
      Linus Torvalds authored
      Pull more sysctl updates from Luis Chamberlain:
       "As mentioned on my first pull request for sysctl-next, for v6.4-rc1
        we're very close to being able to deprecating register_sysctl_paths().
        I was going to assess the situation after the first week of the merge
        window.
      
        That time is now and things are looking good. We only have one which
        had already an ACK for so I'm picking this up here now and the last
        patch is the one that uses an axe.
      
        I have boot tested the last patch and 0-day build completed
        successfully"
      
      * tag 'sysctl-6.4-rc1-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux:
        sysctl: remove register_sysctl_paths()
        kernel: pid_namespace: simplify sysctls with register_sysctl()
      049a18f2
    • Linus Torvalds's avatar
      Merge tag 'uml-for-linus-6.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux · 342528ff
      Linus Torvalds authored
      Pull uml updates from Richard Weinberger:
      
       - Make stub data pages configurable
      
       - Make it harder to mix user and kernel code by accident
      
      * tag 'uml-for-linus-6.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux:
        um: make stub data pages size tweakable
        um: prevent user code in modules
        um: further clean up user_syms
        um: don't export printf()
        um: hostfs: define our own API boundary
        um: add __weak for exported functions
      342528ff
    • Linus Torvalds's avatar
      Merge tag 'ubifs-for-linus-6.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs · 9f269232
      Linus Torvalds authored
      Pull UBI and UBIFS updates from Richard Weinberger:
       "UBI:
      
         - Fix error value for try_write_vid_and_data()
      
         - Minor cleanups
      
        UBIFS:
      
         - Fixes for various memory leaks
      
         - Minor cleanups"
      
      * tag 'ubifs-for-linus-6.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs:
        ubifs: Fix memleak when insert_old_idx() failed
        Revert "ubifs: dirty_cow_znode: Fix memleak in error handling path"
        ubifs: Fix memory leak in do_rename
        ubifs: Free memory for tmpfile name
        ubi: Fix return value overwrite issue in try_write_vid_and_data()
        ubifs: Remove return in compr_exit()
        ubi: Simplify bool conversion
      9f269232
  2. 03 May, 2023 30 commits
    • Linus Torvalds's avatar
      Merge tag 'pm-6.4-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · fa31fc82
      Linus Torvalds authored
      Pull more power management updates from Rafael Wysocki:
       "These fix a hibernation test mode regression and clean up the
        intel_idle driver.
      
        Specifics:
      
         - Make test_resume work again after the changes that made hibernation
           open the snapshot device in exclusive mode (Chen Yu)
      
         - Clean up code in several places in intel_idle (Artem Bityutskiy)"
      
      * tag 'pm-6.4-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        intel_idle: mark few variables as __read_mostly
        intel_idle: do not sprinkle module parameter definitions around
        intel_idle: fix confusing message
        intel_idle: improve C-state flags handling robustness
        intel_idle: further intel_idle_init_cstates_icpu() cleanup
        intel_idle: clean up intel_idle_init_cstates_icpu()
        intel_idle: use pr_info() instead of printk()
        PM: hibernate: Do not get block device exclusively in test_resume mode
        PM: hibernate: Turn snapshot_test into global variable
      fa31fc82
    • Linus Torvalds's avatar
      Merge tag 'acpi-6.4-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 0153d8e6
      Linus Torvalds authored
      Pull more ACPI updates from Rafael Wysocki:
       "These add two ACPI-related quirks and extend support for Apple device
        properties supplied via ACPI _DSM.
      
        Specifics:
      
         - Do not turn off unused power resources during initialization on the
           Toshiba Click Mini (Hans de Goede)
      
         - Support strings in device properties supplied by ACPI _DSM on Apple
           platforms (Hector Martin)
      
         - Add an ACPI device ID quirk for Lenovo Yoga Tablet 2 (Marius Hoch)"
      
      * tag 'acpi-6.4-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        ACPI: property: Support strings in Apple _DSM props
        ACPI: x86: utils: Remove Lenovo Yoga Tablet 2's MAGN0001
        ACPI: PM: Do not turn of unused power resources on the Toshiba Click Mini
      0153d8e6
    • Linus Torvalds's avatar
      Merge tag 'thermal-6.4-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 667de5c6
      Linus Torvalds authored
      Pull more thermal control updates from Rafael Wysocki:
       "These are mostly cleanups on top of the previously merged thermal
        control changes plus some driver fixes and the removal of the Intel
        Menlow thermal driver.
      
        Specifics:
      
         - Add compatible DT bindings for imx6sll and imx6ul to fix a dtbs
           check warning (Stefan Wahren)
      
         - Update the example in the DT bindings to reflect changes with the
           ADC node name for QCom TM and TM5 (Marijn Suijten)
      
         - Fix comments for the cpuidle_cooling_register() function to match
           the function prototype (Chenggang Wang)
      
         - Fix inconsistent temperature read and some Mediatek variant board
           reboot by reverting a change and handling the temperature
           differently (AngeloGioacchino Del Regno)
      
         - Fix a memory leak in the initialization error path for the Mediatek
           driver (Kang Chen)
      
         - Use of_address_to_resource() in the Mediatek driver (Rob Herring)
      
         - Fix unit address in the QCom tsens driver DT bindings (Krzysztof
           Kozlowski)
      
         - Clean up the step-wise thermal governor (Zhang Rui)
      
         - Introduce thermal_zone_device() for accessing the device field of
           struct thermal_zone_device and two drivers use it (Daniel Lezcano)
      
         - Clean up the ACPI thermal driver a bit (Daniel Lezcano)
      
         - Delete the thermal driver for Intel Menlow platforms that is not
           expected to have any users (Rafael Wysocki)"
      
      * tag 'thermal-6.4-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        thermal: intel: menlow: Get rid of this driver
        ACPI: thermal: Move to dedicated function sysfs extra attr creation
        ACPI: thermal: Use thermal_zone_device()
        thermal: intel: pch_thermal: Use thermal driver device to write a trace
        thermal: core: Encapsulate tz->device field
        thermal: gov_step_wise: Adjust code logic to match comment
        thermal: gov_step_wise: Delete obsolete comment
        dt-bindings: thermal: qcom-tsens: Correct unit address
        thermal/drivers/mediatek: Use of_address_to_resource()
        thermal/drivers/mediatek: Change clk_prepare_enable to devm_clk_get_enabled in mtk_thermal_probe
        thermal/drivers/mediatek: Use devm_of_iomap to avoid resource leak in mtk_thermal_probe
        thermal/drivers/mediatek: Add temperature constraints to validate read
        Revert "thermal/drivers/mediatek: Add delay after thermal banks initialization"
        thermal/drivers/cpuidle_cooling: Delete unmatched comments
        dt-bindings: thermal: Use generic ADC node name in examples
        dt-bindings: imx-thermal: Add imx6sll and imx6ul compatible
      667de5c6
    • Linus Torvalds's avatar
      Merge tag 'pwm/for-6.4-rc1' of... · 89b7fd5d
      Linus Torvalds authored
      Merge tag 'pwm/for-6.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm
      
      Pull pwm updates from Thierry Reding:
       "The bulk of this is trivial conversions to the new .remove_new()
        callback for drivers as part of Uwe's effort to clean that up.
      
        Other than that a driver is added for Apple devices and various small
        fixes are included for existing drivers.
      
        Last but not least, this finally gets rid of the old pwm_request() and
        pwm_free() APIs are removed since the last user was dropped in v6.3"
      
      * tag 'pwm/for-6.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm: (44 commits)
        pwm: Remove unused radix tree
        pwm: Delete deprecated functions pwm_request() and pwm_free()
        pwm: meson: Fix g12a ao clk81 name
        pwm: meson: Fix axg ao mux parents
        pwm: stm32: Enforce settings for PWM capture
        MAINTAINERS: Add entries for Apple PWM driver
        pwm: Add Apple PWM controller
        dt-bindings: pwm: Add Apple PWM controller
        pwm: mtk-disp: Configure double buffering before reading in .get_state()
        pwm: mtk-disp: Disable shadow registers before setting backlight values
        pwm: stm32-lp: Drop of_match_ptr for ID table
        pwm: rcar: Drop of_match_ptr for ID table
        dt-bindings: pwm: Convert Amlogic Meson PWM binding
        dt-bindings: pwm: mediatek: Add mediatek,mt7986 compatible
        pwm: xilinx: Convert to platform remove callback returning void
        pwm: vt8500: Convert to platform remove callback returning void
        pwm: tiehrpwm: Convert to platform remove callback returning void
        pwm: tiecap: Convert to platform remove callback returning void
        pwm: tegra: Convert to platform remove callback returning void
        pwm: sun4i: Convert to platform remove callback returning void
        ...
      89b7fd5d
    • Linus Torvalds's avatar
      Merge tag 'soundwire-6.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire · 4c9818d8
      Linus Torvalds authored
      Pull soundwire updates from Vinod Koul:
       "This features AMD soundwire controller driver, a bunch of Intel
        changes for future platform support, sdw API updates etc:
      
         - Support for AMD soundwire controller
      
         - Intel driver updates to support future platforms
      
         - Core API sdw_nread/nwrite_no_pm updates to handle page boundaries"
      
      * tag 'soundwire-6.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire: (38 commits)
        soundwire: intel_auxdevice: improve pm_prepare step
        soundwire: bus: Fix unbalanced pm_runtime_put() causing usage count underflow
        soundwire: intel: don't save hw_params for use in prepare
        soundwire: bus: Update sdw_nread/nwrite_no_pm to handle page boundaries
        soundwire: bus: Update kernel doc for no_pm functions
        soundwire: bus: Remove now outdated comments on no_pm IO
        soundwire: stream: uniquify dev_err() logs
        soundwire: stream: remove bus->dev from logs on multiple buses
        soundwire: amd: add pm_prepare callback and pm ops support
        soundwire: amd: handle SoundWire wake enable interrupt
        soundwire: amd: add runtime pm ops for AMD SoundWire manager driver
        soundwire: amd: add SoundWire manager interrupt handling
        soundwire: amd: enable build for AMD SoundWire manager driver
        soundwire: amd: register SoundWire manager dai ops
        soundwire: amd: Add support for AMD Manager driver
        soundwire: export sdw_compute_slave_ports() function
        soundwire: stream: restore cumulative bus bandwidth when compute_params callback failed
        soundwire: bandwidth allocation: Use hweight32() to calculate set bits
        soundwire: qcom: gracefully handle too many ports in DT
        soundwire: qcom: define hardcoded version magic numbers
        ...
      4c9818d8
    • Linus Torvalds's avatar
      Merge tag 'phy-for-6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy · 54bdf8a3
      Linus Torvalds authored
      Pull phy updates from Vinod Koul:
       "New support:
         - UFS PHY for Qualcomm SA8775p, SM7150
         - PCIe 2 lane phy support for sc8180x and PCIe PHY for SDX65
         - Mediatke hdmi phy support for mt8195
         - rockchip naneng combo phy support for RK358
      
        Updates:
         - Drop Thunder Bay eMMC PHY driver
         - RC support for PCIe phy for Qualcomm SDX55
         - SGMII support in WIZ driver for J721E
         - PCIe and multilink SGMII PHY support in cadence driver
         - Big pile of platform remove callback returning void conversions"
      
      * tag 'phy-for-6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy: (77 commits)
        phy: cadence: cdns-dphy-rx: Add common module reset support
        phy: ti: j721e-wiz: Add SGMII support in WIZ driver for J721E
        dt-bindings: phy: ti: phy-gmii-sel: Add support for J784S4 CPSW9G
        phy: ti: j721e-wiz: Fix unreachable code in wiz_mode_select()
        phy: cadence: Sierra: Add PCIe + SGMII PHY multilink configuration
        phy: mediatek: add support for phy-mtk-hdmi-mt8195
        phy: phy-mtk-hdmi: Add generic phy configure callback
        dt-bindings: phy: mediatek: hdmi-phy: Add mt8195 compatible
        phy: tegra: xusb: Add missing tegra_xusb_port_unregister for usb2_port and ulpi_port
        dt-bindings: phy: ti,phy-j721e-wiz: document clock-output-names
        dt-bindings: phy: ti,phy-j721e-wiz: drop assigned-clocks
        dt-bindings: phy: ti,phy-am654-serdes: drop assigned-clocks type
        dt-bindings: phy: cadence-torrent: drop assigned-clocks
        dt-bindings: phy: cadence-sierra: drop assigned-clocks
        phy: rockchip: remove unused hw_to_inno function
        phy: qualcomm: phy-qcom-qmp-ufs: add definitions for sa8775p
        dt-bindings: phy: qmp-ufs: describe the UFS PHY for sa8775p
        phy: qcom-qmp-pcie: drop sdm845_qhp_pcie_rx_tbl
        phy: qcom-qmp-pcie: sc8180x PCIe PHY has 2 lanes
        phy: qcom-qmp-ufs: Add SM7150 support
        ...
      54bdf8a3
    • Linus Torvalds's avatar
      Merge tag 'dmaengine-6.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine · 7994beab
      Linus Torvalds authored
      Pull dmaengine updates from Vinod Koul:
       "New support:
      
         - Apple admac t8112 device support
      
         - StarFive JH7110 DMA controller
      
        Updates:
      
         - Big pile of idxd updates to support IAA 2.0 device capabilities,
           DSA 2.0 Event Log and completion record faulting features and
           new DSA operations
      
         - at_xdmac supend & resume updates and driver code cleanup
      
         - k3-udma supend & resume support
      
         - k3-psil thread support for J784s4"
      
      * tag 'dmaengine-6.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine: (57 commits)
        dmaengine: idxd: add per wq PRS disable
        dmaengine: idxd: add pid to exported sysfs attribute for opened file
        dmaengine: idxd: expose fault counters to sysfs
        dmaengine: idxd: add a device to represent the file opened
        dmaengine: idxd: add per file user counters for completion record faults
        dmaengine: idxd: process batch descriptor completion record faults
        dmaengine: idxd: add descs_completed field for completion record
        dmaengine: idxd: process user page faults for completion record
        dmaengine: idxd: add idxd_copy_cr() to copy user completion record during page fault handling
        dmaengine: idxd: create kmem cache for event log fault items
        dmaengine: idxd: add per DSA wq workqueue for processing cr faults
        dmanegine: idxd: add debugfs for event log dump
        dmaengine: idxd: add interrupt handling for event log
        dmaengine: idxd: setup event log configuration
        dmaengine: idxd: add event log size sysfs attribute
        dmaengine: idxd: make misc interrupt one shot
        dt-bindings: dma: snps,dw-axi-dmac: constrain the items of resets for JH7110 dma
        dt-bindings: dma: Drop unneeded quotes
        dmaengine: at_xdmac: align declaration of ret with the rest of variables
        dmaengine: at_xdmac: add a warning message regarding for unpaused channels
        ...
      7994beab
    • Linus Torvalds's avatar
      Merge tag 'for-6.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/pateldipen1984/linux · 29ee463d
      Linus Torvalds authored
      Pull hardware timestamp engine updates from Dipen Patel:
       "The changes for the hte subsystem include:
      
         - Add Tegra234 HTE provider and relevant DT bindings
      
         - Update MAINTAINERS file for the HTE subsystem"
      
      * tag 'for-6.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/pateldipen1984/linux:
        hte: tegra-194: Use proper includes
        hte: Use device_match_of_node()
        hte: tegra-194: Fix off by one in tegra_hte_map_to_line_id()
        hte: tegra: fix 'struct of_device_id' build error
        hte: Use of_property_present() for testing DT property presence
        gpio: tegra186: Add Tegra234 hte support
        hte: handle nvidia,gpio-controller property
        hte: Deprecate nvidia,slices property
        hte: Add Tegra234 provider
        hte: Re-phrase tegra API document
        arm64: tegra: Add Tegra234 GTE nodes
        dt-bindings: timestamp: Deprecate nvidia,slices property
        dt-bindings: timestamp: Add Tegra234 support
        MAINTAINERS: Add HTE/timestamp subsystem details
      29ee463d
    • Helge Deller's avatar
      parisc: Fix argument pointer in real64_call_asm() · 6e3220ba
      Helge Deller authored
      Fix the argument pointer (ap) to point to real-mode memory
      instead of virtual memory.
      
      It's interesting that this issue hasn't shown up earlier, as this could
      have happened with any 64-bit PDC ROM code.
      
      I just noticed it because I suddenly faced a HPMC while trying to execute
      the 64-bit STI ROM code of an Visualize-FXe graphics card for the STI
      text console.
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Cc: <stable@vger.kernel.org>
      6e3220ba
    • John David Anglin's avatar
      parisc: Cleanup mmap implementation regarding color alignment · 567b3515
      John David Anglin authored
      This change simplifies the randomization of file mapping regions. It
      reworks the code to remove duplication. The flow is now similar to
      that for mips. Finally, we consistently use the do_color_align variable
      to determine when color alignment is needed.
      
      Tested on rp3440.
      Signed-off-by: default avatarJohn David Anglin <dave.anglin@bell.net>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      567b3515
    • Helge Deller's avatar
      653f3ea7
    • Helge Deller's avatar
      parisc: Ensure page alignment in flush functions · d755bd2c
      Helge Deller authored
      Matthew Wilcox noticed, that if ARCH_HAS_FLUSH_ON_KUNMAP is defined
      (which is the case for PA-RISC), __kunmap_local() calls
      kunmap_flush_on_unmap(), which may call the parisc flush functions with
      a non-page-aligned address and thus the page might not be fully flushed.
      
      This patch ensures that flush_kernel_dcache_page_asm() and
      flush_kernel_dcache_page_asm() will always operate on page-aligned
      addresses.
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Cc: <stable@vger.kernel.org> # v6.0+
      d755bd2c
    • Guilherme G. Piccoli's avatar
      parisc: Replace regular spinlock with spin_trylock on panic path · 829632da
      Guilherme G. Piccoli authored
      The panic notifiers' callbacks execute in an atomic context, with
      interrupts/preemption disabled, and all CPUs not running the panic
      function are off, so it's very dangerous to wait on a regular
      spinlock, there's a risk of deadlock.
      
      Refactor the panic notifier of parisc/power driver to make use
      of spin_trylock - for that, we've added a second version of the
      soft-power function. Also, some comments were reorganized and
      trailing white spaces, useless header inclusion and blank lines
      were removed.
      
      Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
      Cc: Jeroen Roovers <jer@xs4all.nl>
      Acked-by: Helge Deller <deller@gmx.de> # parisc
      Signed-off-by: default avatarGuilherme G. Piccoli <gpiccoli@igalia.com>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      829632da
    • Randy Dunlap's avatar
      parisc: update kbuild doc. aliases for parisc64 · e0838a99
      Randy Dunlap authored
      ARCH=parisc64 is now supported for 64-bit parisc builds, so add
      this alias to the kbuild.rst documentation.
      
      Fixes: 3dcfb729 ("parisc: Make CONFIG_64BIT available for ARCH=parisc64 only")
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
      Cc: Helge Deller <deller@gmx.de>
      Cc: linux-parisc@vger.kernel.org
      Cc: Masahiro Yamada <masahiroy@kernel.org>
      Cc: linux-kbuild@vger.kernel.org
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: linux-doc@vger.kernel.org
      Acked-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      e0838a99
    • Helge Deller's avatar
      parisc: Limit amount of kgdb breakpoints on parisc · 82da62ab
      Helge Deller authored
      kgdb is rarely used and 40 breakpoints seems enough to debug
      parisc specific bugs.
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      82da62ab
    • Rafael J. Wysocki's avatar
      Merge branch 'pm-sleep' · 57ea3ab2
      Rafael J. Wysocki authored
      Merge hibernation test mode fix for 6.4-rc1.
      
      * pm-sleep:
        PM: hibernate: Do not get block device exclusively in test_resume mode
        PM: hibernate: Turn snapshot_test into global variable
      57ea3ab2
    • Rafael J. Wysocki's avatar
      Merge branches 'acpi-pm' and 'acpi-properties' · 2e70a47c
      Rafael J. Wysocki authored
      Merge an ACPI power management quirk and a change related to the
      handling of ACPI device properties for 6.4-rc1:
      
       - Do not turn off unused power resources during initialization on the
         Toshiba Click Mini (Hans de Goede).
      
       - Support strings in device properties supplied by ACPI _DSM on Apple
         platforms (Hector Martin).
      
      * acpi-pm:
        ACPI: PM: Do not turn of unused power resources on the Toshiba Click Mini
      
      * acpi-properties:
        ACPI: property: Support strings in Apple _DSM props
      2e70a47c
    • Rafael J. Wysocki's avatar
      Merge branch 'thermal-core' · 53389edd
      Rafael J. Wysocki authored
      Merge additional thermal core and ACPI thermal changes for 6.4-rc1:
      
       - Clean up the step-wise thermal governor (Zhang Rui).
      
       - Introduce thermal_zone_device() for accessing the device field of
         struct thermal_zone_device and two drivers use it (Daniel Lezcano).
      
       - Clean up the ACPI thermal driver a bit (Daniel Lezcano).
      
       - Delete the thermal driver for Intel Menlow platforms that is not
         expected to have any users (Rafael Wysocki).
      
      * thermal-core:
        thermal: intel: menlow: Get rid of this driver
        ACPI: thermal: Move to dedicated function sysfs extra attr creation
        ACPI: thermal: Use thermal_zone_device()
        thermal: intel: pch_thermal: Use thermal driver device to write a trace
        thermal: core: Encapsulate tz->device field
        thermal: gov_step_wise: Adjust code logic to match comment
        thermal: gov_step_wise: Delete obsolete comment
      53389edd
    • Arnd Bergmann's avatar
      module: include internal.h in module/dups.c · 0b891c83
      Arnd Bergmann authored
      Two newly introduced functions are declared in a header that is not
      included before the definition, causing a warning with sparse or
      'make W=1':
      
      kernel/module/dups.c:118:6: error: no previous prototype for 'kmod_dup_request_exists_wait' [-Werror=missing-prototypes]
        118 | bool kmod_dup_request_exists_wait(char *module_name, bool wait, int *dup_ret)
            |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      kernel/module/dups.c:220:6: error: no previous prototype for 'kmod_dup_request_announce' [-Werror=missing-prototypes]
        220 | void kmod_dup_request_announce(char *module_name, int ret)
            |      ^~~~~~~~~~~~~~~~~~~~~~~~~
      
      Add an explicit include to ensure the prototypes match.
      
      Fixes: 8660484e ("module: add debugging auto-load duplicate module support")
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Link: https://lore.kernel.org/oe-kbuild-all/202304141440.DYO4NAzp-lkp@intel.com/Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
      0b891c83
    • Luis Chamberlain's avatar
      sysctl: remove register_sysctl_paths() · 0199849a
      Luis Chamberlain authored
      The deprecation for register_sysctl_paths() is over. We can rejoice as
      we nuke register_sysctl_paths(). The routine register_sysctl_table()
      was the only user left of register_sysctl_paths(), so we can now just
      open code and move the implementation over to what used to be
      to __register_sysctl_paths().
      
      The old dynamic struct ctl_table_set *set is now the point to
      sysctl_table_root.default_set.
      
      The old dynamic const struct ctl_path *path was being used in the
      routine register_sysctl_paths() with a static:
      
      static const struct ctl_path null_path[] = { {} };
      
      Since this is a null path we can now just simplfy the old routine
      and remove its use as its always empty.
      
      This saves us a total of 230 bytes.
      
      $ ./scripts/bloat-o-meter vmlinux.old vmlinux
      add/remove: 2/7 grow/shrink: 1/1 up/down: 1015/-1245 (-230)
      Function                                     old     new   delta
      register_leaf_sysctl_tables.constprop          -     524    +524
      register_sysctl_table                         22     497    +475
      __pfx_register_leaf_sysctl_tables.constprop       -      16     +16
      null_path                                      8       -      -8
      __pfx_register_sysctl_paths                   16       -     -16
      __pfx_register_leaf_sysctl_tables             16       -     -16
      __pfx___register_sysctl_paths                 16       -     -16
      __register_sysctl_base                        29      12     -17
      register_sysctl_paths                         18       -     -18
      register_leaf_sysctl_tables                  534       -    -534
      __register_sysctl_paths                      620       -    -620
      Total: Before=21259666, After=21259436, chg -0.00%
      Signed-off-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
      0199849a
    • Luis Chamberlain's avatar
      kernel: pid_namespace: simplify sysctls with register_sysctl() · 9e7c73c0
      Luis Chamberlain authored
      register_sysctl_paths() is only required if your child (directories)
      have entries and pid_namespace does not. So use register_sysctl_init()
      instead where we don't care about the return value and use
      register_sysctl() where we do.
      Signed-off-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
      Acked-by: default avatarJeff Xu <jeffxu@google.com>
      Link: https://lore.kernel.org/r/20230302202826.776286-9-mcgrof@kernel.org
      9e7c73c0
    • Suren Baghdasaryan's avatar
      mm: change per-VMA lock statistics to be disabled by default · 6152e53d
      Suren Baghdasaryan authored
      Change CONFIG_PER_VMA_LOCK_STATS to be disabled by default, as most users
      don't need it.  Add configuration help to clarify its usage.
      
      Link: https://lkml.kernel.org/r/20230428173533.18158-1-surenb@google.com
      Fixes: 52f23865 ("mm: introduce per-VMA lock statistics")
      Signed-off-by: default avatarSuren Baghdasaryan <surenb@google.com>
      Suggested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Reviewed-by: default avatarLorenzo Stoakes <lstoakes@gmail.com>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      6152e53d
    • Michal Simek's avatar
      MAINTAINERS: update Michal Simek's email · 3628d2bb
      Michal Simek authored
      @xilinx.com is still working but better to switch to new amd.com after
      AMD/Xilinx acquisition.
      
      Link: https://lkml.kernel.org/r/bd073d026f8c367a9cfb45d26d39f26e40c665dc.1683035692.git.michal.simek@amd.comSigned-off-by: default avatarMichal Simek <michal.simek@amd.com>
      Cc: Colin Ian King <colin.i.king@gmail.com>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Cc: Kirill Tkhai <tkhai@ya.ru>
      Cc: Konrad Dybcio <konrad.dybcio@linaro.org>
      Cc: Qais Yousef <qyousef@layalina.io>
      Cc: Michal Simek <michal.simek@xilinx.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      3628d2bb
    • Lorenzo Stoakes's avatar
      mm/mempolicy: correctly update prev when policy is equal on mbind · 00ca0f2e
      Lorenzo Stoakes authored
      The refactoring in commit f4e9e0e6 ("mm/mempolicy: fix use-after-free
      of VMA iterator") introduces a subtle bug which arises when attempting to
      apply a new NUMA policy across a range of VMAs in mbind_range().
      
      The refactoring passes a **prev pointer to keep track of the previous VMA
      in order to reduce duplication, and in all but one case it keeps this
      correctly updated.
      
      The bug arises when a VMA within the specified range has an equivalent
      policy as determined by mpol_equal() - which unlike other cases, does not
      update prev.
      
      This can result in a situation where, later in the iteration, a VMA is
      found whose policy does need to change.  At this point, vma_merge() is
      invoked with prev pointing to a VMA which is before the previous VMA.
      
      Since vma_merge() discovers the curr VMA by looking for the one
      immediately after prev, it will now be in a situation where this VMA is
      incorrect and the merge will not proceed correctly.
      
      This is checked in the VM_WARN_ON() invariant case with end >
      curr->vm_end, which, if a merge is possible, results in a warning (if
      CONFIG_DEBUG_VM is specified).
      
      I note that vma_merge() performs these invariant checks only after
      merge_prev/merge_next are checked, which is debatable as it hides this
      issue if no merge is possible even though a buggy situation has arisen.
      
      The solution is simply to update the prev pointer even when policies are
      equal.
      
      This caused a bug to arise in the 6.2.y stable tree, and this patch
      resolves this bug.
      
      Link: https://lkml.kernel.org/r/83f1d612acb519d777bebf7f3359317c4e7f4265.1682866629.git.lstoakes@gmail.com
      Fixes: f4e9e0e6 ("mm/mempolicy: fix use-after-free of VMA iterator")
      Signed-off-by: default avatarLorenzo Stoakes <lstoakes@gmail.com>
      Reported-by: default avatarkernel test robot <oliver.sang@intel.com>
        Link: https://lore.kernel.org/oe-lkp/202304292203.44ddeff6-oliver.sang@intel.com
      Cc: Liam R. Howlett <Liam.Howlett@oracle.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      00ca0f2e
    • Zhang Zhengming's avatar
      relayfs: fix out-of-bounds access in relay_file_read · 43ec16f1
      Zhang Zhengming authored
      There is a crash in relay_file_read, as the var from
      point to the end of last subbuf.
      
      The oops looks something like:
      pc : __arch_copy_to_user+0x180/0x310
      lr : relay_file_read+0x20c/0x2c8
      Call trace:
       __arch_copy_to_user+0x180/0x310
       full_proxy_read+0x68/0x98
       vfs_read+0xb0/0x1d0
       ksys_read+0x6c/0xf0
       __arm64_sys_read+0x20/0x28
       el0_svc_common.constprop.3+0x84/0x108
       do_el0_svc+0x74/0x90
       el0_svc+0x1c/0x28
       el0_sync_handler+0x88/0xb0
       el0_sync+0x148/0x180
      
      We get the condition by analyzing the vmcore:
      
      1). The last produced byte and last consumed byte
          both at the end of the last subbuf
      
      2). A softirq calls function(e.g __blk_add_trace)
          to write relay buffer occurs when an program is calling
          relay_file_read_avail().
      
              relay_file_read
                      relay_file_read_avail
                              relay_file_read_consume(buf, 0, 0);
                              //interrupted by softirq who will write subbuf
                              ....
                              return 1;
                      //read_start point to the end of the last subbuf
                      read_start = relay_file_read_start_pos
                      //avail is equal to subsize
                      avail = relay_file_read_subbuf_avail
                      //from  points to an invalid memory address
                      from = buf->start + read_start
                      //system is crashed
                      copy_to_user(buffer, from, avail)
      
      Link: https://lkml.kernel.org/r/20230419040203.37676-1-zhang.zhengming@h3c.com
      Fixes: 8d62fdeb ("relay file read: start-pos fix")
      Signed-off-by: default avatarZhang Zhengming <zhang.zhengming@h3c.com>
      Reviewed-by: default avatarZhao Lei <zhao_lei1@hoperun.com>
      Reviewed-by: default avatarZhou Kete <zhou.kete@h3c.com>
      Reviewed-by: default avatarPengcheng Yang <yangpc@wangsu.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      43ec16f1
    • Mark Rutland's avatar
      kasan: hw_tags: avoid invalid virt_to_page() · 29083fd8
      Mark Rutland authored
      When booting with 'kasan.vmalloc=off', a kernel configured with support
      for KASAN_HW_TAGS will explode at boot time due to bogus use of
      virt_to_page() on a vmalloc adddress.  With CONFIG_DEBUG_VIRTUAL selected
      this will be reported explicitly, and with or without CONFIG_DEBUG_VIRTUAL
      the kernel will dereference a bogus address:
      
      | ------------[ cut here ]------------
      | virt_to_phys used for non-linear address: (____ptrval____) (0xffff800008000000)
      | WARNING: CPU: 0 PID: 0 at arch/arm64/mm/physaddr.c:15 __virt_to_phys+0x78/0x80
      | Modules linked in:
      | CPU: 0 PID: 0 Comm: swapper/0 Not tainted 6.3.0-rc3-00073-g83865133300d-dirty #4
      | Hardware name: linux,dummy-virt (DT)
      | pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
      | pc : __virt_to_phys+0x78/0x80
      | lr : __virt_to_phys+0x78/0x80
      | sp : ffffcd076afd3c80
      | x29: ffffcd076afd3c80 x28: 0068000000000f07 x27: ffff800008000000
      | x26: fffffbfff0000000 x25: fffffbffff000000 x24: ff00000000000000
      | x23: ffffcd076ad3c000 x22: fffffc0000000000 x21: ffff800008000000
      | x20: ffff800008004000 x19: ffff800008000000 x18: ffff800008004000
      | x17: 666678302820295f x16: ffffffffffffffff x15: 0000000000000004
      | x14: ffffcd076b009e88 x13: 0000000000000fff x12: 0000000000000003
      | x11: 00000000ffffefff x10: c0000000ffffefff x9 : 0000000000000000
      | x8 : 0000000000000000 x7 : 205d303030303030 x6 : 302e30202020205b
      | x5 : ffffcd076b41d63f x4 : ffffcd076afd3827 x3 : 0000000000000000
      | x2 : 0000000000000000 x1 : ffffcd076afd3a30 x0 : 000000000000004f
      | Call trace:
      |  __virt_to_phys+0x78/0x80
      |  __kasan_unpoison_vmalloc+0xd4/0x478
      |  __vmalloc_node_range+0x77c/0x7b8
      |  __vmalloc_node+0x54/0x64
      |  init_IRQ+0x94/0xc8
      |  start_kernel+0x194/0x420
      |  __primary_switched+0xbc/0xc4
      | ---[ end trace 0000000000000000 ]---
      | Unable to handle kernel paging request at virtual address 03fffacbe27b8000
      | Mem abort info:
      |   ESR = 0x0000000096000004
      |   EC = 0x25: DABT (current EL), IL = 32 bits
      |   SET = 0, FnV = 0
      |   EA = 0, S1PTW = 0
      |   FSC = 0x04: level 0 translation fault
      | Data abort info:
      |   ISV = 0, ISS = 0x00000004
      |   CM = 0, WnR = 0
      | swapper pgtable: 4k pages, 48-bit VAs, pgdp=0000000041bc5000
      | [03fffacbe27b8000] pgd=0000000000000000, p4d=0000000000000000
      | Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
      | Modules linked in:
      | CPU: 0 PID: 0 Comm: swapper/0 Tainted: G        W          6.3.0-rc3-00073-g83865133300d-dirty #4
      | Hardware name: linux,dummy-virt (DT)
      | pstate: 200000c5 (nzCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
      | pc : __kasan_unpoison_vmalloc+0xe4/0x478
      | lr : __kasan_unpoison_vmalloc+0xd4/0x478
      | sp : ffffcd076afd3ca0
      | x29: ffffcd076afd3ca0 x28: 0068000000000f07 x27: ffff800008000000
      | x26: 0000000000000000 x25: 03fffacbe27b8000 x24: ff00000000000000
      | x23: ffffcd076ad3c000 x22: fffffc0000000000 x21: ffff800008000000
      | x20: ffff800008004000 x19: ffff800008000000 x18: ffff800008004000
      | x17: 666678302820295f x16: ffffffffffffffff x15: 0000000000000004
      | x14: ffffcd076b009e88 x13: 0000000000000fff x12: 0000000000000001
      | x11: 0000800008000000 x10: ffff800008000000 x9 : ffffb2f8dee00000
      | x8 : 000ffffb2f8dee00 x7 : 205d303030303030 x6 : 302e30202020205b
      | x5 : ffffcd076b41d63f x4 : ffffcd076afd3827 x3 : 0000000000000000
      | x2 : 0000000000000000 x1 : ffffcd076afd3a30 x0 : ffffb2f8dee00000
      | Call trace:
      |  __kasan_unpoison_vmalloc+0xe4/0x478
      |  __vmalloc_node_range+0x77c/0x7b8
      |  __vmalloc_node+0x54/0x64
      |  init_IRQ+0x94/0xc8
      |  start_kernel+0x194/0x420
      |  __primary_switched+0xbc/0xc4
      | Code: d34cfc08 aa1f03fa 8b081b39 d503201f (f9400328)
      | ---[ end trace 0000000000000000 ]---
      | Kernel panic - not syncing: Attempted to kill the idle task!
      
      This is because init_vmalloc_pages() erroneously calls virt_to_page() on
      a vmalloc address, while virt_to_page() is only valid for addresses in
      the linear/direct map. Since init_vmalloc_pages() expects virtual
      addresses in the vmalloc range, it must use vmalloc_to_page() rather
      than virt_to_page().
      
      We call init_vmalloc_pages() from __kasan_unpoison_vmalloc(), where we
      check !is_vmalloc_or_module_addr(), suggesting that we might encounter a
      non-vmalloc address. Luckily, this never happens. By design, we only
      call __kasan_unpoison_vmalloc() on pointers in the vmalloc area, and I
      have verified that we don't violate that expectation. Given that,
      is_vmalloc_or_module_addr() must always be true for any legitimate
      argument to __kasan_unpoison_vmalloc().
      
      Correct init_vmalloc_pages() to use vmalloc_to_page(), and remove the
      redundant and misleading use of is_vmalloc_or_module_addr() in
      __kasan_unpoison_vmalloc().
      
      Link: https://lkml.kernel.org/r/20230418164212.1775741-1-mark.rutland@arm.com
      Fixes: 6c2f761d ("kasan: fix zeroing vmalloc memory with HW_TAGS")
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Andrey Konovalov <andreyknvl@google.com>
      Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Marco Elver <elver@google.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      29083fd8
    • Kefeng Wang's avatar
      mm: hwpoison: coredump: support recovery from dump_user_range() · 245f0922
      Kefeng Wang authored
      dump_user_range() is used to copy the user page to a coredump file, but if
      a hardware memory error occurred during copy, which called from
      __kernel_write_iter() in dump_user_range(), it crashes,
      
        CPU: 112 PID: 7014 Comm: mca-recover Not tainted 6.3.0-rc2 #425
      
        pc : __memcpy+0x110/0x260
        lr : _copy_from_iter+0x3bc/0x4c8
        ...
        Call trace:
         __memcpy+0x110/0x260
         copy_page_from_iter+0xcc/0x130
         pipe_write+0x164/0x6d8
         __kernel_write_iter+0x9c/0x210
         dump_user_range+0xc8/0x1d8
         elf_core_dump+0x308/0x368
         do_coredump+0x2e8/0xa40
         get_signal+0x59c/0x788
         do_signal+0x118/0x1f8
         do_notify_resume+0xf0/0x280
         el0_da+0x130/0x138
         el0t_64_sync_handler+0x68/0xc0
         el0t_64_sync+0x188/0x190
      
      Generally, the '->write_iter' of file ops will use copy_page_from_iter()
      and copy_page_from_iter_atomic(), change memcpy() to copy_mc_to_kernel()
      in both of them to handle #MC during source read, which stop coredump
      processing and kill the task instead of kernel panic, but the source
      address may not always a user address, so introduce a new copy_mc flag in
      struct iov_iter{} to indicate that the iter could do a safe memory copy,
      also introduce the helpers to set/cleck the flag, for now, it's only used
      in coredump's dump_user_range(), but it could expand to any other
      scenarios to fix the similar issue.
      
      Link: https://lkml.kernel.org/r/20230417045323.11054-1-wangkefeng.wang@huawei.comSigned-off-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Christian Brauner <brauner@kernel.org>
      Cc: Miaohe Lin <linmiaohe@huawei.com>
      Cc: Naoya Horiguchi <naoya.horiguchi@nec.com>
      Cc: Tong Tiangen <tongtiangen@huawei.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      245f0922
    • Baolin Wang's avatar
      mm/page_alloc: add some comments to explain the possible hole in __pageblock_pfn_to_page() · 65f67a3e
      Baolin Wang authored
      Now the __pageblock_pfn_to_page() is used by set_zone_contiguous(), which
      checks whether the given zone contains holes, and uses
      pfn_to_online_page() to validate if the start pfn is online and valid, as
      well as using pfn_valid() to validate the end pfn.
      
      However, the __pageblock_pfn_to_page() function may return non-NULL even
      if the end pfn of a pageblock is in a memory hole in some situations.  For
      example, if the pageblock order is MAX_ORDER, which will fall into 2
      sub-sections, and the end pfn of the pageblock may be hole even though the
      start pfn is online and valid.
      
      See below memory layout as an example and suppose the pageblock order is
      MAX_ORDER.
      
      [    0.000000] Zone ranges:
      [    0.000000]   DMA      [mem 0x0000000040000000-0x00000000ffffffff]
      [    0.000000]   DMA32    empty
      [    0.000000]   Normal   [mem 0x0000000100000000-0x0000001fa7ffffff]
      [    0.000000] Movable zone start for each node
      [    0.000000] Early memory node ranges
      [    0.000000]   node   0: [mem 0x0000000040000000-0x0000001fa3c7ffff]
      [    0.000000]   node   0: [mem 0x0000001fa3c80000-0x0000001fa3ffffff]
      [    0.000000]   node   0: [mem 0x0000001fa4000000-0x0000001fa402ffff]
      [    0.000000]   node   0: [mem 0x0000001fa4030000-0x0000001fa40effff]
      [    0.000000]   node   0: [mem 0x0000001fa40f0000-0x0000001fa73cffff]
      [    0.000000]   node   0: [mem 0x0000001fa73d0000-0x0000001fa745ffff]
      [    0.000000]   node   0: [mem 0x0000001fa7460000-0x0000001fa746ffff]
      [    0.000000]   node   0: [mem 0x0000001fa7470000-0x0000001fa758ffff]
      [    0.000000]   node   0: [mem 0x0000001fa7590000-0x0000001fa7dfffff]
      
      Focus on the last memory range, and there is a hole for the range [mem
      0x0000001fa7590000-0x0000001fa7dfffff].  That means the last pageblock
      will contain the range from 0x1fa7c00000 to 0x1fa7ffffff, since the
      pageblock must be 4M aligned.  And in this pageblock, these pfns will fall
      into 2 sub-section (the sub-section size is 2M aligned).
      
      So, the 1st sub-section (indicates pfn range: 0x1fa7c00000 - 0x1fa7dfffff
      ) in this pageblock is valid by calling subsection_map_init() in
      free_area_init(), but the 2nd sub-section (indicates pfn range:
      0x1fa7e00000 - 0x1fa7ffffff ) in this pageblock is not valid.
      
      This did not break anything until now, but the zone continuous is fragile
      in this possible scenario.  So as previous discussion[1], it is better to
      add some comments to explain this possible issue in case there are some
      future pfn walkers that rely on this.
      
      [1] https://lore.kernel.org/all/87r0sdsmr6.fsf@yhuang6-desk2.ccr.corp.intel.com/
      
      Link: https://lkml.kernel.org/r/5c26368865e79c743a453dea48d30670b19d2e4f.1682425534.git.baolin.wang@linux.alibaba.com
      Link: https://lkml.kernel.org/r/5c26368865e79c743a453dea48d30670b19d2e4f.1682425534.git.baolin.wang@linux.alibaba.comSigned-off-by: default avatarBaolin Wang <baolin.wang@linux.alibaba.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Reviewed-by: default avatar"Huang, Ying" <ying.huang@intel.com>
      Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Mike Rapoport (IBM) <rppt@kernel.org>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      65f67a3e
    • David Hildenbrand's avatar
      mm/ksm: move disabling KSM from s390/gmap code to KSM code · 2c281f54
      David Hildenbrand authored
      Let's factor out actual disabling of KSM.  The existing "mm->def_flags &=
      ~VM_MERGEABLE;" was essentially a NOP and can be dropped, because
      def_flags should never include VM_MERGEABLE.  Note that we don't currently
      prevent re-enabling KSM.
      
      This should now be faster in case KSM was never enabled, because we only
      conditionally iterate all VMAs.  Further, it certainly looks cleaner.
      
      Link: https://lkml.kernel.org/r/20230422210156.33630-1-david@redhat.comSigned-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      Acked-by: default avatarJanosch Frank <frankja@linux.ibm.com>
      Acked-by: default avatarStefan Roesch <shr@devkernel.io>
      Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
      Cc: Claudio Imbrenda <imbrenda@linux.ibm.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Rik van Riel <riel@surriel.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Sven Schnelle <svens@linux.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      2c281f54
    • David Hildenbrand's avatar
      selftests/ksm: ksm_functional_tests: add prctl unmerge test · 1150ea93
      David Hildenbrand authored
      Let's test whether setting PR_SET_MEMORY_MERGE to 0 after setting it to 1
      will unmerge pages, similar to how setting MADV_UNMERGEABLE after setting
      MADV_MERGEABLE would.
      
      Link: https://lkml.kernel.org/r/20230422205420.30372-3-david@redhat.comSigned-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      Acked-by: default avatarStefan Roesch <shr@devkernel.io>
      Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
      Cc: Claudio Imbrenda <imbrenda@linux.ibm.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Janosch Frank <frankja@linux.ibm.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Rik van Riel <riel@surriel.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Sven Schnelle <svens@linux.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      1150ea93