-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmVmHpsACgkQONu9yGCS aT5uvw//SzcE0GImnHnfeN7iXtpFE9O0fhTxsjZCi8/HTXmGWPtQgWscd9y81bAd EHBVr456GXqd6KuIF+03g/r/FYinwWqK375meLfaybw1vSBP+fZttrEGqz6nTnYD yqOxw2bqgz8Xjp63UeNHD6mifpBvVtuAvzrfO1E2Ie/U1OU2uKdjRRv0iijKNeWN liOYTXaddIkVfZR0z6dVTl0hb5dPWsxNmF77kfVpKz4ALIHJcO13DlUuKtQz6Sb6 0ElmJpuonHuUxHzb8e9LLsFy3IvbBqomSscwcd0tngtdUTzhMYFIZLjg2+WQ9Ovq raMGqvS/bKsoyoTBNKL83QB2NyXQb3vkfL0NgLsq9IwDl+r96mP9ctANYGwSjhND o/4sa/fbMFzeInA8Rzh7i56RCNstOBKApJPhBzWuY0f/6b1BZpvZaONyX3fFksWO dMeYT16GgO4lhQXnG3O6mtDT8eoZ1fLf7ZdGEZ2NktcOzXYelNc4aXJke7qdlIop CVxM+Ur+juj+DJymo59a6baXjEgIROdHq83N3CZwetGviPHneGqgYc0K7ETtA33H sH/0KGYAT8SzzjMlnXB0lpjp68WViJfzzo9Wxdf2aDZbL3SdI14GPKMUeDqqeSyU 8bB2Hb4ItccRFW9RriiE3BPGnLGu7PDTkn5TgXDG/bDX54Cb5DQ= =YPzI -----END PGP SIGNATURE----- Merge 6.1.64 into android14-6.1-lts Changes in 6.1.64 locking/ww_mutex/test: Fix potential workqueue corruption lib/generic-radix-tree.c: Don't overflow in peek() perf/core: Bail out early if the request AUX area is out of bound srcu: Fix srcu_struct node grpmask overflow on 64-bit systems selftests/lkdtm: Disable CONFIG_UBSAN_TRAP in test config clocksource/drivers/timer-imx-gpt: Fix potential memory leak clocksource/drivers/timer-atmel-tcb: Fix initialization on SAM9 hardware smp,csd: Throw an error if a CSD lock is stuck for too long cpu/hotplug: Don't offline the last non-isolated CPU workqueue: Provide one lock class key per work_on_cpu() callsite x86/mm: Drop the 4 MB restriction on minimal NUMA node memory size wifi: plfxlc: fix clang-specific fortify warning wifi: mac80211_hwsim: fix clang-specific fortify warning wifi: mac80211: don't return unset power in ieee80211_get_tx_power() atl1c: Work around the DMA RX overflow issue bpf: Detect IP == ksym.end as part of BPF program wifi: ath9k: fix clang-specific fortify warnings wifi: ath10k: fix clang-specific fortify warning net: annotate data-races around sk->sk_tx_queue_mapping net: annotate data-races around sk->sk_dst_pending_confirm wifi: ath10k: Don't touch the CE interrupt registers after power up vsock: read from socket's error queue bpf: Ensure proper register state printing for cond jumps Bluetooth: btusb: Add date->evt_skb is NULL check Bluetooth: Fix double free in hci_conn_cleanup ACPI: EC: Add quirk for HP 250 G7 Notebook PC tsnep: Fix tsnep_request_irq() format-overflow warning platform/chrome: kunit: initialize lock for fake ec_dev platform/x86: thinkpad_acpi: Add battery quirk for Thinkpad X120e drm/gma500: Fix call trace when psb_gem_mm_init() fails drm/komeda: drop all currently held locks if deadlock happens drm/amdgpu: not to save bo in the case of RAS err_event_athub drm/amdkfd: Fix a race condition of vram buffer unref in svm code drm/amd: Update `update_pcie_parameters` functions to use uint8_t arguments drm/amd/display: use full update for clip size increase of large plane source string.h: add array-wrappers for (v)memdup_user() kernel: kexec: copy user-array safely kernel: watch_queue: copy user-array safely drm_lease.c: copy user-array safely drm: vmwgfx_surface.c: copy user-array safely drm/msm/dp: skip validity check for DP CTS EDID checksum drm/amd: Fix UBSAN array-index-out-of-bounds for SMU7 drm/amd: Fix UBSAN array-index-out-of-bounds for Polaris and Tonga drm/amdgpu: Fix potential null pointer derefernce drm/panel: fix a possible null pointer dereference drm/panel/panel-tpo-tpg110: fix a possible null pointer dereference drm/radeon: fix a possible null pointer dereference drm/amdgpu/vkms: fix a possible null pointer dereference drm/panel: st7703: Pick different reset sequence drm/amdkfd: Fix shift out-of-bounds issue drm/amdgpu: Fix a null pointer access when the smc_rreg pointer is NULL arm64: dts: ls208xa: use a pseudo-bus to constrain usb dma size selftests/efivarfs: create-read: fix a resource leak ASoC: soc-card: Add storage for PCI SSID ASoC: SOF: Pass PCI SSID to machine driver crypto: pcrypt - Fix hungtask for PADATA_RESET ASoC: SOF: ipc4: handle EXCEPTION_CAUGHT notification from firmware RDMA/hfi1: Use FIELD_GET() to extract Link Width scsi: hisi_sas: Set debugfs_dir pointer to NULL after removing debugfs scsi: ibmvfc: Remove BUG_ON in the case of an empty event pool fs/jfs: Add check for negative db_l2nbperpage fs/jfs: Add validity check for db_maxag and db_agpref jfs: fix array-index-out-of-bounds in dbFindLeaf jfs: fix array-index-out-of-bounds in diAlloc HID: lenovo: Detect quirk-free fw on cptkbd and stop applying workaround ARM: 9320/1: fix stack depot IRQ stack filter ALSA: hda: Fix possible null-ptr-deref when assigning a stream PCI: tegra194: Use FIELD_GET()/FIELD_PREP() with Link Width fields PCI: mvebu: Use FIELD_PREP() with Link Width atm: iphase: Do PCI error checks on own line PCI: Do error check on own line to split long "if" conditions scsi: libfc: Fix potential NULL pointer dereference in fc_lport_ptp_setup() PCI: Use FIELD_GET() to extract Link Width PCI: Extract ATS disabling to a helper function PCI: Disable ATS for specific Intel IPU E2000 devices misc: pci_endpoint_test: Add Device ID for R-Car S4-8 PCIe controller PCI: Use FIELD_GET() in Sapphire RX 5600 XT Pulse quirk ASoC: Intel: soc-acpi-cht: Add Lenovo Yoga Tab 3 Pro YT3-X90 quirk crypto: hisilicon/qm - prevent soft lockup in receive loop HID: Add quirk for Dell Pro Wireless Keyboard and Mouse KM5221W exfat: support handle zero-size directory mfd: intel-lpss: Add Intel Lunar Lake-M PCI IDs iio: adc: stm32-adc: harden against NULL pointer deref in stm32_adc_probe() thunderbolt: Apply USB 3.x bandwidth quirk only in software connection manager tty: vcc: Add check for kstrdup() in vcc_probe() usb: dwc3: core: configure TX/RX threshold for DWC3_IP soundwire: dmi-quirks: update HP Omen match f2fs: fix error handling of __get_node_page usb: gadget: f_ncm: Always set current gadget in ncm_bind() 9p/trans_fd: Annotate data-racy writes to file::f_flags 9p: v9fs_listxattr: fix %s null argument warning i3c: mipi-i3c-hci: Fix out of bounds access in hci_dma_irq_handler i2c: fix memleak in i2c_new_client_device() i2c: sun6i-p2wi: Prevent potential division by zero virtio-blk: fix implicit overflow on virtio_max_dma_size i3c: master: mipi-i3c-hci: Fix a kernel panic for accessing DAT_data. media: gspca: cpia1: shift-out-of-bounds in set_flicker media: vivid: avoid integer overflow gfs2: ignore negated quota changes gfs2: fix an oops in gfs2_permission media: cobalt: Use FIELD_GET() to extract Link Width media: ccs: Fix driver quirk struct documentation media: imon: fix access to invalid resource for the second interface drm/amd/display: Avoid NULL dereference of timing generator kgdb: Flush console before entering kgdb on panic i2c: dev: copy userspace array safely ASoC: ti: omap-mcbsp: Fix runtime PM underflow warnings drm/qxl: prevent memory leak ALSA: hda/realtek: Add quirk for ASUS UX7602ZM drm/amdgpu: fix software pci_unplug on some chips pwm: Fix double shift bug mtd: rawnand: tegra: add missing check for platform_get_irq() wifi: iwlwifi: Use FW rate for non-data frames sched/core: Optimize in_task() and in_interrupt() a bit SUNRPC: ECONNRESET might require a rebind mtd: rawnand: intel: check return value of devm_kasprintf() mtd: rawnand: meson: check return value of devm_kasprintf() NFSv4.1: fix handling NFS4ERR_DELAY when testing for session trunking SUNRPC: Add an IS_ERR() check back to where it was NFSv4.1: fix SP4_MACH_CRED protection for pnfs IO SUNRPC: Fix RPC client cleaned up the freed pipefs dentries gfs2: Silence "suspicious RCU usage in gfs2_permission" warning vhost-vdpa: fix use after free in vhost_vdpa_probe() net: set SOCK_RCU_FREE before inserting socket into hashtable ipvlan: add ipvlan_route_v6_outbound() helper tty: Fix uninit-value access in ppp_sync_receive() net: hns3: fix add VLAN fail issue net: hns3: add barrier in vf mailbox reply process net: hns3: fix incorrect capability bit display for copper port net: hns3: fix out-of-bounds access may occur when coalesce info is read via debugfs net: hns3: fix variable may not initialized problem in hns3_init_mac_addr() net: hns3: fix VF reset fail issue net: hns3: fix VF wrong speed and duplex issue tipc: Fix kernel-infoleak due to uninitialized TLV value net: mvneta: fix calls to page_pool_get_stats ppp: limit MRU to 64K xen/events: fix delayed eoi list handling ptp: annotate data-race around q->head and q->tail bonding: stop the device in bond_setup_by_slave() net: ethernet: cortina: Fix max RX frame define net: ethernet: cortina: Handle large frames net: ethernet: cortina: Fix MTU max setting af_unix: fix use-after-free in unix_stream_read_actor() netfilter: nf_conntrack_bridge: initialize err to 0 netfilter: nf_tables: fix pointer math issue in nft_byteorder_eval() net: stmmac: fix rx budget limit check net: stmmac: avoid rx queue overrun net/mlx5e: fix double free of encap_header net/mlx5e: fix double free of encap_header in update funcs net/mlx5e: Fix pedit endianness net/mlx5e: Reduce the size of icosq_str net/mlx5e: Check return value of snprintf writing to fw_version buffer net/mlx5e: Check return value of snprintf writing to fw_version buffer for representors macvlan: Don't propagate promisc change to lower dev in passthru tools/power/turbostat: Fix a knl bug tools/power/turbostat: Enable the C-state Pre-wake printing cifs: spnego: add ';' in HOST_KEY_LEN cifs: fix check of rc in function generate_smb3signingkey i915/perf: Fix NULL deref bugs with drm_dbg() calls media: venus: hfi: add checks to perform sanity on queue pointers perf intel-pt: Fix async branch flags powerpc/perf: Fix disabling BHRB and instruction sampling randstruct: Fix gcc-plugin performance mode to stay in group bpf: Fix check_stack_write_fixed_off() to correctly spill imm bpf: Fix precision tracking for BPF_ALU | BPF_TO_BE | BPF_END scsi: mpt3sas: Fix loop logic scsi: megaraid_sas: Increase register read retry rount from 3 to 30 for selected registers scsi: qla2xxx: Fix system crash due to bad pointer access crypto: x86/sha - load modules based on CPU features x86/cpu/hygon: Fix the CPU topology evaluation for real KVM: x86: hyper-v: Don't auto-enable stimer on write from user-space KVM: x86: Ignore MSR_AMD64_TW_CFG access KVM: x86: Clear bit12 of ICR after APIC-write VM-exit audit: don't take task_lock() in audit_exe_compare() code path audit: don't WARN_ON_ONCE(!current->mm) in audit_exe_compare() proc: sysctl: prevent aliased sysctls from getting passed to init tty/sysrq: replace smp_processor_id() with get_cpu() tty: serial: meson: fix hard LOCKUP on crtscts mode hvc/xen: fix console unplug hvc/xen: fix error path in xen_hvc_init() to always register frontend driver hvc/xen: fix event channel handling for secondary consoles PCI/sysfs: Protect driver's D3cold preference from user space mm/damon/sysfs: remove requested targets when online-commit inputs mm/damon/sysfs: update monitoring target regions for online input commit watchdog: move softlockup_panic back to early_param mm/damon/lru_sort: avoid divide-by-zero in hot threshold calculation mm/damon/ops-common: avoid divide-by-zero during region hotness calculation mm/damon: implement a function for max nr_accesses safe calculation mm/damon/sysfs: check error from damon_sysfs_update_target() ACPI: resource: Do IRQ override on TongFang GMxXGxx regmap: Ensure range selector registers are updated after cache sync wifi: ath11k: fix temperature event locking wifi: ath11k: fix dfs radar event locking wifi: ath11k: fix htt pktlog locking wifi: ath11k: fix gtk offload status event locking mmc: meson-gx: Remove setting of CMD_CFG_ERROR genirq/generic_chip: Make irq_remove_generic_chip() irqdomain aware KEYS: trusted: tee: Refactor register SHM usage KEYS: trusted: Rollback init_trusted() consistently PCI: keystone: Don't discard .remove() callback PCI: keystone: Don't discard .probe() callback arm64: Restrict CPU_BIG_ENDIAN to GNU as or LLVM IAS 15.x or newer parisc/pdc: Add width field to struct pdc_model parisc/power: Add power soft-off when running on qemu clk: socfpga: Fix undefined behavior bug in struct stratix10_clock_data clk: qcom: ipq8074: drop the CLK_SET_RATE_PARENT flag from PLL clocks clk: qcom: ipq6018: drop the CLK_SET_RATE_PARENT flag from PLL clocks ksmbd: handle malformed smb1 message ksmbd: fix slab out of bounds write in smb_inherit_dacl() mmc: vub300: fix an error code mmc: sdhci_am654: fix start loop index for TAP value parsing mmc: Add quirk MMC_QUIRK_BROKEN_CACHE_FLUSH for Micron eMMC Q2J54A PCI/ASPM: Fix L1 substate handling in aspm_attr_store_common() PCI: kirin: Don't discard .remove() callback PCI: exynos: Don't discard .remove() callback wifi: wilc1000: use vmm_table as array in wilc struct svcrdma: Drop connection after an RDMA Read error rcu/tree: Defer setting of jiffies during stall reset arm64: dts: qcom: ipq6018: Fix hwlock index for SMEM PM: hibernate: Use __get_safe_page() rather than touching the list PM: hibernate: Clean up sync_read handling in snapshot_write_next() rcu: kmemleak: Ignore kmemleak false positives when RCU-freeing objects btrfs: don't arbitrarily slow down delalloc if we're committing arm64: dts: qcom: ipq8074: Fix hwlock index for SMEM firmware: qcom_scm: use 64-bit calling convention only when client is 64-bit ACPI: FPDT: properly handle invalid FPDT subtables arm64: dts: qcom: ipq6018: Fix tcsr_mutex register size mfd: qcom-spmi-pmic: Fix reference leaks in revid helper mfd: qcom-spmi-pmic: Fix revid implementation ima: annotate iint mutex to avoid lockdep false positive warnings ima: detect changes to the backing overlay file netfilter: nf_tables: remove catchall element in GC sync path netfilter: nf_tables: split async and sync catchall in two functions selftests/resctrl: Remove duplicate feature check from CMT test selftests/resctrl: Move _GNU_SOURCE define into Makefile selftests/resctrl: Reduce failures due to outliers in MBA/MBM tests hid: lenovo: Resend all settings on reset_resume for compact keyboards ASoC: codecs: wsa-macro: fix uninitialized stack variables with name prefix jbd2: fix potential data lost in recovering journal raced with synchronizing fs bdev quota: explicitly forbid quota files from being encrypted kernel/reboot: emergency_restart: Set correct system_state i2c: core: Run atomic i2c xfer when !preemptible tracing: Have the user copy of synthetic event address use correct context driver core: Release all resources during unbind before updating device links mcb: fix error handling for different scenarios when parsing dmaengine: stm32-mdma: correct desc prep when channel running s390/cmma: fix detection of DAT pages mm/cma: use nth_page() in place of direct struct page manipulation mm/memory_hotplug: use pfn math in place of direct struct page manipulation mtd: cfi_cmdset_0001: Byte swap OTP info i3c: master: cdns: Fix reading status register i3c: master: svc: fix race condition in ibi work thread i3c: master: svc: fix wrong data return when IBI happen during start frame i3c: master: svc: fix ibi may not return mandatory data byte i3c: master: svc: fix check wrong status register in irq handler i3c: master: svc: fix SDA keep low when polling IBIWON timeout happen parisc: Prevent booting 64-bit kernels on PA1.x machines parisc/pgtable: Do not drop upper 5 address bits of physical address parisc/power: Fix power soft-off when running on qemu xhci: Enable RPM on controllers that support low-power states fs: add ctime accessors infrastructure smb3: fix creating FIFOs when mounting with "sfu" mount option smb3: fix touch -h of symlink smb3: fix caching of ctime on setxattr smb: client: fix use-after-free bug in cifs_debug_data_proc_show() smb: client: fix potential deadlock when releasing mids cifs: reconnect helper should set reconnect for the right channel cifs: force interface update before a fresh session setup cifs: do not reset chan_max if multichannel is not supported at mount xfs: recovery should not clear di_flushiter unconditionally btrfs: zoned: wait for data BG to be finished on direct IO allocation ALSA: info: Fix potential deadlock at disconnection ALSA: hda/realtek: Enable Mute LED on HP 255 G8 ALSA: hda/realtek - Add Dell ALC295 to pin fall back table ALSA: hda/realtek - Enable internal speaker of ASUS K6500ZC ALSA: hda/realtek: Enable Mute LED on HP 255 G10 ALSA: hda/realtek: Add quirks for HP Laptops pmdomain: bcm: bcm2835-power: check if the ASB register is equal to enable pmdomain: imx: Make imx pgc power domain also set the fwnode cpufreq: stats: Fix buffer overflow detection in trans_stats() clk: visconti: remove unused visconti_pll_provider::regmap clk: visconti: Fix undefined behavior bug in struct visconti_pll_provider Bluetooth: btusb: Add Realtek RTL8852BE support ID 0x0cb8:0xc559 bluetooth: Add device 0bda:887b to device tables bluetooth: Add device 13d3:3571 to device tables Bluetooth: btusb: Add RTW8852BE device 13d3:3570 to device tables Bluetooth: btusb: Add 0bda:b85b for Fn-Link RTL8852BE drm/amd/display: enable dsc_clk even if dsc_pg disabled cxl/region: Validate region mode vs decoder mode cxl/region: Cleanup target list on attach error cxl/region: Move region-position validation to a helper cxl/region: Do not try to cleanup after cxl_region_setup_targets() fails i3c: master: svc: add NACK check after start byte sent i3c: master: svc: fix random hot join failure since timeout error cxl: Unify debug messages when calling devm_cxl_add_port() cxl/mem: Move devm_cxl_add_endpoint() from cxl_core to cxl_mem tools/testing/cxl: Define a fixed volatile configuration to parse cxl/region: Fix x1 root-decoder granularity calculations Revert ncsi: Propagate carrier gain/loss events to the NCSI controller Revert "i2c: pxa: move to generic GPIO recovery" lsm: fix default return value for vm_enough_memory lsm: fix default return value for inode_getsecctx sbsa_gwdt: Calculate timeout with 64-bit math i2c: designware: Disable TX_EMPTY irq while waiting for block length byte s390/ap: fix AP bus crash on early config change callback invocation net: ethtool: Fix documentation of ethtool_sprintf() net: dsa: lan9303: consequently nested-lock physical MDIO net: phylink: initialize carrier state at creation i2c: i801: fix potential race in i801_block_transaction_byte_by_byte f2fs: do not return EFSCORRUPTED, but try to run online repair f2fs: avoid format-overflow warning media: lirc: drop trailing space from scancode transmit media: sharp: fix sharp encoding media: venus: hfi_parser: Add check to keep the number of codecs within range media: venus: hfi: fix the check to handle session buffer requirement media: venus: hfi: add checks to handle capabilities from firmware media: ccs: Correctly initialise try compose rectangle drm/mediatek/dp: fix memory leak on ->get_edid callback audio detection drm/mediatek/dp: fix memory leak on ->get_edid callback error path dm-verity: don't use blocking calls from tasklets nfsd: fix file memleak on client_opens_release LoongArch: Mark __percpu functions as always inline riscv: mm: Update the comment of CONFIG_PAGE_OFFSET riscv: correct pt_level name via pgtable_l5/4_enabled riscv: kprobes: allow writing to x0 mmc: sdhci-pci-gli: A workaround to allow GL9750 to enter ASPM L1.2 mm: fix for negative counter: nr_file_hugepages mm: kmem: drop __GFP_NOFAIL when allocating objcg vectors mptcp: deal with large GSO size mptcp: add validity check for sending RM_ADDR mptcp: fix setsockopt(IP_TOS) subflow locking r8169: fix network lost after resume on DASH systems r8169: add handling DASH when DASH is disabled mmc: sdhci-pci-gli: GL9750: Mask the replay timer timeout of AER media: qcom: camss: Fix pm_domain_on sequence in probe media: qcom: camss: Fix vfe_get() error jump media: qcom: camss: Fix VFE-17x vfe_disable_output() media: qcom: camss: Fix VFE-480 vfe_disable_output() media: qcom: camss: Fix missing vfe_lite clocks check media: qcom: camss: Fix invalid clock enable bit disjunction media: qcom: camss: Fix csid-gen2 for test pattern generator Revert "net: r8169: Disable multicast filter for RTL8168H and RTL8107E" ext4: apply umask if ACL support is disabled ext4: correct offset of gdb backup in non meta_bg group to update_backups ext4: mark buffer new if it is unwritten to avoid stale data exposure ext4: correct return value of ext4_convert_meta_bg ext4: correct the start block of counting reserved clusters ext4: remove gdb backup copy for meta bg in setup_new_flex_group_blocks ext4: add missed brelse in update_backups ext4: properly sync file size update after O_SYNC direct IO drm/amd/pm: Handle non-terminated overdrive commands. drm/i915: Bump GLK CDCLK frequency when driving multiple pipes drm/i915: Fix potential spectre vulnerability drm/amd/pm: Fix error of MACO flag setting code drm/amdgpu/smu13: drop compute workload workaround drm/amdgpu: don't use pci_is_thunderbolt_attached() drm/amdgpu: don't use ATRM for external devices drm/amdgpu: fix error handling in amdgpu_bo_list_get() drm/amdgpu: lower CS errors to debug severity drm/amd/display: fix a NULL pointer dereference in amdgpu_dm_i2c_xfer() drm/amd/display: Enable fast plane updates on DCN3.2 and above drm/amd/display: Change the DMCUB mailbox memory location from FB to inbox powerpc/powernv: Fix fortify source warnings in opal-prd.c tracing: Have trace_event_file have ref counters Input: xpad - add VID for Turtle Beach controllers mmc: sdhci-pci-gli: GL9755: Mask the replay timer timeout of AER cxl/port: Fix NULL pointer access in devm_cxl_add_port() RISC-V: drop error print from riscv_hartid_to_cpuid() Linux 6.1.64 Change-Id: I9284282aeae5d0f9da957a58147efe0114f8e60a Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
754 lines
24 KiB
C
754 lines
24 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* workqueue.h --- work queue handling for Linux.
|
|
*/
|
|
|
|
#ifndef _LINUX_WORKQUEUE_H
|
|
#define _LINUX_WORKQUEUE_H
|
|
|
|
#include <linux/timer.h>
|
|
#include <linux/linkage.h>
|
|
#include <linux/bitops.h>
|
|
#include <linux/lockdep.h>
|
|
#include <linux/threads.h>
|
|
#include <linux/atomic.h>
|
|
#include <linux/cpumask.h>
|
|
#include <linux/rcupdate.h>
|
|
#include <linux/android_kabi.h>
|
|
|
|
struct workqueue_struct;
|
|
|
|
struct work_struct;
|
|
typedef void (*work_func_t)(struct work_struct *work);
|
|
void delayed_work_timer_fn(struct timer_list *t);
|
|
|
|
/*
|
|
* The first word is the work queue pointer and the flags rolled into
|
|
* one
|
|
*/
|
|
#define work_data_bits(work) ((unsigned long *)(&(work)->data))
|
|
|
|
enum {
|
|
WORK_STRUCT_PENDING_BIT = 0, /* work item is pending execution */
|
|
WORK_STRUCT_INACTIVE_BIT= 1, /* work item is inactive */
|
|
WORK_STRUCT_PWQ_BIT = 2, /* data points to pwq */
|
|
WORK_STRUCT_LINKED_BIT = 3, /* next work is linked to this one */
|
|
#ifdef CONFIG_DEBUG_OBJECTS_WORK
|
|
WORK_STRUCT_STATIC_BIT = 4, /* static initializer (debugobjects) */
|
|
WORK_STRUCT_COLOR_SHIFT = 5, /* color for workqueue flushing */
|
|
#else
|
|
WORK_STRUCT_COLOR_SHIFT = 4, /* color for workqueue flushing */
|
|
#endif
|
|
|
|
WORK_STRUCT_COLOR_BITS = 4,
|
|
|
|
WORK_STRUCT_PENDING = 1 << WORK_STRUCT_PENDING_BIT,
|
|
WORK_STRUCT_INACTIVE = 1 << WORK_STRUCT_INACTIVE_BIT,
|
|
WORK_STRUCT_PWQ = 1 << WORK_STRUCT_PWQ_BIT,
|
|
WORK_STRUCT_LINKED = 1 << WORK_STRUCT_LINKED_BIT,
|
|
#ifdef CONFIG_DEBUG_OBJECTS_WORK
|
|
WORK_STRUCT_STATIC = 1 << WORK_STRUCT_STATIC_BIT,
|
|
#else
|
|
WORK_STRUCT_STATIC = 0,
|
|
#endif
|
|
|
|
WORK_NR_COLORS = (1 << WORK_STRUCT_COLOR_BITS),
|
|
|
|
/* not bound to any CPU, prefer the local CPU */
|
|
WORK_CPU_UNBOUND = NR_CPUS,
|
|
|
|
/*
|
|
* Reserve 8 bits off of pwq pointer w/ debugobjects turned off.
|
|
* This makes pwqs aligned to 256 bytes and allows 16 workqueue
|
|
* flush colors.
|
|
*/
|
|
WORK_STRUCT_FLAG_BITS = WORK_STRUCT_COLOR_SHIFT +
|
|
WORK_STRUCT_COLOR_BITS,
|
|
|
|
/* data contains off-queue information when !WORK_STRUCT_PWQ */
|
|
WORK_OFFQ_FLAG_BASE = WORK_STRUCT_COLOR_SHIFT,
|
|
|
|
__WORK_OFFQ_CANCELING = WORK_OFFQ_FLAG_BASE,
|
|
|
|
/*
|
|
* When a work item is off queue, its high bits point to the last
|
|
* pool it was on. Cap at 31 bits and use the highest number to
|
|
* indicate that no pool is associated.
|
|
*/
|
|
WORK_OFFQ_FLAG_BITS = 1,
|
|
WORK_OFFQ_POOL_SHIFT = WORK_OFFQ_FLAG_BASE + WORK_OFFQ_FLAG_BITS,
|
|
WORK_OFFQ_LEFT = BITS_PER_LONG - WORK_OFFQ_POOL_SHIFT,
|
|
WORK_OFFQ_POOL_BITS = WORK_OFFQ_LEFT <= 31 ? WORK_OFFQ_LEFT : 31,
|
|
|
|
/* bit mask for work_busy() return values */
|
|
WORK_BUSY_PENDING = 1 << 0,
|
|
WORK_BUSY_RUNNING = 1 << 1,
|
|
|
|
/* maximum string length for set_worker_desc() */
|
|
WORKER_DESC_LEN = 24,
|
|
};
|
|
|
|
/* Convenience constants - of type 'unsigned long', not 'enum'! */
|
|
#define WORK_OFFQ_CANCELING (1ul << __WORK_OFFQ_CANCELING)
|
|
#define WORK_OFFQ_POOL_NONE ((1ul << WORK_OFFQ_POOL_BITS) - 1)
|
|
#define WORK_STRUCT_NO_POOL (WORK_OFFQ_POOL_NONE << WORK_OFFQ_POOL_SHIFT)
|
|
|
|
#define WORK_STRUCT_FLAG_MASK ((1ul << WORK_STRUCT_FLAG_BITS) - 1)
|
|
#define WORK_STRUCT_WQ_DATA_MASK (~WORK_STRUCT_FLAG_MASK)
|
|
|
|
struct work_struct {
|
|
atomic_long_t data;
|
|
struct list_head entry;
|
|
work_func_t func;
|
|
#ifdef CONFIG_LOCKDEP
|
|
struct lockdep_map lockdep_map;
|
|
#endif
|
|
ANDROID_KABI_RESERVE(1);
|
|
ANDROID_KABI_RESERVE(2);
|
|
};
|
|
|
|
#define WORK_DATA_INIT() ATOMIC_LONG_INIT((unsigned long)WORK_STRUCT_NO_POOL)
|
|
#define WORK_DATA_STATIC_INIT() \
|
|
ATOMIC_LONG_INIT((unsigned long)(WORK_STRUCT_NO_POOL | WORK_STRUCT_STATIC))
|
|
|
|
struct delayed_work {
|
|
struct work_struct work;
|
|
struct timer_list timer;
|
|
|
|
/* target workqueue and CPU ->timer uses to queue ->work */
|
|
struct workqueue_struct *wq;
|
|
int cpu;
|
|
|
|
ANDROID_KABI_RESERVE(1);
|
|
ANDROID_KABI_RESERVE(2);
|
|
};
|
|
|
|
struct rcu_work {
|
|
struct work_struct work;
|
|
struct rcu_head rcu;
|
|
|
|
/* target workqueue ->rcu uses to queue ->work */
|
|
struct workqueue_struct *wq;
|
|
};
|
|
|
|
/**
|
|
* struct workqueue_attrs - A struct for workqueue attributes.
|
|
*
|
|
* This can be used to change attributes of an unbound workqueue.
|
|
*/
|
|
struct workqueue_attrs {
|
|
/**
|
|
* @nice: nice level
|
|
*/
|
|
int nice;
|
|
|
|
/**
|
|
* @cpumask: allowed CPUs
|
|
*/
|
|
cpumask_var_t cpumask;
|
|
|
|
/**
|
|
* @no_numa: disable NUMA affinity
|
|
*
|
|
* Unlike other fields, ``no_numa`` isn't a property of a worker_pool. It
|
|
* only modifies how :c:func:`apply_workqueue_attrs` select pools and thus
|
|
* doesn't participate in pool hash calculations or equality comparisons.
|
|
*/
|
|
bool no_numa;
|
|
};
|
|
|
|
static inline struct delayed_work *to_delayed_work(struct work_struct *work)
|
|
{
|
|
return container_of(work, struct delayed_work, work);
|
|
}
|
|
|
|
static inline struct rcu_work *to_rcu_work(struct work_struct *work)
|
|
{
|
|
return container_of(work, struct rcu_work, work);
|
|
}
|
|
|
|
struct execute_work {
|
|
struct work_struct work;
|
|
};
|
|
|
|
#ifdef CONFIG_LOCKDEP
|
|
/*
|
|
* NB: because we have to copy the lockdep_map, setting _key
|
|
* here is required, otherwise it could get initialised to the
|
|
* copy of the lockdep_map!
|
|
*/
|
|
#define __WORK_INIT_LOCKDEP_MAP(n, k) \
|
|
.lockdep_map = STATIC_LOCKDEP_MAP_INIT(n, k),
|
|
#else
|
|
#define __WORK_INIT_LOCKDEP_MAP(n, k)
|
|
#endif
|
|
|
|
#define __WORK_INITIALIZER(n, f) { \
|
|
.data = WORK_DATA_STATIC_INIT(), \
|
|
.entry = { &(n).entry, &(n).entry }, \
|
|
.func = (f), \
|
|
__WORK_INIT_LOCKDEP_MAP(#n, &(n)) \
|
|
}
|
|
|
|
#define __DELAYED_WORK_INITIALIZER(n, f, tflags) { \
|
|
.work = __WORK_INITIALIZER((n).work, (f)), \
|
|
.timer = __TIMER_INITIALIZER(delayed_work_timer_fn,\
|
|
(tflags) | TIMER_IRQSAFE), \
|
|
}
|
|
|
|
#define DECLARE_WORK(n, f) \
|
|
struct work_struct n = __WORK_INITIALIZER(n, f)
|
|
|
|
#define DECLARE_DELAYED_WORK(n, f) \
|
|
struct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f, 0)
|
|
|
|
#define DECLARE_DEFERRABLE_WORK(n, f) \
|
|
struct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f, TIMER_DEFERRABLE)
|
|
|
|
#ifdef CONFIG_DEBUG_OBJECTS_WORK
|
|
extern void __init_work(struct work_struct *work, int onstack);
|
|
extern void destroy_work_on_stack(struct work_struct *work);
|
|
extern void destroy_delayed_work_on_stack(struct delayed_work *work);
|
|
static inline unsigned int work_static(struct work_struct *work)
|
|
{
|
|
return *work_data_bits(work) & WORK_STRUCT_STATIC;
|
|
}
|
|
#else
|
|
static inline void __init_work(struct work_struct *work, int onstack) { }
|
|
static inline void destroy_work_on_stack(struct work_struct *work) { }
|
|
static inline void destroy_delayed_work_on_stack(struct delayed_work *work) { }
|
|
static inline unsigned int work_static(struct work_struct *work) { return 0; }
|
|
#endif
|
|
|
|
/*
|
|
* initialize all of a work item in one go
|
|
*
|
|
* NOTE! No point in using "atomic_long_set()": using a direct
|
|
* assignment of the work data initializer allows the compiler
|
|
* to generate better code.
|
|
*/
|
|
#ifdef CONFIG_LOCKDEP
|
|
#define __INIT_WORK_KEY(_work, _func, _onstack, _key) \
|
|
do { \
|
|
__init_work((_work), _onstack); \
|
|
(_work)->data = (atomic_long_t) WORK_DATA_INIT(); \
|
|
lockdep_init_map(&(_work)->lockdep_map, "(work_completion)"#_work, (_key), 0); \
|
|
INIT_LIST_HEAD(&(_work)->entry); \
|
|
(_work)->func = (_func); \
|
|
} while (0)
|
|
#else
|
|
#define __INIT_WORK_KEY(_work, _func, _onstack, _key) \
|
|
do { \
|
|
__init_work((_work), _onstack); \
|
|
(_work)->data = (atomic_long_t) WORK_DATA_INIT(); \
|
|
INIT_LIST_HEAD(&(_work)->entry); \
|
|
(_work)->func = (_func); \
|
|
} while (0)
|
|
#endif
|
|
|
|
#define __INIT_WORK(_work, _func, _onstack) \
|
|
do { \
|
|
static __maybe_unused struct lock_class_key __key; \
|
|
\
|
|
__INIT_WORK_KEY(_work, _func, _onstack, &__key); \
|
|
} while (0)
|
|
|
|
#define INIT_WORK(_work, _func) \
|
|
__INIT_WORK((_work), (_func), 0)
|
|
|
|
#define INIT_WORK_ONSTACK(_work, _func) \
|
|
__INIT_WORK((_work), (_func), 1)
|
|
|
|
#define INIT_WORK_ONSTACK_KEY(_work, _func, _key) \
|
|
__INIT_WORK_KEY((_work), (_func), 1, _key)
|
|
|
|
#define __INIT_DELAYED_WORK(_work, _func, _tflags) \
|
|
do { \
|
|
INIT_WORK(&(_work)->work, (_func)); \
|
|
__init_timer(&(_work)->timer, \
|
|
delayed_work_timer_fn, \
|
|
(_tflags) | TIMER_IRQSAFE); \
|
|
} while (0)
|
|
|
|
#define __INIT_DELAYED_WORK_ONSTACK(_work, _func, _tflags) \
|
|
do { \
|
|
INIT_WORK_ONSTACK(&(_work)->work, (_func)); \
|
|
__init_timer_on_stack(&(_work)->timer, \
|
|
delayed_work_timer_fn, \
|
|
(_tflags) | TIMER_IRQSAFE); \
|
|
} while (0)
|
|
|
|
#define INIT_DELAYED_WORK(_work, _func) \
|
|
__INIT_DELAYED_WORK(_work, _func, 0)
|
|
|
|
#define INIT_DELAYED_WORK_ONSTACK(_work, _func) \
|
|
__INIT_DELAYED_WORK_ONSTACK(_work, _func, 0)
|
|
|
|
#define INIT_DEFERRABLE_WORK(_work, _func) \
|
|
__INIT_DELAYED_WORK(_work, _func, TIMER_DEFERRABLE)
|
|
|
|
#define INIT_DEFERRABLE_WORK_ONSTACK(_work, _func) \
|
|
__INIT_DELAYED_WORK_ONSTACK(_work, _func, TIMER_DEFERRABLE)
|
|
|
|
#define INIT_RCU_WORK(_work, _func) \
|
|
INIT_WORK(&(_work)->work, (_func))
|
|
|
|
#define INIT_RCU_WORK_ONSTACK(_work, _func) \
|
|
INIT_WORK_ONSTACK(&(_work)->work, (_func))
|
|
|
|
/**
|
|
* work_pending - Find out whether a work item is currently pending
|
|
* @work: The work item in question
|
|
*/
|
|
#define work_pending(work) \
|
|
test_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(work))
|
|
|
|
/**
|
|
* delayed_work_pending - Find out whether a delayable work item is currently
|
|
* pending
|
|
* @w: The work item in question
|
|
*/
|
|
#define delayed_work_pending(w) \
|
|
work_pending(&(w)->work)
|
|
|
|
/*
|
|
* Workqueue flags and constants. For details, please refer to
|
|
* Documentation/core-api/workqueue.rst.
|
|
*/
|
|
enum {
|
|
WQ_UNBOUND = 1 << 1, /* not bound to any cpu */
|
|
WQ_FREEZABLE = 1 << 2, /* freeze during suspend */
|
|
WQ_MEM_RECLAIM = 1 << 3, /* may be used for memory reclaim */
|
|
WQ_HIGHPRI = 1 << 4, /* high priority */
|
|
WQ_CPU_INTENSIVE = 1 << 5, /* cpu intensive workqueue */
|
|
WQ_SYSFS = 1 << 6, /* visible in sysfs, see workqueue_sysfs_register() */
|
|
|
|
/*
|
|
* Per-cpu workqueues are generally preferred because they tend to
|
|
* show better performance thanks to cache locality. Per-cpu
|
|
* workqueues exclude the scheduler from choosing the CPU to
|
|
* execute the worker threads, which has an unfortunate side effect
|
|
* of increasing power consumption.
|
|
*
|
|
* The scheduler considers a CPU idle if it doesn't have any task
|
|
* to execute and tries to keep idle cores idle to conserve power;
|
|
* however, for example, a per-cpu work item scheduled from an
|
|
* interrupt handler on an idle CPU will force the scheduler to
|
|
* execute the work item on that CPU breaking the idleness, which in
|
|
* turn may lead to more scheduling choices which are sub-optimal
|
|
* in terms of power consumption.
|
|
*
|
|
* Workqueues marked with WQ_POWER_EFFICIENT are per-cpu by default
|
|
* but become unbound if workqueue.power_efficient kernel param is
|
|
* specified. Per-cpu workqueues which are identified to
|
|
* contribute significantly to power-consumption are identified and
|
|
* marked with this flag and enabling the power_efficient mode
|
|
* leads to noticeable power saving at the cost of small
|
|
* performance disadvantage.
|
|
*
|
|
* http://thread.gmane.org/gmane.linux.kernel/1480396
|
|
*/
|
|
WQ_POWER_EFFICIENT = 1 << 7,
|
|
|
|
__WQ_DRAINING = 1 << 16, /* internal: workqueue is draining */
|
|
__WQ_ORDERED = 1 << 17, /* internal: workqueue is ordered */
|
|
__WQ_LEGACY = 1 << 18, /* internal: create*_workqueue() */
|
|
__WQ_ORDERED_EXPLICIT = 1 << 19, /* internal: alloc_ordered_workqueue() */
|
|
|
|
WQ_MAX_ACTIVE = 512, /* I like 512, better ideas? */
|
|
WQ_MAX_UNBOUND_PER_CPU = 4, /* 4 * #cpus for unbound wq */
|
|
WQ_DFL_ACTIVE = WQ_MAX_ACTIVE / 2,
|
|
};
|
|
|
|
/* unbound wq's aren't per-cpu, scale max_active according to #cpus */
|
|
#define WQ_UNBOUND_MAX_ACTIVE \
|
|
max_t(int, WQ_MAX_ACTIVE, num_possible_cpus() * WQ_MAX_UNBOUND_PER_CPU)
|
|
|
|
/*
|
|
* System-wide workqueues which are always present.
|
|
*
|
|
* system_wq is the one used by schedule[_delayed]_work[_on]().
|
|
* Multi-CPU multi-threaded. There are users which expect relatively
|
|
* short queue flush time. Don't queue works which can run for too
|
|
* long.
|
|
*
|
|
* system_highpri_wq is similar to system_wq but for work items which
|
|
* require WQ_HIGHPRI.
|
|
*
|
|
* system_long_wq is similar to system_wq but may host long running
|
|
* works. Queue flushing might take relatively long.
|
|
*
|
|
* system_unbound_wq is unbound workqueue. Workers are not bound to
|
|
* any specific CPU, not concurrency managed, and all queued works are
|
|
* executed immediately as long as max_active limit is not reached and
|
|
* resources are available.
|
|
*
|
|
* system_freezable_wq is equivalent to system_wq except that it's
|
|
* freezable.
|
|
*
|
|
* *_power_efficient_wq are inclined towards saving power and converted
|
|
* into WQ_UNBOUND variants if 'wq_power_efficient' is enabled; otherwise,
|
|
* they are same as their non-power-efficient counterparts - e.g.
|
|
* system_power_efficient_wq is identical to system_wq if
|
|
* 'wq_power_efficient' is disabled. See WQ_POWER_EFFICIENT for more info.
|
|
*/
|
|
extern struct workqueue_struct *system_wq;
|
|
extern struct workqueue_struct *system_highpri_wq;
|
|
extern struct workqueue_struct *system_long_wq;
|
|
extern struct workqueue_struct *system_unbound_wq;
|
|
extern struct workqueue_struct *system_freezable_wq;
|
|
extern struct workqueue_struct *system_power_efficient_wq;
|
|
extern struct workqueue_struct *system_freezable_power_efficient_wq;
|
|
|
|
/**
|
|
* alloc_workqueue - allocate a workqueue
|
|
* @fmt: printf format for the name of the workqueue
|
|
* @flags: WQ_* flags
|
|
* @max_active: max in-flight work items, 0 for default
|
|
* remaining args: args for @fmt
|
|
*
|
|
* Allocate a workqueue with the specified parameters. For detailed
|
|
* information on WQ_* flags, please refer to
|
|
* Documentation/core-api/workqueue.rst.
|
|
*
|
|
* RETURNS:
|
|
* Pointer to the allocated workqueue on success, %NULL on failure.
|
|
*/
|
|
__printf(1, 4) struct workqueue_struct *
|
|
alloc_workqueue(const char *fmt, unsigned int flags, int max_active, ...);
|
|
|
|
/**
|
|
* alloc_ordered_workqueue - allocate an ordered workqueue
|
|
* @fmt: printf format for the name of the workqueue
|
|
* @flags: WQ_* flags (only WQ_FREEZABLE and WQ_MEM_RECLAIM are meaningful)
|
|
* @args: args for @fmt
|
|
*
|
|
* Allocate an ordered workqueue. An ordered workqueue executes at
|
|
* most one work item at any given time in the queued order. They are
|
|
* implemented as unbound workqueues with @max_active of one.
|
|
*
|
|
* RETURNS:
|
|
* Pointer to the allocated workqueue on success, %NULL on failure.
|
|
*/
|
|
#define alloc_ordered_workqueue(fmt, flags, args...) \
|
|
alloc_workqueue(fmt, WQ_UNBOUND | __WQ_ORDERED | \
|
|
__WQ_ORDERED_EXPLICIT | (flags), 1, ##args)
|
|
|
|
#define create_workqueue(name) \
|
|
alloc_workqueue("%s", __WQ_LEGACY | WQ_MEM_RECLAIM, 1, (name))
|
|
#define create_freezable_workqueue(name) \
|
|
alloc_workqueue("%s", __WQ_LEGACY | WQ_FREEZABLE | WQ_UNBOUND | \
|
|
WQ_MEM_RECLAIM, 1, (name))
|
|
#define create_singlethread_workqueue(name) \
|
|
alloc_ordered_workqueue("%s", __WQ_LEGACY | WQ_MEM_RECLAIM, name)
|
|
|
|
extern void destroy_workqueue(struct workqueue_struct *wq);
|
|
|
|
struct workqueue_attrs *alloc_workqueue_attrs(void);
|
|
void free_workqueue_attrs(struct workqueue_attrs *attrs);
|
|
int apply_workqueue_attrs(struct workqueue_struct *wq,
|
|
const struct workqueue_attrs *attrs);
|
|
int workqueue_set_unbound_cpumask(cpumask_var_t cpumask);
|
|
|
|
extern bool queue_work_on(int cpu, struct workqueue_struct *wq,
|
|
struct work_struct *work);
|
|
extern bool queue_work_node(int node, struct workqueue_struct *wq,
|
|
struct work_struct *work);
|
|
extern bool queue_delayed_work_on(int cpu, struct workqueue_struct *wq,
|
|
struct delayed_work *work, unsigned long delay);
|
|
extern bool mod_delayed_work_on(int cpu, struct workqueue_struct *wq,
|
|
struct delayed_work *dwork, unsigned long delay);
|
|
extern bool queue_rcu_work(struct workqueue_struct *wq, struct rcu_work *rwork);
|
|
|
|
extern void __flush_workqueue(struct workqueue_struct *wq);
|
|
extern void drain_workqueue(struct workqueue_struct *wq);
|
|
|
|
extern int schedule_on_each_cpu(work_func_t func);
|
|
|
|
int execute_in_process_context(work_func_t fn, struct execute_work *);
|
|
|
|
extern bool flush_work(struct work_struct *work);
|
|
extern bool cancel_work(struct work_struct *work);
|
|
extern bool cancel_work_sync(struct work_struct *work);
|
|
|
|
extern bool flush_delayed_work(struct delayed_work *dwork);
|
|
extern bool cancel_delayed_work(struct delayed_work *dwork);
|
|
extern bool cancel_delayed_work_sync(struct delayed_work *dwork);
|
|
|
|
extern bool flush_rcu_work(struct rcu_work *rwork);
|
|
|
|
extern void workqueue_set_max_active(struct workqueue_struct *wq,
|
|
int max_active);
|
|
extern struct work_struct *current_work(void);
|
|
extern bool current_is_workqueue_rescuer(void);
|
|
extern bool workqueue_congested(int cpu, struct workqueue_struct *wq);
|
|
extern unsigned int work_busy(struct work_struct *work);
|
|
extern __printf(1, 2) void set_worker_desc(const char *fmt, ...);
|
|
extern void print_worker_info(const char *log_lvl, struct task_struct *task);
|
|
extern void show_all_workqueues(void);
|
|
extern void show_one_workqueue(struct workqueue_struct *wq);
|
|
extern void wq_worker_comm(char *buf, size_t size, struct task_struct *task);
|
|
|
|
/**
|
|
* queue_work - queue work on a workqueue
|
|
* @wq: workqueue to use
|
|
* @work: work to queue
|
|
*
|
|
* Returns %false if @work was already on a queue, %true otherwise.
|
|
*
|
|
* We queue the work to the CPU on which it was submitted, but if the CPU dies
|
|
* it can be processed by another CPU.
|
|
*
|
|
* Memory-ordering properties: If it returns %true, guarantees that all stores
|
|
* preceding the call to queue_work() in the program order will be visible from
|
|
* the CPU which will execute @work by the time such work executes, e.g.,
|
|
*
|
|
* { x is initially 0 }
|
|
*
|
|
* CPU0 CPU1
|
|
*
|
|
* WRITE_ONCE(x, 1); [ @work is being executed ]
|
|
* r0 = queue_work(wq, work); r1 = READ_ONCE(x);
|
|
*
|
|
* Forbids: r0 == true && r1 == 0
|
|
*/
|
|
static inline bool queue_work(struct workqueue_struct *wq,
|
|
struct work_struct *work)
|
|
{
|
|
return queue_work_on(WORK_CPU_UNBOUND, wq, work);
|
|
}
|
|
|
|
/**
|
|
* queue_delayed_work - queue work on a workqueue after delay
|
|
* @wq: workqueue to use
|
|
* @dwork: delayable work to queue
|
|
* @delay: number of jiffies to wait before queueing
|
|
*
|
|
* Equivalent to queue_delayed_work_on() but tries to use the local CPU.
|
|
*/
|
|
static inline bool queue_delayed_work(struct workqueue_struct *wq,
|
|
struct delayed_work *dwork,
|
|
unsigned long delay)
|
|
{
|
|
return queue_delayed_work_on(WORK_CPU_UNBOUND, wq, dwork, delay);
|
|
}
|
|
|
|
/**
|
|
* mod_delayed_work - modify delay of or queue a delayed work
|
|
* @wq: workqueue to use
|
|
* @dwork: work to queue
|
|
* @delay: number of jiffies to wait before queueing
|
|
*
|
|
* mod_delayed_work_on() on local CPU.
|
|
*/
|
|
static inline bool mod_delayed_work(struct workqueue_struct *wq,
|
|
struct delayed_work *dwork,
|
|
unsigned long delay)
|
|
{
|
|
return mod_delayed_work_on(WORK_CPU_UNBOUND, wq, dwork, delay);
|
|
}
|
|
|
|
/**
|
|
* schedule_work_on - put work task on a specific cpu
|
|
* @cpu: cpu to put the work task on
|
|
* @work: job to be done
|
|
*
|
|
* This puts a job on a specific cpu
|
|
*/
|
|
static inline bool schedule_work_on(int cpu, struct work_struct *work)
|
|
{
|
|
return queue_work_on(cpu, system_wq, work);
|
|
}
|
|
|
|
/**
|
|
* schedule_work - put work task in global workqueue
|
|
* @work: job to be done
|
|
*
|
|
* Returns %false if @work was already on the kernel-global workqueue and
|
|
* %true otherwise.
|
|
*
|
|
* This puts a job in the kernel-global workqueue if it was not already
|
|
* queued and leaves it in the same position on the kernel-global
|
|
* workqueue otherwise.
|
|
*
|
|
* Shares the same memory-ordering properties of queue_work(), cf. the
|
|
* DocBook header of queue_work().
|
|
*/
|
|
static inline bool schedule_work(struct work_struct *work)
|
|
{
|
|
return queue_work(system_wq, work);
|
|
}
|
|
|
|
/*
|
|
* Detect attempt to flush system-wide workqueues at compile time when possible.
|
|
*
|
|
* See https://lkml.kernel.org/r/49925af7-78a8-a3dd-bce6-cfc02e1a9236@I-love.SAKURA.ne.jp
|
|
* for reasons and steps for converting system-wide workqueues into local workqueues.
|
|
*/
|
|
extern void __warn_flushing_systemwide_wq(void)
|
|
__compiletime_warning("Please avoid flushing system-wide workqueues.");
|
|
|
|
/**
|
|
* flush_scheduled_work - ensure that any scheduled work has run to completion.
|
|
*
|
|
* Forces execution of the kernel-global workqueue and blocks until its
|
|
* completion.
|
|
*
|
|
* It's very easy to get into trouble if you don't take great care.
|
|
* Either of the following situations will lead to deadlock:
|
|
*
|
|
* One of the work items currently on the workqueue needs to acquire
|
|
* a lock held by your code or its caller.
|
|
*
|
|
* Your code is running in the context of a work routine.
|
|
*
|
|
* They will be detected by lockdep when they occur, but the first might not
|
|
* occur very often. It depends on what work items are on the workqueue and
|
|
* what locks they need, which you have no control over.
|
|
*
|
|
* In most situations flushing the entire workqueue is overkill; you merely
|
|
* need to know that a particular work item isn't queued and isn't running.
|
|
* In such cases you should use cancel_delayed_work_sync() or
|
|
* cancel_work_sync() instead.
|
|
*
|
|
* Please stop calling this function! A conversion to stop flushing system-wide
|
|
* workqueues is in progress. This function will be removed after all in-tree
|
|
* users stopped calling this function.
|
|
*/
|
|
/*
|
|
* The background of commit 771c035372a036f8 ("deprecate the
|
|
* '__deprecated' attribute warnings entirely and for good") is that,
|
|
* since Linus builds all modules between every single pull he does,
|
|
* the standard kernel build needs to be _clean_ in order to be able to
|
|
* notice when new problems happen. Therefore, don't emit warning while
|
|
* there are in-tree users.
|
|
*/
|
|
#define flush_scheduled_work() \
|
|
({ \
|
|
if (0) \
|
|
__warn_flushing_systemwide_wq(); \
|
|
__flush_workqueue(system_wq); \
|
|
})
|
|
|
|
/*
|
|
* Although there is no longer in-tree caller, for now just emit warning
|
|
* in order to give out-of-tree callers time to update.
|
|
*/
|
|
#define flush_workqueue(wq) \
|
|
({ \
|
|
struct workqueue_struct *_wq = (wq); \
|
|
\
|
|
if ((__builtin_constant_p(_wq == system_wq) && \
|
|
_wq == system_wq) || \
|
|
(__builtin_constant_p(_wq == system_highpri_wq) && \
|
|
_wq == system_highpri_wq) || \
|
|
(__builtin_constant_p(_wq == system_long_wq) && \
|
|
_wq == system_long_wq) || \
|
|
(__builtin_constant_p(_wq == system_unbound_wq) && \
|
|
_wq == system_unbound_wq) || \
|
|
(__builtin_constant_p(_wq == system_freezable_wq) && \
|
|
_wq == system_freezable_wq) || \
|
|
(__builtin_constant_p(_wq == system_power_efficient_wq) && \
|
|
_wq == system_power_efficient_wq) || \
|
|
(__builtin_constant_p(_wq == system_freezable_power_efficient_wq) && \
|
|
_wq == system_freezable_power_efficient_wq)) \
|
|
__warn_flushing_systemwide_wq(); \
|
|
__flush_workqueue(_wq); \
|
|
})
|
|
|
|
/**
|
|
* schedule_delayed_work_on - queue work in global workqueue on CPU after delay
|
|
* @cpu: cpu to use
|
|
* @dwork: job to be done
|
|
* @delay: number of jiffies to wait
|
|
*
|
|
* After waiting for a given time this puts a job in the kernel-global
|
|
* workqueue on the specified CPU.
|
|
*/
|
|
static inline bool schedule_delayed_work_on(int cpu, struct delayed_work *dwork,
|
|
unsigned long delay)
|
|
{
|
|
return queue_delayed_work_on(cpu, system_wq, dwork, delay);
|
|
}
|
|
|
|
/**
|
|
* schedule_delayed_work - put work task in global workqueue after delay
|
|
* @dwork: job to be done
|
|
* @delay: number of jiffies to wait or 0 for immediate execution
|
|
*
|
|
* After waiting for a given time this puts a job in the kernel-global
|
|
* workqueue.
|
|
*/
|
|
static inline bool schedule_delayed_work(struct delayed_work *dwork,
|
|
unsigned long delay)
|
|
{
|
|
return queue_delayed_work(system_wq, dwork, delay);
|
|
}
|
|
|
|
#ifndef CONFIG_SMP
|
|
static inline long work_on_cpu(int cpu, long (*fn)(void *), void *arg)
|
|
{
|
|
return fn(arg);
|
|
}
|
|
static inline long work_on_cpu_safe(int cpu, long (*fn)(void *), void *arg)
|
|
{
|
|
return fn(arg);
|
|
}
|
|
#else
|
|
long work_on_cpu_key(int cpu, long (*fn)(void *),
|
|
void *arg, struct lock_class_key *key);
|
|
/*
|
|
* A new key is defined for each caller to make sure the work
|
|
* associated with the function doesn't share its locking class.
|
|
*/
|
|
#define work_on_cpu(_cpu, _fn, _arg) \
|
|
({ \
|
|
static struct lock_class_key __key; \
|
|
\
|
|
work_on_cpu_key(_cpu, _fn, _arg, &__key); \
|
|
})
|
|
|
|
long work_on_cpu_safe_key(int cpu, long (*fn)(void *),
|
|
void *arg, struct lock_class_key *key);
|
|
|
|
/*
|
|
* A new key is defined for each caller to make sure the work
|
|
* associated with the function doesn't share its locking class.
|
|
*/
|
|
#define work_on_cpu_safe(_cpu, _fn, _arg) \
|
|
({ \
|
|
static struct lock_class_key __key; \
|
|
\
|
|
work_on_cpu_safe_key(_cpu, _fn, _arg, &__key); \
|
|
})
|
|
#endif /* CONFIG_SMP */
|
|
|
|
#ifdef CONFIG_FREEZER
|
|
extern void freeze_workqueues_begin(void);
|
|
extern bool freeze_workqueues_busy(void);
|
|
extern void thaw_workqueues(void);
|
|
#endif /* CONFIG_FREEZER */
|
|
|
|
#ifdef CONFIG_SYSFS
|
|
int workqueue_sysfs_register(struct workqueue_struct *wq);
|
|
#else /* CONFIG_SYSFS */
|
|
static inline int workqueue_sysfs_register(struct workqueue_struct *wq)
|
|
{ return 0; }
|
|
#endif /* CONFIG_SYSFS */
|
|
|
|
#ifdef CONFIG_WQ_WATCHDOG
|
|
void wq_watchdog_touch(int cpu);
|
|
#else /* CONFIG_WQ_WATCHDOG */
|
|
static inline void wq_watchdog_touch(int cpu) { }
|
|
#endif /* CONFIG_WQ_WATCHDOG */
|
|
|
|
#ifdef CONFIG_SMP
|
|
int workqueue_prepare_cpu(unsigned int cpu);
|
|
int workqueue_online_cpu(unsigned int cpu);
|
|
int workqueue_offline_cpu(unsigned int cpu);
|
|
#endif
|
|
|
|
void __init workqueue_init_early(void);
|
|
void __init workqueue_init(void);
|
|
|
|
#endif
|