GKI (arm64) relevant 69 out of 278 changes, affecting 88 files +585/-2900b603e7759tracing: Add __print_dynamic_array() helper [3 files, +15/-1]0312735402tracing: Verify event formats that have "%*p.." [2 files, +13/-2]1c9798bf81mm/vmscan: don't try to reclaim hwpoison folio [1 file, +7/-0]db3b3964afPM: EM: use kfree_rcu() to simplify the code [1 file, +1/-9]9d5752b853PM: EM: Address RCU-related sparse warnings [2 files, +26/-25]3e12e8c273block: remove the write_hint field from struct request [4 files, +13/-12]ed7535b141block: remove the ioprio field from struct request [4 files, +11/-15]2afa5ea7c4block: make sure ->nr_integrity_segments is cloned in blk_rq_prep_clone [1 file, +1/-0]46d3575209PCI/MSI: Handle the NOMASK flag correctly for all PCI/MSI backends [1 file, +6/-12]35ba7b2d4dPCI/MSI: Add an option to write MSIX ENTRY_DATA before any reads [2 files, +5/-0]16c8aa5de1dma/contiguous: avoid warning about unused size_bytes [1 file, +1/-2]7ccfadfb25cpufreq: scmi: Fix null-ptr-deref in scmi_cpufreq_get_rate() [1 file, +8/-2]28fbd7b13bcpufreq: scpi: Fix null-ptr-deref in scpi_cpufreq_get_rate() [1 file, +10/-3]7d002f5914scsi: ufs: mcq: Add NULL check in ufshcd_mcq_abort() [1 file, +5/-7]5d92e582d1cgroup/cpuset-v1: Add missing support for cpuset_v2_mode [1 file, +29/-0]29daa63f2cscsi: core: Clear flags for scsi_cmnd that did not complete [1 file, +5/-1]eeab661803scsi: ufs: core: Add NULL check in ufshcd_mcq_compl_pending_transfer() [1 file, +2/-0]41143e7105net: phy: leds: fix memory leak [1 file, +13/-10]0ceef62a32tipc: fix NULL pointer dereference in tipc_mon_reinit_self() [1 file, +2/-1]a61afd5482fix a couple of races in MNT_TREE_BENEATH handling by do_move_mount() [1 file, +36/-33]7f24ea6a46block: never reduce ra_pages in blk_apply_bdi_limits [1 file, +7/-1]3decda1a3csplice: remove duplicate noinline from pipe_clear_nowait [1 file, +1/-1]30c0d6e778virtio_console: fix missing byte order handling for cols and rows [1 file, +4/-3]c2a6b4d78cnet: selftests: initialize TCP header and skb payload with zero [1 file, +13/-5]3939d6f29dirqchip/gic-v2m: Prevent use after free of gicv2m_get_fwnode() [1 file, +1/-1]7a8a6b627fio_uring: fix 'sync' handling of io_fallback_tw() [1 file, +7/-6]1f439fe4d8scsi: Improve CDL control [1 file, +24/-12]3670dee376char: misc: register chrdev region with all possible minors [1 file, +1/-1]ea0d806b94USB: serial: ftdi_sio: add support for Abacus Electrics Optical Probe [2 files, +7/-0]1777714865xhci: Limit time spent with xHC interrupts disabled during bus resume [3 files, +20/-16]bce3055b08usb: xhci: Fix invalid pointer dereference in Etron workaround [1 file, +1/-1]52a7c9d930usb: dwc3: gadget: check that event count does not exceed event buffer length [1 file, +6/-0]9924ee1bcdusb: quirks: add DELAY_INIT quirk for Silicon Motion Flash Drive [1 file, +3/-0]d85b7af3bdusb: quirks: Add delay init quirk for SanDisk 3.2Gen1 Flash Drive [1 file, +3/-0]3e52ae347eUSB: VLI disk crashes if LPM is used [1 file, +3/-0]0486de3c1bcrypto: null - Use spin lock instead of mutex [1 file, +26/-13]7758e308aebpf: Fix kmemleak warning for percpu hashmap [1 file, +3/-3]c5c833f637bpf: Fix deadlock between rcu_tasks_trace and event_mutex. [1 file, +4/-3]4139072087clk: check for disabled clock-provider in of_clk_get_hw_from_clkspec() [1 file, +4/-0]4131411f42bpf: Only fails the busy counter check in bpf_cgrp_storage_get if it creates storage [1 file, +6/-5]b817d2bfd6bpf: Reject attaching fexit/fmod_ret to __noreturn functions [1 file, +32/-0]2ecae00138usb: dwc3: gadget: Refactor loop to avoid NULL endpoints [1 file, +18/-4]cbfa55bda1usb: xhci: Complete 'error mid TD' transfers when handling Missed Service [1 file, +5/-1]16a7a8e6c4usb: xhci: Fix isochronous Ring Underrun/Overrun event handling [1 file, +14/-6]635be13606xhci: Handle spurious events on Etron host isoc enpoints [2 files, +27/-13]9ff59cb815usb: xhci: Avoid Stop Endpoint retry loop if the endpoint seems Running [1 file, +7/-4]0485bdf88fobjtool, panic: Disable SMAP in __stack_chk_fail() [2 files, +10/-1]c548f956889p/net: fix improper handling of bogus negative read/write replies [1 file, +16/-14]18296b59519p/trans_fd: mark concurrent read and writes to p9_conn->err [1 file, +10/-7]3568fd9e44io_uring: always do atomic put from iowq [2 files, +8/-1]90dc6c1e3bperf/core: Fix WARN_ON(!ctx) in __free_event() for partial init [1 file, +3/-3]24ede35eb2nvme: requeue namespace scan on missed AENs [1 file, +4/-0]b9c89c97d7nvme: re-read ANA log page after ns scan completes [1 file, +5/-0]ee5521176anvme: multipath: fix return value of nvme_available_path [1 file, +1/-1]5e58b93a12gpiolib: of: Move Atmel HSMCI quirk up out of the regulator comment [1 file, +3/-3]9f8eeac3a6timekeeping: Add a lockdep override in tick_freeze() [1 file, +22/-0]b14d986413iommu: Clear iommu-dma ops on cleanup [1 file, +3/-0]b626bc3c1dext4: make block validity check resistent to sb bh corruption [2 files, +6/-6]2ef6eea2efnetfs: Only create /proc/fs/netfs with CONFIG_PROC_FS [1 file, +4/-0]d53b2d49a8iomap: skip unnecessary ifs_block_is_uptodate check [1 file, +1/-1]bfc66c4c28Revert "drivers: core: synchronize really_probe() and dev_uevent()" [1 file, +0/-3]de7c24febdusb: typec: class: Fix NULL pointer access [2 files, +14/-2]45314999f9ext4: goto right label 'out_mmap_sem' in ext4_setattr() [1 file, +1/-1]40966fc993usb: typec: class: Invalidate USB device pointers on partner unregistration [1 file, +6/-2]4833d0a92biommu: Handle race with default domain setup [1 file, +5/-0]1042d22942nvme: fixup scan failure for non-ANA multipath controllers [1 file, +1/-1]1b7647efadusb: xhci: Fix Short Packet handling rework ignoring errors [1 file, +1/-1]ab5281d21eusb: typec: class: Unlocked on error in typec_register_partner() [1 file, +1/-0]6b9ebcbd31mq-deadline: don't call req_get_ioprio from the I/O completion handler [1 file, +4/-9] Changes in 6.12.26 module: sign with sha512 instead of sha1 by default tracing: Add __print_dynamic_array() helper tracing: Verify event formats that have "%*p.." mm/vmscan: don't try to reclaim hwpoison folio soc: qcom: ice: introduce devm_of_qcom_ice_get mmc: sdhci-msm: fix dev reference leaked through of_qcom_ice_get PM: EM: use kfree_rcu() to simplify the code PM: EM: Address RCU-related sparse warnings media: i2c: imx214: Use subdev active state media: i2c: imx214: Simplify with dev_err_probe() media: i2c: imx214: Convert to CCI register access helpers media: i2c: imx214: Replace register addresses with macros media: i2c: imx214: Check number of lanes from device tree media: i2c: imx214: Fix link frequency validation media: ov08x40: Move ov08x40_identify_module() function up media: ov08x40: Add missing ov08x40_identify_module() call on stream-start block: remove the write_hint field from struct request block: remove the ioprio field from struct request block: make sure ->nr_integrity_segments is cloned in blk_rq_prep_clone net: dsa: mv88e6xxx: fix VTU methods for 6320 family iio: adc: ad7768-1: Move setting of val a bit later to avoid unnecessary return value check iio: adc: ad7768-1: Fix conversion result sign arm64: dts: ti: Refactor J784s4 SoC files to a common file arm64: dts: ti: k3-j784s4-j742s2-main-common: Fix serdes_ln_ctrl reg-masks of: resolver: Simplify of_resolve_phandles() using __free() of: resolver: Fix device node refcount leakage in of_resolve_phandles() scsi: ufs: qcom: fix dev reference leaked through of_qcom_ice_get PCI/MSI: Convert pci_msi_ignore_mask to per MSI domain flag PCI/MSI: Handle the NOMASK flag correctly for all PCI/MSI backends PCI/MSI: Add an option to write MSIX ENTRY_DATA before any reads accel/ivpu: Add auto selection logic for job scheduler accel/ivpu: Fix the NPU's DPU frequency calculation ksmbd: use __GFP_RETRY_MAYFAIL ksmbd: add netdev-up/down event debug print ksmbd: browse interfaces list on FSCTL_QUERY_INTERFACE_INFO IOCTL ksmbd: fix use-after-free in __smb2_lease_break_noti() scsi: ufs: exynos: Remove empty drv_init method scsi: ufs: exynos: Remove superfluous function parameter scsi: ufs: exynos: Add gs101_ufs_drv_init() hook and enable WriteBooster scsi: ufs: exynos: Move UFS shareability value to drvdata scsi: ufs: exynos: Disable iocc if dma-coherent property isn't set net/niu: Niu requires MSIX ENTRY_DATA fields touch before entry reads drm/xe/bmg: Add one additional PCI ID drm/amd/display: Fix unnecessary cast warnings from checkpatch drm/amd/display/dml2: use vzalloc rather than kzalloc lib/Kconfig.ubsan: Remove 'default UBSAN' from UBSAN_INTEGER_WRAP ceph: Fix incorrect flush end position calculation cpufreq: sun50i: prevent out-of-bounds access dma/contiguous: avoid warning about unused size_bytes cpufreq: apple-soc: Fix null-ptr-deref in apple_soc_cpufreq_get_rate() cpufreq: scmi: Fix null-ptr-deref in scmi_cpufreq_get_rate() cpufreq: scpi: Fix null-ptr-deref in scpi_cpufreq_get_rate() scsi: ufs: mcq: Add NULL check in ufshcd_mcq_abort() cpufreq: cppc: Fix invalid return value in .get() callback cpufreq: Do not enable by default during compile testing cpufreq: fix compile-test defaults btrfs: avoid page_lockend underflow in btrfs_punch_hole_lock_range() btrfs: zoned: return EIO on RAID1 block group write pointer mismatch cgroup/cpuset-v1: Add missing support for cpuset_v2_mode vhost-scsi: Add better resource allocation failure handling vhost-scsi: Fix vhost_scsi_send_bad_target() vhost-scsi: Fix vhost_scsi_send_status() net/mlx5: Fix null-ptr-deref in mlx5_create_{inner_,}ttc_table() net/mlx5: Move ttc allocation after switch case to prevent leaks scsi: core: Clear flags for scsi_cmnd that did not complete scsi: ufs: core: Add NULL check in ufshcd_mcq_compl_pending_transfer() net: lwtunnel: disable BHs when required net: phy: leds: fix memory leak tipc: fix NULL pointer dereference in tipc_mon_reinit_self() net: ethernet: mtk_eth_soc: net: revise NETSYSv3 hardware configuration fix a couple of races in MNT_TREE_BENEATH handling by do_move_mount() net_sched: hfsc: Fix a UAF vulnerability in class handling net_sched: hfsc: Fix a potential UAF in hfsc_dequeue() too net: dsa: mt7530: sync driver-specific behavior of MT7531 variants pds_core: Prevent possible adminq overflow/stuck condition pds_core: handle unsupported PDS_CORE_CMD_FW_CONTROL result pds_core: Remove unnecessary check in pds_client_adminq_cmd() pds_core: make wait_context part of q_info block: never reduce ra_pages in blk_apply_bdi_limits iommu/amd: Return an error if vCPU affinity is set for non-vCPU IRTE riscv: Replace function-like macro by static inline function riscv: uprobes: Add missing fence.i after building the XOL buffer splice: remove duplicate noinline from pipe_clear_nowait bpf: Add namespace to BPF internal symbols perf/x86: Fix non-sampling (counting) events on certain x86 platforms LoongArch: Select ARCH_USE_MEMTEST LoongArch: Make regs_irqs_disabled() more clear LoongArch: Make do_xyz() exception handlers more robust KVM: SVM: Disable AVIC on SNP-enabled system without HvInUseWrAllowed feature netfilter: fib: avoid lookup if socket is available virtio_console: fix missing byte order handling for cols and rows sched_ext: Use kvzalloc for large exit_dump allocation crypto: atmel-sha204a - Set hwrng quality to lowest possible xen-netfront: handle NULL returned by xdp_convert_buff_to_frame() net: selftests: initialize TCP header and skb payload with zero net: phy: microchip: force IRQ polling mode for lan88xx scsi: mpi3mr: Fix pending I/O counter rust: firmware: Use `ffi::c_char` type in `FwFunc` drm: panel: jd9365da: fix reset signal polarity in unprepare drm/amd/display: Fix gpu reset in multidisplay config drm/amd/display: Force full update in gpu reset x86/insn: Fix CTEST instruction decoding irqchip/gic-v2m: Prevent use after free of gicv2m_get_fwnode() LoongArch: Handle fp, lsx, lasx and lbt assembly symbols LoongArch: Return NULL from huge_pte_offset() for invalid PMD LoongArch: Remove a bogus reference to ZONE_DMA LoongArch: KVM: Fully clear some CSRs when VM reboot LoongArch: KVM: Fix PMU pass-through issue if VM exits to host finally io_uring: fix 'sync' handling of io_fallback_tw() KVM: SVM: Allocate IR data using atomic allocation cxl/core/regs.c: Skip Memory Space Enable check for RCD and RCH Ports mcb: fix a double free bug in chameleon_parse_gdd() ata: libata-scsi: Improve CDL control ata: libata-scsi: Fix ata_mselect_control_ata_feature() return type ata: libata-scsi: Fix ata_msense_control_ata_feature() USB: storage: quirk for ADATA Portable HDD CH94 scsi: Improve CDL control mei: me: add panther lake H DID mei: vsc: Fix fortify-panic caused by invalid counted_by() use KVM: x86: Explicitly treat routing entry type changes as changes KVM: x86: Reset IRTE to host control if *new* route isn't postable KVM: x86: Take irqfds.lock when adding/deleting IRQ bypass producer char: misc: register chrdev region with all possible minors misc: microchip: pci1xxxx: Fix Kernel panic during IRQ handler registration misc: microchip: pci1xxxx: Fix incorrect IRQ status handling during ack firmware: stratix10-svc: Add of_platform_default_populate() tty: Require CAP_SYS_ADMIN for all usages of TIOCL_SELMOUSEREPORT serial: msm: Configure correct working mode before starting earlycon serial: sifive: lock port in startup()/shutdown() callbacks USB: serial: ftdi_sio: add support for Abacus Electrics Optical Probe USB: serial: option: add Sierra Wireless EM9291 USB: serial: simple: add OWON HDS200 series oscilloscope support xhci: Limit time spent with xHC interrupts disabled during bus resume usb: xhci: Fix invalid pointer dereference in Etron workaround usb: cdns3: Fix deadlock when using NCM gadget usb: chipidea: ci_hdrc_imx: fix usbmisc handling usb: chipidea: ci_hdrc_imx: fix call balance of regulator routines usb: chipidea: ci_hdrc_imx: implement usb_phy_init() error handling USB: OHCI: Add quirk for LS7A OHCI controller (rev 0x02) usb: dwc3: gadget: check that event count does not exceed event buffer length usb: dwc3: xilinx: Prevent spike in reset signal usb: quirks: add DELAY_INIT quirk for Silicon Motion Flash Drive usb: quirks: Add delay init quirk for SanDisk 3.2Gen1 Flash Drive USB: VLI disk crashes if LPM is used USB: wdm: handle IO errors in wdm_wwan_port_start USB: wdm: close race between wdm_open and wdm_wwan_port_stop USB: wdm: wdm_wwan_port_tx_complete mutex in atomic context USB: wdm: add annotation selftests/bpf: Fix stdout race condition in traffic monitor pinctrl: renesas: rza2: Fix potential NULL pointer dereference pinctrl: mcp23s08: Get rid of spurious level interrupts MIPS: cm: Detect CM quirks from device tree crypto: ccp - Add support for PCI device 0x1134 crypto: lib/Kconfig - Fix lib built-in failure when arch is modular crypto: null - Use spin lock instead of mutex bpf: Fix kmemleak warning for percpu hashmap bpf: Fix deadlock between rcu_tasks_trace and event_mutex. clk: check for disabled clock-provider in of_clk_get_hw_from_clkspec() parisc: PDT: Fix missing prototype warning s390/sclp: Add check for get_zeroed_page() s390/tty: Fix a potential memory leak bug bpf: bpftool: Setting error code in do_loader() bpf: Only fails the busy counter check in bpf_cgrp_storage_get if it creates storage bpf: Reject attaching fexit/fmod_ret to __noreturn functions mailbox: pcc: Fix the possible race in updation of chan_in_use flag mailbox: pcc: Always clear the platform ack interrupt first usb: host: max3421-hcd: Add missing spi_device_id table fs/ntfs3: Keep write operations atomic fs/ntfs3: Fix WARNING in ntfs_extend_initialized_size usb: dwc3: gadget: Refactor loop to avoid NULL endpoints usb: dwc3: gadget: Avoid using reserved endpoints on Intel Merrifield sound/virtio: Fix cancel_sync warnings on uninitialized work_structs usb: xhci: Complete 'error mid TD' transfers when handling Missed Service usb: xhci: Fix isochronous Ring Underrun/Overrun event handling xhci: Handle spurious events on Etron host isoc enpoints i3c: master: svc: Add support for Nuvoton npcm845 i3c dmaengine: dmatest: Fix dmatest waiting less when interrupted usb: xhci: Avoid Stop Endpoint retry loop if the endpoint seems Running phy: rockchip: usbdp: Avoid call hpd_event_trigger in dp_phy_init usb: gadget: aspeed: Add NULL pointer check in ast_vhub_init_dev() usb: host: xhci-plat: mvebu: use ->quirks instead of ->init_quirk() func thunderbolt: Scan retimers after device router has been enumerated um: work around sched_yield not yielding in time-travel mode objtool: Silence more KCOV warnings objtool, panic: Disable SMAP in __stack_chk_fail() objtool, ASoC: codecs: wcd934x: Remove potential undefined behavior in wcd934x_slim_irq_handler() objtool, regulator: rk808: Remove potential undefined behavior in rk806_set_mode_dcdc() objtool, lkdtm: Obfuscate the do_nothing() pointer qibfs: fix _another_ leak ntb: reduce stack usage in idt_scan_mws ntb_hw_amd: Add NTB PCI ID for new gen CPU 9p/net: fix improper handling of bogus negative read/write replies 9p/trans_fd: mark concurrent read and writes to p9_conn->err rtc: pcf85063: do a SW reset if POR failed io_uring: always do atomic put from iowq kbuild: add dependency from vmlinux to sorttable sched/isolation: Make CONFIG_CPU_ISOLATION depend on CONFIG_SMP KVM: s390: Don't use %pK through tracepoints KVM: s390: Don't use %pK through debug printing cgroup/cpuset: Don't allow creation of local partition over a remote one selftests: ublk: fix test_stripe_04 perf/core: Fix WARN_ON(!ctx) in __free_event() for partial init xen: Change xen-acpi-processor dom0 dependency nvme: requeue namespace scan on missed AENs ACPI: EC: Set ec_no_wakeup for Lenovo Go S ACPI PPTT: Fix coding mistakes in a couple of sizeof() calls drm/amdgpu: Increase KIQ invalidate_tlbs timeout drm/xe/xe3lpg: Apply Wa_14022293748, Wa_22019794406 nvme: re-read ANA log page after ns scan completes nvme: multipath: fix return value of nvme_available_path objtool: Stop UNRET validation on UD2 gpiolib: of: Move Atmel HSMCI quirk up out of the regulator comment x86/xen: disable CPU idle and frequency drivers for PVH dom0 selftests/mincore: Allow read-ahead pages to reach the end of the file x86/bugs: Use SBPB in write_ibpb() if applicable x86/bugs: Don't fill RSB on VMEXIT with eIBRS+retpoline x86/bugs: Don't fill RSB on context switch with eIBRS nvmet-fc: take tgtport reference only once nvmet-fc: put ref when assoc->del_work is already scheduled cifs: Fix encoding of SMB1 Session Setup Kerberos Request in non-UNICODE mode timekeeping: Add a lockdep override in tick_freeze() cifs: Fix querying of WSL CHR and BLK reparse points over SMB1 iommu: Clear iommu-dma ops on cleanup ext4: make block validity check resistent to sb bh corruption scsi: hisi_sas: Fix I/O errors caused by hardware port ID changes scsi: ufs: exynos: Ensure pre_link() executes before exynos_ufs_phy_init() scsi: ufs: exynos: Enable PRDT pre-fetching with UFSHCD_CAP_CRYPTO scsi: ufs: exynos: Move phy calls to .exit() callback scsi: ufs: exynos: gs101: Put UFS device in reset on .suspend() scsi: pm80xx: Set phy_attached to zero when device is gone ASoC: fsl_asrc_dma: get codec or cpu dai from backend x86/i8253: Call clockevent_i8253_disable() with interrupts disabled netfs: Only create /proc/fs/netfs with CONFIG_PROC_FS iomap: skip unnecessary ifs_block_is_uptodate check riscv: Provide all alternative macros all the time ksmbd: fix WARNING "do not call blocking ops when !TASK_RUNNING" spi: tegra210-quad: use WARN_ON_ONCE instead of WARN_ON for timeouts spi: tegra210-quad: add rate limiting and simplify timeout error message ubsan: Fix panic from test_ubsan_out_of_bounds x86/cpu: Add CPU model number for Bartlett Lake CPUs with Raptor Cove cores md/raid1: Add check for missing source disk in process_checks() drm/amdgpu: use a dummy owner for sysfs triggered cleaner shaders v4 drm/amdgpu: Use the right function for hdp flush spi: spi-imx: Add check for spi_imx_setupxfer() Revert "drivers: core: synchronize really_probe() and dev_uevent()" driver core: introduce device_set_driver() helper driver core: fix potential NULL pointer dereference in dev_uevent() xfs: do not check NEEDSREPAIR if ro,norecovery mount. xfs: Do not allow norecovery mount with quotacheck xfs: rename xfs_iomap_swapfile_activate to xfs_vm_swap_activate xfs: flush inodegc before swapon selftests/bpf: fix bpf_map_redirect call for cpu map test selftests/bpf: make xdp_cpumap_attach keep redirect prog attached selftests/bpf: check program redirect in xdp_cpumap_attach selftests/bpf: Adjust data size to have ETH_HLEN usb: typec: class: Fix NULL pointer access vmxnet3: Fix malformed packet sizing in vmxnet3_process_xdp comedi: jr3_pci: Fix synchronous deletion of timer ext4: goto right label 'out_mmap_sem' in ext4_setattr() usb: typec: class: Invalidate USB device pointers on partner unregistration Revert "net: dsa: mv88e6xxx: fix internal PHYs for 6320 family" net: dsa: mv88e6xxx: fix atu_move_port_mask for 6341 family net: dsa: mv88e6xxx: enable PVT for 6321 switch net: dsa: mv88e6xxx: enable .port_set_policy() for 6320 family net: dsa: mv88e6xxx: enable STU methods for 6320 family iommu: Handle race with default domain setup crypto: lib/Kconfig - Hide arch options from user media: i2c: imx214: Fix uninitialized variable in imx214_set_ctrl() MIPS: cm: Fix warning if MIPS_CM is disabled nvme: fixup scan failure for non-ANA multipath controllers usb: xhci: Fix Short Packet handling rework ignoring errors objtool: Ignore end-of-section jumps for KCOV/GCOV objtool: Silence more KCOV warnings, part 2 usb: typec: class: Unlocked on error in typec_register_partner() crypto: Kconfig - Select LIB generic option arm64: dts: ti: k3-j784s4-j742s2-main-common: Correct the GICD size mq-deadline: don't call req_get_ioprio from the I/O completion handler Linux 6.12.26 Change-Id: Iff5be8c388b8b915652fafb787156a4653f060aa Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
603 lines
16 KiB
C
603 lines
16 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* This file contains the base functions to manage periodic tick
|
|
* related events.
|
|
*
|
|
* Copyright(C) 2005-2006, Thomas Gleixner <tglx@linutronix.de>
|
|
* Copyright(C) 2005-2007, Red Hat, Inc., Ingo Molnar
|
|
* Copyright(C) 2006-2007, Timesys Corp., Thomas Gleixner
|
|
*/
|
|
#include <linux/compiler.h>
|
|
#include <linux/cpu.h>
|
|
#include <linux/err.h>
|
|
#include <linux/hrtimer.h>
|
|
#include <linux/interrupt.h>
|
|
#include <linux/nmi.h>
|
|
#include <linux/percpu.h>
|
|
#include <linux/profile.h>
|
|
#include <linux/sched.h>
|
|
#include <linux/module.h>
|
|
#include <trace/events/power.h>
|
|
#include <trace/hooks/sched.h>
|
|
|
|
#include <asm/irq_regs.h>
|
|
|
|
#include "tick-internal.h"
|
|
|
|
/*
|
|
* Tick devices
|
|
*/
|
|
DEFINE_PER_CPU(struct tick_device, tick_cpu_device);
|
|
/*
|
|
* Tick next event: keeps track of the tick time. It's updated by the
|
|
* CPU which handles the tick and protected by jiffies_lock. There is
|
|
* no requirement to write hold the jiffies seqcount for it.
|
|
*/
|
|
ktime_t tick_next_period;
|
|
|
|
/*
|
|
* tick_do_timer_cpu is a timer core internal variable which holds the CPU NR
|
|
* which is responsible for calling do_timer(), i.e. the timekeeping stuff. This
|
|
* variable has two functions:
|
|
*
|
|
* 1) Prevent a thundering herd issue of a gazillion of CPUs trying to grab the
|
|
* timekeeping lock all at once. Only the CPU which is assigned to do the
|
|
* update is handling it.
|
|
*
|
|
* 2) Hand off the duty in the NOHZ idle case by setting the value to
|
|
* TICK_DO_TIMER_NONE, i.e. a non existing CPU. So the next cpu which looks
|
|
* at it will take over and keep the time keeping alive. The handover
|
|
* procedure also covers cpu hotplug.
|
|
*/
|
|
int tick_do_timer_cpu __read_mostly = TICK_DO_TIMER_BOOT;
|
|
#ifdef CONFIG_NO_HZ_FULL
|
|
/*
|
|
* tick_do_timer_boot_cpu indicates the boot CPU temporarily owns
|
|
* tick_do_timer_cpu and it should be taken over by an eligible secondary
|
|
* when one comes online.
|
|
*/
|
|
static int tick_do_timer_boot_cpu __read_mostly = -1;
|
|
#endif
|
|
|
|
/*
|
|
* Debugging: see timer_list.c
|
|
*/
|
|
struct tick_device *tick_get_device(int cpu)
|
|
{
|
|
return &per_cpu(tick_cpu_device, cpu);
|
|
}
|
|
|
|
/**
|
|
* tick_is_oneshot_available - check for a oneshot capable event device
|
|
*/
|
|
int tick_is_oneshot_available(void)
|
|
{
|
|
struct clock_event_device *dev = __this_cpu_read(tick_cpu_device.evtdev);
|
|
|
|
if (!dev || !(dev->features & CLOCK_EVT_FEAT_ONESHOT))
|
|
return 0;
|
|
if (!(dev->features & CLOCK_EVT_FEAT_C3STOP))
|
|
return 1;
|
|
return tick_broadcast_oneshot_available();
|
|
}
|
|
|
|
/*
|
|
* Periodic tick
|
|
*/
|
|
static void tick_periodic(int cpu)
|
|
{
|
|
if (READ_ONCE(tick_do_timer_cpu) == cpu) {
|
|
raw_spin_lock(&jiffies_lock);
|
|
write_seqcount_begin(&jiffies_seq);
|
|
|
|
/* Keep track of the next tick event */
|
|
tick_next_period = ktime_add_ns(tick_next_period, TICK_NSEC);
|
|
|
|
do_timer(1);
|
|
write_seqcount_end(&jiffies_seq);
|
|
raw_spin_unlock(&jiffies_lock);
|
|
update_wall_time();
|
|
trace_android_vh_jiffies_update(NULL);
|
|
}
|
|
|
|
update_process_times(user_mode(get_irq_regs()));
|
|
profile_tick(CPU_PROFILING);
|
|
}
|
|
|
|
/*
|
|
* Event handler for periodic ticks
|
|
*/
|
|
void tick_handle_periodic(struct clock_event_device *dev)
|
|
{
|
|
int cpu = smp_processor_id();
|
|
ktime_t next = dev->next_event;
|
|
|
|
tick_periodic(cpu);
|
|
|
|
/*
|
|
* The cpu might have transitioned to HIGHRES or NOHZ mode via
|
|
* update_process_times() -> run_local_timers() ->
|
|
* hrtimer_run_queues().
|
|
*/
|
|
if (IS_ENABLED(CONFIG_TICK_ONESHOT) && dev->event_handler != tick_handle_periodic)
|
|
return;
|
|
|
|
if (!clockevent_state_oneshot(dev))
|
|
return;
|
|
for (;;) {
|
|
/*
|
|
* Setup the next period for devices, which do not have
|
|
* periodic mode:
|
|
*/
|
|
next = ktime_add_ns(next, TICK_NSEC);
|
|
|
|
if (!clockevents_program_event(dev, next, false))
|
|
return;
|
|
/*
|
|
* Have to be careful here. If we're in oneshot mode,
|
|
* before we call tick_periodic() in a loop, we need
|
|
* to be sure we're using a real hardware clocksource.
|
|
* Otherwise we could get trapped in an infinite
|
|
* loop, as the tick_periodic() increments jiffies,
|
|
* which then will increment time, possibly causing
|
|
* the loop to trigger again and again.
|
|
*/
|
|
if (timekeeping_valid_for_hres())
|
|
tick_periodic(cpu);
|
|
}
|
|
}
|
|
|
|
/*
|
|
* Setup the device for a periodic tick
|
|
*/
|
|
void tick_setup_periodic(struct clock_event_device *dev, int broadcast)
|
|
{
|
|
tick_set_periodic_handler(dev, broadcast);
|
|
|
|
/* Broadcast setup ? */
|
|
if (!tick_device_is_functional(dev))
|
|
return;
|
|
|
|
if ((dev->features & CLOCK_EVT_FEAT_PERIODIC) &&
|
|
!tick_broadcast_oneshot_active()) {
|
|
clockevents_switch_state(dev, CLOCK_EVT_STATE_PERIODIC);
|
|
} else {
|
|
unsigned int seq;
|
|
ktime_t next;
|
|
|
|
do {
|
|
seq = read_seqcount_begin(&jiffies_seq);
|
|
next = tick_next_period;
|
|
} while (read_seqcount_retry(&jiffies_seq, seq));
|
|
|
|
clockevents_switch_state(dev, CLOCK_EVT_STATE_ONESHOT);
|
|
|
|
for (;;) {
|
|
if (!clockevents_program_event(dev, next, false))
|
|
return;
|
|
next = ktime_add_ns(next, TICK_NSEC);
|
|
}
|
|
}
|
|
}
|
|
|
|
/*
|
|
* Setup the tick device
|
|
*/
|
|
static void tick_setup_device(struct tick_device *td,
|
|
struct clock_event_device *newdev, int cpu,
|
|
const struct cpumask *cpumask)
|
|
{
|
|
void (*handler)(struct clock_event_device *) = NULL;
|
|
ktime_t next_event = 0;
|
|
|
|
/*
|
|
* First device setup ?
|
|
*/
|
|
if (!td->evtdev) {
|
|
/*
|
|
* If no cpu took the do_timer update, assign it to
|
|
* this cpu:
|
|
*/
|
|
if (READ_ONCE(tick_do_timer_cpu) == TICK_DO_TIMER_BOOT) {
|
|
WRITE_ONCE(tick_do_timer_cpu, cpu);
|
|
tick_next_period = ktime_get();
|
|
#ifdef CONFIG_NO_HZ_FULL
|
|
/*
|
|
* The boot CPU may be nohz_full, in which case the
|
|
* first housekeeping secondary will take do_timer()
|
|
* from it.
|
|
*/
|
|
if (tick_nohz_full_cpu(cpu))
|
|
tick_do_timer_boot_cpu = cpu;
|
|
|
|
} else if (tick_do_timer_boot_cpu != -1 && !tick_nohz_full_cpu(cpu)) {
|
|
tick_do_timer_boot_cpu = -1;
|
|
/*
|
|
* The boot CPU will stay in periodic (NOHZ disabled)
|
|
* mode until clocksource_done_booting() called after
|
|
* smp_init() selects a high resolution clocksource and
|
|
* timekeeping_notify() kicks the NOHZ stuff alive.
|
|
*
|
|
* So this WRITE_ONCE can only race with the READ_ONCE
|
|
* check in tick_periodic() but this race is harmless.
|
|
*/
|
|
WRITE_ONCE(tick_do_timer_cpu, cpu);
|
|
#endif
|
|
}
|
|
|
|
/*
|
|
* Startup in periodic mode first.
|
|
*/
|
|
td->mode = TICKDEV_MODE_PERIODIC;
|
|
} else {
|
|
handler = td->evtdev->event_handler;
|
|
next_event = td->evtdev->next_event;
|
|
td->evtdev->event_handler = clockevents_handle_noop;
|
|
}
|
|
|
|
td->evtdev = newdev;
|
|
|
|
/*
|
|
* When the device is not per cpu, pin the interrupt to the
|
|
* current cpu:
|
|
*/
|
|
if (!cpumask_equal(newdev->cpumask, cpumask))
|
|
irq_set_affinity(newdev->irq, cpumask);
|
|
|
|
/*
|
|
* When global broadcasting is active, check if the current
|
|
* device is registered as a placeholder for broadcast mode.
|
|
* This allows us to handle this x86 misfeature in a generic
|
|
* way. This function also returns !=0 when we keep the
|
|
* current active broadcast state for this CPU.
|
|
*/
|
|
if (tick_device_uses_broadcast(newdev, cpu))
|
|
return;
|
|
|
|
if (td->mode == TICKDEV_MODE_PERIODIC)
|
|
tick_setup_periodic(newdev, 0);
|
|
else
|
|
tick_setup_oneshot(newdev, handler, next_event);
|
|
}
|
|
|
|
void tick_install_replacement(struct clock_event_device *newdev)
|
|
{
|
|
struct tick_device *td = this_cpu_ptr(&tick_cpu_device);
|
|
int cpu = smp_processor_id();
|
|
|
|
clockevents_exchange_device(td->evtdev, newdev);
|
|
tick_setup_device(td, newdev, cpu, cpumask_of(cpu));
|
|
if (newdev->features & CLOCK_EVT_FEAT_ONESHOT)
|
|
tick_oneshot_notify();
|
|
}
|
|
|
|
static bool tick_check_percpu(struct clock_event_device *curdev,
|
|
struct clock_event_device *newdev, int cpu)
|
|
{
|
|
if (!cpumask_test_cpu(cpu, newdev->cpumask))
|
|
return false;
|
|
if (cpumask_equal(newdev->cpumask, cpumask_of(cpu)))
|
|
return true;
|
|
/* Check if irq affinity can be set */
|
|
if (newdev->irq >= 0 && !irq_can_set_affinity(newdev->irq))
|
|
return false;
|
|
/* Prefer an existing cpu local device */
|
|
if (curdev && cpumask_equal(curdev->cpumask, cpumask_of(cpu)))
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
static bool tick_check_preferred(struct clock_event_device *curdev,
|
|
struct clock_event_device *newdev)
|
|
{
|
|
/* Prefer oneshot capable device */
|
|
if (!(newdev->features & CLOCK_EVT_FEAT_ONESHOT)) {
|
|
if (curdev && (curdev->features & CLOCK_EVT_FEAT_ONESHOT))
|
|
return false;
|
|
if (tick_oneshot_mode_active())
|
|
return false;
|
|
}
|
|
|
|
/*
|
|
* Use the higher rated one, but prefer a CPU local device with a lower
|
|
* rating than a non-CPU local device
|
|
*/
|
|
return !curdev ||
|
|
newdev->rating > curdev->rating ||
|
|
!cpumask_equal(curdev->cpumask, newdev->cpumask);
|
|
}
|
|
|
|
/*
|
|
* Check whether the new device is a better fit than curdev. curdev
|
|
* can be NULL !
|
|
*/
|
|
bool tick_check_replacement(struct clock_event_device *curdev,
|
|
struct clock_event_device *newdev)
|
|
{
|
|
if (!tick_check_percpu(curdev, newdev, smp_processor_id()))
|
|
return false;
|
|
|
|
return tick_check_preferred(curdev, newdev);
|
|
}
|
|
|
|
/*
|
|
* Check, if the new registered device should be used. Called with
|
|
* clockevents_lock held and interrupts disabled.
|
|
*/
|
|
void tick_check_new_device(struct clock_event_device *newdev)
|
|
{
|
|
struct clock_event_device *curdev;
|
|
struct tick_device *td;
|
|
int cpu;
|
|
|
|
cpu = smp_processor_id();
|
|
td = &per_cpu(tick_cpu_device, cpu);
|
|
curdev = td->evtdev;
|
|
|
|
if (!tick_check_replacement(curdev, newdev))
|
|
goto out_bc;
|
|
|
|
if (!try_module_get(newdev->owner))
|
|
return;
|
|
|
|
/*
|
|
* Replace the eventually existing device by the new
|
|
* device. If the current device is the broadcast device, do
|
|
* not give it back to the clockevents layer !
|
|
*/
|
|
if (tick_is_broadcast_device(curdev)) {
|
|
clockevents_shutdown(curdev);
|
|
curdev = NULL;
|
|
}
|
|
clockevents_exchange_device(curdev, newdev);
|
|
tick_setup_device(td, newdev, cpu, cpumask_of(cpu));
|
|
if (newdev->features & CLOCK_EVT_FEAT_ONESHOT)
|
|
tick_oneshot_notify();
|
|
return;
|
|
|
|
out_bc:
|
|
/*
|
|
* Can the new device be used as a broadcast device ?
|
|
*/
|
|
tick_install_broadcast_device(newdev, cpu);
|
|
}
|
|
|
|
/**
|
|
* tick_broadcast_oneshot_control - Enter/exit broadcast oneshot mode
|
|
* @state: The target state (enter/exit)
|
|
*
|
|
* The system enters/leaves a state, where affected devices might stop
|
|
* Returns 0 on success, -EBUSY if the cpu is used to broadcast wakeups.
|
|
*
|
|
* Called with interrupts disabled, so clockevents_lock is not
|
|
* required here because the local clock event device cannot go away
|
|
* under us.
|
|
*/
|
|
int tick_broadcast_oneshot_control(enum tick_broadcast_state state)
|
|
{
|
|
struct tick_device *td = this_cpu_ptr(&tick_cpu_device);
|
|
|
|
if (!(td->evtdev->features & CLOCK_EVT_FEAT_C3STOP))
|
|
return 0;
|
|
|
|
return __tick_broadcast_oneshot_control(state);
|
|
}
|
|
EXPORT_SYMBOL_GPL(tick_broadcast_oneshot_control);
|
|
|
|
#ifdef CONFIG_HOTPLUG_CPU
|
|
void tick_assert_timekeeping_handover(void)
|
|
{
|
|
WARN_ON_ONCE(tick_do_timer_cpu == smp_processor_id());
|
|
}
|
|
/*
|
|
* Stop the tick and transfer the timekeeping job away from a dying cpu.
|
|
*/
|
|
int tick_cpu_dying(unsigned int dying_cpu)
|
|
{
|
|
/*
|
|
* If the current CPU is the timekeeper, it's the only one that can
|
|
* safely hand over its duty. Also all online CPUs are in stop
|
|
* machine, guaranteed not to be idle, therefore there is no
|
|
* concurrency and it's safe to pick any online successor.
|
|
*/
|
|
if (tick_do_timer_cpu == dying_cpu)
|
|
tick_do_timer_cpu = cpumask_first(cpu_online_mask);
|
|
|
|
/* Make sure the CPU won't try to retake the timekeeping duty */
|
|
tick_sched_timer_dying(dying_cpu);
|
|
|
|
/* Remove CPU from timer broadcasting */
|
|
tick_offline_cpu(dying_cpu);
|
|
|
|
return 0;
|
|
}
|
|
|
|
/*
|
|
* Shutdown an event device on a given cpu:
|
|
*
|
|
* This is called on a life CPU, when a CPU is dead. So we cannot
|
|
* access the hardware device itself.
|
|
* We just set the mode and remove it from the lists.
|
|
*/
|
|
void tick_shutdown(unsigned int cpu)
|
|
{
|
|
struct tick_device *td = &per_cpu(tick_cpu_device, cpu);
|
|
struct clock_event_device *dev = td->evtdev;
|
|
|
|
td->mode = TICKDEV_MODE_PERIODIC;
|
|
if (dev) {
|
|
/*
|
|
* Prevent that the clock events layer tries to call
|
|
* the set mode function!
|
|
*/
|
|
clockevent_set_state(dev, CLOCK_EVT_STATE_DETACHED);
|
|
clockevents_exchange_device(dev, NULL);
|
|
dev->event_handler = clockevents_handle_noop;
|
|
td->evtdev = NULL;
|
|
}
|
|
}
|
|
#endif
|
|
|
|
/**
|
|
* tick_suspend_local - Suspend the local tick device
|
|
*
|
|
* Called from the local cpu for freeze with interrupts disabled.
|
|
*
|
|
* No locks required. Nothing can change the per cpu device.
|
|
*/
|
|
void tick_suspend_local(void)
|
|
{
|
|
struct tick_device *td = this_cpu_ptr(&tick_cpu_device);
|
|
|
|
clockevents_shutdown(td->evtdev);
|
|
}
|
|
|
|
/**
|
|
* tick_resume_local - Resume the local tick device
|
|
*
|
|
* Called from the local CPU for unfreeze or XEN resume magic.
|
|
*
|
|
* No locks required. Nothing can change the per cpu device.
|
|
*/
|
|
void tick_resume_local(void)
|
|
{
|
|
struct tick_device *td = this_cpu_ptr(&tick_cpu_device);
|
|
bool broadcast = tick_resume_check_broadcast();
|
|
|
|
clockevents_tick_resume(td->evtdev);
|
|
if (!broadcast) {
|
|
if (td->mode == TICKDEV_MODE_PERIODIC)
|
|
tick_setup_periodic(td->evtdev, 0);
|
|
else
|
|
tick_resume_oneshot();
|
|
}
|
|
|
|
/*
|
|
* Ensure that hrtimers are up to date and the clockevents device
|
|
* is reprogrammed correctly when high resolution timers are
|
|
* enabled.
|
|
*/
|
|
hrtimers_resume_local();
|
|
}
|
|
|
|
/**
|
|
* tick_suspend - Suspend the tick and the broadcast device
|
|
*
|
|
* Called from syscore_suspend() via timekeeping_suspend with only one
|
|
* CPU online and interrupts disabled or from tick_unfreeze() under
|
|
* tick_freeze_lock.
|
|
*
|
|
* No locks required. Nothing can change the per cpu device.
|
|
*/
|
|
void tick_suspend(void)
|
|
{
|
|
tick_suspend_local();
|
|
tick_suspend_broadcast();
|
|
}
|
|
|
|
/**
|
|
* tick_resume - Resume the tick and the broadcast device
|
|
*
|
|
* Called from syscore_resume() via timekeeping_resume with only one
|
|
* CPU online and interrupts disabled.
|
|
*
|
|
* No locks required. Nothing can change the per cpu device.
|
|
*/
|
|
void tick_resume(void)
|
|
{
|
|
tick_resume_broadcast();
|
|
tick_resume_local();
|
|
}
|
|
|
|
#ifdef CONFIG_SUSPEND
|
|
static DEFINE_RAW_SPINLOCK(tick_freeze_lock);
|
|
static DEFINE_WAIT_OVERRIDE_MAP(tick_freeze_map, LD_WAIT_SLEEP);
|
|
static unsigned int tick_freeze_depth;
|
|
|
|
/**
|
|
* tick_freeze - Suspend the local tick and (possibly) timekeeping.
|
|
*
|
|
* Check if this is the last online CPU executing the function and if so,
|
|
* suspend timekeeping. Otherwise suspend the local tick.
|
|
*
|
|
* Call with interrupts disabled. Must be balanced with %tick_unfreeze().
|
|
* Interrupts must not be enabled before the subsequent %tick_unfreeze().
|
|
*/
|
|
void tick_freeze(void)
|
|
{
|
|
raw_spin_lock(&tick_freeze_lock);
|
|
|
|
tick_freeze_depth++;
|
|
if (tick_freeze_depth == num_online_cpus()) {
|
|
trace_suspend_resume(TPS("timekeeping_freeze"),
|
|
smp_processor_id(), true);
|
|
/*
|
|
* All other CPUs have their interrupts disabled and are
|
|
* suspended to idle. Other tasks have been frozen so there
|
|
* is no scheduling happening. This means that there is no
|
|
* concurrency in the system at this point. Therefore it is
|
|
* okay to acquire a sleeping lock on PREEMPT_RT, such as a
|
|
* spinlock, because the lock cannot be held by other CPUs
|
|
* or threads and acquiring it cannot block.
|
|
*
|
|
* Inform lockdep about the situation.
|
|
*/
|
|
lock_map_acquire_try(&tick_freeze_map);
|
|
system_state = SYSTEM_SUSPEND;
|
|
sched_clock_suspend();
|
|
timekeeping_suspend();
|
|
lock_map_release(&tick_freeze_map);
|
|
} else {
|
|
tick_suspend_local();
|
|
}
|
|
|
|
raw_spin_unlock(&tick_freeze_lock);
|
|
}
|
|
|
|
/**
|
|
* tick_unfreeze - Resume the local tick and (possibly) timekeeping.
|
|
*
|
|
* Check if this is the first CPU executing the function and if so, resume
|
|
* timekeeping. Otherwise resume the local tick.
|
|
*
|
|
* Call with interrupts disabled. Must be balanced with %tick_freeze().
|
|
* Interrupts must not be enabled after the preceding %tick_freeze().
|
|
*/
|
|
void tick_unfreeze(void)
|
|
{
|
|
raw_spin_lock(&tick_freeze_lock);
|
|
|
|
if (tick_freeze_depth == num_online_cpus()) {
|
|
/*
|
|
* Similar to tick_freeze(). On resumption the first CPU may
|
|
* acquire uncontended sleeping locks while other CPUs block on
|
|
* tick_freeze_lock.
|
|
*/
|
|
lock_map_acquire_try(&tick_freeze_map);
|
|
timekeeping_resume();
|
|
sched_clock_resume();
|
|
lock_map_release(&tick_freeze_map);
|
|
|
|
system_state = SYSTEM_RUNNING;
|
|
trace_suspend_resume(TPS("timekeeping_freeze"),
|
|
smp_processor_id(), false);
|
|
} else {
|
|
touch_softlockup_watchdog();
|
|
tick_resume_local();
|
|
}
|
|
|
|
tick_freeze_depth--;
|
|
|
|
raw_spin_unlock(&tick_freeze_lock);
|
|
}
|
|
#endif /* CONFIG_SUSPEND */
|
|
|
|
/**
|
|
* tick_init - initialize the tick control
|
|
*/
|
|
void __init tick_init(void)
|
|
{
|
|
tick_broadcast_init();
|
|
tick_nohz_init();
|
|
}
|