Merge 4.19.160 into android-4.19-stable
Linux 4.19.160
mm/userfaultfd: do not access vma->vm_mm after calling handle_userfault()
x86/microcode/intel: Check patch signature before saving microcode for early loading
* seccomp: Set PF_SUPERPRIV when checking capability
kernel/seccomp.c
* ptrace: Set PF_SUPERPRIV when checking capability
kernel/ptrace.c
s390/dasd: fix null pointer dereference for ERP requests
s390/cpum_sf.c: fix file permission for cpum_sfb_size
mac80211: free sta in sta_info_insert_finish() on errors
mac80211: minstrel: fix tx status processing corner case
mac80211: minstrel: remove deferred sampling code
xtensa: disable preemption around cache alias management calls
* regulator: workaround self-referent regulators
drivers/regulator/core.c
* regulator: avoid resolve_supply() infinite recursion
drivers/regulator/core.c
* regulator: fix memory leak with repeated set_machine_constraints()
drivers/regulator/core.c
regulator: pfuze100: limit pfuze-support-disable-sw to pfuze{100,200}
iio: accel: kxcjk1013: Add support for KIOX010A ACPI DSM for setting tablet-mode
iio: accel: kxcjk1013: Replace is_smo8500_device with an acpi_type enum
* ext4: fix bogus warning in ext4_update_dx_flag()
fs/ext4/ext4.h
staging: rtl8723bs: Add 024c:0627 to the list of SDIO device-ids
efivarfs: fix memory leak in efivarfs_create()
tty: serial: imx: keep console clocks always on
ALSA: hda/realtek: Add some Clove SSID in the ALC293(ALC1220)
ALSA: mixart: Fix mutex deadlock
* ALSA: ctl: fix error path at adding user-defined element set
sound/core/control.c
* ALSA: usb-audio: Add delay quirk for all Logitech USB devices
sound/usb/quirks.c
ALSA: firewire: Clean up a locking issue in copy_resp_to_buf()
speakup: Do not let the line discipline be used several times
* libfs: fix error cast of negative value in simple_attr_write()
fs/libfs.c
efi/x86: Free efi_pgd with free_pages()
xfs: revert "xfs: fix rmap key and record comparison functions"
fail_function: Remove a redundant mutex unlock
regulator: ti-abb: Fix array out of bound read access on the first transition
xfs: strengthen rmap record flags checking
xfs: fix the minrecs logic when dealing with inode root child blocks
can: kvaser_usb: kvaser_usb_hydra: Fix KCAN bittiming limits
drm/sun4i: dw-hdmi: fix error return code in sun8i_dw_hdmi_bind()
MIPS: Alchemy: Fix memleak in alchemy_clk_setup_cpu
ASoC: qcom: lpass-platform: Fix memory leak
can: m_can: m_can_handle_state_change(): fix state change
can: peak_usb: fix potential integer overflow on shift of a int
can: mcba_usb: mcba_usb_start_xmit(): first fill skb, then pass to can_put_echo_skb()
can: ti_hecc: Fix memleak in ti_hecc_probe
can: dev: can_restart(): post buffer from the right context
can: af_can: prevent potential access of uninitialized member in canfd_rcv()
can: af_can: prevent potential access of uninitialized member in can_rcv()
* ip_tunnels: Set tunnel option flag when tunnel metadata is present
include/net/ip_tunnels.h
perf lock: Don't free "lock_seq_stat" if read_count isn't zero
* Input: resistive-adc-touch - fix kconfig dependency on IIO_BUFFER
drivers/input/touchscreen/Kconfig
ARM: dts: imx50-evk: Fix the chip select 1 IOMUX
arm: dts: imx6qdl-udoo: fix rgmii phy-mode for ksz9031 phy
arm64: dts: allwinner: h5: OrangePi Prime: Fix ethernet node
MIPS: export has_transparent_hugepage() for modules
Input: adxl34x - clean up a data type in adxl34x_probe()
arm64: dts: allwinner: a64: bananapi-m64: Enable RGMII RX/TX delay on PHY
ARM: dts: sun8i: a83t: Enable both RGMII RX/TX delay on Ethernet PHY
ARM: dts: sun8i: h3: orangepi-plus2e: Enable RGMII RX/TX delay on Ethernet PHY
Revert "arm: sun8i: orangepi-pc-plus: Set EMAC activity LEDs to active high"
ARM: dts: sun8i: r40: bananapi-m2-ultra: Fix ethernet node
arm64: dts: allwinner: h5: OrangePi PC2: Fix ethernet node
arm64: dts: allwinner: a64: Pine64 Plus: Fix ethernet node
* vfs: remove lockdep bogosity in __sb_start_write
fs/super.c
* arm64: psci: Avoid printing in cpu_psci_cpu_die()
arch/arm64/kernel/psci.c
ACPI: button: Add DMI quirk for Medion Akoya E2228T
selftests: kvm: Fix the segment descriptor layout to match the actual layout
* scsi: ufs: Fix unbalanced scsi_block_reqs_cnt caused by ufshcd_hold()
drivers/scsi/ufs/ufshcd.c
pinctrl: rockchip: enable gpio pclk for rockchip_gpio_to_irq
net: ftgmac100: Fix crash when removing driver
net/ncsi: Fix netlink registration
net: usb: qmi_wwan: Set DTR quirk for MR400
net/mlx5: Disable QoS when min_rates on all VFs are zero
tcp: only postpone PROBE_RTT if RTT is < current min_rtt estimate
* sctp: change to hold/put transport for proto_unreach_timer
net/sctp/input.c
net/sctp/sm_sideeffect.c
net/sctp/transport.c
qlcnic: fix error return code in qlcnic_83xx_restart_hw()
qed: fix error return code in qed_iwarp_ll2_start()
* page_frag: Recover from memory pressure
mm/page_alloc.c
net: x25: Increase refcnt of "struct x25_neigh" in x25_rx_call_request
* net: qualcomm: rmnet: Fix incorrect receive packet handling during cleanup
drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
net/mlx4_core: Fix init_hca fields offset
* netlabel: fix an uninitialized warning in netlbl_unlabel_staticlist()
net/netlabel/netlabel_unlabeled.c
* netlabel: fix our progress tracking in netlbl_unlabel_staticlist()
net/netlabel/netlabel_unlabeled.c
net: Have netpoll bring-up DSA management interface
net: dsa: mv88e6xxx: Avoid VTU corruption on 6097
* net: bridge: add missing counters to ndo_get_stats64 callback
net/bridge/br_device.c
net: b44: fix error return code in b44_init_one()
mlxsw: core: Use variable timeout for EMAD retries
lan743x: prevent entire kernel HANG on open, for some platforms
lan743x: fix issue causing intermittent kernel log warnings
* inet_diag: Fix error path to cancel the meseage in inet_req_diag_fill()
net/ipv4/inet_diag.c
devlink: Add missing genlmsg_cancel() in devlink_nl_sb_port_pool_fill()
bnxt_en: read EEPROM A2h address using page 0
atm: nicstar: Unmap DMA on send error
* ah6: fix error return code in ah6_input()
net/ipv6/ah6.c
Merge 4.19.159 into android-4.19-stable
Linux 4.19.159
ACPI: GED: fix -Wformat
KVM: x86: clflushopt should be treated as a no-op by emulation
can: proc: can_remove_proc(): silence remove_proc_entry warning
mac80211: always wind down STA state
Input: sunkbd - avoid use-after-free in teardown paths
powerpc/8xx: Always fault when _PAGE_ACCESSED is not set
Revert "perf cs-etm: Move definition of 'traceid_list' global variable from header file"
powerpc/64s: flush L1D after user accesses
powerpc/uaccess: Evaluate macro arguments once, before user access is allowed
powerpc: Fix __clear_user() with KUAP enabled
powerpc: Implement user_access_begin and friends
powerpc: Add a framework for user access tracking
powerpc/64s: flush L1D on kernel entry
powerpc/64s: move some exception handlers out of line
ANDROID: GKI: Update ABI for incfs and dm-user
Revert "ANDROID: Add dependencies of dm-user.ko"
* ANDROID: Incremental fs: Add zstd compression support
fs/incfs/Kconfig
fs/incfs/data_mgmt.c
fs/incfs/data_mgmt.h
fs/incfs/format.h
include/uapi/linux/incrementalfs.h
* ANDROID: Incremental fs: Small improvements
fs/incfs/data_mgmt.c
fs/incfs/data_mgmt.h
fs/incfs/format.c
fs/incfs/format.h
fs/incfs/pseudo_files.c
fs/incfs/vfs.c
* ANDROID: Incremental fs: Initialize mount options correctly
fs/incfs/vfs.c
ANDROID: Incremental fs: Fix read_log_test which failed sporadically
* ANDROID: Incremental fs: Fix misuse of cpu_to_leXX and poll return
fs/incfs/format.c
fs/incfs/pseudo_files.c
* ANDROID: Incremental fs: Add per UID read timeouts
fs/incfs/data_mgmt.c
fs/incfs/data_mgmt.h
fs/incfs/pseudo_files.c
fs/incfs/vfs.c
include/uapi/linux/incrementalfs.h
* ANDROID: Incremental fs: Add .incomplete folder
fs/incfs/data_mgmt.c
fs/incfs/data_mgmt.h
fs/incfs/pseudo_files.c
fs/incfs/vfs.c
* ANDROID: Incremental fs: Fix dangling else
fs/incfs/data_mgmt.c
* ANDROID: Incremental fs: Fix uninitialized variable
fs/incfs/vfs.c
* ANDROID: Incremental fs: Fix filled block count from get filled blocks
fs/incfs/data_mgmt.c
fs/incfs/data_mgmt.h
fs/incfs/format.c
fs/incfs/format.h
fs/incfs/pseudo_files.c
fs/incfs/vfs.c
fs/incfs/vfs.h
* ANDROID: Incremental fs: Add hash block counts to IOC_IOCTL_GET_BLOCK_COUNT
fs/incfs/data_mgmt.c
fs/incfs/data_mgmt.h
fs/incfs/format.c
fs/incfs/format.h
fs/incfs/vfs.c
include/uapi/linux/incrementalfs.h
* ANDROID: Incremental fs: Add INCFS_IOC_GET_BLOCK_COUNT
fs/incfs/data_mgmt.c
fs/incfs/data_mgmt.h
fs/incfs/format.c
fs/incfs/format.h
fs/incfs/vfs.c
include/uapi/linux/incrementalfs.h
* ANDROID: Incremental fs: Make compatible with existing files
fs/incfs/format.c
fs/incfs/format.h
* ANDROID: Incremental fs: Remove block HASH flag
fs/incfs/format.c
fs/incfs/format.h
* ANDROID: Incremental fs: Remove back links and crcs
fs/incfs/format.c
fs/incfs/format.h
* ANDROID: Incremental fs: Remove attributes from file
fs/incfs/data_mgmt.c
fs/incfs/format.c
fs/incfs/format.h
fs/incfs/pseudo_files.c
* ANDROID: Incremental fs: Add .blocks_written file
fs/incfs/data_mgmt.c
fs/incfs/data_mgmt.h
fs/incfs/pseudo_files.c
fs/incfs/pseudo_files.h
include/uapi/linux/incrementalfs.h
* ANDROID: Incremental fs: Separate pseudo-file code
fs/incfs/Makefile
fs/incfs/pseudo_files.c
fs/incfs/pseudo_files.h
fs/incfs/vfs.c
fs/incfs/vfs.h
* ANDROID: Incremental fs: Add UID to pending_read
fs/incfs/data_mgmt.c
fs/incfs/data_mgmt.h
fs/incfs/main.c
fs/incfs/vfs.c
include/uapi/linux/incrementalfs.h
* ANDROID: Incremental fs: Create mapped file
fs/incfs/data_mgmt.c
fs/incfs/data_mgmt.h
fs/incfs/format.c
fs/incfs/format.h
fs/incfs/vfs.c
include/uapi/linux/incrementalfs.h
* ANDROID: Incremental fs: Don't allow renaming .index directory.
fs/incfs/vfs.c
* ANDROID: Incremental fs: Fix incfs to work on virtio-9p
fs/incfs/format.c
fs/incfs/vfs.c
ANDROID: Incremental fs: Allow running a single test
ANDROID: Incremental fs: Adding perf test
ANDROID: Incremental fs: Stress tool
* ANDROID: Incremental fs: Use R/W locks to read/write segment blockmap.
fs/incfs/data_mgmt.c
fs/incfs/data_mgmt.h
fs/incfs/vfs.c
* ANDROID: Incremental fs: Remove unnecessary dependencies
fs/incfs/Kconfig
* ANDROID: Incremental fs: Remove annoying pr_debugs
fs/incfs/data_mgmt.c
* ANDROID: Incremental fs: dentry_revalidate should not return -EBADF.
fs/incfs/vfs.c
* ANDROID: Incremental fs: Fix minor bugs
fs/incfs/data_mgmt.c
fs/incfs/vfs.c
* ANDROID: Incremental fs: RCU locks instead of mutex for pending_reads.
fs/incfs/data_mgmt.c
fs/incfs/data_mgmt.h
* ANDROID: Incremental fs: fix up attempt to copy structures with READ/WRITE_ONCE
fs/incfs/vfs.c
Merge 4.19.158 into android-4.19-stable
Revert "ANDROID: clang: update to 11.0.5"
Linux 4.19.158
Convert trailing spaces and periods in path components
* net: sch_generic: fix the missing new qdisc assignment bug
net/sched/sch_generic.c
* reboot: fix overflow parsing reboot cpu number
kernel/reboot.c
* Revert "kernel/reboot.c: convert simple_strtoul to kstrtoint"
kernel/reboot.c
* perf/core: Fix race in the perf_mmap_close() function
kernel/events/core.c
perf scripting python: Avoid declaring function pointers with a visibility attribute
x86/speculation: Allow IBPB to be conditionally enabled on CPUs with always-on STIBP
* random32: make prandom_u32() output unpredictable
drivers/char/random.c
include/linux/prandom.h
kernel/time/timer.c
lib/random32.c
r8169: fix potential skb double free in an error path
vrf: Fix fast path output packet handling with async Netfilter rules
* tipc: fix memory leak in tipc_topsrv_start()
net/tipc/topsrv.c
net/x25: Fix null-ptr-deref in x25_connect
* net: Update window_clamp if SOCK_RCVBUF is set
net/ipv4/syncookies.c
net/ipv6/syncookies.c
net/af_iucv: fix null pointer dereference on shutdown
* IPv6: Set SIT tunnel hard_header_len to zero
net/ipv6/sit.c
* swiotlb: fix "x86: Don't panic if can not alloc buffer for swiotlb"
kernel/dma/swiotlb.c
erofs: derive atime instead of leaving it empty
pinctrl: amd: fix incorrect way to disable debounce filter
pinctrl: amd: use higher precision for 512 RtcClk
drm/gma500: Fix out-of-bounds access to struct drm_device.vblank[]
* don't dump the threads that had been already exiting when zapped.
kernel/exit.c
mmc: renesas_sdhi_core: Add missing tmio_mmc_host_free() at remove
gpio: pcie-idio-24: Enable PEX8311 interrupts
gpio: pcie-idio-24: Fix IRQ Enable Register value
gpio: pcie-idio-24: Fix irq mask when masking
selinux: Fix error return code in sel_ib_pkey_sid_slow()
btrfs: fix potential overflow in cluster_pages_for_defrag on 32bit arch
ocfs2: initialize ip_next_orphan
* futex: Don't enable IRQs unconditionally in put_pi_state()
kernel/futex.c
mei: protect mei_cl_mtu from null dereference
xhci: hisilicon: fix refercence leak in xhci_histb_probe
usb: cdc-acm: Add DISABLE_ECHO for Renesas USB Download mode
* uio: Fix use-after-free in uio_unregister_device()
drivers/uio/uio.c
thunderbolt: Add the missed ida_simple_remove() in ring_request_msix()
thunderbolt: Fix memory leak if ida_simple_get() fails in enumerate_services()
btrfs: dev-replace: fail mount if we don't have replace item with target device
btrfs: ref-verify: fix memory leak in btrfs_ref_tree_mod
* ext4: unlock xattr_sem properly in ext4_inline_data_truncate()
fs/ext4/inline.c
* ext4: correctly report "not supported" for {usr,grp}jquota when !CONFIG_QUOTA
fs/ext4/super.c
* perf: Fix get_recursion_context()
kernel/events/internal.h
cosa: Add missing kfree in error path of cosa_write
* of/address: Fix of_node memory leak in of_dma_is_coherent
drivers/of/address.c
xfs: fix a missing unlock on error in xfs_fs_map_blocks
lan743x: fix "BUG: invalid wait context" when setting rx mode
xfs: fix brainos in the refcount scrubber's rmap fragment processor
xfs: fix rmap key and record comparison functions
xfs: set the unwritten bit in rmap lookup flags in xchk_bmap_get_rmapextents
xfs: fix flags argument to rmap lookup when converting shared file rmaps
nbd: fix a block_device refcount leak in nbd_release
pinctrl: aspeed: Fix GPI only function problem.
ARM: 9019/1: kprobes: Avoid fortify_panic() when copying optprobe template
pinctrl: intel: Set default bias in case no particular value given
mfd: sprd: Add wakeup capability for PMIC IRQ
* tick/common: Touch watchdog in tick_unfreeze() on all CPUs
kernel/time/tick-common.c
tpm_tis: Disable interrupts on ThinkPad T490s
selftests: proc: fix warning: _GNU_SOURCE redefined
vfio: platform: fix reference leak in vfio_platform_open
s390/smp: move rcu_cpu_starting() earlier
iommu/amd: Increase interrupt remapping table limit to 512 entries
scsi: scsi_dh_alua: Avoid crash during alua_bus_detach()
* cfg80211: regulatory: Fix inconsistent format argument
net/wireless/reg.c
mac80211: fix use of skb payload instead of header
drm/amd/pm: do not use ixFEATURE_STATUS for checking smc running
drm/amd/pm: perform SMC reset on suspend/hibernation
drm/amdgpu: perform srbm soft reset always on SDMA resume
scsi: hpsa: Fix memory leak in hpsa_init_one()
gfs2: check for live vs. read-only file system in gfs2_fitrim
gfs2: Add missing truncate_inode_pages_final for sd_aspace
gfs2: Free rd_bits later in gfs2_clear_rgrpd to fix use-after-free
usb: gadget: goku_udc: fix potential crashes in probe
* crypto: arm64/aes-modes - get rid of literal load of addend vector
arch/arm64/crypto/aes-modes.S
* netfilter: use actual socket sk rather than skb sk when routing harder
include/linux/netfilter_ipv4.h
include/linux/netfilter_ipv6.h
net/ipv4/netfilter.c
net/ipv4/netfilter/iptable_mangle.c
net/ipv4/netfilter/nf_nat_l3proto_ipv4.c
net/ipv4/netfilter/nf_reject_ipv4.c
net/ipv6/netfilter.c
net/ipv6/netfilter/ip6table_mangle.c
ath9k_htc: Use appropriate rs_datalen type
Btrfs: fix missing error return if writeback for extent buffer never started
tpm: efi: Don't create binary_bios_measurements file for an empty log
xfs: fix scrub flagging rtinherit even if there is no rt device
xfs: flush new eof page on truncate to avoid post-eof corruption
can: flexcan: remove FLEXCAN_QUIRK_DISABLE_MECR quirk for LS1021A
can: peak_canfd: pucan_handle_can_rx(): fix echo management when loopback is on
can: peak_usb: peak_usb_get_ts_time(): fix timestamp wrapping
can: peak_usb: add range checking in decode operations
* can: can_create_echo_skb(): fix echo skb generation: always use skb_clone()
include/linux/can/skb.h
can: dev: __can_get_echo_skb(): fix real payload length return value for RTR frames
can: dev: can_get_echo_skb(): prevent call to kfree_skb() in hard IRQ context
can: rx-offload: don't call kfree_skb() from IRQ context
ALSA: hda: prevent undefined shift in snd_hdac_ext_bus_get_link()
perf tools: Add missing swap for ino_generation
netfilter: ipset: Update byte and packet counters regardless of whether they match
xfs: set xefi_discard when creating a deferred agfl free log intent item
* net: xfrm: fix a race condition during allocing spi
net/xfrm/xfrm_state.c
hv_balloon: disable warning when floor reached
* genirq: Let GENERIC_IRQ_IPI select IRQ_DOMAIN_HIERARCHY
kernel/irq/Kconfig
btrfs: reschedule when cloning lots of extents
btrfs: sysfs: init devices outside of the chunk_mutex
* usb: dwc3: gadget: Reclaim extra TRBs after request completion
drivers/usb/dwc3/gadget.c
* usb: dwc3: gadget: Continue to process pending requests
drivers/usb/dwc3/gadget.c
nbd: don't update block size after device is started
* time: Prevent undefined behaviour in timespec64_to_ns()
include/linux/time64.h
kernel/time/itimer.c
* regulator: defer probe when trying to get voltage from unresolved supply
drivers/regulator/core.c
* FROMGIT: Input: Add devices for HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE
drivers/hid/hid-ids.h
drivers/hid/hid-quirks.c
* ANDROID: arm64: Fix off-by-one vdso trampoline return value
arch/arm64/include/asm/vdso.h
ANDROID: Add dependencies of dm-user.ko
* UPSTREAM: arm64: vdso: Add -fasynchronous-unwind-tables to cflags
arch/arm64/kernel/vdso/Makefile
* UPSTREAM: of: property: Fix create device links for all child-supplier dependencies
drivers/of/property.c
* UPSTREAM: of: property: Do not link to disabled devices
drivers/of/property.c
* UPSTREAM: drm: Fix doc warning in drm_connector_attach_edid_property()
drivers/gpu/drm/drm_connector.c
* UPSTREAM: selinux: fix non-MLS handling in mls_context_to_sid()
security/selinux/ss/mls.c
* UPSTREAM: drm/prime: Fix drm_gem_prime_mmap() stack use
drivers/gpu/drm/drm_prime.c
UPSTREAM: crypto: chacha-generic - fix use as arm64 no-NEON fallback
UPSTREAM: slab: store tagged freelist for off-slab slabmgmt
UPSTREAM: parisc: Switch from DISCONTIGMEM to SPARSEMEM
* UPSTREAM: cgroup: Move cgroup_parse_float() implementation out of CONFIG_SYSFS
kernel/cgroup/cgroup.c
* UPSTREAM: fork: don't check parent_tidptr with CLONE_PIDFD
kernel/fork.c
* UPSTREAM: vdso: Remove superfluous #ifdef __KERNEL__ in vdso/datapage.h
include/vdso/datapage.h
* UPSTREAM: arm64: compat: No need for pre-ARMv7 barriers on an ARMv8 system
arch/arm64/include/asm/vdso/compat_barrier.h
* UPSTREAM: timekeeping/vsyscall: Use __iter_div_u64_rem()
kernel/time/vsyscall.c
* UPSTREAM: kasan: remove clang version check for KASAN_STACK
lib/Kconfig.kasan
* UPSTREAM: page flags: prioritize kasan bits over last-cpuid
include/linux/page-flags-layout.h
* UPSTREAM: timekeeping/vsyscall: Prevent math overflow in BOOTTIME update
include/linux/timekeeper_internal.h
kernel/time/timekeeping.c
kernel/time/vsyscall.c
UPSTREAM: kcm: disable preemption in kcm_parse_func_strparser()
* UPSTREAM: cfg80211: validate SSID/MBSSID element ordering assumption
net/wireless/scan.c
UPSTREAM: MIPS: VDSO: Fix build for binutils < 2.25
UPSTREAM: virt_wifi: fix refcnt leak in module exit routine
* UPSTREAM: sched/topology: Allow sched_asym_cpucapacity to be disabled
kernel/sched/topology.c
* UPSTREAM: scripts/tools-support-relr.sh: un-quote variables
scripts/tools-support-relr.sh
* UPSTREAM: fork: fix pidfd_poll()'s return type
kernel/fork.c
UPSTREAM: virt_wifi: fix use-after-free in virt_wifi_newlink()
* UPSTREAM: of/platform: Unconditionally pause/resume sync state during kernel init
drivers/of/platform.c
* UPSTREAM: selinux: ensure the policy has been loaded before reading the sidtab stats
security/selinux/ss/services.c
* UPSTREAM: raid6/test: fix a compilation error
include/linux/raid/pq.h
UPSTREAM: PM: hibernate: fix crashes with init_on_free=1
UPSTREAM: ARM: bcm2835_defconfig: Explicitly restore CONFIG_DEBUG_FS
UPSTREAM: ARM: socfpga_defconfig: Add back DEBUG_FS
* UPSTREAM: binderfs: use refcount for binder control devices too
drivers/android/binderfs.c
UPSTREAM: um: Fix header inclusion
* UPSTREAM: PM: sleep: wakeup: Skip wakeup_source_sysfs_remove() if device is not there
drivers/base/power/wakeup.c
* UPSTREAM: Input: fix stale timestamp on key autorepeat events
drivers/input/input.c
* UPSTREAM: mm/filemap.c: don't bother dropping mmap_sem for zero size readahead
mm/filemap.c
* UPSTREAM: arm64: vdso: don't free unallocated pages
arch/arm64/kernel/vdso.c
* UPSTREAM: usb: typec: altmode: Fix typec_altmode_get_partner sometimes returning an invalid pointer
drivers/usb/typec/bus.c
* UPSTREAM: ipv6: ndisc: RFC-ietf-6man-ra-pref64-09 is now published as RFC8781
include/net/ndisc.h
UPSTREAM: s390/setup: init jump labels before command line parsing
* UPSTREAM: dma-buf: free dmabuf->name in dma_buf_release()
drivers/dma-buf/dma-buf.c
* UPSTREAM: driver core: Don't do deferred probe in parallel with kernel_init thread
drivers/base/base.h
drivers/base/core.c
drivers/base/dd.c
* UPSTREAM: fscrypt: restrict IV_INO_LBLK_* to AES-256-XTS
fs/crypto/policy.c
* UPSTREAM: fscrypt: use smp_load_acquire() for fscrypt_prepared_key
fs/crypto/fscrypt_private.h
fs/crypto/inline_crypt.c
fs/crypto/keysetup.c
* UPSTREAM: mm/page_alloc: silence a KASAN false positive
mm/page_alloc.c
* UPSTREAM: ARM64: vdso32: Install vdso32 from vdso_install
arch/arm64/Makefile
arch/arm64/kernel/vdso32/Makefile
* UPSTREAM: fscrypt: restrict IV_INO_LBLK_32 to ino_bits <= 32
fs/crypto/policy.c
UPSTREAM: coresight: tmc: Fix bad register address for CLAIM
UPSTREAM: coresight: etm4x: Fix unused function warning
UPSTREAM: coresight: etm4x: Fix use-after-free of per-cpu etm drvdata
UPSTREAM: coresight: etm4x: Fix save/restore during cpu idle
UPSTREAM: coresight: etm4x: Handle unreachable sink in perf mode
UPSTREAM: coresight: etm4x: Fix issues on trcseqevr access
UPSTREAM: coresight: etm: perf: Fix warning caused by etm_setup_aux failure
UPSTREAM: coresight: etm4x: Fix save and restore of TRCVMIDCCTLR1 register
Merge 4.19.157 into android-4.19-stable
Linux 4.19.157
powercap: restrict energy meter to root access
* Revert "ANDROID: Kbuild, LLVMLinux: allow overriding clang target triple"
Makefile
Merge 4.19.156 into android-4.19-stable
Linux 4.19.156
arm64: dts: marvell: espressobin: Add ethernet switch aliases
* net: dsa: read mac address from DT for slave device
include/net/dsa.h
tools: perf: Fix build error in v4.19.y
* perf/core: Fix a memory leak in perf_event_parse_addr_filter()
kernel/events/core.c
* PM: runtime: Resume the device earlier in __device_release_driver()
drivers/base/dd.c
Revert "ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE"
ARC: stack unwinding: avoid indefinite looping
usb: mtu3: fix panic in mtu3_gadget_stop()
* USB: Add NO_LPM quirk for Kingston flash drive
drivers/usb/core/quirks.c
USB: serial: option: add Telit FN980 composition 0x1055
USB: serial: option: add LE910Cx compositions 0x1203, 0x1230, 0x1231
USB: serial: option: add Quectel EC200T module support
USB: serial: cyberjack: fix write-URB completion race
serial: txx9: add missing platform_driver_unregister() on error in serial_txx9_init
serial: 8250_mtk: Fix uart_get_baud_rate warning
* fork: fix copy_process(CLONE_PARENT) race with the exiting ->real_parent
kernel/fork.c
vt: Disable KD_FONT_OP_COPY
ACPI: NFIT: Fix comparison to '-ENXIO'
drm/vc4: drv: Add error handding for bind
vsock: use ns_capable_noaudit() on socket create
* scsi: core: Don't start concurrent async scan on same host
drivers/scsi/scsi_scan.c
* blk-cgroup: Pre-allocate tree node on blkg_conf_prep
block/blk-cgroup.c
* blk-cgroup: Fix memleak on error path
block/blk-cgroup.c
* of: Fix reserved-memory overlap detection
drivers/of/of_reserved_mem.c
x86/kexec: Use up-to-dated screen_info copy to fill boot params
ARM: dts: sun4i-a10: fix cpu_alert temperature
* futex: Handle transient "ownerless" rtmutex state correctly
kernel/futex.c
* tracing: Fix out of bounds write in get_trace_buf
kernel/trace/trace.c
* ftrace: Handle tracing when switching between context
kernel/trace/trace.h
* ftrace: Fix recursion check for NMI test
kernel/trace/trace.h
* ring-buffer: Fix recursion protection transitions between interrupt context
kernel/trace/ring_buffer.c
gfs2: Wake up when sd_glock_disposal becomes zero
* mm: always have io_remap_pfn_range() set pgprot_decrypted()
include/asm-generic/pgtable.h
include/linux/mm.h
* kthread_worker: prevent queuing delayed work from timer_fn when it is being canceled
kernel/kthread.c
lib/crc32test: remove extra local_irq_disable/enable
mm: mempolicy: fix potential pte_unmap_unlock pte error
* ALSA: usb-audio: Add implicit feedback quirk for MODX
sound/usb/pcm.c
* ALSA: usb-audio: Add implicit feedback quirk for Qu-16
sound/usb/pcm.c
* ALSA: usb-audio: add usb vendor id as DSD-capable for Khadas devices
sound/usb/quirks.c
* ALSA: usb-audio: Add implicit feedback quirk for Zoom UAC-2
sound/usb/pcm.c
Fonts: Replace discarded const qualifier
btrfs: tree-checker: fix the error message for transid error
btrfs: tree-checker: Verify inode item
btrfs: tree-checker: Enhance chunk checker to validate chunk profile
btrfs: tree-checker: Fix wrong check on max devid
btrfs: tree-checker: Verify dev item
btrfs: tree-checker: Check chunk item at tree block read time
btrfs: tree-checker: Make btrfs_check_chunk_valid() return EUCLEAN instead of EIO
btrfs: tree-checker: Make chunk item checker messages more readable
btrfs: Move btrfs_check_chunk_valid() to tree-check.[ch] and export it
btrfs: Don't submit any btree write bio if the fs has errors
Btrfs: fix unwritten extent buffers and hangs on future writeback attempts
btrfs: extent_io: add proper error handling to lock_extent_buffer_for_io()
btrfs: extent_io: Handle errors better in btree_write_cache_pages()
btrfs: extent_io: Handle errors better in extent_write_full_page()
btrfs: flush write bio if we loop in extent_write_cache_pages
Revert "btrfs: flush write bio if we loop in extent_write_cache_pages"
btrfs: extent_io: Move the BUG_ON() in flush_write_bio() one level up
btrfs: extent_io: Kill the forward declaration of flush_write_bio
* blktrace: fix debugfs use after free
kernel/trace/blktrace.c
sfp: Fix error handing in sfp_probe()
* sctp: Fix COMM_LOST/CANT_STR_ASSOC err reporting on big-endian platforms
net/sctp/sm_sideeffect.c
net: usb: qmi_wwan: add Telit LE910Cx 0x1230 composition
gianfar: Account for Tx PTP timestamp in the skb headroom
gianfar: Replace skb_realloc_headroom with skb_cow_head for PTP
chelsio/chtls: fix always leaking ctrl_skb
chelsio/chtls: fix memory leaks caused by a race
cadence: force nonlinear buffers to be cloned
* ptrace: fix task_join_group_stop() for the case when current is traced
kernel/signal.c
* tipc: fix use-after-free in tipc_bcast_get_mode
net/tipc/core.c
drm/i915: Break up error capture compression loops with cond_resched()
* ANDROID: fuse: Add support for d_canonical_path
fs/fuse/dev.c
fs/fuse/dir.c
fs/fuse/fuse_i.h
include/uapi/linux/fuse.h
* ANDROID: vfs: add d_canonical_path for stacked filesystem support
fs/notify/inotify/inotify_user.c
include/linux/dcache.h
include/linux/fsnotify.h
* ANDROID: Temporarily disable XFRM_USER_COMPAT filtering
net/xfrm/xfrm_state.c
net/xfrm/xfrm_user.c
Merge 4.19.155 into android-4.19-stable
Linux 4.19.155
staging: octeon: Drop on uncorrectable alignment or FCS error
staging: octeon: repair "fixed-link" support
staging: comedi: cb_pcidas: Allow 2-channel commands for AO subdevice
* KVM: arm64: Fix AArch32 handling of DBGD{CCINT,SCRext} and DBGVCR
arch/arm64/include/asm/kvm_host.h
* device property: Don't clear secondary pointer for shared primary firmware node
drivers/base/core.c
* device property: Keep secondary firmware node secondary by type
drivers/base/core.c
ARM: s3c24xx: fix missing system reset
ARM: samsung: fix PM debug build with DEBUG_LL but !MMU
arm: dts: mt7623: add missing pause for switchport
* hil/parisc: Disable HIL driver when it gets stuck
include/linux/hil_mlc.h
cachefiles: Handle readpage error correctly
* arm64: berlin: Select DW_APB_TIMER_OF
arch/arm64/Kconfig.platforms
tty: make FONTX ioctl use the tty pointer they were actually passed
rtc: rx8010: don't modify the global rtc ops
drm/ttm: fix eviction valuable range check.
* ext4: fix invalid inode checksum
fs/ext4/inode.c
* ext4: fix error handling code in add_new_gdb
fs/ext4/resize.c
* ext4: fix leaking sysfs kobject after failed mount
fs/ext4/super.c
vringh: fix __vringh_iov() when riov and wiov are different
* ring-buffer: Return 0 on success from ring_buffer_resize()
kernel/trace/ring_buffer.c
9P: Cast to loff_t before multiplying
libceph: clear con->out_msg on Policy::stateful_server faults
ceph: promote to unsigned long long before shifting
drm/amd/display: Don't invoke kgdb_breakpoint() unconditionally
drm/amdgpu: don't map BO in reserved region
i2c: imx: Fix external abort on interrupt in exit paths
ia64: fix build error with !COREDUMP
ubi: check kthread_should_stop() after the setting of task state
perf python scripting: Fix printable strings in python3 scripts
ubifs: dent: Fix some potential memory leaks while iterating entries
NFSD: Add missing NFSv2 .pc_func methods
* NFSv4.2: support EXCHGID4_FLAG_SUPP_FENCE_OPS 4.2 EXCHANGE_ID flag
include/uapi/linux/nfs4.h
powerpc: Fix undetected data corruption with P9N DD2.1 VSX CI load emulation
powerpc/powernv/elog: Fix race while processing OPAL error log event.
powerpc: Warn about use of smt_snooze_delay
powerpc/rtas: Restrict RTAS requests from userspace
s390/stp: add locking to sysfs functions
powerpc/drmem: Make lmb_size 64 bit
iio:gyro:itg3200: Fix timestamp alignment and prevent data leak.
iio:adc:ti-adc12138 Fix alignment issue with timestamp
iio:adc:ti-adc0832 Fix alignment issue with timestamp
iio:light:si1145: Fix timestamp alignment and prevent data leak.
dmaengine: dma-jz4780: Fix race in jz4780_dma_tx_status
udf: Fix memory leak when mounting
HID: wacom: Avoid entering wacom_wac_pen_report for pad / battery
vt: keyboard, extend func_buf_lock to readers
vt: keyboard, simplify vt_kdgkbsent
drm/i915: Force VT'd workarounds when running as a guest OS
usb: host: fsl-mph-dr-of: check return of dma_set_mask()
usb: typec: tcpm: reset hard_reset_count for any disconnect
usb: cdc-acm: fix cooldown mechanism
* usb: dwc3: core: don't trigger runtime pm when remove driver
drivers/usb/dwc3/core.c
* usb: dwc3: core: add phy cleanup for probe error handling
drivers/usb/dwc3/core.c
* usb: dwc3: gadget: Check MPS of the request length
drivers/usb/dwc3/gadget.c
* usb: dwc3: ep0: Fix ZLP for OUT ep0 requests
drivers/usb/dwc3/ep0.c
* usb: xhci: Workaround for S3 issue on AMD SNPS 3.0 xHC
drivers/usb/host/xhci-pci.c
drivers/usb/host/xhci.h
btrfs: fix use-after-free on readahead extent after failure to create it
btrfs: cleanup cow block on error
btrfs: use kvzalloc() to allocate clone_roots in btrfs_ioctl_send()
btrfs: send, recompute reference path after orphanization of a directory
btrfs: reschedule if necessary when logging directory items
btrfs: improve device scanning messages
btrfs: qgroup: fix wrong qgroup metadata reserve for delayed inode
scsi: qla2xxx: Fix crash on session cleanup with unload
scsi: mptfusion: Fix null pointer dereferences in mptscsih_remove()
w1: mxc_w1: Fix timeout resolution problem leading to bus error
acpi-cpufreq: Honor _PSD table setting on new AMD CPUs
ACPI: debug: don't allow debugging when ACPI is disabled
ACPI: video: use ACPI backlight for HP 635 Notebook
ACPI / extlog: Check for RDMSR failure
ACPI: button: fix handling lid state changes when input device closed
NFS: fix nfs_path in case of a rename retry
* fs: Don't invalidate page buffers in block_write_full_page()
fs/buffer.c
media: uvcvideo: Fix uvc_ctrl_fixup_xu_info() not having any effect
leds: bcm6328, bcm6358: use devres LED registering function
perf/x86/amd/ibs: Fix raw sample data accumulation
perf/x86/amd/ibs: Don't include randomized bits in get_ibs_op_count()
mmc: sdhci-acpi: AMDI0040: Set SDHCI_QUIRK2_PRESET_VALUE_BROKEN
md/raid5: fix oops during stripe resizing
nvme-rdma: fix crash when connect rejected
* sgl_alloc_order: fix memory leak
lib/scatterlist.c
nbd: make the config put is called before the notifying the waiter
ARM: dts: s5pv210: remove dedicated 'audio-subsystem' node
ARM: dts: s5pv210: move PMU node out of clock controller
ARM: dts: s5pv210: remove DMA controller bus node name to fix dtschema warnings
memory: emif: Remove bogus debugfs error handling
ARM: dts: omap4: Fix sgx clock rate for 4430
arm64: dts: renesas: ulcb: add full-pwr-cycle-in-suspend into eMMC nodes
cifs: handle -EINTR in cifs_setattr
gfs2: add validation checks for size of superblock
* ext4: Detect already used quota file early
fs/ext4/super.c
drivers: watchdog: rdc321x_wdt: Fix race condition bugs
net: 9p: initialize sun_server.sun_path to have addr's value only when addr is valid
clk: ti: clockdomain: fix static checker warning
* rpmsg: glink: Use complete_all for open states
drivers/rpmsg/qcom_glink_native.c
bnxt_en: Log unknown link speed appropriately.
md/bitmap: md_bitmap_get_counter returns wrong blocks
btrfs: fix replace of seed device
drm/amd/display: HDMI remote sink need mode validation for Linux
power: supply: test_power: add missing newlines when printing parameters by sysfs
bus/fsl_mc: Do not rely on caller to provide non NULL mc_io
drivers/net/wan/hdlc_fr: Correctly handle special skb->protocol values
ACPI: Add out of bounds and numa_off protections to pxm_to_node()
xfs: don't free rt blocks when we're doing a REMAP bunmapi call
* arm64/mm: return cpu_all_mask when node is NUMA_NO_NODE
arch/arm64/include/asm/numa.h
* usb: xhci: omit duplicate actions when suspending a runtime suspended host.
drivers/usb/host/xhci.c
* uio: free uio id after uio file node is freed
drivers/uio/uio.c
USB: adutux: fix debugging
cpufreq: sti-cpufreq: add stih418 support
riscv: Define AT_VECTOR_SIZE_ARCH for ARCH_DLINFO
media: uvcvideo: Fix dereference of out-of-bound list iterator
kgdb: Make "kgdbcon" work properly with "kgdb_earlycon"
ia64: kprobes: Use generic kretprobe trampoline handler
* printk: reduce LOG_BUF_SHIFT range for H8300
init/Kconfig
* arm64: topology: Stop using MPIDR for topology information
arch/arm64/kernel/topology.c
drm/bridge/synopsys: dsi: add support for non-continuous HS clock
mmc: via-sdmmc: Fix data race bug
media: imx274: fix frame interval handling
media: tw5864: check status of tw5864_frameinterval_get
* usb: typec: tcpm: During PR_SWAP, source caps should be sent only after tSwapSourceStart
include/linux/usb/pd.h
media: platform: Improve queue set up flow for bug fixing
* media: videodev2.h: RGB BT2020 and HSV are always full range
include/uapi/linux/videodev2.h
drm/brige/megachips: Add checking if ge_b850v3_lvds_init() is working correctly
ath10k: fix VHT NSS calculation when STBC is enabled
ath10k: start recovery process when payload length exceeds max htc length for sdio
video: fbdev: pvr2fb: initialize variables
xfs: fix realtime bitmap/summary file truncation when growing rt volume
power: supply: bq27xxx: report "not charging" on all types
ARM: 8997/2: hw_breakpoint: Handle inexact watchpoint addresses
um: change sigio_spinlock to a mutex
* f2fs: fix to check segment boundary during SIT page readahead
fs/f2fs/checkpoint.c
* f2fs: fix uninit-value in f2fs_lookup
fs/f2fs/dir.c
* f2fs: add trace exit in exception path
fs/f2fs/checkpoint.c
sparc64: remove mm_cpumask clearing to fix kthread_use_mm race
powerpc: select ARCH_WANT_IRQS_OFF_ACTIVATE_MM
* mm: fix exec activate_mm vs TLB shootdown and lazy tlb switching race
arch/Kconfig
fs/exec.c
powerpc/powernv/smp: Fix spurious DBG() warning
* futex: Fix incorrect should_fail_futex() handling
kernel/futex.c
ata: sata_nv: Fix retrieving of active qcs
RDMA/qedr: Fix memory leak in iWARP CM
mlxsw: core: Fix use-after-free in mlxsw_emad_trans_finish()
x86/unwind/orc: Fix inactive tasks with stack pointer in %sp on GCC 10 compiled kernels
xen/events: block rogue events for some time
xen/events: defer eoi in case of excessive number of events
xen/events: use a common cpu hotplug hook for event channels
xen/events: switch user event channels to lateeoi model
xen/pciback: use lateeoi irq binding
xen/pvcallsback: use lateeoi irq binding
xen/scsiback: use lateeoi irq binding
xen/netback: use lateeoi irq binding
xen/blkback: use lateeoi irq binding
* xen/events: add a new "late EOI" evtchn framework
include/xen/events.h
xen/events: fix race in evtchn_fifo_unmask()
xen/events: add a proper barrier to 2-level uevent unmasking
xen/events: avoid removing an event channel while handling it
xen/events: don't use chip_data for legacy IRQs
* Revert "block: ratelimit handle_bad_sector() message"
block/blk-core.c
* fscrypt: fix race where ->lookup() marks plaintext dentry as ciphertext
fs/crypto/fname.c
fs/crypto/hooks.c
fs/ext4/ext4.h
fs/ext4/namei.c
fs/f2fs/namei.c
include/linux/fscrypt.h
* fscrypt: only set dentry_operations on ciphertext dentries
fs/crypto/hooks.c
* fs, fscrypt: clear DCACHE_ENCRYPTED_NAME when unaliasing directory
fs/dcache.c
* fscrypt: fix race allowing rename() and link() of ciphertext dentries
fs/crypto/hooks.c
include/linux/fscrypt.h
* fscrypt: clean up and improve dentry revalidation
fs/crypto/crypto.c
fs/crypto/hooks.c
include/linux/dcache.h
include/linux/fscrypt.h
* fscrypt: return -EXDEV for incompatible rename or link into encrypted dir
fs/crypto/hooks.c
fs/crypto/policy.c
include/linux/fscrypt.h
ata: sata_rcar: Fix DMA boundary mask
serial: pl011: Fix lockdep splat when handling magic-sysrq interrupt
* mtd: lpddr: Fix bad logic in print_drs_error
include/linux/mtd/pfow.h
RDMA/addr: Fix race with netevent_callback()/rdma_addr_cancel()
cxl: Rework error message for incompatible slots
p54: avoid accessing the data mapped to streaming DMA
evm: Check size of security.evm before using it
* bpf: Fix comment for helper bpf_current_task_under_cgroup()
include/uapi/linux/bpf.h
* fuse: fix page dereference after free
fs/fuse/dev.c
x86/xen: disable Firmware First mode for correctable memory errors
arch/x86/amd/ibs: Fix re-arming IBS Fetch
cxgb4: set up filter action after rewrites
r8169: fix issue with forced threading in combination with shared interrupts
* tipc: fix memory leak caused by tipc_buf_append()
net/tipc/msg.c
* tcp: Prevent low rmem stalls with SO_RCVLOWAT.
net/ipv4/tcp.c
net/ipv4/tcp_input.c
ravb: Fix bit fields checking in ravb_hwtstamp_get()
* netem: fix zero division in tabledist
net/sched/sch_netem.c
mlxsw: core: Fix memory leak on module removal
gtp: fix an use-before-init in gtp_newlink()
chelsio/chtls: fix tls record info to user
chelsio/chtls: fix memory leaks in CPL handlers
chelsio/chtls: fix deadlock issue
efivarfs: Replace invalid slashes with exclamation marks in dentries.
x86/PCI: Fix intel_mid_pci.c build error when ACPI is not enabled
* arm64: link with -z norelro regardless of CONFIG_RELOCATABLE
arch/arm64/Makefile
* arm64: Run ARCH_WORKAROUND_1 enabling code on all CPUs
arch/arm64/kernel/cpu_errata.c
* scripts/setlocalversion: make git describe output more reliable
scripts/setlocalversion
objtool: Support Clang non-section symbols in ORC generation
ANDROID: GKI: Enable DEBUG_INFO_DWARF4
* UPSTREAM: mm/sl[uo]b: export __kmalloc_track(_node)_caller
mm/slub.c
* BACKPORT: xfrm/compat: Translate 32-bit user_policy from sockptr
include/net/xfrm.h
net/xfrm/xfrm_state.c
* BACKPORT: xfrm/compat: Add 32=>64-bit messages translator
include/net/xfrm.h
net/xfrm/Kconfig
net/xfrm/xfrm_user.c
* UPSTREAM: xfrm/compat: Attach xfrm dumps to 64=>32 bit translator
net/xfrm/xfrm_user.c
* UPSTREAM: xfrm/compat: Add 64=>32-bit messages translator
include/net/xfrm.h
net/xfrm/xfrm_user.c
* BACKPORT: xfrm: Provide API to register translator module
include/net/xfrm.h
net/xfrm/Kconfig
net/xfrm/Makefile
net/xfrm/xfrm_state.c
ANDROID: Publish uncompressed Image on aarch64
FROMLIST: crypto: arm64/poly1305-neon - reorder PAC authentication with SP update
UPSTREAM: crypto: arm64/chacha - fix chacha_4block_xor_neon() for big endian
UPSTREAM: crypto: arm64/chacha - fix hchacha_block_neon() for big endian
Merge 4.19.154 into android-4.19-stable
Linux 4.19.154
* usb: gadget: f_ncm: allow using NCM in SuperSpeed Plus gadgets.
drivers/usb/gadget/function/f_ncm.c
eeprom: at25: set minimum read/write access stride to 1
USB: cdc-wdm: Make wdm_flush() interruptible and add wdm_fsync().
usb: cdc-acm: add quirk to blacklist ETAS ES58X devices
tty: serial: fsl_lpuart: fix lpuart32_poll_get_char
net: korina: cast KSEG0 address to pointer in kfree
ath10k: check idx validity in __ath10k_htt_rx_ring_fill_n()
* scsi: ufs: ufs-qcom: Fix race conditions caused by ufs_qcom_testbus_config()
drivers/scsi/ufs/ufs-qcom.c
* usb: core: Solve race condition in anchor cleanup functions
drivers/usb/core/urb.c
brcm80211: fix possible memleak in brcmf_proto_msgbuf_attach
mwifiex: don't call del_timer_sync() on uninitialized timer
reiserfs: Fix memory leak in reiserfs_parse_options()
ipvs: Fix uninit-value in do_ip_vs_set_ctl()
tty: ipwireless: fix error handling
scsi: qedi: Fix list_del corruption while removing active I/O
scsi: qedi: Protect active command list to avoid list corruption
Fix use after free in get_capset_info callback.
rtl8xxxu: prevent potential memory leak
brcmsmac: fix memory leak in wlc_phy_attach_lcnphy
scsi: ibmvfc: Fix error return in ibmvfc_probe()
* Bluetooth: Only mark socket zapped after unlocking
net/bluetooth/l2cap_sock.c
* usb: ohci: Default to per-port over-current protection
drivers/usb/host/ohci-hcd.c
xfs: make sure the rt allocator doesn't run off the end
reiserfs: only call unlock_new_inode() if I_NEW
misc: rtsx: Fix memory leak in rtsx_pci_probe
ath9k: hif_usb: fix race condition between usb_get_urb() and usb_kill_anchored_urbs()
can: flexcan: flexcan_chip_stop(): add error handling and propagate error value
* usb: dwc3: simple: add support for Hikey 970
drivers/usb/dwc3/dwc3-of-simple.c
USB: cdc-acm: handle broken union descriptors
udf: Avoid accessing uninitialized data on failed inode read
udf: Limit sparing table size
usb: gadget: function: printer: fix use-after-free in __lock_acquire
misc: vop: add round_up(x,4) for vring_size to avoid kernel panic
mic: vop: copy data to kernel space then write to io memory
* scsi: target: core: Add CONTROL field for trace events
include/scsi/scsi_common.h
include/trace/events/target.h
scsi: mvumi: Fix error return in mvumi_io_attach()
PM: hibernate: remove the bogus call to get_gendisk() in software_resume()
mac80211: handle lack of sband->bitrates in rates
ip_gre: set dev->hard_header_len and dev->needed_headroom properly
ntfs: add check for mft record size in superblock
media: venus: core: Fix runtime PM imbalance in venus_probe
fs: dlm: fix configfs memory leak
media: saa7134: avoid a shift overflow
mmc: sdio: Check for CISTPL_VERS_1 buffer size
media: uvcvideo: Ensure all probed info is returned to v4l2
media: media/pci: prevent memory leak in bttv_probe
media: bdisp: Fix runtime PM imbalance on error
media: platform: sti: hva: Fix runtime PM imbalance on error
media: platform: s3c-camif: Fix runtime PM imbalance on error
media: vsp1: Fix runtime PM imbalance on error
media: exynos4-is: Fix a reference count leak
media: exynos4-is: Fix a reference count leak due to pm_runtime_get_sync
media: exynos4-is: Fix several reference count leaks due to pm_runtime_get_sync
media: sti: Fix reference count leaks
media: st-delta: Fix reference count leak in delta_run_work
media: ati_remote: sanity check for both endpoints
media: firewire: fix memory leak
crypto: ccp - fix error handling
* block: ratelimit handle_bad_sector() message
block/blk-core.c
i2c: core: Restore acpi_walk_dep_device_list() getting called after registering the ACPI i2c devs
* perf: correct SNOOPX field offset
include/uapi/linux/perf_event.h
* sched/features: Fix !CONFIG_JUMP_LABEL case
kernel/sched/core.c
kernel/sched/sched.h
NTB: hw: amd: fix an issue about leak system resources
nvmet: fix uninitialized work for zero kato
powerpc/powernv/dump: Fix race while processing OPAL dump
arm64: dts: zynqmp: Remove additional compatible string for i2c IPs
ARM: dts: owl-s500: Fix incorrect PPI interrupt specifiers
arm64: dts: qcom: msm8916: Fix MDP/DSI interrupts
arm64: dts: qcom: pm8916: Remove invalid reg size from wcd_codec
memory: fsl-corenet-cf: Fix handling of platform_get_irq() error
memory: omap-gpmc: Fix build error without CONFIG_OF
memory: omap-gpmc: Fix a couple off by ones
ARM: dts: sun8i: r40: bananapi-m2-ultra: Fix dcdc1 regulator
ARM: dts: imx6sl: fix rng node
netfilter: nf_fwd_netdev: clear timestamp in forwarding path
* netfilter: conntrack: connection timeout after re-register
net/netfilter/nf_conntrack_proto_tcp.c
KVM: x86: emulating RDPID failure shall return #UD rather than #GP
Input: sun4i-ps2 - fix handling of platform_get_irq() error
Input: twl4030_keypad - fix handling of platform_get_irq() error
Input: omap4-keypad - fix handling of platform_get_irq() error
Input: ep93xx_keypad - fix handling of platform_get_irq() error
Input: stmfts - fix a & vs && typo
Input: imx6ul_tsc - clean up some errors in imx6ul_tsc_resume()
SUNRPC: fix copying of multiple pages in gss_read_proxy_verf()
vfio iommu type1: Fix memory leak in vfio_iommu_type1_pin_pages
vfio/pci: Clear token on bypass registration failure
* ext4: limit entries returned when counting fsmap records
fs/ext4/fsmap.c
svcrdma: fix bounce buffers for unaligned offsets and multiple pages
watchdog: sp5100: Fix definition of EFCH_PM_DECODEEN3
* watchdog: Use put_device on error
drivers/watchdog/watchdog_dev.c
* watchdog: Fix memleak in watchdog_cdev_register
drivers/watchdog/watchdog_dev.c
clk: bcm2835: add missing release if devm_clk_hw_register fails
clk: at91: clk-main: update key before writing AT91_CKGR_MOR
clk: rockchip: Initialize hw to error to avoid undefined behavior
pwm: img: Fix null pointer access in probe
rpmsg: smd: Fix a kobj leak in in qcom_smd_parse_edge()
PCI: iproc: Set affinity mask on MSI interrupts
* i2c: rcar: Auto select RESET_CONTROLLER
drivers/i2c/busses/Kconfig
* mailbox: avoid timer start from callback
drivers/mailbox/mailbox.c
rapidio: fix the missed put_device() for rio_mport_add_riodev
rapidio: fix error handling path
ramfs: fix nommu mmap with gaps in the page cache
* lib/crc32.c: fix trivial typo in preprocessor condition
lib/crc32.c
* f2fs: wait for sysfs kobject removal before freeing f2fs_sb_info
fs/f2fs/sysfs.c
IB/rdmavt: Fix sizeof mismatch
cpufreq: powernv: Fix frame-size-overflow in powernv_cpufreq_reboot_notifier
powerpc/perf/hv-gpci: Fix starting index value
powerpc/perf: Exclude pmc5/6 from the irrelevant PMU group constraints
* overflow: Include header file with SIZE_MAX declaration
include/linux/overflow.h
kdb: Fix pager search for multi-line strings
RDMA/hns: Fix missing sq_sig_type when querying QP
RDMA/hns: Set the unsupported wr opcode
perf intel-pt: Fix "context_switch event has no tid" error
RDMA/cma: Consolidate the destruction of a cma_multicast in one place
RDMA/cma: Remove dead code for kernel rdmacm multicast
powerpc/64s/radix: Fix mm_cpumask trimming race vs kthread_use_mm
powerpc/tau: Disable TAU between measurements
powerpc/tau: Check processor type before enabling TAU interrupt
ANDROID: GKI: update the ABI xml
Merge 4.19.153 into android-4.19-stable
Linux 4.19.153
powerpc/tau: Remove duplicated set_thresholds() call
powerpc/tau: Convert from timer to workqueue
powerpc/tau: Use appropriate temperature sample interval
RDMA/qedr: Fix inline size returned for iWARP
RDMA/qedr: Fix use of uninitialized field
xfs: fix high key handling in the rt allocator's query_range function
xfs: limit entries returned when counting fsmap records
arc: plat-hsdk: fix kconfig dependency warning when !RESET_CONTROLLER
ARM: 9007/1: l2c: fix prefetch bits init in L2X0_AUX_CTRL using DT values
mtd: mtdoops: Don't write panic data twice
powerpc/pseries: explicitly reschedule during drmem_lmb list traversal
mtd: lpddr: fix excessive stack usage with clang
RDMA/ucma: Add missing locking around rdma_leave_multicast()
RDMA/ucma: Fix locking for ctx->events_reported
powerpc/icp-hv: Fix missing of_node_put() in success path
powerpc/pseries: Fix missing of_node_put() in rng_init()
IB/mlx4: Adjust delayed work when a dup is observed
IB/mlx4: Fix starvation in paravirt mux/demux
* mm, oom_adj: don't loop through tasks in __set_oom_adj when not necessary
fs/proc/base.c
include/linux/oom.h
include/linux/sched/coredump.h
kernel/fork.c
mm/oom_kill.c
* mm/memcg: fix device private memcg accounting
mm/memcontrol.c
* netfilter: nf_log: missing vlan offload tag and proto
include/net/netfilter/nf_log.h
net/ipv4/netfilter/nf_log_ipv4.c
net/ipv6/netfilter/nf_log_ipv6.c
net/netfilter/nf_log_common.c
net: korina: fix kfree of rx/tx descriptor array
ipvs: clear skb->tstamp in forwarding path
mwifiex: fix double free
platform/x86: mlx-platform: Remove PSU EEPROM configuration
scsi: be2iscsi: Fix a theoretical leak in beiscsi_create_eqs()
scsi: target: tcmu: Fix warning: 'page' may be used uninitialized
usb: dwc2: Fix INTR OUT transfers in DDMA mode.
* nl80211: fix non-split wiphy information
net/wireless/nl80211.c
* usb: gadget: u_ether: enable qmult on SuperSpeed Plus as well
drivers/usb/gadget/function/u_ether.c
* usb: gadget: f_ncm: fix ncm_bitrate for SuperSpeed and above.
drivers/usb/gadget/function/f_ncm.c
iwlwifi: mvm: split a print to avoid a WARNING in ROC
mfd: sm501: Fix leaks in probe()
net: enic: Cure the enic api locking trainwreck
qtnfmac: fix resource leaks on unsupported iftype error return path
* HID: hid-input: fix stylus battery reporting
drivers/hid/hid-input.c
slimbus: qcom-ngd-ctrl: disable ngd in qmi server down callback
slimbus: core: do not enter to clock pause mode in core
slimbus: core: check get_addr before removing laddr ida
* quota: clear padding in v2r1_mem2diskdqb()
fs/quota/quota_v2.c
usb: dwc2: Fix parameter type in function pointer prototype
ALSA: seq: oss: Avoid mutex lock for a long-time ioctl
misc: mic: scif: Fix error handling path
ath6kl: wmi: prevent a shift wrapping bug in ath6kl_wmi_delete_pstream_cmd()
net: dsa: rtl8366rb: Support all 4096 VLANs
net: dsa: rtl8366: Skip PVID setting if not requested
net: dsa: rtl8366: Refactor VLAN/PVID init
net: dsa: rtl8366: Check validity of passed VLANs
cpufreq: armada-37xx: Add missing MODULE_DEVICE_TABLE
net: stmmac: use netif_tx_start|stop_all_queues() function
net/mlx5: Don't call timecounter cyc2time directly from 1PPS flow
pinctrl: mcp23s08: Fix mcp23x17 precious range
pinctrl: mcp23s08: Fix mcp23x17_regmap initialiser
HID: roccat: add bounds checking in kone_sysfs_write_settings()
video: fbdev: radeon: Fix memleak in radeonfb_pci_register
video: fbdev: sis: fix null ptr dereference
video: fbdev: vga16fb: fix setting of pixclock because a pass-by-value error
drivers/virt/fsl_hypervisor: Fix error handling path
pwm: lpss: Add range limit check for the base_unit register value
pwm: lpss: Fix off by one error in base_unit math in pwm_lpss_prepare()
* pty: do tty_flip_buffer_push without port->lock in pty_write
drivers/tty/pty.c
tty: hvcs: Don't NULL tty->driver_data until hvcs_cleanup()
* tty: serial: earlycon dependency
drivers/tty/serial/Kconfig
VMCI: check return value of get_user_pages_fast() for errors
backlight: sky81452-backlight: Fix refcount imbalance on error
scsi: csiostor: Fix wrong return value in csio_hw_prep_fw()
scsi: qla2xxx: Fix wrong return value in qla_nvme_register_hba()
scsi: qla4xxx: Fix an error handling path in 'qla4xxx_get_host_stats()'
drm/gma500: fix error check
staging: rtl8192u: Do not use GFP_KERNEL in atomic context
mwifiex: Do not use GFP_KERNEL in atomic context
brcmfmac: check ndev pointer
ASoC: qcom: lpass-cpu: fix concurrency issue
ASoC: qcom: lpass-platform: fix memory leak
wcn36xx: Fix reported 802.11n rx_highest rate wcn3660/wcn3680
ath10k: Fix the size used in a 'dma_free_coherent()' call in an error handling path
ath9k: Fix potential out of bounds in ath9k_htc_txcompletion_cb()
ath6kl: prevent potential array overflow in ath6kl_add_new_sta()
Bluetooth: hci_uart: Cancel init work before unregistering
ath10k: provide survey info as accumulated data
spi: spi-s3c64xx: Check return values
spi: spi-s3c64xx: swap s3c64xx_spi_set_cs() and s3c64xx_enable_datapath()
* pinctrl: bcm: fix kconfig dependency warning when !GPIOLIB
drivers/pinctrl/bcm/Kconfig
* regulator: resolve supply after creating regulator
drivers/regulator/core.c
media: ti-vpe: Fix a missing check and reference count leak
media: stm32-dcmi: Fix a reference count leak
media: s5p-mfc: Fix a reference count leak
media: camss: Fix a reference count leak.
media: platform: fcp: Fix a reference count leak.
media: rockchip/rga: Fix a reference count leak.
media: rcar-vin: Fix a reference count leak.
media: tc358743: cleanup tc358743_cec_isr
media: tc358743: initialize variable
media: mx2_emmaprp: Fix memleak in emmaprp_probe
cypto: mediatek - fix leaks in mtk_desc_ring_alloc
hwmon: (pmbus/max34440) Fix status register reads for MAX344{51,60,61}
crypto: omap-sham - fix digcnt register handling with export/import
media: omap3isp: Fix memleak in isp_probe
media: uvcvideo: Silence shift-out-of-bounds warning
media: uvcvideo: Set media controller entity functions
media: m5mols: Check function pointer in m5mols_sensor_power
media: Revert "media: exynos4-is: Add missed check for pinctrl_lookup_state()"
media: tuner-simple: fix regression in simple_set_radio_freq
crypto: picoxcell - Fix potential race condition bug
crypto: ixp4xx - Fix the size used in a 'dma_free_coherent()' call
crypto: mediatek - Fix wrong return value in mtk_desc_ring_alloc()
crypto: algif_skcipher - EBUSY on aio should be an error
x86/events/amd/iommu: Fix sizeof mismatch
x86/nmi: Fix nmi_handle() duration miscalculation
drivers/perf: xgene_pmu: Fix uninitialized resource struct
x86/fpu: Allow multiple bits in clearcpuid= parameter
EDAC/ti: Fix handling of platform_get_irq() error
EDAC/i5100: Fix error handling order in i5100_init_one()
crypto: algif_aead - Do not set MAY_BACKLOG on the async path
ima: Don't ignore errors from crypto_shash_update()
KVM: SVM: Initialize prev_ga_tag before use
KVM: x86/mmu: Commit zap of remaining invalid pages when recovering lpages
cifs: Return the error from crypt_message when enc/dec key not found.
cifs: remove bogus debug code
ALSA: hda/realtek: Enable audio jacks of ASUS D700SA with ALC887
* icmp: randomize the global rate limiter
net/ipv4/icmp.c
r8169: fix operation under forced interrupt threading
* tcp: fix to update snd_wl1 in bulk receiver fast path
net/ipv4/tcp_input.c
nfc: Ensure presence of NFC_ATTR_FIRMWARE_NAME attribute in nfc_genl_fw_download()
net/sched: act_tunnel_key: fix OOB write in case of IPv6 ERSPAN tunnels
net: hdlc_raw_eth: Clear the IFF_TX_SKB_SHARING flag after calling ether_setup
net: hdlc: In hdlc_rcv, check to make sure dev is an HDLC device
chelsio/chtls: correct function return and return type
chelsio/chtls: correct netdevice for vlan interface
chelsio/chtls: fix socket lock
ALSA: bebob: potential info leak in hwdep_read()
* binder: fix UAF when releasing todo list
drivers/android/binder.c
net/tls: sendfile fails with ktls offload
r8169: fix data corruption issue on RTL8402
* net/ipv4: always honour route mtu during forwarding
include/net/ip.h
* tipc: fix the skb_unshare() in tipc_buf_append()
net/tipc/msg.c
net: usb: qmi_wwan: add Cellient MPL200 card
net/smc: fix valid DMBE buffer sizes
* net: fix pos incrementment in ipv6_route_seq_next
net/ipv6/ip6_fib.c
net: fec: Fix PHY init after phy_reset_after_clk_enable()
net: fec: Fix phy_device lookup for phy_reset_after_clk_enable()
mlx4: handle non-napi callers to napi_poll
* ipv4: Restore flowi4_oif update before call to xfrm_lookup_route
net/ipv4/route.c
ibmveth: Identify ingress large send packets.
ibmveth: Switch order of ibmveth_helper calls.
ANDROID: clang: update to 11.0.5
* FROMLIST: arm64: link with -z norelro regardless of CONFIG_RELOCATABLE
arch/arm64/Makefile
ANDROID: GKI: enable CONFIG_WIREGUARD
UPSTREAM: wireguard: peerlookup: take lock before checking hash in replace operation
UPSTREAM: wireguard: noise: take lock when removing handshake entry from table
UPSTREAM: wireguard: queueing: make use of ip_tunnel_parse_protocol
* UPSTREAM: net: ip_tunnel: add header_ops for layer 3 devices
include/net/ip_tunnels.h
net/ipv4/ip_tunnel_core.c
UPSTREAM: wireguard: receive: account for napi_gro_receive never returning GRO_DROP
UPSTREAM: wireguard: device: avoid circular netns references
UPSTREAM: wireguard: noise: do not assign initiation time in if condition
UPSTREAM: wireguard: noise: separate receive counter from send counter
UPSTREAM: wireguard: queueing: preserve flow hash across packet scrubbing
UPSTREAM: wireguard: noise: read preshared key while taking lock
UPSTREAM: wireguard: selftests: use newer iproute2 for gcc-10
UPSTREAM: wireguard: send/receive: use explicit unlikely branch instead of implicit coalescing
UPSTREAM: wireguard: selftests: initalize ipv6 members to NULL to squelch clang warning
UPSTREAM: wireguard: send/receive: cond_resched() when processing worker ringbuffers
UPSTREAM: wireguard: socket: remove errant restriction on looping to self
UPSTREAM: wireguard: selftests: use normal kernel stack size on ppc64
UPSTREAM: wireguard: receive: use tunnel helpers for decapsulating ECN markings
UPSTREAM: wireguard: queueing: cleanup ptr_ring in error path of packet_queue_init
UPSTREAM: wireguard: send: remove errant newline from packet_encrypt_worker
UPSTREAM: wireguard: noise: error out precomputed DH during handshake rather than config
UPSTREAM: wireguard: receive: remove dead code from default packet type case
UPSTREAM: wireguard: queueing: account for skb->protocol==0
UPSTREAM: wireguard: selftests: remove duplicated include <sys/types.h>
UPSTREAM: wireguard: socket: remove extra call to synchronize_net
UPSTREAM: wireguard: send: account for mtu=0 devices
UPSTREAM: wireguard: receive: reset last_under_load to zero
UPSTREAM: wireguard: selftests: reduce complexity and fix make races
UPSTREAM: wireguard: device: use icmp_ndo_send helper
UPSTREAM: wireguard: selftests: tie socket waiting to target pid
UPSTREAM: wireguard: selftests: ensure non-addition of peers with failed precomputation
UPSTREAM: wireguard: noise: reject peers with low order public keys
UPSTREAM: wireguard: allowedips: fix use-after-free in root_remove_peer_lists
* UPSTREAM: net: skbuff: disambiguate argument and member for skb_list_walk_safe helper
include/linux/skbuff.h
* UPSTREAM: net: introduce skb_list_walk_safe for skb segment walking
include/linux/skbuff.h
UPSTREAM: wireguard: socket: mark skbs as not on list when receiving via gro
UPSTREAM: wireguard: queueing: do not account for pfmemalloc when clearing skb header
UPSTREAM: wireguard: selftests: remove ancient kernel compatibility code
UPSTREAM: wireguard: allowedips: use kfree_rcu() instead of call_rcu()
UPSTREAM: wireguard: main: remove unused include <linux/version.h>
* UPSTREAM: wireguard: global: fix spelling mistakes in comments
include/uapi/linux/wireguard.h
* UPSTREAM: wireguard: Kconfig: select parent dependency for crypto
drivers/net/Kconfig
UPSTREAM: wireguard: selftests: import harness makefile for test suite
* UPSTREAM: net: WireGuard secure network tunnel
drivers/net/Kconfig
drivers/net/Makefile
include/uapi/linux/wireguard.h
* UPSTREAM: timekeeping: Boot should be boottime for coarse ns accessor
include/linux/timekeeping.h
* UPSTREAM: timekeeping: Add missing _ns functions for coarse accessors
include/linux/timekeeping.h
* UPSTREAM: icmp: introduce helper for nat'd source address in network device context
include/linux/icmpv6.h
include/net/icmp.h
net/ipv4/icmp.c
net/ipv6/ip6_icmp.c
UPSTREAM: crypto: poly1305-x86_64 - Use XORL r32,32
UPSTREAM: crypto: curve25519-x86_64 - Use XORL r32,32
UPSTREAM: crypto: arm/poly1305 - Add prototype for poly1305_blocks_neon
UPSTREAM: crypto: arm/curve25519 - include <linux/scatterlist.h>
UPSTREAM: crypto: x86/curve25519 - Remove unused carry variables
* UPSTREAM: crypto: x86/chacha-sse3 - use unaligned loads for state array
include/crypto/chacha.h
* UPSTREAM: crypto: lib/chacha20poly1305 - Add missing function declaration
include/crypto/chacha20poly1305.h
UPSTREAM: crypto: arch/lib - limit simd usage to 4k chunks
UPSTREAM: crypto: arm[64]/poly1305 - add artifact to .gitignore files
UPSTREAM: crypto: x86/curve25519 - leave r12 as spare register
UPSTREAM: crypto: x86/curve25519 - replace with formally verified implementation
UPSTREAM: crypto: arm64/chacha - correctly walk through blocks
* UPSTREAM: crypto: x86/curve25519 - support assemblers with no adx support
include/crypto/curve25519.h
UPSTREAM: crypto: chacha20poly1305 - prevent integer overflow on large input
* UPSTREAM: crypto: Kconfig - allow tests to be disabled when manager is disabled
crypto/Kconfig
UPSTREAM: crypto: arm/chacha - fix build failured when kernel mode NEON is disabled
UPSTREAM: crypto: x86/poly1305 - emit does base conversion itself
UPSTREAM: crypto: chacha20poly1305 - add back missing test vectors and test chunking
UPSTREAM: crypto: x86/poly1305 - fix .gitignore typo
* UPSTREAM: crypto: curve25519 - Fix selftest build error
lib/crypto/Makefile
UPSTREAM: crypto: {arm,arm64,mips}/poly1305 - remove redundant non-reduction from emit
* UPSTREAM: crypto: x86/poly1305 - wire up faster implementations for kernel
lib/crypto/Kconfig
UPSTREAM: crypto: x86/poly1305 - import unmodified cryptogams implementation
* UPSTREAM: crypto: poly1305 - add new 32 and 64-bit generic versions
include/crypto/internal/poly1305.h
include/crypto/nhpoly1305.h
include/crypto/poly1305.h
lib/crypto/Makefile
* UPSTREAM: crypto: lib/curve25519 - re-add selftests
lib/crypto/Makefile
UPSTREAM: crypto: arm/curve25519 - add arch-specific key generation function
* UPSTREAM: crypto: chacha - fix warning message in header file
include/crypto/internal/chacha.h
UPSTREAM: crypto: arch - conditionalize crypto api in arch glue for lib code
UPSTREAM: crypto: lib/chacha20poly1305 - use chacha20_crypt()
UPSTREAM: crypto: x86/chacha - only unregister algorithms if registered
UPSTREAM: crypto: chacha_generic - remove unnecessary setkey() functions
* UPSTREAM: crypto: lib/chacha20poly1305 - reimplement crypt_from_sg() routine
include/crypto/chacha20poly1305.h
* UPSTREAM: crypto: chacha20poly1305 - import construction and selftest from Zinc
include/crypto/chacha20poly1305.h
lib/crypto/Kconfig
lib/crypto/Makefile
UPSTREAM: crypto: arm/curve25519 - wire up NEON implementation
UPSTREAM: crypto: arm/curve25519 - import Bernstein and Schwabe's Curve25519 ARM implementation
* UPSTREAM: crypto: curve25519 - x86_64 library and KPP implementations
crypto/Kconfig
UPSTREAM: crypto: lib/curve25519 - work around Clang stack spilling issue
* UPSTREAM: crypto: curve25519 - implement generic KPP driver
crypto/Kconfig
crypto/Makefile
* UPSTREAM: crypto: curve25519 - add kpp selftest
crypto/testmgr.c
* UPSTREAM: crypto: curve25519 - generic C library implementations
include/crypto/curve25519.h
lib/crypto/Kconfig
lib/crypto/Makefile
* UPSTREAM: crypto: blake2s - x86_64 SIMD implementation
crypto/Kconfig
* UPSTREAM: crypto: blake2s - implement generic shash driver
crypto/Kconfig
crypto/Makefile
include/crypto/internal/blake2s.h
* UPSTREAM: crypto: testmgr - add test cases for Blake2s
crypto/testmgr.c
* UPSTREAM: crypto: blake2s - generic C library implementation and selftest
include/crypto/blake2s.h
include/crypto/internal/blake2s.h
lib/crypto/Kconfig
lib/crypto/Makefile
* UPSTREAM: crypto: mips/poly1305 - incorporate OpenSSL/CRYPTOGAMS optimized implementation
crypto/Kconfig
lib/crypto/Kconfig
* UPSTREAM: crypto: arm/poly1305 - incorporate OpenSSL/CRYPTOGAMS NEON implementation
lib/crypto/Kconfig
* UPSTREAM: crypto: arm64/poly1305 - incorporate OpenSSL/CRYPTOGAMS NEON implementation
arch/arm64/crypto/Kconfig
arch/arm64/crypto/Makefile
lib/crypto/Kconfig
* UPSTREAM: crypto: x86/poly1305 - expose existing driver as poly1305 library
crypto/Kconfig
lib/crypto/Kconfig
* UPSTREAM: crypto: x86/poly1305 - depend on generic library not generic shash
crypto/Kconfig
include/crypto/internal/poly1305.h
* UPSTREAM: crypto: poly1305 - expose init/update/final library interface
include/crypto/poly1305.h
lib/crypto/Kconfig
* UPSTREAM: crypto: x86/poly1305 - unify Poly1305 state struct with generic code
include/crypto/internal/poly1305.h
include/crypto/poly1305.h
* UPSTREAM: crypto: poly1305 - move core routines into a separate library
crypto/Kconfig
include/crypto/internal/poly1305.h
include/crypto/poly1305.h
lib/crypto/Kconfig
lib/crypto/Makefile
* UPSTREAM: crypto: chacha - unexport chacha_generic routines
include/crypto/internal/chacha.h
* UPSTREAM: crypto: mips/chacha - wire up accelerated 32r2 code from Zinc
crypto/Kconfig
UPSTREAM: crypto: mips/chacha - import 32r2 ChaCha code from Zinc
UPSTREAM: crypto: arm/chacha - expose ARM ChaCha routine as library function
UPSTREAM: crypto: arm/chacha - remove dependency on generic ChaCha driver
UPSTREAM: crypto: arm/chacha - import Eric Biggers's scalar accelerated ChaCha code
* UPSTREAM: crypto: arm64/chacha - expose arm64 ChaCha routine as library function
arch/arm64/crypto/Kconfig
* UPSTREAM: crypto: arm64/chacha - depend on generic chacha library instead of crypto driver
arch/arm64/crypto/Kconfig
UPSTREAM: crypto: arm64/chacha - use combined SIMD/ALU routine for more speed
UPSTREAM: crypto: arm64/chacha - optimize for arbitrary length inputs
* UPSTREAM: crypto: x86/chacha - expose SIMD ChaCha routine as library function
crypto/Kconfig
include/crypto/chacha.h
* UPSTREAM: crypto: x86/chacha - depend on generic chacha library instead of crypto driver
crypto/Kconfig
* UPSTREAM: crypto: chacha - move existing library code into lib/crypto
crypto/Kconfig
include/crypto/chacha.h
include/crypto/internal/chacha.h
lib/Makefile
lib/crypto/Kconfig
lib/crypto/Makefile
* UPSTREAM: crypto: lib - tidy up lib/crypto Kconfig and Makefile
crypto/Kconfig
lib/Makefile
lib/crypto/Kconfig
lib/crypto/Makefile
* UPSTREAM: crypto: chacha - constify ctx and iv arguments
include/crypto/chacha.h
UPSTREAM: crypto: x86/poly1305 - Clear key material from stack in SSE2 variant
UPSTREAM: crypto: xchacha20 - fix comments for test vectors
UPSTREAM: crypto: xchacha - add test vector from XChaCha20 draft RFC
* UPSTREAM: crypto: arm64/chacha - add XChaCha12 support
arch/arm64/crypto/Kconfig
* UPSTREAM: crypto: arm64/chacha20 - refactor to allow varying number of rounds
arch/arm64/crypto/Makefile
* UPSTREAM: crypto: arm64/chacha20 - add XChaCha20 support
arch/arm64/crypto/Kconfig
UPSTREAM: crypto: x86/chacha - avoid sleeping under kernel_fpu_begin()
UPSTREAM: crypto: x86/chacha - yield the FPU occasionally
* UPSTREAM: crypto: x86/chacha - add XChaCha12 support
crypto/Kconfig
UPSTREAM: crypto: x86/chacha20 - refactor to allow varying number of rounds
* UPSTREAM: crypto: x86/chacha20 - add XChaCha20 support
crypto/Kconfig
UPSTREAM: crypto: x86/chacha20 - Add a 4-block AVX-512VL variant
UPSTREAM: crypto: x86/chacha20 - Add a 2-block AVX-512VL variant
UPSTREAM: crypto: x86/chacha20 - Add a 8-block AVX-512VL variant
UPSTREAM: crypto: x86/chacha20 - Add a 4-block AVX2 variant
UPSTREAM: crypto: x86/chacha20 - Add a 2-block AVX2 variant
UPSTREAM: crypto: x86/chacha20 - Use larger block functions more aggressively
UPSTREAM: crypto: x86/chacha20 - Support partial lengths in 8-block AVX2 variant
UPSTREAM: crypto: x86/chacha20 - Support partial lengths in 4-block SSSE3 variant
UPSTREAM: crypto: x86/chacha20 - Support partial lengths in 1-block SSSE3 variant
ANDROID: GKI: Enable CONFIG_USB_ANNOUNCE_NEW_DEVICES
ANDROID: GKI: Enable CONFIG_X86_X2APIC
ANDROID: move builds to use gas prebuilts
* UPSTREAM: binder: fix UAF when releasing todo list
drivers/android/binder.c
Merge 4.19.152 into android-4.19-stable
Linux 4.19.152
crypto: qat - check cipher length for aead AES-CBC-HMAC-SHA
crypto: bcm - Verify GCM/CCM key length in setkey
drivers/net/ethernet/marvell/mvmdio.c: Fix non OF case
reiserfs: Fix oops during mount
reiserfs: Initialize inode keys properly
USB: serial: ftdi_sio: add support for FreeCalypso JTAG+UART adapters
USB: serial: pl2303: add device-id for HP GC device
staging: comedi: check validity of wMaxPacketSize of usb endpoints found
USB: serial: option: Add Telit FT980-KS composition
USB: serial: option: add Cellient MPL200 card
media: usbtv: Fix refcounting mixup
* Bluetooth: Disconnect if E0 is used for Level 4
include/net/bluetooth/hci_core.h
net/bluetooth/hci_conn.c
net/bluetooth/hci_event.c
* Bluetooth: Fix update of connection state in `hci_encrypt_cfm`
include/net/bluetooth/hci_core.h
* Bluetooth: Consolidate encryption handling in hci_encrypt_cfm
include/net/bluetooth/hci_core.h
net/bluetooth/hci_event.c
* Bluetooth: MGMT: Fix not checking if BT_HS is enabled
net/bluetooth/mgmt.c
* Bluetooth: L2CAP: Fix calling sk_filter on non-socket based channel
include/net/bluetooth/l2cap.h
net/bluetooth/l2cap_core.c
net/bluetooth/l2cap_sock.c
* Bluetooth: A2MP: Fix not initializing all members
net/bluetooth/a2mp.c
ARM: 8867/1: vdso: pass --be8 to linker if necessary
ARM: 8939/1: kbuild: use correct nm executable
ARM: 8858/1: vdso: use $(LD) instead of $(CC) to link VDSO
perf cs-etm: Move definition of 'traceid_list' global variable from header file
* FROMLIST: arm64: vdso32: Allow ld.lld to properly link the VDSO
arch/arm64/kernel/vdso32/Makefile
Merge 4.19.151 into android-4.19-stable
Linux 4.19.151
* net: usb: rtl8150: set random MAC address when set_ethernet_addr() fails
drivers/net/usb/rtl8150.c
* mm: khugepaged: recalculate min_free_kbytes after memory hotplug as expected by khugepaged
include/linux/khugepaged.h
mm/page_alloc.c
mmc: core: don't set limits.discard_granularity as 0
* perf: Fix task_function_call() error handling
kernel/events/core.c
rxrpc: Fix server keyring leak
rxrpc: Fix some missing _bh annotations on locking conn->state_lock
rxrpc: Downgrade the BUG() for unsupported token type in rxrpc_read()
rxrpc: Fix rxkad token xdr encoding
net/mlx5e: Fix VLAN create flow
net/mlx5e: Fix VLAN cleanup flow
* net: usb: ax88179_178a: fix missing stop entry in driver_info
drivers/net/usb/ax88179_178a.c
* mdio: fix mdio-thunder.c dependency & build error
drivers/net/phy/Kconfig
* bonding: set dev->needed_headroom in bond_setup_by_slave()
drivers/net/bonding/bond_main.c
* xfrm: Use correct address family in xfrm_state_find
net/xfrm/xfrm_state.c
* platform/x86: fix kconfig dependency warning for FUJITSU_LAPTOP
drivers/platform/x86/Kconfig
net: stmmac: removed enabling eee in EEE set callback
* xfrm: clone whole liftime_cur structure in xfrm_do_migrate
net/xfrm/xfrm_state.c
* xfrm: clone XFRMA_SEC_CTX in xfrm_do_migrate
net/xfrm/xfrm_state.c
* xfrm: clone XFRMA_REPLAY_ESN_VAL in xfrm_do_migrate
include/net/xfrm.h
* xfrm: clone XFRMA_SET_MARK in xfrm_do_migrate
net/xfrm/xfrm_state.c
drm/amdgpu: prevent double kfree ttm->sg
openvswitch: handle DNAT tuple collision
net: team: fix memory leak in __team_options_register
team: set dev->needed_headroom in team_setup_by_port()
* sctp: fix sctp_auth_init_hmacs() error path
net/sctp/auth.c
i2c: owl: Clear NACK and BUS error bits
i2c: meson: fixup rate calculation with filter delay
i2c: meson: fix clock setting overwrite
cifs: Fix incomplete memory allocation on setxattr path
* xfrmi: drop ignore_df check before updating pmtu
net/xfrm/xfrm_interface.c
mm/khugepaged: fix filemap page_to_pgoff(page) != offset
macsec: avoid use-after-free in macsec_handle_frame()
nvme-core: put ctrl ref when module ref get fail
arm64: dts: stratix10: add status to qspi dts node
mtd: rawnand: sunxi: Fix the probe error path
i2c: i801: Exclude device from suspend direct complete optimization
perf top: Fix stdio interface input handling with glibc 2.28+
* driver core: Fix probe_count imbalance in really_probe()
drivers/base/dd.c
platform/x86: thinkpad_acpi: re-initialize ACPI buffer size when reuse
platform/x86: intel-vbtn: Switch to an allow-list for SW_TABLET_MODE reporting
platform/x86: thinkpad_acpi: initialize tp_nvram_state variable
platform/x86: intel-vbtn: Fix SW_TABLET_MODE always reporting 1 on the HP Pavilion 11 x360
* usermodehelper: reset umask to default before executing user process
kernel/umh.c
drm/nouveau/mem: guard against NULL pointer access in mem_del
* net: wireless: nl80211: fix out-of-bounds access in nl80211_del_key()
net/wireless/nl80211.c
Revert "ravb: Fixed to be able to unload modules"
fbcon: Fix global-out-of-bounds read in fbcon_get_font()
* Fonts: Support FONT_EXTRA_WORDS macros for built-in fonts
include/linux/font.h
* fbdev, newport_con: Move FONT_EXTRA_WORDS macros into linux/font.h
include/linux/font.h
Merge 4.19.150 into android-4.19-stable
Linux 4.19.150
* netfilter: ctnetlink: add a range check for l3/l4 protonum
net/netfilter/nf_conntrack_netlink.c
* ep_create_wakeup_source(): dentry name can change under you...
fs/eventpoll.c
* epoll: EPOLL_CTL_ADD: close the race in decision to take fast path
fs/eventpoll.c
* epoll: replace ->visited/visited_list with generation count
fs/eventpoll.c
* epoll: do not insert into poll queues until all sanity checks are done
fs/eventpoll.c
* net/packet: fix overflow in tpacket_rcv
net/packet/af_packet.c
* mm: don't rely on system state to detect hot-plug operations
include/linux/node.h
* mm: replace memmap_context by meminit_context
include/linux/mm.h
include/linux/mmzone.h
mm/page_alloc.c
* random32: Restore __latent_entropy attribute on net_rand_state
lib/random32.c
Input: trackpoint - enable Synaptics trackpoints
i2c: cpm: Fix i2c_ram structure
iommu/exynos: add missing put_device() call in exynos_iommu_of_xlate()
clk: samsung: exynos4: mark 'chipid' clock as CLK_IGNORE_UNUSED
nfs: Fix security label length not being reset
pinctrl: mvebu: Fix i2c sda definition for 98DX3236
gpio: sprd: Clear interrupt when setting the type as edge
nvme-fc: fail new connections to a deleted host or remote port
spi: fsl-espi: Only process interrupts for expected events
mac80211: do not allow bigger VHT MPDUs than the hardware supports
drivers/net/wan/hdlc: Set skb->protocol before transmitting
drivers/net/wan/lapbether: Make skb->protocol consistent with the header
nvme-core: get/put ctrl and transport module in nvme_dev_open/release()
rndis_host: increase sleep time in the query-response loop
net: dec: de2104x: Increase receive ring size for Tulip
drm/sun4i: mixer: Extend regmap max_register
drivers/net/wan/hdlc_fr: Add needed_headroom for PVC devices
drm/amdgpu: restore proper ref count in amdgpu_display_crtc_set_config
ftrace: Move RCU is watching check after recursion check
Input: i8042 - add nopnp quirk for Acer Aspire 5 A515
net: virtio_vsock: Enhance connection semantics
* vsock/virtio: add transport parameter to the virtio_transport_reset_no_sock()
include/linux/virtio_vsock.h
vsock/virtio: stop workers during the .remove()
vsock/virtio: use RCU to avoid use-after-free on the_virtio_vsock
clk: socfpga: stratix10: fix the divider for the emac_ptp_free_clk
gpio: tc35894: fix up tc35894 interrupt configuration
gpio: mockup: fix resource leak in error path
* USB: gadget: f_ncm: Fix NDP16 datagram validation
drivers/usb/gadget/function/f_ncm.c
mmc: sdhci: Workaround broken command queuing on Intel GLK based IRBIS models
ANDROID: use arm-linux-androidkernel- for CROSS_COMPILE_COMPAT
ANDROID: build.config.common: enable LLVM=1
Merge 4.19.149 into android-4.19-stable
Linux 4.19.149
* KVM: arm64: Assume write fault on S1PTW permission fault on instruction fetch
arch/arm64/include/asm/kvm_emulate.h
ata: sata_mv, avoid trigerrable BUG_ON
* ata: make qc_prep return ata_completion_errors
include/linux/libata.h
* ata: define AC_ERR_OK
include/linux/libata.h
kprobes: Fix compiler warning for !CONFIG_KPROBES_ON_FTRACE
s390/zcrypt: Fix ZCRYPT_PERDEV_REQCNT ioctl
* mm, THP, swap: fix allocating cluster for swapfile by mistake
mm/swapfile.c
kprobes: Fix to check probe enabled before disarm_kprobe_ftrace()
s390/dasd: Fix zero write for FBA devices
tracing: fix double free
KVM: SVM: Add a dedicated INVD intercept routine
KVM: x86: Reset MMU context if guest toggles CR4.SMAP or CR4.PKE
MIPS: Add the missing 'CPU_1074K' into __get_cpu_type()
* regmap: fix page selection for noinc reads
drivers/base/regmap/regmap.c
ALSA: asihpi: fix iounmap in error handler
* bpf: Fix a rcu warning for bpffs map pretty-print
kernel/bpf/inode.c
batman-adv: mcast: fix duplicate mcast packets from BLA backbone to mesh
batman-adv: mcast: fix duplicate mcast packets in BLA backbone from mesh
batman-adv: Add missing include for in_interrupt()
drm/sun4i: sun8i-csc: Secondary CSC register correction
net: qed: RDMA personality shouldn't fail VF load
drm/vc4/vc4_hdmi: fill ASoC card owner
* bpf: Fix clobbering of r2 in bpf_gen_ld_abs
net/core/filter.c
mac802154: tx: fix use-after-free
batman-adv: mcast/TT: fix wrongly dropped or rerouted packets
atm: eni: fix the missed pci_disable_device() for eni_init_one()
batman-adv: bla: fix type misuse for backbone_gw hash indexing
mwifiex: Increase AES key storage size to 256 bits
clocksource/drivers/h8300_timer8: Fix wrong return value in h8300_8timer_init()
ieee802154/adf7242: check status of adf7242_read_reg
ieee802154: fix one possible memleak in ca8210_dev_com_init
objtool: Fix noreturn detection for ignored functions
* i2c: core: Call i2c_acpi_install_space_handler() before i2c_acpi_register_devices()
drivers/i2c/i2c-core-base.c
drm/amdkfd: fix a memory leak issue
lockdep: fix order in trace_hardirqs_off_caller()
s390/init: add missing __init annotations
RISC-V: Take text_mutex in ftrace_init_nop()
ASoC: Intel: bytcr_rt5640: Add quirk for MPMAN Converter9 2-in-1
ASoC: wm8994: Ensure the device is resumed in wm89xx_mic_detect functions
ASoC: wm8994: Skip setting of the WM8994_MICBIAS register for WM1811
nvme: explicitly update mpath disk capacity on revalidation
net: openvswitch: use div_u64() for 64-by-32 divisions
perf parse-events: Use strcmp() to compare the PMU name
ubi: fastmap: Free unused fastmap anchor peb during detach
btrfs: qgroup: fix data leak caused by race between writeback and truncate
vfio/pci: fix racy on error and request eventfd ctx
selftests/x86/syscall_nt: Clear weird flags after each test
scsi: libfc: Skip additional kref updating work event
scsi: libfc: Handling of extra kref
nvme: fix possible deadlock when I/O is blocked
cifs: Fix double add page to memcg when cifs_readpages
vfio/pci: Clear error and request eventfd ctx after releasing
x86/speculation/mds: Mark mds_user_clear_cpu_buffers() __always_inline
mtd: parser: cmdline: Support MTD names containing one or more colons
rapidio: avoid data race between file operation callbacks and mport_cdev_add().
* mm/swap_state: fix a data race in swapin_nr_pages
mm/swap_state.c
ceph: fix potential race in ceph_check_caps
PCI: tegra: Fix runtime PM imbalance on error
mtd: rawnand: omap_elm: Fix runtime PM imbalance on error
wlcore: fix runtime pm imbalance in wlcore_regdomain_config
wlcore: fix runtime pm imbalance in wl1271_tx_work
ASoC: img-i2s-out: Fix runtime PM imbalance on error
perf kcore_copy: Fix module map when there are no modules loaded
perf metricgroup: Free metric_events on error
perf util: Fix memory leak of prefix_if_not_in
perf stat: Fix duration_time value for higher intervals
perf trace: Fix the selection for architectures to generate the errno name tables
perf evsel: Fix 2 memory leaks
vfio/pci: fix memory leaks of eventfd ctx
btrfs: don't force read-only after error in drop snapshot
* usb: dwc3: Increase timeout for CmdAct cleared by device controller
drivers/usb/dwc3/gadget.c
* printk: handle blank console arguments passed in.
kernel/printk/printk.c
drm/nouveau/dispnv50: fix runtime pm imbalance on error
drm/nouveau: fix runtime pm imbalance on error
drm/nouveau/debugfs: fix runtime pm imbalance on error
e1000: Do not perform reset in reset_task if we are already down
* arm64/cpufeature: Drop TraceFilt feature exposure from ID_DFR0 register
arch/arm64/kernel/cpufeature.c
scsi: cxlflash: Fix error return code in cxlflash_probe()
USB: EHCI: ehci-mv: fix less than zero comparison of an unsigned int
* fuse: don't check refcount after stealing page
fs/fuse/dev.c
powerpc/traps: Make unrecoverable NMIs die instead of panic
ALSA: hda: Fix potential race in unsol event handler
tty: serial: samsung: Correct clock selection logic
* tipc: fix memory leak in service subscripting
net/tipc/topsrv.c
USB: EHCI: ehci-mv: fix error handling in mv_ehci_probe()
* Bluetooth: Handle Inquiry Cancel error after Inquiry Complete
net/bluetooth/hci_event.c
phy: samsung: s5pv210-usb2: Add delay after reset
power: supply: max17040: Correct voltage reading
perf mem2node: Avoid double free related to realloc
atm: fix a memory leak of vcc->user_back
dt-bindings: sound: wm8994: Correct required supplies based on actual implementaion
* arm64: cpufeature: Relax checks for AArch32 support at EL[0-2]
arch/arm64/kernel/cpufeature.c
sparc64: vcc: Fix error return code in vcc_probe()
staging:r8188eu: avoid skb_clone for amsdu to msdu conversion
scsi: aacraid: Fix error handling paths in aac_probe_one()
net: openvswitch: use u64 for meter bucket
KVM: arm64: vgic-its: Fix memory leak on the error path of vgic_add_lpi()
drivers: char: tlclk.c: Avoid data race between init and interrupt handler
* bdev: Reduce time holding bd_mutex in sync in blkdev_close()
fs/block_dev.c
KVM: Remove CREATE_IRQCHIP/SET_PIT2 race
serial: uartps: Wait for tx_empty in console setup
scsi: qedi: Fix termination timeouts in session logout
* mm/mmap.c: initialize align_offset explicitly for vm_unmapped_area
mm/mmap.c
nvmet-rdma: fix double free of rdma queue
* mm/vmscan.c: fix data races using kswapd_classzone_idx
mm/vmscan.c
* mm/filemap.c: clear page error before actual read
mm/filemap.c
mm/kmemleak.c: use address-of operator on section symbols
* NFS: Fix races nfs_page_group_destroy() vs nfs_destroy_unlinked_subrequests()
include/linux/nfs_page.h
PCI: pciehp: Fix MSI interrupt race
* ALSA: usb-audio: Fix case when USB MIDI interface has more than one extra endpoint descriptor
sound/usb/midi.c
ubifs: Fix out-of-bounds memory access caused by abnormal value of node_len
* PCI: Use ioremap(), not phys_to_virt() for platform ROM
drivers/pci/rom.c
include/linux/pci.h
svcrdma: Fix leak of transport addresses
SUNRPC: Fix a potential buffer overflow in 'svc_print_xprts()'
scsi: hpsa: correct race condition in offload enabled
RDMA/rxe: Set sys_image_guid to be aligned with HW IB devices
nvme: Fix controller creation races with teardown flow
nvme-multipath: do not reset on unknown status
tools: gpio-hammer: Avoid potential overflow in main
cpufreq: powernv: Fix frame-size-overflow in powernv_cpufreq_work_fn
perf cpumap: Fix snprintf overflow check
serial: 8250: 8250_omap: Terminate DMA before pushing data on RX timeout
serial: 8250_omap: Fix sleeping function called from invalid context during probe
serial: 8250_port: Don't service RX FIFO if throttled
perf parse-events: Fix 3 use after frees found with clang ASAN
thermal: rcar_thermal: Handle probe error gracefully
* tracing: Use address-of operator on section symbols
kernel/trace/trace.c
drm/msm/a5xx: Always set an OPP supported hardware value
drm/msm: fix leaks if initialization fails
KVM: PPC: Book3S HV: Treat TM-related invalid form instructions on P9 like the valid ones
RDMA/cm: Remove a race freeing timewait_info
nfsd: Don't add locks to closed or closing open stateids
rtc: ds1374: fix possible race condition
rtc: sa1100: fix possible race condition
tpm: ibmvtpm: Wait for buffer to be set before proceeding
* ext4: mark block bitmap corrupted when found instead of BUGON
fs/ext4/mballoc.c
xfs: mark dir corrupt when lookup-by-hash fails
xfs: don't ever return a stale pointer from __xfs_dir3_free_read
media: tda10071: fix unsigned sign extension overflow
* Bluetooth: L2CAP: handle l2cap config request during open state
net/bluetooth/l2cap_core.c
scsi: aacraid: Disabling TM path and only processing IOP reset
ath10k: use kzalloc to read for ath10k_sdio_hif_diag_read
drm/amd/display: Stop if retimer is not available
drm/amdgpu: increase atombios cmd timeout
* mm: avoid data corruption on CoW fault into PFN-mapped VMA
mm/memory.c
perf jevents: Fix leak of mapfile memory
* ext4: fix a data race at inode->i_disksize
fs/ext4/inode.c
* timekeeping: Prevent 32bit truncation in scale64_check_overflow()
kernel/time/timekeeping.c
* Bluetooth: guard against controllers sending zero'd events
net/bluetooth/hci_event.c
media: go7007: Fix URB type for interrupt handling
bus: hisi_lpc: Fixup IO ports addresses to avoid use-after-free in host removal
* random: fix data races at timer_rand_state
drivers/char/random.c
firmware: arm_sdei: Use cpus_read_lock() to avoid races with cpuhp
drm/amd/display: dal_ddc_i2c_payloads_create can fail causing panic
dmaengine: tegra-apb: Prevent race conditions on channel's freeing
dmaengine: stm32-dma: use vchan_terminate_vdesc() in .terminate_all
* bpf: Remove recursion prevention from rcu free callback
kernel/bpf/hashtab.c
x86/pkeys: Add check for pkey "overflow"
media: staging/imx: Missing assignment in imx_media_capture_device_register()
dmaengine: stm32-mdma: use vchan_terminate_vdesc() in .terminate_all
KVM: x86: fix incorrect comparison in trace event
RDMA/rxe: Fix configuration of atomic queue pair attributes
perf test: Fix test trace+probe_vfs_getname.sh on s390
* ALSA: usb-audio: Don't create a mixer element with bogus volume range
sound/usb/mixer.c
mt76: clear skb pointers from rx aggregation reorder buffer during cleanup
crypto: chelsio - This fixes the kernel panic which occurs during a libkcapi test
clk: stratix10: use do_div() for 64-bit calculation
drm/omap: fix possible object reference leak
scsi: lpfc: Fix coverity errors in fmdi attribute handling
scsi: lpfc: Fix RQ buffer leakage when no IOCBs available
* selinux: sel_avc_get_stat_idx should increase position index
security/selinux/selinuxfs.c
* audit: CONFIG_CHANGE don't log internal bookkeeping as an event
kernel/audit_watch.c
* skbuff: fix a data race in skb_queue_len()
include/linux/skbuff.h
net/unix/af_unix.c
ALSA: hda: Clear RIRB status before reading WP
KVM: fix overflow of zero page refcount with ksm running
* Bluetooth: prefetch channel before killing sock
net/bluetooth/l2cap_sock.c
* mm: pagewalk: fix termination condition in walk_pte_range()
mm/pagewalk.c
* mm/swapfile.c: swap_next should increase position index
mm/swapfile.c
* Bluetooth: Fix refcount use-after-free issue
net/bluetooth/l2cap_core.c
net/bluetooth/l2cap_sock.c
tools/power/x86/intel_pstate_tracer: changes for python 3 compatibility
selftests/ftrace: fix glob selftest
ceph: ensure we have a new cap before continuing in fill_inode
ar5523: Add USB ID of SMCWUSBT-G2 wireless adapter
ARM: 8948/1: Prevent OOB access in stacktrace
* tracing: Set kernel_stack's caller size properly
kernel/trace/trace_entries.h
Bluetooth: btrtl: Use kvmalloc for FW allocations
powerpc/eeh: Only dump stack once if an MMIO loop is detected
s390/cpum_sf: Use kzalloc and minor changes
dmaengine: zynqmp_dma: fix burst length configuration
* scsi: ufs: Fix a race condition in the tracing code
drivers/scsi/ufs/ufshcd.c
* scsi: ufs: Make ufshcd_add_command_trace() easier to read
drivers/scsi/ufs/ufshcd.c
ACPI: EC: Reference count query handlers under lock
* sctp: move trace_sctp_probe_path into sctp_outq_sack
include/trace/events/sctp.h
net/sctp/outqueue.c
media: ti-vpe: cal: Restrict DMA to avoid memory corruption
* seqlock: Require WRITE_ONCE surrounding raw_seqcount_barrier
include/linux/seqlock.h
* ipv6_route_seq_next should increase position index
net/ipv6/ip6_fib.c
* rt_cpu_seq_next should increase position index
net/ipv4/route.c
* neigh_stat_seq_next() should increase position index
net/core/neighbour.c
xfs: fix log reservation overflows when allocating large rt extents
KVM: arm/arm64: vgic: Fix potential double free dist->spis in __kvm_vgic_destroy()
* kernel/sys.c: avoid copying possible padding bytes in copy_to_user
kernel/sys.c
ASoC: max98090: remove msleep in PLL unlocked workaround
CIFS: Properly process SMB3 lease breaks
* debugfs: Fix !DEBUG_FS debugfs_create_automount
include/linux/debugfs.h
scsi: pm80xx: Cleanup command when a reset times out
gfs2: clean up iopen glock mess in gfs2_create_inode
* mmc: core: Fix size overflow for mmc partitions
include/linux/mmc/card.h
ubi: Fix producing anchor PEBs
RDMA/iw_cgxb4: Fix an error handling path in 'c4iw_connect()'
xfs: fix attr leaf header freemap.size underflow
* fix dget_parent() fastpath race
fs/dcache.c
RDMA/i40iw: Fix potential use after free
RDMA/qedr: Fix potential use after free
dmaengine: mediatek: hsdma_probe: fixed a memory leak when devm_request_irq fails
bcache: fix a lost wake-up problem caused by mca_cannibalize_lock
* tracing: Adding NULL checks for trace_array descriptor pointer
kernel/trace/trace.c
kernel/trace/trace_events.c
tpm_crb: fix fTPM on AMD Zen+ CPUs
drm/amdgpu/powerplay/smu7: fix AVFS handling with custom powerplay table
* mfd: mfd-core: Protect against NULL call-back function pointer
drivers/mfd/mfd-core.c
mtd: cfi_cmdset_0002: don't free cfi->cfiq in error path of cfi_amdstd_setup()
drm/amdgpu/powerplay: fix AVFS handling with custom powerplay table
clk/ti/adpll: allocate room for terminating null
* net: silence data-races on sk_backlog.tail
include/net/sock.h
net/ipv4/tcp.c
scsi: lpfc: Fix kernel crash at lpfc_nvme_info_show during remote port bounce
scsi: fnic: fix use after free
PM / devfreq: tegra30: Fix integer overflow on CPU's freq max out
leds: mlxreg: Fix possible buffer overflow
* lib/string.c: implement stpcpy
lib/string.c
ALSA: hda/realtek: Enable front panel headset LED on Lenovo ThinkStation P520
ALSA: hda/realtek - Couldn't detect Mic if booting with headset plugged
* ALSA: usb-audio: Add delay quirk for H570e USB headsets
sound/usb/quirks.c
x86/ioapic: Unbreak check_timer()
arch/x86/lib/usercopy_64.c: fix __copy_user_flushcache() cache writeback
media: smiapp: Fix error handling at NVM reading
ASoC: kirkwood: fix IRQ error handling
gma/gma500: fix a memory disclosure bug due to uninitialized bytes
m68k: q40: Fix info-leak in rtc_ioctl
scsi: aacraid: fix illegal IO beyond last LBA
* mm: fix double page fault on arm64 if PTE_AF is cleared
mm/memory.c
ath10k: fix memory leak for tpc_stats_final
ath10k: fix array out-of-bounds access
* dma-fence: Serialise signal enabling (dma_fence_enable_sw_signaling)
drivers/dma-buf/dma-fence.c
* media: mc-device.c: fix memleak in media_device_register_entity
drivers/media/media-device.c
* selinux: allow labeling before policy is loaded
security/selinux/hooks.c
ANDROID: GKI: prevent removal of monitored symbols
ANDROID: Refresh ABI.xmls with libabigail 1.8.0-98bbf30d
Merge 4.19.148 into android-4.19-stable
Linux 4.19.148
serial: 8250: Avoid error message on reprobe
* tcp_bbr: adapt cwnd based on ack aggregation estimation
include/net/inet_connection_sock.h
tcp_bbr: refactor bbr_target_cwnd() for general inflight provisioning
* mm: memcg: fix memcg reclaim soft lockup
mm/vmscan.c
* kbuild: support LLVM=1 to switch the default tools to Clang/LLVM
Makefile
* kbuild: replace AS=clang with LLVM_IAS=1
Makefile
* kbuild: remove AS variable
Makefile
* x86/boot: kbuild: allow readelf executable to be specified
Makefile
net: wan: wanxl: use $(M68KCC) instead of $(M68KAS) for rebuilding firmware
* net: wan: wanxl: use allow to pass CROSS_COMPILE_M68k for rebuilding firmware
drivers/net/wan/Kconfig
Documentation/llvm: fix the name of llvm-size
Documentation/llvm: add documentation on building w/ Clang/LLVM
* kbuild: add OBJSIZE variable for the size tool
Makefile
MAINTAINERS: add CLANG/LLVM BUILD SUPPORT info
* ipv4: Update exception handling for multipath routes via same device
net/ipv4/route.c
* net: add __must_check to skb_put_padto()
include/linux/skbuff.h
* net: qrtr: check skb_put_padto() return value
net/qrtr/qrtr.c
* net: phy: Avoid NPD upon phy_detach() when driver is unbound
drivers/net/phy/phy_device.c
bnxt_en: Protect bnxt_set_eee() and bnxt_set_pauseparam() with mutex.
bnxt_en: return proper error codes in bnxt_show_temp
* tipc: use skb_unshare() instead in tipc_buf_append()
net/tipc/msg.c
* tipc: fix shutdown() of connection oriented socket
net/tipc/socket.c
* tipc: Fix memory leak in tipc_group_create_member()
net/tipc/group.c
nfp: use correct define to return NONE fec
* net: sch_generic: aviod concurrent reset and enqueue op for lockless qdisc
net/sched/sch_generic.c
* net: ipv6: fix kconfig dependency warning for IPV6_SEG6_HMAC
net/ipv6/Kconfig
net: dsa: rtl8366: Properly clear member config
net: DCB: Validate DCB_ATTR_DCB_BUFFER argument
* ipv6: avoid lockdep issue in fib6_del()
net/ipv6/ip6_fib.c
* ip: fix tos reflection in ack and reset packets
net/ipv4/ip_output.c
hdlc_ppp: add range checks in ppp_cp_parse_cr()
geneve: add transport ports in route lookup for geneve
cxgb4: Fix offset when clearing filter byte counters
mm/thp: fix __split_huge_pmd_locked() for migration PMD
kprobes: fix kill kprobe which has been marked as gone
KVM: fix memory leak in kvm_io_bus_unregister_dev()
* af_key: pfkey_dump needs parameter validation
net/key/af_key.c
ANDROID: drop KERNEL_DIR setting in build.config.common
Merge 4.19.147 into android-4.19-stable
Linux 4.19.147
x86/defconfig: Enable CONFIG_USB_XHCI_HCD=y
powerpc/dma: Fix dma_map_ops::get_required_mask
* ehci-hcd: Move include to keep CRC stable
drivers/usb/host/ehci-hcd.c
drivers/usb/host/ehci-hub.c
x86/boot/compressed: Disable relocation relaxation
serial: 8250_pci: Add Realtek 816a and 816b
Input: i8042 - add Entroware Proteus EL07R4 to nomux and reset lists
Input: trackpoint - add new trackpoint variant IDs
* percpu: fix first chunk size calculation for populated bitmap
mm/percpu.c
Revert "ALSA: hda - Fix silent audio output and corrupted input on MSI X570-A PRO"
i2c: i801: Fix resume bug
usblp: fix race between disconnect() and read()
USB: UAS: fix disconnect by unplugging a hub
* USB: quirks: Add USB_QUIRK_IGNORE_REMOTE_WAKEUP quirk for BYD zhaoxin notebook
drivers/usb/core/quirks.c
drm/mediatek: Add missing put_device() call in mtk_hdmi_dt_parse_pdata()
drm/mediatek: Add exception handing in mtk_drm_probe() if component init fail
MIPS: SNI: Fix spurious interrupts
fbcon: Fix user font detection test at fbcon_resize().
perf test: Free formats for perf pmu parse test
MIPS: SNI: Fix MIPS_L1_CACHE_SHIFT
perf test: Fix the "signal" test inline assembly
Drivers: hv: vmbus: Add timeout to vmbus_wait_for_unload
ASoC: qcom: Set card->owner to avoid warnings
clk: rockchip: Fix initialization of mux_pll_src_4plls_p
clk: davinci: Use the correct size when allocating memory
* KVM: MIPS: Change the definition of kvm type
include/uapi/linux/kvm.h
* spi: Fix memory leak on splited transfers
drivers/spi/spi.c
* i2c: algo: pca: Reapply i2c bus settings after reset
include/linux/i2c-algo-pca.h
* f2fs: Return EOF on unaligned end of file DIO read
fs/f2fs/data.c
* f2fs: fix indefinite loop scanning for free nid
fs/f2fs/node.c
nvme-rdma: cancel async events before freeing event struct
nvme-fc: cancel async events before freeing event struct
openrisc: Fix cache API compile issue when not inlining
rapidio: Replace 'select' DMAENGINES 'with depends on'
SUNRPC: stop printk reading past end of string
NFS: Zero-stateid SETATTR should first return delegation
spi: spi-loopback-test: Fix out-of-bounds read
regulator: pwm: Fix machine constraints application
scsi: lpfc: Fix FLOGI/PLOGI receive race condition in pt2pt discovery
scsi: libfc: Fix for double free()
scsi: pm8001: Fix memleak in pm8001_exec_internal_task_abort
NFSv4.1 handle ERR_DELAY error reclaiming locking state on delegation recall
hv_netvsc: Remove "unlikely" from netvsc_select_queue
* net: handle the return value of pskb_carve_frag_list() correctly
net/core/skbuff.c
RDMA/bnxt_re: Restrict the max_gids to 256
gfs2: initialize transaction tr_ailX_lists earlier
scsi: qla2xxx: Reduce holding sess_lock to prevent CPU lock-up
scsi: qla2xxx: Move rport registration out of internal work_list
scsi: qla2xxx: Update rscn_rcvd field to more meaningful scan_needed
dsa: Allow forwarding of redirected IGMP traffic
ANDROID: Refresh ABI.xmls with libabigail 1.8.0-1dca710a
ANDROID: KMI symbol lists: migrate section name
Merge 4.19.146 into android-4.19-stable
Linux 4.19.146
* gcov: add support for GCC 10.1
kernel/gcov/Kconfig
usb: typec: ucsi: acpi: Check the _DEP dependencies
* usb: Fix out of sync data toggle if a configured device is reconfigured
drivers/usb/core/message.c
USB: serial: option: add support for SIM7070/SIM7080/SIM7090 modules
USB: serial: option: support dynamic Quectel USB compositions
USB: serial: ftdi_sio: add IDs for Xsens Mti USB converter
* usb: core: fix slab-out-of-bounds Read in read_descriptors
drivers/usb/core/sysfs.c
phy: qcom-qmp: Use correct values for ipq8074 PCIe Gen2 PHY init
staging: greybus: audio: fix uninitialized value issue
video: fbdev: fix OOB read in vga_8planes_imageblit()
ARM: dts: vfxxx: Add syscon compatible with OCOTP
KVM: VMX: Don't freeze guest when event delivery causes an APIC-access exit
fbcon: remove now unusued 'softback_lines' cursor() argument
fbcon: remove soft scrollback code
* vgacon: remove software scrollback support
drivers/video/console/Kconfig
RDMA/rxe: Fix the parent sysfs read when the interface has 15 chars
rbd: require global CAP_SYS_ADMIN for mapping and unmapping
drm/msm: Disable preemption on all 5xx targets
drm/tve200: Stabilize enable/disable
scsi: target: iscsi: Fix hang in iscsit_access_np() when getting tpg->np_login_sem
scsi: target: iscsi: Fix data digest calculation
* regulator: push allocation in set_consumer_device_supply() out of lock
drivers/regulator/core.c
btrfs: fix wrong address when faulting in pages in the search ioctl
btrfs: fix lockdep splat in add_missing_dev
btrfs: require only sector size alignment for parent eb bytenr
staging: wlan-ng: fix out of bounds read in prism2sta_probe_usb()
iio:accel:mma8452: Fix timestamp alignment and prevent data leak.
iio:accel:mma7455: Fix timestamp alignment and prevent data leak.
iio: accel: kxsd9: Fix alignment of local buffer.
iio:chemical:ccs811: Fix timestamp alignment and prevent data leak.
iio:light:max44000 Fix timestamp alignment and prevent data leak.
iio:magnetometer:ak8975 Fix alignment and data leak issues.
iio:adc:ti-adc081c Fix alignment and data leak issues
iio:adc:max1118 Fix alignment of timestamp and data leak issues
iio:adc:ina2xx Fix timestamp alignment issue.
iio:adc:ti-adc084s021 Fix alignment and data leak issues.
iio:accel:bmc150-accel: Fix timestamp alignment and prevent data leak.
iio:light:ltr501 Fix timestamp alignment issue.
iio: adc: ti-ads1015: fix conversion when CONFIG_PM is not set
iio: adc: mcp3422: fix locking on error path
iio: adc: mcp3422: fix locking scope
* gcov: Disable gcov build with GCC 10
kernel/gcov/Kconfig
iommu/amd: Do not use IOMMUv2 functionality when SME is active
drm/amdgpu: Fix bug in reporting voltage for CIK
ALSA: hda: fix a runtime pm issue in SOF when integrated GPU is disabled
cpufreq: intel_pstate: Fix intel_pstate_get_hwp_max() for turbo disabled
cpufreq: intel_pstate: Refuse to turn off with HWP enabled
ARC: [plat-hsdk]: Switch ethernet phy-mode to rgmii-id
HID: elan: Fix memleak in elan_input_configured
drivers/net/wan/hdlc_cisco: Add hard_header_len
* HID: quirks: Set INCREMENT_USAGE_ON_DUPLICATE for all Saitek X52 devices
drivers/hid/hid-ids.h
drivers/hid/hid-quirks.c
nvme-rdma: serialize controller teardown sequences
nvme-fabrics: don't check state NVME_CTRL_NEW for request acceptance
* irqchip/eznps: Fix build error for !ARC700 builds
include/soc/nps/common.h
xfs: initialize the shortform attr header padding entry
drivers/net/wan/lapbether: Set network_header before transmitting
ALSA: hda: Fix 2 channel swapping for Tegra
firestream: Fix memleak in fs_open
NFC: st95hf: Fix memleak in st95hf_in_send_cmd
drivers/net/wan/lapbether: Added needed_tailroom
* netfilter: conntrack: allow sctp hearbeat after connection re-use
include/linux/netfilter/nf_conntrack_sctp.h
net/netfilter/nf_conntrack_proto_sctp.c
dmaengine: acpi: Put the CSRT table after using it
ARC: HSDK: wireup perf irq
arm64: dts: ns2: Fixed QSPI compatible string
ARM: dts: BCM5301X: Fixed QSPI compatible string
ARM: dts: NSP: Fixed QSPI compatible string
ARM: dts: bcm: HR2: Fixed QSPI compatible string
mmc: sdhci-msm: Add retries when all tuning phases are found valid
RDMA/core: Fix reported speed and width
scsi: libsas: Set data_dir as DMA_NONE if libata marks qc as NODATA
drm/sun4i: Fix dsi dcs long write function
RDMA/bnxt_re: Do not report transparent vlan from QP1
RDMA/rxe: Drop pointless checks in rxe_init_ports
RDMA/rxe: Fix memleak in rxe_mem_init_user
ARM: dts: ls1021a: fix QuadSPI-memory reg range
ARM: dts: socfpga: fix register entry for timer3 on Arria10
ARM: dts: logicpd-som-lv-baseboard: Fix broken audio
ARM: dts: logicpd-torpedo-baseboard: Fix broken audio
ANDROID: ABI: refresh with latest libabigail 94f5d4ae
Change-Id: Ifcfb1e210aef4012ef6851f7b79d25f52e3cd0ef
Signed-off-by: Lucas Wei <lucaswei@google.com>
2091 lines
59 KiB
C
2091 lines
59 KiB
C
/*
|
|
* linux/kernel/timer.c
|
|
*
|
|
* Kernel internal timers
|
|
*
|
|
* Copyright (C) 1991, 1992 Linus Torvalds
|
|
*
|
|
* 1997-01-28 Modified by Finn Arne Gangstad to make timers scale better.
|
|
*
|
|
* 1997-09-10 Updated NTP code according to technical memorandum Jan '96
|
|
* "A Kernel Model for Precision Timekeeping" by Dave Mills
|
|
* 1998-12-24 Fixed a xtime SMP race (we need the xtime_lock rw spinlock to
|
|
* serialize accesses to xtime/lost_ticks).
|
|
* Copyright (C) 1998 Andrea Arcangeli
|
|
* 1999-03-10 Improved NTP compatibility by Ulrich Windl
|
|
* 2002-05-31 Move sys_sysinfo here and make its locking sane, Robert Love
|
|
* 2000-10-05 Implemented scalable SMP per-CPU timer handling.
|
|
* Copyright (C) 2000, 2001, 2002 Ingo Molnar
|
|
* Designed by David S. Miller, Alexey Kuznetsov and Ingo Molnar
|
|
*/
|
|
|
|
#include <linux/kernel_stat.h>
|
|
#include <linux/export.h>
|
|
#include <linux/interrupt.h>
|
|
#include <linux/percpu.h>
|
|
#include <linux/init.h>
|
|
#include <linux/mm.h>
|
|
#include <linux/swap.h>
|
|
#include <linux/pid_namespace.h>
|
|
#include <linux/notifier.h>
|
|
#include <linux/thread_info.h>
|
|
#include <linux/time.h>
|
|
#include <linux/jiffies.h>
|
|
#include <linux/posix-timers.h>
|
|
#include <linux/cpu.h>
|
|
#include <linux/syscalls.h>
|
|
#include <linux/delay.h>
|
|
#include <linux/tick.h>
|
|
#include <linux/kallsyms.h>
|
|
#include <linux/irq_work.h>
|
|
#include <linux/sched/signal.h>
|
|
#include <linux/sched/sysctl.h>
|
|
#include <linux/sched/nohz.h>
|
|
#include <linux/sched/debug.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/compat.h>
|
|
#include <linux/random.h>
|
|
|
|
#include <linux/uaccess.h>
|
|
#include <asm/unistd.h>
|
|
#include <asm/div64.h>
|
|
#include <asm/timex.h>
|
|
#include <asm/io.h>
|
|
|
|
#include "tick-internal.h"
|
|
|
|
#define CREATE_TRACE_POINTS
|
|
#include <trace/events/timer.h>
|
|
|
|
__visible u64 jiffies_64 __cacheline_aligned_in_smp = INITIAL_JIFFIES;
|
|
|
|
EXPORT_SYMBOL(jiffies_64);
|
|
|
|
/*
|
|
* The timer wheel has LVL_DEPTH array levels. Each level provides an array of
|
|
* LVL_SIZE buckets. Each level is driven by its own clock and therefor each
|
|
* level has a different granularity.
|
|
*
|
|
* The level granularity is: LVL_CLK_DIV ^ lvl
|
|
* The level clock frequency is: HZ / (LVL_CLK_DIV ^ level)
|
|
*
|
|
* The array level of a newly armed timer depends on the relative expiry
|
|
* time. The farther the expiry time is away the higher the array level and
|
|
* therefor the granularity becomes.
|
|
*
|
|
* Contrary to the original timer wheel implementation, which aims for 'exact'
|
|
* expiry of the timers, this implementation removes the need for recascading
|
|
* the timers into the lower array levels. The previous 'classic' timer wheel
|
|
* implementation of the kernel already violated the 'exact' expiry by adding
|
|
* slack to the expiry time to provide batched expiration. The granularity
|
|
* levels provide implicit batching.
|
|
*
|
|
* This is an optimization of the original timer wheel implementation for the
|
|
* majority of the timer wheel use cases: timeouts. The vast majority of
|
|
* timeout timers (networking, disk I/O ...) are canceled before expiry. If
|
|
* the timeout expires it indicates that normal operation is disturbed, so it
|
|
* does not matter much whether the timeout comes with a slight delay.
|
|
*
|
|
* The only exception to this are networking timers with a small expiry
|
|
* time. They rely on the granularity. Those fit into the first wheel level,
|
|
* which has HZ granularity.
|
|
*
|
|
* We don't have cascading anymore. timers with a expiry time above the
|
|
* capacity of the last wheel level are force expired at the maximum timeout
|
|
* value of the last wheel level. From data sampling we know that the maximum
|
|
* value observed is 5 days (network connection tracking), so this should not
|
|
* be an issue.
|
|
*
|
|
* The currently chosen array constants values are a good compromise between
|
|
* array size and granularity.
|
|
*
|
|
* This results in the following granularity and range levels:
|
|
*
|
|
* HZ 1000 steps
|
|
* Level Offset Granularity Range
|
|
* 0 0 1 ms 0 ms - 63 ms
|
|
* 1 64 8 ms 64 ms - 511 ms
|
|
* 2 128 64 ms 512 ms - 4095 ms (512ms - ~4s)
|
|
* 3 192 512 ms 4096 ms - 32767 ms (~4s - ~32s)
|
|
* 4 256 4096 ms (~4s) 32768 ms - 262143 ms (~32s - ~4m)
|
|
* 5 320 32768 ms (~32s) 262144 ms - 2097151 ms (~4m - ~34m)
|
|
* 6 384 262144 ms (~4m) 2097152 ms - 16777215 ms (~34m - ~4h)
|
|
* 7 448 2097152 ms (~34m) 16777216 ms - 134217727 ms (~4h - ~1d)
|
|
* 8 512 16777216 ms (~4h) 134217728 ms - 1073741822 ms (~1d - ~12d)
|
|
*
|
|
* HZ 300
|
|
* Level Offset Granularity Range
|
|
* 0 0 3 ms 0 ms - 210 ms
|
|
* 1 64 26 ms 213 ms - 1703 ms (213ms - ~1s)
|
|
* 2 128 213 ms 1706 ms - 13650 ms (~1s - ~13s)
|
|
* 3 192 1706 ms (~1s) 13653 ms - 109223 ms (~13s - ~1m)
|
|
* 4 256 13653 ms (~13s) 109226 ms - 873810 ms (~1m - ~14m)
|
|
* 5 320 109226 ms (~1m) 873813 ms - 6990503 ms (~14m - ~1h)
|
|
* 6 384 873813 ms (~14m) 6990506 ms - 55924050 ms (~1h - ~15h)
|
|
* 7 448 6990506 ms (~1h) 55924053 ms - 447392423 ms (~15h - ~5d)
|
|
* 8 512 55924053 ms (~15h) 447392426 ms - 3579139406 ms (~5d - ~41d)
|
|
*
|
|
* HZ 250
|
|
* Level Offset Granularity Range
|
|
* 0 0 4 ms 0 ms - 255 ms
|
|
* 1 64 32 ms 256 ms - 2047 ms (256ms - ~2s)
|
|
* 2 128 256 ms 2048 ms - 16383 ms (~2s - ~16s)
|
|
* 3 192 2048 ms (~2s) 16384 ms - 131071 ms (~16s - ~2m)
|
|
* 4 256 16384 ms (~16s) 131072 ms - 1048575 ms (~2m - ~17m)
|
|
* 5 320 131072 ms (~2m) 1048576 ms - 8388607 ms (~17m - ~2h)
|
|
* 6 384 1048576 ms (~17m) 8388608 ms - 67108863 ms (~2h - ~18h)
|
|
* 7 448 8388608 ms (~2h) 67108864 ms - 536870911 ms (~18h - ~6d)
|
|
* 8 512 67108864 ms (~18h) 536870912 ms - 4294967288 ms (~6d - ~49d)
|
|
*
|
|
* HZ 100
|
|
* Level Offset Granularity Range
|
|
* 0 0 10 ms 0 ms - 630 ms
|
|
* 1 64 80 ms 640 ms - 5110 ms (640ms - ~5s)
|
|
* 2 128 640 ms 5120 ms - 40950 ms (~5s - ~40s)
|
|
* 3 192 5120 ms (~5s) 40960 ms - 327670 ms (~40s - ~5m)
|
|
* 4 256 40960 ms (~40s) 327680 ms - 2621430 ms (~5m - ~43m)
|
|
* 5 320 327680 ms (~5m) 2621440 ms - 20971510 ms (~43m - ~5h)
|
|
* 6 384 2621440 ms (~43m) 20971520 ms - 167772150 ms (~5h - ~1d)
|
|
* 7 448 20971520 ms (~5h) 167772160 ms - 1342177270 ms (~1d - ~15d)
|
|
*/
|
|
|
|
/* Clock divisor for the next level */
|
|
#define LVL_CLK_SHIFT 3
|
|
#define LVL_CLK_DIV (1UL << LVL_CLK_SHIFT)
|
|
#define LVL_CLK_MASK (LVL_CLK_DIV - 1)
|
|
#define LVL_SHIFT(n) ((n) * LVL_CLK_SHIFT)
|
|
#define LVL_GRAN(n) (1UL << LVL_SHIFT(n))
|
|
|
|
/*
|
|
* The time start value for each level to select the bucket at enqueue
|
|
* time.
|
|
*/
|
|
#define LVL_START(n) ((LVL_SIZE - 1) << (((n) - 1) * LVL_CLK_SHIFT))
|
|
|
|
/* Size of each clock level */
|
|
#define LVL_BITS 6
|
|
#define LVL_SIZE (1UL << LVL_BITS)
|
|
#define LVL_MASK (LVL_SIZE - 1)
|
|
#define LVL_OFFS(n) ((n) * LVL_SIZE)
|
|
|
|
/* Level depth */
|
|
#if HZ > 100
|
|
# define LVL_DEPTH 9
|
|
# else
|
|
# define LVL_DEPTH 8
|
|
#endif
|
|
|
|
/* The cutoff (max. capacity of the wheel) */
|
|
#define WHEEL_TIMEOUT_CUTOFF (LVL_START(LVL_DEPTH))
|
|
#define WHEEL_TIMEOUT_MAX (WHEEL_TIMEOUT_CUTOFF - LVL_GRAN(LVL_DEPTH - 1))
|
|
|
|
/*
|
|
* The resulting wheel size. If NOHZ is configured we allocate two
|
|
* wheels so we have a separate storage for the deferrable timers.
|
|
*/
|
|
#define WHEEL_SIZE (LVL_SIZE * LVL_DEPTH)
|
|
|
|
#ifdef CONFIG_NO_HZ_COMMON
|
|
# define NR_BASES 2
|
|
# define BASE_STD 0
|
|
# define BASE_DEF 1
|
|
#else
|
|
# define NR_BASES 1
|
|
# define BASE_STD 0
|
|
# define BASE_DEF 0
|
|
#endif
|
|
|
|
struct timer_base {
|
|
raw_spinlock_t lock;
|
|
struct timer_list *running_timer;
|
|
unsigned long clk;
|
|
unsigned long next_expiry;
|
|
unsigned int cpu;
|
|
bool is_idle;
|
|
bool must_forward_clk;
|
|
DECLARE_BITMAP(pending_map, WHEEL_SIZE);
|
|
struct hlist_head vectors[WHEEL_SIZE];
|
|
} ____cacheline_aligned;
|
|
|
|
static DEFINE_PER_CPU(struct timer_base, timer_bases[NR_BASES]);
|
|
struct timer_base timer_base_deferrable;
|
|
static atomic_t deferrable_pending;
|
|
|
|
#ifdef CONFIG_NO_HZ_COMMON
|
|
|
|
static DEFINE_STATIC_KEY_FALSE(timers_nohz_active);
|
|
static DEFINE_MUTEX(timer_keys_mutex);
|
|
|
|
static void timer_update_keys(struct work_struct *work);
|
|
static DECLARE_WORK(timer_update_work, timer_update_keys);
|
|
|
|
#ifdef CONFIG_SMP
|
|
unsigned int sysctl_timer_migration = 1;
|
|
|
|
DEFINE_STATIC_KEY_FALSE(timers_migration_enabled);
|
|
|
|
static void timers_update_migration(void)
|
|
{
|
|
if (sysctl_timer_migration && tick_nohz_active)
|
|
static_branch_enable(&timers_migration_enabled);
|
|
else
|
|
static_branch_disable(&timers_migration_enabled);
|
|
}
|
|
#else
|
|
static inline void timers_update_migration(void) { }
|
|
#endif /* !CONFIG_SMP */
|
|
|
|
static void timer_update_keys(struct work_struct *work)
|
|
{
|
|
mutex_lock(&timer_keys_mutex);
|
|
timers_update_migration();
|
|
static_branch_enable(&timers_nohz_active);
|
|
mutex_unlock(&timer_keys_mutex);
|
|
}
|
|
|
|
void timers_update_nohz(void)
|
|
{
|
|
schedule_work(&timer_update_work);
|
|
}
|
|
|
|
int timer_migration_handler(struct ctl_table *table, int write,
|
|
void __user *buffer, size_t *lenp,
|
|
loff_t *ppos)
|
|
{
|
|
int ret;
|
|
|
|
mutex_lock(&timer_keys_mutex);
|
|
ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
|
|
if (!ret && write)
|
|
timers_update_migration();
|
|
mutex_unlock(&timer_keys_mutex);
|
|
return ret;
|
|
}
|
|
|
|
static inline bool is_timers_nohz_active(void)
|
|
{
|
|
return static_branch_unlikely(&timers_nohz_active);
|
|
}
|
|
#else
|
|
static inline bool is_timers_nohz_active(void) { return false; }
|
|
#endif /* NO_HZ_COMMON */
|
|
|
|
static unsigned long round_jiffies_common(unsigned long j, int cpu,
|
|
bool force_up)
|
|
{
|
|
int rem;
|
|
unsigned long original = j;
|
|
|
|
/*
|
|
* We don't want all cpus firing their timers at once hitting the
|
|
* same lock or cachelines, so we skew each extra cpu with an extra
|
|
* 3 jiffies. This 3 jiffies came originally from the mm/ code which
|
|
* already did this.
|
|
* The skew is done by adding 3*cpunr, then round, then subtract this
|
|
* extra offset again.
|
|
*/
|
|
j += cpu * 3;
|
|
|
|
rem = j % HZ;
|
|
|
|
/*
|
|
* If the target jiffie is just after a whole second (which can happen
|
|
* due to delays of the timer irq, long irq off times etc etc) then
|
|
* we should round down to the whole second, not up. Use 1/4th second
|
|
* as cutoff for this rounding as an extreme upper bound for this.
|
|
* But never round down if @force_up is set.
|
|
*/
|
|
if (rem < HZ/4 && !force_up) /* round down */
|
|
j = j - rem;
|
|
else /* round up */
|
|
j = j - rem + HZ;
|
|
|
|
/* now that we have rounded, subtract the extra skew again */
|
|
j -= cpu * 3;
|
|
|
|
/*
|
|
* Make sure j is still in the future. Otherwise return the
|
|
* unmodified value.
|
|
*/
|
|
return time_is_after_jiffies(j) ? j : original;
|
|
}
|
|
|
|
/**
|
|
* __round_jiffies - function to round jiffies to a full second
|
|
* @j: the time in (absolute) jiffies that should be rounded
|
|
* @cpu: the processor number on which the timeout will happen
|
|
*
|
|
* __round_jiffies() rounds an absolute time in the future (in jiffies)
|
|
* up or down to (approximately) full seconds. This is useful for timers
|
|
* for which the exact time they fire does not matter too much, as long as
|
|
* they fire approximately every X seconds.
|
|
*
|
|
* By rounding these timers to whole seconds, all such timers will fire
|
|
* at the same time, rather than at various times spread out. The goal
|
|
* of this is to have the CPU wake up less, which saves power.
|
|
*
|
|
* The exact rounding is skewed for each processor to avoid all
|
|
* processors firing at the exact same time, which could lead
|
|
* to lock contention or spurious cache line bouncing.
|
|
*
|
|
* The return value is the rounded version of the @j parameter.
|
|
*/
|
|
unsigned long __round_jiffies(unsigned long j, int cpu)
|
|
{
|
|
return round_jiffies_common(j, cpu, false);
|
|
}
|
|
EXPORT_SYMBOL_GPL(__round_jiffies);
|
|
|
|
/**
|
|
* __round_jiffies_relative - function to round jiffies to a full second
|
|
* @j: the time in (relative) jiffies that should be rounded
|
|
* @cpu: the processor number on which the timeout will happen
|
|
*
|
|
* __round_jiffies_relative() rounds a time delta in the future (in jiffies)
|
|
* up or down to (approximately) full seconds. This is useful for timers
|
|
* for which the exact time they fire does not matter too much, as long as
|
|
* they fire approximately every X seconds.
|
|
*
|
|
* By rounding these timers to whole seconds, all such timers will fire
|
|
* at the same time, rather than at various times spread out. The goal
|
|
* of this is to have the CPU wake up less, which saves power.
|
|
*
|
|
* The exact rounding is skewed for each processor to avoid all
|
|
* processors firing at the exact same time, which could lead
|
|
* to lock contention or spurious cache line bouncing.
|
|
*
|
|
* The return value is the rounded version of the @j parameter.
|
|
*/
|
|
unsigned long __round_jiffies_relative(unsigned long j, int cpu)
|
|
{
|
|
unsigned long j0 = jiffies;
|
|
|
|
/* Use j0 because jiffies might change while we run */
|
|
return round_jiffies_common(j + j0, cpu, false) - j0;
|
|
}
|
|
EXPORT_SYMBOL_GPL(__round_jiffies_relative);
|
|
|
|
/**
|
|
* round_jiffies - function to round jiffies to a full second
|
|
* @j: the time in (absolute) jiffies that should be rounded
|
|
*
|
|
* round_jiffies() rounds an absolute time in the future (in jiffies)
|
|
* up or down to (approximately) full seconds. This is useful for timers
|
|
* for which the exact time they fire does not matter too much, as long as
|
|
* they fire approximately every X seconds.
|
|
*
|
|
* By rounding these timers to whole seconds, all such timers will fire
|
|
* at the same time, rather than at various times spread out. The goal
|
|
* of this is to have the CPU wake up less, which saves power.
|
|
*
|
|
* The return value is the rounded version of the @j parameter.
|
|
*/
|
|
unsigned long round_jiffies(unsigned long j)
|
|
{
|
|
return round_jiffies_common(j, raw_smp_processor_id(), false);
|
|
}
|
|
EXPORT_SYMBOL_GPL(round_jiffies);
|
|
|
|
/**
|
|
* round_jiffies_relative - function to round jiffies to a full second
|
|
* @j: the time in (relative) jiffies that should be rounded
|
|
*
|
|
* round_jiffies_relative() rounds a time delta in the future (in jiffies)
|
|
* up or down to (approximately) full seconds. This is useful for timers
|
|
* for which the exact time they fire does not matter too much, as long as
|
|
* they fire approximately every X seconds.
|
|
*
|
|
* By rounding these timers to whole seconds, all such timers will fire
|
|
* at the same time, rather than at various times spread out. The goal
|
|
* of this is to have the CPU wake up less, which saves power.
|
|
*
|
|
* The return value is the rounded version of the @j parameter.
|
|
*/
|
|
unsigned long round_jiffies_relative(unsigned long j)
|
|
{
|
|
return __round_jiffies_relative(j, raw_smp_processor_id());
|
|
}
|
|
EXPORT_SYMBOL_GPL(round_jiffies_relative);
|
|
|
|
/**
|
|
* __round_jiffies_up - function to round jiffies up to a full second
|
|
* @j: the time in (absolute) jiffies that should be rounded
|
|
* @cpu: the processor number on which the timeout will happen
|
|
*
|
|
* This is the same as __round_jiffies() except that it will never
|
|
* round down. This is useful for timeouts for which the exact time
|
|
* of firing does not matter too much, as long as they don't fire too
|
|
* early.
|
|
*/
|
|
unsigned long __round_jiffies_up(unsigned long j, int cpu)
|
|
{
|
|
return round_jiffies_common(j, cpu, true);
|
|
}
|
|
EXPORT_SYMBOL_GPL(__round_jiffies_up);
|
|
|
|
/**
|
|
* __round_jiffies_up_relative - function to round jiffies up to a full second
|
|
* @j: the time in (relative) jiffies that should be rounded
|
|
* @cpu: the processor number on which the timeout will happen
|
|
*
|
|
* This is the same as __round_jiffies_relative() except that it will never
|
|
* round down. This is useful for timeouts for which the exact time
|
|
* of firing does not matter too much, as long as they don't fire too
|
|
* early.
|
|
*/
|
|
unsigned long __round_jiffies_up_relative(unsigned long j, int cpu)
|
|
{
|
|
unsigned long j0 = jiffies;
|
|
|
|
/* Use j0 because jiffies might change while we run */
|
|
return round_jiffies_common(j + j0, cpu, true) - j0;
|
|
}
|
|
EXPORT_SYMBOL_GPL(__round_jiffies_up_relative);
|
|
|
|
/**
|
|
* round_jiffies_up - function to round jiffies up to a full second
|
|
* @j: the time in (absolute) jiffies that should be rounded
|
|
*
|
|
* This is the same as round_jiffies() except that it will never
|
|
* round down. This is useful for timeouts for which the exact time
|
|
* of firing does not matter too much, as long as they don't fire too
|
|
* early.
|
|
*/
|
|
unsigned long round_jiffies_up(unsigned long j)
|
|
{
|
|
return round_jiffies_common(j, raw_smp_processor_id(), true);
|
|
}
|
|
EXPORT_SYMBOL_GPL(round_jiffies_up);
|
|
|
|
/**
|
|
* round_jiffies_up_relative - function to round jiffies up to a full second
|
|
* @j: the time in (relative) jiffies that should be rounded
|
|
*
|
|
* This is the same as round_jiffies_relative() except that it will never
|
|
* round down. This is useful for timeouts for which the exact time
|
|
* of firing does not matter too much, as long as they don't fire too
|
|
* early.
|
|
*/
|
|
unsigned long round_jiffies_up_relative(unsigned long j)
|
|
{
|
|
return __round_jiffies_up_relative(j, raw_smp_processor_id());
|
|
}
|
|
EXPORT_SYMBOL_GPL(round_jiffies_up_relative);
|
|
|
|
|
|
static inline unsigned int timer_get_idx(struct timer_list *timer)
|
|
{
|
|
return (timer->flags & TIMER_ARRAYMASK) >> TIMER_ARRAYSHIFT;
|
|
}
|
|
|
|
static inline void timer_set_idx(struct timer_list *timer, unsigned int idx)
|
|
{
|
|
timer->flags = (timer->flags & ~TIMER_ARRAYMASK) |
|
|
idx << TIMER_ARRAYSHIFT;
|
|
}
|
|
|
|
/*
|
|
* Helper function to calculate the array index for a given expiry
|
|
* time.
|
|
*/
|
|
static inline unsigned calc_index(unsigned expires, unsigned lvl)
|
|
{
|
|
if (expires & ~(UINT_MAX << LVL_SHIFT(lvl)))
|
|
expires = (expires + LVL_GRAN(lvl)) >> LVL_SHIFT(lvl);
|
|
else
|
|
expires = expires >> LVL_SHIFT(lvl);
|
|
|
|
return LVL_OFFS(lvl) + (expires & LVL_MASK);
|
|
}
|
|
|
|
static inline unsigned int calc_index_min_granularity(unsigned int expires)
|
|
{
|
|
return LVL_OFFS(0) + ((expires >> LVL_SHIFT(0)) & LVL_MASK);
|
|
}
|
|
|
|
static int calc_wheel_index(unsigned long expires, unsigned long clk)
|
|
{
|
|
unsigned long delta = expires - clk;
|
|
unsigned int idx;
|
|
|
|
if (delta < LVL_START(1)) {
|
|
idx = calc_index_min_granularity(expires);
|
|
} else if (delta < LVL_START(2)) {
|
|
idx = calc_index(expires, 1);
|
|
} else if (delta < LVL_START(3)) {
|
|
idx = calc_index(expires, 2);
|
|
} else if (delta < LVL_START(4)) {
|
|
idx = calc_index(expires, 3);
|
|
} else if (delta < LVL_START(5)) {
|
|
idx = calc_index(expires, 4);
|
|
} else if (delta < LVL_START(6)) {
|
|
idx = calc_index(expires, 5);
|
|
} else if (delta < LVL_START(7)) {
|
|
idx = calc_index(expires, 6);
|
|
} else if (LVL_DEPTH > 8 && delta < LVL_START(8)) {
|
|
idx = calc_index(expires, 7);
|
|
} else if ((long) delta < 0) {
|
|
idx = clk & LVL_MASK;
|
|
} else {
|
|
/*
|
|
* Force expire obscene large timeouts to expire at the
|
|
* capacity limit of the wheel.
|
|
*/
|
|
if (delta >= WHEEL_TIMEOUT_CUTOFF)
|
|
expires = clk + WHEEL_TIMEOUT_MAX;
|
|
|
|
idx = calc_index(expires, LVL_DEPTH - 1);
|
|
}
|
|
return idx;
|
|
}
|
|
|
|
/*
|
|
* Enqueue the timer into the hash bucket, mark it pending in
|
|
* the bitmap and store the index in the timer flags.
|
|
*/
|
|
static void enqueue_timer(struct timer_base *base, struct timer_list *timer,
|
|
unsigned int idx)
|
|
{
|
|
hlist_add_head(&timer->entry, base->vectors + idx);
|
|
__set_bit(idx, base->pending_map);
|
|
timer_set_idx(timer, idx);
|
|
}
|
|
|
|
static void
|
|
__internal_add_timer(struct timer_base *base, struct timer_list *timer)
|
|
{
|
|
unsigned int idx;
|
|
|
|
idx = calc_wheel_index(timer->expires, base->clk);
|
|
enqueue_timer(base, timer, idx);
|
|
}
|
|
|
|
static void
|
|
trigger_dyntick_cpu(struct timer_base *base, struct timer_list *timer)
|
|
{
|
|
if (!is_timers_nohz_active())
|
|
return;
|
|
|
|
/*
|
|
* TODO: This wants some optimizing similar to the code below, but we
|
|
* will do that when we switch from push to pull for deferrable timers.
|
|
*/
|
|
if (timer->flags & TIMER_DEFERRABLE) {
|
|
if (tick_nohz_full_cpu(base->cpu))
|
|
wake_up_nohz_cpu(base->cpu);
|
|
return;
|
|
}
|
|
|
|
/*
|
|
* We might have to IPI the remote CPU if the base is idle and the
|
|
* timer is not deferrable. If the other CPU is on the way to idle
|
|
* then it can't set base->is_idle as we hold the base lock:
|
|
*/
|
|
if (!base->is_idle)
|
|
return;
|
|
|
|
/* Check whether this is the new first expiring timer: */
|
|
if (time_after_eq(timer->expires, base->next_expiry))
|
|
return;
|
|
|
|
/*
|
|
* Set the next expiry time and kick the CPU so it can reevaluate the
|
|
* wheel:
|
|
*/
|
|
if (time_before(timer->expires, base->clk)) {
|
|
/*
|
|
* Prevent from forward_timer_base() moving the base->clk
|
|
* backward
|
|
*/
|
|
base->next_expiry = base->clk;
|
|
} else {
|
|
base->next_expiry = timer->expires;
|
|
}
|
|
wake_up_nohz_cpu(base->cpu);
|
|
}
|
|
|
|
static void
|
|
internal_add_timer(struct timer_base *base, struct timer_list *timer)
|
|
{
|
|
__internal_add_timer(base, timer);
|
|
trigger_dyntick_cpu(base, timer);
|
|
}
|
|
|
|
#ifdef CONFIG_DEBUG_OBJECTS_TIMERS
|
|
|
|
static struct debug_obj_descr timer_debug_descr;
|
|
|
|
static void *timer_debug_hint(void *addr)
|
|
{
|
|
return ((struct timer_list *) addr)->function;
|
|
}
|
|
|
|
static bool timer_is_static_object(void *addr)
|
|
{
|
|
struct timer_list *timer = addr;
|
|
|
|
return (timer->entry.pprev == NULL &&
|
|
timer->entry.next == TIMER_ENTRY_STATIC);
|
|
}
|
|
|
|
/*
|
|
* fixup_init is called when:
|
|
* - an active object is initialized
|
|
*/
|
|
static bool timer_fixup_init(void *addr, enum debug_obj_state state)
|
|
{
|
|
struct timer_list *timer = addr;
|
|
|
|
switch (state) {
|
|
case ODEBUG_STATE_ACTIVE:
|
|
del_timer_sync(timer);
|
|
debug_object_init(timer, &timer_debug_descr);
|
|
return true;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/* Stub timer callback for improperly used timers. */
|
|
static void stub_timer(struct timer_list *unused)
|
|
{
|
|
WARN_ON(1);
|
|
}
|
|
|
|
/*
|
|
* fixup_activate is called when:
|
|
* - an active object is activated
|
|
* - an unknown non-static object is activated
|
|
*/
|
|
static bool timer_fixup_activate(void *addr, enum debug_obj_state state)
|
|
{
|
|
struct timer_list *timer = addr;
|
|
|
|
switch (state) {
|
|
case ODEBUG_STATE_NOTAVAILABLE:
|
|
timer_setup(timer, stub_timer, 0);
|
|
return true;
|
|
|
|
case ODEBUG_STATE_ACTIVE:
|
|
WARN_ON(1);
|
|
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/*
|
|
* fixup_free is called when:
|
|
* - an active object is freed
|
|
*/
|
|
static bool timer_fixup_free(void *addr, enum debug_obj_state state)
|
|
{
|
|
struct timer_list *timer = addr;
|
|
|
|
switch (state) {
|
|
case ODEBUG_STATE_ACTIVE:
|
|
del_timer_sync(timer);
|
|
debug_object_free(timer, &timer_debug_descr);
|
|
return true;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/*
|
|
* fixup_assert_init is called when:
|
|
* - an untracked/uninit-ed object is found
|
|
*/
|
|
static bool timer_fixup_assert_init(void *addr, enum debug_obj_state state)
|
|
{
|
|
struct timer_list *timer = addr;
|
|
|
|
switch (state) {
|
|
case ODEBUG_STATE_NOTAVAILABLE:
|
|
timer_setup(timer, stub_timer, 0);
|
|
return true;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
|
|
static struct debug_obj_descr timer_debug_descr = {
|
|
.name = "timer_list",
|
|
.debug_hint = timer_debug_hint,
|
|
.is_static_object = timer_is_static_object,
|
|
.fixup_init = timer_fixup_init,
|
|
.fixup_activate = timer_fixup_activate,
|
|
.fixup_free = timer_fixup_free,
|
|
.fixup_assert_init = timer_fixup_assert_init,
|
|
};
|
|
|
|
static inline void debug_timer_init(struct timer_list *timer)
|
|
{
|
|
debug_object_init(timer, &timer_debug_descr);
|
|
}
|
|
|
|
static inline void debug_timer_activate(struct timer_list *timer)
|
|
{
|
|
debug_object_activate(timer, &timer_debug_descr);
|
|
}
|
|
|
|
static inline void debug_timer_deactivate(struct timer_list *timer)
|
|
{
|
|
debug_object_deactivate(timer, &timer_debug_descr);
|
|
}
|
|
|
|
static inline void debug_timer_free(struct timer_list *timer)
|
|
{
|
|
debug_object_free(timer, &timer_debug_descr);
|
|
}
|
|
|
|
static inline void debug_timer_assert_init(struct timer_list *timer)
|
|
{
|
|
debug_object_assert_init(timer, &timer_debug_descr);
|
|
}
|
|
|
|
static void do_init_timer(struct timer_list *timer,
|
|
void (*func)(struct timer_list *),
|
|
unsigned int flags,
|
|
const char *name, struct lock_class_key *key);
|
|
|
|
void init_timer_on_stack_key(struct timer_list *timer,
|
|
void (*func)(struct timer_list *),
|
|
unsigned int flags,
|
|
const char *name, struct lock_class_key *key)
|
|
{
|
|
debug_object_init_on_stack(timer, &timer_debug_descr);
|
|
do_init_timer(timer, func, flags, name, key);
|
|
}
|
|
EXPORT_SYMBOL_GPL(init_timer_on_stack_key);
|
|
|
|
void destroy_timer_on_stack(struct timer_list *timer)
|
|
{
|
|
debug_object_free(timer, &timer_debug_descr);
|
|
}
|
|
EXPORT_SYMBOL_GPL(destroy_timer_on_stack);
|
|
|
|
#else
|
|
static inline void debug_timer_init(struct timer_list *timer) { }
|
|
static inline void debug_timer_activate(struct timer_list *timer) { }
|
|
static inline void debug_timer_deactivate(struct timer_list *timer) { }
|
|
static inline void debug_timer_assert_init(struct timer_list *timer) { }
|
|
#endif
|
|
|
|
static inline void debug_init(struct timer_list *timer)
|
|
{
|
|
debug_timer_init(timer);
|
|
trace_timer_init(timer);
|
|
}
|
|
|
|
static inline void
|
|
debug_activate(struct timer_list *timer, unsigned long expires)
|
|
{
|
|
debug_timer_activate(timer);
|
|
trace_timer_start(timer, expires, timer->flags);
|
|
}
|
|
|
|
static inline void debug_deactivate(struct timer_list *timer)
|
|
{
|
|
debug_timer_deactivate(timer);
|
|
trace_timer_cancel(timer);
|
|
}
|
|
|
|
static inline void debug_assert_init(struct timer_list *timer)
|
|
{
|
|
debug_timer_assert_init(timer);
|
|
}
|
|
|
|
static void do_init_timer(struct timer_list *timer,
|
|
void (*func)(struct timer_list *),
|
|
unsigned int flags,
|
|
const char *name, struct lock_class_key *key)
|
|
{
|
|
timer->entry.pprev = NULL;
|
|
timer->function = func;
|
|
timer->flags = flags | raw_smp_processor_id();
|
|
lockdep_init_map(&timer->lockdep_map, name, key, 0);
|
|
}
|
|
|
|
/**
|
|
* init_timer_key - initialize a timer
|
|
* @timer: the timer to be initialized
|
|
* @func: timer callback function
|
|
* @flags: timer flags
|
|
* @name: name of the timer
|
|
* @key: lockdep class key of the fake lock used for tracking timer
|
|
* sync lock dependencies
|
|
*
|
|
* init_timer_key() must be done to a timer prior calling *any* of the
|
|
* other timer functions.
|
|
*/
|
|
void init_timer_key(struct timer_list *timer,
|
|
void (*func)(struct timer_list *), unsigned int flags,
|
|
const char *name, struct lock_class_key *key)
|
|
{
|
|
debug_init(timer);
|
|
do_init_timer(timer, func, flags, name, key);
|
|
}
|
|
EXPORT_SYMBOL(init_timer_key);
|
|
|
|
static inline void detach_timer(struct timer_list *timer, bool clear_pending)
|
|
{
|
|
struct hlist_node *entry = &timer->entry;
|
|
|
|
debug_deactivate(timer);
|
|
|
|
__hlist_del(entry);
|
|
if (clear_pending)
|
|
entry->pprev = NULL;
|
|
entry->next = LIST_POISON2;
|
|
}
|
|
|
|
static int detach_if_pending(struct timer_list *timer, struct timer_base *base,
|
|
bool clear_pending)
|
|
{
|
|
unsigned idx = timer_get_idx(timer);
|
|
|
|
if (!timer_pending(timer))
|
|
return 0;
|
|
|
|
if (hlist_is_singular_node(&timer->entry, base->vectors + idx))
|
|
__clear_bit(idx, base->pending_map);
|
|
|
|
detach_timer(timer, clear_pending);
|
|
return 1;
|
|
}
|
|
|
|
static inline struct timer_base *get_timer_cpu_base(u32 tflags, u32 cpu)
|
|
{
|
|
struct timer_base *base = per_cpu_ptr(&timer_bases[BASE_STD], cpu);
|
|
|
|
/*
|
|
* If the timer is deferrable and NO_HZ_COMMON is set then we need
|
|
* to use the deferrable base.
|
|
*/
|
|
if (IS_ENABLED(CONFIG_NO_HZ_COMMON) && (tflags & TIMER_DEFERRABLE)) {
|
|
base = &timer_base_deferrable;
|
|
if (tflags & TIMER_PINNED)
|
|
base = per_cpu_ptr(&timer_bases[BASE_DEF], cpu);
|
|
}
|
|
return base;
|
|
}
|
|
|
|
static inline struct timer_base *get_timer_this_cpu_base(u32 tflags)
|
|
{
|
|
struct timer_base *base = this_cpu_ptr(&timer_bases[BASE_STD]);
|
|
|
|
/*
|
|
* If the timer is deferrable and NO_HZ_COMMON is set then we need
|
|
* to use the deferrable base.
|
|
*/
|
|
if (IS_ENABLED(CONFIG_NO_HZ_COMMON) && (tflags & TIMER_DEFERRABLE)) {
|
|
base = &timer_base_deferrable;
|
|
if (tflags & TIMER_PINNED)
|
|
base = this_cpu_ptr(&timer_bases[BASE_DEF]);
|
|
}
|
|
return base;
|
|
}
|
|
|
|
static inline struct timer_base *get_timer_base(u32 tflags)
|
|
{
|
|
return get_timer_cpu_base(tflags, tflags & TIMER_CPUMASK);
|
|
}
|
|
|
|
static inline struct timer_base *
|
|
get_target_base(struct timer_base *base, unsigned tflags)
|
|
{
|
|
#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON)
|
|
if (static_branch_likely(&timers_migration_enabled) &&
|
|
!(tflags & TIMER_PINNED))
|
|
return get_timer_cpu_base(tflags, get_nohz_timer_target());
|
|
#endif
|
|
return get_timer_this_cpu_base(tflags);
|
|
}
|
|
|
|
static inline void forward_timer_base(struct timer_base *base)
|
|
{
|
|
#ifdef CONFIG_NO_HZ_COMMON
|
|
unsigned long jnow;
|
|
|
|
/*
|
|
* We only forward the base when we are idle or have just come out of
|
|
* idle (must_forward_clk logic), and have a delta between base clock
|
|
* and jiffies. In the common case, run_timers will take care of it.
|
|
*/
|
|
if (likely(!base->must_forward_clk))
|
|
return;
|
|
|
|
jnow = READ_ONCE(jiffies);
|
|
base->must_forward_clk = base->is_idle;
|
|
if ((long)(jnow - base->clk) < 2)
|
|
return;
|
|
|
|
/*
|
|
* If the next expiry value is > jiffies, then we fast forward to
|
|
* jiffies otherwise we forward to the next expiry value.
|
|
*/
|
|
if (time_after(base->next_expiry, jnow)) {
|
|
base->clk = jnow;
|
|
} else {
|
|
if (WARN_ON_ONCE(time_before(base->next_expiry, base->clk)))
|
|
return;
|
|
base->clk = base->next_expiry;
|
|
}
|
|
#endif
|
|
}
|
|
|
|
|
|
/*
|
|
* We are using hashed locking: Holding per_cpu(timer_bases[x]).lock means
|
|
* that all timers which are tied to this base are locked, and the base itself
|
|
* is locked too.
|
|
*
|
|
* So __run_timers/migrate_timers can safely modify all timers which could
|
|
* be found in the base->vectors array.
|
|
*
|
|
* When a timer is migrating then the TIMER_MIGRATING flag is set and we need
|
|
* to wait until the migration is done.
|
|
*/
|
|
static struct timer_base *lock_timer_base(struct timer_list *timer,
|
|
unsigned long *flags)
|
|
__acquires(timer->base->lock)
|
|
{
|
|
for (;;) {
|
|
struct timer_base *base;
|
|
u32 tf;
|
|
|
|
/*
|
|
* We need to use READ_ONCE() here, otherwise the compiler
|
|
* might re-read @tf between the check for TIMER_MIGRATING
|
|
* and spin_lock().
|
|
*/
|
|
tf = READ_ONCE(timer->flags);
|
|
|
|
if (!(tf & TIMER_MIGRATING)) {
|
|
base = get_timer_base(tf);
|
|
raw_spin_lock_irqsave(&base->lock, *flags);
|
|
if (timer->flags == tf)
|
|
return base;
|
|
raw_spin_unlock_irqrestore(&base->lock, *flags);
|
|
}
|
|
cpu_relax();
|
|
ndelay(TIMER_LOCK_TIGHT_LOOP_DELAY_NS);
|
|
}
|
|
}
|
|
|
|
#define MOD_TIMER_PENDING_ONLY 0x01
|
|
#define MOD_TIMER_REDUCE 0x02
|
|
|
|
static inline int
|
|
__mod_timer(struct timer_list *timer, unsigned long expires, unsigned int options)
|
|
{
|
|
struct timer_base *base, *new_base;
|
|
unsigned int idx = UINT_MAX;
|
|
unsigned long clk = 0, flags;
|
|
int ret = 0;
|
|
|
|
BUG_ON(!timer->function);
|
|
|
|
/*
|
|
* This is a common optimization triggered by the networking code - if
|
|
* the timer is re-modified to have the same timeout or ends up in the
|
|
* same array bucket then just return:
|
|
*/
|
|
if (timer_pending(timer)) {
|
|
/*
|
|
* The downside of this optimization is that it can result in
|
|
* larger granularity than you would get from adding a new
|
|
* timer with this expiry.
|
|
*/
|
|
long diff = timer->expires - expires;
|
|
|
|
if (!diff)
|
|
return 1;
|
|
if (options & MOD_TIMER_REDUCE && diff <= 0)
|
|
return 1;
|
|
|
|
/*
|
|
* We lock timer base and calculate the bucket index right
|
|
* here. If the timer ends up in the same bucket, then we
|
|
* just update the expiry time and avoid the whole
|
|
* dequeue/enqueue dance.
|
|
*/
|
|
base = lock_timer_base(timer, &flags);
|
|
forward_timer_base(base);
|
|
|
|
if (timer_pending(timer) && (options & MOD_TIMER_REDUCE) &&
|
|
time_before_eq(timer->expires, expires)) {
|
|
ret = 1;
|
|
goto out_unlock;
|
|
}
|
|
|
|
clk = base->clk;
|
|
idx = calc_wheel_index(expires, clk);
|
|
|
|
/*
|
|
* Retrieve and compare the array index of the pending
|
|
* timer. If it matches set the expiry to the new value so a
|
|
* subsequent call will exit in the expires check above.
|
|
*/
|
|
if (idx == timer_get_idx(timer)) {
|
|
if (!(options & MOD_TIMER_REDUCE))
|
|
timer->expires = expires;
|
|
else if (time_after(timer->expires, expires))
|
|
timer->expires = expires;
|
|
ret = 1;
|
|
goto out_unlock;
|
|
}
|
|
} else {
|
|
base = lock_timer_base(timer, &flags);
|
|
forward_timer_base(base);
|
|
}
|
|
|
|
ret = detach_if_pending(timer, base, false);
|
|
if (!ret && (options & MOD_TIMER_PENDING_ONLY))
|
|
goto out_unlock;
|
|
|
|
new_base = get_target_base(base, timer->flags);
|
|
|
|
if (base != new_base) {
|
|
/*
|
|
* We are trying to schedule the timer on the new base.
|
|
* However we can't change timer's base while it is running,
|
|
* otherwise del_timer_sync() can't detect that the timer's
|
|
* handler yet has not finished. This also guarantees that the
|
|
* timer is serialized wrt itself.
|
|
*/
|
|
if (likely(base->running_timer != timer)) {
|
|
/* See the comment in lock_timer_base() */
|
|
timer->flags |= TIMER_MIGRATING;
|
|
|
|
raw_spin_unlock(&base->lock);
|
|
base = new_base;
|
|
raw_spin_lock(&base->lock);
|
|
WRITE_ONCE(timer->flags,
|
|
(timer->flags & ~TIMER_BASEMASK) | base->cpu);
|
|
forward_timer_base(base);
|
|
}
|
|
}
|
|
|
|
debug_activate(timer, expires);
|
|
|
|
timer->expires = expires;
|
|
/*
|
|
* If 'idx' was calculated above and the base time did not advance
|
|
* between calculating 'idx' and possibly switching the base, only
|
|
* enqueue_timer() and trigger_dyntick_cpu() is required. Otherwise
|
|
* we need to (re)calculate the wheel index via
|
|
* internal_add_timer().
|
|
*/
|
|
if (idx != UINT_MAX && clk == base->clk) {
|
|
enqueue_timer(base, timer, idx);
|
|
trigger_dyntick_cpu(base, timer);
|
|
} else {
|
|
internal_add_timer(base, timer);
|
|
}
|
|
|
|
out_unlock:
|
|
raw_spin_unlock_irqrestore(&base->lock, flags);
|
|
|
|
return ret;
|
|
}
|
|
|
|
/**
|
|
* mod_timer_pending - modify a pending timer's timeout
|
|
* @timer: the pending timer to be modified
|
|
* @expires: new timeout in jiffies
|
|
*
|
|
* mod_timer_pending() is the same for pending timers as mod_timer(),
|
|
* but will not re-activate and modify already deleted timers.
|
|
*
|
|
* It is useful for unserialized use of timers.
|
|
*/
|
|
int mod_timer_pending(struct timer_list *timer, unsigned long expires)
|
|
{
|
|
return __mod_timer(timer, expires, MOD_TIMER_PENDING_ONLY);
|
|
}
|
|
EXPORT_SYMBOL(mod_timer_pending);
|
|
|
|
/**
|
|
* mod_timer - modify a timer's timeout
|
|
* @timer: the timer to be modified
|
|
* @expires: new timeout in jiffies
|
|
*
|
|
* mod_timer() is a more efficient way to update the expire field of an
|
|
* active timer (if the timer is inactive it will be activated)
|
|
*
|
|
* mod_timer(timer, expires) is equivalent to:
|
|
*
|
|
* del_timer(timer); timer->expires = expires; add_timer(timer);
|
|
*
|
|
* Note that if there are multiple unserialized concurrent users of the
|
|
* same timer, then mod_timer() is the only safe way to modify the timeout,
|
|
* since add_timer() cannot modify an already running timer.
|
|
*
|
|
* The function returns whether it has modified a pending timer or not.
|
|
* (ie. mod_timer() of an inactive timer returns 0, mod_timer() of an
|
|
* active timer returns 1.)
|
|
*/
|
|
int mod_timer(struct timer_list *timer, unsigned long expires)
|
|
{
|
|
return __mod_timer(timer, expires, 0);
|
|
}
|
|
EXPORT_SYMBOL(mod_timer);
|
|
|
|
/**
|
|
* timer_reduce - Modify a timer's timeout if it would reduce the timeout
|
|
* @timer: The timer to be modified
|
|
* @expires: New timeout in jiffies
|
|
*
|
|
* timer_reduce() is very similar to mod_timer(), except that it will only
|
|
* modify a running timer if that would reduce the expiration time (it will
|
|
* start a timer that isn't running).
|
|
*/
|
|
int timer_reduce(struct timer_list *timer, unsigned long expires)
|
|
{
|
|
return __mod_timer(timer, expires, MOD_TIMER_REDUCE);
|
|
}
|
|
EXPORT_SYMBOL(timer_reduce);
|
|
|
|
/**
|
|
* add_timer - start a timer
|
|
* @timer: the timer to be added
|
|
*
|
|
* The kernel will do a ->function(@timer) callback from the
|
|
* timer interrupt at the ->expires point in the future. The
|
|
* current time is 'jiffies'.
|
|
*
|
|
* The timer's ->expires, ->function fields must be set prior calling this
|
|
* function.
|
|
*
|
|
* Timers with an ->expires field in the past will be executed in the next
|
|
* timer tick.
|
|
*/
|
|
void add_timer(struct timer_list *timer)
|
|
{
|
|
BUG_ON(timer_pending(timer));
|
|
mod_timer(timer, timer->expires);
|
|
}
|
|
EXPORT_SYMBOL(add_timer);
|
|
|
|
/**
|
|
* add_timer_on - start a timer on a particular CPU
|
|
* @timer: the timer to be added
|
|
* @cpu: the CPU to start it on
|
|
*
|
|
* This is not very scalable on SMP. Double adds are not possible.
|
|
*/
|
|
void add_timer_on(struct timer_list *timer, int cpu)
|
|
{
|
|
struct timer_base *new_base, *base;
|
|
unsigned long flags;
|
|
|
|
BUG_ON(timer_pending(timer) || !timer->function);
|
|
|
|
new_base = get_timer_cpu_base(timer->flags, cpu);
|
|
|
|
/*
|
|
* If @timer was on a different CPU, it should be migrated with the
|
|
* old base locked to prevent other operations proceeding with the
|
|
* wrong base locked. See lock_timer_base().
|
|
*/
|
|
base = lock_timer_base(timer, &flags);
|
|
if (base != new_base) {
|
|
timer->flags |= TIMER_MIGRATING;
|
|
|
|
raw_spin_unlock(&base->lock);
|
|
base = new_base;
|
|
raw_spin_lock(&base->lock);
|
|
WRITE_ONCE(timer->flags,
|
|
(timer->flags & ~TIMER_BASEMASK) | cpu);
|
|
}
|
|
forward_timer_base(base);
|
|
|
|
debug_activate(timer, timer->expires);
|
|
internal_add_timer(base, timer);
|
|
raw_spin_unlock_irqrestore(&base->lock, flags);
|
|
}
|
|
EXPORT_SYMBOL_GPL(add_timer_on);
|
|
|
|
/**
|
|
* del_timer - deactivate a timer.
|
|
* @timer: the timer to be deactivated
|
|
*
|
|
* del_timer() deactivates a timer - this works on both active and inactive
|
|
* timers.
|
|
*
|
|
* The function returns whether it has deactivated a pending timer or not.
|
|
* (ie. del_timer() of an inactive timer returns 0, del_timer() of an
|
|
* active timer returns 1.)
|
|
*/
|
|
int del_timer(struct timer_list *timer)
|
|
{
|
|
struct timer_base *base;
|
|
unsigned long flags;
|
|
int ret = 0;
|
|
|
|
debug_assert_init(timer);
|
|
|
|
if (timer_pending(timer)) {
|
|
base = lock_timer_base(timer, &flags);
|
|
ret = detach_if_pending(timer, base, true);
|
|
raw_spin_unlock_irqrestore(&base->lock, flags);
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
EXPORT_SYMBOL(del_timer);
|
|
|
|
/**
|
|
* try_to_del_timer_sync - Try to deactivate a timer
|
|
* @timer: timer to delete
|
|
*
|
|
* This function tries to deactivate a timer. Upon successful (ret >= 0)
|
|
* exit the timer is not queued and the handler is not running on any CPU.
|
|
*/
|
|
int try_to_del_timer_sync(struct timer_list *timer)
|
|
{
|
|
struct timer_base *base;
|
|
unsigned long flags;
|
|
int ret = -1;
|
|
|
|
debug_assert_init(timer);
|
|
|
|
base = lock_timer_base(timer, &flags);
|
|
|
|
if (base->running_timer != timer)
|
|
ret = detach_if_pending(timer, base, true);
|
|
|
|
raw_spin_unlock_irqrestore(&base->lock, flags);
|
|
|
|
return ret;
|
|
}
|
|
EXPORT_SYMBOL(try_to_del_timer_sync);
|
|
|
|
#ifdef CONFIG_SMP
|
|
/**
|
|
* del_timer_sync - deactivate a timer and wait for the handler to finish.
|
|
* @timer: the timer to be deactivated
|
|
*
|
|
* This function only differs from del_timer() on SMP: besides deactivating
|
|
* the timer it also makes sure the handler has finished executing on other
|
|
* CPUs.
|
|
*
|
|
* Synchronization rules: Callers must prevent restarting of the timer,
|
|
* otherwise this function is meaningless. It must not be called from
|
|
* interrupt contexts unless the timer is an irqsafe one. The caller must
|
|
* not hold locks which would prevent completion of the timer's
|
|
* handler. The timer's handler must not call add_timer_on(). Upon exit the
|
|
* timer is not queued and the handler is not running on any CPU.
|
|
*
|
|
* Note: For !irqsafe timers, you must not hold locks that are held in
|
|
* interrupt context while calling this function. Even if the lock has
|
|
* nothing to do with the timer in question. Here's why::
|
|
*
|
|
* CPU0 CPU1
|
|
* ---- ----
|
|
* <SOFTIRQ>
|
|
* call_timer_fn();
|
|
* base->running_timer = mytimer;
|
|
* spin_lock_irq(somelock);
|
|
* <IRQ>
|
|
* spin_lock(somelock);
|
|
* del_timer_sync(mytimer);
|
|
* while (base->running_timer == mytimer);
|
|
*
|
|
* Now del_timer_sync() will never return and never release somelock.
|
|
* The interrupt on the other CPU is waiting to grab somelock but
|
|
* it has interrupted the softirq that CPU0 is waiting to finish.
|
|
*
|
|
* The function returns whether it has deactivated a pending timer or not.
|
|
*/
|
|
int del_timer_sync(struct timer_list *timer)
|
|
{
|
|
#ifdef CONFIG_LOCKDEP
|
|
unsigned long flags;
|
|
|
|
/*
|
|
* If lockdep gives a backtrace here, please reference
|
|
* the synchronization rules above.
|
|
*/
|
|
local_irq_save(flags);
|
|
lock_map_acquire(&timer->lockdep_map);
|
|
lock_map_release(&timer->lockdep_map);
|
|
local_irq_restore(flags);
|
|
#endif
|
|
/*
|
|
* don't use it in hardirq context, because it
|
|
* could lead to deadlock.
|
|
*/
|
|
WARN_ON(in_irq() && !(timer->flags & TIMER_IRQSAFE));
|
|
for (;;) {
|
|
int ret = try_to_del_timer_sync(timer);
|
|
if (ret >= 0)
|
|
return ret;
|
|
cpu_relax();
|
|
ndelay(TIMER_LOCK_TIGHT_LOOP_DELAY_NS);
|
|
}
|
|
}
|
|
EXPORT_SYMBOL(del_timer_sync);
|
|
#endif
|
|
|
|
static void call_timer_fn(struct timer_list *timer, void (*fn)(struct timer_list *))
|
|
{
|
|
int count = preempt_count();
|
|
|
|
#ifdef CONFIG_LOCKDEP
|
|
/*
|
|
* It is permissible to free the timer from inside the
|
|
* function that is called from it, this we need to take into
|
|
* account for lockdep too. To avoid bogus "held lock freed"
|
|
* warnings as well as problems when looking into
|
|
* timer->lockdep_map, make a copy and use that here.
|
|
*/
|
|
struct lockdep_map lockdep_map;
|
|
|
|
lockdep_copy_map(&lockdep_map, &timer->lockdep_map);
|
|
#endif
|
|
/*
|
|
* Couple the lock chain with the lock chain at
|
|
* del_timer_sync() by acquiring the lock_map around the fn()
|
|
* call here and in del_timer_sync().
|
|
*/
|
|
lock_map_acquire(&lockdep_map);
|
|
|
|
trace_timer_expire_entry(timer);
|
|
fn(timer);
|
|
trace_timer_expire_exit(timer);
|
|
|
|
lock_map_release(&lockdep_map);
|
|
|
|
if (count != preempt_count()) {
|
|
WARN_ONCE(1, "timer: %pF preempt leak: %08x -> %08x\n",
|
|
fn, count, preempt_count());
|
|
/*
|
|
* Restore the preempt count. That gives us a decent
|
|
* chance to survive and extract information. If the
|
|
* callback kept a lock held, bad luck, but not worse
|
|
* than the BUG() we had.
|
|
*/
|
|
preempt_count_set(count);
|
|
}
|
|
}
|
|
|
|
static void expire_timers(struct timer_base *base, struct hlist_head *head)
|
|
{
|
|
while (!hlist_empty(head)) {
|
|
struct timer_list *timer;
|
|
void (*fn)(struct timer_list *);
|
|
|
|
timer = hlist_entry(head->first, struct timer_list, entry);
|
|
|
|
base->running_timer = timer;
|
|
detach_timer(timer, true);
|
|
|
|
fn = timer->function;
|
|
|
|
if (timer->flags & TIMER_IRQSAFE) {
|
|
raw_spin_unlock(&base->lock);
|
|
call_timer_fn(timer, fn);
|
|
raw_spin_lock(&base->lock);
|
|
} else {
|
|
raw_spin_unlock_irq(&base->lock);
|
|
call_timer_fn(timer, fn);
|
|
raw_spin_lock_irq(&base->lock);
|
|
}
|
|
}
|
|
}
|
|
|
|
static int __collect_expired_timers(struct timer_base *base,
|
|
struct hlist_head *heads)
|
|
{
|
|
unsigned long clk = base->clk;
|
|
struct hlist_head *vec;
|
|
int i, levels = 0;
|
|
unsigned int idx;
|
|
|
|
for (i = 0; i < LVL_DEPTH; i++) {
|
|
idx = (clk & LVL_MASK) + i * LVL_SIZE;
|
|
|
|
if (__test_and_clear_bit(idx, base->pending_map)) {
|
|
vec = base->vectors + idx;
|
|
hlist_move_list(vec, heads++);
|
|
levels++;
|
|
}
|
|
/* Is it time to look at the next level? */
|
|
if (clk & LVL_CLK_MASK)
|
|
break;
|
|
/* Shift clock for the next level granularity */
|
|
clk >>= LVL_CLK_SHIFT;
|
|
}
|
|
return levels;
|
|
}
|
|
|
|
#ifdef CONFIG_NO_HZ_COMMON
|
|
/*
|
|
* Find the next pending bucket of a level. Search from level start (@offset)
|
|
* + @clk upwards and if nothing there, search from start of the level
|
|
* (@offset) up to @offset + clk.
|
|
*/
|
|
static int next_pending_bucket(struct timer_base *base, unsigned offset,
|
|
unsigned clk)
|
|
{
|
|
unsigned pos, start = offset + clk;
|
|
unsigned end = offset + LVL_SIZE;
|
|
|
|
pos = find_next_bit(base->pending_map, end, start);
|
|
if (pos < end)
|
|
return pos - start;
|
|
|
|
pos = find_next_bit(base->pending_map, start, offset);
|
|
return pos < start ? pos + LVL_SIZE - start : -1;
|
|
}
|
|
|
|
/*
|
|
* Search the first expiring timer in the various clock levels. Caller must
|
|
* hold base->lock.
|
|
*/
|
|
static unsigned long __next_timer_interrupt(struct timer_base *base)
|
|
{
|
|
unsigned long clk, next, adj;
|
|
unsigned lvl, offset = 0;
|
|
|
|
next = base->clk + NEXT_TIMER_MAX_DELTA;
|
|
clk = base->clk;
|
|
for (lvl = 0; lvl < LVL_DEPTH; lvl++, offset += LVL_SIZE) {
|
|
int pos = next_pending_bucket(base, offset, clk & LVL_MASK);
|
|
|
|
if (pos >= 0) {
|
|
unsigned long tmp = clk + (unsigned long) pos;
|
|
|
|
tmp <<= LVL_SHIFT(lvl);
|
|
if (time_before(tmp, next))
|
|
next = tmp;
|
|
}
|
|
/*
|
|
* Clock for the next level. If the current level clock lower
|
|
* bits are zero, we look at the next level as is. If not we
|
|
* need to advance it by one because that's going to be the
|
|
* next expiring bucket in that level. base->clk is the next
|
|
* expiring jiffie. So in case of:
|
|
*
|
|
* LVL5 LVL4 LVL3 LVL2 LVL1 LVL0
|
|
* 0 0 0 0 0 0
|
|
*
|
|
* we have to look at all levels @index 0. With
|
|
*
|
|
* LVL5 LVL4 LVL3 LVL2 LVL1 LVL0
|
|
* 0 0 0 0 0 2
|
|
*
|
|
* LVL0 has the next expiring bucket @index 2. The upper
|
|
* levels have the next expiring bucket @index 1.
|
|
*
|
|
* In case that the propagation wraps the next level the same
|
|
* rules apply:
|
|
*
|
|
* LVL5 LVL4 LVL3 LVL2 LVL1 LVL0
|
|
* 0 0 0 0 F 2
|
|
*
|
|
* So after looking at LVL0 we get:
|
|
*
|
|
* LVL5 LVL4 LVL3 LVL2 LVL1
|
|
* 0 0 0 1 0
|
|
*
|
|
* So no propagation from LVL1 to LVL2 because that happened
|
|
* with the add already, but then we need to propagate further
|
|
* from LVL2 to LVL3.
|
|
*
|
|
* So the simple check whether the lower bits of the current
|
|
* level are 0 or not is sufficient for all cases.
|
|
*/
|
|
adj = clk & LVL_CLK_MASK ? 1 : 0;
|
|
clk >>= LVL_CLK_SHIFT;
|
|
clk += adj;
|
|
}
|
|
return next;
|
|
}
|
|
|
|
/*
|
|
* Check, if the next hrtimer event is before the next timer wheel
|
|
* event:
|
|
*/
|
|
static u64 cmp_next_hrtimer_event(u64 basem, u64 expires)
|
|
{
|
|
u64 nextevt = hrtimer_get_next_event();
|
|
|
|
/*
|
|
* If high resolution timers are enabled
|
|
* hrtimer_get_next_event() returns KTIME_MAX.
|
|
*/
|
|
if (expires <= nextevt)
|
|
return expires;
|
|
|
|
/*
|
|
* If the next timer is already expired, return the tick base
|
|
* time so the tick is fired immediately.
|
|
*/
|
|
if (nextevt <= basem)
|
|
return basem;
|
|
|
|
/*
|
|
* Round up to the next jiffie. High resolution timers are
|
|
* off, so the hrtimers are expired in the tick and we need to
|
|
* make sure that this tick really expires the timer to avoid
|
|
* a ping pong of the nohz stop code.
|
|
*
|
|
* Use DIV_ROUND_UP_ULL to prevent gcc calling __divdi3
|
|
*/
|
|
return DIV_ROUND_UP_ULL(nextevt, TICK_NSEC) * TICK_NSEC;
|
|
}
|
|
|
|
|
|
#ifdef CONFIG_SMP
|
|
/*
|
|
* check_pending_deferrable_timers - Check for unbound deferrable timer expiry
|
|
* @cpu - Current CPU
|
|
*
|
|
* The function checks whether any global deferrable pending timers
|
|
* are exipired or not. This function does not check cpu bounded
|
|
* diferrable pending timers expiry.
|
|
*
|
|
* The function returns true when a cpu unbounded deferrable timer is expired.
|
|
*/
|
|
bool check_pending_deferrable_timers(int cpu)
|
|
{
|
|
if (cpu == tick_do_timer_cpu ||
|
|
tick_do_timer_cpu == TICK_DO_TIMER_NONE) {
|
|
if (time_after_eq(jiffies, timer_base_deferrable.clk)
|
|
&& !atomic_cmpxchg(&deferrable_pending, 0, 1)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
#endif
|
|
|
|
/**
|
|
* get_next_timer_interrupt - return the time (clock mono) of the next timer
|
|
* @basej: base time jiffies
|
|
* @basem: base time clock monotonic
|
|
*
|
|
* Returns the tick aligned clock monotonic time of the next pending
|
|
* timer or KTIME_MAX if no timer is pending.
|
|
*/
|
|
u64 get_next_timer_interrupt(unsigned long basej, u64 basem)
|
|
{
|
|
struct timer_base *base = this_cpu_ptr(&timer_bases[BASE_STD]);
|
|
u64 expires = KTIME_MAX;
|
|
unsigned long nextevt;
|
|
bool is_max_delta;
|
|
|
|
/*
|
|
* Pretend that there is no timer pending if the cpu is offline.
|
|
* Possible pending timers will be migrated later to an active cpu.
|
|
*/
|
|
if (cpu_is_offline(smp_processor_id()))
|
|
return expires;
|
|
|
|
raw_spin_lock(&base->lock);
|
|
nextevt = __next_timer_interrupt(base);
|
|
is_max_delta = (nextevt == base->clk + NEXT_TIMER_MAX_DELTA);
|
|
base->next_expiry = nextevt;
|
|
/*
|
|
* We have a fresh next event. Check whether we can forward the
|
|
* base. We can only do that when @basej is past base->clk
|
|
* otherwise we might rewind base->clk.
|
|
*/
|
|
if (time_after(basej, base->clk)) {
|
|
if (time_after(nextevt, basej))
|
|
base->clk = basej;
|
|
else if (time_after(nextevt, base->clk))
|
|
base->clk = nextevt;
|
|
}
|
|
|
|
if (time_before_eq(nextevt, basej)) {
|
|
expires = basem;
|
|
base->is_idle = false;
|
|
} else {
|
|
if (!is_max_delta)
|
|
expires = basem + (u64)(nextevt - basej) * TICK_NSEC;
|
|
/*
|
|
* If we expect to sleep more than a tick, mark the base idle.
|
|
* Also the tick is stopped so any added timer must forward
|
|
* the base clk itself to keep granularity small. This idle
|
|
* logic is only maintained for the BASE_STD base, deferrable
|
|
* timers may still see large granularity skew (by design).
|
|
*/
|
|
if ((expires - basem) > TICK_NSEC) {
|
|
base->must_forward_clk = true;
|
|
base->is_idle = true;
|
|
}
|
|
}
|
|
raw_spin_unlock(&base->lock);
|
|
|
|
return cmp_next_hrtimer_event(basem, expires);
|
|
}
|
|
|
|
/**
|
|
* timer_clear_idle - Clear the idle state of the timer base
|
|
*
|
|
* Called with interrupts disabled
|
|
*/
|
|
void timer_clear_idle(void)
|
|
{
|
|
struct timer_base *base = this_cpu_ptr(&timer_bases[BASE_STD]);
|
|
|
|
/*
|
|
* We do this unlocked. The worst outcome is a remote enqueue sending
|
|
* a pointless IPI, but taking the lock would just make the window for
|
|
* sending the IPI a few instructions smaller for the cost of taking
|
|
* the lock in the exit from idle path.
|
|
*/
|
|
base->is_idle = false;
|
|
}
|
|
|
|
static int collect_expired_timers(struct timer_base *base,
|
|
struct hlist_head *heads)
|
|
{
|
|
unsigned long now = READ_ONCE(jiffies);
|
|
|
|
/*
|
|
* NOHZ optimization. After a long idle sleep we need to forward the
|
|
* base to current jiffies. Avoid a loop by searching the bitfield for
|
|
* the next expiring timer.
|
|
*/
|
|
if ((long)(now - base->clk) > 2) {
|
|
unsigned long next = __next_timer_interrupt(base);
|
|
|
|
/*
|
|
* If the next timer is ahead of time forward to current
|
|
* jiffies, otherwise forward to the next expiry time:
|
|
*/
|
|
if (time_after(next, now)) {
|
|
/*
|
|
* The call site will increment base->clk and then
|
|
* terminate the expiry loop immediately.
|
|
*/
|
|
base->clk = now;
|
|
return 0;
|
|
}
|
|
base->clk = next;
|
|
}
|
|
return __collect_expired_timers(base, heads);
|
|
}
|
|
#else
|
|
static inline int collect_expired_timers(struct timer_base *base,
|
|
struct hlist_head *heads)
|
|
{
|
|
return __collect_expired_timers(base, heads);
|
|
}
|
|
#endif
|
|
|
|
/*
|
|
* Called from the timer interrupt handler to charge one tick to the current
|
|
* process. user_tick is 1 if the tick is user time, 0 for system.
|
|
*/
|
|
void update_process_times(int user_tick)
|
|
{
|
|
struct task_struct *p = current;
|
|
|
|
/* Note: this timer irq context must be accounted for as well. */
|
|
account_process_tick(p, user_tick);
|
|
run_local_timers();
|
|
rcu_check_callbacks(user_tick);
|
|
#ifdef CONFIG_IRQ_WORK
|
|
if (in_irq())
|
|
irq_work_tick();
|
|
#endif
|
|
scheduler_tick();
|
|
if (IS_ENABLED(CONFIG_POSIX_TIMERS))
|
|
run_posix_cpu_timers(p);
|
|
}
|
|
|
|
/**
|
|
* __run_timers - run all expired timers (if any) on this CPU.
|
|
* @base: the timer vector to be processed.
|
|
*/
|
|
static inline void __run_timers(struct timer_base *base)
|
|
{
|
|
struct hlist_head heads[LVL_DEPTH];
|
|
int levels;
|
|
|
|
if (!time_after_eq(jiffies, base->clk))
|
|
return;
|
|
|
|
raw_spin_lock_irq(&base->lock);
|
|
|
|
/*
|
|
* timer_base::must_forward_clk must be cleared before running
|
|
* timers so that any timer functions that call mod_timer() will
|
|
* not try to forward the base. Idle tracking / clock forwarding
|
|
* logic is only used with BASE_STD timers.
|
|
*
|
|
* The must_forward_clk flag is cleared unconditionally also for
|
|
* the deferrable base. The deferrable base is not affected by idle
|
|
* tracking and never forwarded, so clearing the flag is a NOOP.
|
|
*
|
|
* The fact that the deferrable base is never forwarded can cause
|
|
* large variations in granularity for deferrable timers, but they
|
|
* can be deferred for long periods due to idle anyway.
|
|
*/
|
|
base->must_forward_clk = false;
|
|
|
|
while (time_after_eq(jiffies, base->clk)) {
|
|
|
|
levels = collect_expired_timers(base, heads);
|
|
base->clk++;
|
|
|
|
while (levels--)
|
|
expire_timers(base, heads + levels);
|
|
}
|
|
base->running_timer = NULL;
|
|
raw_spin_unlock_irq(&base->lock);
|
|
}
|
|
|
|
/*
|
|
* This function runs timers and the timer-tq in bottom half context.
|
|
*/
|
|
static __latent_entropy void run_timer_softirq(struct softirq_action *h)
|
|
{
|
|
struct timer_base *base = this_cpu_ptr(&timer_bases[BASE_STD]);
|
|
|
|
__run_timers(base);
|
|
if (IS_ENABLED(CONFIG_NO_HZ_COMMON)) {
|
|
__run_timers(this_cpu_ptr(&timer_bases[BASE_DEF]));
|
|
}
|
|
|
|
if ((atomic_cmpxchg(&deferrable_pending, 1, 0) &&
|
|
tick_do_timer_cpu == TICK_DO_TIMER_NONE) ||
|
|
tick_do_timer_cpu == smp_processor_id())
|
|
__run_timers(&timer_base_deferrable);
|
|
}
|
|
|
|
/*
|
|
* Called by the local, per-CPU timer interrupt on SMP.
|
|
*/
|
|
void run_local_timers(void)
|
|
{
|
|
struct timer_base *base = this_cpu_ptr(&timer_bases[BASE_STD]);
|
|
|
|
hrtimer_run_queues();
|
|
/* Raise the softirq only if required. */
|
|
if (time_before(jiffies, base->clk)) {
|
|
if (!IS_ENABLED(CONFIG_NO_HZ_COMMON))
|
|
return;
|
|
/* CPU is awake, so check the deferrable base. */
|
|
base++;
|
|
if (time_before(jiffies, base->clk))
|
|
return;
|
|
}
|
|
raise_softirq(TIMER_SOFTIRQ);
|
|
}
|
|
|
|
/*
|
|
* Since schedule_timeout()'s timer is defined on the stack, it must store
|
|
* the target task on the stack as well.
|
|
*/
|
|
struct process_timer {
|
|
struct timer_list timer;
|
|
struct task_struct *task;
|
|
};
|
|
|
|
static void process_timeout(struct timer_list *t)
|
|
{
|
|
struct process_timer *timeout = from_timer(timeout, t, timer);
|
|
|
|
wake_up_process(timeout->task);
|
|
}
|
|
|
|
/**
|
|
* schedule_timeout - sleep until timeout
|
|
* @timeout: timeout value in jiffies
|
|
*
|
|
* Make the current task sleep until @timeout jiffies have
|
|
* elapsed. The routine will return immediately unless
|
|
* the current task state has been set (see set_current_state()).
|
|
*
|
|
* You can set the task state as follows -
|
|
*
|
|
* %TASK_UNINTERRUPTIBLE - at least @timeout jiffies are guaranteed to
|
|
* pass before the routine returns unless the current task is explicitly
|
|
* woken up, (e.g. by wake_up_process())".
|
|
*
|
|
* %TASK_INTERRUPTIBLE - the routine may return early if a signal is
|
|
* delivered to the current task or the current task is explicitly woken
|
|
* up.
|
|
*
|
|
* The current task state is guaranteed to be TASK_RUNNING when this
|
|
* routine returns.
|
|
*
|
|
* Specifying a @timeout value of %MAX_SCHEDULE_TIMEOUT will schedule
|
|
* the CPU away without a bound on the timeout. In this case the return
|
|
* value will be %MAX_SCHEDULE_TIMEOUT.
|
|
*
|
|
* Returns 0 when the timer has expired otherwise the remaining time in
|
|
* jiffies will be returned. In all cases the return value is guaranteed
|
|
* to be non-negative.
|
|
*/
|
|
signed long __sched schedule_timeout(signed long timeout)
|
|
{
|
|
struct process_timer timer;
|
|
unsigned long expire;
|
|
|
|
switch (timeout)
|
|
{
|
|
case MAX_SCHEDULE_TIMEOUT:
|
|
/*
|
|
* These two special cases are useful to be comfortable
|
|
* in the caller. Nothing more. We could take
|
|
* MAX_SCHEDULE_TIMEOUT from one of the negative value
|
|
* but I' d like to return a valid offset (>=0) to allow
|
|
* the caller to do everything it want with the retval.
|
|
*/
|
|
schedule();
|
|
goto out;
|
|
default:
|
|
/*
|
|
* Another bit of PARANOID. Note that the retval will be
|
|
* 0 since no piece of kernel is supposed to do a check
|
|
* for a negative retval of schedule_timeout() (since it
|
|
* should never happens anyway). You just have the printk()
|
|
* that will tell you if something is gone wrong and where.
|
|
*/
|
|
if (timeout < 0) {
|
|
printk(KERN_ERR "schedule_timeout: wrong timeout "
|
|
"value %lx\n", timeout);
|
|
dump_stack();
|
|
current->state = TASK_RUNNING;
|
|
goto out;
|
|
}
|
|
}
|
|
|
|
expire = timeout + jiffies;
|
|
|
|
timer.task = current;
|
|
timer_setup_on_stack(&timer.timer, process_timeout, 0);
|
|
__mod_timer(&timer.timer, expire, 0);
|
|
schedule();
|
|
del_singleshot_timer_sync(&timer.timer);
|
|
|
|
/* Remove the timer from the object tracker */
|
|
destroy_timer_on_stack(&timer.timer);
|
|
|
|
timeout = expire - jiffies;
|
|
|
|
out:
|
|
return timeout < 0 ? 0 : timeout;
|
|
}
|
|
EXPORT_SYMBOL(schedule_timeout);
|
|
|
|
/*
|
|
* We can use __set_current_state() here because schedule_timeout() calls
|
|
* schedule() unconditionally.
|
|
*/
|
|
signed long __sched schedule_timeout_interruptible(signed long timeout)
|
|
{
|
|
__set_current_state(TASK_INTERRUPTIBLE);
|
|
return schedule_timeout(timeout);
|
|
}
|
|
EXPORT_SYMBOL(schedule_timeout_interruptible);
|
|
|
|
signed long __sched schedule_timeout_killable(signed long timeout)
|
|
{
|
|
__set_current_state(TASK_KILLABLE);
|
|
return schedule_timeout(timeout);
|
|
}
|
|
EXPORT_SYMBOL(schedule_timeout_killable);
|
|
|
|
signed long __sched schedule_timeout_uninterruptible(signed long timeout)
|
|
{
|
|
__set_current_state(TASK_UNINTERRUPTIBLE);
|
|
return schedule_timeout(timeout);
|
|
}
|
|
EXPORT_SYMBOL(schedule_timeout_uninterruptible);
|
|
|
|
/*
|
|
* Like schedule_timeout_uninterruptible(), except this task will not contribute
|
|
* to load average.
|
|
*/
|
|
signed long __sched schedule_timeout_idle(signed long timeout)
|
|
{
|
|
__set_current_state(TASK_IDLE);
|
|
return schedule_timeout(timeout);
|
|
}
|
|
EXPORT_SYMBOL(schedule_timeout_idle);
|
|
|
|
#ifdef CONFIG_HOTPLUG_CPU
|
|
static void migrate_timer_list(struct timer_base *new_base,
|
|
struct hlist_head *head, bool remove_pinned)
|
|
{
|
|
struct timer_list *timer;
|
|
int cpu = new_base->cpu;
|
|
struct hlist_node *n;
|
|
int is_pinned;
|
|
|
|
hlist_for_each_entry_safe(timer, n, head, entry) {
|
|
is_pinned = timer->flags & TIMER_PINNED;
|
|
if (!remove_pinned && is_pinned)
|
|
continue;
|
|
|
|
detach_if_pending(timer, get_timer_base(timer->flags), false);
|
|
timer->flags = (timer->flags & ~TIMER_BASEMASK) | cpu;
|
|
internal_add_timer(new_base, timer);
|
|
}
|
|
}
|
|
|
|
int timers_prepare_cpu(unsigned int cpu)
|
|
{
|
|
struct timer_base *base;
|
|
int b;
|
|
|
|
for (b = 0; b < NR_BASES; b++) {
|
|
base = per_cpu_ptr(&timer_bases[b], cpu);
|
|
base->clk = jiffies;
|
|
base->next_expiry = base->clk + NEXT_TIMER_MAX_DELTA;
|
|
base->is_idle = false;
|
|
base->must_forward_clk = true;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
static void __migrate_timers(unsigned int cpu, bool remove_pinned)
|
|
{
|
|
struct timer_base *old_base;
|
|
struct timer_base *new_base;
|
|
unsigned long flags;
|
|
int b, i;
|
|
|
|
for (b = 0; b < NR_BASES; b++) {
|
|
old_base = per_cpu_ptr(&timer_bases[b], cpu);
|
|
new_base = get_cpu_ptr(&timer_bases[b]);
|
|
/*
|
|
* The caller is globally serialized and nobody else
|
|
* takes two locks at once, deadlock is not possible.
|
|
*/
|
|
raw_spin_lock_irqsave(&new_base->lock, flags);
|
|
raw_spin_lock_nested(&old_base->lock, SINGLE_DEPTH_NESTING);
|
|
|
|
/*
|
|
* The current CPUs base clock might be stale. Update it
|
|
* before moving the timers over.
|
|
*/
|
|
forward_timer_base(new_base);
|
|
|
|
if (!cpu_online(cpu))
|
|
BUG_ON(old_base->running_timer);
|
|
|
|
for (i = 0; i < WHEEL_SIZE; i++)
|
|
migrate_timer_list(new_base, old_base->vectors + i,
|
|
remove_pinned);
|
|
|
|
raw_spin_unlock(&old_base->lock);
|
|
raw_spin_unlock_irqrestore(&new_base->lock, flags);
|
|
put_cpu_ptr(&timer_bases);
|
|
}
|
|
}
|
|
|
|
int timers_dead_cpu(unsigned int cpu)
|
|
{
|
|
BUG_ON(cpu_online(cpu));
|
|
__migrate_timers(cpu, true);
|
|
return 0;
|
|
}
|
|
|
|
void timer_quiesce_cpu(void *cpup)
|
|
{
|
|
__migrate_timers(*(unsigned int *)cpup, false);
|
|
}
|
|
|
|
#endif /* CONFIG_HOTPLUG_CPU */
|
|
|
|
static void __init init_timer_cpu(int cpu)
|
|
{
|
|
struct timer_base *base;
|
|
int i;
|
|
|
|
for (i = 0; i < NR_BASES; i++) {
|
|
base = per_cpu_ptr(&timer_bases[i], cpu);
|
|
base->cpu = cpu;
|
|
raw_spin_lock_init(&base->lock);
|
|
base->clk = jiffies;
|
|
}
|
|
}
|
|
|
|
static inline void init_timer_deferrable_global(void)
|
|
{
|
|
timer_base_deferrable.cpu = nr_cpu_ids;
|
|
raw_spin_lock_init(&timer_base_deferrable.lock);
|
|
timer_base_deferrable.clk = jiffies;
|
|
}
|
|
|
|
static void __init init_timer_cpus(void)
|
|
{
|
|
int cpu;
|
|
|
|
init_timer_deferrable_global();
|
|
|
|
for_each_possible_cpu(cpu)
|
|
init_timer_cpu(cpu);
|
|
}
|
|
|
|
void __init init_timers(void)
|
|
{
|
|
init_timer_cpus();
|
|
open_softirq(TIMER_SOFTIRQ, run_timer_softirq);
|
|
}
|
|
|
|
/**
|
|
* msleep - sleep safely even with waitqueue interruptions
|
|
* @msecs: Time in milliseconds to sleep for
|
|
*/
|
|
void msleep(unsigned int msecs)
|
|
{
|
|
unsigned long timeout = msecs_to_jiffies(msecs) + 1;
|
|
|
|
while (timeout)
|
|
timeout = schedule_timeout_uninterruptible(timeout);
|
|
}
|
|
|
|
EXPORT_SYMBOL(msleep);
|
|
|
|
/**
|
|
* msleep_interruptible - sleep waiting for signals
|
|
* @msecs: Time in milliseconds to sleep for
|
|
*/
|
|
unsigned long msleep_interruptible(unsigned int msecs)
|
|
{
|
|
unsigned long timeout = msecs_to_jiffies(msecs) + 1;
|
|
|
|
while (timeout && !signal_pending(current))
|
|
timeout = schedule_timeout_interruptible(timeout);
|
|
return jiffies_to_msecs(timeout);
|
|
}
|
|
|
|
EXPORT_SYMBOL(msleep_interruptible);
|
|
|
|
/**
|
|
* usleep_range - Sleep for an approximate time
|
|
* @min: Minimum time in usecs to sleep
|
|
* @max: Maximum time in usecs to sleep
|
|
*
|
|
* In non-atomic context where the exact wakeup time is flexible, use
|
|
* usleep_range() instead of udelay(). The sleep improves responsiveness
|
|
* by avoiding the CPU-hogging busy-wait of udelay(), and the range reduces
|
|
* power usage by allowing hrtimers to take advantage of an already-
|
|
* scheduled interrupt instead of scheduling a new one just for this sleep.
|
|
*/
|
|
void __sched usleep_range(unsigned long min, unsigned long max)
|
|
{
|
|
ktime_t exp = ktime_add_us(ktime_get(), min);
|
|
u64 delta = (u64)(max - min) * NSEC_PER_USEC;
|
|
|
|
for (;;) {
|
|
__set_current_state(TASK_UNINTERRUPTIBLE);
|
|
/* Do not return before the requested sleep time has elapsed */
|
|
if (!schedule_hrtimeout_range(&exp, delta, HRTIMER_MODE_ABS))
|
|
break;
|
|
}
|
|
}
|
|
EXPORT_SYMBOL(usleep_range);
|