1. 12 Dec, 2022 29 commits
    • Linus Torvalds's avatar
      Merge tag 'irq-core-2022-12-10' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 9d33edb2
      Linus Torvalds authored
      Pull irq updates from Thomas Gleixner:
       "Updates for the interrupt core and driver subsystem:
      
        The bulk is the rework of the MSI subsystem to support per device MSI
        interrupt domains. This solves conceptual problems of the current
        PCI/MSI design which are in the way of providing support for
        PCI/MSI[-X] and the upcoming PCI/IMS mechanism on the same device.
      
        IMS (Interrupt Message Store] is a new specification which allows
        device manufactures to provide implementation defined storage for MSI
        messages (as opposed to PCI/MSI and PCI/MSI-X that has a specified
        message store which is uniform accross all devices). The PCI/MSI[-X]
        uniformity allowed us to get away with "global" PCI/MSI domains.
      
        IMS not only allows to overcome the size limitations of the MSI-X
        table, but also gives the device manufacturer the freedom to store the
        message in arbitrary places, even in host memory which is shared with
        the device.
      
        There have been several attempts to glue this into the current MSI
        code, but after lengthy discussions it turned out that there is a
        fundamental design problem in the current PCI/MSI-X implementation.
        This needs some historical background.
      
        When PCI/MSI[-X] support was added around 2003, interrupt management
        was completely different from what we have today in the actively
        developed architectures. Interrupt management was completely
        architecture specific and while there were attempts to create common
        infrastructure the commonalities were rudimentary and just providing
        shared data structures and interfaces so that drivers could be written
        in an architecture agnostic way.
      
        The initial PCI/MSI[-X] support obviously plugged into this model
        which resulted in some basic shared infrastructure in the PCI core
        code for setting up MSI descriptors, which are a pure software
        construct for holding data relevant for a particular MSI interrupt,
        but the actual association to Linux interrupts was completely
        architecture specific. This model is still supported today to keep
        museum architectures and notorious stragglers alive.
      
        In 2013 Intel tried to add support for hot-pluggable IO/APICs to the
        kernel, which was creating yet another architecture specific mechanism
        and resulted in an unholy mess on top of the existing horrors of x86
        interrupt handling. The x86 interrupt management code was already an
        incomprehensible maze of indirections between the CPU vector
        management, interrupt remapping and the actual IO/APIC and PCI/MSI[-X]
        implementation.
      
        At roughly the same time ARM struggled with the ever growing SoC
        specific extensions which were glued on top of the architected GIC
        interrupt controller.
      
        This resulted in a fundamental redesign of interrupt management and
        provided the today prevailing concept of hierarchical interrupt
        domains. This allowed to disentangle the interactions between x86
        vector domain and interrupt remapping and also allowed ARM to handle
        the zoo of SoC specific interrupt components in a sane way.
      
        The concept of hierarchical interrupt domains aims to encapsulate the
        functionality of particular IP blocks which are involved in interrupt
        delivery so that they become extensible and pluggable. The X86
        encapsulation looks like this:
      
                                                  |--- device 1
           [Vector]---[Remapping]---[PCI/MSI]--|...
                                                  |--- device N
      
        where the remapping domain is an optional component and in case that
        it is not available the PCI/MSI[-X] domains have the vector domain as
        their parent. This reduced the required interaction between the
        domains pretty much to the initialization phase where it is obviously
        required to establish the proper parent relation ship in the
        components of the hierarchy.
      
        While in most cases the model is strictly representing the chain of IP
        blocks and abstracting them so they can be plugged together to form a
        hierarchy, the design stopped short on PCI/MSI[-X]. Looking at the
        hardware it's clear that the actual PCI/MSI[-X] interrupt controller
        is not a global entity, but strict a per PCI device entity.
      
        Here we took a short cut on the hierarchical model and went for the
        easy solution of providing "global" PCI/MSI domains which was possible
        because the PCI/MSI[-X] handling is uniform across the devices. This
        also allowed to keep the existing PCI/MSI[-X] infrastructure mostly
        unchanged which in turn made it simple to keep the existing
        architecture specific management alive.
      
        A similar problem was created in the ARM world with support for IP
        block specific message storage. Instead of going all the way to stack
        a IP block specific domain on top of the generic MSI domain this ended
        in a construct which provides a "global" platform MSI domain which
        allows overriding the irq_write_msi_msg() callback per allocation.
      
        In course of the lengthy discussions we identified other abuse of the
        MSI infrastructure in wireless drivers, NTB etc. where support for
        implementation specific message storage was just mindlessly glued into
        the existing infrastructure. Some of this just works by chance on
        particular platforms but will fail in hard to diagnose ways when the
        driver is used on platforms where the underlying MSI interrupt
        management code does not expect the creative abuse.
      
        Another shortcoming of today's PCI/MSI-X support is the inability to
        allocate or free individual vectors after the initial enablement of
        MSI-X. This results in an works by chance implementation of VFIO (PCI
        pass-through) where interrupts on the host side are not set up upfront
        to avoid resource exhaustion. They are expanded at run-time when the
        guest actually tries to use them. The way how this is implemented is
        that the host disables MSI-X and then re-enables it with a larger
        number of vectors again. That works by chance because most device
        drivers set up all interrupts before the device actually will utilize
        them. But that's not universally true because some drivers allocate a
        large enough number of vectors but do not utilize them until it's
        actually required, e.g. for acceleration support. But at that point
        other interrupts of the device might be in active use and the MSI-X
        disable/enable dance can just result in losing interrupts and
        therefore hard to diagnose subtle problems.
      
        Last but not least the "global" PCI/MSI-X domain approach prevents to
        utilize PCI/MSI[-X] and PCI/IMS on the same device due to the fact
        that IMS is not longer providing a uniform storage and configuration
        model.
      
        The solution to this is to implement the missing step and switch from
        global PCI/MSI domains to per device PCI/MSI domains. The resulting
        hierarchy then looks like this:
      
                                    |--- [PCI/MSI] device 1
           [Vector]---[Remapping]---|...
                                    |--- [PCI/MSI] device N
      
        which in turn allows to provide support for multiple domains per
        device:
      
                                    |--- [PCI/MSI] device 1
                                    |--- [PCI/IMS] device 1
           [Vector]---[Remapping]---|...
                                    |--- [PCI/MSI] device N
                                    |--- [PCI/IMS] device N
      
        This work converts the MSI and PCI/MSI core and the x86 interrupt
        domains to the new model, provides new interfaces for post-enable
        allocation/free of MSI-X interrupts and the base framework for
        PCI/IMS. PCI/IMS has been verified with the work in progress IDXD
        driver.
      
        There is work in progress to convert ARM over which will replace the
        platform MSI train-wreck. The cleanup of VFIO, NTB and other creative
        "solutions" are in the works as well.
      
        Drivers:
      
         - Updates for the LoongArch interrupt chip drivers
      
         - Support for MTK CIRQv2
      
         - The usual small fixes and updates all over the place"
      
      * tag 'irq-core-2022-12-10' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (134 commits)
        irqchip/ti-sci-inta: Fix kernel doc
        irqchip/gic-v2m: Mark a few functions __init
        irqchip/gic-v2m: Include arm-gic-common.h
        irqchip/irq-mvebu-icu: Fix works by chance pointer assignment
        iommu/amd: Enable PCI/IMS
        iommu/vt-d: Enable PCI/IMS
        x86/apic/msi: Enable PCI/IMS
        PCI/MSI: Provide pci_ims_alloc/free_irq()
        PCI/MSI: Provide IMS (Interrupt Message Store) support
        genirq/msi: Provide constants for PCI/IMS support
        x86/apic/msi: Enable MSI_FLAG_PCI_MSIX_ALLOC_DYN
        PCI/MSI: Provide post-enable dynamic allocation interfaces for MSI-X
        PCI/MSI: Provide prepare_desc() MSI domain op
        PCI/MSI: Split MSI-X descriptor setup
        genirq/msi: Provide MSI_FLAG_MSIX_ALLOC_DYN
        genirq/msi: Provide msi_domain_alloc_irq_at()
        genirq/msi: Provide msi_domain_ops:: Prepare_desc()
        genirq/msi: Provide msi_desc:: Msi_data
        genirq/msi: Provide struct msi_map
        x86/apic/msi: Remove arch_create_remap_msi_irq_domain()
        ...
      9d33edb2
    • Linus Torvalds's avatar
      Merge tag 'core-debugobjects-2022-12-10' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · f10bc401
      Linus Torvalds authored
      Pull debugobjects update from Thomas Gleixner:
       "A single update for debugobjects:
      
        Add the object pointer to the debug output for better correlation with
        other debug facilities"
      
      * tag 'core-debugobjects-2022-12-10' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        debugobjects: Print object pointer in debug_print_object()
      f10bc401
    • Linus Torvalds's avatar
      Merge tag 'x86-urgent-2022-12-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 9c2b840a
      Linus Torvalds authored
      Pull x86 fixes from Thomas Gleixner:
       "Three small x86 fixes which did not make it into 6.1:
      
         - Remove a superfluous noinline which prevents GCC-7.3 to optimize a
           stub function away
      
         - Allow uprobes on REP NOP and do not treat them like word-sized
           branch instructions
      
         - Make the VDSO symbol export of __vdso_sgx_enter_enclave() depend on
           CONFIG_X86_SGX to prevent build failures with newer LLVM versions
           which rightfully detect that there is no function behind the
           symbol"
      
      * tag 'x86-urgent-2022-12-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/vdso: Conditionally export __vdso_sgx_enter_enclave()
        uprobes/x86: Allow to probe a NOP instruction with 0x66 prefix
        x86/alternative: Remove noinline from __ibt_endbr_seal[_end]() stubs
      9c2b840a
    • Linus Torvalds's avatar
      Merge tag 's390-6.2-1' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux · 47477c84
      Linus Torvalds authored
      Pull s390 updates from Alexander Gordeev:
      
       - Factor out handle_write() function and simplify 3215 console write
         operation
      
       - When 3170 terminal emulator is connected to the 3215 console driver
         the boot time could be very long due to limited buffer space or
         missing operator input. Add con3215_drop command line parameter and
         con3215_drop sysfs attribute file to instruct the kernel drop console
         data when such conditions are met
      
       - Fix white space errors in 3215 console driver
      
       - Move enum paiext_mode definition to a header file and rename it to
         paievt_mode to indicate this is now used for several events. Rename
         PAI_MODE_COUNTER to PAI_MODE_COUNTING to make consistent with
         PAI_MODE_SAMPLING
      
       - Simplify the logic of PMU pai_crypto mapped buffer reference counter
         and make it consistent with PMU pai_ext
      
       - Rename PMU pai_crypto mapped buffer structure member users to
         active_events to make it consistent with PMU pai_ext
      
       - Enable HUGETLB_PAGE_OPTIMIZE_VMEMMAP configuration option. This
         results in saving of 12K per 1M hugetlb page (~1.2%) and 32764K per
         2G hugetlb page (~1.6%)
      
       - Use generic serial.h, bugs.h, shmparam.h and vga.h header files and
         scrap s390-specific versions
      
       - The generic percpu setup code does not expect the s390-like
         implementation and emits a warning. To get rid of that warning and
         provide sane CPU-to-node and CPU-to-CPU distance mappings implementat
         a minimal version of setup_per_cpu_areas()
      
       - Use kstrtobool() instead of strtobool() for re-IPL sysfs device
         attributes
      
       - Avoid unnecessary lookup of a pointer to MSI descriptor when setting
         IRQ affinity for a PCI device
      
       - Get rid of "an incompatible function type cast" warning by changing
         debug_sprintf_format_fn() function prototype so it matches the
         debug_format_proc_t function type
      
       - Remove unused info_blk_hdr__pcpus() and get_page_state() functions
      
       - Get rid of clang "unused unused insn cache ops function" warning by
         moving s390_insn definition to a private header
      
       - Get rid of clang "unused function" warning by making function
         raw3270_state_final() only available if CONFIG_TN3270_CONSOLE is
         enabled
      
       - Use kstrobool() to parse sclp_con_drop parameter to make it identical
         to the con3215_drop parameter and allow passing values like "yes" and
         "true"
      
       - Use sysfs_emit() for all SCLP sysfs show functions, which is the
         current standard way to generate output strings
      
       - Make SCLP con_drop sysfs attribute also writable and allow to change
         its value during runtime. This makes SCLP console drop handling
         consistent with the 3215 device driver
      
       - Virtual and physical addresses are indentical on s390. However, there
         is still a confusion when pointers are directly casted to physical
         addresses or vice versa. Use correct address converters
         virt_to_phys() and phys_to_virt() for s390 channel IO drivers
      
       - Support for power managemant has been removed from s390 since quite
         some time. Remove unused power managemant code from the appldata
         device driver
      
       - Allow memory tools like KASAN see memory accesses from the checksum
         code. Switch to GENERIC_CSUM if KASAN is enabled, just like x86 does
      
       - Add support of ECKD DASDs disks so it could be used as boot and dump
         devices
      
       - Follow checkpatch recommendations and use octal values instead of
         S_IRUGO and S_IWUSR for dump device attributes in sysfs
      
       - Changes to vx-insn.h do not cause a recompile of C files that use
         asm(".include \"asm/vx-insn.h\"\n") magic to access vector
         instruction macros from inline assemblies. Add wrapper include header
         file to avoid this problem
      
       - Use vector instruction macros instead of byte patterns to increase
         register validation routine readability
      
       - The current machine check register validation handling does not take
         into account various scenarios and might lead to killing a wrong user
         process or potentially ignore corrupted FPU registers. Simplify logic
         of the machine check handler and stop the whole machine if the
         previous context was kerenel mode. If the previous context was user
         mode, kill the current task
      
       - Introduce sclp_emergency_printk() function which can be used to emit
         a message in emergency cases. It is supposed to be used in cases
         where regular console device drivers may not work anymore, e.g.
         unrecoverable machine checks
      
         Keep the early Service-Call Control Block so it can also be used
         after initdata has been freed to allow sclp_emergency_printk()
         implementation
      
       - In case a system will be stopped because of an unrecoverable machine
         check error print the machine check interruption code to give a hint
         of what went wrong
      
       - Move storage error checking from the assembly entry code to C in
         order to simplify machine check handling. Enter the handler with DAT
         turned on, which simplifies the entry code even more
      
       - The machine check extended save areas are allocated using a private
         "nmi_save_areas" slab cache which guarantees a required power-of-two
         alignment. Get rid of that cache in favour of kmalloc()
      
      * tag 's390-6.2-1' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: (38 commits)
        s390/nmi: get rid of private slab cache
        s390/nmi: move storage error checking back to C, enter with DAT on
        s390/nmi: print machine check interruption code before stopping system
        s390/sclp: introduce sclp_emergency_printk()
        s390/sclp: keep sclp_early_sccb
        s390/nmi: rework register validation handling
        s390/nmi: use vector instruction macros instead of byte patterns
        s390/vx: add vx-insn.h wrapper include file
        s390/ipl: use octal values instead of S_* macros
        s390/ipl: add eckd dump support
        s390/ipl: add eckd support
        vfio/ccw: identify CCW data addresses as physical
        vfio/ccw: sort out physical vs virtual pointers usage
        s390/checksum: support GENERIC_CSUM, enable it for KASAN
        s390/appldata: remove power management callbacks
        s390/cio: sort out physical vs virtual pointers usage
        s390/sclp: allow to change sclp_console_drop during runtime
        s390/sclp: convert to use sysfs_emit()
        s390/sclp: use kstrobool() to parse sclp_con_drop parameter
        s390/3270: make raw3270_state_final() depend on CONFIG_TN3270_CONSOLE
        ...
      47477c84
    • Linus Torvalds's avatar
      Merge tag 'm68k-for-v6.2-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k · 49d07f01
      Linus Torvalds authored
      Pull m68k updates from Geert Uytterhoeven:
      
       - remove an unused function involving a non-explictly signed char type
      
       - reword a (correct) comment to stop the inflood of (incorrect) patches
         trying to fix it
      
       - defconfig updates
      
      * tag 'm68k-for-v6.2-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k:
        m68k: defconfig: Update defconfigs for v6.1-rc1
        m68k: mac: Reword comment using double "in"
        m68k: mac: Remove unused rbv_set_video_bpp()
      49d07f01
    • Linus Torvalds's avatar
      Merge tag 'mips_6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux · 5977aa66
      Linus Torvalds authored
      Pull MIPS updates from Thomas Bogendoerfer:
      
       - DT cleanups
      
       - fix for early use of kzalloc on mt7621 platform
      
       - cleanups and fixes
      
      * tag 'mips_6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux: (21 commits)
        MIPS: OCTEON: warn only once if deprecated link status is being used
        MIPS: BCM63xx: Add check for NULL for clk in clk_enable
        platform/mips: Adjust Kconfig to keep consistency
        MIPS: OCTEON: cvmx-bootmem: use strscpy() to instead of strncpy()
        MIPS: mscc: jaguar2: Fix pca9545 i2c-mux node names
        mips/pci: use devm_platform_ioremap_resource()
        mips: ralink: mt7621: do not use kzalloc too early
        mips: ralink: mt7621: soc queries and tests as functions
        mips: ralink: mt7621: define MT7621_SYSC_BASE with __iomem
        MIPS: Restore symbol versions for copy_page_cpu and clear_page_cpu
        mips: dts: remove label = "cpu" from DSA dt-binding
        mips: ralink: mt7621: change DSA port labels to generic naming
        mips: ralink: mt7621: fix phy-mode of external phy on GB-PC2
        MIPS: vpe-cmp: fix possible memory leak while module exiting
        MIPS: vpe-mt: fix possible memory leak while module exiting
        dt-bindings: mips: brcm: add Broadcom SoCs bindings
        dt-bindings: mips: add CPU bindings for MIPS architecture
        mips: dts: brcm: bcm7435: add "interrupt-names" for NAND controller
        mips: dts: bcm63268: add TWD block timer
        MIPS: Use "grep -E" instead of "egrep"
        ...
      5977aa66
    • Linus Torvalds's avatar
      Merge tag 'for-linus-6.2-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip · e6b160bc
      Linus Torvalds authored
      Pull xen updates from Juergen Gross:
      
       - fix memory leaks in error paths
      
       - add support for virtio PCI-devices in Xen guests on ARM
      
       - two minor fixes
      
      * tag 'for-linus-6.2-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
        xen/privcmd: Fix a possible warning in privcmd_ioctl_mmap_resource()
        x86/xen: Fix memory leak in xen_init_lock_cpu()
        x86/xen: Fix memory leak in xen_smp_intr_init{_pv}()
        xen: fix xen.h build for CONFIG_XEN_PVH=y
        xen/virtio: Handle PCI devices which Host controller is described in DT
        xen/virtio: Optimize the setup of "xen-grant-dma" devices
      e6b160bc
    • Linus Torvalds's avatar
      Merge tag 'tag-chrome-platform-for-v6.2' of... · 0ec5a38b
      Linus Torvalds authored
      Merge tag 'tag-chrome-platform-for-v6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux
      
      Pull chrome platform updates from Tzung-Bi Shih:
       "New drivers
         - Driver for ChromeOS human presence sensor
      
        Cleanups:
         - Add missing property in dt-binding example.
         - Update the availability of properties in dt-binding.
         - Separate dt-binding for ChromeOS fingerprint sensor.
      
        Improvements:
         - Set PROBE_PREFER_ASYNCHRONOUS for some drivers for shortening boot time.
      
        Fixes:
         - Fix an use-after-free in cros_ec_typec.
      
        And minor fixes and cleanups"
      
      * tag 'tag-chrome-platform-for-v6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux:
        platform/chrome: cros_ec_typec: zero out stale pointers
        platform/chrome: cros_usbpd_notify: Fix error handling in cros_usbpd_notify_init()
        platform/chrome: cros_ec: Convert to i2c's .probe_new()
        platform/chrome: cros_ec_lpc: Force synchronous probe
        platform/chrome: cros_ec_spi: Set PROBE_PREFER_ASYNCHRONOUS
        platform/chrome: cros_ec_lightbar: Set PROBE_PREFER_ASYNCHRONOUS
        platform/chrome: cros_ec_debugfs: Set PROBE_PREFER_ASYNCHRONOUS
        platform/chrome: cros_ec_lpc: Mark PROBE_PREFER_ASYNCHRONOUS
        platform/chrome: cros_ec_lpc: Move mec_init to device probe
        platform/chrome: Use kstrtobool() instead of strtobool()
        platform/chrome: cros_ec_lpc_mec: remove cros_ec_lpc_mec_destroy()
        dt-bindings: cros-ec: Add ChromeOS fingerprint binding
        dt-bindings: cros-ec: Reorganize and enforce property availability
        platform/chrome: cros_hps_i2c: make remove callback return void
        platform/chrome: add a driver for HPS
      0ec5a38b
    • Linus Torvalds's avatar
      Merge tag 'platform-drivers-x86-v6.2-1' of... · 7a76117f
      Linus Torvalds authored
      Merge tag 'platform-drivers-x86-v6.2-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86
      
      Pull x86 platform driver updates from Hans de Goede:
      
       - Intel:
            - PMC: Add support for Meteor Lake
            - Intel On Demand: various updates
      
       - Ideapad-laptop:
            - Add support for various Fn keys on new models
            - Fix touchpad on/off handling in a generic way to avoid having to
              add more and more quirks
      
       - Android x86 tablets:
            - Add support for two more X86 Android tablet models
      
       - New Dell WMI DDV driver
      
       - Miscellaneous cleanups and small bugfixes
      
      * tag 'platform-drivers-x86-v6.2-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: (52 commits)
        platform/mellanox: mlxbf-pmc: Fix event typo
        platform/x86: intel_scu_ipc: fix possible name leak in __intel_scu_ipc_register()
        platform/x86: sony-laptop: Convert to use sysfs_emit_at() API
        platform/x86/dell: alienware-wmi: Use sysfs_emit() instead of scnprintf()
        platform/x86: uv_sysfs: Use sysfs_emit() instead of scnprintf()
        platform/x86: mxm-wmi: fix memleak in mxm_wmi_call_mx[ds|mx]()
        platform/x86: x86-android-tablets: Add Advantech MICA-071 extra button
        platform/x86: x86-android-tablets: Add Lenovo Yoga Tab 3 (YT3-X90F) charger + fuel-gauge data
        platform/x86: x86-android-tablets: Add Medion Lifetab S10346 data
        platform/x86: wireless-hotkey: use ACPI HID as phys
        platform/x86/intel/hid: Add module-params for 5 button array + SW_TABLET_MODE reporting
        platform/x86: ideapad-laptop: Make touchpad_ctrl_via_ec a module option
        platform/x86: ideapad-laptop: Stop writing VPCCMD_W_TOUCHPAD at probe time
        platform/x86: ideapad-laptop: Send KEY_TOUCHPAD_TOGGLE on some models
        platform/x86: ideapad-laptop: Only toggle ps2 aux port on/off on select models
        platform/x86: ideapad-laptop: Do not send KEY_TOUCHPAD* events on probe / resume
        platform/x86: ideapad-laptop: Refactor ideapad_sync_touchpad_state()
        tools/arch/x86: intel_sdsi: Add support for reading meter certificates
        tools/arch/x86: intel_sdsi: Add support for new GUID
        tools/arch/x86: intel_sdsi: Read more On Demand registers
        ...
      7a76117f
    • Linus Torvalds's avatar
      Merge tag 'soc-dt-6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · 01f3cbb2
      Linus Torvalds authored
      Pull ARM SoC DT updates from Arnd Bergmann:
       "The devicetree changes contain exactly 1000 non-merge changesets,
        including a number of new arm64 SoC variants from Qualcomm and Apple,
        as well as the Renesas r9a07g043f/u chip in both arm64 and riscv
        variants.
      
        While we have occasionally merged support for non-arm SoCs in the
        past, this is now the normal path for riscv devicetree files.
      
        The most notable changes, by SoC platform, are:
      
         - The Apple T6000 (M1 Pro), T6001 (M1 Max) and T6002 (M1 Ultra) chips
           now have initial support. This is particularly nice as I am typing
           this on a T6002 Mac Studio with only a small number of driver
           patches.
      
         - Qualcomm MSM8996 Pro (Snapdragon 821), SM6115 (Snapdragon 662),
           SM4250 (Snapdragon 460), SM6375 (Snapdragon 695), SDM670
           (Snapdragon 670), MSM8976 (Snapdragon 652) and MSM8956 (Snapdragon
           650) are all mobile phone chips that are closely related to others
           we already support.
      
           Adding those helps support more phones and we add several models
           from Sony (Xperia 10 IV, 5 IV, X, and X compact), OnePlus (One, 3,
           3T, and Nord N100), Xiaomi (Poco F1, Mi6), Huawei (Watch) and
           Google (Pixel 3a).
      
           There are also new variants of the Herobrine and Trogdor chromebook
           motherboards. SA8540P is an automotive SoC used in the Qdrive-3
           development platform
      
         - Rockchips gains no new SoC variants, but a lot of new boards: three
           mobile gaming systems based on RK3326 Odroid-Go/rg351 family, two
           more Anbernic gaming systems based on RK3566 and a number of other
           RK356x based single-board computers.
      
         - Renesas RZ/G2UL (r9a07g043) was already supported for arm64, but as
           the newly added RZ/Five is based on the same design, this now gets
           reorganized in order to share most of the dts description between
           the two and add the RZ/Five SMARC EVK board support.
      
        Aside from that, there are the usual changes all over the tree:
      
         - New boards on other platforms contain two ASpeed BMC users, two
           Broadcom based Wifi routers, Zyxel NSA310S NAS, the i.MX6 based
           Kobo Aura2 ebook reader, two i.MX8 based development boards, two
           Uniphier Pro5 development boards, the STM32MP1 testbench board from
           DHCOR, the TI K3 based BeagleBone AI-64 board, and the Mediatek
           Helio X10 based Sony Xperia M5 phone.
      
         - The Starfive JH7100 source gets reorganized in order to support the
           VisionFive V1 board.
      
         - Minor updates and cleanups for Intel SoCFPGA, Marvell PXA168, TI,
           ST, NXP, Apple, Broadcom, Juno, Marvell MVEBU, at91, nuvoton,
           Tegra, Mediatek, Renesas, Hisilicon, Allwinner, Samsung, ux500,
           spear, ... The treewide cleanups now have a lot of fixes for cache
           nodes and other binding violoations.
      
         - Somewhat larger sets of reworks for NVIDIA Tegra, Qualcomm and
           Renesas platforms, adding a lot more on-chip device support
      
         - A rework of the way that DTB overlays are built"
      
      * tag 'soc-dt-6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (979 commits)
        arm64: dts: apple: t6002: Fix GPU power domains
        arm64: dts: apple: t600x-pmgr: Fix search & replace typo
        arm64: dts: apple: Add t8103 L1/L2 cache properties and nodes
        arm64: dts: apple: Rename dart-sio* to sio-dart*
        arch: arm64: apple: t600x: Use standard "iommu" node name
        arch: arm64: apple: t8103: Use standard "iommu" node name
        ARM: dts: socfpga: Fix pca9548 i2c-mux node name
        dt-bindings: iio: adc: qcom,spmi-vadc: fix PM8350 define
        dt-bindings: iio: adc: qcom,spmi-vadc: extend example
        arm64: dts: qcom: sc8280xp: fix UFS DMA coherency
        arm64: dts: qcom: sc7280: Add DT for sc7280-herobrine-zombie
        arm64: dts: qcom: sm8250-sony-xperia-edo: fix no-mmc property for SDHCI
        arm64: dts: qcom: sdm845-sony-xperia-tama: fix no-mmc property for SDHCI
        arm64: dts: qcom: sda660-inforce-ifc6560: fix no-mmc property for SDHCI
        arm64: dts: qcom: sa8155p-adp: fix no-mmc property for SDHCI
        arm64: dts: qcom: qrb5165-rb: fix no-mmc property for SDHCI
        arm64: dts: qcom: sm8450: align MMC node names with dtschema
        arm64: dts: qcom: sc7180-trogdor: use generic node names
        arm64: dts: qcom: sm8450-hdk: add sound support
        arm64: dts: qcom: sm8450: add Soundwire and LPASS
        ...
      01f3cbb2
    • Linus Torvalds's avatar
      Merge tag 'soc-drivers-6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · 8e17b16a
      Linus Torvalds authored
      Pull ARM SoC driver updates from Arnd Bergmann:
       "There are few major updates in the SoC specific drivers, mainly the
        usual reworks and support for variants of the existing SoC. While this
        remains Arm centric for the most part, the branch now also contains
        updates to risc-v and loongarch specific code in drivers/soc/.
      
        Notable changes include:
      
         - Support for the newly added Qualcomm Snapdragon variants (MSM8956,
           MSM8976, SM6115, SM4250, SM8150, SA8155 and SM8550) in the soc ID,
           rpmh, rpm, spm and powerdomain drivers.
      
         - Documentation for the somewhat controversial qcom,board-id
           properties that are required for booting a number of machines
      
         - A new SoC identification driver for the loongson-2 (loongarch)
           platform
      
         - memory controller updates for stm32, tegra, and renesas.
      
         - a new DT binding to better describe LPDDR2/3/4/5 chips in the
           memory controller subsystem
      
         - Updates for Tegra specific drivers across multiple subsystems,
           improving support for newer SoCs and better identification
      
         - Minor fixes for Broadcom, Freescale, Apple, Renesas, Sifive, TI,
           Mediatek and Marvell SoC drivers"
      
      * tag 'soc-drivers-6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (137 commits)
        soc: qcom: socinfo: Add SM6115 / SM4250 SoC IDs to the soc_id table
        dt-bindings: arm: qcom,ids: Add SoC IDs for SM6115 / SM4250 and variants
        soc: qcom: socinfo: Add SM8150 and SA8155 SoC IDs to the soc_id table
        dt-bindings: arm: qcom,ids: Add SoC IDs for SM8150 and SA8155
        dt-bindings: soc: qcom: apr: document generic qcom,apr compatible
        soc: qcom: Select REMAP_MMIO for ICC_BWMON driver
        soc: qcom: Select REMAP_MMIO for LLCC driver
        soc: qcom: rpmpd: Add SM4250 support
        dt-bindings: power: rpmpd: Add SM4250 support
        dt-bindings: soc: qcom: aoss: Add compatible for SM8550
        soc: qcom: llcc: Add configuration data for SM8550
        dt-bindings: arm: msm: Add LLCC compatible for SM8550
        soc: qcom: llcc: Add v4.1 HW version support
        soc: qcom: socinfo: Add SM8550 ID
        soc: qcom: rpmh-rsc: Avoid unnecessary checks on irq-done response
        soc: qcom: rpmh-rsc: Add support for RSC v3 register offsets
        soc: qcom: rpmhpd: Add SM8550 power domains
        dt-bindings: power: rpmpd: Add SM8550 to rpmpd binding
        soc: qcom: socinfo: Add MSM8956/76 SoC IDs to the soc_id table
        dt-bindings: arm: qcom,ids: Add SoC IDs for MSM8956 and MSM8976
        ...
      8e17b16a
    • Linus Torvalds's avatar
      Merge tag 'soc-6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · 69700db4
      Linus Torvalds authored
      Pull ARM SoC code updates from Arnd Bergmann:
       "This time there are only fairly minor cleanups across the i.MX,
        ixp4xx, ux500 and renesas platforms.
      
        The only notable update is a change to the keystone2 platform to
        switch switch it over to standard PSCI SMP bringup, which apparently
        was present in the shipped firmware almost from the start"
      
      * tag 'soc-6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc:
        ARM: ixp4xx: Remove unused debug iomap
        MAINTAINERS: Add DHCOR to the DH electronic i.MX6 board support
        ARM: ixp4xx: Remove unused static map
        MAINTAINERS: adjust ARM/INTEL IXP4XX ARM ARCHITECTURE to ixp4xx clean-up
        ARM: imx3: Remove unneeded #include <linux/pinctrl/machine.h>
        ARM: mxs: Remove unneeded #include <linux/pinctrl/consumer.h>
        riscv: Kconfig.socs: Add ARCH_RENESAS kconfig option
        ARM: ux500: Drop unused register file
        ARM: ux500: do not directly dereference __iomem
        arm/mach-ux500: fix repeated words in comments
        arm64: renesas: Drop selecting GPIOLIB and PINCTRL
        ARM: shmobile: Drop selecting GPIOLIB and PINCTRL
        ARM: keystone: Replace platform SMP with PSCI
        soc: renesas: Kconfig: Explicitly select GPIOLIB and PINCTRL config under SOC_RENESAS
      69700db4
    • Linus Torvalds's avatar
      Merge tag 'soc-defconfig-6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · 5910b842
      Linus Torvalds authored
      Pull ARM SoC defconfig updates from Arnd Bergmann:
       "This contains the ususal arm and arm64 updates to defconfig files,
        enabling newly added drivers and adapting the files to Kconfig
        changes, in particular for qualcomm, microchip, and nxp SoC platforms"
      
      * tag 'soc-defconfig-6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (28 commits)
        arm64: defconfig: Enable Qualcomm SM6115 / SM4250 GCC and Pinctrl
        arm64: defconfig: Enable Qualcomm SM6115 / SM4250 GCC and Pinctrl
        ARM: configs: multi_v7: switch to new MICROCHIP_ISC driver
        ARM: configs: sama5/7: switch to new MICROCHIP_ISC driver
        ARM: multi_v7_defconfig: enable Type-C UCSI and STM32G0 as modules
        arm64: defconfig: Enable Renesas R-Car S4-8 Spider Ethernet devices
        arm: configs: spear6xx: Enable PL110 display controller
        arm: configs: spear6xx: Refresh defconfig
        arm64: defconfig: Enable HTE config
        arm64: defconfig: Enable missing configs for mt8183-jacuzzi-juniper
        arm64: defconfig: Add Renesas 9-series PCIe clock generator
        riscv: configs: defconfig: Enable Renesas RZ/Five SoC
        ARM: imx_v6_v7_defconfig: Enable the cyttsp5 touchscreen
        arm64: defconfig: Enable Tegra186 timer support
        arm64: defconfig: build-in Qualcomm SC7180 and SM8450 interconnects
        arm64: defconfig: Enable Qualcomm QCE crypto
        arm64: defconfig: Enable TI_TFP410 DVI bridge
        ARM: configs: at91: sama7: add config for thermal management
        ARM: configs: at91: sama7: add config for microchip otpc
        ARM: configs: at91: sama7: use make savedefconfig
        ...
      5910b842
    • Linus Torvalds's avatar
      Merge tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux · 06cff4a5
      Linus Torvalds authored
      Pull arm64 updates from Will Deacon:
       "The highlights this time are support for dynamically enabling and
        disabling Clang's Shadow Call Stack at boot and a long-awaited
        optimisation to the way in which we handle the SVE register state on
        system call entry to avoid taking unnecessary traps from userspace.
      
        Summary:
      
        ACPI:
         - Enable FPDT support for boot-time profiling
         - Fix CPU PMU probing to work better with PREEMPT_RT
         - Update SMMUv3 MSI DeviceID parsing to latest IORT spec
         - APMT support for probing Arm CoreSight PMU devices
      
        CPU features:
         - Advertise new SVE instructions (v2.1)
         - Advertise range prefetch instruction
         - Advertise CSSC ("Common Short Sequence Compression") scalar
           instructions, adding things like min, max, abs, popcount
         - Enable DIT (Data Independent Timing) when running in the kernel
         - More conversion of system register fields over to the generated
           header
      
        CPU misfeatures:
         - Workaround for Cortex-A715 erratum #2645198
      
        Dynamic SCS:
         - Support for dynamic shadow call stacks to allow switching at
           runtime between Clang's SCS implementation and the CPU's pointer
           authentication feature when it is supported (complete with scary
           DWARF parser!)
      
        Tracing and debug:
         - Remove static ftrace in favour of, err, dynamic ftrace!
         - Seperate 'struct ftrace_regs' from 'struct pt_regs' in core ftrace
           and existing arch code
         - Introduce and implement FTRACE_WITH_ARGS on arm64 to replace the
           old FTRACE_WITH_REGS
         - Extend 'crashkernel=' parameter with default value and fallback to
           placement above 4G physical if initial (low) allocation fails
      
        SVE:
         - Optimisation to avoid disabling SVE unconditionally on syscall
           entry and just zeroing the non-shared state on return instead
      
        Exceptions:
         - Rework of undefined instruction handling to avoid serialisation on
           global lock (this includes emulation of user accesses to the ID
           registers)
      
        Perf and PMU:
         - Support for TLP filters in Hisilicon's PCIe PMU device
         - Support for the DDR PMU present in Amlogic Meson G12 SoCs
         - Support for the terribly-named "CoreSight PMU" architecture from
           Arm (and Nvidia's implementation of said architecture)
      
        Misc:
         - Tighten up our boot protocol for systems with memory above 52 bits
           physical
         - Const-ify static keys to satisty jump label asm constraints
         - Trivial FFA driver cleanups in preparation for v1.1 support
         - Export the kernel_neon_* APIs as GPL symbols
         - Harden our instruction generation routines against instrumentation
         - A bunch of robustness improvements to our arch-specific selftests
         - Minor cleanups and fixes all over (kbuild, kprobes, kfence, PMU, ...)"
      
      * tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: (151 commits)
        arm64: kprobes: Return DBG_HOOK_ERROR if kprobes can not handle a BRK
        arm64: kprobes: Let arch do_page_fault() fix up page fault in user handler
        arm64: Prohibit instrumentation on arch_stack_walk()
        arm64:uprobe fix the uprobe SWBP_INSN in big-endian
        arm64: alternatives: add __init/__initconst to some functions/variables
        arm_pmu: Drop redundant armpmu->map_event() in armpmu_event_init()
        kselftest/arm64: Allow epoll_wait() to return more than one result
        kselftest/arm64: Don't drain output while spawning children
        kselftest/arm64: Hold fp-stress children until they're all spawned
        arm64/sysreg: Remove duplicate definitions from asm/sysreg.h
        arm64/sysreg: Convert ID_DFR1_EL1 to automatic generation
        arm64/sysreg: Convert ID_DFR0_EL1 to automatic generation
        arm64/sysreg: Convert ID_AFR0_EL1 to automatic generation
        arm64/sysreg: Convert ID_MMFR5_EL1 to automatic generation
        arm64/sysreg: Convert MVFR2_EL1 to automatic generation
        arm64/sysreg: Convert MVFR1_EL1 to automatic generation
        arm64/sysreg: Convert MVFR0_EL1 to automatic generation
        arm64/sysreg: Convert ID_PFR2_EL1 to automatic generation
        arm64/sysreg: Convert ID_PFR1_EL1 to automatic generation
        arm64/sysreg: Convert ID_PFR0_EL1 to automatic generation
        ...
      06cff4a5
    • Linus Torvalds's avatar
      Merge tag 'microblaze-v6.2' of git://git.monstr.eu/linux-2.6-microblaze · 164f5900
      Linus Torvalds authored
      Pull microblaze updates from Michal Simek:
       "Clean up PCI support which was pretty much copied and pasted from
        PowerPC long time ago for one custom platform which is not available
        for years.
      
        Also, the Xilinx/AMD PCIe team tested Microblaze with IP cores also
        used on ARM SOCs and clean up Microblaze code"
      
      * tag 'microblaze-v6.2' of git://git.monstr.eu/linux-2.6-microblaze:
        microblaze/PCI: Moving PCI iounmap and dependent code
        microblaze/PCI: Remove support for Xilinx PCI host bridge
        microblaze/PCI: Remove unused pci_iobar_pfn() and et al declarations
        microblaze/PCI: Remove unused sys_pciconfig_iobase() and et al declaration
        microblaze/PCI: Remove unused pci_address_to_pio() conversion of CPU address to I/O port
        microblaze/PCI: Remove unused PCI Indirect ops
        microblaze/PCI: Remove unused PCI BIOS resource allocation
        microblaze/PCI: Remove unused allocation & free of PCI host bridge structure
        microblaze/PCI: Remove unused device tree parsing for a host bridge resources
        microblaze/PCI: Remove unused PCI legacy IO's access on a bus
        microblaze/PCI: Remove unused PCI bus scan if configured as a host
        microblaze/PCI: Remove Null PCI config access unused functions
        microblaze/PCI: Remove unused early_read_config_byte() et al declarations
      164f5900
    • Linus Torvalds's avatar
      Merge tag 'hyperv-next-signed-20221208' of... · 7d621599
      Linus Torvalds authored
      Merge tag 'hyperv-next-signed-20221208' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux
      
      Pull hyperv updates from Wei Liu:
      
       - Drop unregister syscore from hyperv_cleanup to avoid hang (Gaurav
         Kohli)
      
       - Clean up panic path for Hyper-V framebuffer (Guilherme G. Piccoli)
      
       - Allow IRQ remapping to work without x2apic (Nuno Das Neves)
      
       - Fix comments (Olaf Hering)
      
       - Expand hv_vp_assist_page definition (Saurabh Sengar)
      
       - Improvement to page reporting (Shradha Gupta)
      
       - Make sure TSC clocksource works when Linux runs as the root partition
         (Stanislav Kinsburskiy)
      
      * tag 'hyperv-next-signed-20221208' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux:
        x86/hyperv: Remove unregister syscore call from Hyper-V cleanup
        iommu/hyper-v: Allow hyperv irq remapping without x2apic
        clocksource: hyper-v: Add TSC page support for root partition
        clocksource: hyper-v: Use TSC PFN getter to map vvar page
        clocksource: hyper-v: Introduce TSC PFN getter
        clocksource: hyper-v: Introduce a pointer to TSC page
        x86/hyperv: Expand definition of struct hv_vp_assist_page
        PCI: hv: update comment in x86 specific hv_arch_irq_unmask
        hv: fix comment typo in vmbus_channel/low_latency
        drivers: hv, hyperv_fb: Untangle and refactor Hyper-V panic notifiers
        video: hyperv_fb: Avoid taking busy spinlock on panic path
        hv_balloon: Add support for configurable order free page reporting
        mm/page_reporting: Add checks for page_reporting_order param
      7d621599
    • Linus Torvalds's avatar
      Merge tag 'tpmdd-next-v6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd · 43686598
      Linus Torvalds authored
      Pull tpm updates from Jarkko Sakkinen:
       "A random collection of TPM fixes and one bug fix for trusted keys"
      
      * tag 'tpmdd-next-v6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd:
        tpm: st33zp24: remove pointless checks on probe
        tpm/tpm_crb: Fix error message in __crb_relinquish_locality()
        tpm/tpm_ftpm_tee: Fix error handling in ftpm_mod_init()
        tpm: tpm_tis: Add the missed acpi_put_table() to fix memory leak
        tpm: tpm_crb: Add the missed acpi_put_table() to fix memory leak
        tpm: acpi: Call acpi_put_table() to fix memory leak
        tpm: Add flag to use default cancellation policy
        tpm: tis_i2c: Fix sanity check interrupt enable mask
        KEYS: trusted: tee: Make registered shm dependency explicit
        tpm: Avoid function type cast of put_device()
        tpm: st33zp24: switch to using gpiod API
        tpm: st33zp24: drop support for platform data
      43686598
    • Linus Torvalds's avatar
      Merge tag 'slab-for-6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab · 893660b0
      Linus Torvalds authored
      Pull slab updates from Vlastimil Babka:
      
       - SLOB deprecation and SLUB_TINY
      
         The SLOB allocator adds maintenance burden and stands in the way of
         API improvements [1]. Deprecate it by renaming the config option (to
         make users notice) to CONFIG_SLOB_DEPRECATED with updated help text.
         SLUB should be used instead as SLAB will be the next on the removal
         list.
      
         Based on reports from a riscv k210 board with 8MB RAM, add a
         CONFIG_SLUB_TINY option to minimize SLUB's memory usage at the
         expense of scalability. This has resolved the k210 regression [2] so
         in case there are no others (that wouldn't be resolvable by further
         tweaks to SLUB_TINY) plan is to remove SLOB in a few cycles.
      
         Existing defconfigs with CONFIG_SLOB are converted to
         CONFIG_SLUB_TINY.
      
       - kmalloc() slub_debug redzone improvements
      
         A series from Feng Tang that builds on the tracking or requested size
         for kmalloc() allocations (for caches with debugging enabled) added
         in 6.1, to make redzone checks consider the requested size and not
         the rounded up one, in order to catch more subtle buffer overruns.
         Includes new slub_kunit test.
      
       - struct slab fields reordering to accomodate larger rcu_head
      
         RCU folks would like to grow rcu_head with debugging options, which
         breaks current struct slab layout's assumptions, so reorganize it to
         make this possible.
      
       - Miscellaneous improvements/fixes:
           - __alloc_size checking compiler workaround (Kees Cook)
           - Optimize and cleanup SLUB's sysfs init (Rasmus Villemoes)
           - Make SLAB compatible with PROVE_RAW_LOCK_NESTING (Jiri Kosina)
           - Correct SLUB's percpu allocation estimates (Baoquan He)
           - Re-enableS LUB's run-time failslab sysfs control (Alexander Atanasov)
           - Make tools/vm/slabinfo more user friendly when not run as root (Rong Tao)
           - Dead code removal in SLUB (Hyeonggon Yoo)
      
      * tag 'slab-for-6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab: (31 commits)
        mm, slob: rename CONFIG_SLOB to CONFIG_SLOB_DEPRECATED
        mm, slub: don't aggressively inline with CONFIG_SLUB_TINY
        mm, slub: remove percpu slabs with CONFIG_SLUB_TINY
        mm, slub: split out allocations from pre/post hooks
        mm/slub, kunit: Add a test case for kmalloc redzone check
        mm/slub, kunit: add SLAB_SKIP_KFENCE flag for cache creation
        mm, slub: refactor free debug processing
        mm, slab: ignore SLAB_RECLAIM_ACCOUNT with CONFIG_SLUB_TINY
        mm, slub: don't create kmalloc-rcl caches with CONFIG_SLUB_TINY
        mm, slub: lower the default slub_max_order with CONFIG_SLUB_TINY
        mm, slub: retain no free slabs on partial list with CONFIG_SLUB_TINY
        mm, slub: disable SYSFS support with CONFIG_SLUB_TINY
        mm, slub: add CONFIG_SLUB_TINY
        mm, slab: ignore hardened usercopy parameters when disabled
        slab: Remove special-casing of const 0 size allocations
        slab: Clean up SLOB vs kmalloc() definition
        mm/sl[au]b: rearrange struct slab fields to allow larger rcu_head
        mm/migrate: make isolate_movable_page() skip slab pages
        mm/slab: move and adjust kernel-doc for kmem_cache_alloc
        mm/slub, percpu: correct the calculation of early percpu allocation size
        ...
      893660b0
    • Linus Torvalds's avatar
      Merge tag 'printk-for-6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux · 98d0052d
      Linus Torvalds authored
      Pull printk updates from Petr Mladek:
      
       - Add NMI-safe SRCU reader API. It uses atomic_inc() instead of
         this_cpu_inc() on strong load-store architectures.
      
       - Introduce new console_list_lock to synchronize a manipulation of the
         list of registered consoles and their flags.
      
         This is a first step in removing the big-kernel-lock-like behavior of
         console_lock(). This semaphore still serializes console->write()
         calbacks against:
      
            - each other. It primary prevents potential races between early
              and proper console drivers using the same device.
      
            - suspend()/resume() callbacks and init() operations in some
              drivers.
      
            - various other operations in the tty/vt and framebufer
              susbsystems. It is likely that console_lock() serializes even
              operations that are not directly conflicting with the
              console->write() callbacks here. This is the most complicated
              big-kernel-lock aspect of the console_lock() that will be hard
              to untangle.
      
       - Introduce new console_srcu lock that is used to safely iterate and
         access the registered console drivers under SRCU read lock.
      
         This is a prerequisite for introducing atomic console drivers and
         console kthreads. It will reduce the complexity of serialization
         against normal consoles and console_lock(). Also it should remove the
         risk of deadlock during critical situations, like Oops or panic, when
         only atomic consoles are registered.
      
       - Check whether the console is registered instead of enabled on many
         locations. It was a historical leftover.
      
       - Cleanly force a preferred console in xenfb code instead of a dirty
         hack.
      
       - A lot of code and comment clean ups and improvements.
      
      * tag 'printk-for-6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux: (47 commits)
        printk: htmldocs: add missing description
        tty: serial: sh-sci: use setup() callback for early console
        printk: relieve console_lock of list synchronization duties
        tty: serial: kgdboc: use console_list_lock to trap exit
        tty: serial: kgdboc: synchronize tty_find_polling_driver() and register_console()
        tty: serial: kgdboc: use console_list_lock for list traversal
        tty: serial: kgdboc: use srcu console list iterator
        proc: consoles: use console_list_lock for list iteration
        tty: tty_io: use console_list_lock for list synchronization
        printk, xen: fbfront: create/use safe function for forcing preferred
        netconsole: avoid CON_ENABLED misuse to track registration
        usb: early: xhci-dbc: use console_is_registered()
        tty: serial: xilinx_uartps: use console_is_registered()
        tty: serial: samsung_tty: use console_is_registered()
        tty: serial: pic32_uart: use console_is_registered()
        tty: serial: earlycon: use console_is_registered()
        tty: hvc: use console_is_registered()
        efi: earlycon: use console_is_registered()
        tty: nfcon: use console_is_registered()
        serial_core: replace uart_console_enabled() with uart_console_registered()
        ...
      98d0052d
    • Linus Torvalds's avatar
      Merge tag 'locks-v6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux · 73fa58dc
      Linus Torvalds authored
      Pull file locking updates from Jeff Layton:
       "The main change here is to add the new locks_inode_context helper, and
        convert all of the places that dereference inode->i_flctx directly to
        use that instead.
      
        There is a new helper to indicate whether any locks are held on an
        inode. This is mostly for Ceph but may be usable elsewhere too.
      
        Andi Kleen requested that we print the PID when the LOCK_MAND warning
        fires, to help track down applications trying to use it.
      
        Finally, we added some new warnings to some of the file locking
        functions that fire when the ->fl_file and filp arguments differ. This
        helped us find some long-standing bugs in lockd. Patches for those are
        in Chuck Lever's tree and should be in his v6.2 PR. After that patch,
        people using NFSv2/v3 locking may see some warnings fire until those
        go in.
      
        Happy Holidays!"
      
      * tag 'locks-v6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux:
        Add process name and pid to locks warning
        nfsd: use locks_inode_context helper
        nfs: use locks_inode_context helper
        lockd: use locks_inode_context helper
        ksmbd: use locks_inode_context helper
        cifs: use locks_inode_context helper
        ceph: use locks_inode_context helper
        filelock: add a new locks_inode_context accessor function
        filelock: new helper: vfs_inode_has_locks
        filelock: WARN_ON_ONCE when ->fl_file and filp don't match
      73fa58dc
    • Linus Torvalds's avatar
      Merge tag 'execve-v6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux · 7fc03505
      Linus Torvalds authored
      Pull execve updates from Kees Cook:
       "Most are small refactorings and bug fixes, but three things stand out:
        switching timens (which got reverted before) looks solid now,
        FOLL_FORCE has been removed (no failures seen yet across several weeks
        in -next), and some whitespace cleanups (which are long overdue).
      
         - Add timens support (when switching mm). This version has survived
           in -next for the entire cycle (Andrei Vagin)
      
         - Various small bug fixes, refactoring, and readability improvements
           (Bernd Edlinger, Rolf Eike Beer, Bo Liu, Li Zetao Liu Shixin)
      
         - Remove FOLL_FORCE for stack setup (Kees Cook)
      
         - Whitespace cleanups (Rolf Eike Beer, Kees Cook)"
      
      * tag 'execve-v6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
        binfmt_misc: fix shift-out-of-bounds in check_special_flags
        binfmt: Fix error return code in load_elf_fdpic_binary()
        exec: Remove FOLL_FORCE for stack setup
        binfmt_elf: replace IS_ERR() with IS_ERR_VALUE()
        binfmt_elf: simplify error handling in load_elf_phdrs()
        binfmt_elf: fix documented return value for load_elf_phdrs()
        exec: simplify initial stack size expansion
        binfmt: Fix whitespace issues
        exec: Add comments on check_unsafe_exec() fs counting
        ELF uapi: add spaces before '{'
        selftests/timens: add a test for vfork+exit
        fs/exec: switch timens when a task gets a new mm
      7fc03505
    • Linus Torvalds's avatar
      Merge tag 'seccomp-v6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux · 667161ba
      Linus Torvalds authored
      Pull seccomp updates from Kees Cook:
      
       - Add missing kerndoc parameter (Randy Dunlap)
      
       - Improve seccomp selftest to check CAP_SYS_ADMIN (Gautam Menghani)
      
       - Fix allocation leak when cloned thread immediately dies (Kuniyuki
         Iwashima)
      
      * tag 'seccomp-v6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
        seccomp: document the "filter_count" field
        seccomp: Move copy_seccomp() to no failure path.
        selftests/seccomp: Check CAP_SYS_ADMIN capability in the test mode_filter_without_nnp
      667161ba
    • Linus Torvalds's avatar
      Merge tag 'pstore-v6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux · 059c4a34
      Linus Torvalds authored
      Pull pstore updates from Kees Cook:
       "A small collection of bug fixes, refactorings, and general
        improvements:
      
         - Reporting improvements and return path fixes (Guilherme G. Piccoli,
           Wang Yufen, Kees Cook)
      
         - Clean up kmsg_bytes module parameter usage (Guilherme G. Piccoli)
      
         - Add Guilherme to pstore MAINTAINERS entry
      
         - Choose friendlier allocation flags (Qiujun Huang, Stephen Boyd)"
      
      * tag 'pstore-v6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
        pstore: Avoid kcore oops by vmap()ing with VM_IOREMAP
        pstore/ram: Fix error return code in ramoops_probe()
        pstore: Alert on backend write error
        MAINTAINERS: Update pstore maintainers
        pstore/ram: Set freed addresses to NULL
        pstore/ram: Move internal definitions out of kernel-wide include
        pstore/ram: Move pmsg init earlier
        pstore/ram: Consolidate kfree() paths
        efi: pstore: Follow convention for the efi-pstore backend name
        pstore: Inform unregistered backend names as well
        pstore: Expose kmsg_bytes as a module parameter
        pstore: Improve error reporting in case of backend overlap
        pstore/zone: Use GFP_ATOMIC to allocate zone buffer
      059c4a34
    • Linus Torvalds's avatar
      Merge tag 'unsigned-char-6.2-for-linus' of... · 3a28c2c8
      Linus Torvalds authored
      Merge tag 'unsigned-char-6.2-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/zx2c4/linux
      
      Pull unsigned-char conversion from Jason Donenfeld:
       "Enable -funsigned-char and fix code affected by that flag.
      
        During the 6.1 cycle, several patches already made it into the tree,
        which were for code that was already broken on at least one
        architecture, where the naked char had a different sign than the code
        author anticipated, or were part of some bug fix for an existing bug
        that this initiative unearthed.
      
        These 6.1-era fixes are:
      
          64806090 ("MIPS: pic32: treat port as signed integer")
          5c26159c ("ipvs: use explicitly signed chars")
          e6cb8769 ("wifi: airo: do not assign -1 to unsigned char")
          937ec9f7 ("staging: rtl8192e: remove bogus ssid character sign test")
          67704738 ("misc: sgi-gru: use explicitly signed char")
          50895a55 ("ALSA: rme9652: use explicitly signed char")
          ee03c0f2 ("ALSA: au88x0: use explicitly signed char")
          835bed1b ("fbdev: sisfb: use explicitly signed char")
          50f19697 ("parisc: Use signed char for hardware path in pdc.h")
          66063033 ("wifi: rt2x00: use explicitly signed or unsigned types")
      
        Regarding patches in this pull:
      
         - There is one patch in this pull that should have made it to you
           during 6.1 ("media: stv0288: use explicitly signed char"), but the
           maintainer was MIA during the cycle, so it's in here instead.
      
         - Two patches fix single architecture code affected by unsigned char
           ("perf/x86: Make struct p4_event_bind::cntr signed array" and
           "sparc: sbus: treat CPU index as integer"), while one patch fixes
           an unused typedef, in case it's ever used in the future ("media:
           atomisp: make hive_int8 explictly signed").
      
         - Finally, there's the change to actually enable -funsigned-char
           ("kbuild: treat char as always unsigned") and then the removal of
           some no longer useful !__CHAR_UNSIGNED__ selftest code ("lib:
           assume char is unsigned").
      
        The various fixes were found with a combination of diffing objdump
        output, a large variety of Coccinelle scripts, and plain old grep. In
        the end, things didn't seem as bad as I feared they would. But of
        course, it's also possible I missed things.
      
        However, this has been in linux-next for basically an entire cycle
        now, so I'm not overly worried. I've also been daily driving this on
        my laptop for all of 6.1. Still, this series, and the ones sent for
        6.1 don't total in quantity to what I thought it'd be, so I will be on
        the lookout for breakage.
      
        We could receive a few reports that are quickly fixable. Hopefully we
        won't receive a barrage of reports that would result in a revert. And
        just maybe we won't receive any reports at all and nobody will even
        notice. Knock on wood"
      
      * tag 'unsigned-char-6.2-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/zx2c4/linux:
        lib: assume char is unsigned
        kbuild: treat char as always unsigned
        media: atomisp: make hive_int8 explictly signed
        media: stv0288: use explicitly signed char
        sparc: sbus: treat CPU index as integer
        perf/x86: Make struct p4_event_bind::cntr signed array
      3a28c2c8
    • Linus Torvalds's avatar
      Merge tag 'nolibc.2022.12.02a' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu · 74dc488b
      Linus Torvalds authored
      Pull nolibc updates from Paul McKenney:
      
       - Further improvements to nolibc testing
      
      * tag 'nolibc.2022.12.02a' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu:
        selftests/nolibc: Always rebuild the sysroot when running a test
        selftests/nolibc: Add 7 tests for memcmp()
      74dc488b
    • Linus Torvalds's avatar
      Merge tag 'kcsan.2022.12.02a' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu · f433cf21
      Linus Torvalds authored
      Pull KCSAN updates from Paul McKenney:
      
       - Add instrumentation for memcpy(), memset(), and memmove() for Clang
         v16+'s new function names that are used when the -fsanitize=thread
         argument is given
      
       - Fix objtool warnings from KCSAN's volatile instrumentation, and typos
         in a pair of Kconfig options' help clauses
      
      * tag 'kcsan.2022.12.02a' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu:
        kcsan: Fix trivial typo in Kconfig help comments
        objtool, kcsan: Add volatile read/write instrumentation to whitelist
        kcsan: Instrument memcpy/memset/memmove with newer Clang
      f433cf21
    • Linus Torvalds's avatar
      Merge tag 'lkmm.2022.12.02a' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu · 5517a2ea
      Linus Torvalds authored
      Pull kernel memory model documentation updates from Paul McKenney:
      
       - Update the LKMM documentation, both in English and in Korean
      
      * tag 'lkmm.2022.12.02a' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu:
        docs/memory-barriers.txt/kokr: Fix confusing name of 'data dependency barrier'
        docs/memory-barriers.txt/kokr: Add memory barrier dma_mb()
        docs/memory-barriers.txt/kokr: introduce io_stop_wc() and add implementation for ARM64
        docs/memory-barriers.txt: Add a missed closing parenthesis
        tools/memory-model: Weaken ctrl dependency definition in explanation.txt
      5517a2ea
    • Linus Torvalds's avatar
      Merge tag 'rcu.2022.12.02a' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu · 1fab45ab
      Linus Torvalds authored
      Pull RCU updates from Paul McKenney:
      
       - Documentation updates. This is the second in a series from an ongoing
         review of the RCU documentation.
      
       - Miscellaneous fixes.
      
       - Introduce a default-off Kconfig option that depends on RCU_NOCB_CPU
         that, on CPUs mentioned in the nohz_full or rcu_nocbs boot-argument
         CPU lists, causes call_rcu() to introduce delays.
      
         These delays result in significant power savings on nearly idle
         Android and ChromeOS systems. These savings range from a few percent
         to more than ten percent.
      
         This series also includes several commits that change call_rcu() to a
         new call_rcu_hurry() function that avoids these delays in a few
         cases, for example, where timely wakeups are required. Several of
         these are outside of RCU and thus have acks and reviews from the
         relevant maintainers.
      
       - Create an srcu_read_lock_nmisafe() and an srcu_read_unlock_nmisafe()
         for architectures that support NMIs, but which do not provide
         NMI-safe this_cpu_inc(). These NMI-safe SRCU functions are required
         by the upcoming lockless printk() work by John Ogness et al.
      
       - Changes providing minor but important increases in torture test
         coverage for the new RCU polled-grace-period APIs.
      
       - Changes to torturescript that avoid redundant kernel builds, thus
         providing about a 30% speedup for the torture.sh acceptance test.
      
      * tag 'rcu.2022.12.02a' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu: (49 commits)
        net: devinet: Reduce refcount before grace period
        net: Use call_rcu_hurry() for dst_release()
        workqueue: Make queue_rcu_work() use call_rcu_hurry()
        percpu-refcount: Use call_rcu_hurry() for atomic switch
        scsi/scsi_error: Use call_rcu_hurry() instead of call_rcu()
        rcu/rcutorture: Use call_rcu_hurry() where needed
        rcu/rcuscale: Use call_rcu_hurry() for async reader test
        rcu/sync: Use call_rcu_hurry() instead of call_rcu
        rcuscale: Add laziness and kfree tests
        rcu: Shrinker for lazy rcu
        rcu: Refactor code a bit in rcu_nocb_do_flush_bypass()
        rcu: Make call_rcu() lazy to save power
        rcu: Implement lockdep_rcu_enabled for !CONFIG_DEBUG_LOCK_ALLOC
        srcu: Debug NMI safety even on archs that don't require it
        srcu: Explain the reason behind the read side critical section on GP start
        srcu: Warn when NMI-unsafe API is used in NMI
        arch/s390: Add ARCH_HAS_NMI_SAFE_THIS_CPU_OPS Kconfig option
        arch/loongarch: Add ARCH_HAS_NMI_SAFE_THIS_CPU_OPS Kconfig option
        rcu: Fix __this_cpu_read() lockdep warning in rcu_force_quiescent_state()
        rcu-tasks: Make grace-period-age message human-readable
        ...
      1fab45ab
    • James Hurley's avatar
      platform/mellanox: mlxbf-pmc: Fix event typo · b0b698b8
      James Hurley authored
      Had a duplicate event typo, so just fixed the 1 character typo.
      
      Fixes: 1a218d31 ("platform/mellanox: mlxbf-pmc: Add Mellanox BlueField PMC driver")
      Signed-off-by: default avatarJames Hurley <jahurley@nvidia.com>
      Reviewed-by: default avatarDavid Thompson <davthompson@nvidia.com>
      Reviewed-by: default avatarShravan Kumar Ramani <shravankr@nvidia.com>
      Link: https://lore.kernel.org/r/aadacdbbd3186c55e74ea9456fe011b77938eb6c.1670535330.git.jahurley@nvidia.comSigned-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      b0b698b8
  2. 11 Dec, 2022 3 commits
  3. 10 Dec, 2022 8 commits
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm · 296a7b7e
      Linus Torvalds authored
      Pull ARM fix from Russell King:
       "One further ARM fix for 6.1 from Wang Kefeng, fixing up the handling
        for kfence faults"
      
      * tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm:
        ARM: 9278/1: kfence: only handle translation faults
      296a7b7e
    • Tejun Heo's avatar
      memcg: fix possible use-after-free in memcg_write_event_control() · 4a7ba45b
      Tejun Heo authored
      memcg_write_event_control() accesses the dentry->d_name of the specified
      control fd to route the write call.  As a cgroup interface file can't be
      renamed, it's safe to access d_name as long as the specified file is a
      regular cgroup file.  Also, as these cgroup interface files can't be
      removed before the directory, it's safe to access the parent too.
      
      Prior to 347c4a87 ("memcg: remove cgroup_event->cft"), there was a
      call to __file_cft() which verified that the specified file is a regular
      cgroupfs file before further accesses.  The cftype pointer returned from
      __file_cft() was no longer necessary and the commit inadvertently dropped
      the file type check with it allowing any file to slip through.  With the
      invarients broken, the d_name and parent accesses can now race against
      renames and removals of arbitrary files and cause use-after-free's.
      
      Fix the bug by resurrecting the file type check in __file_cft().  Now that
      cgroupfs is implemented through kernfs, checking the file operations needs
      to go through a layer of indirection.  Instead, let's check the superblock
      and dentry type.
      
      Link: https://lkml.kernel.org/r/Y5FRm/cfcKPGzWwl@slm.duckdns.org
      Fixes: 347c4a87 ("memcg: remove cgroup_event->cft")
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Reported-by: default avatarJann Horn <jannh@google.com>
      Acked-by: default avatarRoman Gushchin <roman.gushchin@linux.dev>
      Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Muchun Song <songmuchun@bytedance.com>
      Cc: Shakeel Butt <shakeelb@google.com>
      Cc: <stable@vger.kernel.org>	[3.14+]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      4a7ba45b
    • Muchun Song's avatar
      MAINTAINERS: update Muchun Song's email · a501788a
      Muchun Song authored
      I'm moving to the @linux.dev account.  Map my old addresses and update it
      to my new address.
      
      Link: https://lkml.kernel.org/r/20221208115548.85244-1-songmuchun@bytedance.comSigned-off-by: default avatarMuchun Song <songmuchun@bytedance.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      a501788a
    • John Starks's avatar
      mm/gup: fix gup_pud_range() for dax · fcd0ccd8
      John Starks authored
      For dax pud, pud_huge() returns true on x86. So the function works as long
      as hugetlb is configured. However, dax doesn't depend on hugetlb.
      Commit 414fd080 ("mm/gup: fix gup_pmd_range() for dax") fixed
      devmap-backed huge PMDs, but missed devmap-backed huge PUDs. Fix this as
      well.
      
      This fixes the below kernel panic:
      
      general protection fault, probably for non-canonical address 0x69e7c000cc478: 0000 [#1] SMP
      	< snip >
      Call Trace:
      <TASK>
      get_user_pages_fast+0x1f/0x40
      iov_iter_get_pages+0xc6/0x3b0
      ? mempool_alloc+0x5d/0x170
      bio_iov_iter_get_pages+0x82/0x4e0
      ? bvec_alloc+0x91/0xc0
      ? bio_alloc_bioset+0x19a/0x2a0
      blkdev_direct_IO+0x282/0x480
      ? __io_complete_rw_common+0xc0/0xc0
      ? filemap_range_has_page+0x82/0xc0
      generic_file_direct_write+0x9d/0x1a0
      ? inode_update_time+0x24/0x30
      __generic_file_write_iter+0xbd/0x1e0
      blkdev_write_iter+0xb4/0x150
      ? io_import_iovec+0x8d/0x340
      io_write+0xf9/0x300
      io_issue_sqe+0x3c3/0x1d30
      ? sysvec_reschedule_ipi+0x6c/0x80
      __io_queue_sqe+0x33/0x240
      ? fget+0x76/0xa0
      io_submit_sqes+0xe6a/0x18d0
      ? __fget_light+0xd1/0x100
      __x64_sys_io_uring_enter+0x199/0x880
      ? __context_tracking_enter+0x1f/0x70
      ? irqentry_exit_to_user_mode+0x24/0x30
      ? irqentry_exit+0x1d/0x30
      ? __context_tracking_exit+0xe/0x70
      do_syscall_64+0x3b/0x90
      entry_SYSCALL_64_after_hwframe+0x61/0xcb
      RIP: 0033:0x7fc97c11a7be
      	< snip >
      </TASK>
      ---[ end trace 48b2e0e67debcaeb ]---
      RIP: 0010:internal_get_user_pages_fast+0x340/0x990
      	< snip >
      Kernel panic - not syncing: Fatal exception
      Kernel Offset: disabled
      
      Link: https://lkml.kernel.org/r/1670392853-28252-1-git-send-email-ssengar@linux.microsoft.com
      Fixes: 414fd080 ("mm/gup: fix gup_pmd_range() for dax")
      Signed-off-by: default avatarJohn Starks <jostarks@microsoft.com>
      Signed-off-by: default avatarSaurabh Sengar <ssengar@linux.microsoft.com>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Yu Zhao <yuzhao@google.com>
      Cc: Jason Gunthorpe <jgg@nvidia.com>
      Cc: John Hubbard <jhubbard@nvidia.com>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Alistair Popple <apopple@nvidia.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      fcd0ccd8
    • Liam Howlett's avatar
      mmap: fix do_brk_flags() modifying obviously incorrect VMAs · 6c28ca64
      Liam Howlett authored
      Add more sanity checks to the VMA that do_brk_flags() will expand.  Ensure
      the VMA matches basic merge requirements within the function before
      calling can_vma_merge_after().
      
      Drop the duplicate checks from vm_brk_flags() since they will be enforced
      later.
      
      The old code would expand file VMAs on brk(), which is functionally
      wrong and also dangerous in terms of locking because the brk() path
      isn't designed for file VMAs and therefore doesn't lock the file
      mapping.  Checking can_vma_merge_after() ensures that new anonymous
      VMAs can't be merged into file VMAs.
      
      See https://lore.kernel.org/linux-mm/CAG48ez1tJZTOjS_FjRZhvtDA-STFmdw8PEizPDwMGFd_ui0Nrw@mail.gmail.com/
      
      Link: https://lkml.kernel.org/r/20221205192304.1957418-1-Liam.Howlett@oracle.com
      Fixes: 2e7ce7d3 ("mm/mmap: change do_brk_flags() to expand existing VMA and add do_brk_munmap()")
      Signed-off-by: default avatarLiam R. Howlett <Liam.Howlett@oracle.com>
      Suggested-by: default avatarJann Horn <jannh@google.com>
      Cc: Jason A. Donenfeld <Jason@zx2c4.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: SeongJae Park <sj@kernel.org>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Yu Zhao <yuzhao@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      6c28ca64
    • David Hildenbrand's avatar
      mm/swap: fix SWP_PFN_BITS with CONFIG_PHYS_ADDR_T_64BIT on 32bit · 630dc25e
      David Hildenbrand authored
      We use "unsigned long" to store a PFN in the kernel and phys_addr_t to
      store a physical address.
      
      On a 64bit system, both are 64bit wide.  However, on a 32bit system, the
      latter might be 64bit wide.  This is, for example, the case on x86 with
      PAE: phys_addr_t and PTEs are 64bit wide, while "unsigned long" only spans
      32bit.
      
      The current definition of SWP_PFN_BITS without MAX_PHYSMEM_BITS misses
      that case, and assumes that the maximum PFN is limited by an 32bit
      phys_addr_t.  This implies, that SWP_PFN_BITS will currently only be able
      to cover 4 GiB - 1 on any 32bit system with 4k page size, which is wrong.
      
      Let's rely on the number of bits in phys_addr_t instead, but make sure to
      not exceed the maximum swap offset, to not make the BUILD_BUG_ON() in
      is_pfn_swap_entry() unhappy.  Note that swp_entry_t is effectively an
      unsigned long and the maximum swap offset shares that value with the swap
      type.
      
      For example, on an 8 GiB x86 PAE system with a kernel config based on
      Debian 11.5 (-> CONFIG_FLATMEM=y, CONFIG_X86_PAE=y), we will currently
      fail removing migration entries (remove_migration_ptes()), because
      mm/page_vma_mapped.c:check_pte() will fail to identify a PFN match as
      swp_offset_pfn() wrongly masks off PFN bits.  For example,
      split_huge_page_to_list()->...->remap_page() will leave migration entries
      in place and continue to unlock the page.
      
      Later, when we stumble over these migration entries (e.g., via
      /proc/self/pagemap), pfn_swap_entry_to_page() will BUG_ON() because these
      migration entries shouldn't exist anymore and the page was unlocked.
      
      [   33.067591] kernel BUG at include/linux/swapops.h:497!
      [   33.067597] invalid opcode: 0000 [#1] PREEMPT SMP NOPTI
      [   33.067602] CPU: 3 PID: 742 Comm: cow Tainted: G            E      6.1.0-rc8+ #16
      [   33.067605] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.0-1.fc36 04/01/2014
      [   33.067606] EIP: pagemap_pmd_range+0x644/0x650
      [   33.067612] Code: 00 00 00 00 66 90 89 ce b9 00 f0 ff ff e9 ff fb ff ff 89 d8 31 db e8 48 c6 52 00 e9 23 fb ff ff e8 61 83 56 00 e9 b6 fe ff ff <0f> 0b bf 00 f0 ff ff e9 38 fa ff ff 3e 8d 74 26 00 55 89 e5 57 31
      [   33.067615] EAX: ee394000 EBX: 00000002 ECX: ee394000 EDX: 00000000
      [   33.067617] ESI: c1b0ded4 EDI: 00024a00 EBP: c1b0ddb4 ESP: c1b0dd68
      [   33.067619] DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068 EFLAGS: 00010246
      [   33.067624] CR0: 80050033 CR2: b7a00000 CR3: 01bbbd20 CR4: 00350ef0
      [   33.067625] Call Trace:
      [   33.067628]  ? madvise_free_pte_range+0x720/0x720
      [   33.067632]  ? smaps_pte_range+0x4b0/0x4b0
      [   33.067634]  walk_pgd_range+0x325/0x720
      [   33.067637]  ? mt_find+0x1d6/0x3a0
      [   33.067641]  ? mt_find+0x1d6/0x3a0
      [   33.067643]  __walk_page_range+0x164/0x170
      [   33.067646]  walk_page_range+0xf9/0x170
      [   33.067648]  ? __kmem_cache_alloc_node+0x2a8/0x340
      [   33.067653]  pagemap_read+0x124/0x280
      [   33.067658]  ? default_llseek+0x101/0x160
      [   33.067662]  ? smaps_account+0x1d0/0x1d0
      [   33.067664]  vfs_read+0x90/0x290
      [   33.067667]  ? do_madvise.part.0+0x24b/0x390
      [   33.067669]  ? debug_smp_processor_id+0x12/0x20
      [   33.067673]  ksys_pread64+0x58/0x90
      [   33.067675]  __ia32_sys_ia32_pread64+0x1b/0x20
      [   33.067680]  __do_fast_syscall_32+0x4c/0xc0
      [   33.067683]  do_fast_syscall_32+0x29/0x60
      [   33.067686]  do_SYSENTER_32+0x15/0x20
      [   33.067689]  entry_SYSENTER_32+0x98/0xf1
      
      Decrease the indentation level of SWP_PFN_BITS and SWP_PFN_MASK to keep it
      readable and consistent.
      
      [david@redhat.com: rely on sizeof(phys_addr_t) and min_t() instead]
        Link: https://lkml.kernel.org/r/20221206105737.69478-1-david@redhat.com
      [david@redhat.com: use "int" for comparison, as we're only comparing numbers < 64]
        Link: https://lkml.kernel.org/r/1f157500-2676-7cef-a84e-9224ed64e540@redhat.com
      Link: https://lkml.kernel.org/r/20221205150857.167583-1-david@redhat.com
      Fixes: 0d206b5d ("mm/swap: add swp_offset_pfn() to fetch PFN from swap entry")
      Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      Acked-by: default avatarPeter Xu <peterx@redhat.com>
      Reviewed-by: default avatarYang Shi <shy828301@gmail.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      630dc25e
    • Hugh Dickins's avatar
      tmpfs: fix data loss from failed fallocate · 44bcabd7
      Hugh Dickins authored
      Fix tmpfs data loss when the fallocate system call is interrupted by a
      signal, or fails for some other reason.  The partial folio handling in
      shmem_undo_range() forgot to consider this unfalloc case, and was liable
      to erase or truncate out data which had already been committed earlier.
      
      It turns out that none of the partial folio handling there is appropriate
      for the unfalloc case, which just wants to proceed to removal of whole
      folios: which find_get_entries() provides, even when partially covered.
      
      Original patch by Rui Wang.
      
      Link: https://lore.kernel.org/linux-mm/33b85d82.7764.1842e9ab207.Coremail.chenguoqic@163.com/
      Link: https://lkml.kernel.org/r/a5dac112-cf4b-7af-a33-f386e347fd38@google.com
      Fixes: b9a8a419 ("truncate,shmem: Handle truncates that split large folios")
      Signed-off-by: default avatarHugh Dickins <hughd@google.com>
      Reported-by: default avatarGuoqi Chen <chenguoqic@163.com>
        Link: https://lore.kernel.org/all/20221101032248.819360-1-kernel@hev.cc/
      Cc: Rui Wang <kernel@hev.cc>
      Cc: Huacai Chen <chenhuacai@loongson.cn>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Vishal Moola (Oracle) <vishal.moola@gmail.com>
      Cc: <stable@vger.kernel.org>	[5.17+]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      44bcabd7
    • Michal Hocko's avatar
      kselftests: cgroup: update kmem test precision tolerance · de16d6e4
      Michal Hocko authored
      1813e51e ("memcg: increase MEMCG_CHARGE_BATCH to 64") has changed
      the batch size while this test case has been left behind. This has led
      to a test failure reported by test bot:
      not ok 2 selftests: cgroup: test_kmem # exit=1
      
      Update the tolerance for the pcp charges to reflect the
      MEMCG_CHARGE_BATCH change to fix this.
      
      [akpm@linux-foundation.org: update comments, per Roman]
      Link: https://lkml.kernel.org/r/Y4m8Unt6FhWKC6IH@dhcp22.suse.cz
      Fixes: 1813e51e ("memcg: increase MEMCG_CHARGE_BATCH to 64")
      Signed-off-by: default avatarMichal Hocko <mhocko@suse.com>
      Reported-by: default avatarkernel test robot <yujie.liu@intel.com>
        Link: https://lore.kernel.org/oe-lkp/202212010958.c1053bd3-yujie.liu@intel.comAcked-by: default avatarShakeel Butt <shakeelb@google.com>
      Acked-by: default avatarRoman Gushchin <roman.gushchin@linux.dev>
      Tested-by: default avatarYujie Liu <yujie.liu@intel.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Feng Tang <feng.tang@intel.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: "Michal Koutný" <mkoutny@suse.com>
      Cc: Muchun Song <songmuchun@bytedance.com>
      Cc: Soheil Hassas Yeganeh <soheil@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      de16d6e4