
This is the merge of the upstream LTS release of 5.10.81 into the android12-5.10 branch. New symbols were added to be tracked, which are the only ABI changes: Leaf changes summary: 209 artifacts changed Changed leaf types summary: 0 leaf type changed Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 192 Added functions Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 17 Added variables 192 Added functions: [A] 'function void __bforget(buffer_head*)' [A] 'function ssize_t __blockdev_direct_IO(kiocb*, inode*, block_device*, iov_iter*, get_block_t*, dio_iodone_t*, dio_submit_t*, int)' [A] 'function buffer_head* __bread_gfp(block_device*, sector_t, unsigned int, gfp_t)' [A] 'function void __breadahead(block_device*, sector_t, unsigned int)' [A] 'function void __brelse(buffer_head*)' [A] 'function void __cancel_dirty_page(page*)' [A] 'function void __cleancache_invalidate_inode(address_space*)' [A] 'function void __filemap_set_wb_err(address_space*, int)' [A] 'function void __insert_inode_hash(inode*, unsigned long int)' [A] 'function void __mark_inode_dirty(inode*, int)' [A] 'function void __pagevec_release(pagevec*)' [A] 'function void __remove_inode_hash(inode*)' [A] 'function int __set_page_dirty_buffers(page*)' [A] 'function int __set_page_dirty_nobuffers(page*)' [A] 'function int __test_set_page_writeback(page*, bool)' [A] 'function int __traceiter_android_rvh_binder_transaction(void*, binder_proc*, binder_proc*, binder_thread*, binder_transaction_data*)' [A] 'function int __traceiter_android_rvh_do_sched_yield(void*, rq*)' [A] 'function int __traceiter_android_vh_binder_del_ref(void*, task_struct*, uint32_t)' [A] 'function int __traceiter_android_vh_binder_free_proc(void*, binder_proc*)' [A] 'function int __traceiter_android_vh_binder_has_work_ilocked(void*, binder_thread*, bool, int*)' [A] 'function int __traceiter_android_vh_binder_looper_state_registered(void*, binder_thread*, binder_proc*)' [A] 'function int __traceiter_android_vh_binder_new_ref(void*, task_struct*, uint32_t, int)' [A] 'function int __traceiter_android_vh_binder_proc_transaction(void*, task_struct*, task_struct*, task_struct*, int, unsigned int, bool)' [A] 'function int __traceiter_android_vh_binder_proc_transaction_end(void*, task_struct*, task_struct*, task_struct*, unsigned int, bool, bool)' [A] 'function int __traceiter_android_vh_binder_read_done(void*, binder_proc*, binder_thread*)' [A] 'function int __traceiter_android_vh_binder_thread_read(void*, list_head**, binder_proc*, binder_thread*)' [A] 'function int __traceiter_android_vh_binder_thread_release(void*, binder_proc*, binder_thread*)' [A] 'function int __traceiter_android_vh_futex_sleep_start(void*, task_struct*)' [A] 'function int __traceiter_block_bio_remap(void*, request_queue*, bio*, dev_t, sector_t)' [A] 'function int add_to_page_cache_locked(page*, address_space*, unsigned long int, gfp_t)' [A] 'function bio* bio_split(bio*, int, gfp_t, bio_set*)' [A] 'function wait_queue_head* bit_waitqueue(void*, int)' [A] 'function blk_plug_cb* blk_check_plugged(blk_plug_cb_fn, void*, int)' [A] 'function void blk_queue_max_write_same_sectors(request_queue*, unsigned int)' [A] 'function int blkdev_issue_discard(block_device*, sector_t, sector_t, gfp_t, unsigned long int)' [A] 'function void block_invalidatepage(page*, unsigned int, unsigned int)' [A] 'function int block_is_partially_uptodate(page*, unsigned long int, unsigned long int)' [A] 'function int buffer_migrate_page(address_space*, page*, page*, migrate_mode)' [A] 'function bool capable_wrt_inode_uidgid(const inode*, int)' [A] 'function void clean_bdev_aliases(block_device*, sector_t, sector_t)' [A] 'function void clear_inode(inode*)' [A] 'function int clear_page_dirty_for_io(page*)' [A] 'function int clk_set_duty_cycle(clk*, unsigned int, unsigned int)' [A] 'function int clocksource_mmio_init(void*, const char*, unsigned long int, int, unsigned int, typedef u64 (clocksource*)*)' [A] 'function u64 clocksource_mmio_readl_up(clocksource*)' [A] 'function void create_empty_buffers(page*, unsigned long int, unsigned long int)' [A] 'function int current_umask()' [A] 'function dentry* d_add_ci(dentry*, inode*, qstr*)' [A] 'function void d_instantiate(dentry*, inode*)' [A] 'function dentry* d_obtain_alias(inode*)' [A] 'function dentry* d_splice_alias(inode*, dentry*)' [A] 'function void delete_from_page_cache(page*)' [A] 'function i3c_device* dev_to_i3cdev(device*)' [A] 'function spi_mem_dirmap_desc* devm_spi_mem_dirmap_create(device*, spi_mem*, const spi_mem_dirmap_info*)' [A] 'function void disk_stack_limits(gendisk*, block_device*, sector_t)' [A] 'function void drop_nlink(inode*)' [A] 'function void end_buffer_write_sync(buffer_head*, int)' [A] 'function void end_page_writeback(page*)' [A] 'function errseq_t errseq_set(errseq_t*, int)' [A] 'function int fb_get_options(const char*, char**)' [A] 'function int fiemap_fill_next_extent(fiemap_extent_info*, u64, u64, u64, u32)' [A] 'function int fiemap_prep(inode*, fiemap_extent_info*, u64, u64*, u32)' [A] 'function int file_remove_privs(file*)' [A] 'function int file_update_time(file*)' [A] 'function int file_write_and_wait_range(file*, loff_t, loff_t)' [A] 'function vm_fault_t filemap_fault(vm_fault*)' [A] 'function int filemap_fdatawait_range(address_space*, loff_t, loff_t)' [A] 'function int filemap_fdatawrite(address_space*)' [A] 'function int filemap_flush(address_space*)' [A] 'function int filemap_write_and_wait_range(address_space*, loff_t, loff_t)' [A] 'function file* filp_open(const char*, int, umode_t)' [A] 'function void flush_delayed_fput()' [A] 'function int freq_qos_remove_notifier(freq_constraints*, freq_qos_req_type, notifier_block*)' [A] 'function int generic_error_remove_page(address_space*, page*)' [A] 'function ssize_t generic_file_direct_write(kiocb*, iov_iter*)' [A] 'function int generic_file_mmap(file*, vm_area_struct*)' [A] 'function int generic_file_open(inode*, file*)' [A] 'function ssize_t generic_file_splice_read(file*, loff_t*, pipe_inode_info*, size_t, unsigned int)' [A] 'function void generic_fillattr(inode*, kstat*)' [A] 'function ssize_t generic_read_dir(file*, char*, size_t, loff_t*)' [A] 'function int genphy_restart_aneg(phy_device*)' [A] 'function page* grab_cache_page_write_begin(address_space*, unsigned long int, unsigned int)' [A] 'function const i3c_device_id* i3c_device_match_id(i3c_device*, const i3c_device_id*)' [A] 'function inode* iget5_locked(super_block*, unsigned long int, int (inode*, void*)*, int (inode*, void*)*, void*)' [A] 'function inode* igrab(inode*)' [A] 'function void ihold(inode*)' [A] 'function int iio_device_claim_direct_mode(iio_dev*)' [A] 'function void iio_device_release_direct_mode(iio_dev*)' [A] 'function int iio_push_event(iio_dev*, u64, s64)' [A] 'function int iio_read_mount_matrix(device*, const char*, iio_mount_matrix*)' [A] 'function ssize_t iio_show_mount_matrix(iio_dev*, uintptr_t, const iio_chan_spec*, char*)' [A] 'function int iio_write_channel_raw(iio_channel*, int)' [A] 'function inode* ilookup5(super_block*, unsigned long int, int (inode*, void*)*, void*)' [A] 'function int in_group_p(kgid_t)' [A] 'function void inc_nlink(inode*)' [A] 'function void init_special_inode(inode*, umode_t, dev_t)' [A] 'function void inode_dio_wait(inode*)' [A] 'function void inode_init_once(inode*)' [A] 'function void inode_init_owner(inode*, const inode*, umode_t)' [A] 'function int inode_newsize_ok(const inode*, loff_t)' [A] 'function void inode_set_flags(inode*, unsigned int, unsigned int)' [A] 'function void io_schedule()' [A] 'function void iov_iter_advance(iov_iter*, size_t)' [A] 'function unsigned long int iov_iter_alignment(const iov_iter*)' [A] 'function size_t iov_iter_copy_from_user_atomic(page*, iov_iter*, unsigned long int, size_t)' [A] 'function int iov_iter_fault_in_readable(iov_iter*, size_t)' [A] 'function ssize_t iov_iter_get_pages(iov_iter*, page**, size_t, unsigned int, size_t*)' [A] 'function size_t iov_iter_single_seg_count(const iov_iter*)' [A] 'function bool is_bad_inode(inode*)' [A] 'function ssize_t iter_file_splice_write(pipe_inode_info*, file*, loff_t*, size_t, unsigned int)' [A] 'function ino_t iunique(super_block*, ino_t)' [A] 'function int kernel_sock_shutdown(socket*, sock_shutdown_cmd)' [A] 'function void kill_block_super(super_block*)' [A] 'function int kill_pid(pid*, int, int)' [A] 'function bool kthread_freezable_should_stop(bool*)' [A] 'function void ll_rw_block(int, int, int, buffer_head**)' [A] 'function nls_table* load_nls(char*)' [A] 'function nls_table* load_nls_default()' [A] 'function void lru_cache_add(page*)' [A] 'function void make_bad_inode(inode*)' [A] 'function void mark_buffer_async_write(buffer_head*)' [A] 'function void mark_buffer_dirty(buffer_head*)' [A] 'function void mark_buffer_write_io_error(buffer_head*)' [A] 'function void mark_page_accessed(page*)' [A] 'function void mnt_drop_write_file(file*)' [A] 'function int mnt_want_write_file(file*)' [A] 'function dentry* mount_bdev(file_system_type*, int, const char*, void*, int (super_block*, void*, int)*)' [A] 'function void mpage_readahead(readahead_control*, get_block_t*)' [A] 'function int mpage_readpage(page*, get_block_t*)' [A] 'function int notify_change(dentry*, iattr*, inode**)' [A] 'function unsigned long int page_cache_next_miss(address_space*, unsigned long int, unsigned long int)' [A] 'function unsigned long int page_cache_prev_miss(address_space*, unsigned long int, unsigned long int)' [A] 'function bool page_mapped(page*)' [A] 'function int page_mkclean(page*)' [A] 'function void page_zero_new_buffers(page*, unsigned int, unsigned int)' [A] 'function page* pagecache_get_page(address_space*, unsigned long int, int, gfp_t)' [A] 'function unsigned int pagevec_lookup_range(pagevec*, address_space*, unsigned long int*, unsigned long int)' [A] 'function unsigned int pagevec_lookup_range_tag(pagevec*, address_space*, unsigned long int*, unsigned long int, xa_mark_t)' [A] 'function int phy_modify_mmd(phy_device*, int, u32, u16, u16)' [A] 'function void put_pages_list(list_head*)' [A] 'function gfp_t readahead_gfp_mask(address_space*)' [A] 'function int redirty_page_for_writepage(writeback_control*, page*)' [A] 'function int rproc_set_firmware(rproc*, const char*)' [A] 'function int sb_min_blocksize(super_block*, int)' [A] 'function int sb_set_blocksize(super_block*, int)' [A] 'function void sched_clock_register(typedef u64 ()*, int, unsigned long int)' [A] 'function int security_inode_init_security(inode*, inode*, const qstr*, const initxattrs, void*)' [A] 'function void set_nlink(inode*, unsigned int)' [A] 'function int setattr_prepare(dentry*, iattr*)' [A] 'function int snd_interval_ranges(snd_interval*, unsigned int, const snd_interval*, unsigned int)' [A] 'function int snd_pcm_hw_constraint_ratnums(snd_pcm_runtime*, unsigned int, snd_pcm_hw_param_t, const snd_pcm_hw_constraint_ratnums*)' [A] 'function int snd_soc_limit_volume(snd_soc_card*, const char*, int)' [A] 'function int sock_recvmsg(socket*, msghdr*, int)' [A] 'function socket* sockfd_lookup(int, int*)' [A] 'function const spi_device_id* spi_get_device_id(const spi_device*)' [A] 'function int spi_mem_adjust_op_size(spi_mem*, spi_mem_op*)' [A] 'function bool spi_mem_default_supports_op(spi_mem*, const spi_mem_op*)' [A] 'function ssize_t spi_mem_dirmap_read(spi_mem_dirmap_desc*, u64, size_t, void*)' [A] 'function ssize_t spi_mem_dirmap_write(spi_mem_dirmap_desc*, u64, size_t, void*)' [A] 'function int spi_mem_driver_register_with_owner(spi_mem_driver*, module*)' [A] 'function void spi_mem_driver_unregister(spi_mem_driver*)' [A] 'function bool spi_mem_dtr_supports_op(spi_mem*, const spi_mem_op*)' [A] 'function int spi_mem_exec_op(spi_mem*, const spi_mem_op*)' [A] 'function const char* spi_mem_get_name(spi_mem*)' [A] 'function bool spi_mem_supports_op(spi_mem*, const spi_mem_op*)' [A] 'function blk_qc_t submit_bio_noacct(bio*)' [A] 'function int sync_dirty_buffer(buffer_head*)' [A] 'function int sync_filesystem(super_block*)' [A] 'function int sync_inode_metadata(inode*, int)' [A] 'function void tag_pages_for_writeback(address_space*, unsigned long int, unsigned long int)' [A] 'function timespec64 timestamp_truncate(timespec64, inode*)' [A] 'function void touch_atime(const path*)' [A] 'function void touchscreen_parse_properties(input_dev*, bool, touchscreen_properties*)' [A] 'function void touchscreen_report_pos(input_dev*, const touchscreen_properties*, unsigned int, unsigned int, bool)' [A] 'function int trace_set_clr_event(const char*, const char*, int)' [A] 'function void truncate_inode_pages(address_space*, loff_t)' [A] 'function void truncate_inode_pages_final(address_space*)' [A] 'function void truncate_pagecache(inode*, loff_t)' [A] 'function void truncate_setsize(inode*, loff_t)' [A] 'function int try_to_release_page(page*, gfp_t)' [A] 'function void try_to_writeback_inodes_sb(super_block*, wb_reason)' [A] 'function void unload_nls(nls_table*)' [A] 'function void unlock_buffer(buffer_head*)' [A] 'function void unlock_new_inode(inode*)' [A] 'function void usbnet_cdc_unbind(usbnet*, usb_interface*)' [A] 'function int usbnet_generic_cdc_bind(usbnet*, usb_interface*)' [A] 'function int vsscanf(const char*, const char*, va_list)' [A] 'function void wait_on_page_bit(page*, int)' [A] 'function int wake_bit_function(wait_queue_entry*, unsigned int, int, void*)' [A] 'function void wq_worker_comm(char*, size_t, task_struct*)' [A] 'function int write_inode_now(inode*, int)' [A] 'function int write_one_page(page*)' 17 Added variables: [A] 'tracepoint __tracepoint_android_rvh_binder_transaction' [A] 'tracepoint __tracepoint_android_rvh_do_ptrauth_fault' [A] 'tracepoint __tracepoint_android_rvh_do_sched_yield' [A] 'tracepoint __tracepoint_android_vh_binder_del_ref' [A] 'tracepoint __tracepoint_android_vh_binder_free_proc' [A] 'tracepoint __tracepoint_android_vh_binder_has_work_ilocked' [A] 'tracepoint __tracepoint_android_vh_binder_looper_state_registered' [A] 'tracepoint __tracepoint_android_vh_binder_new_ref' [A] 'tracepoint __tracepoint_android_vh_binder_proc_transaction' [A] 'tracepoint __tracepoint_android_vh_binder_proc_transaction_end' [A] 'tracepoint __tracepoint_android_vh_binder_read_done' [A] 'tracepoint __tracepoint_android_vh_binder_thread_read' [A] 'tracepoint __tracepoint_android_vh_binder_thread_release' [A] 'tracepoint __tracepoint_android_vh_futex_sleep_start' [A] 'tracepoint __tracepoint_android_vh_subpage_dma_contig_alloc' [A] 'tracepoint __tracepoint_block_bio_remap' [A] 'device platform_bus' This merge contains the following new commits:4b64435629
ANDROID: GKI: disable CONFIG_FORTIFY_SOURCE94097f9434
Merge 5.10.81 into android12-5.10-lts99957dcea4
Linux 5.10.810685efd984
selftests/x86/iopl: Adjust to the faked iopl CLI/STI usage6a315471cb
thermal: Fix NULL pointer dereferences in of_thermal_ functionsbd40513d0b
perf/core: Avoid put_page() when GUP failsdf58fb431a
scripts/lld-version.sh: Rewrite based on upstream ld-version.shbe3f603583
erofs: fix unsafe pagevec reuse of hooked pclusters6c1ad56b2d
erofs: remove the occupied parameter from z_erofs_pagevec_enqueue()5bf5f46483
PCI: Add MSI masking quirk for Nvidia ION AHCIf28c620e1a
PCI/MSI: Deal with devices lying about their MSI mask capability9b61500ee5
PCI/MSI: Destroy sysfs before freeing entriesc49bfdfe53
parisc/entry: fix trace test in syscall exit pathb31bac0619
x86/iopl: Fake iopl(3) CLI/STI usagea0958a5354
net: stmmac: dwmac-rk: fix unbalanced pm_runtime_enable warnings80407c6ad9
net: stmmac: fix issue where clk is being unprepared twiceac4bb9951c
net: stmmac: fix system hang if change mac address after interface ifdownbcf3752243
net: stmmac: fix missing unlock on error in stmmac_suspend()483ed89522
net: stmmac: platform: fix build error with !CONFIG_PM_SLEEP3afe11be64
net: stmmac: add clocks management for gmac driverf27060e28e
bootconfig: init: Fix memblock leak in xbc_make_cmdline()04e46514fe
loop: Use blk_validate_block_size() to validate block size79ff56c613
block: Add a helper to validate the block sizeeaafc59005
fortify: Explicitly disable Clang support971945b722
Revert "tcp: switch orphan_count to bare per-cpu counters"e101be336e
Revert "net: sched: update default qdisc visibility after Tx queue cnt changes"2d94ebb760
Revert "serial: core: Fix initializing and restoring termios speed"c553d9a246
Merge 5.10.80 into android12-5.10-lts706ebf15a1
Merge branch 'android12-5.10' into `android12-5.10-lts`f884bb85b8
Linux 5.10.801e49a79bc3
soc/tegra: pmc: Fix imbalanced clock disabling in error code path45490bfa1e
x86/sev: Make the #VC exception stacks part of the default stacks storagefc25889a66
x86/sev: Add an x86 version of cc_platform_has()74ba917cfd
arch/cc: Introduce a function to check for confidential computing features5be42b203f
selftests/bpf: Fix also no-alu32 strobemeta selftest1e7340950d
mmc: moxart: Fix null pointer dereference on pointer host188bf40391
ath10k: fix invalid dma_addr_t token assignmentd41f4d4dd7
SUNRPC: Partial revert of commit6f9f17287e
c7a440cd30
PCI: aardvark: Fix PCIe Max Payload Size settingf967d120a5
PCI: Add PCI_EXP_DEVCTL_PAYLOAD_* macrosf3396f6d83
drm/sun4i: Fix macros in sun8i_csc.h1023355234
powerpc/85xx: fix timebase sync issue when CONFIG_HOTPLUG_CPU=n77d543e687
powerpc/powernv/prd: Unregister OPAL_MSG_PRD2 notifier during module unload9dcdadd6cc
mtd: rawnand: au1550nd: Keep the driver compatible with on-die ECC engines51e34fcf72
mtd: rawnand: plat_nand: Keep the driver compatible with on-die ECC enginese1de04df8e
mtd: rawnand: orion: Keep the driver compatible with on-die ECC enginesb4e2e9fbd1
mtd: rawnand: pasemi: Keep the driver compatible with on-die ECC engines963db3ccc1
mtd: rawnand: gpio: Keep the driver compatible with on-die ECC engines13566bc111
mtd: rawnand: mpc5121: Keep the driver compatible with on-die ECC engines9b366f5221
mtd: rawnand: xway: Keep the driver compatible with on-die ECC enginescbc55cf4a3
mtd: rawnand: ams-delta: Keep the driver compatible with on-die ECC engines1f420818df
s390/cio: make ccw_device_dma_* more robustc9ca9669de
s390/ap: Fix hanging ioctl caused by orphaned replies57de1fbecf
s390/tape: fix timer initialization in tape_std_assign()1174298a5b
s390/cio: check the subchannel validity for dev_busid7d0341b37d
video: backlight: Drop maximum brightness override for brightness zero332306b1e7
mfd: dln2: Add cell for initializing DLN2 ADC1d45798736
mm, oom: do not trigger out_of_memory from the #PFac7f6befc3
mm, oom: pagefault_out_of_memory: don't force global OOM for dying tasks1ada86999d
powerpc/bpf: Emit stf barrier instruction sequences for BPF_NOSPEC7fcf86565b
powerpc/security: Add a helper to query stf_barrier type951fb7bf38
powerpc/bpf: Validate branch ranges51cf71d5cb
powerpc/lib: Add helper to check if offset is within conditional branch range74293225f5
memcg: prohibit unconditional exceeding the limit of dying tasks32246cefb9
9p/net: fix missing error check in p9_check_errorsa8cdf34ff8
net, neigh: Enable state migration between NUD_PERMANENT and NTF_USE0bf5c6a1e4
f2fs: should use GFP_NOFS for directory inodes7930892cbd
irqchip/sifive-plic: Fixup EOI failed when maskedf67f6eb717
posix-cpu-timers: Clear task::posix_cputimers_work in copy_process()1372eb1871
x86/mce: Add errata workaround for Skylake SKX371ee5bc2ba8
MIPS: Fix assembly error from MIPSr2 code used within MIPS_ISA_ARCH_LEVELfc42bbb782
parisc: Fix backtrace to always include init funtion names241c74cc65
ARM: 9156/1: drop cc-option fallbacks for architecture selection03f2578153
ARM: 9155/1: fix early early_iounmap()ee79560cb7
selftests/net: udpgso_bench_rx: fix port argument8b215edb7a
cxgb4: fix eeprom len when diagnostics not implemented93bc3ef607
net/smc: fix sk_refcnt underflow on linkdown and fallback7e03b797be
vsock: prevent unnecessary refcnt inc for nonblocking connectad3d219e84
net: stmmac: allow a tc-taprio base-time of zerob30459c0ca
net: hns3: allow configure ETS bandwidth of all TCsee11f16fee
net: hns3: fix kernel crash when unload VF while it is being reset79aa8706b4
net/sched: sch_taprio: fix undefined behavior in ktime_mono_to_anyb5703462a4
seq_file: fix passing wrong private data4af0cd17e7
gve: Fix off by one in gve_tx_timeout()c842a4c4ae
bpf: sockmap, strparser, and tls are reusing qdisc_skb_cb and colliding8b5c98a67c
bpf, sockmap: Remove unhash handler for BPF sockmap usage0fe81d7a20
arm64: pgtable: make __pte_to_phys/__phys_to_pte_val inline functions727c812433
nfc: pn533: Fix double free when pn533_fill_fragment_skbs() fails9f0e683e1b
llc: fix out-of-bound array index in llc_sk_dev_hash()b833274ae6
perf bpf: Add missing free to bpf_event__print_bpf_prog_info()7091fcc75f
zram: off by one in read_block_state()64bde0c2db
mm/zsmalloc.c: close race window between zs_pool_dec_isolated() and zs_unregister_migration()a3c205c017
can: mcp251xfd: mcp251xfd_chip_start(): fix error handling for mcp251xfd_chip_rx_int_enable()300d874748
mfd: core: Add missing of_node_put for loop iteration6439b91fef
bonding: Fix a use-after-free problem when bond_sysfs_slave_add() failedacb01e962a
net: phy: fix duplex out of sync problem while changing settings090e17075f
drm/nouveau/svm: Fix refcount leak bug and missing check against null bugee8a3ae48a
ACPI: PMIC: Fix intel_pmic_regs_handler() read accessesd83832d4a8
ice: Fix not stopping Tx queues for VFs354ae5ca6c
ice: Fix replacing VF hardware MAC to existing MAC filtere04a7a84bb
net: vlan: fix a UAF in vlan_dev_real_dev()3fe164e719
openrisc: fix SMP tlb flush NULL pointer dereference628773a759
ethtool: fix ethtool msg len calculation for pause statse78c267eb7
net: davinci_emac: Fix interrupt pacing disable111f77594d
xen-pciback: Fix return in pm_ctrl_init()de9721ee8a
i2c: xlr: Fix a resource leak in the error handling path of 'xlr_i2c_probe()'8c3e204fb6
NFSv4: Fix a regression in nfs_set_open_stateid_locked()0afb3bc534
scsi: qla2xxx: Turn off target reset during issue_lip09595fd2ce
scsi: qla2xxx: Fix gnl list corruptioncbe31149e5
scsi: qla2xxx: Relogin during fabric disturbancebc3f207ed9
scsi: qla2xxx: Changes to support FCP2 Targetba5eb0e443
ar7: fix kernel builds for compiler testef9f7ab9ba
watchdog: f71808e_wdt: fix inaccurate report in WDIOC_GETTIMEOUTaaa64ee14a
m68k: set a default value for MEMORY_RESERVEa4cbf00e5a
signal/sh: Use force_sig(SIGKILL) instead of do_group_exit(SIGKILL)b04c17acf4
dmaengine: dmaengine_desc_callback_valid(): Check for `callback_result`bba31f3b1f
netfilter: nfnetlink_queue: fix OOB when mac header was cleared41968262bb
soc: fsl: dpaa2-console: free buffer before returning from dpaa2_console_read6caab6c96b
auxdisplay: ht16k33: Fix frame buffer device blanking178522aa75
auxdisplay: ht16k33: Connect backlight to fbdeva1d6a60ee0
auxdisplay: img-ascii-lcd: Fix lock-up when displaying empty string0e1709b2a0
Fix user namespace leak90e7415221
NFS: Fix an Oops in pnfs_mark_request_commit()10f2108717
NFS: Fix up commit deadlocks91e43a8500
dmaengine: at_xdmac: fix AT_XDMAC_CC_PERID() macro038dfd67d3
rtc: rv3032: fix error handling in rv3032_clkout_set_rate()5061e10234
remoteproc: Fix a memory leak in an error handling path in 'rproc_handle_vdev()'36104e1f71
mtd: core: don't remove debugfs directory if device is in use0b73c025bf
PCI: uniphier: Serialize INTx masking/unmasking and fix the bit operationd2ff7a8b07
mtd: spi-nor: hisi-sfc: Remove excessive clk_disable_unprepare()c4eb684990
fs: orangefs: fix error return code of orangefs_revalidate_lookup()3e7b08ebf4
NFS: Fix deadlocks in nfs_scan_commit_list()1494389185
opp: Fix return in _opp_add_static_v2()bea3213f19
PCI: aardvark: Fix preserving PCI_EXP_RTCTL_CRSSVE flag on emulated bridgeec6dba3ffe
PCI: aardvark: Don't spam about PIO Response Status2e548581fe
drm/plane-helper: fix uninitialized variable referencee94c59b64e
pnfs/flexfiles: Fix misplaced barrier in nfs4_ff_layout_prepare_ds8ac076ce71
NFS: Fix dentry verifier races9d438dbf73
i2c: mediatek: fixing the incorrect register offsetf3492c4a92
nfsd: don't alloc under spinlock in rpc_parse_scope_id602ab1fd40
rpmsg: Fix rpmsg_create_ept return when RPMSG config is not defined851b622e7b
apparmor: fix error check9c9c33ea4c
power: supply: bq27xxx: Fix kernel crash on IRQ handler register errordbdf0f2207
mips: cm: Convert to bitfield API to fix out-of-bounds accessc8447cb14a
virtio_ring: check desc == NULL when using indirect with packed80e6643393
ASoC: cs42l42: Correct configuring of switch inversion from ts-invcb0fdd9aae
ASoC: cs42l42: Use device_property API instead of of_propertyef9d007a91
ASoC: cs42l42: Disable regulators if probe failsc0faad6e9d
powerpc/44x/fsp2: add missing of_node_put4310970d0b
HID: u2fzero: properly handle timeouts in usb_submit_urbe2f0bff411
HID: u2fzero: clarify error check and length calculations26be378079
clk: at91: sam9x60-pll: use DIV_ROUND_CLOSEST_ULLf2886010a8
serial: xilinx_uartps: Fix race condition causing stuck TX515778f9d8
phy: qcom-snps: Correct the FSEL_MASKfd056574a7
phy: ti: gmii-sel: check of_get_address() for failure0a46740a0a
phy: qcom-qusb2: Fix a memory leak on probeec40a28495
pinctrl: equilibrium: Fix function addition in multiple groupsa0467ca4d2
soc: qcom: apr: Add of_node_put() before returnb41c528b14
firmware: qcom_scm: Fix error retval in __qcom_scm_is_call_available()31e7a836e2
usb: dwc2: drd: reset current session before setting the new onefc86da757d
usb: dwc2: drd: fix dwc2_drd_role_sw_set when clock could be disabled6774a42932
usb: dwc2: drd: fix dwc2_force_mode call in dwc2_ovr_init068dfa570d
serial: imx: fix detach/attach of serial consoled293bd40fb
scsi: ufs: ufshcd-pltfrm: Fix memory leak due to probe defer75df593941
scsi: ufs: Refactor ufshcd_setup_clocks() to remove skip_ref_clk948d8f2f2f
iio: adis: do not disabe IRQs in 'adis_init()'c8e5edca68
usb: typec: STUSB160X should select REGMAP_I2C503d6e5fb8
soc: qcom: rpmhpd: Make power_on actually enable the domain81e37cf40d
soc: qcom: rpmhpd: Provide some missing struct member descriptionsb288b841c1
ASoC: cs42l42: Defer probe if request_threaded_irq() returns EPROBE_DEFER1812deb08f
ASoC: cs42l42: Correct some register default valuesd34982c087
ARM: dts: stm32: fix AV96 board SAI2 pin muxing on stm32mp15602fefd456
ARM: dts: stm32: fix SAI sub nodes register range3fb75227bd
ARM: dts: stm32: Reduce DHCOR SPI NOR frequency to 50 MHz78238479b9
pinctrl: renesas: checker: Fix off-by-one bug in drive register check51bcffb395
staging: ks7010: select CRYPTO_HASH/CRYPTO_MICHAEL_MIC0bb8359f9c
staging: most: dim2: do not double-register the same device8e1feecc04
usb: musb: select GENERIC_PHY instead of depending on it0058f7fbea
RDMA/mlx4: Return missed an error if device doesn't support steeringbce61de564
scsi: csiostor: Uninitialized data in csio_ln_vnp_read_cbfn()12c4673204
power: supply: max17040: fix null-ptr-deref in max17040_probe()c553d67301
power: supply: rt5033_battery: Change voltage values to µVd8da6328ec
usb: gadget: hid: fix error code in do_config()92a80e1ca2
serial: 8250_dw: Drop wrong use of ACPI_PTR()cfbf58ac8e
powerpc: fix unbalanced node refcount in check_kvm_guest()54965d92a4
powerpc: Fix is_kvm_guest() / kvm_para_available()e01a4d7560
powerpc: Reintroduce is_kvm_guest() as a fast-path check113207234a
powerpc: Rename is_kvm_guest() to check_kvm_guest()61c5d9fa56
powerpc: Refactor is_kvm_guest() declaration to new header67074c63cd
video: fbdev: chipsfb: use memset_io() instead of memset()fb24243e6d
clk: at91: check pmc node status before registering syscore ops20cc0fa1d0
memory: fsl_ifc: fix leak of irq and nand_irq in fsl_ifc_ctrl_probed3833d3c56
soc/tegra: Fix an error handling path in tegra_powergate_power_up()9a22442009
ASoC: SOF: topology: do not power down primary core during topology removal8b6124d924
arm: dts: omap3-gta04a4: accelerometer irq fixe1959450b7
driver core: Fix possible memory leak in device_link_add()ddb13ddacc
scsi: pm80xx: Fix misleading log statement in pm8001_mpi_get_nvmd_resp()4438a74570
soundwire: debugfs: use controller id and link_id for debugfs3fe8d239e3
ALSA: hda: Use position buffer for SKL+ againc550c7c9ae
ALSA: hda: Fix hang during shutdown due to link reset23e8f775d9
ALSA: hda: Release controller display power during shutdown/reboot5972e974eb
ALSA: hda: Reduce udelay() at SKL+ position reporting1db71de28b
arm64: dts: qcom: pm8916: Remove wrong reg-names for rtc@6000d833ddddec
arm64: dts: renesas: beacon: Fix Ethernet PHY moded70247b752
arm64: dts: qcom: msm8916: Fix Secondary MI2S bit clock980c7bdd20
JFS: fix memleak in jfs_mountc4edd206d5
MIPS: loongson64: make CPU_LOONGSON64 depends on MIPS_FP_SUPPORT24149c954f
scsi: dc395: Fix error case unwinding6348983be7
ARM: dts: at91: tse850: the emac<->phy interface is rmiib6493c2b7d
bus: ti-sysc: Fix timekeeping_suspended warning on resume85085c3437
arm64: dts: meson-g12b: Fix the pwm regulator supply properties4ccb7e4a97
arm64: dts: meson-g12a: Fix the pwm regulator supply properties20baf01638
arm64: dts: ti: k3-j721e-main: Fix "bus-range" upto 256 bus number for PCIe7a1617a991
arm64: dts: ti: k3-j721e-main: Fix "max-virtual-functions" in PCIe EP nodes64a43b7712
RDMA/bnxt_re: Fix query SRQ failurefe3c11fc62
ARM: dts: qcom: msm8974: Add xo_board reference clock to DSI0 PHY2887df89e7
arm64: dts: rockchip: Fix GPU register width for RK33283f33f09d9f
ARM: s3c: irq-s3c24xx: Fix return value check for s3c24xx_init_intc()cdd3dd905c
clk: mvebu: ap-cpu-clk: Fix a memory leak in error handling paths2fde76df18
ARM: dts: BCM5301X: Fix memory nodes names5282385ee6
RDMA/rxe: Fix wrong port_cap_flagsa2c17c93b7
iio: st_sensors: disable regulators after device unregistrationbfedc81776
iio: st_sensors: Call st_sensors_power_enable() from bus driversf84c7a03d1
of: unittest: fix EXPECT text for gpio hog errors4a50bc0084
bpf: Fix propagation of signed bounds from 64-bit min/max into 32-bit.84dde8c8c9
bpf: Fix propagation of bounds from 64-bit min/max into 32-bit and var_off.9308f9c9c7
cgroup: Fix rootcg cpu.stat guest double countinga3fdcd16b1
ibmvnic: Process crqs after enabling interrupts5b3f720419
ibmvnic: don't stop queue in xmit366235d4be
udp6: allow SO_MARK ctrl msg to affect routing8f3d88139d
selftests/bpf: Fix fclose/pclose mismatch in test_progs71ec65c700
crypto: pcrypt - Delay write to padata->infofb41b8f5e8
net: phylink: avoid mvneta warning when setting pause parameters08449a5c0e
net: amd-xgbe: Toggle PLL settings during rate changeb17f424f88
selftests/bpf: Fix fd cleanup in sk_lookup test2989a396b8
selftests: bpf: Convert sk_lookup ctx access tests to PROG_TEST_RUNae1f588ca1
drm/amdgpu/gmc6: fix DMA mask from 44 to 40 bitsa586453da9
wcn36xx: Fix discarded frames due to wrong sequence number3965cc2e9f
wcn36xx: add proper DMA memory barriers in rx path62d12650b8
libertas: Fix possible memory leak in probe and disconnect975c15a19b
libertas_tf: Fix possible memory leak in probe and disconnect3aa98ef8f7
KVM: s390: Fix handle_sske page fault handling5109802499
samples/kretprobes: Fix return value if register_kretprobe() failedc3ac751944
spi: spi-rpc-if: Check return value of rpcif_sw_init()5b7b4afead
tcp: don't free a FIN sk_buff in tcp_remove_empty_skb()3925134eff
libbpf: Fix endianness detection in BPF_CORE_READ_BITFIELD_PROBED()227efdda51
tpm_tis_spi: Add missing SPI IDff1a0f71cc
tpm: fix Atmel TPM crash caused by too frequent queries43b4860b58
irq: mips: avoid nested irq_enter()29a1cc3b50
KVM: s390: pv: avoid stalls for kvm_s390_pv_init_vm759f27cfa3
KVM: s390: pv: avoid double free of sida pagea729eb55b3
s390/gmap: don't unconditionally call pte_unmap_unlock() in __gmap_zap()50fcaa7155
libbpf: Fix BTF header parsing checks12872fd7e4
libbpf: Fix overflow in BTF sanity checks255eb8f8af
libbpf: Allow loading empty BTFs4d4d6aa2ef
libbpf: Fix BTF data layout checks and allow empty BTF0b95aaa493
bpftool: Avoid leaking the JSON writer prepared for program metadata7cd4af996c
KVM: selftests: Fix nested SVM tests when built with clang293fa72d62
KVM: selftests: Add operand to vmsave/vmload/vmrun in svm.cd337537181
smackfs: use netlbl_cfg_cipsov4_del() for deleting cipso_v4_doi807f01f60c
drm/msm: Fix potential NULL dereference in DPU SSPP6d1f3157aa
x86/sev: Fix stack type check in vc_switch_off_ist()8e2f97df6a
clocksource/drivers/timer-ti-dm: Select TIMER_OFb9f142d748
PM: hibernate: fix sparse warningse8c0b74845
nvme-rdma: fix error code in nvme_rdma_setup_ctrl7668cbe0cb
phy: micrel: ksz8041nl: do not use power down moded405eb1150
net: enetc: unmap DMA in enetc_send_cmd()14e12b7a76
mwifiex: Send DELBA requests according to spec4ed5bb3df6
rsi: stop thread firstly in rsi_91x_init() error handlinge270226475
mt76: mt7915: fix muar_idx in mt7915_mcu_alloc_sta_req()1a270dada0
mt76: mt7915: fix sta_rec_wtbl tag len116652a3d5
mt76: mt7915: fix possible infinite loop release semaphore7a8e4effbb
mt76: mt76x02: fix endianness warnings in mt76x02_mac.c4d5c7f07c7
mt76: mt7615: fix endianness warning in mt7615_mac_write_txwi4187bf3310
platform/x86: thinkpad_acpi: Fix bitwise vs. logical warning25c032c585
mmc: mxs-mmc: disable regulator on error and in the remove function7c1c7ac9d1
media: ir_toy: assignment to be16 should be of correct typedaf15fa1fd
net: stream: don't purge sk_error_queue in sk_stream_kill_queues()14d2415772
drm/msm: uninitialized variable in msm_gem_import()3424931fa3
drm/msm: potential error pointer dereference in init()a342cb4772
tcp: switch orphan_count to bare per-cpu countersc85c6fadbe
kernel/sched: Fix sched_fork() access an invalid sched_task_groupe1ee11473a
ath10k: fix max antenna gain unit786976b25a
hwmon: (pmbus/lm25066) Let compiler determine outer dimension of lm25066_coefffbc80c83f1
hwmon: Fix possible memleak in __hwmon_device_register()e29352f162
net, neigh: Fix NTF_EXT_LEARNED in combination with NTF_USE41fe79cf11
memstick: jmb38x_ms: use appropriate free function in jmb38x_ms_alloc_host()4756d7fbaf
memstick: avoid out-of-range warning72de92d33f
mmc: sdhci-omap: Fix context restore2fd26ec36e
mmc: sdhci-omap: Fix NULL pointer exception if regulator is not configureda9fbeb5bbc
gve: Recover from queue stall due to missed IRQ9e4f708df6
b43: fix a lower bounds test508faf8721
b43legacy: fix a lower bounds test6a16100141
hwrng: mtk - Force runtime pm ops for sleep ops8d98683fa6
crypto: qat - disregard spurious PFVF interruptsd99fdd13a7
crypto: qat - detect PFVF collision after ACK1fe4b24419
media: dvb-frontends: mn88443x: Handle errors of clk_prepare_enable()740a794e01
netfilter: nft_dynset: relax superfluous check on set updatesaf756be29c
rcu: Always inline rcu_dynticks_task*_{enter,exit}()6880325382
EDAC/amd64: Handle three rank interleaving mode1b2d422a26
PM: EM: Fix inefficient states detectiond01e847d84
ath9k: Fix potential interrupt storm on queue reset52e3545eef
media: em28xx: Don't use ops->suspend if it is NULLf03e0624e9
cpuidle: Fix kobject memory leaks in error paths66f7de13d1
crypto: ecc - fix CRYPTO_DEFAULT_RNG dependency848f1f00c6
kprobes: Do not use local variable when creating debugfs filec34bfe4204
media: cx23885: Fix snd_card_free call on null card pointer388cebfa73
media: tm6000: Avoid card name truncation86626be4b6
media: si470x: Avoid card name truncation88315edafe
media: radio-wl1273: Avoid card name truncation4280b30ea9
media: mtk-vpu: Fix a resource leak in the error handling path of 'mtk_vpu_probe()'e43b301cb1
media: TDA1997x: handle short reads of hdmi info frame.c85e591b77
media: v4l2-ioctl: S_CTRL output the right valuee2f3608a0b
media: dvb-usb: fix ununit-value in az6027_rc_query0a85325fc5
media: cxd2880-spi: Fix a null pointer dereference on error handling path4303b39b50
media: em28xx: add missing em28xx_close_extension375150b3aa
drm/amdgpu: fix warning for overflow check8980f9d144
arm64: mm: update max_pfn after memory hotplugcbbf816cb7
drm/ttm: stop calling tt_swapin in vm_accessc39154d3d6
ath10k: sdio: Add missing BH locking around napi_schdule()ffed645538
ath10k: Fix missing frame timestamp for beacon/probe-resp08fb0008d9
ath11k: Fix memory leak in ath11k_qmi_driver_event_work4519fb9105
ath11k: fix packet drops due to incorrect 6 GHz freq value in rx statusb6a46ec871
ath11k: Avoid race during regd updatesac49af173c
ath11k: fix some sleeping in atomic bugs9833cb3206
net: dsa: rtl8366rb: Fix off-by-one bug78fb8c9992
rxrpc: Fix _usecs_to_jiffies() by using usecs_to_jiffies()03725f7125
crypto: caam - disable pkc for non-E SoCsf0b40bf3e4
Bluetooth: btmtkuart: fix a memleak in mtk_hci_wmt_sync310f581f54
wilc1000: fix possible memory leak in cfg_scan_result()3a95dbc8b7
wcn36xx: Fix Antenna Diversity Switchingba8ba76885
cgroup: Make rebind_subsystems() disable v2 controllers all at oncea585e04e34
net: net_namespace: Fix undefined member in key_remove_domain()fb4a58f519
lockdep: Let lock_is_held_type() detect recursive read as read38098444b7
virtio-gpu: fix possible memory allocation failure582de9e385
drm/v3d: fix wait for TMU write combiner flushf0bc12b848
objtool: Fix static_call list generationb36ab509e1
x86/xen: Mark cpu_bringup_and_idle() as dead_end_functionabf37e855e
objtool: Add xen_start_kernel() to noreturn list6b72caabc4
MIPS: lantiq: dma: fix burst length for DEU226d68fb6c
rcu: Fix existing exp request check in sync_sched_exp_online_cleanup()c20d8c1974
Bluetooth: fix init and cleanup of sco_conn.timeout_work19337ed10e
selftests/bpf: Fix strobemeta selftest regressionbc9199271c
netfilter: conntrack: set on IPS_ASSURED if flows enters internal stream state0c5e946794
parisc/kgdb: add kgdb_roundup() to make kgdb work with idle pollinga1ec31a0be
parisc/unwind: fix unwinder when CONFIG_64BIT is enabledee75174f6a
erofs: don't trigger WARN() when decompression fails50a2d1229b
task_stack: Fix end_of_stack() for architectures with upwards-growing stack44d4c43bab
parisc: fix warning in flush_tlb_alld8166a27c6
selftests/core: fix conflicting types compile error for close_range()6f038b1a94
drm/amd/display: dcn20_resource_construct reduce scope of FPU enabledddfcae9052
x86/hyperv: Protect set_hv_tscchange_cb() against getting preemptedc4cfdf5fa8
wcn36xx: Correct band/freq reporting on RXa27095cda1
spi: bcm-qspi: Fix missing clk_disable_unprepare() on error in bcm_qspi_probe()b917f9b946
btrfs: do not take the uuid_mutex in btrfs_rm_device428bb3d71e
btrfs: reflink: initialize return value to 0 in btrfs_extent_same()eeb96ebdc6
ACPI: AC: Quirk GK45 to skip reading _PSR42d8c280dd
net: annotate data-race in neigh_output()c2e5f43db0
vrf: run conntrack only in context of lower/physdev for locally generated packetsb3ae170b8e
ARM: 9136/1: ARMv7-M uses BE-8, not BE-32b870d8a76c
gfs2: Fix glock_hash_walk bugs16a7981188
gfs2: Cancel remote delete work asynchronously9ceac307b5
gre/sit: Don't generate link-local addr if addr_gen_mode is IN6_ADDR_GEN_MODE_NONE25a45d3999
ARM: clang: Do not rely on lr register for stacktracec11aecbe05
smackfs: use __GFP_NOFAIL for smk_cipso_doi()32a9a8fdba
iwlwifi: mvm: disable RX-diversity in powersavee658d59f0e
selftests/bpf: Fix perf_buffer test on system with offline cpusd6dca066fc
selftests: kvm: fix mismatched fclose() after popen()9f4bd00a6e
PM: hibernate: Get block device exclusively in swsusp_check()7a0b68eecb
nvme: drop scan_lock and always kick requeue list when removing namespaces82327823f3
nvmet-tcp: fix use-after-free when a port is removed2659d8213d
nvmet-rdma: fix use-after-free when a port is removede73574f7bc
nvmet: fix use-after-free when a port is removed1a10bf4c9d
media: allegro: ignore interrupt if mailbox is not initialized49cc377654
block: remove inaccurate requeue check451cef276f
mwl8k: Fix use-after-free in mwl8k_fw_state_machine()16c2dd0ab5
mt76: mt7915: fix an off-by-one bound checkea7f8803a3
tracing/cfi: Fix cmp_entries_* functions signature mismatch5736f1dead
workqueue: make sysfs of unbound kworker cpumask more cleverab5c46f258
lib/xz: Validate the value before assigning it to an enum variableaa5d35e350
lib/xz: Avoid overlapping memcpy() with invalid input with in-place decompressioncad55afe37
memstick: r592: Fix a UAF bug when removing the driver2338c35017
md: update superblock after changing rdev flags in state_storeb34ea3c91e
block: bump max plugged deferred size from 16 to 32517feec952
drm/msm: prevent NULL dereference in msm_gpu_crashstate_capture()e1d7f0202a
leaking_addresses: Always print a trailing newline9101e2574b
net: phy: micrel: make *-skew-ps check more lenient832fad367c
drm/amdkfd: fix resume error when iommu disabled in Picasso65c84e09e8
ACPI: battery: Accept charges over the design capacity as fullb600866018
iov_iter: Fix iov_iter_get_pages{,_alloc} page fault return value219df0f6ba
mmc: moxart: Fix reference count leaks in moxart_probe38608d32ad
ath: dfs_pattern_detector: Fix possible null-pointer dereference in channel_detector_create()3c2434d9a6
tracefs: Have tracefs directories not set OTH permission bits by default8524501a0e
net-sysfs: try not to restart the syscall if it will fail eventuallyb94e5bd540
media: usb: dvd-usb: fix uninit-value bug in dibusb_read_eeprom_byte()e3bc3e1141
media: ipu3-imgu: VIDIOC_QUERYCAP: Fix bus_infob499d40571
media: ipu3-imgu: imgu_fmt: Handle properly try272e54604c
ACPICA: Avoid evaluating methods too early during system resumef09e1a2d2c
fs/proc/uptime.c: Fix idle time reporting in /proc/uptime6e242c557a
ipmi: Disable some operations during a panic1f38e5e803
media: rcar-csi2: Add checking to rcsi2_start_receiver()3d5575b3f5
brcmfmac: Add DMI nvram filename quirk for Cyberbook T116 tablet7d54f52d8f
rtw88: fix RX clock gate setting while fifo dumpd506a3d60d
ia64: don't do IA64_CMPXCHG_DEBUG without CONFIG_PRINTK2709971f9f
media: mceusb: return without resubmitting URB in case of -EPROTO error.40b8e7dee5
media: imx: set a media_device bus_info stringa62edd8390
media: s5p-mfc: Add checking to s5p_mfc_probe().b570e36a77
media: s5p-mfc: fix possible null-pointer dereference in s5p_mfc_probe()f4037b9b10
media: uvcvideo: Set unique vdev name based in typed934941640
media: uvcvideo: Return -EIO for control errors2052c4cebc
media: uvcvideo: Set capability in s_param0c91bb4fbd
media: stm32: Potential NULL pointer dereference in dcmi_irq_thread()309ea2248d
media: atomisp: Fix error handling in probef4c652bd35
media: netup_unidvb: handle interrupt properly according to the firmware09ee09359a
media: mt9p031: Fix corrupted frame after restarting streamaded39ff1f
ath10k: high latency fixes for beacon buffer461a71a1a6
ath11k: Change DMA_FROM_DEVICE to DMA_TO_DEVICE when map reinjected packets43ab645788
ath11k: add handler for scan event WMI_SCAN_EVENT_DEQUEUED97890f3633
ath11k: Avoid reg rules update during firmware recovery2114f80889
drm/amdgpu: Fix MMIO access page fault68ac723fb1
fscrypt: allow 256-bit master keys with AES-256-XTSf526d948c3
mwifiex: Properly initialize private structure on interface type changesbab15174ec
mwifiex: Run SET_BSS_MODE when changing from P2P to STATION vif-type7ca1711d59
x86: Increase exception stack sizes1c04dabbd1
ath11k: Align bss_chan_info structure with firmware3fac6feca9
smackfs: Fix use-after-free in netlbl_catmap_walk()02ddf26d84
rcu-tasks: Move RTGS_WAIT_CBS to beginning of rcu_tasks_kthread() loop8d433ab5c8
net: sched: update default qdisc visibility after Tx queue cnt changes28118dcc87
locking/lockdep: Avoid RCU-induced noinstr failb92a5df2c7
MIPS: lantiq: dma: reset correct number of channel5af57ce8a6
MIPS: lantiq: dma: add small delay after reset396e302cc8
platform/x86: wmi: do not fail if disabling fails7f43cda650
rcutorture: Avoid problematic critical section nesting on PREEMPT_RT7987f31e54
drm/panel-orientation-quirks: add Valve Steam Deckc10465f6d6
Bluetooth: fix use-after-free error in lock_sock_nested()4dfba42604
Bluetooth: sco: Fix lock_sock() blockage by memcpy_from_msg()509ae4a4f0
drm: panel-orientation-quirks: Add quirk for the Samsung Galaxy Book 10.662b90d7eeb
drm: panel-orientation-quirks: Add quirk for KD Kurio Smart C15200 2-in-1780fff2c75
drm: panel-orientation-quirks: Update the Lenovo Ideapad D330 quirk (v2)6758d66516
dma-buf: WARN on dmabuf release with pending attachments890e4edcec
power: supply: max17042_battery: Clear status bits in interrupt handler898622adb7
USB: chipidea: fix interrupt deadlock6edf4cffe1
USB: iowarrior: fix control-message timeouts0e71591e91
most: fix control-message timeoutsedc5466254
serial: 8250: fix racy uartclk update5f31af4e78
USB: serial: keyspan: fix memleak on probe errorsab4755ea91
iio: ad5770r: make devicetree property reading consistent6384620608
iio: dac: ad5446: Fix ad5622_write() return valuea4e7a8c432
coresight: cti: Correct the parameter for pm_runtime_put46709163a5
pinctrl: core: fix possible memory leak in pinctrl_enable()6bc8317b8c
quota: correct error number in free_dqentry()ceeb0a8a87
quota: check block number when reading the block in quota filebc1274df3f
PCI: aardvark: Fix support for PCI_ROM_ADDRESS1 on emulated bridgee2e8961fbc
PCI: aardvark: Set PCI Bridge Class Code to PCI Bridgebd5d982822
PCI: aardvark: Fix support for PCI_BRIDGE_CTL_BUS_RESET on emulated bridge2b99c6fb65
PCI: aardvark: Fix support for bus mastering and PCI_COMMAND on emulated bridge4bb5399c1c
PCI: aardvark: Read all 16-bits from PCIE_MSI_PAYLOAD_REG2ad10bbf84
PCI: aardvark: Fix return value of MSI domain .alloc() method6a0da19be5
PCI: aardvark: Fix configuring Reference clock5fb031fcd4
PCI: aardvark: Fix reporting Data Link Layer Link Active2b861523d7
PCI: aardvark: Do not unmask unused interrupts1085ee5236
PCI: aardvark: Fix checking for link up via LTSSM state3bcbace714
PCI: aardvark: Do not clear status bits of masked interruptsc1a8fb2374
PCI: cadence: Add cdns_plat_pcie_probe() missing returnadcfc317d3
PCI: pci-bridge-emul: Fix emulation of W1C bits4fd9f0509a
ovl: fix use after free in struct ovl_aio_reqaf7d25d785
xen/balloon: add late_initcall_sync() for initial ballooning done96e7880a43
ALSA: mixer: fix deadlock in snd_mixer_oss_set_volume694c0c84a6
ALSA: mixer: oss: Fix racy access to slotscd0b29a89b
ifb: fix building without CONFIG_NET_CLS_ACT47462c5e60
serial: core: Fix initializing and restoring termios speedc1e6e42740
ring-buffer: Protect ring_buffer_reset() from reentrancy93fccb1f89
powerpc/85xx: Fix oops when mpc85xx_smp_guts_ids node cannot be found875609ad80
can: j1939: j1939_can_recv(): ignore messages with invalid source addressc3cb7b5c9d
can: j1939: j1939_tp_cmd_recv(): ignore abort message in the BAM transport9f9d6d391f
KVM: nVMX: Query current VMCS when determining if MSR bitmaps are in usebd37419f4f
KVM: arm64: Extract ESR_ELx.EC only924955df37
power: supply: max17042_battery: use VFSOC for capacity when no rsnsf2feac81ed
power: supply: max17042_battery: Prevent int underflow in set_soc_threshold5720436bc7
mtd: rawnand: socrates: Keep the driver compatible with on-die ECC engines7e867f8bb3
soc: fsl: dpio: use the combined functions to protect critical zone55c97165ad
soc: fsl: dpio: replace smp_processor_id with raw_smp_processor_id62bd9eac5f
signal/mips: Update (_save|_restore)_fp_context to fail with -EFAULT5e63b85a48
memory: renesas-rpc-if: Correct QSPI data transfer in Manual mode4fbecebb31
signal: Remove the bogus sigkill_pending in ptrace_stop5c6fedce4a
RDMA/qedr: Fix NULL deref for query_qp on the GSI QP30cdf50357
perf/x86/intel/uncore: Fix Intel ICX IIO event constraintsaef1a67fbf
perf/x86/intel/uncore: Support extra IMC channel on Ice Lake serverda8b3b95c5
rsi: Fix module dev_oper_mode parameter descriptiond69ffec3aa
rsi: fix rate mask set leading to P2P failure41d97e0360
rsi: fix key enabled check causing unwanted encryption for vap_id > 046752a7aed
rsi: fix occasional initialisation failure with BT coexa194e9c721
wcn36xx: handle connection loss indication701cf28e01
libata: fix checking of DMA state890e416c02
mwifiex: Try waking the firmware until we get an interruptd59d2f7af7
mwifiex: Read a PCI register after writing the TX ring write pointerdaccf40320
PM: sleep: Do not let "syscore" devices runtime-suspend during system transitions1c422d6301
wcn36xx: Fix (QoS) null data frame bitrate/modulationc1b8ad661f
wcn36xx: Fix tx_status mechanism3d62e1c9bc
wcn36xx: Fix HT40 capability for 2Ghz bandc044f34ca2
ifb: Depend on netfilter alternatively to tcc7400e2ec8
evm: mark evm_fixmode as __ro_after_initeab090dfcb
rtl8187: fix control-message timeouts73b79ada4c
PCI: Mark Atheros QCA6174 to avoid bus reset30182b8c13
ath10k: fix division by zero in send pathce56007609
ath10k: fix control-message timeout1336b2af8a
ath6kl: fix control-message timeoutf34487c7f2
ath6kl: fix division by zero in send pathfd1e4d8c61
mwifiex: fix division by zero in fw download patha5d8d76710
EDAC/sb_edac: Fix top-of-high-memory value for Broadwell/Haswell31f5c92546
regulator: dt-bindings: samsung,s5m8767: correct s5m8767,pmic-buck-default-dvs-idx property02ecf56faa
regulator: s5m8767: do not use reset value as DVS voltage if GPIO DVS is disabled5b7e3bb163
hwmon: (pmbus/lm25066) Add offset coefficientsdb04fb4111
selinux: fix race condition when computing ocontext SIDsa09a5f4c07
ia64: kprobes: Fix to pass correct trampoline address to the handler2f65b76c44
KVM: VMX: Unregister posted interrupt wakeup handler on hardware unsetupb4a4c9dc44
btrfs: call btrfs_check_rw_degradable only if there is a missing deviceb406439afe
btrfs: fix lost error handling when replaying directory deletes8992aab294
btrfs: clear MISSING device status bit in btrfs_close_one_devicea99da5b680
rds: stop using dmapool0bfb1c1a16
net/smc: Correct spelling mistake to TCPF_SYN_RECV9b86eb2f34
net/smc: Fix smc_link->llc_testlink_time overflow2167a9a12c
nfp: bpf: relax prog rejection for mtu check through max_pkt_offsetc9a7d5fe15
vmxnet3: do not stop tx queues after netif_device_detach()9813218e96
r8169: Add device 10ec:8162 to driver r8169ad6a2a1e56
nvmet-tcp: fix header digest verificationc8270435cf
block: schedule queue restart after BLK_STS_ZONE_RESOURCE7d1fb5c12c
drm: panel-orientation-quirks: Add quirk for GPD Win34d41059b9e
watchdog: Fix OMAP watchdog early handlingb8cb3f4ffa
net: multicast: calculate csum of looped-back and forwarded packets07f7a18649
spi: spl022: fix Microwire full duplex modedb1d9d102e
nvmet-tcp: fix a memory leak when releasing a queue0e86b727a9
xen/netfront: stop tx queues during live migration69b14e23df
gpio: mlxbf2.c: Add check for bgpio_init failureb92ac0a9ca
bpf: Prevent increasing bpf_jit_limit above maxa3564fb7b0
bpf: Define bpf_jit_alloc_exec_limit for arm64 JIT0ad7f317b9
fcnal-test: kill hanging ping/nettest binaries on cleanupbc3e73ebb7
drm: panel-orientation-quirks: Add quirk for Aya Neo 20214002f3944d
mmc: winbond: don't build on M68Ka1ea41f91d
reset: socfpga: add empty driver allowing consumers to probea903984385
ARM: dts: sun7i: A20-olinuxino-lime2: Fix ethernet phy-modef03e04bb9d
hyperv/vmbus: include linux/bitops.h6491ccdde2
sfc: Don't use netif_info before net_device setupe519acba2f
sfc: Export fibre-specific supported link modes7986fdbbe0
cavium: Fix return values of the probe functionad01685177
mISDN: Fix return values of the probe functiona6cb5e09e1
scsi: qla2xxx: Fix unmap of already freed sgl77fee241e6
scsi: qla2xxx: Return -ENOMEM if kzalloc() fails940783d08d
cavium: Return negative value when pci_alloc_irq_vectors() fails75710d583c
ALSA: hda/realtek: Fixes HP Spectre x360 15-eb1xxx speakers92556e3c2b
ASoC: soc-core: fix null-ptr-deref in snd_soc_del_component_unlocked()73199aadcd
x86/irq: Ensure PI wakeup handler is unregistered before module unloaddf8a74fc15
x86/cpu: Fix migration safety with X86_BUG_NULL_SEL115810a265
x86/sme: Use #define USE_EARLY_PGTABLE_L5 in mem_encrypt_identity.cb05eea1bcb
fuse: fix page stealingd81e341fb1
ext4: refresh the ext4_ext_path struct after dropping i_data_sem.4089432dc0
ext4: ensure enough credits in ext4_ext_shift_path_extentsaa21b7e3d3
ext4: fix lazy initialization next schedule time computation in more granular unit782025948b
ALSA: timer: Unconditionally unlink slave instances, toob980ce4ebb
ALSA: timer: Fix use-after-free problem7c6fd52504
ALSA: synth: missing check for possible NULL after the call to kstrdupecd536c57a
ALSA: hda: Free card instance properly at probe errorsf503a25a3d
ALSA: usb-audio: Add registration quirk for JBL Quantum 4009259518fab
ALSA: usb-audio: Line6 HX-Stomp XL USB_ID for 48k-fixed quirk3c7a3f2d79
ALSA: line6: fix control and interrupt message timeouts21f9c02a4d
ALSA: 6fire: fix control and bulk message timeouts0e4c288a74
ALSA: ua101: fix division by zero at probe4f9e9c389e
ALSA: hda/realtek: Add quirk for HP EliteBook 840 G7 mute LED62b189f9f3
ALSA: hda/realtek: Add quirk for ASUS UX550VEa770cb746b
ALSA: hda/realtek: Add a quirk for Acer Spin SP513-54N88bcfcc50d
ALSA: hda/realtek: Headset fixup for Clevo NH77HJQ0288f838a2
ALSA: hda/realtek: Add quirk for Clevo PC70HS3d0e5d2eaf
ALSA: hda/realtek: Add a quirk for HP OMEN 15 mute LEDf0750e9801
ALSA: hda/realtek: Fix mic mute LED for the HP Spectre x360 14a2b3dbc9fd
media: v4l2-ioctl: Fix check_ext_ctrls151eff5880
media: ir-kbd-i2c: improve responsiveness of hauppauge zilog receivers71a137376b
media: rkvdec: Support dynamic resolution changesb2b5126a77
media: ite-cir: IR receiver stop working after receive overflow39275d2ec6
media: rkvdec: Do not override sizeimage for output format949c5b6daa
crypto: s5p-sss - Add error handling in s5p_aes_probe()9ac25cd2f4
firmware/psci: fix application of sizeof to pointerdd189feeba
tpm: Check for integer overflow in tpm2_map_response_body()32498b8889
parisc: Fix ptrace check on syscall return15b4142aea
parisc: Fix set_fixmap() on PA1.x CPUs284ad31054
exfat: fix incorrect loading of i_blocks for large files823b487cfb
mmc: dw_mmc: Dont wait for DRTO on Write RSP error7b24b669d3
mmc: mtk-sd: Add wait dma stop done flowc1d31266de
scsi: qla2xxx: Fix use after free in eh_abort path37b15db1d8
scsi: qla2xxx: Fix kernel crash when accessing port_speed sysfs file06cc8187db
scsi: core: Remove command size deduction from scsi_setup_scsi_cmnd()9d623bf173
ocfs2: fix data corruption on truncate39264eaa6d
libata: fix read log timeout valueab0a06769e
Input: i8042 - Add quirk for Fujitsu Lifebook T7258c341d11c8
Input: elantench - fix misreporting trackpoint coordinatesd1eb42de7c
Input: iforce - fix control-message timeoutafbec52fbc
binder: use cred instead of task for getsecid0d9f4ae7cd
binder: use cred instead of task for selinux checksbd9cea41ac
binder: use euid from cred instead of using task7f1d5a1a7d
usb: xhci: Enable runtime-pm by default on AMD Yellow Carp platformff32302687
xhci: Fix USB 3.1 enumeration issues by increasing roothub power-on-good delay87acf4924e
ANDROID: GKI: fix up abi break in ehci code525e61a871
Merge 5.10.79 into android12-5.10-ltsbd816c2783
Linux 5.10.7962424fe4c2
rsi: fix control-message timeout8971158af1
media: staging/intel-ipu3: css: Fix wrong size comparison imgu_css_fw_init1cf43e9289
staging: rtl8192u: fix control-message timeouts9963ba5b9d
staging: r8712u: fix control-message timeout844b02496e
comedi: vmk80xx: fix bulk and interrupt message timeoutsb7fd7f3387
comedi: vmk80xx: fix bulk-buffer overflow33d7a47073
comedi: vmk80xx: fix transfer-buffer overflowsef143dc0c3
comedi: ni_usb6501: fix NULL-deref in command paths786f5b0345
comedi: dt9812: fix DMA buffers on stack86d4aedcbc
isofs: Fix out of bound access for corrupted isofs imagec430094541
staging: rtl8712: fix use-after-free in rtl8712_dl_fwab4af56ae2
printk/console: Allow to disable console output by using console="" or console=null07d1db141e
binder: don't detect sender/target during buffer cleanup42681b90c4
usb-storage: Add compatibility quirk flags for iODD 2531/25411309753b78
usb: musb: Balance list entry in musb_gadget_queue2740914312
usb: gadget: Mark USB_FSL_QE broken on 64-bit94e5305a38
usb: ehci: handshake CMD_RUN instead of STS_HALTa8db6fd04d
Revert "x86/kvm: fix vcpu-id indexed array sizes"ecf58653f1
KVM: x86: avoid warning with -Wbitwise-instead-of-logicalbe686d451e
Merge branch 'android12-5.10' into `android12-5.10-lts`bb235e8cc2
Merge 5.10.78 into android12-5.10-lts5040520482
Linux 5.10.784c7c024327
ALSA: usb-audio: Add Audient iD14 to mixer map quirk tablef3eb44f496
ALSA: usb-audio: Add Schiit Hel device to mixer map quirk table68765fc977
Revert "wcn36xx: Disable bmps when encryption is disabled"f84b791d4c
ARM: 9120/1: Revert "amba: make use of -1 IRQs warn"bbc920fb32
Revert "drm/ttm: fix memleak in ttm_transfered_destroy"6d67b2a73b
mm: khugepaged: skip huge page collapse for special files5a7957491e
Revert "usb: core: hcd: Add support for deferring roothub registration"50f46bd309
Revert "xhci: Set HCD flag to defer primary roothub registration"d7fc85f610
media: firewire: firedtv-avc: fix a buffer overflow in avc_ca_pmt()b93a70bf2b
net: ethernet: microchip: lan743x: Fix skb allocation failureb9c85a71e1
vrf: Revert "Reset skb conntrack connection..."0382fdf9ae
sfc: Fix reading non-legacy supported link modes748786564a
Revert "io_uring: reinforce cancel on flush during exit"7b57c38d12
scsi: core: Put LLD module refcnt after SCSI device is releaseda7c8ce8460
Merge branch 'android12-5.10' into `android12-5.10-lts`76698ea35f
ANDROID: GKI: fix up abi breakage from "cfg80211: fix management registrations locking"a739489620
Merge 5.10.77 into android12-5.10-lts09df347cfd
Linux 5.10.77fbb91dadb5
perf script: Check session->header.env.arch before using it6f416815c5
riscv: Fix asan-stack clang build7a4cf25d83
riscv: fix misalgned trap vector base addressacb8832f6a
scsi: ufs: ufs-exynos: Correct timeout value setting registers8ecddaca79
KVM: s390: preserve deliverable_mask in __airqs_kick_single_vcpue11a7355fb
KVM: s390: clear kicked_mask before sleeping again727e5deca8
lan743x: fix endianness when accessing descriptorsa7112b8eeb
sctp: add vtag check in sctp_sf_ootbc2442f7219
sctp: add vtag check in sctp_sf_do_8_5_1_E_sa14c1e02b11
sctp: add vtag check in sctp_sf_violationdad2486414
sctp: fix the processing for COOKIE_ECHO chunk8c50693d25
sctp: fix the processing for INIT_ACK chunkad111d4435
sctp: use init_tag from inithdr for ABORT chunk4509000a25
phy: phy_ethtool_ksettings_set: Lock the PHY while changing settings5b88bb9377
phy: phy_start_aneg: Add an unlocked version81780b624d
phy: phy_ethtool_ksettings_set: Move after phy_start_aneg258c5fea44
phy: phy_ethtool_ksettings_get: Lock the phy for consistency58722323d4
net/tls: Fix flipped sign in async_wait.err assignment44e8c93e1e
net: nxp: lpc_eth.c: avoid hang when bringing interface downc2af2092c9
net: ethernet: microchip: lan743x: Fix dma allocation failure by using dma_set_mask_and_coherentbfa6fbdb4e
net: ethernet: microchip: lan743x: Fix driver crash when lan743x_pm_resume failse81bed557f
mlxsw: pci: Recycle received packet upon allocation failurebe98be1a17
nios2: Make NIOS2_DTB_SOURCE_BOOL depend on !COMPILE_TESTaead02927a
gpio: xgs-iproc: fix parsing of ngpios property863a423ee0
RDMA/sa_query: Use strscpy_pad instead of memcpy to copy a string2b7c5eed19
net: Prevent infinite while loop in skb_tx_hash()04121b10cd
cfg80211: correct bridge/4addr mode checkaed897e96b
net-sysfs: initialize uid and gid before calling net_ns_get_ownershipb0a2cd3855
net: batman-adv: fix error handling36e911a16b
regmap: Fix possible double-free in regcache_rbtree_exit()e51371bd68
reset: brcmstb-rescal: fix incorrect polarity of status bit2cf7d935d6
arm64: dts: allwinner: h5: NanoPI Neo 2: Fix ethernet node10e40fb2f5
RDMA/mlx5: Set user priority for DCT24fd8e2f02
octeontx2-af: Display all enabled PF VF rsrc_alloc entries.c63d7f2ca9
nvme-tcp: fix possible req->offset corruption32f3db20f1
nvme-tcp: fix data digest pointer calculation4286c72c53
nvmet-tcp: fix data digest pointer calculationd98883f6c3
IB/hfi1: Fix abba locking issue with sc_disable()c3e17e58f5
IB/qib: Protect from buffer overflow in struct qib_user_sdma_pkt fieldsee4908f909
bpf: Fix error usage of map_fd and fdget() in generic_map_update_batch()dd2260ec64
bpf: Fix potential race in tail call compatibility check15dec6d8f8
tcp_bpf: Fix one concurrency problem in the tcp_bpf_send_verdict functioncac6b043ce
riscv, bpf: Fix potential NULL dereference01599bf7cc
cgroup: Fix memory leak caused by missing cgroup_bpf_offlineeb3b6805e3
drm/amdgpu: fix out of bounds writec21b400221
drm/ttm: fix memleak in ttm_transfered_destroy69a7fa5cb0
mm, thp: bail out early in collapse_file for writeback page8fb858b74a
net: lan78xx: fix division by zero in send path4c22227e39
cfg80211: fix management registrations lockingfa29cec42c
cfg80211: scan: fix RCU in cfg80211_add_nontrans_list()db1191a529
nvme-tcp: fix H2CData PDU send accounting (again)5043fbd294
ocfs2: fix race between searching chunks and release journal_head from buffer_head01169a4335
mmc: sdhci-esdhc-imx: clear the buffer_read_ready to reset standard tuning circuitee3213b117
mmc: sdhci: Map more voltage level to SDHCI_POWER_330a95a76fc01
mmc: dw_mmc: exynos: fix the finding clock sample value12a46f72f4
mmc: mediatek: Move cqhci init behind ungate clock44c2bc2a6b
mmc: cqhci: clear HALT state after CQE enableefe934629f
mmc: vub300: fix control-message timeoutsf3dec7e7ac
net/tls: Fix flipped sign in tls_err_abort() callsc828115a14
Revert "net: mdiobus: Fix memory leak in __mdiobus_register"11c0406b4c
nfc: port100: fix using -ERRNO as command type mask0b1b3e086b
tipc: fix size validations for the MSG_CRYPTO type5aa5bab579
ata: sata_mv: Fix the error handling of mv_chip_id()9a52798dce
pinctrl: amd: disable and mask interrupts on probe01c2881bb0
Revert "pinctrl: bcm: ns: support updated DT binding as syscon subnode"017718dfbb
usbnet: fix error return code in usbnet_probe()693ecbe8f7
usbnet: sanity check for maxpacketb663890d85
ext4: fix possible UAF when remounting r/o a mmp-protected file systemd4d9c06598
arm64: Avoid premature usercopy failuree184a21b5c
powerpc/bpf: Fix BPF_MOD when imm == 13f2c12ec8a
io_uring: don't take uring_lock during iowq cancel5a768b4d3e
ARM: 9141/1: only warn about XIP address when not compile testing15b278f94b
ARM: 9139/1: kprobes: fix arch_init_kprobes() prototypec06d7d9bfc
ARM: 9138/1: fix link warning with XIP + frame-pointer8a6af97c31
ARM: 9134/1: remove duplicate memcpy() definition6ad8bbc9d3
ARM: 9133/1: mm: proc-macros: ensure *_tlb_fns are 4B aligned3ceaa85c33
ARM: 9132/1: Fix __get_user_check failure with ARM KASAN images4944ec82eb
Merge 5.10.76 into android12-5.10-lts378e85d1ae
Linux 5.10.76cfa79faf7e
pinctrl: stm32: use valid pin identifier in stm32_pinctrl_resume()c56c801391
ARM: 9122/1: select HAVE_FUTEX_CMPXCHGd088db8637
selftests: bpf: fix backported ASSERT_FALSE3a845fa00f
e1000e: Separate TGP board type from SPT021b6d11e5
tracing: Have all levels of checks prevent recursion3a0dc2e35a
net: mdiobus: Fix memory leak in __mdiobus_registercfe9266213
bpf, test, cgroup: Use sk_{alloc,free} for test cases188907c252
s390/pci: fix zpci_zdev_put() on reservef18b90e936
can: isotp: isotp_sendmsg(): fix TX buffer concurrent access in isotp_sendmsg()2304dfb548
scsi: core: Fix shost->cmd_per_lun calculation in scsi_add_host_with_dma()c58654f344
net: hns3: fix for miscalculation of rx unused desc96fe506129
sched/scs: Reset the shadow stack when idle_task_exit96f0aebf29
scsi: qla2xxx: Fix a memory leak in an error path of qla2x00_process_els()90c8e8c082
scsi: iscsi: Fix set_param() handling0eb2544796
Input: snvs_pwrkey - add clk handlingea9c1f5d8a
perf/x86/msr: Add Sapphire Rapids CPU support7a5a1f09c8
libperf tests: Fix test_stat_cpue56a3e7ae3
ALSA: hda: avoid write to STATESTS if controller is in reset85c8d8c160
platform/x86: intel_scu_ipc: Update timeout value in comment9f591cbdbe
isdn: mISDN: Fix sleeping function called from invalid contextab4f542b51
ARM: dts: spear3xx: Fix gmac node15d3ad7988
net: stmmac: add support for dwmac 3.40af9d16a4284
btrfs: deal with errors when checking if a dir entry exists during log replay369db2a91d
ALSA: hda: intel: Allow repeatedly probing on codec configuration errors81d8e70cdc
gcc-plugins/structleak: add makefile var for disabling structleak69078a9436
net: hns3: fix the max tx size according to user manualf40c2281d2
drm: mxsfb: Fix NULL pointer dereference crash on unload96835b68d7
net: bridge: mcast: use multicast_membership_interval for IGMPv30e033cb407
selftests: netfilter: remove stray bash debug linef8a6541345
netfilter: Kconfig: use 'default y' instead of 'm' for bool config option7f221ccbee
isdn: cpai: check ctr->cnr to avoid array index out of bound77c0ef979e
nfc: nci: fix the UAF of rf_conn_info object8f042315fc
KVM: nVMX: promptly process interrupts delivered while in guest modeb41fd8f5d2
mm, slub: fix incorrect memcg slab count for bulk free568f906340
mm, slub: fix potential memoryleak in kmem_cache_open()48843dd23c
mm, slub: fix mismatch between reconstructed freelist depth and cntc5c2a80368
powerpc/idle: Don't corrupt back chain when going idle197ec50b2d
KVM: PPC: Book3S HV: Make idle_kvm_start_guest() return 0 if it went to guestfbd724c49b
KVM: PPC: Book3S HV: Fix stack handling in idle_kvm_start_guest()9258f58432
powerpc64/idle: Fix SP offsets when saving GPRs3e16d9d525
net: dsa: mt7530: correct ds->num_ports16802fa4c3
audit: fix possible null-pointer dereference in audit_filter_rules0d867a3599
ASoC: DAPM: Fix missing kctl change notificationsa2606acf41
ALSA: hda/realtek: Add quirk for Clevo PC50HS6411397b6d
ALSA: usb-audio: Provide quirk for Sennheiser GSP670 Headsetb721500c97
vfs: check fd has read access in kernel_read_file_from_fd()895ceeff31
elfcore: correct reference to CONFIG_UML3cda4bfffd
userfaultfd: fix a race between writeprotect and exit_mmap()93be0eeea1
ocfs2: mount fails with buffer overflow in strlenf1b98569e8
ocfs2: fix data corruption after conversion from inline format1727e8688d
ceph: fix handling of "meta" errors603d4bcc0f
ceph: skip existing superblocks that are blocklisted or shut down when mountingd48db508f9
can: j1939: j1939_xtp_rx_rts_session_new(): abort TP less than 9 bytes5abc9b9d3c
can: j1939: j1939_xtp_rx_dat_one(): cancel session if receive TP.DT with error length864e77771a
can: j1939: j1939_netdev_start(): fix UAF for rx_kref of j1939_privecfccb1c58
can: j1939: j1939_tp_rxtimer(): fix errant alert in j1939_tp_rxtimer053bc12df0
can: isotp: isotp_sendmsg(): add result check for wait_event_interruptible()0917fb0406
can: isotp: isotp_sendmsg(): fix return error on FC timeout on TX path28f28e4bc3
can: peak_pci: peak_pci_remove(): fix UAF9697ad6395
can: peak_usb: pcan_usb_fd_decode_status(): fix back to ERROR_ACTIVE state notification4758e92e75
can: rcar_can: fix suspend/resume4a0928c3eb
net: enetc: fix ethtool counter name for PM0_TERR00ad7a0154
drm/panel: ilitek-ili9881c: Fix sync for Feixin K101-IM2BYL02 paneleccd00728b
ice: Add missing E810 device ids6418508a3a
e1000e: Fix packet loss on Tiger Lake and later29f1bdcaa3
net: stmmac: Fix E2E delay mechanismd36b15e3e7
net: hns3: disable sriov before unload hclge layer6a72e1d78a
net: hns3: fix vf reset workqueue cannot exit32b860d364
net: hns3: schedule the polling again when allocation fails96c013f40c
net: hns3: add limit ets dwrr bandwidth cannot be 021f61d1043
net: hns3: reset DWRR of unused tc to zero53770a4115
powerpc/smp: do not decrement idle task preempt count in CPU offline81dbd898fb
NIOS2: irqflags: rename a redefined register name6edf99b000
net: dsa: lantiq_gswip: fix register definitionef97219d5f
ipv6: When forwarding count rx stats on the orig netdev38d984e5e8
tcp: md5: Fix overlap between vrf and non-vrf keysc28bea6b87
lan78xx: select CRC329c8943812d
netfilter: ipvs: make global sysctl readonly in non-init netns911e01990c
netfilter: ip6t_rt: fix rt0_hdr parsing in rt_mt669ea08c1b5
ice: fix getting UDP tunnel entry842fce4319
ASoC: wm8960: Fix clock configuration on slave mode39afed394c
dma-debug: fix sg checks in debug_dma_map_sg()2a670c3230
netfilter: xt_IDLETIMER: fix panic that occurs when timer_type has garbage value0f4308a164
NFSD: Keep existing listeners on portlist error546c04c857
xtensa: xtfpga: Try software restart before simulating CPU resetbfef5d8262
xtensa: xtfpga: use CONFIG_USE_OF instead of CONFIG_OFd8284c981c
drm/amdgpu/display: fix dependencies for DRM_AMD_DC_SI101e1bcb11
xen/x86: prevent PVH type from getting clobbereda6285b1b22
block: decode QUEUE_FLAG_HCTX_ACTIVE in debugfs output85c1827eee
ARM: dts: at91: sama5d2_som1_ek: disable ISC node by default5489c1bed5
arm: dts: vexpress-v2p-ca9: Fix the SMB unit-addressf59da9f7ef
io_uring: fix splice_fd_in checks backport typob6f32897af
xhci: add quirk for host controllers that don't update endpoint DCSb3b7f831a4
parisc: math-emu: Fix fall-through warnings234d53d2bb
Merge branch 'android12-5.10' into `android12-5.10-lts`221975092a
Merge 5.10.75 into android12-5.10-lts3a9842b42e
Linux 5.10.753e28736521
net: dsa: mv88e6xxx: don't use PHY_DETECT on internal PHY's3593fa147c
ionic: don't remove netdev->dev_addr when syncing uc listf33890d9bb
net: mscc: ocelot: warn when a PTP IRQ is raised for an unknown skb9c546af181
nfp: flow_offload: move flow_indr_dev_register from app init to app start6da9af2d25
r8152: select CRC32 and CRYPTO/CRYPTO_HASH/CRYPTO_SHA256ecfd4fa15b
qed: Fix missing error code in qed_slowpath_start()51f6e72ca6
mqprio: Correct stats in mqprio_dump_class_stats().fdaff7f9e8
platform/x86: intel_scu_ipc: Fix busy loop expiry time057ee6843b
acpi/arm64: fix next_platform_timer() section mismatch errorc6b2400095
drm/msm/dsi: fix off by one in dsi_bus_clk_enable error handling2c56587174
drm/msm/dsi: Fix an error code in msm_dsi_modeset_init()b28586fb04
drm/msm/a6xx: Track current ctx by seqnoabd1186415
drm/msm/mdp5: fix cursor-related warnings91a340768b
drm/msm: Fix null pointer dereference on pointer edpa7b45024f6
drm/edid: In connector_bad_edid() cap num_of_ext by num_blocks readd0f0e17103
drm/panel: olimex-lcd-olinuxino: select CRC32a4a37e6516
spi: bcm-qspi: clear MSPI spifie interrupt during probed9428f08e1
platform/mellanox: mlxreg-io: Fix read access of n-bytes size attributesc216cebdd2
platform/mellanox: mlxreg-io: Fix argument base in kstrtou32() calle59d839743
mlxsw: thermal: Fix out-of-bounds memory accesses7eef482db7
ata: ahci_platform: fix null-ptr-deref in ahci_platform_enable_regulators()116932c0e4
pata_legacy: fix a couple uninitialized variable bugs50cb95487c
NFC: digital: fix possible memory leak in digital_in_send_sdd_req()3f2960b39f
NFC: digital: fix possible memory leak in digital_tg_listen_mdaa()2f21f06a5e
nfc: fix error handling of nfc_proto_register()ba39f55952
vhost-vdpa: Fix the wrong input in config_cb84e0f2fc66
ethernet: s2io: fix setting mac address during resumee19c10d6e0
net: encx24j600: check error in devm_regmap_init_encx24j600f2e1de0750
net: dsa: microchip: Added the condition for scheduling ksz_mib_read_work9053c5b459
net: stmmac: fix get_hw_feature() on old hardware12da46cb6a
net/mlx5e: Mutually exclude RX-FCS and RX-port-timestamp4f7bddf8c5
net/mlx5e: Fix memory leak in mlx5_core_destroy_cq() error pathafb0c67dfd
net: korina: select CRC3233ca850105
net: arc: select CRC3217a027aafd
gpio: pca953x: Improve bias settingd84a69ac41
sctp: account stream padding length for reconf chunk6fecdb5b54
nvme-pci: Fix abort command id2d937cc12c
ARM: dts: bcm2711-rpi-4-b: Fix pcie0's unit address formatting6e6082250b
ARM: dts: bcm2711-rpi-4-b: fix sd_io_1v8_reg regulator states48613e687e
ARM: dts: bcm2711: fix MDIO #address- and #size-cells6e6e3018d3
ARM: dts: bcm2711-rpi-4-b: Fix usb's unit address76644f9459
tee: optee: Fix missing devices unregister during optee_remove07f8856824
iio: dac: ti-dac5571: fix an error code in probe()6c0024bcaa
iio: ssp_sensors: fix error code in ssp_print_mcu_debug()0fbc3cf7dd
iio: ssp_sensors: add more range checking in ssp_parse_dataframe()abe5b13dd9
iio: adc: max1027: Fix the number of max1X31 channels41e84a4f25
iio: light: opt3001: Fixed timeout error when 0 luxe811506f60
iio: mtk-auxadc: fix case IIO_CHAN_INFO_PROCESSED1671cfd31b
iio: adc: max1027: Fix wrong shift with 12-bit devicesf931076d32
iio: adc128s052: Fix the error handling path of 'adc128_probe()'4425d059aa
iio: adc: ad7793: Fix IRQ flagd078043a17
iio: adc: ad7780: Fix IRQ flaga8177f0576
iio: adc: ad7192: Add IRQ flagbe8ef91d61
driver core: Reject pointless SYNC_STATE_ONLY device linksd5f13bbb51
drivers: bus: simple-pm-bus: Add support for probing simple bus only devicesb45923f66e
iio: adc: aspeed: set driver data when adc probe.ea947267eb
powerpc/xive: Discard disabled interrupts in get_irqchip_state()9e46bdfb55
x86/Kconfig: Do not enable AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT automatically57e4888640
nvmem: Fix shift-out-of-bound (UBSAN) with byte size cellsa7bd0dd3f2
EDAC/armada-xp: Fix output of uncorrectable error counter92e6e08ca2
virtio: write back F_VERSION_1 before validate86e3ad8b75
misc: fastrpc: Add missing lock before accessing find_vma()3f0ca245a8
USB: serial: option: add prod. id for Quectel EG91ecad614b0c
USB: serial: option: add Telit LE910Cx composition 0x1204bf26bc72dc
USB: serial: option: add Quectel EC200S-CN module supportd4b77900cf
USB: serial: qcserial: add EM9191 QDL support3147f57215
Input: xpad - add support for another USB ID of Nacon GC-1009d89e28711
usb: musb: dsps: Fix the probe error path3b42751401
efi: Change down_interruptible() in virt_efi_reset_system() to down_trylock()5100dc4489
efi/cper: use stack buffer for error record decoding2c5dd2a8af
cb710: avoid NULL pointer subtractiond40e193abd
xhci: Enable trust tx length quirk for Fresco FL11 USB controllerdec944bb70
xhci: Fix command ring pointer corruption while aborting a commanddc3e0a20db
xhci: guard accesses to ep_state in xhci_endpoint_reset()0ee66290f0
USB: xhci: dbc: fix tty registration race9f0d6c781c
mei: me: add Ice Lake-N device id.e4f7171c23
x86/resctrl: Free the ctrlval arrays when domain_setup_mon_state() fails0e32a2b85c
btrfs: fix abort logic in btrfs_replace_file_extents52924879ed
btrfs: update refs for any root except tree log roots352349aa49
btrfs: check for error when looking up inode during dir entry replay4ed68471bc
btrfs: deal with errors when adding inode reference during log replay95d3aba5fe
btrfs: deal with errors when replaying dir entry during log replay206868a5b6
btrfs: unlock newly allocated extent buffer after errore7e3ed5c92
drm/msm: Avoid potential overflow in timeout_to_jiffies()a31c33aa80
arm64/hugetlb: fix CMA gigantic page order for non-4K PAGE_SIZE0c97008859
csky: Fixup regs.sr broken in ptrace5dab6e8f14
csky: don't let sigreturn play with priveleged bits of status registere3c37135c9
clk: socfpga: agilex: fix duplicate s2f_user0_clkfaba7916cd
s390: fix strrchr() implementation7ef43c0f68
nds32/ftrace: Fix Error: invalid operands (*UND* and *UND* sections) for `^'c3bf276fd7
ALSA: hda/realtek: Fix the mic type detection issue for ASUS G551JW1099953b32
ALSA: hda/realtek: Fix for quirk to enable speaker output on the Lenovo 13s Gen2554a5027f5
ALSA: hda/realtek: Add quirk for TongFang PHxTxX10fa256509b
ALSA: hda/realtek - ALC236 headset MIC recording issue1e10c6bf15
ALSA: hda/realtek: Add quirk for Clevo X170KM-G8a5f01f4b0
ALSA: hda/realtek: Complete partial device name to avoid ambiguityc6e5290e6c
ALSA: hda - Enable headphone mic on Dell Latitude laptops with ALC32549bb1659ac5
ALSA: hda/realtek: Enable 4-speaker output for Dell Precision 5560 laptop7680631ac7
ALSA: seq: Fix a potential UAF by wrong private_free call order4aab156d30
ALSA: pcm: Workaround for a wrong offset in SYNC_PTR compat ioctlf077d699c1
ALSA: usb-audio: Add quirk for VF0770a336e746e3
Merge 5.10.74 into android12-5.10-lts77434fe5a0
Linux 5.10.7442b49f012b
hwmon: (pmbus/ibm-cffps) max_power_out swap changesbb893f0754
sched: Always inline is_percpu_thread()bdae2a0834
perf/core: fix userpage->time_enabled of inactive events57c7ca3d55
scsi: virtio_scsi: Fix spelling mistake "Unsupport" -> "Unsupported"d993d1e1c4
scsi: ses: Fix unsigned comparison with less than zero621ddffb70
drm/amdgpu: fix gart.bo pin_count leaka5ba615fbe
net: sun: SUNVNET_COMMON should depend on INETdb868b4532
vboxfs: fix broken legacy mount signature checking42c871d38e
mac80211: check return value of rhashtable_initbda06aff03
net: prevent user from passing illegal stab size3d68c7b0ab
hwmon: (ltc2947) Properly handle errors when looking for the external clock194e8a4f0a
m68k: Handle arrivals of multiple signals correctly977aee5814
mac80211: Drop frames from invalid MAC address in ad-hoc mode9ec9a975ea
netfilter: nf_nat_masquerade: defer conntrack walk to work queue5182d6db80
netfilter: nf_nat_masquerade: make async masq_inet6_event handling genericbcb647c1e1
ASoC: SOF: loader: release_firmware() on load failure to avoid batchingf6952b1e22
HID: wacom: Add new Intuos BT (CTL-4100WL/CTL-6100WL) device IDsddc4ba737b
netfilter: ip6_tables: zero-initialize fragment offsetddf026d6ae
HID: apple: Fix logical maximum and usage maximum of Magic Keyboard JIS0bcfa99e8f
ASoC: Intel: sof_sdw: tag SoundWire BEs as non-atomic14cbfeeee4
ext4: correct the error path of ext4_write_inline_data_end()d7a15e1e4f
ext4: check and update i_disksize properly87b4a70303
Merge branch 'android12-5.10' into `android12-5.10-lts`4b3fd2a81e
Merge 5.10.73 into android12-5.10-lts0268aa579b
Linux 5.10.73825c00c2ee
x86/hpet: Use another crystalball to evaluate HPET usabilityf2447f6587
x86/entry: Clear X86_FEATURE_SMAP when CONFIG_X86_SMAP=n6bfe1f6fc8
x86/entry: Correct reference to intended CONFIG_64_BIT5d637bc6f9
x86/sev: Return an error on a returned non-zero SW_EXITINFO1[31:0]df121cf550
x86/Kconfig: Correct reference to MWINCHIP3Dd7c36115fb
x86/platform/olpc: Correct ifdef symbol to intended CONFIG_OLPC_XO15_SCIf73ca4961d
pseries/eeh: Fix the kdump kernel crash during eeh_pseries_init411b38fe68
powerpc/64s: fix program check interrupt emergency stack path18a2a2cafc
powerpc/bpf: Fix BPF_SUB when imm == 0x80000000a4037dded5
RISC-V: Include clone3() on rv3229fdb11ca8
bpf, s390: Fix potential memory leak about jit_data2c152d9da8
riscv/vdso: make arch_setup_additional_pages wait for mmap_sem for write killablede834e12b9
i2c: mediatek: Add OFFSET_EXT_CONF setting backf86de018fd
i2c: acpi: fix resource leak in reconfiguration device addition87990a60b4
powerpc/iommu: Report the correct most efficient DMA mask for PCI devices985cca1ad1
net: prefer socket bound to interface when not in VRF97aeed72af
i40e: Fix freeing of uninitialized misc IRQ vector2dc768a98c
i40e: fix endless loop under rtnld3a07ca78a
gve: report 64bit tx_bytes counter from gve_handle_report_stats()35f6ddd934
gve: fix gve_get_stats()9a04302252
rtnetlink: fix if_nlmsg_stats_size() under estimation72c2a68f1d
gve: Avoid freeing NULL pointer5d903a694b
gve: Correct available tx qpl checkf69556a420
drm/nouveau/debugfs: fix file release memory leak65fff0a8ef
drm/nouveau/kms/nv50-: fix file release memory leakf86e19d918
drm/nouveau: avoid a use-after-free when BO init fails008224cdc1
video: fbdev: gbefb: Only instantiate device when built for IP32d2ccbaaa66
drm/sun4i: dw-hdmi: Fix HDMI PHY clock setup18d2568cc7
bus: ti-sysc: Use CLKDM_NOAUTO for dra7 dcan1 for errata i89340a84fcae2
perf jevents: Tidy error handling628b31d967
netlink: annotate data races around nlk->bound144715fbab
net: sfp: Fix typo in state machine debug string3ec73ffeef
net/sched: sch_taprio: properly cancel timer from taprio_destroy()60955b65bd
net: bridge: fix under estimation in br_get_linkxstats_size()c480d15190
net: bridge: use nla_total_size_64bit() in br_get_linkxstats_size()cb8880680b
ARM: imx6: disable the GIC CPU interface before calling stby-poweroff sequence2b0035d105
dt-bindings: drm/bridge: ti-sn65dsi86: Fix reg value10afd15972
arm64: dts: ls1028a: add missing CAN nodes95ba03fb4c
ptp_pch: Load module automatically if ID matches442ea65d0c
powerpc/fsl/dts: Fix phy-connection-type for fm1mac3acff2d182c
net_sched: fix NULL deref in fifo_set_limit()0d2dd40a7b
phy: mdio: fix memory leak6e6f79e398
net/mlx5: E-Switch, Fix double allocation of acl flow counterd70cb6c77a
net/mlx5e: IPSEC RX, enable checksum complete064faa8e8a
bpf: Fix integer overflow in prealloc_elems_and_freelist()d5f4b27c3c
soc: ti: omap-prm: Fix external abort for am335x pruss1d8f4447e8
bpf, arm: Fix register clobbering in div/mod implementation29a19eaeb2
iwlwifi: pcie: add configuration of a Wi-Fi adapter on Dell XPS 156b0132f730
xtensa: call irqchip_init only when CONFIG_USE_OF is selected3d288ed983
xtensa: use CONFIG_USE_OF instead of CONFIG_OF997bec509a
arm64: dts: qcom: pm8150: use qcom,pm8998-pon bindingfbca14abc1
ath5k: fix building with LEDS=m8aef3824e9
PCI: hv: Fix sleep while in non-sleep context when removing child devices from the busd9b838ae39
ARM: dts: imx6qdl-pico: Fix Ethernet support9e99ad4194
ARM: dts: imx: Fix USB host power regulator polarity on M53Menlo2ba34cf0c1
ARM: dts: imx: Add missing pinctrl-names for panel on M53Menlo8f977e97b2
soc: qcom: mdt_loader: Drop PT_LOAD check on hash segment14f52004bd
ARM: at91: pm: do not panic if ram controllers are not enabledd89a313a57
ARM: dts: qcom: apq8064: Use 27MHz PXO clock as DSI PLL reference25ac88e601
soc: qcom: socinfo: Fixed argument passed to platform_set_data()ab8073794b
bus: ti-sysc: Add break in switch statement in sysc_init_soc()427faa29e0
riscv: Flush current cpu icache before other cpus05287407de
ARM: dts: qcom: apq8064: use compatible which contains chipidac06fe40e8
ARM: dts: imx6dl-yapp4: Fix lp5562 LED driver probe71d3ce62ac
ARM: dts: omap3430-sdp: Fix NAND device nodef9a855d1bc
xen/balloon: fix cancelled balloon action9aac782ab0
SUNRPC: fix sign error causing rpcsec_gss drops8f174a208c
nfsd4: Handle the NFSv4 READDIR 'dircount' hint being zero12d4b17902
nfsd: fix error handling of register_pernet_subsys() in init_nfsd()1bc2f315a2
ovl: fix IOCB_DIRECT if underlying fs doesn't support direct IO9763ffd4da
ovl: fix missing negative dentry check in ovl_rename()1500f0c836
mmc: sdhci-of-at91: replace while loop with read_poll_timeout3a0feae5f6
mmc: sdhci-of-at91: wait for calibration done before proceede5cb3680b9
mmc: meson-gx: do not use memcpy_to/fromio for dram-access-quirk13d17cc717
xen/privcmd: fix error handling in mmap-resource processingde1e8bd36a
drm/nouveau/kms/tu102-: delay enabling cursor until after assign_windows1d4e9f27d2
usb: typec: tcpm: handle SRC_STARTUP state if cc changesfeb3fe702a
USB: cdc-acm: fix break reportingfc8b3e838b
USB: cdc-acm: fix racy tty buffer accessesb3265b88e8
usb: chipidea: ci_hdrc_imx: Also search for 'phys' phandle16d728110b
Partially revert "usb: Kconfig: using select for USB_COMMON dependency"56596148ae
ANDROID: Different fix for KABI breakage in 5.10.71 in struct sock79f3d20a45
ANDROID: ABI: update .xml file with new symbols to track3cce4e4a1b
Merge branch 'android12-5.10' into `android12-5.10-lts`d306ef529c
Merge 5.10.72 into android12-5.10-lts5aa003b381
Linux 5.10.72387aecdab7
libata: Add ATA_HORKAGE_NO_NCQ_ON_ATI for Samsung 860 and 870 SSD.02bf504bc3
perf/x86: Reset destroy callback on event init failureb56475c29b
KVM: x86: nSVM: restore int_vector in svm_clear_vintrae34f26d4a
kvm: x86: Add AMD PMU MSRs to msrs_to_save_all[]6d0ff92059
KVM: do not shrink halt_poll_ns below grow_startb8add3f47a
selftests: KVM: Align SMCCC call with the spec in steal_time352b02562a
tools/vm/page-types: remove dependency on opt_file for idle page tracking84778fd66d
smb3: correct smb3 ACL security descriptora7be240d17
irqchip/gic: Work around broken Renesas integration8724a2a0e6
scsi: ses: Retry failed Send/Receive Diagnostic commands2e28f7dd37
thermal/drivers/tsens: Fix wrong check for tzd in irq handlers7a670cfb0f
nvme-fc: avoid race between time out and tear downc251d023ed
nvme-fc: update hardware queues before using themc4506403e1
selftests:kvm: fix get_warnings_count() ignoring fscanf() return warnbcc4b4de63
selftests: be sure to make khdr before other targets6a4aaf1d84
habanalabs/gaudi: fix LBW RR configuration2754fa3b73
usb: dwc2: check return value after calling platform_get_resource()ed6574d484
usb: testusb: Fix for showing the connection speed60df9f5556
scsi: sd: Free scsi_disk device via put_device()76c7063c74
ext2: fix sleeping in atomic bugs on errorb114f2d18e
sparc64: fix pci_iounmap() when CONFIG_PCI is not setfdfb3bc873
xen-netback: correct success/error reporting for the SKB-with-fraglist casea41938d072
net: mdio: introduce a shutdown method to mdio device drivers63c89930d4
btrfs: fix mount failure due to past and transient device flush error50628b06e6
btrfs: replace BUG_ON() in btrfs_csum_one_bio() with proper error handling83050cc239
nfsd: back channel stuck in SEQ4_STATUS_CB_PATH_DOWNf986cf2702
platform/x86: touchscreen_dmi: Update info for the Chuwi Hi10 Plus (CWI527) tablete561150324
platform/x86: touchscreen_dmi: Add info for the Chuwi HiBook (CWI514) tablet2ababcd8c2
spi: rockchip: handle zero length transfers without timing out627dc3c79c
ANDROID: Fix up KABI breakage in 5.10.71 in struct sockc23269dad5
Merge 5.10.71 into android12-5.10-lts5cd40b137c
Linux 5.10.7196f439a7ed
netfilter: nf_tables: Fix oversized kvmalloc() callse2d192301a
netfilter: conntrack: serialize hash resizes and cleanupsdeb2949417
KVM: x86: Handle SRCU initialization failure during page track initf7ac4d24e1
HID: usbhid: free raw_report buffers in usbhid_stop57a269a1b1
mm: don't allow oversized kvmalloc() callsda5b8b9319
netfilter: ipset: Fix oversized kvmalloc() callsdedfc35a2d
HID: betop: fix slab-out-of-bounds Write in betop_probe17ccc64e4f
crypto: ccp - fix resource leaks in ccp_run_aes_gcm_cmd()28f0fdbac0
usb: hso: remove the bailout parameter4ad4852b9a
ASoC: dapm: use component prefix when checking widget names5c3a90b6ff
net: udp: annotate data race around udp_sk(sk)->corkflaga7f4c633ae
HID: u2fzero: ignore incomplete packets without data3770e21f60
ext4: fix potential infinite loop in ext4_dx_readdir()a63474dbf6
ext4: add error checking to ext4_ext_replay_set_iblocks()9ccf35492b
ext4: fix reserved space counter leakagedc0942168a
ext4: limit the number of blocks in one ADD_RANGE TLVd11502fa26
ext4: fix loff_t overflow in ext4_max_bitmap_size()7cea848678
ipack: ipoctal: fix module reference leak843efca98e
ipack: ipoctal: fix missing allocation-failure check67d1df6610
ipack: ipoctal: fix tty-registration error handlingf46e5db92f
ipack: ipoctal: fix tty registration race5f6a309a69
ipack: ipoctal: fix stack information leak3bef1b7242
debugfs: debugfs_create_file_size(): use IS_ERR to check for error15fd3954bc
elf: don't use MAP_FIXED_NOREPLACE for elf interpreter mappings011b4de950
nvme: add command id quirk for apple controllers44c600a57d
hwmon: (pmbus/mp2975) Add missed POUT attribute for page 1 mp2975 controller7fc5f60a01
perf/x86/intel: Update event constraints for ICX3db53827a0
af_unix: fix races in sk_peer_pid and sk_peer_cred accessesd0d520c19e
net: sched: flower: protect fl_walk() with rcue63f6d8fe7
net: phy: bcm7xxx: Fixed indirect MMD operations071febc37e
net: hns3: fix always enable rx vlan filter problem after selftest85e4f5d28d
net: hns3: reconstruct function hns3_self_test8e89876c84
net: hns3: fix prototype warningd4a14faf79
net: hns3: fix show wrong state when add existing uc mac address64dae9551f
net: hns3: fix mixed flag HCLGE_FLAG_MQPRIO_ENABLE and HCLGE_FLAG_DCB_ENABLE8d3d27664e
net: hns3: keep MAC pause mode when multiple TCs are enabledf8ba689cb6
net: hns3: do not allow call hns3_nic_net_open repeatedly20f6c4a31a
ixgbe: Fix NULL pointer dereference in ixgbe_xdp_setup16138cf938
scsi: csiostor: Add module softdep on cxgb40306a2c7df
Revert "block, bfq: honor already-setup queue merges"1f2ca30fbd
net: ks8851: fix link errorf1dd6e10f0
selftests, bpf: test_lwt_ip_encap: Really disable rp_filter4967ae9ab4
selftests, bpf: Fix makefile dependencies on libbpf59efda5073
bpf: Exempt CAP_BPF from checks against bpf_jit_limitf908072391
RDMA/hns: Fix inaccurate prints7e3eda32b8
e100: fix buffer overrun in e100_get_regsf2edf80cdd
e100: fix length calculation in e100_get_regs_lenc20a0ad7b6
dsa: mv88e6xxx: Include tagger overhead when setting MTU for DSA and CPU ports7b771b1222
dsa: mv88e6xxx: Fix MTU definitionee4d0495a6
dsa: mv88e6xxx: 6161: Use chip wide MAX MTUd35d95e8b9
drm/i915/request: fix early tracepoints8321738c6e
smsc95xx: fix stalled rx after link change8de12ad916
net: ipv4: Fix rtnexthop len when RTA_FLOW is presentb22c5e2c8e
net: enetc: fix the incorrect clearing of IF_MODE bits5ee40530b0
hwmon: (tmp421) fix rounding for negative values89d96f147d
hwmon: (tmp421) report /PVLD condition as fault560271d09f
mptcp: don't return sockets in foreign netns9c6591ae8e
sctp: break out if skb_header_pointer returns NULL in sctp_rcv_ootb2c204cf594
mac80211-hwsim: fix late beacon hrtimer handling8576e72ac5
mac80211: mesh: fix potentially unaligned access1282bb0083
mac80211: limit injected vht mcs/nss in ieee80211_parse_tx_radiotap3748871e12
mac80211: Fix ieee80211_amsdu_aggregate frag_tail bug76bbb482d3
hwmon: (mlxreg-fan) Return non-zero value when fan current state is enforced from sysfsc61736a994
bpf, mips: Validate conditional branch offsets3f4e68902d
RDMA/cma: Fix listener leak in rdma_cma_listen_on_all() failure62ba3c5010
IB/cma: Do not send IGMP leaves for sendonly Multicast groupsd93f65586c
bpf: Handle return value of BPF_PROG_TYPE_STRUCT_OPS prog12cbdaeeb5
ipvs: check that ip_vs_conn_tab_bits is between 8 and 209f382e1edf
drm/amdgpu: correct initial cp_hqd_quantum for gfx9c331fad63b
drm/amd/display: Pass PCI deviceid into DC0a16c9751e
RDMA/cma: Do not change route.addr.src_addr.ss_family31a13f039e
media: ir_toy: prevent device from hanging during transmit249e5e5a50
KVM: rseq: Update rseq when processing NOTIFY_RESUME on xfer to KVM guest3778511dfc
KVM: nVMX: Filter out all unsupported controls when eVMCS was activated4ed671e6bc
KVM: x86: nSVM: don't copy virt_ext from vmcb12bebabb76ad
KVM: x86: Fix stack-out-of-bounds memory access from ioapic_write_indirect()782122ae7d
x86/kvmclock: Move this_cpu_pvti into kvmclock.h57de2dcb18
mac80211: fix use-after-free in CCMP/GCMP RX201ba843fe
scsi: ufs: Fix illegal offset in UPIU event tracebd4e446a69
gpio: pca953x: do not ignore i2c errors516d905503
hwmon: (w83791d) Fix NULL pointer dereference by removing unnecessary structure field1499bb2c3a
hwmon: (w83792d) Fix NULL pointer dereference by removing unnecessary structure field7c4fd5de39
hwmon: (w83793) Fix NULL pointer dereference by removing unnecessary structure field196dabd96b
hwmon: (tmp421) handle I2C errors23a6dfa10f
fs-verity: fix signed integer overflow with i_size near S64_MAXd1d0016e4a
ACPI: NFIT: Use fallback node id when numa info in NFIT table is incorrecte9edc7bc61
ALSA: hda/realtek: Quirks to enable speaker output for Lenovo Legion 7i 15IMHG05, Yoga 7i 14ITL5/15ITL5, and 13s Gen2 laptops.23115ca7d2
usb: cdns3: fix race condition before setting doorbell3945c48136
cpufreq: schedutil: Destroy mutex before kobject_put() frees the memory2193cf76f4
scsi: qla2xxx: Changes to support kdump kernel for NVMe BFSa7d4fc8440
cpufreq: schedutil: Use kobject release() method to free sugov_tunablesd570c48dd3
tty: Fix out-of-bound vmalloc access in imageblit87b6b38b53
ANDROID: GKI: update .xml file with new symbols to track7d8687d4ef
Merge branch 'android12-5.10' into `android12-5.10-lts`dcf0824c26
Revert "treewide: Change list_sort to use const pointers"d69751309b
Merge 5.10.70 into android12-5.10-lts33740c9227
Merge 5.10.69 into android12-5.10-ltsbeafee90ec
Merge 5.10.68 into android12-5.10-lts91607afb55
Revert "crypto: public_key: fix overflow during implicit conversion"0dae5f42c0
Revert "drm/vmwgfx: fix potential UAF in vmwgfx_surface.c"5b4909f961
Revert "drm: serialize drm_file.master with a new spinlock"49faae8510
Revert "drm: protect drm_master pointers in drm_lease.c"08ed4cb090
Merge 5.10.67 into android12-5.10-ltsf93026b28e
Linux 5.10.705909429605
qnx4: work around gcc false positive warning bug35c0dfbbd3
xen/balloon: fix balloon kthread freezing8373d58c89
USB: serial: cp210x: fix dropped characters with CP210267cdb51ab5
thermal/drivers/int340x: Do not set a wrong tcc offset on resumecc71740ee4
EDAC/dmc520: Assign the proper type to dimm->edac_mode9afad85a43
EDAC/synopsys: Fix wrong value type assignment for edac_modedb76cb05c0
spi: Fix tegra20 build with CONFIG_PM=n890e25c424
net: 6pack: Fix tx timeout and slot time044513c1fa
alpha: Declare virt_to_phys and virt_to_bus parameter as pointer to volatile0a511ba6d2
arm64: Mark __stack_chk_guard as __ro_after_initfec3bd622d
parisc: Use absolute_pointer() to define PAGE061454e7fd6
qnx4: avoid stringop-overread errors5520d27f02
sparc: avoid stringop-overread errors8d768beaf0
net: i825xx: Use absolute_pointer for memcpy from fixed memory locatione99f903271
compiler.h: Introduce absolute_pointer macrof58d305887
blk-cgroup: fix UAF by grabbing blkcg lock before destroying blkg pd1ef68b84bc
block: flush the integrity workqueue in blk_integrity_unregister1963bdb748
block: check if a profile is actually registered in blk_integrity_unregister526261c1b7
amd/display: downgrade validation failure log level54a4860c62
sparc32: page align size in arch_dma_allocecf0dc5a90
nvme-rdma: destroy cm id before destroy qp to avoid use after free2a08960577
nvme-multipath: fix ANA state updates when a namespace is not present372d3e6ea1
xen/balloon: use a kernel thread instead a workqueue6345a0bee8
bpf: Add oversize check before call kvcalloc()e567d33508
cpufreq: intel_pstate: Override parameters if HWP forced by BIOS9561bb9887
ipv6: delay fib6_sernum increase in fib6_add31df1d037c
m68k: Double cast io functions to unsigned longcc3dd119d3
blk-mq: avoid to iterate over stale requestde7e030033
net: stmmac: allow CSR clock of 300MHz7721221e87
net: macb: fix use after free on rmmoda632288053
net: phylink: Update SFP selected interface on advertising changes3815fe7371
blktrace: Fix uaf in blk_trace access after removing by sysfsce092350b4
io_uring: put provided buffer meta data under memcg accounting7040b37a96
x86/asm: Fix SETZ size enqcmds() build failure54e85b6c28
x86/asm: Add a missing __iomem annotation in enqcmds()b18ba3f477
md: fix a lock order reversal in md_alloc568662e37f
irqchip/gic-v3-its: Fix potential VPE leak on erroraf7c9ffe2b
irqchip/goldfish-pic: Select GENERIC_IRQ_CHIP to fix build0595fc4794
scsi: lpfc: Use correct scnprintf() limitcb948b158a
scsi: qla2xxx: Restore initiator in dual mode3d42ed6b79
cifs: fix a sign extension bug8cba4c2698
thermal/core: Potential buffer overflow in thermal_build_list_of_policies()215df43499
nvme: keep ctrl->namespaces ordered55e6f8b3c0
treewide: Change list_sort to use const pointers419fab1cb0
nvme-tcp: fix incorrect h2cdata pdu offset accountingc6ecdcba9d
fpga: machxo2-spi: Fix missing error code in machxo2_write_complete()5c6bfde245
fpga: machxo2-spi: Return an error on failure4ea4925c70
tty: synclink_gt: rename a conflicting function name56a8f0b18f
tty: synclink_gt, drop unneeded forward declarationsc64e6c307a
scsi: target: Fix the pgr/alua_support_store functions2d03054251
scsi: iscsi: Adjust iface sysfs attr detection0032f8b3cf
atlantic: Fix issue in the pm resume flow.c2598bce41
net/mlx4_en: Don't allow aRFS for encapsulated packetsb4e54f5f42
qed: rdma - don't wait for resources under hw error recovery flow1bba406c07
gpio: uniphier: Fix void functions to remove return valuedb94f89e1d
s390/qeth: fix NULL deref in qeth_clear_working_pool_list()3aa50241e1
kselftest/arm64: signal: Skip tests if required features are missing91d4da33c3
kselftest/arm64: signal: Add SVE to the set of features we can check for2eaa39d83e
net: dsa: realtek: register the MDIO bus under devres43c880b860
net: dsa: don't allocate the slave_mii_bus using devresb4561bd29e
net/smc: fix 'workqueue leaked lock' in smc_conn_abort_work8a00c832ef
net/smc: add missing error check in smc_clc_prfx_set()4e0fd1d795
net: hns3: check queue id range before usingca435999bc
net: hns3: fix change RSS 'hfunc' ineffective issue1365a0dc55
bnxt_en: Fix TX timeout when TX ring size is set to the smallestd5afe3cf52
enetc: Fix uninitialized struct dim_sample field usage6c3f1b741c
enetc: Fix illegal access when reading affinity_hint117661cb9d
platform/x86/intel: punit_ipc: Drop wrong use of ACPI_PTR()22538c1bde
afs: Fix updating of i_blocks on file/dir extension55352944b4
afs: Fix incorrect triggering of sillyrename on 3rd-party invalidation8d6a21e4cd
comedi: Fix memory leak in compat_insnlist()43241a6c6e
net: hso: fix muxed tty registration68d4fbe622
drm/amd/pm: Update intermediate power state for SI7dc9225fcd
scsi: sd_zbc: Ensure buffer size is aligned to SECTOR_SIZE3dfffcd260
serial: mvebu-uart: fix driver's tx_empty callback640946fc56
serial: 8250: 8250_omap: Fix RX_LVL register offset0ea9ac731a
xhci: Set HCD flag to defer primary roothub registration80af86c122
btrfs: prevent __btrfs_dump_space_info() to underflow its free space8326be9e51
erofs: fix up erofs_lookup tracepoint91e4ad05bf
mcb: fix error handling in mcb_alloc_bus()2c28bb016b
USB: serial: option: add device id for Foxconn T99W265600b19610a
USB: serial: option: remove duplicate USB device ID0daf57973f
USB: serial: option: add Telit LN920 compositionsdc131d3f13
USB: serial: mos7840: remove duplicated 0xac24 device IDd58fc9e9c1
usb: core: hcd: Add support for deferring roothub registration996f7c4a1f
usb: dwc3: core: balance phy init and exita05ff80001
Re-enable UAS for LaCie Rugged USB3-FW with fk quirkb9e697e60c
staging: greybus: uart: fix tty use after freed5b0473707
binder: make sure fd closes complete302e60e26a
Revert "USB: bcma: Add a check for devm_gpiod_get"b33b3db476
USB: cdc-acm: fix minor-number release0809b8576f
USB: serial: cp210x: add ID for GW Instek GDM-834x Digital Multimetera34d6ef0c7
usb-storage: Add quirk for ScanLogic SL11R-IDE older than 2.6cf792828491
xen/x86: fix PV trap handling on secondary processors93028da5e9
cifs: fix incorrect check for null pointer in header_assemble5940e22528
usb: musb: tusb6010: uninitialized data in tusb_fifo_write_unaligned()d071c7fd45
usb: dwc2: gadget: Fix ISOC transfer complete handling for DDMA5f4bfac261
usb: dwc2: gadget: Fix ISOC flow for BDMA and Slave1fbd7eb385
usb: gadget: r8a66597: fix a loop in set_feature()838297222b
mm: fix uninitialized use in overcommit_policy_handler437be4d6fa
ocfs2: drop acl cache for directories too31bd6cd06a
PCI: aardvark: Increase polling delay to 1.5s while waiting for PIO response0f8a659a24
ANDROID: GKI: update the .xml file after modifying the ANDROID_KABI_USE() macro119f513123
ANDROID: GKI: rework the ANDROID_KABI_USE() macro to not use __UNIQUE()f04036b092
ANDROID: GKI: update .xml file to handle previous issues5f4196eaa9
Linux 5.10.697c09505e9e
drm/nouveau/nvkm: Replace -ENOSYS with -ENODEV83a3cb200e
sched/idle: Make the idle timer expire in hard interrupt context647c19bc61
rtc: rx8010: select REGMAP_I2C9a14014df7
blk-mq: allow 4x BLK_MAX_REQUEST_COUNT at blk_plug for multiple_queues23dfb959c6
blk-throttle: fix UAF by deleteing timer in blk_throtl_exit()a2551d0a29
pwm: stm32-lp: Don't modify HW state in .remove() callbacka6a2b36a8c
pwm: rockchip: Don't modify HW state in .remove() callback0a2ea5c0e5
pwm: img: Don't modify HW state in .remove() callbackdb8838e48a
habanalabs: add validity check for event ID received from F/Wd7736e2faa
nilfs2: fix memory leak in nilfs_sysfs_delete_snapshot_group0f36028d01
nilfs2: fix memory leak in nilfs_sysfs_create_snapshot_group5770b54b11
nilfs2: fix memory leak in nilfs_sysfs_delete_##name##_group5acb21e30d
nilfs2: fix memory leak in nilfs_sysfs_create_##name##_group0480f7a480
nilfs2: fix NULL pointer in nilfs_##name##_attr_released95b50ff07
nilfs2: fix memory leak in nilfs_sysfs_create_device_groupaa1af89a66
btrfs: fix lockdep warning while mounting sprout fsc43803c1aa
btrfs: update the bdev time directly when closing921ef7cfef
ceph: lockdep annotations for try_nonblocking_invalidate487ead34a2
ceph: remove the capsnaps when removing caps386fd6fd01
ceph: request Fw caps before updating the mtime in ceph_write_iterb26ced2625
dmaengine: xilinx_dma: Set DMA mask for coherent APIs9c1ea85377
dmaengine: ioat: depends on !UML35492619e0
dmaengine: sprd: Add missing MODULE_DEVICE_TABLEc12cf7f9af
dmaengine: idxd: depends on !UMLb4bb0b171b
iommu/amd: Relocate GAMSup check to early_enable_iommus2a07348e98
parisc: Move pci_dev_is_behind_card_dino to where it is usedca907291e1
dma-buf: DMABUF_MOVE_NOTIFY should depend on DMA_SHARED_BUFFERb9a1526d51
drivers: base: cacheinfo: Get rid of DEFINE_SMP_CALL_CACHE_FUNCTION()45bd9dd1be
drm/amdgpu: Disable PCIE_DPM on Intel RKL Platformc9538018cb
thermal/core: Fix thermal_cooling_device_register() prototyped1f9ecc00d
tools/bootconfig: Fix tracing_on option checking in ftrace2bconf.sh912afe602e
Kconfig.debug: drop selecting non-existing HARDLOCKUP_DETECTOR_ARCHe418ce8b8d
ceph: cancel delayed work instead of flushing on mdsc teardown8193ad306e
ceph: allow ceph_put_mds_session to take NULL or ERR_PTR41aa215734
platform/chrome: cros_ec_trace: Fix format warnings113a69460d
platform/chrome: sensorhub: Add trace events for sample48271d10bf
dmaengine: idxd: fix wq slot allocation index check777344da34
pwm: mxs: Don't modify HW state in .probe() after the PWM chip was registered322b70b522
pwm: lpc32xx: Don't modify HW state in .probe() after the PWM chip was registeredc63df77c40
PM: sleep: core: Avoid setting power.must_resume to false74190973ab
profiling: fix shift-out-of-bounds bugs0796d99c1b
nilfs2: use refcount_dec_and_lock() to fix potential UAF30417cbecc
prctl: allow to setup brk for et_dyn executablese464b3876b
9p/trans_virtio: Remove sysfs file on probe failure375e779ec3
thermal/drivers/exynos: Fix an error code in exynos_tmu_probe()38ab04186f
perf tools: Allow build-id with trailing zeros87c4144450
tools lib: Adopt memchr_inv() from kernelebcd3fd920
perf test: Fix bpf test sample mismatch reportingfa64b08931
dmaengine: acpi: Avoid comparison GSI with Linux vIRQ9d49973b08
um: virtio_uml: fix memory leak on init failures5d0e6a5e44
coredump: fix memleak in dump_vma_snapshot()6b24588708
staging: rtl8192u: Fix bitwise vs logical operator in TranslateRxSignalStuff819xUsb()ccb79116c3
sctp: add param size validation for SCTP_PARAM_SET_PRIMARYffca467668
sctp: validate chunk size in __rcv_asconf_lookup473cea4983
Revert "net/mlx5: Register to devlink ingress VLAN filter trap"5ce134e65f
ARM: 9098/1: ftrace: MODULE_PLT: Fix build problem without DYNAMIC_FTRACEf91d25a7c8
ARM: 9079/1: ftrace: Add MODULE_PLTS supportad00533858
ARM: 9078/1: Add warn suppress parameter to arm_gen_branch_link()ce90c6706d
ARM: 9077/1: PLT: Move struct plt_entries definition to headereb46d7c8ae
ARM: Qualify enabling of swiotlb_init()79286ea830
s390/pci_mmio: fully validate the VMA before calling follow_pte()74d54e5ceb
console: consume APC, DM, DCS9493e92a39
PCI: aardvark: Fix reporting CRS value9e766b86a9
PCI: pci-bridge-emul: Add PCIe Root Capabilities Register1b6d7b3a21
ANDROID: GKI: Update symbol list for new modules4d8524048a
Linux 5.10.68a23d357621
net: dsa: bcm_sf2: Fix array overrun in bcm_sf2_num_active_ports()9f2972e151
bnxt_en: Fix error recovery regression619d747c18
x86/mce: Avoid infinite loop for copy from user recovery47bc9c3929
net: renesas: sh_eth: Fix freeing wrong tx descriptorb2f9b7455b
mfd: lpc_sch: Rename GPIOBASE to prevent build error027c44b8c8
mfd: lpc_sch: Partially revert "Add support for Intel Quark X1000"52a7e66671
bnxt_en: Fix possible unintended driver initiated error recovery9a3f52f73c
bnxt_en: Improve logging of error recovery settings information.639a2eddb7
bnxt_en: Convert to use netif_level() helpers.01cad477a9
bnxt_en: Consolidate firmware reset event logging.fad75e0463
bnxt_en: log firmware debug notificationsf90a34faba
bnxt_en: Fix asic.rev in devlink dev info command7245023184
bnxt_en: fix stored FW_PSID version maskseb635e008c
net: dsa: b53: Fix IMP port setup on BCM5301x87b34cd648
ip_gre: validate csum_start only on pull9c98d2bd14
qlcnic: Remove redundant unlock in qlcnic_pinit_from_rom8c01c620ae
fq_codel: reject silly quantum parameters6e2d36f2b1
netfilter: socket: icmp6: fix use-after-scopec361c95560
net: dsa: b53: Set correct number of ports in the DSA struct0db7e0d9f6
net: dsa: b53: Fix calculating number of switch portsf89b0d032f
net: hso: add failure handler for add_net_devicef450958f7f
selftests: mptcp: clean tmp files in simult_flows5711ced58e
net: dsa: tag_rtl4_a: Fix egress tagsb167a0cec1
gpio: mpc8xxx: Use 'devm_gpiochip_add_data()' to simplify the code and avoid a leakf86956143d
gpio: mpc8xxx: Fix a resources leak in the error handling path of 'mpc8xxx_probe()'c2b52963fd
perf bench inject-buildid: Handle writen() errors5a20adc388
perf unwind: Do not overwrite FEATURE_CHECK_LDFLAGS-libunwind-{x86,aarch64}f5176a0798
ARC: export clear_user_page() for modules9da1fb128c
mtd: rawnand: cafe: Fix a resource leak in the error handling path of 'cafe_nand_probe()'5402b31c0c
PCI: Sync __pci_register_driver() stub for CONFIG_PCI=na957d82b23
KVM: arm64: Handle PSCI resets before userspace touches vCPU state53921242cf
KVM: arm64: Fix read-side race on updates to vcpu reset stateb9b89da56a
mtd: mtdconcat: Check _read, _write callbacks existence before assignment812cbb143c
mtd: mtdconcat: Judge callback existence based on the mastere8dfc446a1
tracing/boot: Fix a hist trigger dependency for boot time tracing87479b10eb
mfd: tqmx86: Clear GPIO IRQ resource when no IRQ is setf10f727cf9
PCI: Fix pci_dev_str_match_path() alloc while atomic buged44be1cbe
KVM: arm64: Restrict IPA size to maximum 48 bits on 4K and 16K page size62f813769f
netfilter: nft_ct: protect nft_ct_pcpu_template_refcnt with mutex1cf43a1e57
netfilter: Fix fall-through warnings for Clang9e89c22d1c
PCI: iproc: Fix BCMA probe resource handlingb1f3be0c30
PCI: of: Don't fail devm_pci_alloc_host_bridge() on missing 'ranges'063c3d980d
backlight: ktd253: Stabilize backlight00303e4592
mfd: axp20x: Update AXP288 volatile rangesab7cf22501
s390/bpf: Fix branch shortening during codegen pass4320c222c2
s390/bpf: Fix 64-bit subtraction of the -0x80000000 constantd92d3a9c2b
s390/bpf: Fix optimizing out zero-extensions4a93393203
NTB: perf: Fix an error code in perf_setup_inbuf()ce660d6dfc
NTB: Fix an error code in ntb_msit_probe()e76ccbdedb
ethtool: Fix an error code in cxgb2.c70ac967a7b
PCI: ibmphp: Fix double unmap of io_mem9ae759a36b
block, bfq: honor already-setup queue merges7f2b3242f0
net: usb: cdc_mbim: avoid altsetting toggling for Telit LN920ca8ecd7444
Set fc_nlinfo in nh_create_ipv4, nh_create_ipv6c422c55505
octeontx2-af: Add additional register check to rvu_poll_reg()1cac475eeb
watchdog: Start watchdog in watchdog_set_last_hw_keepalive only if appropriatee5609d3fd5
PCI: Add ACS quirks for Cavium multi-function devices365cdfcc6e
PCI: j721e: Add PCIe support for AM6481381b72f4
PCI: j721e: Add PCIe support for J72004892b1515b
PCI: cadence: Add quirk flag to set minimum delay in LTSSM Detect.Quiet statea83e032cc4
PCI: cadence: Use bitfield for *quirk_retrain_flag* instead of bool3aedfe4b08
tracing/probes: Reject events which have the same name of existing one75420f9400
PCI: rcar: Fix runtime PM imbalance in rcar_pcie_ep_probe()b6352e2e27
mfd: Don't use irq_create_mapping() to resolve a mappingaa638669c8
PCI: tegra: Fix OF node reference leakd5c5d1b141
PCI: tegra194: Fix MSI-X programming13f366bab0
PCI: tegra194: Fix handling BME_CHGED eventb7d4f310bb
fuse: fix use after free in fuse_read_interrupt()03cc3a2923
PCI: Add ACS quirks for NXP LX2xx0 and LX2xx2 platforms7a44361a1f
mfd: db8500-prcmu: Adjust map to reality619f137ffd
dt-bindings: mtd: gpmc: Fix the ECC bytes vs. OOB bytes equation49cf30ebb3
mm/memory_hotplug: use "unsigned long" for PFN in zone_for_pfn_range()aa39eb744a
net: hns3: fix the timing issue of VF clearing interrupt sourcesad47e09221
net: hns3: disable mac in flr processb76522c7c3
net: hns3: change affinity_mask to numa node range34fc06d047
net: hns3: pad the short tunnel frame before sending to hardware0511d099db
bnxt_en: make bnxt_free_skbs() safe to call after bnxt_free_mem()49eff4ab7d
KVM: PPC: Book3S HV: Tolerate treclaim. in fake-suspend mode changing registerse68795c110
ibmvnic: check failover_pending in login responseaeb67214ce
dt-bindings: arm: Fix Toradex compatible typo0ab9981fa0
udp_tunnel: Fix udp_tunnel_nic work-queue type5221e66329
qed: Handle management FW errore00eae1d6b
selftest: net: fix typo in altname test53947b68c5
tcp: fix tp->undo_retrans accounting in tcp_sacktag_one()35d3ab2ea2
x86/uaccess: Fix 32-bit __get_user_asm_u64() when CC_HAS_ASM_GOTO_OUTPUT=ycf6f29bb2c
net: dsa: destroy the phylink instance on any error in dsa_slave_phy_setupdf38f941a7
net/af_unix: fix a data-race in unix_dgram_pollcad96d0e50
vhost_net: fix OoB on sendmsg() failure.7843861e21
gen_compile_commands: fix missing 'sys' package983ef86629
net: ipa: initialize all filter table slotsc5102ced8a
events: Reuse value read using READ_ONCE instead of re-reading it8f8ad122ff
nvme-tcp: fix io_work priority inversionc586bc31d5
net/mlx5: Fix potential sleeping in atomic context29a5af9112
net/mlx5: FWTrace, cancel work on alloc pd error flow229e9293b2
perf machine: Initialize srcline string member in add_location struct33c983f7a1
drm/rockchip: cdn-dp-core: Make cdn_dp_core_resume __maybe_unusedfd9ed47fe6
tipc: increase timeout in tipc_sk_enqueue()abe460eb6f
r6040: Restore MDIO clock frequency after MAC resetedfab735d5
net/l2tp: Fix reference count leak in l2tp_udp_recv_core6c3cb65d56
dccp: don't duplicate ccid when cloning dccp sockf6f8076655
ptp: dp83640: don't define PAGE0bd6d9a0dd4
net-caif: avoid user-triggerable WARN_ON(1)855c17ffa6
net/{mlx5|nfp|bnxt}: Remove unnecessary RTNL lock assertc5c9ee2d36
ethtool: Fix rxnfc copy to user buffer overflowee3ffd56b4
tipc: fix an use-after-free issue in tipc_recvmsg12551b75b0
x86/mm: Fix kern_addr_valid() to cope with existing but not present entries6672dc68e2
x86/pat: Pass valid address to sanitize_phys()0346f8a2c5
s390/sclp: fix Secure-IPL facility detectioncc9d96c9f9
drm/etnaviv: add missing MMU context put when reaping MMU mappingea995e8a62
drm/etnaviv: reference MMU context when setting up hardware state660dfbf208
drm/etnaviv: fix MMU context leak on GPU reset22163efedc
drm/etnaviv: exec and MMU state is lost when resetting the GPU6b1c223d8a
drm/etnaviv: keep MMU context across runtime suspend/resumec63e6e0951
drm/etnaviv: stop abusing mmu_context as FE running markercf24bd826e
drm/etnaviv: put submit prev MMU context when it exists0759f64847
drm/etnaviv: return context from etnaviv_iommu_context_get8f95553f00
drm/amd/amdgpu: Increase HWIP_MAX_INSTANCE to 1087f7032dc2
PCI: Add AMD GPU multi-function power dependenciescd64b416ae
PM: base: power: don't try to use non-existing RTC for storing dataa67e7cdbc6
arm64/sve: Use correct size when reinitialising SVE state84da60070c
bnx2x: Fix enabling network interfaces without VFs1a5a3ba21a
xen: reset legacy rtc flag for PV domUce8f81b76d
io_uring: ensure symmetry in handling iter types in loop_rw_iter()88f3d951e2
btrfs: fix upper limit for max_inline for page size 64K575279059e
drm/bridge: lt9611: Fix handling of 4k panelsfaf816b0f8
Linux 5.10.67ad3ea16746
fanotify: limit number of event merge attempts412974e75f
drm/panfrost: Clamp lock region to Bifrost minimum8976e09443
drm/panfrost: Use u64 for size in lock_region95251e6833
drm/panfrost: Simplify lock_region calculationb80a99e048
drm/amd/display: Update bounding box states (v2)583c4f3d09
drm/amd/display: Update number of DCN3 clock states7b1abace16
drm/amdgpu: Fix BUG_ON assertc29485e34e
drm/panfrost: Make sure MMU context lifetime is not bound to panfrost_privbb693c114e
drm/dp_mst: Fix return code on sideband message failure84cac4f806
drm/msi/mdp4: populate priv->kms in mdp4_kms_initbe1fcecfc1
drm/mgag200: Select clock in PLL update functionsd0aaea1f11
net: dsa: lantiq_gswip: fix maximum frame length5944d0e2b0
lib/test_stackinit: Fix static initializer test00cdb2fb4d
platform/chrome: cros_ec_proto: Send command again when timeout occursb2e72e53cd
libnvdimm/pmem: Fix crash triggered when I/O in-flight during unbind6d86634d7b
memcg: enable accounting for pids in nested pid namespaces388f12dabb
mm,vmscan: fix divide by zero in get_scan_count2d2d8b0eca
mm/hugetlb: initialize hugetlb_usage in mm_initce75a6b399
mm/hmm: bypass devmap pte when all pfn requested flags are fulfillede1fa3b2b60
hugetlb: fix hugetlb cgroup refcounting during vma split27dd91221b
s390/pv: fix the forcing of the swiotlb086faa4a2e
cpufreq: powernv: Fix init_chip_info initialization in numa=off55be9eb193
scsi: qla2xxx: Sync queue idx with queue_pair_map idx9c8414325e
scsi: qla2xxx: Changes to support kdump kernel137dafa722
scsi: BusLogic: Fix missing pr_cont() use69775e4e17
ovl: fix BUG_ON() in may_delete() when called from ovl_cleanup()7a5756e905
parisc: fix crash with signals and alloca9a4e7f9038
io_uring: remove duplicated io_size from rw6930a2a5be
fs/io_uring Don't use the return value from import_iovec().2c304c65de
net: hns3: clean up a type mismatch warningfb1ee02787
net: w5100: check return value after calling platform_get_resource()c49a52046d
fix array-index-out-of-bounds in taprio_changea4301d06a0
net: fix NULL pointer reference in cipso_v4_doi_free5ed5d594d9
ath9k: fix sleeping in atomic contextaa3708236e
ath9k: fix OOB read ar9300_eeprom_restore_internalbe457b27dd
wcn36xx: Fix missing frame timestamp for beacon/probe-respb1d547f2f5
selftests/bpf: Fix potential unreleased lock3ad66d6782
parport: remove non-zero check on count1e93025378
net/mlx5: DR, Enable QP retransmission9c5c65ecbd
net/mlx5: DR, fix a potential use-after-free bug4bbf0a9d90
iwlwifi: mvm: Fix scan channel flags settingsa693aff5e8
iwlwifi: fw: correctly limit to monitor dump4ed6510e05
iwlwifi: mvm: fix access to BSS elements9e80a3d88f
iwlwifi: mvm: avoid static queue number aliasing3ed8982df5
iwlwifi: mvm: fix a memory leak in iwl_mvm_mac_ctxt_beacon_changed608c8359c5
iwlwifi: pcie: free RBs during configureeb04c51a43
nfsd: fix crash on LOCKT on reexported NFSv30e9f449221
drm/amdkfd: Account for SH/SE count when setting up cu masks.27d4a96add
ASoC: rockchip: i2s: Fixup config for DAIFMT_DSP_A/B969eddc3b4
ASoC: rockchip: i2s: Fix regmap_ops hang7344a8a801
usbip:vhci_hcd USB port can get stuck in the disabled state29c8f13a34
usbip: give back URBs for unsent unlink requests during cleanup8de01a896c
usb: musb: musb_dsps: request_irq() after initializing musbc0751eeb93
Revert "USB: xhci: fix U1/U2 handling for hardware with XHCI_INTEL_HOST quirk set"ba2faddf1f
cifs: fix wrong release in sess_alloc_buffer() failed path7c7d6c9cd8
mmc: core: Return correct emmc response in case of ioctl errord1e382a04a
selftests/bpf: Enlarge select() timeout for test_maps3aab5bffdd
mmc: rtsx_pci: Fix long reads when clock is prescaled7f43da79eb
mmc: sdhci-of-arasan: Check return value of non-void funtions834ecf61ce
mmc: sdhci-of-arasan: Modified SD default speed to 19MHz for ZynqMP1a40e60e2a
of: Don't allow __of_attached_node_sysfs() without CONFIG_SYSFSbe69ed7bb9
ASoC: Intel: Skylake: Fix passing loadable flag for module4a48ed4794
ASoC: Intel: Skylake: Fix module configuration for KPB and MIXERd72afec087
soundwire: intel: fix potential race condition during power downb225eeaf3a
btrfs: tree-log: check btrfs_lookup_data_extent return value87ae522e46
m68knommu: only set CONFIG_ISA_DMA_API for ColdFire sub-archc10b1afc2f
octeontx2-pf: Fix NIX1_RX interface backpressure6d657f1fa1
rtw88: wow: fix size access error of probe requestaa82a11176
rtw88: wow: build wow function only if CONFIG_PM is on2fd1964f75
rtw88: use read_poll_timeout instead of fixed sleep9baf6f8ca2
rtl8xxxu: Fix the handling of TX A-MPDU aggregation756924bc18
drm/exynos: Always initialize mapping in exynos_drm_register_dma()9ce6e29375
lockd: lockd server-side shouldn't set fl_ops2d3fab9cea
usb: chipidea: host: fix port index underflow and UBSAN complains2225a5cd2f
gfs2: Don't call dlm after protocol is unmounted0df5eba67b
kselftest/arm64: pac: Fix skipping of tests on systems without PAC9486d7ac9f
kselftest/arm64: mte: Fix misleading output when skipping tests1f5db5b8a3
net: Fix offloading indirect devices dependency on qdisc order creation2a69325ee5
staging: rts5208: Fix get_ms_information() heap buffer size868831492d
hwmon: (pmbus/ibm-cffps) Fix write bits for LED control39738ebfad
selftests/bpf: Fix flaky send_signal testc53c68c9bf
rpc: fix gss_svc_init cleanup on failure4b1b4d3f45
tcp: enable data-less, empty-cookie SYN with TFO_SERVER_COOKIE_NOT_REQDfca514f25c
iomap: pass writeback errors to the mapping49e2bcb7cf
serial: sh-sci: fix break handling for sysrqa99eec36ed
opp: Don't print an error if required-opps is missing6698029de3
Bluetooth: Fix handling of LE Enhanced Connection Complete240a7025a6
nvme: code command_id with a genctr for use-after-free validation24618e92d5
nvme-tcp: don't check blk_mq_tag_to_rq when receiving pdu data27e8bc1f5b
arm64: dts: ls1046a: fix eeprom entriesaa06cfc529
arm64: tegra: Fix compatible string for Tegra132 CPUs9c2b89f64f
ARM: tegra: tamonten: Fix UART pad setting035e8d5a6d
ARM: tegra: acer-a500: Remove bogus USB VBUS regulators9713dfa518
mac80211: Fix monitor MTU limit so that A-MSDUs get through83449db3aa
drm/display: fix possible null-pointer dereference in dcn10_set_clock()2254383788
gpu: drm: amd: amdgpu: amdgpu_i2c: fix possible uninitialized-variable access in amdgpu_i2c_router_select_ddc_port()155e704790
net/mlx5: Fix variable type to match 64bitf86bc4a1a4
drm/msm/dp: return correct edid checksum after corrupted edid checksum read98d44b7be6
Bluetooth: avoid circular locks in sco_sock_connecta1073aad49
Bluetooth: schedule SCO timeouts with delayed_workd6c9142399
drm/vmwgfx: fix potential UAF in vmwgfx_surface.c3841dfa7eb
selftests/bpf: Fix xdp_tx.c prog section name63ebc1f1df
drm/amd/display: fix incorrect CM/TF programming sequence in dwbd763afc4ea
drm/amd/display: fix missing writeback disablement if plane is removed491c8be219
thunderbolt: Fix port linking by checking all adapters0f0f1de02b
drm: xlnx: zynqmp: release reset to DP controller before accessing DP registersf76f78f9f4
drm: xlnx: zynqmp_dpsub: Call pm_runtime_get_sync before setting pixel clock127f3610a0
drm/msm/dsi: Fix DSI and DSI PHY regulator config from SDM6600bbbe3ec67
drm/msm: mdp4: drop vblank get/put from prepare/complete_commitac21cd44c9
net: ethernet: stmmac: Do not use unreachable() in ipq806x_gmac_probe()2b0fa8d530
nvmem: qfprom: Fix up qfprom_disable_fuse_blowing() ordering35e5c99b15
arm64: dts: qcom: sm8250: Fix epss_l3 unit address43ccafc91f
arm64: dts: qcom: msm8996: don't use underscore in node namef868c2d62a
arm64: dts: qcom: msm8994: don't use underscore in node namebda9c84edb
arm64: dts: qcom: sdm630: don't use underscore in node nameaa16e76c80
arm64: dts: qcom: ipq6018: drop '0x' from unit addressda714a1983
arm64: dts: qcom: sdm660: use reg value for memory node34e9c56675
arm64: dts: qcom: ipq8074: fix pci node reg property74287874c9
ARM: dts: imx53-ppd: Fix ACHC entry6a00decce3
serial: 8250_omap: Handle optional overrun-throttle-ms property699c914758
arm64: dts: qcom: sdm630: Fix TLMM node and pinctrl configuration310a127178
arm64: dts: qcom: sdm630: Rewrite memory map783be2a942
gfs2: Fix glock recursion in freeze_go_xmote_bh4e014ff22e
media: tegra-cec: Handle errors of clk_prepare_enable()c159db240c
media: TDA1997x: fix tda1997x_query_dv_timings() return valuee3a2e20ed5
media: v4l2-dv-timings.c: fix wrong condition in two for-loopsac1bcf53e3
media: imx258: Limit the max analogue gain to 4804cb4967472
media: imx258: Rectify mismatch of VTS valuea64e3f1d8a
ASoC: Intel: update sof_pcm512x quirks9cf8272420
ASoC: Intel: bytcr_rt5640: Move "Platform Clock" routes to the maps for the matching in-/outputf1fb1f6fa1
arm64: tegra: Fix Tegra194 PCIe EP compatible string8fb3d8c151
ARM: dts: at91: use the right property for shutdown controllerf710323dcd
bonding: 3ad: fix the concurrency between __bond_release_one() and bond_3ad_state_machine_handler()5d008cb763
ARM: dts: stm32: Update AV96 adv7513 node per dtbs_check3142476fa0
ARM: dts: stm32: Set {bitclock,frame}-master phandles on ST DKx37437a60a9
ARM: dts: stm32: Set {bitclock,frame}-master phandles on DHCOM SoMf4c7c95e3e
workqueue: Fix possible memory leaks in wq_numa_init()6528cc687c
Bluetooth: skip invalid hci_sync_conn_complete_evt3b82e4799f
ata: sata_dwc_460ex: No need to call phy_exit() befre phy_init()4af60a543b
libbpf: Fix race when pinning maps in parallel874d5aa06c
samples: bpf: Fix tracex7 error raised on the missing argument035f83b5ab
staging: ks7010: Fix the initialization of the 'sleep_status' structured0a8ef04c2
serial: 8250_pci: make setup_port() parameters explicitly unsigned2603740df8
hvsi: don't panic on tty_register_driver failuredd3307a8b3
xtensa: ISS: don't panic in rs_initb763d2e7d4
serial: 8250: Define RX trigger levels for OxSemi 950 devices973c57c5e6
s390: make PCI mio support a machine flag77d62f2bcc
s390/jump_label: print real address in a case of a jump label bug863d2eb2f7
flow_dissector: Fix out-of-bounds warnings64583448c2
ipv4: ip_output.c: Fix out-of-bounds warning in ip_copy_addrs()bcc61adefd
video: fbdev: riva: Error out if 'pixclock' equals zero63abc0eb8a
video: fbdev: kyro: Error out if 'pixclock' equals zero6a8dcd2ffb
video: fbdev: asiliantfb: Error out if 'pixclock' equals zero3740418ccd
arm64: dts: allwinner: h6: tanix-tx6: Fix regulator node namesbe2e11b9f8
drm/bridge: nwl-dsi: Avoid potential multiplication overflow on 32-bit6a3564739b
bpf/tests: Do not PASS tests without actually testing the result99121dec14
bpf/tests: Fix copy-and-paste error in double word test6f51f42412
drm/amd/amdgpu: Update debugfs link_settings output link_rate field in hexa5999d18a8
drm/amdgpu: Fix a printing message5b3a45eedd
ethtool: improve compat ioctl handling52bb703f71
nfp: fix return statement in nfp_net_parse_meta()23e5fb6475
media: atomisp: pci: fix error return code in atomisp_pci_probe()e5cecb9105
media: atomisp: Fix runtime PM imbalance in atomisp_pci_probe9a85b9e376
media: platform: stm32: unprepare clocks at handling errors in probec6e5eebd95
media: hantro: vp8: Move noisy WARN_ON to vpu_debugf462a39eb8
drm/amd/display: Fix timer_per_pixel unit errorb4f5c9454d
selftests: firmware: Fix ignored return val of asprintf() warne944a22126
bus: fsl-mc: fix mmio base address for child DPRCs165c55af5f
tty: serial: jsm: hold port lock when reporting modem line changes642639bb8d
staging: board: Fix uninitialized spinlock when attaching genpd03f4492dbf
usb: gadget: composite: Allow bMaxPower=0 if self-powered5534de13b6
USB: EHCI: ehci-mv: improve error handling in mv_ehci_enable()b2b8137ec9
usb: gadget: u_ether: fix a potential null pointer dereference566ddd2d94
usb: host: fotg210: fix the actual_length of an iso packet224cf5e8c8
usb: host: fotg210: fix the endpoint's transactional opportunities calculation463b3edfba
igc: Check if num of q_vectors is smaller than max before array accessd3ca78775d
rcu: Fix macro name CONFIG_TASKS_RCU_TRACE34609faad0
drm: protect drm_master pointers in drm_lease.c06a553a99b
drm: serialize drm_file.master with a new spinlock54e51d288b
drm: avoid blocking in drm_clients_info's rcu sectiondf19d95141
Smack: Fix wrong semantics in smk_access_entry()3533aa65e6
netlink: Deal with ESRCH error in nlmsg_notify()9de06dcd47
video: fbdev: kyro: fix a DoS bug by restricting user input29ab7f6d50
ARM: dts: qcom: apq8064: correct clock namese0c17c11b1
iavf: fix locking of critical sections67c9262e3f
iavf: do not override the adapter state in the watchdog task9f11de5601
iio: dac: ad5624r: Fix incorrect handling of an optional regulator.e78a0b4a33
net: phy: Fix data type in DP83822 dp8382x_disable_wol()cca6127587
tipc: keep the skb in rcv queue until the whole data is readcc12ab5951
PCI: Use pci_update_current_state() in pci_enable_device_flags()aad29a00a5
crypto: mxs-dcp - Use sg_mapping_iter to copy data871abd1e61
x86/hyperv: fix for unwanted manipulation of sched_clock when TSC marked unstablec327b69e96
libbpf: Fix reuse of pinned map on older kernel6a985c5794
media: dib8000: rewrite the init prbs logic2048907d8c
ASoC: atmel: ATMEL drivers don't need HAS_DMA10a135969f
drm/amdgpu: Fix amdgpu_ras_eeprom_init()b32d3ded9d
drm/vc4: hdmi: Set HD_CTL_WHOLSMP and HD_CTL_CHALIGN_SET6afd1e053d
userfaultfd: prevent concurrent API initialization1e4cfe954b
kbuild: Fix 'no symbols' warning when CONFIG_TRIM_UNUSD_KSYMS=y981bf9b0aa
MIPS: Malta: fix alignment of the devicetree bufferbb8108546d
f2fs: should put a page beyond EOF when preparing a writed04925fb8d
f2fs: deallocate compressed pages when error happens4b71928e5c
f2fs: fix to unmap pages from userspace process in punch_hole()1c934aba9f
f2fs: fix unexpected ENOENT comes from f2fs_map_blocks()45cb5f86c1
f2fs: fix to account missing .skipped_gc_rwsemfd69f613af
soc: mediatek: cmdq: add address shift in jumpd320c1b2e7
KVM: PPC: Fix clearing never mapped TCEs in realmode6bf98b94ff
clk: at91: clk-generated: Limit the requested rate to our range9bab2bc4c2
fscache: Fix cookie key hashingb4849e2ac7
RDMA/hns: Fix QP's resp incomplete assignmente91077cf17
powerpc/smp: Update cpu_core_map on all PowerPc systems903ca538f5
platform/x86: dell-smbios-wmi: Add missing kfree in error-exit from run_smbios_calladd8e8c340
KVM: PPC: Book3S HV Nested: Reflect guest PMU in-use to L0 when guest SPRs are live4c0c4f7021
scsi: ufs: ufs-exynos: Fix static checker warningbda5602c1c
KVM: PPC: Book3S HV: Fix copy_tofrom_guest routines926bf91248
clk: imx8m: fix clock tree update of TF-A managed clockse84a72f696
HID: i2c-hid: Fix Elan touchpad regression253bac6c60
iommu/vt-d: Update the virtual command related registers947579a696
powerpc/config: Renable MTD_PHYSMAP_OF1bc19e4062
scsi: qedf: Fix error codes in qedf_alloc_global_queues()dc45777499
scsi: qedi: Fix error codes in qedi_alloc_global_queues()782c401784
scsi: smartpqi: Fix an error code in pqi_get_raid_map()41066433be
powerpc/numa: Consider the max NUMA node for migratable LPARd3612083ec
pinctrl: single: Fix error return code in pcs_parse_bits_in_pinctrl_entry()6291fd0eea
scsi: fdomain: Fix error return code in fdomain_probe()f02ab9d1d3
sunrpc: Fix return value of get_srcport()21a2be1a51
SUNRPC query transport's source portf19abe0463
SUNRPC/xprtrdma: Fix reconnection lockingf3d3016127
SUNRPC: Fix potential memory corruption9aa7a3ffb1
NFSv4/pnfs: The layout barrier indicate a minimal value for the seqid2a542421eb
NFSv4/pNFS: Always allow update of a zero valued layout barrier4b96edea5c
NFSv4/pNFS: Fix a layoutget livelock loopfa55e76641
dma-debug: fix debugfs initialization orderca7f7e37ba
openrisc: don't printk() unconditionally31fd3211ef
f2fs: reduce the scope of setting fsck tag when de->name_len is zero49e4c83db8
cpuidle: pseries: Mark pseries_idle_proble() as __init876e45c95e
RDMA/mlx5: Delete not-available udata checka77da9de0d
RDMA/efa: Remove double QP type assignment1988836e30
powerpc/stacktrace: Include linux/delay.hc5a5528da7
cpuidle: pseries: Fixup CEDE0 latency only for POWER10 onwards3b2bbcccd6
scsi: ufs: Fix memory corruption by ufshcd_read_desc_param()d353e093c0
vfio: Use config not menuconfig for VFIO_NOIOMMU0f711378f0
pinctrl: samsung: Fix pinctrl bank pin count59137b7dff
scsi: BusLogic: Use %X for u32 sized integer rather than %lX8ea3e622af
docs: Fix infiniband uverbs minor numberfe2a1cd622
RDMA/iwcm: Release resources if iw_cm module initialization failsb824bae96f
IB/hfi1: Adjust pkey entry in index 0273ed4f47e
clk: rockchip: drop GRF dependency for rk3328/rk3036 pll typesf1eccc4081
scsi: bsg: Remove support for SCSI_IOCTL_SEND_COMMANDef5395fbad
pinctrl: armada-37xx: Correct PWM pins definitions782ceaba97
pinctrl: remove empty lines in pinctrl subsystem2d586a3f5b
f2fs: quota: fix potential deadlock70fd936367
HID: input: do not report stylus battery state as "full"4e89aea738
PCI: aardvark: Fix masking and unmasking legacy INTx interruptsb50db4c02f
PCI: aardvark: Fix checking for PIO status9d60905754
PCI: Export pci_pio_to_address() for module usefa3c15ccf2
PCI: aardvark: Configure PCIe resources from 'ranges' DT propertydf23bd40ed
PCI: xilinx-nwl: Enable the clock through CCF72f2be3432
PCI: Return ~0 data on pciconfig_read() CAP_SYS_ADMIN failure088a1052f7
PCI: Restrict ASMedia ASM1062 SATA Max Payload Size Supported9302a3c00c
PCI/portdrv: Enable Bandwidth Notification only if port supports it74d6dfcb0f
f2fs: fix to do sanity check for sb/cp fields correctlyce7e64e63a
ARM: 9105/1: atags_to_fdt: don't warn about stack sizeba73bc1666
libata: add ATA_HORKAGE_NO_NCQ_TRIM for Samsung 860 and 870 SSDsbcbc44e42d
dmaengine: imx-sdma: remove duplicated sdma_load_context300ccb1292
Revert "dmaengine: imx-sdma: refine to load context only once"76668bdee0
s390/qdio: cancel the ESTABLISH ccw after timeoutbcc0c767f9
s390/qdio: fix roll-back after timeout on ESTABLISH ccw2d2aaa200c
media: rc-loopback: return number of emitters rather than errorc0eaaa6868
media: uvc: don't do DMA on stack516dbe27f4
VMCI: fix NULL pointer dereference when unmapping queue pair6cae39f457
crypto: ccp - shutdown SEV firmware on kexec7509c4cb7c
dm crypt: Avoid percpu_counter spinlock contention in crypt_page_alloc()4f920fefd8
power: supply: max17042: handle fails of reading status register0d54bbad80
block: bfq: fix bfq_set_next_ioprio_data()5df14bba00
crypto: public_key: fix overflow during implicit conversion646870ad8e
wcn36xx: Ensure finish scan is not requested before start scan4753723f8b
iio: ltc2983: fix device probede32e15180
arm64: head: avoid over-mapping in map_memory2d3a9dff76
arm64: mm: Fix TLBI vs ASID rollover01e6c64bbc
soc: aspeed: p2a-ctrl: Fix boundary check for mmap3fdf2feb6c
soc: aspeed: lpc-ctrl: Fix boundary check for mmape80c45dbe2
soc: qcom: aoss: Fix the out of bound usage of cooling_devs610e8b2621
pinctrl: ingenic: Fix incorrect pull up/down info1e1136fbe8
pinctrl: stmfx: Fix hazardous u8[] to unsigned long cast7524fcd09c
clk: socfpga: agilex: add the bypass register for s2f_usr0 clock96bf326fb9
clk: socfpga: agilex: fix up s2f_user0_clk representation7eb16be25f
clk: socfpga: agilex: fix the parents of the psi_ref_clkac99b3aa83
tools/thermal/tmon: Add cross compiling support2daa118a3f
selftests/ftrace: Fix requirement check of README file8248b61b86
ceph: fix dereference of null pointer cfc37085d606
9p/xen: Fix end of loop tests for list_for_each_entry907944851a
xen: fix setting of max_pfn in shared_info37566a343f
powerpc/perf/hv-gpci: Fix counter value parsing5f13c8bae8
PCI/MSI: Skip masking MSI-X on Xen PVd15554f985
blk-zoned: allow BLKREPORTZONE without CAP_SYS_ADMINa58f082554
blk-zoned: allow zone management send operations without CAP_SYS_ADMINc1b249e02a
btrfs: reset replace target device to allocation state on close0901af53da
btrfs: wake up async_delalloc_pages waiters after submit9ac218642d
io-wq: fix wakeup race when adding new work548ee201fb
io_uring: fail links of cancelled timeouts54eb6211b9
io_uring: add ->splice_fd_in checksa3ed34bcad
io_uring: place fixed tables under memcg limits5103b73334
io_uring: limit fixed table size by RLIMIT_NOFILEebedb252a4
rtc: tps65910: Correct driver module alias Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: Icc858b61fec7d76c8b144958c0d5c1859508ecb2
6089 lines
167 KiB
C
6089 lines
167 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* kernel/workqueue.c - generic async execution with shared worker pool
|
|
*
|
|
* Copyright (C) 2002 Ingo Molnar
|
|
*
|
|
* Derived from the taskqueue/keventd code by:
|
|
* David Woodhouse <dwmw2@infradead.org>
|
|
* Andrew Morton
|
|
* Kai Petzke <wpp@marie.physik.tu-berlin.de>
|
|
* Theodore Ts'o <tytso@mit.edu>
|
|
*
|
|
* Made to use alloc_percpu by Christoph Lameter.
|
|
*
|
|
* Copyright (C) 2010 SUSE Linux Products GmbH
|
|
* Copyright (C) 2010 Tejun Heo <tj@kernel.org>
|
|
*
|
|
* This is the generic async execution mechanism. Work items as are
|
|
* executed in process context. The worker pool is shared and
|
|
* automatically managed. There are two worker pools for each CPU (one for
|
|
* normal work items and the other for high priority ones) and some extra
|
|
* pools for workqueues which are not bound to any specific CPU - the
|
|
* number of these backing pools is dynamic.
|
|
*
|
|
* Please read Documentation/core-api/workqueue.rst for details.
|
|
*/
|
|
|
|
#include <linux/export.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/sched.h>
|
|
#include <linux/init.h>
|
|
#include <linux/signal.h>
|
|
#include <linux/completion.h>
|
|
#include <linux/workqueue.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/cpu.h>
|
|
#include <linux/notifier.h>
|
|
#include <linux/kthread.h>
|
|
#include <linux/hardirq.h>
|
|
#include <linux/mempolicy.h>
|
|
#include <linux/freezer.h>
|
|
#include <linux/debug_locks.h>
|
|
#include <linux/lockdep.h>
|
|
#include <linux/idr.h>
|
|
#include <linux/jhash.h>
|
|
#include <linux/hashtable.h>
|
|
#include <linux/rculist.h>
|
|
#include <linux/nodemask.h>
|
|
#include <linux/moduleparam.h>
|
|
#include <linux/uaccess.h>
|
|
#include <linux/sched/isolation.h>
|
|
#include <linux/nmi.h>
|
|
#include <linux/kvm_para.h>
|
|
|
|
#include "workqueue_internal.h"
|
|
|
|
#include <trace/hooks/wqlockup.h>
|
|
/* events/workqueue.h uses default TRACE_INCLUDE_PATH */
|
|
#undef TRACE_INCLUDE_PATH
|
|
|
|
enum {
|
|
/*
|
|
* worker_pool flags
|
|
*
|
|
* A bound pool is either associated or disassociated with its CPU.
|
|
* While associated (!DISASSOCIATED), all workers are bound to the
|
|
* CPU and none has %WORKER_UNBOUND set and concurrency management
|
|
* is in effect.
|
|
*
|
|
* While DISASSOCIATED, the cpu may be offline and all workers have
|
|
* %WORKER_UNBOUND set and concurrency management disabled, and may
|
|
* be executing on any CPU. The pool behaves as an unbound one.
|
|
*
|
|
* Note that DISASSOCIATED should be flipped only while holding
|
|
* wq_pool_attach_mutex to avoid changing binding state while
|
|
* worker_attach_to_pool() is in progress.
|
|
*/
|
|
POOL_MANAGER_ACTIVE = 1 << 0, /* being managed */
|
|
POOL_DISASSOCIATED = 1 << 2, /* cpu can't serve workers */
|
|
|
|
/* worker flags */
|
|
WORKER_DIE = 1 << 1, /* die die die */
|
|
WORKER_IDLE = 1 << 2, /* is idle */
|
|
WORKER_PREP = 1 << 3, /* preparing to run works */
|
|
WORKER_CPU_INTENSIVE = 1 << 6, /* cpu intensive */
|
|
WORKER_UNBOUND = 1 << 7, /* worker is unbound */
|
|
WORKER_REBOUND = 1 << 8, /* worker was rebound */
|
|
|
|
WORKER_NOT_RUNNING = WORKER_PREP | WORKER_CPU_INTENSIVE |
|
|
WORKER_UNBOUND | WORKER_REBOUND,
|
|
|
|
NR_STD_WORKER_POOLS = 2, /* # standard pools per cpu */
|
|
|
|
UNBOUND_POOL_HASH_ORDER = 6, /* hashed by pool->attrs */
|
|
BUSY_WORKER_HASH_ORDER = 6, /* 64 pointers */
|
|
|
|
MAX_IDLE_WORKERS_RATIO = 4, /* 1/4 of busy can be idle */
|
|
IDLE_WORKER_TIMEOUT = 300 * HZ, /* keep idle ones for 5 mins */
|
|
|
|
MAYDAY_INITIAL_TIMEOUT = HZ / 100 >= 2 ? HZ / 100 : 2,
|
|
/* call for help after 10ms
|
|
(min two ticks) */
|
|
MAYDAY_INTERVAL = HZ / 10, /* and then every 100ms */
|
|
CREATE_COOLDOWN = HZ, /* time to breath after fail */
|
|
|
|
/*
|
|
* Rescue workers are used only on emergencies and shared by
|
|
* all cpus. Give MIN_NICE.
|
|
*/
|
|
RESCUER_NICE_LEVEL = MIN_NICE,
|
|
HIGHPRI_NICE_LEVEL = MIN_NICE,
|
|
|
|
WQ_NAME_LEN = 24,
|
|
};
|
|
|
|
/*
|
|
* Structure fields follow one of the following exclusion rules.
|
|
*
|
|
* I: Modifiable by initialization/destruction paths and read-only for
|
|
* everyone else.
|
|
*
|
|
* P: Preemption protected. Disabling preemption is enough and should
|
|
* only be modified and accessed from the local cpu.
|
|
*
|
|
* L: pool->lock protected. Access with pool->lock held.
|
|
*
|
|
* X: During normal operation, modification requires pool->lock and should
|
|
* be done only from local cpu. Either disabling preemption on local
|
|
* cpu or grabbing pool->lock is enough for read access. If
|
|
* POOL_DISASSOCIATED is set, it's identical to L.
|
|
*
|
|
* A: wq_pool_attach_mutex protected.
|
|
*
|
|
* PL: wq_pool_mutex protected.
|
|
*
|
|
* PR: wq_pool_mutex protected for writes. RCU protected for reads.
|
|
*
|
|
* PW: wq_pool_mutex and wq->mutex protected for writes. Either for reads.
|
|
*
|
|
* PWR: wq_pool_mutex and wq->mutex protected for writes. Either or
|
|
* RCU for reads.
|
|
*
|
|
* WQ: wq->mutex protected.
|
|
*
|
|
* WR: wq->mutex protected for writes. RCU protected for reads.
|
|
*
|
|
* MD: wq_mayday_lock protected.
|
|
*/
|
|
|
|
/* struct worker is defined in workqueue_internal.h */
|
|
|
|
struct worker_pool {
|
|
raw_spinlock_t lock; /* the pool lock */
|
|
int cpu; /* I: the associated cpu */
|
|
int node; /* I: the associated node ID */
|
|
int id; /* I: pool ID */
|
|
unsigned int flags; /* X: flags */
|
|
|
|
unsigned long watchdog_ts; /* L: watchdog timestamp */
|
|
|
|
struct list_head worklist; /* L: list of pending works */
|
|
|
|
int nr_workers; /* L: total number of workers */
|
|
int nr_idle; /* L: currently idle workers */
|
|
|
|
struct list_head idle_list; /* X: list of idle workers */
|
|
struct timer_list idle_timer; /* L: worker idle timeout */
|
|
struct timer_list mayday_timer; /* L: SOS timer for workers */
|
|
|
|
/* a workers is either on busy_hash or idle_list, or the manager */
|
|
DECLARE_HASHTABLE(busy_hash, BUSY_WORKER_HASH_ORDER);
|
|
/* L: hash of busy workers */
|
|
|
|
struct worker *manager; /* L: purely informational */
|
|
struct list_head workers; /* A: attached workers */
|
|
struct completion *detach_completion; /* all workers detached */
|
|
|
|
struct ida worker_ida; /* worker IDs for task name */
|
|
|
|
struct workqueue_attrs *attrs; /* I: worker attributes */
|
|
struct hlist_node hash_node; /* PL: unbound_pool_hash node */
|
|
int refcnt; /* PL: refcnt for unbound pools */
|
|
|
|
/*
|
|
* The current concurrency level. As it's likely to be accessed
|
|
* from other CPUs during try_to_wake_up(), put it in a separate
|
|
* cacheline.
|
|
*/
|
|
atomic_t nr_running ____cacheline_aligned_in_smp;
|
|
|
|
/*
|
|
* Destruction of pool is RCU protected to allow dereferences
|
|
* from get_work_pool().
|
|
*/
|
|
struct rcu_head rcu;
|
|
} ____cacheline_aligned_in_smp;
|
|
|
|
/*
|
|
* The per-pool workqueue. While queued, the lower WORK_STRUCT_FLAG_BITS
|
|
* of work_struct->data are used for flags and the remaining high bits
|
|
* point to the pwq; thus, pwqs need to be aligned at two's power of the
|
|
* number of flag bits.
|
|
*/
|
|
struct pool_workqueue {
|
|
struct worker_pool *pool; /* I: the associated pool */
|
|
struct workqueue_struct *wq; /* I: the owning workqueue */
|
|
int work_color; /* L: current color */
|
|
int flush_color; /* L: flushing color */
|
|
int refcnt; /* L: reference count */
|
|
int nr_in_flight[WORK_NR_COLORS];
|
|
/* L: nr of in_flight works */
|
|
int nr_active; /* L: nr of active works */
|
|
int max_active; /* L: max active works */
|
|
struct list_head delayed_works; /* L: delayed works */
|
|
struct list_head pwqs_node; /* WR: node on wq->pwqs */
|
|
struct list_head mayday_node; /* MD: node on wq->maydays */
|
|
|
|
/*
|
|
* Release of unbound pwq is punted to system_wq. See put_pwq()
|
|
* and pwq_unbound_release_workfn() for details. pool_workqueue
|
|
* itself is also RCU protected so that the first pwq can be
|
|
* determined without grabbing wq->mutex.
|
|
*/
|
|
struct work_struct unbound_release_work;
|
|
struct rcu_head rcu;
|
|
} __aligned(1 << WORK_STRUCT_FLAG_BITS);
|
|
|
|
/*
|
|
* Structure used to wait for workqueue flush.
|
|
*/
|
|
struct wq_flusher {
|
|
struct list_head list; /* WQ: list of flushers */
|
|
int flush_color; /* WQ: flush color waiting for */
|
|
struct completion done; /* flush completion */
|
|
};
|
|
|
|
struct wq_device;
|
|
|
|
/*
|
|
* The externally visible workqueue. It relays the issued work items to
|
|
* the appropriate worker_pool through its pool_workqueues.
|
|
*/
|
|
struct workqueue_struct {
|
|
struct list_head pwqs; /* WR: all pwqs of this wq */
|
|
struct list_head list; /* PR: list of all workqueues */
|
|
|
|
struct mutex mutex; /* protects this wq */
|
|
int work_color; /* WQ: current work color */
|
|
int flush_color; /* WQ: current flush color */
|
|
atomic_t nr_pwqs_to_flush; /* flush in progress */
|
|
struct wq_flusher *first_flusher; /* WQ: first flusher */
|
|
struct list_head flusher_queue; /* WQ: flush waiters */
|
|
struct list_head flusher_overflow; /* WQ: flush overflow list */
|
|
|
|
struct list_head maydays; /* MD: pwqs requesting rescue */
|
|
struct worker *rescuer; /* MD: rescue worker */
|
|
|
|
int nr_drainers; /* WQ: drain in progress */
|
|
int saved_max_active; /* WQ: saved pwq max_active */
|
|
|
|
struct workqueue_attrs *unbound_attrs; /* PW: only for unbound wqs */
|
|
struct pool_workqueue *dfl_pwq; /* PW: only for unbound wqs */
|
|
|
|
#ifdef CONFIG_SYSFS
|
|
struct wq_device *wq_dev; /* I: for sysfs interface */
|
|
#endif
|
|
#ifdef CONFIG_LOCKDEP
|
|
char *lock_name;
|
|
struct lock_class_key key;
|
|
struct lockdep_map lockdep_map;
|
|
#endif
|
|
char name[WQ_NAME_LEN]; /* I: workqueue name */
|
|
|
|
/*
|
|
* Destruction of workqueue_struct is RCU protected to allow walking
|
|
* the workqueues list without grabbing wq_pool_mutex.
|
|
* This is used to dump all workqueues from sysrq.
|
|
*/
|
|
struct rcu_head rcu;
|
|
|
|
/* hot fields used during command issue, aligned to cacheline */
|
|
unsigned int flags ____cacheline_aligned; /* WQ: WQ_* flags */
|
|
struct pool_workqueue __percpu *cpu_pwqs; /* I: per-cpu pwqs */
|
|
struct pool_workqueue __rcu *numa_pwq_tbl[]; /* PWR: unbound pwqs indexed by node */
|
|
};
|
|
|
|
static struct kmem_cache *pwq_cache;
|
|
|
|
static cpumask_var_t *wq_numa_possible_cpumask;
|
|
/* possible CPUs of each node */
|
|
|
|
static bool wq_disable_numa;
|
|
module_param_named(disable_numa, wq_disable_numa, bool, 0444);
|
|
|
|
/* see the comment above the definition of WQ_POWER_EFFICIENT */
|
|
static bool wq_power_efficient = IS_ENABLED(CONFIG_WQ_POWER_EFFICIENT_DEFAULT);
|
|
module_param_named(power_efficient, wq_power_efficient, bool, 0444);
|
|
|
|
static bool wq_online; /* can kworkers be created yet? */
|
|
|
|
static bool wq_numa_enabled; /* unbound NUMA affinity enabled */
|
|
|
|
/* buf for wq_update_unbound_numa_attrs(), protected by CPU hotplug exclusion */
|
|
static struct workqueue_attrs *wq_update_unbound_numa_attrs_buf;
|
|
|
|
static DEFINE_MUTEX(wq_pool_mutex); /* protects pools and workqueues list */
|
|
static DEFINE_MUTEX(wq_pool_attach_mutex); /* protects worker attach/detach */
|
|
static DEFINE_RAW_SPINLOCK(wq_mayday_lock); /* protects wq->maydays list */
|
|
/* wait for manager to go away */
|
|
static struct rcuwait manager_wait = __RCUWAIT_INITIALIZER(manager_wait);
|
|
|
|
static LIST_HEAD(workqueues); /* PR: list of all workqueues */
|
|
static bool workqueue_freezing; /* PL: have wqs started freezing? */
|
|
|
|
/* PL: allowable cpus for unbound wqs and work items */
|
|
static cpumask_var_t wq_unbound_cpumask;
|
|
|
|
/* CPU where unbound work was last round robin scheduled from this CPU */
|
|
static DEFINE_PER_CPU(int, wq_rr_cpu_last);
|
|
|
|
/*
|
|
* Local execution of unbound work items is no longer guaranteed. The
|
|
* following always forces round-robin CPU selection on unbound work items
|
|
* to uncover usages which depend on it.
|
|
*/
|
|
#ifdef CONFIG_DEBUG_WQ_FORCE_RR_CPU
|
|
static bool wq_debug_force_rr_cpu = true;
|
|
#else
|
|
static bool wq_debug_force_rr_cpu = false;
|
|
#endif
|
|
module_param_named(debug_force_rr_cpu, wq_debug_force_rr_cpu, bool, 0644);
|
|
|
|
/* the per-cpu worker pools */
|
|
static DEFINE_PER_CPU_SHARED_ALIGNED(struct worker_pool [NR_STD_WORKER_POOLS], cpu_worker_pools);
|
|
|
|
static DEFINE_IDR(worker_pool_idr); /* PR: idr of all pools */
|
|
|
|
/* PL: hash of all unbound pools keyed by pool->attrs */
|
|
static DEFINE_HASHTABLE(unbound_pool_hash, UNBOUND_POOL_HASH_ORDER);
|
|
|
|
/* I: attributes used when instantiating standard unbound pools on demand */
|
|
static struct workqueue_attrs *unbound_std_wq_attrs[NR_STD_WORKER_POOLS];
|
|
|
|
/* I: attributes used when instantiating ordered pools on demand */
|
|
static struct workqueue_attrs *ordered_wq_attrs[NR_STD_WORKER_POOLS];
|
|
|
|
struct workqueue_struct *system_wq __read_mostly;
|
|
EXPORT_SYMBOL(system_wq);
|
|
struct workqueue_struct *system_highpri_wq __read_mostly;
|
|
EXPORT_SYMBOL_GPL(system_highpri_wq);
|
|
struct workqueue_struct *system_long_wq __read_mostly;
|
|
EXPORT_SYMBOL_GPL(system_long_wq);
|
|
struct workqueue_struct *system_unbound_wq __read_mostly;
|
|
EXPORT_SYMBOL_GPL(system_unbound_wq);
|
|
struct workqueue_struct *system_freezable_wq __read_mostly;
|
|
EXPORT_SYMBOL_GPL(system_freezable_wq);
|
|
struct workqueue_struct *system_power_efficient_wq __read_mostly;
|
|
EXPORT_SYMBOL_GPL(system_power_efficient_wq);
|
|
struct workqueue_struct *system_freezable_power_efficient_wq __read_mostly;
|
|
EXPORT_SYMBOL_GPL(system_freezable_power_efficient_wq);
|
|
|
|
static int worker_thread(void *__worker);
|
|
static void workqueue_sysfs_unregister(struct workqueue_struct *wq);
|
|
static void show_pwq(struct pool_workqueue *pwq);
|
|
|
|
#define CREATE_TRACE_POINTS
|
|
#include <trace/events/workqueue.h>
|
|
|
|
EXPORT_TRACEPOINT_SYMBOL_GPL(workqueue_execute_start);
|
|
EXPORT_TRACEPOINT_SYMBOL_GPL(workqueue_execute_end);
|
|
|
|
#define assert_rcu_or_pool_mutex() \
|
|
RCU_LOCKDEP_WARN(!rcu_read_lock_held() && \
|
|
!lockdep_is_held(&wq_pool_mutex), \
|
|
"RCU or wq_pool_mutex should be held")
|
|
|
|
#define assert_rcu_or_wq_mutex_or_pool_mutex(wq) \
|
|
RCU_LOCKDEP_WARN(!rcu_read_lock_held() && \
|
|
!lockdep_is_held(&wq->mutex) && \
|
|
!lockdep_is_held(&wq_pool_mutex), \
|
|
"RCU, wq->mutex or wq_pool_mutex should be held")
|
|
|
|
#define for_each_cpu_worker_pool(pool, cpu) \
|
|
for ((pool) = &per_cpu(cpu_worker_pools, cpu)[0]; \
|
|
(pool) < &per_cpu(cpu_worker_pools, cpu)[NR_STD_WORKER_POOLS]; \
|
|
(pool)++)
|
|
|
|
/**
|
|
* for_each_pool - iterate through all worker_pools in the system
|
|
* @pool: iteration cursor
|
|
* @pi: integer used for iteration
|
|
*
|
|
* This must be called either with wq_pool_mutex held or RCU read
|
|
* locked. If the pool needs to be used beyond the locking in effect, the
|
|
* caller is responsible for guaranteeing that the pool stays online.
|
|
*
|
|
* The if/else clause exists only for the lockdep assertion and can be
|
|
* ignored.
|
|
*/
|
|
#define for_each_pool(pool, pi) \
|
|
idr_for_each_entry(&worker_pool_idr, pool, pi) \
|
|
if (({ assert_rcu_or_pool_mutex(); false; })) { } \
|
|
else
|
|
|
|
/**
|
|
* for_each_pool_worker - iterate through all workers of a worker_pool
|
|
* @worker: iteration cursor
|
|
* @pool: worker_pool to iterate workers of
|
|
*
|
|
* This must be called with wq_pool_attach_mutex.
|
|
*
|
|
* The if/else clause exists only for the lockdep assertion and can be
|
|
* ignored.
|
|
*/
|
|
#define for_each_pool_worker(worker, pool) \
|
|
list_for_each_entry((worker), &(pool)->workers, node) \
|
|
if (({ lockdep_assert_held(&wq_pool_attach_mutex); false; })) { } \
|
|
else
|
|
|
|
/**
|
|
* for_each_pwq - iterate through all pool_workqueues of the specified workqueue
|
|
* @pwq: iteration cursor
|
|
* @wq: the target workqueue
|
|
*
|
|
* This must be called either with wq->mutex held or RCU read locked.
|
|
* If the pwq needs to be used beyond the locking in effect, the caller is
|
|
* responsible for guaranteeing that the pwq stays online.
|
|
*
|
|
* The if/else clause exists only for the lockdep assertion and can be
|
|
* ignored.
|
|
*/
|
|
#define for_each_pwq(pwq, wq) \
|
|
list_for_each_entry_rcu((pwq), &(wq)->pwqs, pwqs_node, \
|
|
lockdep_is_held(&(wq->mutex)))
|
|
|
|
#ifdef CONFIG_DEBUG_OBJECTS_WORK
|
|
|
|
static const struct debug_obj_descr work_debug_descr;
|
|
|
|
static void *work_debug_hint(void *addr)
|
|
{
|
|
return ((struct work_struct *) addr)->func;
|
|
}
|
|
|
|
static bool work_is_static_object(void *addr)
|
|
{
|
|
struct work_struct *work = addr;
|
|
|
|
return test_bit(WORK_STRUCT_STATIC_BIT, work_data_bits(work));
|
|
}
|
|
|
|
/*
|
|
* fixup_init is called when:
|
|
* - an active object is initialized
|
|
*/
|
|
static bool work_fixup_init(void *addr, enum debug_obj_state state)
|
|
{
|
|
struct work_struct *work = addr;
|
|
|
|
switch (state) {
|
|
case ODEBUG_STATE_ACTIVE:
|
|
cancel_work_sync(work);
|
|
debug_object_init(work, &work_debug_descr);
|
|
return true;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/*
|
|
* fixup_free is called when:
|
|
* - an active object is freed
|
|
*/
|
|
static bool work_fixup_free(void *addr, enum debug_obj_state state)
|
|
{
|
|
struct work_struct *work = addr;
|
|
|
|
switch (state) {
|
|
case ODEBUG_STATE_ACTIVE:
|
|
cancel_work_sync(work);
|
|
debug_object_free(work, &work_debug_descr);
|
|
return true;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
|
|
static const struct debug_obj_descr work_debug_descr = {
|
|
.name = "work_struct",
|
|
.debug_hint = work_debug_hint,
|
|
.is_static_object = work_is_static_object,
|
|
.fixup_init = work_fixup_init,
|
|
.fixup_free = work_fixup_free,
|
|
};
|
|
|
|
static inline void debug_work_activate(struct work_struct *work)
|
|
{
|
|
debug_object_activate(work, &work_debug_descr);
|
|
}
|
|
|
|
static inline void debug_work_deactivate(struct work_struct *work)
|
|
{
|
|
debug_object_deactivate(work, &work_debug_descr);
|
|
}
|
|
|
|
void __init_work(struct work_struct *work, int onstack)
|
|
{
|
|
if (onstack)
|
|
debug_object_init_on_stack(work, &work_debug_descr);
|
|
else
|
|
debug_object_init(work, &work_debug_descr);
|
|
}
|
|
EXPORT_SYMBOL_GPL(__init_work);
|
|
|
|
void destroy_work_on_stack(struct work_struct *work)
|
|
{
|
|
debug_object_free(work, &work_debug_descr);
|
|
}
|
|
EXPORT_SYMBOL_GPL(destroy_work_on_stack);
|
|
|
|
void destroy_delayed_work_on_stack(struct delayed_work *work)
|
|
{
|
|
destroy_timer_on_stack(&work->timer);
|
|
debug_object_free(&work->work, &work_debug_descr);
|
|
}
|
|
EXPORT_SYMBOL_GPL(destroy_delayed_work_on_stack);
|
|
|
|
#else
|
|
static inline void debug_work_activate(struct work_struct *work) { }
|
|
static inline void debug_work_deactivate(struct work_struct *work) { }
|
|
#endif
|
|
|
|
/**
|
|
* worker_pool_assign_id - allocate ID and assing it to @pool
|
|
* @pool: the pool pointer of interest
|
|
*
|
|
* Returns 0 if ID in [0, WORK_OFFQ_POOL_NONE) is allocated and assigned
|
|
* successfully, -errno on failure.
|
|
*/
|
|
static int worker_pool_assign_id(struct worker_pool *pool)
|
|
{
|
|
int ret;
|
|
|
|
lockdep_assert_held(&wq_pool_mutex);
|
|
|
|
ret = idr_alloc(&worker_pool_idr, pool, 0, WORK_OFFQ_POOL_NONE,
|
|
GFP_KERNEL);
|
|
if (ret >= 0) {
|
|
pool->id = ret;
|
|
return 0;
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
/**
|
|
* unbound_pwq_by_node - return the unbound pool_workqueue for the given node
|
|
* @wq: the target workqueue
|
|
* @node: the node ID
|
|
*
|
|
* This must be called with any of wq_pool_mutex, wq->mutex or RCU
|
|
* read locked.
|
|
* If the pwq needs to be used beyond the locking in effect, the caller is
|
|
* responsible for guaranteeing that the pwq stays online.
|
|
*
|
|
* Return: The unbound pool_workqueue for @node.
|
|
*/
|
|
static struct pool_workqueue *unbound_pwq_by_node(struct workqueue_struct *wq,
|
|
int node)
|
|
{
|
|
assert_rcu_or_wq_mutex_or_pool_mutex(wq);
|
|
|
|
/*
|
|
* XXX: @node can be NUMA_NO_NODE if CPU goes offline while a
|
|
* delayed item is pending. The plan is to keep CPU -> NODE
|
|
* mapping valid and stable across CPU on/offlines. Once that
|
|
* happens, this workaround can be removed.
|
|
*/
|
|
if (unlikely(node == NUMA_NO_NODE))
|
|
return wq->dfl_pwq;
|
|
|
|
return rcu_dereference_raw(wq->numa_pwq_tbl[node]);
|
|
}
|
|
|
|
static unsigned int work_color_to_flags(int color)
|
|
{
|
|
return color << WORK_STRUCT_COLOR_SHIFT;
|
|
}
|
|
|
|
static int get_work_color(struct work_struct *work)
|
|
{
|
|
return (*work_data_bits(work) >> WORK_STRUCT_COLOR_SHIFT) &
|
|
((1 << WORK_STRUCT_COLOR_BITS) - 1);
|
|
}
|
|
|
|
static int work_next_color(int color)
|
|
{
|
|
return (color + 1) % WORK_NR_COLORS;
|
|
}
|
|
|
|
/*
|
|
* While queued, %WORK_STRUCT_PWQ is set and non flag bits of a work's data
|
|
* contain the pointer to the queued pwq. Once execution starts, the flag
|
|
* is cleared and the high bits contain OFFQ flags and pool ID.
|
|
*
|
|
* set_work_pwq(), set_work_pool_and_clear_pending(), mark_work_canceling()
|
|
* and clear_work_data() can be used to set the pwq, pool or clear
|
|
* work->data. These functions should only be called while the work is
|
|
* owned - ie. while the PENDING bit is set.
|
|
*
|
|
* get_work_pool() and get_work_pwq() can be used to obtain the pool or pwq
|
|
* corresponding to a work. Pool is available once the work has been
|
|
* queued anywhere after initialization until it is sync canceled. pwq is
|
|
* available only while the work item is queued.
|
|
*
|
|
* %WORK_OFFQ_CANCELING is used to mark a work item which is being
|
|
* canceled. While being canceled, a work item may have its PENDING set
|
|
* but stay off timer and worklist for arbitrarily long and nobody should
|
|
* try to steal the PENDING bit.
|
|
*/
|
|
static inline void set_work_data(struct work_struct *work, unsigned long data,
|
|
unsigned long flags)
|
|
{
|
|
WARN_ON_ONCE(!work_pending(work));
|
|
atomic_long_set(&work->data, data | flags | work_static(work));
|
|
}
|
|
|
|
static void set_work_pwq(struct work_struct *work, struct pool_workqueue *pwq,
|
|
unsigned long extra_flags)
|
|
{
|
|
set_work_data(work, (unsigned long)pwq,
|
|
WORK_STRUCT_PENDING | WORK_STRUCT_PWQ | extra_flags);
|
|
}
|
|
|
|
static void set_work_pool_and_keep_pending(struct work_struct *work,
|
|
int pool_id)
|
|
{
|
|
set_work_data(work, (unsigned long)pool_id << WORK_OFFQ_POOL_SHIFT,
|
|
WORK_STRUCT_PENDING);
|
|
}
|
|
|
|
static void set_work_pool_and_clear_pending(struct work_struct *work,
|
|
int pool_id)
|
|
{
|
|
/*
|
|
* The following wmb is paired with the implied mb in
|
|
* test_and_set_bit(PENDING) and ensures all updates to @work made
|
|
* here are visible to and precede any updates by the next PENDING
|
|
* owner.
|
|
*/
|
|
smp_wmb();
|
|
set_work_data(work, (unsigned long)pool_id << WORK_OFFQ_POOL_SHIFT, 0);
|
|
/*
|
|
* The following mb guarantees that previous clear of a PENDING bit
|
|
* will not be reordered with any speculative LOADS or STORES from
|
|
* work->current_func, which is executed afterwards. This possible
|
|
* reordering can lead to a missed execution on attempt to queue
|
|
* the same @work. E.g. consider this case:
|
|
*
|
|
* CPU#0 CPU#1
|
|
* ---------------------------- --------------------------------
|
|
*
|
|
* 1 STORE event_indicated
|
|
* 2 queue_work_on() {
|
|
* 3 test_and_set_bit(PENDING)
|
|
* 4 } set_..._and_clear_pending() {
|
|
* 5 set_work_data() # clear bit
|
|
* 6 smp_mb()
|
|
* 7 work->current_func() {
|
|
* 8 LOAD event_indicated
|
|
* }
|
|
*
|
|
* Without an explicit full barrier speculative LOAD on line 8 can
|
|
* be executed before CPU#0 does STORE on line 1. If that happens,
|
|
* CPU#0 observes the PENDING bit is still set and new execution of
|
|
* a @work is not queued in a hope, that CPU#1 will eventually
|
|
* finish the queued @work. Meanwhile CPU#1 does not see
|
|
* event_indicated is set, because speculative LOAD was executed
|
|
* before actual STORE.
|
|
*/
|
|
smp_mb();
|
|
}
|
|
|
|
static void clear_work_data(struct work_struct *work)
|
|
{
|
|
smp_wmb(); /* see set_work_pool_and_clear_pending() */
|
|
set_work_data(work, WORK_STRUCT_NO_POOL, 0);
|
|
}
|
|
|
|
static struct pool_workqueue *get_work_pwq(struct work_struct *work)
|
|
{
|
|
unsigned long data = atomic_long_read(&work->data);
|
|
|
|
if (data & WORK_STRUCT_PWQ)
|
|
return (void *)(data & WORK_STRUCT_WQ_DATA_MASK);
|
|
else
|
|
return NULL;
|
|
}
|
|
|
|
/**
|
|
* get_work_pool - return the worker_pool a given work was associated with
|
|
* @work: the work item of interest
|
|
*
|
|
* Pools are created and destroyed under wq_pool_mutex, and allows read
|
|
* access under RCU read lock. As such, this function should be
|
|
* called under wq_pool_mutex or inside of a rcu_read_lock() region.
|
|
*
|
|
* All fields of the returned pool are accessible as long as the above
|
|
* mentioned locking is in effect. If the returned pool needs to be used
|
|
* beyond the critical section, the caller is responsible for ensuring the
|
|
* returned pool is and stays online.
|
|
*
|
|
* Return: The worker_pool @work was last associated with. %NULL if none.
|
|
*/
|
|
static struct worker_pool *get_work_pool(struct work_struct *work)
|
|
{
|
|
unsigned long data = atomic_long_read(&work->data);
|
|
int pool_id;
|
|
|
|
assert_rcu_or_pool_mutex();
|
|
|
|
if (data & WORK_STRUCT_PWQ)
|
|
return ((struct pool_workqueue *)
|
|
(data & WORK_STRUCT_WQ_DATA_MASK))->pool;
|
|
|
|
pool_id = data >> WORK_OFFQ_POOL_SHIFT;
|
|
if (pool_id == WORK_OFFQ_POOL_NONE)
|
|
return NULL;
|
|
|
|
return idr_find(&worker_pool_idr, pool_id);
|
|
}
|
|
|
|
/**
|
|
* get_work_pool_id - return the worker pool ID a given work is associated with
|
|
* @work: the work item of interest
|
|
*
|
|
* Return: The worker_pool ID @work was last associated with.
|
|
* %WORK_OFFQ_POOL_NONE if none.
|
|
*/
|
|
static int get_work_pool_id(struct work_struct *work)
|
|
{
|
|
unsigned long data = atomic_long_read(&work->data);
|
|
|
|
if (data & WORK_STRUCT_PWQ)
|
|
return ((struct pool_workqueue *)
|
|
(data & WORK_STRUCT_WQ_DATA_MASK))->pool->id;
|
|
|
|
return data >> WORK_OFFQ_POOL_SHIFT;
|
|
}
|
|
|
|
static void mark_work_canceling(struct work_struct *work)
|
|
{
|
|
unsigned long pool_id = get_work_pool_id(work);
|
|
|
|
pool_id <<= WORK_OFFQ_POOL_SHIFT;
|
|
set_work_data(work, pool_id | WORK_OFFQ_CANCELING, WORK_STRUCT_PENDING);
|
|
}
|
|
|
|
static bool work_is_canceling(struct work_struct *work)
|
|
{
|
|
unsigned long data = atomic_long_read(&work->data);
|
|
|
|
return !(data & WORK_STRUCT_PWQ) && (data & WORK_OFFQ_CANCELING);
|
|
}
|
|
|
|
/*
|
|
* Policy functions. These define the policies on how the global worker
|
|
* pools are managed. Unless noted otherwise, these functions assume that
|
|
* they're being called with pool->lock held.
|
|
*/
|
|
|
|
static bool __need_more_worker(struct worker_pool *pool)
|
|
{
|
|
return !atomic_read(&pool->nr_running);
|
|
}
|
|
|
|
/*
|
|
* Need to wake up a worker? Called from anything but currently
|
|
* running workers.
|
|
*
|
|
* Note that, because unbound workers never contribute to nr_running, this
|
|
* function will always return %true for unbound pools as long as the
|
|
* worklist isn't empty.
|
|
*/
|
|
static bool need_more_worker(struct worker_pool *pool)
|
|
{
|
|
return !list_empty(&pool->worklist) && __need_more_worker(pool);
|
|
}
|
|
|
|
/* Can I start working? Called from busy but !running workers. */
|
|
static bool may_start_working(struct worker_pool *pool)
|
|
{
|
|
return pool->nr_idle;
|
|
}
|
|
|
|
/* Do I need to keep working? Called from currently running workers. */
|
|
static bool keep_working(struct worker_pool *pool)
|
|
{
|
|
return !list_empty(&pool->worklist) &&
|
|
atomic_read(&pool->nr_running) <= 1;
|
|
}
|
|
|
|
/* Do we need a new worker? Called from manager. */
|
|
static bool need_to_create_worker(struct worker_pool *pool)
|
|
{
|
|
return need_more_worker(pool) && !may_start_working(pool);
|
|
}
|
|
|
|
/* Do we have too many workers and should some go away? */
|
|
static bool too_many_workers(struct worker_pool *pool)
|
|
{
|
|
bool managing = pool->flags & POOL_MANAGER_ACTIVE;
|
|
int nr_idle = pool->nr_idle + managing; /* manager is considered idle */
|
|
int nr_busy = pool->nr_workers - nr_idle;
|
|
|
|
return nr_idle > 2 && (nr_idle - 2) * MAX_IDLE_WORKERS_RATIO >= nr_busy;
|
|
}
|
|
|
|
/*
|
|
* Wake up functions.
|
|
*/
|
|
|
|
/* Return the first idle worker. Safe with preemption disabled */
|
|
static struct worker *first_idle_worker(struct worker_pool *pool)
|
|
{
|
|
if (unlikely(list_empty(&pool->idle_list)))
|
|
return NULL;
|
|
|
|
return list_first_entry(&pool->idle_list, struct worker, entry);
|
|
}
|
|
|
|
/**
|
|
* wake_up_worker - wake up an idle worker
|
|
* @pool: worker pool to wake worker from
|
|
*
|
|
* Wake up the first idle worker of @pool.
|
|
*
|
|
* CONTEXT:
|
|
* raw_spin_lock_irq(pool->lock).
|
|
*/
|
|
static void wake_up_worker(struct worker_pool *pool)
|
|
{
|
|
struct worker *worker = first_idle_worker(pool);
|
|
|
|
if (likely(worker))
|
|
wake_up_process(worker->task);
|
|
}
|
|
|
|
/**
|
|
* wq_worker_running - a worker is running again
|
|
* @task: task waking up
|
|
*
|
|
* This function is called when a worker returns from schedule()
|
|
*/
|
|
void wq_worker_running(struct task_struct *task)
|
|
{
|
|
struct worker *worker = kthread_data(task);
|
|
|
|
if (!worker->sleeping)
|
|
return;
|
|
if (!(worker->flags & WORKER_NOT_RUNNING))
|
|
atomic_inc(&worker->pool->nr_running);
|
|
worker->sleeping = 0;
|
|
}
|
|
|
|
/**
|
|
* wq_worker_sleeping - a worker is going to sleep
|
|
* @task: task going to sleep
|
|
*
|
|
* This function is called from schedule() when a busy worker is
|
|
* going to sleep. Preemption needs to be disabled to protect ->sleeping
|
|
* assignment.
|
|
*/
|
|
void wq_worker_sleeping(struct task_struct *task)
|
|
{
|
|
struct worker *next, *worker = kthread_data(task);
|
|
struct worker_pool *pool;
|
|
|
|
/*
|
|
* Rescuers, which may not have all the fields set up like normal
|
|
* workers, also reach here, let's not access anything before
|
|
* checking NOT_RUNNING.
|
|
*/
|
|
if (worker->flags & WORKER_NOT_RUNNING)
|
|
return;
|
|
|
|
pool = worker->pool;
|
|
|
|
/* Return if preempted before wq_worker_running() was reached */
|
|
if (worker->sleeping)
|
|
return;
|
|
|
|
worker->sleeping = 1;
|
|
raw_spin_lock_irq(&pool->lock);
|
|
|
|
/*
|
|
* The counterpart of the following dec_and_test, implied mb,
|
|
* worklist not empty test sequence is in insert_work().
|
|
* Please read comment there.
|
|
*
|
|
* NOT_RUNNING is clear. This means that we're bound to and
|
|
* running on the local cpu w/ rq lock held and preemption
|
|
* disabled, which in turn means that none else could be
|
|
* manipulating idle_list, so dereferencing idle_list without pool
|
|
* lock is safe.
|
|
*/
|
|
if (atomic_dec_and_test(&pool->nr_running) &&
|
|
!list_empty(&pool->worklist)) {
|
|
next = first_idle_worker(pool);
|
|
if (next)
|
|
wake_up_process(next->task);
|
|
}
|
|
raw_spin_unlock_irq(&pool->lock);
|
|
}
|
|
|
|
/**
|
|
* wq_worker_last_func - retrieve worker's last work function
|
|
* @task: Task to retrieve last work function of.
|
|
*
|
|
* Determine the last function a worker executed. This is called from
|
|
* the scheduler to get a worker's last known identity.
|
|
*
|
|
* CONTEXT:
|
|
* raw_spin_lock_irq(rq->lock)
|
|
*
|
|
* This function is called during schedule() when a kworker is going
|
|
* to sleep. It's used by psi to identify aggregation workers during
|
|
* dequeuing, to allow periodic aggregation to shut-off when that
|
|
* worker is the last task in the system or cgroup to go to sleep.
|
|
*
|
|
* As this function doesn't involve any workqueue-related locking, it
|
|
* only returns stable values when called from inside the scheduler's
|
|
* queuing and dequeuing paths, when @task, which must be a kworker,
|
|
* is guaranteed to not be processing any works.
|
|
*
|
|
* Return:
|
|
* The last work function %current executed as a worker, NULL if it
|
|
* hasn't executed any work yet.
|
|
*/
|
|
work_func_t wq_worker_last_func(struct task_struct *task)
|
|
{
|
|
struct worker *worker = kthread_data(task);
|
|
|
|
return worker->last_func;
|
|
}
|
|
|
|
/**
|
|
* worker_set_flags - set worker flags and adjust nr_running accordingly
|
|
* @worker: self
|
|
* @flags: flags to set
|
|
*
|
|
* Set @flags in @worker->flags and adjust nr_running accordingly.
|
|
*
|
|
* CONTEXT:
|
|
* raw_spin_lock_irq(pool->lock)
|
|
*/
|
|
static inline void worker_set_flags(struct worker *worker, unsigned int flags)
|
|
{
|
|
struct worker_pool *pool = worker->pool;
|
|
|
|
WARN_ON_ONCE(worker->task != current);
|
|
|
|
/* If transitioning into NOT_RUNNING, adjust nr_running. */
|
|
if ((flags & WORKER_NOT_RUNNING) &&
|
|
!(worker->flags & WORKER_NOT_RUNNING)) {
|
|
atomic_dec(&pool->nr_running);
|
|
}
|
|
|
|
worker->flags |= flags;
|
|
}
|
|
|
|
/**
|
|
* worker_clr_flags - clear worker flags and adjust nr_running accordingly
|
|
* @worker: self
|
|
* @flags: flags to clear
|
|
*
|
|
* Clear @flags in @worker->flags and adjust nr_running accordingly.
|
|
*
|
|
* CONTEXT:
|
|
* raw_spin_lock_irq(pool->lock)
|
|
*/
|
|
static inline void worker_clr_flags(struct worker *worker, unsigned int flags)
|
|
{
|
|
struct worker_pool *pool = worker->pool;
|
|
unsigned int oflags = worker->flags;
|
|
|
|
WARN_ON_ONCE(worker->task != current);
|
|
|
|
worker->flags &= ~flags;
|
|
|
|
/*
|
|
* If transitioning out of NOT_RUNNING, increment nr_running. Note
|
|
* that the nested NOT_RUNNING is not a noop. NOT_RUNNING is mask
|
|
* of multiple flags, not a single flag.
|
|
*/
|
|
if ((flags & WORKER_NOT_RUNNING) && (oflags & WORKER_NOT_RUNNING))
|
|
if (!(worker->flags & WORKER_NOT_RUNNING))
|
|
atomic_inc(&pool->nr_running);
|
|
}
|
|
|
|
/**
|
|
* find_worker_executing_work - find worker which is executing a work
|
|
* @pool: pool of interest
|
|
* @work: work to find worker for
|
|
*
|
|
* Find a worker which is executing @work on @pool by searching
|
|
* @pool->busy_hash which is keyed by the address of @work. For a worker
|
|
* to match, its current execution should match the address of @work and
|
|
* its work function. This is to avoid unwanted dependency between
|
|
* unrelated work executions through a work item being recycled while still
|
|
* being executed.
|
|
*
|
|
* This is a bit tricky. A work item may be freed once its execution
|
|
* starts and nothing prevents the freed area from being recycled for
|
|
* another work item. If the same work item address ends up being reused
|
|
* before the original execution finishes, workqueue will identify the
|
|
* recycled work item as currently executing and make it wait until the
|
|
* current execution finishes, introducing an unwanted dependency.
|
|
*
|
|
* This function checks the work item address and work function to avoid
|
|
* false positives. Note that this isn't complete as one may construct a
|
|
* work function which can introduce dependency onto itself through a
|
|
* recycled work item. Well, if somebody wants to shoot oneself in the
|
|
* foot that badly, there's only so much we can do, and if such deadlock
|
|
* actually occurs, it should be easy to locate the culprit work function.
|
|
*
|
|
* CONTEXT:
|
|
* raw_spin_lock_irq(pool->lock).
|
|
*
|
|
* Return:
|
|
* Pointer to worker which is executing @work if found, %NULL
|
|
* otherwise.
|
|
*/
|
|
static struct worker *find_worker_executing_work(struct worker_pool *pool,
|
|
struct work_struct *work)
|
|
{
|
|
struct worker *worker;
|
|
|
|
hash_for_each_possible(pool->busy_hash, worker, hentry,
|
|
(unsigned long)work)
|
|
if (worker->current_work == work &&
|
|
worker->current_func == work->func)
|
|
return worker;
|
|
|
|
return NULL;
|
|
}
|
|
|
|
/**
|
|
* move_linked_works - move linked works to a list
|
|
* @work: start of series of works to be scheduled
|
|
* @head: target list to append @work to
|
|
* @nextp: out parameter for nested worklist walking
|
|
*
|
|
* Schedule linked works starting from @work to @head. Work series to
|
|
* be scheduled starts at @work and includes any consecutive work with
|
|
* WORK_STRUCT_LINKED set in its predecessor.
|
|
*
|
|
* If @nextp is not NULL, it's updated to point to the next work of
|
|
* the last scheduled work. This allows move_linked_works() to be
|
|
* nested inside outer list_for_each_entry_safe().
|
|
*
|
|
* CONTEXT:
|
|
* raw_spin_lock_irq(pool->lock).
|
|
*/
|
|
static void move_linked_works(struct work_struct *work, struct list_head *head,
|
|
struct work_struct **nextp)
|
|
{
|
|
struct work_struct *n;
|
|
|
|
/*
|
|
* Linked worklist will always end before the end of the list,
|
|
* use NULL for list head.
|
|
*/
|
|
list_for_each_entry_safe_from(work, n, NULL, entry) {
|
|
list_move_tail(&work->entry, head);
|
|
if (!(*work_data_bits(work) & WORK_STRUCT_LINKED))
|
|
break;
|
|
}
|
|
|
|
/*
|
|
* If we're already inside safe list traversal and have moved
|
|
* multiple works to the scheduled queue, the next position
|
|
* needs to be updated.
|
|
*/
|
|
if (nextp)
|
|
*nextp = n;
|
|
}
|
|
|
|
/**
|
|
* get_pwq - get an extra reference on the specified pool_workqueue
|
|
* @pwq: pool_workqueue to get
|
|
*
|
|
* Obtain an extra reference on @pwq. The caller should guarantee that
|
|
* @pwq has positive refcnt and be holding the matching pool->lock.
|
|
*/
|
|
static void get_pwq(struct pool_workqueue *pwq)
|
|
{
|
|
lockdep_assert_held(&pwq->pool->lock);
|
|
WARN_ON_ONCE(pwq->refcnt <= 0);
|
|
pwq->refcnt++;
|
|
}
|
|
|
|
/**
|
|
* put_pwq - put a pool_workqueue reference
|
|
* @pwq: pool_workqueue to put
|
|
*
|
|
* Drop a reference of @pwq. If its refcnt reaches zero, schedule its
|
|
* destruction. The caller should be holding the matching pool->lock.
|
|
*/
|
|
static void put_pwq(struct pool_workqueue *pwq)
|
|
{
|
|
lockdep_assert_held(&pwq->pool->lock);
|
|
if (likely(--pwq->refcnt))
|
|
return;
|
|
if (WARN_ON_ONCE(!(pwq->wq->flags & WQ_UNBOUND)))
|
|
return;
|
|
/*
|
|
* @pwq can't be released under pool->lock, bounce to
|
|
* pwq_unbound_release_workfn(). This never recurses on the same
|
|
* pool->lock as this path is taken only for unbound workqueues and
|
|
* the release work item is scheduled on a per-cpu workqueue. To
|
|
* avoid lockdep warning, unbound pool->locks are given lockdep
|
|
* subclass of 1 in get_unbound_pool().
|
|
*/
|
|
schedule_work(&pwq->unbound_release_work);
|
|
}
|
|
|
|
/**
|
|
* put_pwq_unlocked - put_pwq() with surrounding pool lock/unlock
|
|
* @pwq: pool_workqueue to put (can be %NULL)
|
|
*
|
|
* put_pwq() with locking. This function also allows %NULL @pwq.
|
|
*/
|
|
static void put_pwq_unlocked(struct pool_workqueue *pwq)
|
|
{
|
|
if (pwq) {
|
|
/*
|
|
* As both pwqs and pools are RCU protected, the
|
|
* following lock operations are safe.
|
|
*/
|
|
raw_spin_lock_irq(&pwq->pool->lock);
|
|
put_pwq(pwq);
|
|
raw_spin_unlock_irq(&pwq->pool->lock);
|
|
}
|
|
}
|
|
|
|
static void pwq_activate_delayed_work(struct work_struct *work)
|
|
{
|
|
struct pool_workqueue *pwq = get_work_pwq(work);
|
|
|
|
trace_workqueue_activate_work(work);
|
|
if (list_empty(&pwq->pool->worklist))
|
|
pwq->pool->watchdog_ts = jiffies;
|
|
move_linked_works(work, &pwq->pool->worklist, NULL);
|
|
__clear_bit(WORK_STRUCT_DELAYED_BIT, work_data_bits(work));
|
|
pwq->nr_active++;
|
|
}
|
|
|
|
static void pwq_activate_first_delayed(struct pool_workqueue *pwq)
|
|
{
|
|
struct work_struct *work = list_first_entry(&pwq->delayed_works,
|
|
struct work_struct, entry);
|
|
|
|
pwq_activate_delayed_work(work);
|
|
}
|
|
|
|
/**
|
|
* pwq_dec_nr_in_flight - decrement pwq's nr_in_flight
|
|
* @pwq: pwq of interest
|
|
* @color: color of work which left the queue
|
|
*
|
|
* A work either has completed or is removed from pending queue,
|
|
* decrement nr_in_flight of its pwq and handle workqueue flushing.
|
|
*
|
|
* CONTEXT:
|
|
* raw_spin_lock_irq(pool->lock).
|
|
*/
|
|
static void pwq_dec_nr_in_flight(struct pool_workqueue *pwq, int color)
|
|
{
|
|
/* uncolored work items don't participate in flushing or nr_active */
|
|
if (color == WORK_NO_COLOR)
|
|
goto out_put;
|
|
|
|
pwq->nr_in_flight[color]--;
|
|
|
|
pwq->nr_active--;
|
|
if (!list_empty(&pwq->delayed_works)) {
|
|
/* one down, submit a delayed one */
|
|
if (pwq->nr_active < pwq->max_active)
|
|
pwq_activate_first_delayed(pwq);
|
|
}
|
|
|
|
/* is flush in progress and are we at the flushing tip? */
|
|
if (likely(pwq->flush_color != color))
|
|
goto out_put;
|
|
|
|
/* are there still in-flight works? */
|
|
if (pwq->nr_in_flight[color])
|
|
goto out_put;
|
|
|
|
/* this pwq is done, clear flush_color */
|
|
pwq->flush_color = -1;
|
|
|
|
/*
|
|
* If this was the last pwq, wake up the first flusher. It
|
|
* will handle the rest.
|
|
*/
|
|
if (atomic_dec_and_test(&pwq->wq->nr_pwqs_to_flush))
|
|
complete(&pwq->wq->first_flusher->done);
|
|
out_put:
|
|
put_pwq(pwq);
|
|
}
|
|
|
|
/**
|
|
* try_to_grab_pending - steal work item from worklist and disable irq
|
|
* @work: work item to steal
|
|
* @is_dwork: @work is a delayed_work
|
|
* @flags: place to store irq state
|
|
*
|
|
* Try to grab PENDING bit of @work. This function can handle @work in any
|
|
* stable state - idle, on timer or on worklist.
|
|
*
|
|
* Return:
|
|
*
|
|
* ======== ================================================================
|
|
* 1 if @work was pending and we successfully stole PENDING
|
|
* 0 if @work was idle and we claimed PENDING
|
|
* -EAGAIN if PENDING couldn't be grabbed at the moment, safe to busy-retry
|
|
* -ENOENT if someone else is canceling @work, this state may persist
|
|
* for arbitrarily long
|
|
* ======== ================================================================
|
|
*
|
|
* Note:
|
|
* On >= 0 return, the caller owns @work's PENDING bit. To avoid getting
|
|
* interrupted while holding PENDING and @work off queue, irq must be
|
|
* disabled on entry. This, combined with delayed_work->timer being
|
|
* irqsafe, ensures that we return -EAGAIN for finite short period of time.
|
|
*
|
|
* On successful return, >= 0, irq is disabled and the caller is
|
|
* responsible for releasing it using local_irq_restore(*@flags).
|
|
*
|
|
* This function is safe to call from any context including IRQ handler.
|
|
*/
|
|
static int try_to_grab_pending(struct work_struct *work, bool is_dwork,
|
|
unsigned long *flags)
|
|
{
|
|
struct worker_pool *pool;
|
|
struct pool_workqueue *pwq;
|
|
|
|
local_irq_save(*flags);
|
|
|
|
/* try to steal the timer if it exists */
|
|
if (is_dwork) {
|
|
struct delayed_work *dwork = to_delayed_work(work);
|
|
|
|
/*
|
|
* dwork->timer is irqsafe. If del_timer() fails, it's
|
|
* guaranteed that the timer is not queued anywhere and not
|
|
* running on the local CPU.
|
|
*/
|
|
if (likely(del_timer(&dwork->timer)))
|
|
return 1;
|
|
}
|
|
|
|
/* try to claim PENDING the normal way */
|
|
if (!test_and_set_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(work)))
|
|
return 0;
|
|
|
|
rcu_read_lock();
|
|
/*
|
|
* The queueing is in progress, or it is already queued. Try to
|
|
* steal it from ->worklist without clearing WORK_STRUCT_PENDING.
|
|
*/
|
|
pool = get_work_pool(work);
|
|
if (!pool)
|
|
goto fail;
|
|
|
|
raw_spin_lock(&pool->lock);
|
|
/*
|
|
* work->data is guaranteed to point to pwq only while the work
|
|
* item is queued on pwq->wq, and both updating work->data to point
|
|
* to pwq on queueing and to pool on dequeueing are done under
|
|
* pwq->pool->lock. This in turn guarantees that, if work->data
|
|
* points to pwq which is associated with a locked pool, the work
|
|
* item is currently queued on that pool.
|
|
*/
|
|
pwq = get_work_pwq(work);
|
|
if (pwq && pwq->pool == pool) {
|
|
debug_work_deactivate(work);
|
|
|
|
/*
|
|
* A delayed work item cannot be grabbed directly because
|
|
* it might have linked NO_COLOR work items which, if left
|
|
* on the delayed_list, will confuse pwq->nr_active
|
|
* management later on and cause stall. Make sure the work
|
|
* item is activated before grabbing.
|
|
*/
|
|
if (*work_data_bits(work) & WORK_STRUCT_DELAYED)
|
|
pwq_activate_delayed_work(work);
|
|
|
|
list_del_init(&work->entry);
|
|
pwq_dec_nr_in_flight(pwq, get_work_color(work));
|
|
|
|
/* work->data points to pwq iff queued, point to pool */
|
|
set_work_pool_and_keep_pending(work, pool->id);
|
|
|
|
raw_spin_unlock(&pool->lock);
|
|
rcu_read_unlock();
|
|
return 1;
|
|
}
|
|
raw_spin_unlock(&pool->lock);
|
|
fail:
|
|
rcu_read_unlock();
|
|
local_irq_restore(*flags);
|
|
if (work_is_canceling(work))
|
|
return -ENOENT;
|
|
cpu_relax();
|
|
return -EAGAIN;
|
|
}
|
|
|
|
/**
|
|
* insert_work - insert a work into a pool
|
|
* @pwq: pwq @work belongs to
|
|
* @work: work to insert
|
|
* @head: insertion point
|
|
* @extra_flags: extra WORK_STRUCT_* flags to set
|
|
*
|
|
* Insert @work which belongs to @pwq after @head. @extra_flags is or'd to
|
|
* work_struct flags.
|
|
*
|
|
* CONTEXT:
|
|
* raw_spin_lock_irq(pool->lock).
|
|
*/
|
|
static void insert_work(struct pool_workqueue *pwq, struct work_struct *work,
|
|
struct list_head *head, unsigned int extra_flags)
|
|
{
|
|
struct worker_pool *pool = pwq->pool;
|
|
|
|
/* record the work call stack in order to print it in KASAN reports */
|
|
kasan_record_aux_stack(work);
|
|
|
|
/* we own @work, set data and link */
|
|
set_work_pwq(work, pwq, extra_flags);
|
|
list_add_tail(&work->entry, head);
|
|
get_pwq(pwq);
|
|
|
|
/*
|
|
* Ensure either wq_worker_sleeping() sees the above
|
|
* list_add_tail() or we see zero nr_running to avoid workers lying
|
|
* around lazily while there are works to be processed.
|
|
*/
|
|
smp_mb();
|
|
|
|
if (__need_more_worker(pool))
|
|
wake_up_worker(pool);
|
|
}
|
|
|
|
/*
|
|
* Test whether @work is being queued from another work executing on the
|
|
* same workqueue.
|
|
*/
|
|
static bool is_chained_work(struct workqueue_struct *wq)
|
|
{
|
|
struct worker *worker;
|
|
|
|
worker = current_wq_worker();
|
|
/*
|
|
* Return %true iff I'm a worker executing a work item on @wq. If
|
|
* I'm @worker, it's safe to dereference it without locking.
|
|
*/
|
|
return worker && worker->current_pwq->wq == wq;
|
|
}
|
|
|
|
/*
|
|
* When queueing an unbound work item to a wq, prefer local CPU if allowed
|
|
* by wq_unbound_cpumask. Otherwise, round robin among the allowed ones to
|
|
* avoid perturbing sensitive tasks.
|
|
*/
|
|
static int wq_select_unbound_cpu(int cpu)
|
|
{
|
|
static bool printed_dbg_warning;
|
|
int new_cpu;
|
|
|
|
if (likely(!wq_debug_force_rr_cpu)) {
|
|
if (cpumask_test_cpu(cpu, wq_unbound_cpumask))
|
|
return cpu;
|
|
} else if (!printed_dbg_warning) {
|
|
pr_warn("workqueue: round-robin CPU selection forced, expect performance impact\n");
|
|
printed_dbg_warning = true;
|
|
}
|
|
|
|
if (cpumask_empty(wq_unbound_cpumask))
|
|
return cpu;
|
|
|
|
new_cpu = __this_cpu_read(wq_rr_cpu_last);
|
|
new_cpu = cpumask_next_and(new_cpu, wq_unbound_cpumask, cpu_online_mask);
|
|
if (unlikely(new_cpu >= nr_cpu_ids)) {
|
|
new_cpu = cpumask_first_and(wq_unbound_cpumask, cpu_online_mask);
|
|
if (unlikely(new_cpu >= nr_cpu_ids))
|
|
return cpu;
|
|
}
|
|
__this_cpu_write(wq_rr_cpu_last, new_cpu);
|
|
|
|
return new_cpu;
|
|
}
|
|
|
|
static void __queue_work(int cpu, struct workqueue_struct *wq,
|
|
struct work_struct *work)
|
|
{
|
|
struct pool_workqueue *pwq;
|
|
struct worker_pool *last_pool;
|
|
struct list_head *worklist;
|
|
unsigned int work_flags;
|
|
unsigned int req_cpu = cpu;
|
|
|
|
/*
|
|
* While a work item is PENDING && off queue, a task trying to
|
|
* steal the PENDING will busy-loop waiting for it to either get
|
|
* queued or lose PENDING. Grabbing PENDING and queueing should
|
|
* happen with IRQ disabled.
|
|
*/
|
|
lockdep_assert_irqs_disabled();
|
|
|
|
|
|
/* if draining, only works from the same workqueue are allowed */
|
|
if (unlikely(wq->flags & __WQ_DRAINING) &&
|
|
WARN_ON_ONCE(!is_chained_work(wq)))
|
|
return;
|
|
rcu_read_lock();
|
|
retry:
|
|
/* pwq which will be used unless @work is executing elsewhere */
|
|
if (wq->flags & WQ_UNBOUND) {
|
|
if (req_cpu == WORK_CPU_UNBOUND)
|
|
cpu = wq_select_unbound_cpu(raw_smp_processor_id());
|
|
pwq = unbound_pwq_by_node(wq, cpu_to_node(cpu));
|
|
} else {
|
|
if (req_cpu == WORK_CPU_UNBOUND)
|
|
cpu = raw_smp_processor_id();
|
|
pwq = per_cpu_ptr(wq->cpu_pwqs, cpu);
|
|
}
|
|
|
|
/*
|
|
* If @work was previously on a different pool, it might still be
|
|
* running there, in which case the work needs to be queued on that
|
|
* pool to guarantee non-reentrancy.
|
|
*/
|
|
last_pool = get_work_pool(work);
|
|
if (last_pool && last_pool != pwq->pool) {
|
|
struct worker *worker;
|
|
|
|
raw_spin_lock(&last_pool->lock);
|
|
|
|
worker = find_worker_executing_work(last_pool, work);
|
|
|
|
if (worker && worker->current_pwq->wq == wq) {
|
|
pwq = worker->current_pwq;
|
|
} else {
|
|
/* meh... not running there, queue here */
|
|
raw_spin_unlock(&last_pool->lock);
|
|
raw_spin_lock(&pwq->pool->lock);
|
|
}
|
|
} else {
|
|
raw_spin_lock(&pwq->pool->lock);
|
|
}
|
|
|
|
/*
|
|
* pwq is determined and locked. For unbound pools, we could have
|
|
* raced with pwq release and it could already be dead. If its
|
|
* refcnt is zero, repeat pwq selection. Note that pwqs never die
|
|
* without another pwq replacing it in the numa_pwq_tbl or while
|
|
* work items are executing on it, so the retrying is guaranteed to
|
|
* make forward-progress.
|
|
*/
|
|
if (unlikely(!pwq->refcnt)) {
|
|
if (wq->flags & WQ_UNBOUND) {
|
|
raw_spin_unlock(&pwq->pool->lock);
|
|
cpu_relax();
|
|
goto retry;
|
|
}
|
|
/* oops */
|
|
WARN_ONCE(true, "workqueue: per-cpu pwq for %s on cpu%d has 0 refcnt",
|
|
wq->name, cpu);
|
|
}
|
|
|
|
/* pwq determined, queue */
|
|
trace_workqueue_queue_work(req_cpu, pwq, work);
|
|
|
|
if (WARN_ON(!list_empty(&work->entry)))
|
|
goto out;
|
|
|
|
pwq->nr_in_flight[pwq->work_color]++;
|
|
work_flags = work_color_to_flags(pwq->work_color);
|
|
|
|
if (likely(pwq->nr_active < pwq->max_active)) {
|
|
trace_workqueue_activate_work(work);
|
|
pwq->nr_active++;
|
|
worklist = &pwq->pool->worklist;
|
|
if (list_empty(worklist))
|
|
pwq->pool->watchdog_ts = jiffies;
|
|
} else {
|
|
work_flags |= WORK_STRUCT_DELAYED;
|
|
worklist = &pwq->delayed_works;
|
|
}
|
|
|
|
debug_work_activate(work);
|
|
insert_work(pwq, work, worklist, work_flags);
|
|
|
|
out:
|
|
raw_spin_unlock(&pwq->pool->lock);
|
|
rcu_read_unlock();
|
|
}
|
|
|
|
/**
|
|
* queue_work_on - queue work on specific cpu
|
|
* @cpu: CPU number to execute work on
|
|
* @wq: workqueue to use
|
|
* @work: work to queue
|
|
*
|
|
* We queue the work to a specific CPU, the caller must ensure it
|
|
* can't go away.
|
|
*
|
|
* Return: %false if @work was already on a queue, %true otherwise.
|
|
*/
|
|
bool queue_work_on(int cpu, struct workqueue_struct *wq,
|
|
struct work_struct *work)
|
|
{
|
|
bool ret = false;
|
|
unsigned long flags;
|
|
|
|
local_irq_save(flags);
|
|
|
|
if (!test_and_set_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(work))) {
|
|
__queue_work(cpu, wq, work);
|
|
ret = true;
|
|
}
|
|
|
|
local_irq_restore(flags);
|
|
return ret;
|
|
}
|
|
EXPORT_SYMBOL(queue_work_on);
|
|
|
|
/**
|
|
* workqueue_select_cpu_near - Select a CPU based on NUMA node
|
|
* @node: NUMA node ID that we want to select a CPU from
|
|
*
|
|
* This function will attempt to find a "random" cpu available on a given
|
|
* node. If there are no CPUs available on the given node it will return
|
|
* WORK_CPU_UNBOUND indicating that we should just schedule to any
|
|
* available CPU if we need to schedule this work.
|
|
*/
|
|
static int workqueue_select_cpu_near(int node)
|
|
{
|
|
int cpu;
|
|
|
|
/* No point in doing this if NUMA isn't enabled for workqueues */
|
|
if (!wq_numa_enabled)
|
|
return WORK_CPU_UNBOUND;
|
|
|
|
/* Delay binding to CPU if node is not valid or online */
|
|
if (node < 0 || node >= MAX_NUMNODES || !node_online(node))
|
|
return WORK_CPU_UNBOUND;
|
|
|
|
/* Use local node/cpu if we are already there */
|
|
cpu = raw_smp_processor_id();
|
|
if (node == cpu_to_node(cpu))
|
|
return cpu;
|
|
|
|
/* Use "random" otherwise know as "first" online CPU of node */
|
|
cpu = cpumask_any_and(cpumask_of_node(node), cpu_online_mask);
|
|
|
|
/* If CPU is valid return that, otherwise just defer */
|
|
return cpu < nr_cpu_ids ? cpu : WORK_CPU_UNBOUND;
|
|
}
|
|
|
|
/**
|
|
* queue_work_node - queue work on a "random" cpu for a given NUMA node
|
|
* @node: NUMA node that we are targeting the work for
|
|
* @wq: workqueue to use
|
|
* @work: work to queue
|
|
*
|
|
* We queue the work to a "random" CPU within a given NUMA node. The basic
|
|
* idea here is to provide a way to somehow associate work with a given
|
|
* NUMA node.
|
|
*
|
|
* This function will only make a best effort attempt at getting this onto
|
|
* the right NUMA node. If no node is requested or the requested node is
|
|
* offline then we just fall back to standard queue_work behavior.
|
|
*
|
|
* Currently the "random" CPU ends up being the first available CPU in the
|
|
* intersection of cpu_online_mask and the cpumask of the node, unless we
|
|
* are running on the node. In that case we just use the current CPU.
|
|
*
|
|
* Return: %false if @work was already on a queue, %true otherwise.
|
|
*/
|
|
bool queue_work_node(int node, struct workqueue_struct *wq,
|
|
struct work_struct *work)
|
|
{
|
|
unsigned long flags;
|
|
bool ret = false;
|
|
|
|
/*
|
|
* This current implementation is specific to unbound workqueues.
|
|
* Specifically we only return the first available CPU for a given
|
|
* node instead of cycling through individual CPUs within the node.
|
|
*
|
|
* If this is used with a per-cpu workqueue then the logic in
|
|
* workqueue_select_cpu_near would need to be updated to allow for
|
|
* some round robin type logic.
|
|
*/
|
|
WARN_ON_ONCE(!(wq->flags & WQ_UNBOUND));
|
|
|
|
local_irq_save(flags);
|
|
|
|
if (!test_and_set_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(work))) {
|
|
int cpu = workqueue_select_cpu_near(node);
|
|
|
|
__queue_work(cpu, wq, work);
|
|
ret = true;
|
|
}
|
|
|
|
local_irq_restore(flags);
|
|
return ret;
|
|
}
|
|
EXPORT_SYMBOL_GPL(queue_work_node);
|
|
|
|
void delayed_work_timer_fn(struct timer_list *t)
|
|
{
|
|
struct delayed_work *dwork = from_timer(dwork, t, timer);
|
|
|
|
/* should have been called from irqsafe timer with irq already off */
|
|
__queue_work(dwork->cpu, dwork->wq, &dwork->work);
|
|
}
|
|
EXPORT_SYMBOL(delayed_work_timer_fn);
|
|
|
|
static void __queue_delayed_work(int cpu, struct workqueue_struct *wq,
|
|
struct delayed_work *dwork, unsigned long delay)
|
|
{
|
|
struct timer_list *timer = &dwork->timer;
|
|
struct work_struct *work = &dwork->work;
|
|
|
|
WARN_ON_ONCE(!wq);
|
|
/*
|
|
* With CFI, timer->function can point to a jump table entry in a module,
|
|
* which fails the comparison. Disable the warning if CFI and modules are
|
|
* both enabled.
|
|
*/
|
|
if (!IS_ENABLED(CONFIG_CFI_CLANG) || !IS_ENABLED(CONFIG_MODULES))
|
|
WARN_ON_ONCE(timer->function != delayed_work_timer_fn);
|
|
|
|
WARN_ON_ONCE(timer_pending(timer));
|
|
WARN_ON_ONCE(!list_empty(&work->entry));
|
|
|
|
/*
|
|
* If @delay is 0, queue @dwork->work immediately. This is for
|
|
* both optimization and correctness. The earliest @timer can
|
|
* expire is on the closest next tick and delayed_work users depend
|
|
* on that there's no such delay when @delay is 0.
|
|
*/
|
|
if (!delay) {
|
|
__queue_work(cpu, wq, &dwork->work);
|
|
return;
|
|
}
|
|
|
|
dwork->wq = wq;
|
|
dwork->cpu = cpu;
|
|
timer->expires = jiffies + delay;
|
|
|
|
if (unlikely(cpu != WORK_CPU_UNBOUND))
|
|
add_timer_on(timer, cpu);
|
|
else
|
|
add_timer(timer);
|
|
}
|
|
|
|
/**
|
|
* queue_delayed_work_on - queue work on specific CPU after delay
|
|
* @cpu: CPU number to execute work on
|
|
* @wq: workqueue to use
|
|
* @dwork: work to queue
|
|
* @delay: number of jiffies to wait before queueing
|
|
*
|
|
* Return: %false if @work was already on a queue, %true otherwise. If
|
|
* @delay is zero and @dwork is idle, it will be scheduled for immediate
|
|
* execution.
|
|
*/
|
|
bool queue_delayed_work_on(int cpu, struct workqueue_struct *wq,
|
|
struct delayed_work *dwork, unsigned long delay)
|
|
{
|
|
struct work_struct *work = &dwork->work;
|
|
bool ret = false;
|
|
unsigned long flags;
|
|
|
|
/* read the comment in __queue_work() */
|
|
local_irq_save(flags);
|
|
|
|
if (!test_and_set_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(work))) {
|
|
__queue_delayed_work(cpu, wq, dwork, delay);
|
|
ret = true;
|
|
}
|
|
|
|
local_irq_restore(flags);
|
|
return ret;
|
|
}
|
|
EXPORT_SYMBOL(queue_delayed_work_on);
|
|
|
|
/**
|
|
* mod_delayed_work_on - modify delay of or queue a delayed work on specific CPU
|
|
* @cpu: CPU number to execute work on
|
|
* @wq: workqueue to use
|
|
* @dwork: work to queue
|
|
* @delay: number of jiffies to wait before queueing
|
|
*
|
|
* If @dwork is idle, equivalent to queue_delayed_work_on(); otherwise,
|
|
* modify @dwork's timer so that it expires after @delay. If @delay is
|
|
* zero, @work is guaranteed to be scheduled immediately regardless of its
|
|
* current state.
|
|
*
|
|
* Return: %false if @dwork was idle and queued, %true if @dwork was
|
|
* pending and its timer was modified.
|
|
*
|
|
* This function is safe to call from any context including IRQ handler.
|
|
* See try_to_grab_pending() for details.
|
|
*/
|
|
bool mod_delayed_work_on(int cpu, struct workqueue_struct *wq,
|
|
struct delayed_work *dwork, unsigned long delay)
|
|
{
|
|
unsigned long flags;
|
|
int ret;
|
|
|
|
do {
|
|
ret = try_to_grab_pending(&dwork->work, true, &flags);
|
|
} while (unlikely(ret == -EAGAIN));
|
|
|
|
if (likely(ret >= 0)) {
|
|
__queue_delayed_work(cpu, wq, dwork, delay);
|
|
local_irq_restore(flags);
|
|
}
|
|
|
|
/* -ENOENT from try_to_grab_pending() becomes %true */
|
|
return ret;
|
|
}
|
|
EXPORT_SYMBOL_GPL(mod_delayed_work_on);
|
|
|
|
static void rcu_work_rcufn(struct rcu_head *rcu)
|
|
{
|
|
struct rcu_work *rwork = container_of(rcu, struct rcu_work, rcu);
|
|
|
|
/* read the comment in __queue_work() */
|
|
local_irq_disable();
|
|
__queue_work(WORK_CPU_UNBOUND, rwork->wq, &rwork->work);
|
|
local_irq_enable();
|
|
}
|
|
|
|
/**
|
|
* queue_rcu_work - queue work after a RCU grace period
|
|
* @wq: workqueue to use
|
|
* @rwork: work to queue
|
|
*
|
|
* Return: %false if @rwork was already pending, %true otherwise. Note
|
|
* that a full RCU grace period is guaranteed only after a %true return.
|
|
* While @rwork is guaranteed to be executed after a %false return, the
|
|
* execution may happen before a full RCU grace period has passed.
|
|
*/
|
|
bool queue_rcu_work(struct workqueue_struct *wq, struct rcu_work *rwork)
|
|
{
|
|
struct work_struct *work = &rwork->work;
|
|
|
|
if (!test_and_set_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(work))) {
|
|
rwork->wq = wq;
|
|
call_rcu(&rwork->rcu, rcu_work_rcufn);
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
EXPORT_SYMBOL(queue_rcu_work);
|
|
|
|
/**
|
|
* worker_enter_idle - enter idle state
|
|
* @worker: worker which is entering idle state
|
|
*
|
|
* @worker is entering idle state. Update stats and idle timer if
|
|
* necessary.
|
|
*
|
|
* LOCKING:
|
|
* raw_spin_lock_irq(pool->lock).
|
|
*/
|
|
static void worker_enter_idle(struct worker *worker)
|
|
{
|
|
struct worker_pool *pool = worker->pool;
|
|
|
|
if (WARN_ON_ONCE(worker->flags & WORKER_IDLE) ||
|
|
WARN_ON_ONCE(!list_empty(&worker->entry) &&
|
|
(worker->hentry.next || worker->hentry.pprev)))
|
|
return;
|
|
|
|
/* can't use worker_set_flags(), also called from create_worker() */
|
|
worker->flags |= WORKER_IDLE;
|
|
pool->nr_idle++;
|
|
worker->last_active = jiffies;
|
|
|
|
/* idle_list is LIFO */
|
|
list_add(&worker->entry, &pool->idle_list);
|
|
|
|
if (too_many_workers(pool) && !timer_pending(&pool->idle_timer))
|
|
mod_timer(&pool->idle_timer, jiffies + IDLE_WORKER_TIMEOUT);
|
|
|
|
/*
|
|
* Sanity check nr_running. Because unbind_workers() releases
|
|
* pool->lock between setting %WORKER_UNBOUND and zapping
|
|
* nr_running, the warning may trigger spuriously. Check iff
|
|
* unbind is not in progress.
|
|
*/
|
|
WARN_ON_ONCE(!(pool->flags & POOL_DISASSOCIATED) &&
|
|
pool->nr_workers == pool->nr_idle &&
|
|
atomic_read(&pool->nr_running));
|
|
}
|
|
|
|
/**
|
|
* worker_leave_idle - leave idle state
|
|
* @worker: worker which is leaving idle state
|
|
*
|
|
* @worker is leaving idle state. Update stats.
|
|
*
|
|
* LOCKING:
|
|
* raw_spin_lock_irq(pool->lock).
|
|
*/
|
|
static void worker_leave_idle(struct worker *worker)
|
|
{
|
|
struct worker_pool *pool = worker->pool;
|
|
|
|
if (WARN_ON_ONCE(!(worker->flags & WORKER_IDLE)))
|
|
return;
|
|
worker_clr_flags(worker, WORKER_IDLE);
|
|
pool->nr_idle--;
|
|
list_del_init(&worker->entry);
|
|
}
|
|
|
|
static struct worker *alloc_worker(int node)
|
|
{
|
|
struct worker *worker;
|
|
|
|
worker = kzalloc_node(sizeof(*worker), GFP_KERNEL, node);
|
|
if (worker) {
|
|
INIT_LIST_HEAD(&worker->entry);
|
|
INIT_LIST_HEAD(&worker->scheduled);
|
|
INIT_LIST_HEAD(&worker->node);
|
|
/* on creation a worker is in !idle && prep state */
|
|
worker->flags = WORKER_PREP;
|
|
}
|
|
return worker;
|
|
}
|
|
|
|
/**
|
|
* worker_attach_to_pool() - attach a worker to a pool
|
|
* @worker: worker to be attached
|
|
* @pool: the target pool
|
|
*
|
|
* Attach @worker to @pool. Once attached, the %WORKER_UNBOUND flag and
|
|
* cpu-binding of @worker are kept coordinated with the pool across
|
|
* cpu-[un]hotplugs.
|
|
*/
|
|
static void worker_attach_to_pool(struct worker *worker,
|
|
struct worker_pool *pool)
|
|
{
|
|
mutex_lock(&wq_pool_attach_mutex);
|
|
|
|
/*
|
|
* The wq_pool_attach_mutex ensures %POOL_DISASSOCIATED remains
|
|
* stable across this function. See the comments above the flag
|
|
* definition for details.
|
|
*/
|
|
if (pool->flags & POOL_DISASSOCIATED)
|
|
worker->flags |= WORKER_UNBOUND;
|
|
|
|
if (worker->rescue_wq)
|
|
set_cpus_allowed_ptr(worker->task, pool->attrs->cpumask);
|
|
|
|
list_add_tail(&worker->node, &pool->workers);
|
|
worker->pool = pool;
|
|
|
|
mutex_unlock(&wq_pool_attach_mutex);
|
|
}
|
|
|
|
/**
|
|
* worker_detach_from_pool() - detach a worker from its pool
|
|
* @worker: worker which is attached to its pool
|
|
*
|
|
* Undo the attaching which had been done in worker_attach_to_pool(). The
|
|
* caller worker shouldn't access to the pool after detached except it has
|
|
* other reference to the pool.
|
|
*/
|
|
static void worker_detach_from_pool(struct worker *worker)
|
|
{
|
|
struct worker_pool *pool = worker->pool;
|
|
struct completion *detach_completion = NULL;
|
|
|
|
mutex_lock(&wq_pool_attach_mutex);
|
|
|
|
list_del(&worker->node);
|
|
worker->pool = NULL;
|
|
|
|
if (list_empty(&pool->workers))
|
|
detach_completion = pool->detach_completion;
|
|
mutex_unlock(&wq_pool_attach_mutex);
|
|
|
|
/* clear leftover flags without pool->lock after it is detached */
|
|
worker->flags &= ~(WORKER_UNBOUND | WORKER_REBOUND);
|
|
|
|
if (detach_completion)
|
|
complete(detach_completion);
|
|
}
|
|
|
|
/**
|
|
* create_worker - create a new workqueue worker
|
|
* @pool: pool the new worker will belong to
|
|
*
|
|
* Create and start a new worker which is attached to @pool.
|
|
*
|
|
* CONTEXT:
|
|
* Might sleep. Does GFP_KERNEL allocations.
|
|
*
|
|
* Return:
|
|
* Pointer to the newly created worker.
|
|
*/
|
|
static struct worker *create_worker(struct worker_pool *pool)
|
|
{
|
|
struct worker *worker = NULL;
|
|
int id = -1;
|
|
char id_buf[16];
|
|
|
|
/* ID is needed to determine kthread name */
|
|
id = ida_simple_get(&pool->worker_ida, 0, 0, GFP_KERNEL);
|
|
if (id < 0)
|
|
goto fail;
|
|
|
|
worker = alloc_worker(pool->node);
|
|
if (!worker)
|
|
goto fail;
|
|
|
|
worker->id = id;
|
|
|
|
if (pool->cpu >= 0)
|
|
snprintf(id_buf, sizeof(id_buf), "%d:%d%s", pool->cpu, id,
|
|
pool->attrs->nice < 0 ? "H" : "");
|
|
else
|
|
snprintf(id_buf, sizeof(id_buf), "u%d:%d", pool->id, id);
|
|
|
|
worker->task = kthread_create_on_node(worker_thread, worker, pool->node,
|
|
"kworker/%s", id_buf);
|
|
if (IS_ERR(worker->task))
|
|
goto fail;
|
|
|
|
set_user_nice(worker->task, pool->attrs->nice);
|
|
kthread_bind_mask(worker->task, pool->attrs->cpumask);
|
|
|
|
/* successful, attach the worker to the pool */
|
|
worker_attach_to_pool(worker, pool);
|
|
|
|
/* start the newly created worker */
|
|
raw_spin_lock_irq(&pool->lock);
|
|
worker->pool->nr_workers++;
|
|
worker_enter_idle(worker);
|
|
wake_up_process(worker->task);
|
|
raw_spin_unlock_irq(&pool->lock);
|
|
|
|
return worker;
|
|
|
|
fail:
|
|
if (id >= 0)
|
|
ida_simple_remove(&pool->worker_ida, id);
|
|
kfree(worker);
|
|
return NULL;
|
|
}
|
|
|
|
/**
|
|
* destroy_worker - destroy a workqueue worker
|
|
* @worker: worker to be destroyed
|
|
*
|
|
* Destroy @worker and adjust @pool stats accordingly. The worker should
|
|
* be idle.
|
|
*
|
|
* CONTEXT:
|
|
* raw_spin_lock_irq(pool->lock).
|
|
*/
|
|
static void destroy_worker(struct worker *worker)
|
|
{
|
|
struct worker_pool *pool = worker->pool;
|
|
|
|
lockdep_assert_held(&pool->lock);
|
|
|
|
/* sanity check frenzy */
|
|
if (WARN_ON(worker->current_work) ||
|
|
WARN_ON(!list_empty(&worker->scheduled)) ||
|
|
WARN_ON(!(worker->flags & WORKER_IDLE)))
|
|
return;
|
|
|
|
pool->nr_workers--;
|
|
pool->nr_idle--;
|
|
|
|
list_del_init(&worker->entry);
|
|
worker->flags |= WORKER_DIE;
|
|
wake_up_process(worker->task);
|
|
}
|
|
|
|
static void idle_worker_timeout(struct timer_list *t)
|
|
{
|
|
struct worker_pool *pool = from_timer(pool, t, idle_timer);
|
|
|
|
raw_spin_lock_irq(&pool->lock);
|
|
|
|
while (too_many_workers(pool)) {
|
|
struct worker *worker;
|
|
unsigned long expires;
|
|
|
|
/* idle_list is kept in LIFO order, check the last one */
|
|
worker = list_entry(pool->idle_list.prev, struct worker, entry);
|
|
expires = worker->last_active + IDLE_WORKER_TIMEOUT;
|
|
|
|
if (time_before(jiffies, expires)) {
|
|
mod_timer(&pool->idle_timer, expires);
|
|
break;
|
|
}
|
|
|
|
destroy_worker(worker);
|
|
}
|
|
|
|
raw_spin_unlock_irq(&pool->lock);
|
|
}
|
|
|
|
static void send_mayday(struct work_struct *work)
|
|
{
|
|
struct pool_workqueue *pwq = get_work_pwq(work);
|
|
struct workqueue_struct *wq = pwq->wq;
|
|
|
|
lockdep_assert_held(&wq_mayday_lock);
|
|
|
|
if (!wq->rescuer)
|
|
return;
|
|
|
|
/* mayday mayday mayday */
|
|
if (list_empty(&pwq->mayday_node)) {
|
|
/*
|
|
* If @pwq is for an unbound wq, its base ref may be put at
|
|
* any time due to an attribute change. Pin @pwq until the
|
|
* rescuer is done with it.
|
|
*/
|
|
get_pwq(pwq);
|
|
list_add_tail(&pwq->mayday_node, &wq->maydays);
|
|
wake_up_process(wq->rescuer->task);
|
|
}
|
|
}
|
|
|
|
static void pool_mayday_timeout(struct timer_list *t)
|
|
{
|
|
struct worker_pool *pool = from_timer(pool, t, mayday_timer);
|
|
struct work_struct *work;
|
|
|
|
raw_spin_lock_irq(&pool->lock);
|
|
raw_spin_lock(&wq_mayday_lock); /* for wq->maydays */
|
|
|
|
if (need_to_create_worker(pool)) {
|
|
/*
|
|
* We've been trying to create a new worker but
|
|
* haven't been successful. We might be hitting an
|
|
* allocation deadlock. Send distress signals to
|
|
* rescuers.
|
|
*/
|
|
list_for_each_entry(work, &pool->worklist, entry)
|
|
send_mayday(work);
|
|
}
|
|
|
|
raw_spin_unlock(&wq_mayday_lock);
|
|
raw_spin_unlock_irq(&pool->lock);
|
|
|
|
mod_timer(&pool->mayday_timer, jiffies + MAYDAY_INTERVAL);
|
|
}
|
|
|
|
/**
|
|
* maybe_create_worker - create a new worker if necessary
|
|
* @pool: pool to create a new worker for
|
|
*
|
|
* Create a new worker for @pool if necessary. @pool is guaranteed to
|
|
* have at least one idle worker on return from this function. If
|
|
* creating a new worker takes longer than MAYDAY_INTERVAL, mayday is
|
|
* sent to all rescuers with works scheduled on @pool to resolve
|
|
* possible allocation deadlock.
|
|
*
|
|
* On return, need_to_create_worker() is guaranteed to be %false and
|
|
* may_start_working() %true.
|
|
*
|
|
* LOCKING:
|
|
* raw_spin_lock_irq(pool->lock) which may be released and regrabbed
|
|
* multiple times. Does GFP_KERNEL allocations. Called only from
|
|
* manager.
|
|
*/
|
|
static void maybe_create_worker(struct worker_pool *pool)
|
|
__releases(&pool->lock)
|
|
__acquires(&pool->lock)
|
|
{
|
|
restart:
|
|
raw_spin_unlock_irq(&pool->lock);
|
|
|
|
/* if we don't make progress in MAYDAY_INITIAL_TIMEOUT, call for help */
|
|
mod_timer(&pool->mayday_timer, jiffies + MAYDAY_INITIAL_TIMEOUT);
|
|
|
|
while (true) {
|
|
if (create_worker(pool) || !need_to_create_worker(pool))
|
|
break;
|
|
|
|
schedule_timeout_interruptible(CREATE_COOLDOWN);
|
|
|
|
if (!need_to_create_worker(pool))
|
|
break;
|
|
}
|
|
|
|
del_timer_sync(&pool->mayday_timer);
|
|
raw_spin_lock_irq(&pool->lock);
|
|
/*
|
|
* This is necessary even after a new worker was just successfully
|
|
* created as @pool->lock was dropped and the new worker might have
|
|
* already become busy.
|
|
*/
|
|
if (need_to_create_worker(pool))
|
|
goto restart;
|
|
}
|
|
|
|
/**
|
|
* manage_workers - manage worker pool
|
|
* @worker: self
|
|
*
|
|
* Assume the manager role and manage the worker pool @worker belongs
|
|
* to. At any given time, there can be only zero or one manager per
|
|
* pool. The exclusion is handled automatically by this function.
|
|
*
|
|
* The caller can safely start processing works on false return. On
|
|
* true return, it's guaranteed that need_to_create_worker() is false
|
|
* and may_start_working() is true.
|
|
*
|
|
* CONTEXT:
|
|
* raw_spin_lock_irq(pool->lock) which may be released and regrabbed
|
|
* multiple times. Does GFP_KERNEL allocations.
|
|
*
|
|
* Return:
|
|
* %false if the pool doesn't need management and the caller can safely
|
|
* start processing works, %true if management function was performed and
|
|
* the conditions that the caller verified before calling the function may
|
|
* no longer be true.
|
|
*/
|
|
static bool manage_workers(struct worker *worker)
|
|
{
|
|
struct worker_pool *pool = worker->pool;
|
|
|
|
if (pool->flags & POOL_MANAGER_ACTIVE)
|
|
return false;
|
|
|
|
pool->flags |= POOL_MANAGER_ACTIVE;
|
|
pool->manager = worker;
|
|
|
|
maybe_create_worker(pool);
|
|
|
|
pool->manager = NULL;
|
|
pool->flags &= ~POOL_MANAGER_ACTIVE;
|
|
rcuwait_wake_up(&manager_wait);
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* process_one_work - process single work
|
|
* @worker: self
|
|
* @work: work to process
|
|
*
|
|
* Process @work. This function contains all the logics necessary to
|
|
* process a single work including synchronization against and
|
|
* interaction with other workers on the same cpu, queueing and
|
|
* flushing. As long as context requirement is met, any worker can
|
|
* call this function to process a work.
|
|
*
|
|
* CONTEXT:
|
|
* raw_spin_lock_irq(pool->lock) which is released and regrabbed.
|
|
*/
|
|
static void process_one_work(struct worker *worker, struct work_struct *work)
|
|
__releases(&pool->lock)
|
|
__acquires(&pool->lock)
|
|
{
|
|
struct pool_workqueue *pwq = get_work_pwq(work);
|
|
struct worker_pool *pool = worker->pool;
|
|
bool cpu_intensive = pwq->wq->flags & WQ_CPU_INTENSIVE;
|
|
int work_color;
|
|
struct worker *collision;
|
|
#ifdef CONFIG_LOCKDEP
|
|
/*
|
|
* It is permissible to free the struct work_struct 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
|
|
* work->lockdep_map, make a copy and use that here.
|
|
*/
|
|
struct lockdep_map lockdep_map;
|
|
|
|
lockdep_copy_map(&lockdep_map, &work->lockdep_map);
|
|
#endif
|
|
/* ensure we're on the correct CPU */
|
|
WARN_ON_ONCE(!(pool->flags & POOL_DISASSOCIATED) &&
|
|
raw_smp_processor_id() != pool->cpu);
|
|
|
|
/*
|
|
* A single work shouldn't be executed concurrently by
|
|
* multiple workers on a single cpu. Check whether anyone is
|
|
* already processing the work. If so, defer the work to the
|
|
* currently executing one.
|
|
*/
|
|
collision = find_worker_executing_work(pool, work);
|
|
if (unlikely(collision)) {
|
|
move_linked_works(work, &collision->scheduled, NULL);
|
|
return;
|
|
}
|
|
|
|
/* claim and dequeue */
|
|
debug_work_deactivate(work);
|
|
hash_add(pool->busy_hash, &worker->hentry, (unsigned long)work);
|
|
worker->current_work = work;
|
|
worker->current_func = work->func;
|
|
worker->current_pwq = pwq;
|
|
work_color = get_work_color(work);
|
|
|
|
/*
|
|
* Record wq name for cmdline and debug reporting, may get
|
|
* overridden through set_worker_desc().
|
|
*/
|
|
strscpy(worker->desc, pwq->wq->name, WORKER_DESC_LEN);
|
|
|
|
list_del_init(&work->entry);
|
|
|
|
/*
|
|
* CPU intensive works don't participate in concurrency management.
|
|
* They're the scheduler's responsibility. This takes @worker out
|
|
* of concurrency management and the next code block will chain
|
|
* execution of the pending work items.
|
|
*/
|
|
if (unlikely(cpu_intensive))
|
|
worker_set_flags(worker, WORKER_CPU_INTENSIVE);
|
|
|
|
/*
|
|
* Wake up another worker if necessary. The condition is always
|
|
* false for normal per-cpu workers since nr_running would always
|
|
* be >= 1 at this point. This is used to chain execution of the
|
|
* pending work items for WORKER_NOT_RUNNING workers such as the
|
|
* UNBOUND and CPU_INTENSIVE ones.
|
|
*/
|
|
if (need_more_worker(pool))
|
|
wake_up_worker(pool);
|
|
|
|
/*
|
|
* Record the last pool and clear PENDING which should be the last
|
|
* update to @work. Also, do this inside @pool->lock so that
|
|
* PENDING and queued state changes happen together while IRQ is
|
|
* disabled.
|
|
*/
|
|
set_work_pool_and_clear_pending(work, pool->id);
|
|
|
|
raw_spin_unlock_irq(&pool->lock);
|
|
|
|
lock_map_acquire(&pwq->wq->lockdep_map);
|
|
lock_map_acquire(&lockdep_map);
|
|
/*
|
|
* Strictly speaking we should mark the invariant state without holding
|
|
* any locks, that is, before these two lock_map_acquire()'s.
|
|
*
|
|
* However, that would result in:
|
|
*
|
|
* A(W1)
|
|
* WFC(C)
|
|
* A(W1)
|
|
* C(C)
|
|
*
|
|
* Which would create W1->C->W1 dependencies, even though there is no
|
|
* actual deadlock possible. There are two solutions, using a
|
|
* read-recursive acquire on the work(queue) 'locks', but this will then
|
|
* hit the lockdep limitation on recursive locks, or simply discard
|
|
* these locks.
|
|
*
|
|
* AFAICT there is no possible deadlock scenario between the
|
|
* flush_work() and complete() primitives (except for single-threaded
|
|
* workqueues), so hiding them isn't a problem.
|
|
*/
|
|
lockdep_invariant_state(true);
|
|
trace_workqueue_execute_start(work);
|
|
worker->current_func(work);
|
|
/*
|
|
* While we must be careful to not use "work" after this, the trace
|
|
* point will only record its address.
|
|
*/
|
|
trace_workqueue_execute_end(work, worker->current_func);
|
|
lock_map_release(&lockdep_map);
|
|
lock_map_release(&pwq->wq->lockdep_map);
|
|
|
|
if (unlikely(in_atomic() || lockdep_depth(current) > 0)) {
|
|
pr_err("BUG: workqueue leaked lock or atomic: %s/0x%08x/%d\n"
|
|
" last function: %ps\n",
|
|
current->comm, preempt_count(), task_pid_nr(current),
|
|
worker->current_func);
|
|
debug_show_held_locks(current);
|
|
dump_stack();
|
|
}
|
|
|
|
/*
|
|
* The following prevents a kworker from hogging CPU on !PREEMPTION
|
|
* kernels, where a requeueing work item waiting for something to
|
|
* happen could deadlock with stop_machine as such work item could
|
|
* indefinitely requeue itself while all other CPUs are trapped in
|
|
* stop_machine. At the same time, report a quiescent RCU state so
|
|
* the same condition doesn't freeze RCU.
|
|
*/
|
|
cond_resched();
|
|
|
|
raw_spin_lock_irq(&pool->lock);
|
|
|
|
/* clear cpu intensive status */
|
|
if (unlikely(cpu_intensive))
|
|
worker_clr_flags(worker, WORKER_CPU_INTENSIVE);
|
|
|
|
/* tag the worker for identification in schedule() */
|
|
worker->last_func = worker->current_func;
|
|
|
|
/* we're done with it, release */
|
|
hash_del(&worker->hentry);
|
|
worker->current_work = NULL;
|
|
worker->current_func = NULL;
|
|
worker->current_pwq = NULL;
|
|
pwq_dec_nr_in_flight(pwq, work_color);
|
|
}
|
|
|
|
/**
|
|
* process_scheduled_works - process scheduled works
|
|
* @worker: self
|
|
*
|
|
* Process all scheduled works. Please note that the scheduled list
|
|
* may change while processing a work, so this function repeatedly
|
|
* fetches a work from the top and executes it.
|
|
*
|
|
* CONTEXT:
|
|
* raw_spin_lock_irq(pool->lock) which may be released and regrabbed
|
|
* multiple times.
|
|
*/
|
|
static void process_scheduled_works(struct worker *worker)
|
|
{
|
|
while (!list_empty(&worker->scheduled)) {
|
|
struct work_struct *work = list_first_entry(&worker->scheduled,
|
|
struct work_struct, entry);
|
|
process_one_work(worker, work);
|
|
}
|
|
}
|
|
|
|
static void set_pf_worker(bool val)
|
|
{
|
|
mutex_lock(&wq_pool_attach_mutex);
|
|
if (val)
|
|
current->flags |= PF_WQ_WORKER;
|
|
else
|
|
current->flags &= ~PF_WQ_WORKER;
|
|
mutex_unlock(&wq_pool_attach_mutex);
|
|
}
|
|
|
|
/**
|
|
* worker_thread - the worker thread function
|
|
* @__worker: self
|
|
*
|
|
* The worker thread function. All workers belong to a worker_pool -
|
|
* either a per-cpu one or dynamic unbound one. These workers process all
|
|
* work items regardless of their specific target workqueue. The only
|
|
* exception is work items which belong to workqueues with a rescuer which
|
|
* will be explained in rescuer_thread().
|
|
*
|
|
* Return: 0
|
|
*/
|
|
static int worker_thread(void *__worker)
|
|
{
|
|
struct worker *worker = __worker;
|
|
struct worker_pool *pool = worker->pool;
|
|
|
|
/* tell the scheduler that this is a workqueue worker */
|
|
set_pf_worker(true);
|
|
woke_up:
|
|
raw_spin_lock_irq(&pool->lock);
|
|
|
|
/* am I supposed to die? */
|
|
if (unlikely(worker->flags & WORKER_DIE)) {
|
|
raw_spin_unlock_irq(&pool->lock);
|
|
WARN_ON_ONCE(!list_empty(&worker->entry));
|
|
set_pf_worker(false);
|
|
|
|
set_task_comm(worker->task, "kworker/dying");
|
|
ida_simple_remove(&pool->worker_ida, worker->id);
|
|
worker_detach_from_pool(worker);
|
|
kfree(worker);
|
|
return 0;
|
|
}
|
|
|
|
worker_leave_idle(worker);
|
|
recheck:
|
|
/* no more worker necessary? */
|
|
if (!need_more_worker(pool))
|
|
goto sleep;
|
|
|
|
/* do we need to manage? */
|
|
if (unlikely(!may_start_working(pool)) && manage_workers(worker))
|
|
goto recheck;
|
|
|
|
/*
|
|
* ->scheduled list can only be filled while a worker is
|
|
* preparing to process a work or actually processing it.
|
|
* Make sure nobody diddled with it while I was sleeping.
|
|
*/
|
|
WARN_ON_ONCE(!list_empty(&worker->scheduled));
|
|
|
|
/*
|
|
* Finish PREP stage. We're guaranteed to have at least one idle
|
|
* worker or that someone else has already assumed the manager
|
|
* role. This is where @worker starts participating in concurrency
|
|
* management if applicable and concurrency management is restored
|
|
* after being rebound. See rebind_workers() for details.
|
|
*/
|
|
worker_clr_flags(worker, WORKER_PREP | WORKER_REBOUND);
|
|
|
|
do {
|
|
struct work_struct *work =
|
|
list_first_entry(&pool->worklist,
|
|
struct work_struct, entry);
|
|
|
|
pool->watchdog_ts = jiffies;
|
|
|
|
if (likely(!(*work_data_bits(work) & WORK_STRUCT_LINKED))) {
|
|
/* optimization path, not strictly necessary */
|
|
process_one_work(worker, work);
|
|
if (unlikely(!list_empty(&worker->scheduled)))
|
|
process_scheduled_works(worker);
|
|
} else {
|
|
move_linked_works(work, &worker->scheduled, NULL);
|
|
process_scheduled_works(worker);
|
|
}
|
|
} while (keep_working(pool));
|
|
|
|
worker_set_flags(worker, WORKER_PREP);
|
|
sleep:
|
|
/*
|
|
* pool->lock is held and there's no work to process and no need to
|
|
* manage, sleep. Workers are woken up only while holding
|
|
* pool->lock or from local cpu, so setting the current state
|
|
* before releasing pool->lock is enough to prevent losing any
|
|
* event.
|
|
*/
|
|
worker_enter_idle(worker);
|
|
__set_current_state(TASK_IDLE);
|
|
raw_spin_unlock_irq(&pool->lock);
|
|
schedule();
|
|
goto woke_up;
|
|
}
|
|
|
|
/**
|
|
* rescuer_thread - the rescuer thread function
|
|
* @__rescuer: self
|
|
*
|
|
* Workqueue rescuer thread function. There's one rescuer for each
|
|
* workqueue which has WQ_MEM_RECLAIM set.
|
|
*
|
|
* Regular work processing on a pool may block trying to create a new
|
|
* worker which uses GFP_KERNEL allocation which has slight chance of
|
|
* developing into deadlock if some works currently on the same queue
|
|
* need to be processed to satisfy the GFP_KERNEL allocation. This is
|
|
* the problem rescuer solves.
|
|
*
|
|
* When such condition is possible, the pool summons rescuers of all
|
|
* workqueues which have works queued on the pool and let them process
|
|
* those works so that forward progress can be guaranteed.
|
|
*
|
|
* This should happen rarely.
|
|
*
|
|
* Return: 0
|
|
*/
|
|
static int rescuer_thread(void *__rescuer)
|
|
{
|
|
struct worker *rescuer = __rescuer;
|
|
struct workqueue_struct *wq = rescuer->rescue_wq;
|
|
struct list_head *scheduled = &rescuer->scheduled;
|
|
bool should_stop;
|
|
|
|
set_user_nice(current, RESCUER_NICE_LEVEL);
|
|
|
|
/*
|
|
* Mark rescuer as worker too. As WORKER_PREP is never cleared, it
|
|
* doesn't participate in concurrency management.
|
|
*/
|
|
set_pf_worker(true);
|
|
repeat:
|
|
set_current_state(TASK_IDLE);
|
|
|
|
/*
|
|
* By the time the rescuer is requested to stop, the workqueue
|
|
* shouldn't have any work pending, but @wq->maydays may still have
|
|
* pwq(s) queued. This can happen by non-rescuer workers consuming
|
|
* all the work items before the rescuer got to them. Go through
|
|
* @wq->maydays processing before acting on should_stop so that the
|
|
* list is always empty on exit.
|
|
*/
|
|
should_stop = kthread_should_stop();
|
|
|
|
/* see whether any pwq is asking for help */
|
|
raw_spin_lock_irq(&wq_mayday_lock);
|
|
|
|
while (!list_empty(&wq->maydays)) {
|
|
struct pool_workqueue *pwq = list_first_entry(&wq->maydays,
|
|
struct pool_workqueue, mayday_node);
|
|
struct worker_pool *pool = pwq->pool;
|
|
struct work_struct *work, *n;
|
|
bool first = true;
|
|
|
|
__set_current_state(TASK_RUNNING);
|
|
list_del_init(&pwq->mayday_node);
|
|
|
|
raw_spin_unlock_irq(&wq_mayday_lock);
|
|
|
|
worker_attach_to_pool(rescuer, pool);
|
|
|
|
raw_spin_lock_irq(&pool->lock);
|
|
|
|
/*
|
|
* Slurp in all works issued via this workqueue and
|
|
* process'em.
|
|
*/
|
|
WARN_ON_ONCE(!list_empty(scheduled));
|
|
list_for_each_entry_safe(work, n, &pool->worklist, entry) {
|
|
if (get_work_pwq(work) == pwq) {
|
|
if (first)
|
|
pool->watchdog_ts = jiffies;
|
|
move_linked_works(work, scheduled, &n);
|
|
}
|
|
first = false;
|
|
}
|
|
|
|
if (!list_empty(scheduled)) {
|
|
process_scheduled_works(rescuer);
|
|
|
|
/*
|
|
* The above execution of rescued work items could
|
|
* have created more to rescue through
|
|
* pwq_activate_first_delayed() or chained
|
|
* queueing. Let's put @pwq back on mayday list so
|
|
* that such back-to-back work items, which may be
|
|
* being used to relieve memory pressure, don't
|
|
* incur MAYDAY_INTERVAL delay inbetween.
|
|
*/
|
|
if (pwq->nr_active && need_to_create_worker(pool)) {
|
|
raw_spin_lock(&wq_mayday_lock);
|
|
/*
|
|
* Queue iff we aren't racing destruction
|
|
* and somebody else hasn't queued it already.
|
|
*/
|
|
if (wq->rescuer && list_empty(&pwq->mayday_node)) {
|
|
get_pwq(pwq);
|
|
list_add_tail(&pwq->mayday_node, &wq->maydays);
|
|
}
|
|
raw_spin_unlock(&wq_mayday_lock);
|
|
}
|
|
}
|
|
|
|
/*
|
|
* Put the reference grabbed by send_mayday(). @pool won't
|
|
* go away while we're still attached to it.
|
|
*/
|
|
put_pwq(pwq);
|
|
|
|
/*
|
|
* Leave this pool. If need_more_worker() is %true, notify a
|
|
* regular worker; otherwise, we end up with 0 concurrency
|
|
* and stalling the execution.
|
|
*/
|
|
if (need_more_worker(pool))
|
|
wake_up_worker(pool);
|
|
|
|
raw_spin_unlock_irq(&pool->lock);
|
|
|
|
worker_detach_from_pool(rescuer);
|
|
|
|
raw_spin_lock_irq(&wq_mayday_lock);
|
|
}
|
|
|
|
raw_spin_unlock_irq(&wq_mayday_lock);
|
|
|
|
if (should_stop) {
|
|
__set_current_state(TASK_RUNNING);
|
|
set_pf_worker(false);
|
|
return 0;
|
|
}
|
|
|
|
/* rescuers should never participate in concurrency management */
|
|
WARN_ON_ONCE(!(rescuer->flags & WORKER_NOT_RUNNING));
|
|
schedule();
|
|
goto repeat;
|
|
}
|
|
|
|
/**
|
|
* check_flush_dependency - check for flush dependency sanity
|
|
* @target_wq: workqueue being flushed
|
|
* @target_work: work item being flushed (NULL for workqueue flushes)
|
|
*
|
|
* %current is trying to flush the whole @target_wq or @target_work on it.
|
|
* If @target_wq doesn't have %WQ_MEM_RECLAIM, verify that %current is not
|
|
* reclaiming memory or running on a workqueue which doesn't have
|
|
* %WQ_MEM_RECLAIM as that can break forward-progress guarantee leading to
|
|
* a deadlock.
|
|
*/
|
|
static void check_flush_dependency(struct workqueue_struct *target_wq,
|
|
struct work_struct *target_work)
|
|
{
|
|
work_func_t target_func = target_work ? target_work->func : NULL;
|
|
struct worker *worker;
|
|
|
|
if (target_wq->flags & WQ_MEM_RECLAIM)
|
|
return;
|
|
|
|
worker = current_wq_worker();
|
|
|
|
WARN_ONCE(current->flags & PF_MEMALLOC,
|
|
"workqueue: PF_MEMALLOC task %d(%s) is flushing !WQ_MEM_RECLAIM %s:%ps",
|
|
current->pid, current->comm, target_wq->name, target_func);
|
|
WARN_ONCE(worker && ((worker->current_pwq->wq->flags &
|
|
(WQ_MEM_RECLAIM | __WQ_LEGACY)) == WQ_MEM_RECLAIM),
|
|
"workqueue: WQ_MEM_RECLAIM %s:%ps is flushing !WQ_MEM_RECLAIM %s:%ps",
|
|
worker->current_pwq->wq->name, worker->current_func,
|
|
target_wq->name, target_func);
|
|
}
|
|
|
|
struct wq_barrier {
|
|
struct work_struct work;
|
|
struct completion done;
|
|
struct task_struct *task; /* purely informational */
|
|
};
|
|
|
|
static void wq_barrier_func(struct work_struct *work)
|
|
{
|
|
struct wq_barrier *barr = container_of(work, struct wq_barrier, work);
|
|
complete(&barr->done);
|
|
}
|
|
|
|
/**
|
|
* insert_wq_barrier - insert a barrier work
|
|
* @pwq: pwq to insert barrier into
|
|
* @barr: wq_barrier to insert
|
|
* @target: target work to attach @barr to
|
|
* @worker: worker currently executing @target, NULL if @target is not executing
|
|
*
|
|
* @barr is linked to @target such that @barr is completed only after
|
|
* @target finishes execution. Please note that the ordering
|
|
* guarantee is observed only with respect to @target and on the local
|
|
* cpu.
|
|
*
|
|
* Currently, a queued barrier can't be canceled. This is because
|
|
* try_to_grab_pending() can't determine whether the work to be
|
|
* grabbed is at the head of the queue and thus can't clear LINKED
|
|
* flag of the previous work while there must be a valid next work
|
|
* after a work with LINKED flag set.
|
|
*
|
|
* Note that when @worker is non-NULL, @target may be modified
|
|
* underneath us, so we can't reliably determine pwq from @target.
|
|
*
|
|
* CONTEXT:
|
|
* raw_spin_lock_irq(pool->lock).
|
|
*/
|
|
static void insert_wq_barrier(struct pool_workqueue *pwq,
|
|
struct wq_barrier *barr,
|
|
struct work_struct *target, struct worker *worker)
|
|
{
|
|
struct list_head *head;
|
|
unsigned int linked = 0;
|
|
|
|
/*
|
|
* debugobject calls are safe here even with pool->lock locked
|
|
* as we know for sure that this will not trigger any of the
|
|
* checks and call back into the fixup functions where we
|
|
* might deadlock.
|
|
*/
|
|
INIT_WORK_ONSTACK(&barr->work, wq_barrier_func);
|
|
__set_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(&barr->work));
|
|
|
|
init_completion_map(&barr->done, &target->lockdep_map);
|
|
|
|
barr->task = current;
|
|
|
|
/*
|
|
* If @target is currently being executed, schedule the
|
|
* barrier to the worker; otherwise, put it after @target.
|
|
*/
|
|
if (worker)
|
|
head = worker->scheduled.next;
|
|
else {
|
|
unsigned long *bits = work_data_bits(target);
|
|
|
|
head = target->entry.next;
|
|
/* there can already be other linked works, inherit and set */
|
|
linked = *bits & WORK_STRUCT_LINKED;
|
|
__set_bit(WORK_STRUCT_LINKED_BIT, bits);
|
|
}
|
|
|
|
debug_work_activate(&barr->work);
|
|
insert_work(pwq, &barr->work, head,
|
|
work_color_to_flags(WORK_NO_COLOR) | linked);
|
|
}
|
|
|
|
/**
|
|
* flush_workqueue_prep_pwqs - prepare pwqs for workqueue flushing
|
|
* @wq: workqueue being flushed
|
|
* @flush_color: new flush color, < 0 for no-op
|
|
* @work_color: new work color, < 0 for no-op
|
|
*
|
|
* Prepare pwqs for workqueue flushing.
|
|
*
|
|
* If @flush_color is non-negative, flush_color on all pwqs should be
|
|
* -1. If no pwq has in-flight commands at the specified color, all
|
|
* pwq->flush_color's stay at -1 and %false is returned. If any pwq
|
|
* has in flight commands, its pwq->flush_color is set to
|
|
* @flush_color, @wq->nr_pwqs_to_flush is updated accordingly, pwq
|
|
* wakeup logic is armed and %true is returned.
|
|
*
|
|
* The caller should have initialized @wq->first_flusher prior to
|
|
* calling this function with non-negative @flush_color. If
|
|
* @flush_color is negative, no flush color update is done and %false
|
|
* is returned.
|
|
*
|
|
* If @work_color is non-negative, all pwqs should have the same
|
|
* work_color which is previous to @work_color and all will be
|
|
* advanced to @work_color.
|
|
*
|
|
* CONTEXT:
|
|
* mutex_lock(wq->mutex).
|
|
*
|
|
* Return:
|
|
* %true if @flush_color >= 0 and there's something to flush. %false
|
|
* otherwise.
|
|
*/
|
|
static bool flush_workqueue_prep_pwqs(struct workqueue_struct *wq,
|
|
int flush_color, int work_color)
|
|
{
|
|
bool wait = false;
|
|
struct pool_workqueue *pwq;
|
|
|
|
if (flush_color >= 0) {
|
|
WARN_ON_ONCE(atomic_read(&wq->nr_pwqs_to_flush));
|
|
atomic_set(&wq->nr_pwqs_to_flush, 1);
|
|
}
|
|
|
|
for_each_pwq(pwq, wq) {
|
|
struct worker_pool *pool = pwq->pool;
|
|
|
|
raw_spin_lock_irq(&pool->lock);
|
|
|
|
if (flush_color >= 0) {
|
|
WARN_ON_ONCE(pwq->flush_color != -1);
|
|
|
|
if (pwq->nr_in_flight[flush_color]) {
|
|
pwq->flush_color = flush_color;
|
|
atomic_inc(&wq->nr_pwqs_to_flush);
|
|
wait = true;
|
|
}
|
|
}
|
|
|
|
if (work_color >= 0) {
|
|
WARN_ON_ONCE(work_color != work_next_color(pwq->work_color));
|
|
pwq->work_color = work_color;
|
|
}
|
|
|
|
raw_spin_unlock_irq(&pool->lock);
|
|
}
|
|
|
|
if (flush_color >= 0 && atomic_dec_and_test(&wq->nr_pwqs_to_flush))
|
|
complete(&wq->first_flusher->done);
|
|
|
|
return wait;
|
|
}
|
|
|
|
/**
|
|
* flush_workqueue - ensure that any scheduled work has run to completion.
|
|
* @wq: workqueue to flush
|
|
*
|
|
* This function sleeps until all work items which were queued on entry
|
|
* have finished execution, but it is not livelocked by new incoming ones.
|
|
*/
|
|
void flush_workqueue(struct workqueue_struct *wq)
|
|
{
|
|
struct wq_flusher this_flusher = {
|
|
.list = LIST_HEAD_INIT(this_flusher.list),
|
|
.flush_color = -1,
|
|
.done = COMPLETION_INITIALIZER_ONSTACK_MAP(this_flusher.done, wq->lockdep_map),
|
|
};
|
|
int next_color;
|
|
|
|
if (WARN_ON(!wq_online))
|
|
return;
|
|
|
|
lock_map_acquire(&wq->lockdep_map);
|
|
lock_map_release(&wq->lockdep_map);
|
|
|
|
mutex_lock(&wq->mutex);
|
|
|
|
/*
|
|
* Start-to-wait phase
|
|
*/
|
|
next_color = work_next_color(wq->work_color);
|
|
|
|
if (next_color != wq->flush_color) {
|
|
/*
|
|
* Color space is not full. The current work_color
|
|
* becomes our flush_color and work_color is advanced
|
|
* by one.
|
|
*/
|
|
WARN_ON_ONCE(!list_empty(&wq->flusher_overflow));
|
|
this_flusher.flush_color = wq->work_color;
|
|
wq->work_color = next_color;
|
|
|
|
if (!wq->first_flusher) {
|
|
/* no flush in progress, become the first flusher */
|
|
WARN_ON_ONCE(wq->flush_color != this_flusher.flush_color);
|
|
|
|
wq->first_flusher = &this_flusher;
|
|
|
|
if (!flush_workqueue_prep_pwqs(wq, wq->flush_color,
|
|
wq->work_color)) {
|
|
/* nothing to flush, done */
|
|
wq->flush_color = next_color;
|
|
wq->first_flusher = NULL;
|
|
goto out_unlock;
|
|
}
|
|
} else {
|
|
/* wait in queue */
|
|
WARN_ON_ONCE(wq->flush_color == this_flusher.flush_color);
|
|
list_add_tail(&this_flusher.list, &wq->flusher_queue);
|
|
flush_workqueue_prep_pwqs(wq, -1, wq->work_color);
|
|
}
|
|
} else {
|
|
/*
|
|
* Oops, color space is full, wait on overflow queue.
|
|
* The next flush completion will assign us
|
|
* flush_color and transfer to flusher_queue.
|
|
*/
|
|
list_add_tail(&this_flusher.list, &wq->flusher_overflow);
|
|
}
|
|
|
|
check_flush_dependency(wq, NULL);
|
|
|
|
mutex_unlock(&wq->mutex);
|
|
|
|
wait_for_completion(&this_flusher.done);
|
|
|
|
/*
|
|
* Wake-up-and-cascade phase
|
|
*
|
|
* First flushers are responsible for cascading flushes and
|
|
* handling overflow. Non-first flushers can simply return.
|
|
*/
|
|
if (READ_ONCE(wq->first_flusher) != &this_flusher)
|
|
return;
|
|
|
|
mutex_lock(&wq->mutex);
|
|
|
|
/* we might have raced, check again with mutex held */
|
|
if (wq->first_flusher != &this_flusher)
|
|
goto out_unlock;
|
|
|
|
WRITE_ONCE(wq->first_flusher, NULL);
|
|
|
|
WARN_ON_ONCE(!list_empty(&this_flusher.list));
|
|
WARN_ON_ONCE(wq->flush_color != this_flusher.flush_color);
|
|
|
|
while (true) {
|
|
struct wq_flusher *next, *tmp;
|
|
|
|
/* complete all the flushers sharing the current flush color */
|
|
list_for_each_entry_safe(next, tmp, &wq->flusher_queue, list) {
|
|
if (next->flush_color != wq->flush_color)
|
|
break;
|
|
list_del_init(&next->list);
|
|
complete(&next->done);
|
|
}
|
|
|
|
WARN_ON_ONCE(!list_empty(&wq->flusher_overflow) &&
|
|
wq->flush_color != work_next_color(wq->work_color));
|
|
|
|
/* this flush_color is finished, advance by one */
|
|
wq->flush_color = work_next_color(wq->flush_color);
|
|
|
|
/* one color has been freed, handle overflow queue */
|
|
if (!list_empty(&wq->flusher_overflow)) {
|
|
/*
|
|
* Assign the same color to all overflowed
|
|
* flushers, advance work_color and append to
|
|
* flusher_queue. This is the start-to-wait
|
|
* phase for these overflowed flushers.
|
|
*/
|
|
list_for_each_entry(tmp, &wq->flusher_overflow, list)
|
|
tmp->flush_color = wq->work_color;
|
|
|
|
wq->work_color = work_next_color(wq->work_color);
|
|
|
|
list_splice_tail_init(&wq->flusher_overflow,
|
|
&wq->flusher_queue);
|
|
flush_workqueue_prep_pwqs(wq, -1, wq->work_color);
|
|
}
|
|
|
|
if (list_empty(&wq->flusher_queue)) {
|
|
WARN_ON_ONCE(wq->flush_color != wq->work_color);
|
|
break;
|
|
}
|
|
|
|
/*
|
|
* Need to flush more colors. Make the next flusher
|
|
* the new first flusher and arm pwqs.
|
|
*/
|
|
WARN_ON_ONCE(wq->flush_color == wq->work_color);
|
|
WARN_ON_ONCE(wq->flush_color != next->flush_color);
|
|
|
|
list_del_init(&next->list);
|
|
wq->first_flusher = next;
|
|
|
|
if (flush_workqueue_prep_pwqs(wq, wq->flush_color, -1))
|
|
break;
|
|
|
|
/*
|
|
* Meh... this color is already done, clear first
|
|
* flusher and repeat cascading.
|
|
*/
|
|
wq->first_flusher = NULL;
|
|
}
|
|
|
|
out_unlock:
|
|
mutex_unlock(&wq->mutex);
|
|
}
|
|
EXPORT_SYMBOL(flush_workqueue);
|
|
|
|
/**
|
|
* drain_workqueue - drain a workqueue
|
|
* @wq: workqueue to drain
|
|
*
|
|
* Wait until the workqueue becomes empty. While draining is in progress,
|
|
* only chain queueing is allowed. IOW, only currently pending or running
|
|
* work items on @wq can queue further work items on it. @wq is flushed
|
|
* repeatedly until it becomes empty. The number of flushing is determined
|
|
* by the depth of chaining and should be relatively short. Whine if it
|
|
* takes too long.
|
|
*/
|
|
void drain_workqueue(struct workqueue_struct *wq)
|
|
{
|
|
unsigned int flush_cnt = 0;
|
|
struct pool_workqueue *pwq;
|
|
|
|
/*
|
|
* __queue_work() needs to test whether there are drainers, is much
|
|
* hotter than drain_workqueue() and already looks at @wq->flags.
|
|
* Use __WQ_DRAINING so that queue doesn't have to check nr_drainers.
|
|
*/
|
|
mutex_lock(&wq->mutex);
|
|
if (!wq->nr_drainers++)
|
|
wq->flags |= __WQ_DRAINING;
|
|
mutex_unlock(&wq->mutex);
|
|
reflush:
|
|
flush_workqueue(wq);
|
|
|
|
mutex_lock(&wq->mutex);
|
|
|
|
for_each_pwq(pwq, wq) {
|
|
bool drained;
|
|
|
|
raw_spin_lock_irq(&pwq->pool->lock);
|
|
drained = !pwq->nr_active && list_empty(&pwq->delayed_works);
|
|
raw_spin_unlock_irq(&pwq->pool->lock);
|
|
|
|
if (drained)
|
|
continue;
|
|
|
|
if (++flush_cnt == 10 ||
|
|
(flush_cnt % 100 == 0 && flush_cnt <= 1000))
|
|
pr_warn("workqueue %s: drain_workqueue() isn't complete after %u tries\n",
|
|
wq->name, flush_cnt);
|
|
|
|
mutex_unlock(&wq->mutex);
|
|
goto reflush;
|
|
}
|
|
|
|
if (!--wq->nr_drainers)
|
|
wq->flags &= ~__WQ_DRAINING;
|
|
mutex_unlock(&wq->mutex);
|
|
}
|
|
EXPORT_SYMBOL_GPL(drain_workqueue);
|
|
|
|
static bool start_flush_work(struct work_struct *work, struct wq_barrier *barr,
|
|
bool from_cancel)
|
|
{
|
|
struct worker *worker = NULL;
|
|
struct worker_pool *pool;
|
|
struct pool_workqueue *pwq;
|
|
|
|
might_sleep();
|
|
|
|
rcu_read_lock();
|
|
pool = get_work_pool(work);
|
|
if (!pool) {
|
|
rcu_read_unlock();
|
|
return false;
|
|
}
|
|
|
|
raw_spin_lock_irq(&pool->lock);
|
|
/* see the comment in try_to_grab_pending() with the same code */
|
|
pwq = get_work_pwq(work);
|
|
if (pwq) {
|
|
if (unlikely(pwq->pool != pool))
|
|
goto already_gone;
|
|
} else {
|
|
worker = find_worker_executing_work(pool, work);
|
|
if (!worker)
|
|
goto already_gone;
|
|
pwq = worker->current_pwq;
|
|
}
|
|
|
|
check_flush_dependency(pwq->wq, work);
|
|
|
|
insert_wq_barrier(pwq, barr, work, worker);
|
|
raw_spin_unlock_irq(&pool->lock);
|
|
|
|
/*
|
|
* Force a lock recursion deadlock when using flush_work() inside a
|
|
* single-threaded or rescuer equipped workqueue.
|
|
*
|
|
* For single threaded workqueues the deadlock happens when the work
|
|
* is after the work issuing the flush_work(). For rescuer equipped
|
|
* workqueues the deadlock happens when the rescuer stalls, blocking
|
|
* forward progress.
|
|
*/
|
|
if (!from_cancel &&
|
|
(pwq->wq->saved_max_active == 1 || pwq->wq->rescuer)) {
|
|
lock_map_acquire(&pwq->wq->lockdep_map);
|
|
lock_map_release(&pwq->wq->lockdep_map);
|
|
}
|
|
rcu_read_unlock();
|
|
return true;
|
|
already_gone:
|
|
raw_spin_unlock_irq(&pool->lock);
|
|
rcu_read_unlock();
|
|
return false;
|
|
}
|
|
|
|
static bool __flush_work(struct work_struct *work, bool from_cancel)
|
|
{
|
|
struct wq_barrier barr;
|
|
|
|
if (WARN_ON(!wq_online))
|
|
return false;
|
|
|
|
if (WARN_ON(!work->func))
|
|
return false;
|
|
|
|
if (!from_cancel) {
|
|
lock_map_acquire(&work->lockdep_map);
|
|
lock_map_release(&work->lockdep_map);
|
|
}
|
|
|
|
if (start_flush_work(work, &barr, from_cancel)) {
|
|
wait_for_completion(&barr.done);
|
|
destroy_work_on_stack(&barr.work);
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* flush_work - wait for a work to finish executing the last queueing instance
|
|
* @work: the work to flush
|
|
*
|
|
* Wait until @work has finished execution. @work is guaranteed to be idle
|
|
* on return if it hasn't been requeued since flush started.
|
|
*
|
|
* Return:
|
|
* %true if flush_work() waited for the work to finish execution,
|
|
* %false if it was already idle.
|
|
*/
|
|
bool flush_work(struct work_struct *work)
|
|
{
|
|
return __flush_work(work, false);
|
|
}
|
|
EXPORT_SYMBOL_GPL(flush_work);
|
|
|
|
struct cwt_wait {
|
|
wait_queue_entry_t wait;
|
|
struct work_struct *work;
|
|
};
|
|
|
|
static int cwt_wakefn(wait_queue_entry_t *wait, unsigned mode, int sync, void *key)
|
|
{
|
|
struct cwt_wait *cwait = container_of(wait, struct cwt_wait, wait);
|
|
|
|
if (cwait->work != key)
|
|
return 0;
|
|
return autoremove_wake_function(wait, mode, sync, key);
|
|
}
|
|
|
|
static bool __cancel_work_timer(struct work_struct *work, bool is_dwork)
|
|
{
|
|
static DECLARE_WAIT_QUEUE_HEAD(cancel_waitq);
|
|
unsigned long flags;
|
|
int ret;
|
|
|
|
do {
|
|
ret = try_to_grab_pending(work, is_dwork, &flags);
|
|
/*
|
|
* If someone else is already canceling, wait for it to
|
|
* finish. flush_work() doesn't work for PREEMPT_NONE
|
|
* because we may get scheduled between @work's completion
|
|
* and the other canceling task resuming and clearing
|
|
* CANCELING - flush_work() will return false immediately
|
|
* as @work is no longer busy, try_to_grab_pending() will
|
|
* return -ENOENT as @work is still being canceled and the
|
|
* other canceling task won't be able to clear CANCELING as
|
|
* we're hogging the CPU.
|
|
*
|
|
* Let's wait for completion using a waitqueue. As this
|
|
* may lead to the thundering herd problem, use a custom
|
|
* wake function which matches @work along with exclusive
|
|
* wait and wakeup.
|
|
*/
|
|
if (unlikely(ret == -ENOENT)) {
|
|
struct cwt_wait cwait;
|
|
|
|
init_wait(&cwait.wait);
|
|
cwait.wait.func = cwt_wakefn;
|
|
cwait.work = work;
|
|
|
|
prepare_to_wait_exclusive(&cancel_waitq, &cwait.wait,
|
|
TASK_UNINTERRUPTIBLE);
|
|
if (work_is_canceling(work))
|
|
schedule();
|
|
finish_wait(&cancel_waitq, &cwait.wait);
|
|
}
|
|
} while (unlikely(ret < 0));
|
|
|
|
/* tell other tasks trying to grab @work to back off */
|
|
mark_work_canceling(work);
|
|
local_irq_restore(flags);
|
|
|
|
/*
|
|
* This allows canceling during early boot. We know that @work
|
|
* isn't executing.
|
|
*/
|
|
if (wq_online)
|
|
__flush_work(work, true);
|
|
|
|
clear_work_data(work);
|
|
|
|
/*
|
|
* Paired with prepare_to_wait() above so that either
|
|
* waitqueue_active() is visible here or !work_is_canceling() is
|
|
* visible there.
|
|
*/
|
|
smp_mb();
|
|
if (waitqueue_active(&cancel_waitq))
|
|
__wake_up(&cancel_waitq, TASK_NORMAL, 1, work);
|
|
|
|
return ret;
|
|
}
|
|
|
|
/**
|
|
* cancel_work_sync - cancel a work and wait for it to finish
|
|
* @work: the work to cancel
|
|
*
|
|
* Cancel @work and wait for its execution to finish. This function
|
|
* can be used even if the work re-queues itself or migrates to
|
|
* another workqueue. On return from this function, @work is
|
|
* guaranteed to be not pending or executing on any CPU.
|
|
*
|
|
* cancel_work_sync(&delayed_work->work) must not be used for
|
|
* delayed_work's. Use cancel_delayed_work_sync() instead.
|
|
*
|
|
* The caller must ensure that the workqueue on which @work was last
|
|
* queued can't be destroyed before this function returns.
|
|
*
|
|
* Return:
|
|
* %true if @work was pending, %false otherwise.
|
|
*/
|
|
bool cancel_work_sync(struct work_struct *work)
|
|
{
|
|
return __cancel_work_timer(work, false);
|
|
}
|
|
EXPORT_SYMBOL_GPL(cancel_work_sync);
|
|
|
|
/**
|
|
* flush_delayed_work - wait for a dwork to finish executing the last queueing
|
|
* @dwork: the delayed work to flush
|
|
*
|
|
* Delayed timer is cancelled and the pending work is queued for
|
|
* immediate execution. Like flush_work(), this function only
|
|
* considers the last queueing instance of @dwork.
|
|
*
|
|
* Return:
|
|
* %true if flush_work() waited for the work to finish execution,
|
|
* %false if it was already idle.
|
|
*/
|
|
bool flush_delayed_work(struct delayed_work *dwork)
|
|
{
|
|
local_irq_disable();
|
|
if (del_timer_sync(&dwork->timer))
|
|
__queue_work(dwork->cpu, dwork->wq, &dwork->work);
|
|
local_irq_enable();
|
|
return flush_work(&dwork->work);
|
|
}
|
|
EXPORT_SYMBOL(flush_delayed_work);
|
|
|
|
/**
|
|
* flush_rcu_work - wait for a rwork to finish executing the last queueing
|
|
* @rwork: the rcu work to flush
|
|
*
|
|
* Return:
|
|
* %true if flush_rcu_work() waited for the work to finish execution,
|
|
* %false if it was already idle.
|
|
*/
|
|
bool flush_rcu_work(struct rcu_work *rwork)
|
|
{
|
|
if (test_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(&rwork->work))) {
|
|
rcu_barrier();
|
|
flush_work(&rwork->work);
|
|
return true;
|
|
} else {
|
|
return flush_work(&rwork->work);
|
|
}
|
|
}
|
|
EXPORT_SYMBOL(flush_rcu_work);
|
|
|
|
static bool __cancel_work(struct work_struct *work, bool is_dwork)
|
|
{
|
|
unsigned long flags;
|
|
int ret;
|
|
|
|
do {
|
|
ret = try_to_grab_pending(work, is_dwork, &flags);
|
|
} while (unlikely(ret == -EAGAIN));
|
|
|
|
if (unlikely(ret < 0))
|
|
return false;
|
|
|
|
set_work_pool_and_clear_pending(work, get_work_pool_id(work));
|
|
local_irq_restore(flags);
|
|
return ret;
|
|
}
|
|
|
|
/**
|
|
* cancel_delayed_work - cancel a delayed work
|
|
* @dwork: delayed_work to cancel
|
|
*
|
|
* Kill off a pending delayed_work.
|
|
*
|
|
* Return: %true if @dwork was pending and canceled; %false if it wasn't
|
|
* pending.
|
|
*
|
|
* Note:
|
|
* The work callback function may still be running on return, unless
|
|
* it returns %true and the work doesn't re-arm itself. Explicitly flush or
|
|
* use cancel_delayed_work_sync() to wait on it.
|
|
*
|
|
* This function is safe to call from any context including IRQ handler.
|
|
*/
|
|
bool cancel_delayed_work(struct delayed_work *dwork)
|
|
{
|
|
return __cancel_work(&dwork->work, true);
|
|
}
|
|
EXPORT_SYMBOL(cancel_delayed_work);
|
|
|
|
/**
|
|
* cancel_delayed_work_sync - cancel a delayed work and wait for it to finish
|
|
* @dwork: the delayed work cancel
|
|
*
|
|
* This is cancel_work_sync() for delayed works.
|
|
*
|
|
* Return:
|
|
* %true if @dwork was pending, %false otherwise.
|
|
*/
|
|
bool cancel_delayed_work_sync(struct delayed_work *dwork)
|
|
{
|
|
return __cancel_work_timer(&dwork->work, true);
|
|
}
|
|
EXPORT_SYMBOL(cancel_delayed_work_sync);
|
|
|
|
/**
|
|
* schedule_on_each_cpu - execute a function synchronously on each online CPU
|
|
* @func: the function to call
|
|
*
|
|
* schedule_on_each_cpu() executes @func on each online CPU using the
|
|
* system workqueue and blocks until all CPUs have completed.
|
|
* schedule_on_each_cpu() is very slow.
|
|
*
|
|
* Return:
|
|
* 0 on success, -errno on failure.
|
|
*/
|
|
int schedule_on_each_cpu(work_func_t func)
|
|
{
|
|
int cpu;
|
|
struct work_struct __percpu *works;
|
|
|
|
works = alloc_percpu(struct work_struct);
|
|
if (!works)
|
|
return -ENOMEM;
|
|
|
|
get_online_cpus();
|
|
|
|
for_each_online_cpu(cpu) {
|
|
struct work_struct *work = per_cpu_ptr(works, cpu);
|
|
|
|
INIT_WORK(work, func);
|
|
schedule_work_on(cpu, work);
|
|
}
|
|
|
|
for_each_online_cpu(cpu)
|
|
flush_work(per_cpu_ptr(works, cpu));
|
|
|
|
put_online_cpus();
|
|
free_percpu(works);
|
|
return 0;
|
|
}
|
|
|
|
/**
|
|
* execute_in_process_context - reliably execute the routine with user context
|
|
* @fn: the function to execute
|
|
* @ew: guaranteed storage for the execute work structure (must
|
|
* be available when the work executes)
|
|
*
|
|
* Executes the function immediately if process context is available,
|
|
* otherwise schedules the function for delayed execution.
|
|
*
|
|
* Return: 0 - function was executed
|
|
* 1 - function was scheduled for execution
|
|
*/
|
|
int execute_in_process_context(work_func_t fn, struct execute_work *ew)
|
|
{
|
|
if (!in_interrupt()) {
|
|
fn(&ew->work);
|
|
return 0;
|
|
}
|
|
|
|
INIT_WORK(&ew->work, fn);
|
|
schedule_work(&ew->work);
|
|
|
|
return 1;
|
|
}
|
|
EXPORT_SYMBOL_GPL(execute_in_process_context);
|
|
|
|
/**
|
|
* free_workqueue_attrs - free a workqueue_attrs
|
|
* @attrs: workqueue_attrs to free
|
|
*
|
|
* Undo alloc_workqueue_attrs().
|
|
*/
|
|
void free_workqueue_attrs(struct workqueue_attrs *attrs)
|
|
{
|
|
if (attrs) {
|
|
free_cpumask_var(attrs->cpumask);
|
|
kfree(attrs);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* alloc_workqueue_attrs - allocate a workqueue_attrs
|
|
*
|
|
* Allocate a new workqueue_attrs, initialize with default settings and
|
|
* return it.
|
|
*
|
|
* Return: The allocated new workqueue_attr on success. %NULL on failure.
|
|
*/
|
|
struct workqueue_attrs *alloc_workqueue_attrs(void)
|
|
{
|
|
struct workqueue_attrs *attrs;
|
|
|
|
attrs = kzalloc(sizeof(*attrs), GFP_KERNEL);
|
|
if (!attrs)
|
|
goto fail;
|
|
if (!alloc_cpumask_var(&attrs->cpumask, GFP_KERNEL))
|
|
goto fail;
|
|
|
|
cpumask_copy(attrs->cpumask, cpu_possible_mask);
|
|
return attrs;
|
|
fail:
|
|
free_workqueue_attrs(attrs);
|
|
return NULL;
|
|
}
|
|
|
|
static void copy_workqueue_attrs(struct workqueue_attrs *to,
|
|
const struct workqueue_attrs *from)
|
|
{
|
|
to->nice = from->nice;
|
|
cpumask_copy(to->cpumask, from->cpumask);
|
|
/*
|
|
* Unlike hash and equality test, this function doesn't ignore
|
|
* ->no_numa as it is used for both pool and wq attrs. Instead,
|
|
* get_unbound_pool() explicitly clears ->no_numa after copying.
|
|
*/
|
|
to->no_numa = from->no_numa;
|
|
}
|
|
|
|
/* hash value of the content of @attr */
|
|
static u32 wqattrs_hash(const struct workqueue_attrs *attrs)
|
|
{
|
|
u32 hash = 0;
|
|
|
|
hash = jhash_1word(attrs->nice, hash);
|
|
hash = jhash(cpumask_bits(attrs->cpumask),
|
|
BITS_TO_LONGS(nr_cpumask_bits) * sizeof(long), hash);
|
|
return hash;
|
|
}
|
|
|
|
/* content equality test */
|
|
static bool wqattrs_equal(const struct workqueue_attrs *a,
|
|
const struct workqueue_attrs *b)
|
|
{
|
|
if (a->nice != b->nice)
|
|
return false;
|
|
if (!cpumask_equal(a->cpumask, b->cpumask))
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* init_worker_pool - initialize a newly zalloc'd worker_pool
|
|
* @pool: worker_pool to initialize
|
|
*
|
|
* Initialize a newly zalloc'd @pool. It also allocates @pool->attrs.
|
|
*
|
|
* Return: 0 on success, -errno on failure. Even on failure, all fields
|
|
* inside @pool proper are initialized and put_unbound_pool() can be called
|
|
* on @pool safely to release it.
|
|
*/
|
|
static int init_worker_pool(struct worker_pool *pool)
|
|
{
|
|
raw_spin_lock_init(&pool->lock);
|
|
pool->id = -1;
|
|
pool->cpu = -1;
|
|
pool->node = NUMA_NO_NODE;
|
|
pool->flags |= POOL_DISASSOCIATED;
|
|
pool->watchdog_ts = jiffies;
|
|
INIT_LIST_HEAD(&pool->worklist);
|
|
INIT_LIST_HEAD(&pool->idle_list);
|
|
hash_init(pool->busy_hash);
|
|
|
|
timer_setup(&pool->idle_timer, idle_worker_timeout, TIMER_DEFERRABLE);
|
|
|
|
timer_setup(&pool->mayday_timer, pool_mayday_timeout, 0);
|
|
|
|
INIT_LIST_HEAD(&pool->workers);
|
|
|
|
ida_init(&pool->worker_ida);
|
|
INIT_HLIST_NODE(&pool->hash_node);
|
|
pool->refcnt = 1;
|
|
|
|
/* shouldn't fail above this point */
|
|
pool->attrs = alloc_workqueue_attrs();
|
|
if (!pool->attrs)
|
|
return -ENOMEM;
|
|
return 0;
|
|
}
|
|
|
|
#ifdef CONFIG_LOCKDEP
|
|
static void wq_init_lockdep(struct workqueue_struct *wq)
|
|
{
|
|
char *lock_name;
|
|
|
|
lockdep_register_key(&wq->key);
|
|
lock_name = kasprintf(GFP_KERNEL, "%s%s", "(wq_completion)", wq->name);
|
|
if (!lock_name)
|
|
lock_name = wq->name;
|
|
|
|
wq->lock_name = lock_name;
|
|
lockdep_init_map(&wq->lockdep_map, lock_name, &wq->key, 0);
|
|
}
|
|
|
|
static void wq_unregister_lockdep(struct workqueue_struct *wq)
|
|
{
|
|
lockdep_unregister_key(&wq->key);
|
|
}
|
|
|
|
static void wq_free_lockdep(struct workqueue_struct *wq)
|
|
{
|
|
if (wq->lock_name != wq->name)
|
|
kfree(wq->lock_name);
|
|
}
|
|
#else
|
|
static void wq_init_lockdep(struct workqueue_struct *wq)
|
|
{
|
|
}
|
|
|
|
static void wq_unregister_lockdep(struct workqueue_struct *wq)
|
|
{
|
|
}
|
|
|
|
static void wq_free_lockdep(struct workqueue_struct *wq)
|
|
{
|
|
}
|
|
#endif
|
|
|
|
static void rcu_free_wq(struct rcu_head *rcu)
|
|
{
|
|
struct workqueue_struct *wq =
|
|
container_of(rcu, struct workqueue_struct, rcu);
|
|
|
|
wq_free_lockdep(wq);
|
|
|
|
if (!(wq->flags & WQ_UNBOUND))
|
|
free_percpu(wq->cpu_pwqs);
|
|
else
|
|
free_workqueue_attrs(wq->unbound_attrs);
|
|
|
|
kfree(wq);
|
|
}
|
|
|
|
static void rcu_free_pool(struct rcu_head *rcu)
|
|
{
|
|
struct worker_pool *pool = container_of(rcu, struct worker_pool, rcu);
|
|
|
|
ida_destroy(&pool->worker_ida);
|
|
free_workqueue_attrs(pool->attrs);
|
|
kfree(pool);
|
|
}
|
|
|
|
/* This returns with the lock held on success (pool manager is inactive). */
|
|
static bool wq_manager_inactive(struct worker_pool *pool)
|
|
{
|
|
raw_spin_lock_irq(&pool->lock);
|
|
|
|
if (pool->flags & POOL_MANAGER_ACTIVE) {
|
|
raw_spin_unlock_irq(&pool->lock);
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* put_unbound_pool - put a worker_pool
|
|
* @pool: worker_pool to put
|
|
*
|
|
* Put @pool. If its refcnt reaches zero, it gets destroyed in RCU
|
|
* safe manner. get_unbound_pool() calls this function on its failure path
|
|
* and this function should be able to release pools which went through,
|
|
* successfully or not, init_worker_pool().
|
|
*
|
|
* Should be called with wq_pool_mutex held.
|
|
*/
|
|
static void put_unbound_pool(struct worker_pool *pool)
|
|
{
|
|
DECLARE_COMPLETION_ONSTACK(detach_completion);
|
|
struct worker *worker;
|
|
|
|
lockdep_assert_held(&wq_pool_mutex);
|
|
|
|
if (--pool->refcnt)
|
|
return;
|
|
|
|
/* sanity checks */
|
|
if (WARN_ON(!(pool->cpu < 0)) ||
|
|
WARN_ON(!list_empty(&pool->worklist)))
|
|
return;
|
|
|
|
/* release id and unhash */
|
|
if (pool->id >= 0)
|
|
idr_remove(&worker_pool_idr, pool->id);
|
|
hash_del(&pool->hash_node);
|
|
|
|
/*
|
|
* Become the manager and destroy all workers. This prevents
|
|
* @pool's workers from blocking on attach_mutex. We're the last
|
|
* manager and @pool gets freed with the flag set.
|
|
* Because of how wq_manager_inactive() works, we will hold the
|
|
* spinlock after a successful wait.
|
|
*/
|
|
rcuwait_wait_event(&manager_wait, wq_manager_inactive(pool),
|
|
TASK_UNINTERRUPTIBLE);
|
|
pool->flags |= POOL_MANAGER_ACTIVE;
|
|
|
|
while ((worker = first_idle_worker(pool)))
|
|
destroy_worker(worker);
|
|
WARN_ON(pool->nr_workers || pool->nr_idle);
|
|
raw_spin_unlock_irq(&pool->lock);
|
|
|
|
mutex_lock(&wq_pool_attach_mutex);
|
|
if (!list_empty(&pool->workers))
|
|
pool->detach_completion = &detach_completion;
|
|
mutex_unlock(&wq_pool_attach_mutex);
|
|
|
|
if (pool->detach_completion)
|
|
wait_for_completion(pool->detach_completion);
|
|
|
|
/* shut down the timers */
|
|
del_timer_sync(&pool->idle_timer);
|
|
del_timer_sync(&pool->mayday_timer);
|
|
|
|
/* RCU protected to allow dereferences from get_work_pool() */
|
|
call_rcu(&pool->rcu, rcu_free_pool);
|
|
}
|
|
|
|
/**
|
|
* get_unbound_pool - get a worker_pool with the specified attributes
|
|
* @attrs: the attributes of the worker_pool to get
|
|
*
|
|
* Obtain a worker_pool which has the same attributes as @attrs, bump the
|
|
* reference count and return it. If there already is a matching
|
|
* worker_pool, it will be used; otherwise, this function attempts to
|
|
* create a new one.
|
|
*
|
|
* Should be called with wq_pool_mutex held.
|
|
*
|
|
* Return: On success, a worker_pool with the same attributes as @attrs.
|
|
* On failure, %NULL.
|
|
*/
|
|
static struct worker_pool *get_unbound_pool(const struct workqueue_attrs *attrs)
|
|
{
|
|
u32 hash = wqattrs_hash(attrs);
|
|
struct worker_pool *pool;
|
|
int node;
|
|
int target_node = NUMA_NO_NODE;
|
|
|
|
lockdep_assert_held(&wq_pool_mutex);
|
|
|
|
/* do we already have a matching pool? */
|
|
hash_for_each_possible(unbound_pool_hash, pool, hash_node, hash) {
|
|
if (wqattrs_equal(pool->attrs, attrs)) {
|
|
pool->refcnt++;
|
|
return pool;
|
|
}
|
|
}
|
|
|
|
/* if cpumask is contained inside a NUMA node, we belong to that node */
|
|
if (wq_numa_enabled) {
|
|
for_each_node(node) {
|
|
if (cpumask_subset(attrs->cpumask,
|
|
wq_numa_possible_cpumask[node])) {
|
|
target_node = node;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
/* nope, create a new one */
|
|
pool = kzalloc_node(sizeof(*pool), GFP_KERNEL, target_node);
|
|
if (!pool || init_worker_pool(pool) < 0)
|
|
goto fail;
|
|
|
|
lockdep_set_subclass(&pool->lock, 1); /* see put_pwq() */
|
|
copy_workqueue_attrs(pool->attrs, attrs);
|
|
pool->node = target_node;
|
|
|
|
/*
|
|
* no_numa isn't a worker_pool attribute, always clear it. See
|
|
* 'struct workqueue_attrs' comments for detail.
|
|
*/
|
|
pool->attrs->no_numa = false;
|
|
|
|
if (worker_pool_assign_id(pool) < 0)
|
|
goto fail;
|
|
|
|
/* create and start the initial worker */
|
|
if (wq_online && !create_worker(pool))
|
|
goto fail;
|
|
|
|
/* install */
|
|
hash_add(unbound_pool_hash, &pool->hash_node, hash);
|
|
|
|
return pool;
|
|
fail:
|
|
if (pool)
|
|
put_unbound_pool(pool);
|
|
return NULL;
|
|
}
|
|
|
|
static void rcu_free_pwq(struct rcu_head *rcu)
|
|
{
|
|
kmem_cache_free(pwq_cache,
|
|
container_of(rcu, struct pool_workqueue, rcu));
|
|
}
|
|
|
|
/*
|
|
* Scheduled on system_wq by put_pwq() when an unbound pwq hits zero refcnt
|
|
* and needs to be destroyed.
|
|
*/
|
|
static void pwq_unbound_release_workfn(struct work_struct *work)
|
|
{
|
|
struct pool_workqueue *pwq = container_of(work, struct pool_workqueue,
|
|
unbound_release_work);
|
|
struct workqueue_struct *wq = pwq->wq;
|
|
struct worker_pool *pool = pwq->pool;
|
|
bool is_last = false;
|
|
|
|
/*
|
|
* when @pwq is not linked, it doesn't hold any reference to the
|
|
* @wq, and @wq is invalid to access.
|
|
*/
|
|
if (!list_empty(&pwq->pwqs_node)) {
|
|
if (WARN_ON_ONCE(!(wq->flags & WQ_UNBOUND)))
|
|
return;
|
|
|
|
mutex_lock(&wq->mutex);
|
|
list_del_rcu(&pwq->pwqs_node);
|
|
is_last = list_empty(&wq->pwqs);
|
|
mutex_unlock(&wq->mutex);
|
|
}
|
|
|
|
mutex_lock(&wq_pool_mutex);
|
|
put_unbound_pool(pool);
|
|
mutex_unlock(&wq_pool_mutex);
|
|
|
|
call_rcu(&pwq->rcu, rcu_free_pwq);
|
|
|
|
/*
|
|
* If we're the last pwq going away, @wq is already dead and no one
|
|
* is gonna access it anymore. Schedule RCU free.
|
|
*/
|
|
if (is_last) {
|
|
wq_unregister_lockdep(wq);
|
|
call_rcu(&wq->rcu, rcu_free_wq);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* pwq_adjust_max_active - update a pwq's max_active to the current setting
|
|
* @pwq: target pool_workqueue
|
|
*
|
|
* If @pwq isn't freezing, set @pwq->max_active to the associated
|
|
* workqueue's saved_max_active and activate delayed work items
|
|
* accordingly. If @pwq is freezing, clear @pwq->max_active to zero.
|
|
*/
|
|
static void pwq_adjust_max_active(struct pool_workqueue *pwq)
|
|
{
|
|
struct workqueue_struct *wq = pwq->wq;
|
|
bool freezable = wq->flags & WQ_FREEZABLE;
|
|
unsigned long flags;
|
|
|
|
/* for @wq->saved_max_active */
|
|
lockdep_assert_held(&wq->mutex);
|
|
|
|
/* fast exit for non-freezable wqs */
|
|
if (!freezable && pwq->max_active == wq->saved_max_active)
|
|
return;
|
|
|
|
/* this function can be called during early boot w/ irq disabled */
|
|
raw_spin_lock_irqsave(&pwq->pool->lock, flags);
|
|
|
|
/*
|
|
* During [un]freezing, the caller is responsible for ensuring that
|
|
* this function is called at least once after @workqueue_freezing
|
|
* is updated and visible.
|
|
*/
|
|
if (!freezable || !workqueue_freezing) {
|
|
bool kick = false;
|
|
|
|
pwq->max_active = wq->saved_max_active;
|
|
|
|
while (!list_empty(&pwq->delayed_works) &&
|
|
pwq->nr_active < pwq->max_active) {
|
|
pwq_activate_first_delayed(pwq);
|
|
kick = true;
|
|
}
|
|
|
|
/*
|
|
* Need to kick a worker after thawed or an unbound wq's
|
|
* max_active is bumped. In realtime scenarios, always kicking a
|
|
* worker will cause interference on the isolated cpu cores, so
|
|
* let's kick iff work items were activated.
|
|
*/
|
|
if (kick)
|
|
wake_up_worker(pwq->pool);
|
|
} else {
|
|
pwq->max_active = 0;
|
|
}
|
|
|
|
raw_spin_unlock_irqrestore(&pwq->pool->lock, flags);
|
|
}
|
|
|
|
/* initialize newly alloced @pwq which is associated with @wq and @pool */
|
|
static void init_pwq(struct pool_workqueue *pwq, struct workqueue_struct *wq,
|
|
struct worker_pool *pool)
|
|
{
|
|
BUG_ON((unsigned long)pwq & WORK_STRUCT_FLAG_MASK);
|
|
|
|
memset(pwq, 0, sizeof(*pwq));
|
|
|
|
pwq->pool = pool;
|
|
pwq->wq = wq;
|
|
pwq->flush_color = -1;
|
|
pwq->refcnt = 1;
|
|
INIT_LIST_HEAD(&pwq->delayed_works);
|
|
INIT_LIST_HEAD(&pwq->pwqs_node);
|
|
INIT_LIST_HEAD(&pwq->mayday_node);
|
|
INIT_WORK(&pwq->unbound_release_work, pwq_unbound_release_workfn);
|
|
}
|
|
|
|
/* sync @pwq with the current state of its associated wq and link it */
|
|
static void link_pwq(struct pool_workqueue *pwq)
|
|
{
|
|
struct workqueue_struct *wq = pwq->wq;
|
|
|
|
lockdep_assert_held(&wq->mutex);
|
|
|
|
/* may be called multiple times, ignore if already linked */
|
|
if (!list_empty(&pwq->pwqs_node))
|
|
return;
|
|
|
|
/* set the matching work_color */
|
|
pwq->work_color = wq->work_color;
|
|
|
|
/* sync max_active to the current setting */
|
|
pwq_adjust_max_active(pwq);
|
|
|
|
/* link in @pwq */
|
|
list_add_rcu(&pwq->pwqs_node, &wq->pwqs);
|
|
}
|
|
|
|
/* obtain a pool matching @attr and create a pwq associating the pool and @wq */
|
|
static struct pool_workqueue *alloc_unbound_pwq(struct workqueue_struct *wq,
|
|
const struct workqueue_attrs *attrs)
|
|
{
|
|
struct worker_pool *pool;
|
|
struct pool_workqueue *pwq;
|
|
|
|
lockdep_assert_held(&wq_pool_mutex);
|
|
|
|
pool = get_unbound_pool(attrs);
|
|
if (!pool)
|
|
return NULL;
|
|
|
|
pwq = kmem_cache_alloc_node(pwq_cache, GFP_KERNEL, pool->node);
|
|
if (!pwq) {
|
|
put_unbound_pool(pool);
|
|
return NULL;
|
|
}
|
|
|
|
init_pwq(pwq, wq, pool);
|
|
return pwq;
|
|
}
|
|
|
|
/**
|
|
* wq_calc_node_cpumask - calculate a wq_attrs' cpumask for the specified node
|
|
* @attrs: the wq_attrs of the default pwq of the target workqueue
|
|
* @node: the target NUMA node
|
|
* @cpu_going_down: if >= 0, the CPU to consider as offline
|
|
* @cpumask: outarg, the resulting cpumask
|
|
*
|
|
* Calculate the cpumask a workqueue with @attrs should use on @node. If
|
|
* @cpu_going_down is >= 0, that cpu is considered offline during
|
|
* calculation. The result is stored in @cpumask.
|
|
*
|
|
* If NUMA affinity is not enabled, @attrs->cpumask is always used. If
|
|
* enabled and @node has online CPUs requested by @attrs, the returned
|
|
* cpumask is the intersection of the possible CPUs of @node and
|
|
* @attrs->cpumask.
|
|
*
|
|
* The caller is responsible for ensuring that the cpumask of @node stays
|
|
* stable.
|
|
*
|
|
* Return: %true if the resulting @cpumask is different from @attrs->cpumask,
|
|
* %false if equal.
|
|
*/
|
|
static bool wq_calc_node_cpumask(const struct workqueue_attrs *attrs, int node,
|
|
int cpu_going_down, cpumask_t *cpumask)
|
|
{
|
|
if (!wq_numa_enabled || attrs->no_numa)
|
|
goto use_dfl;
|
|
|
|
/* does @node have any online CPUs @attrs wants? */
|
|
cpumask_and(cpumask, cpumask_of_node(node), attrs->cpumask);
|
|
if (cpu_going_down >= 0)
|
|
cpumask_clear_cpu(cpu_going_down, cpumask);
|
|
|
|
if (cpumask_empty(cpumask))
|
|
goto use_dfl;
|
|
|
|
/* yeap, return possible CPUs in @node that @attrs wants */
|
|
cpumask_and(cpumask, attrs->cpumask, wq_numa_possible_cpumask[node]);
|
|
|
|
if (cpumask_empty(cpumask)) {
|
|
pr_warn_once("WARNING: workqueue cpumask: online intersect > "
|
|
"possible intersect\n");
|
|
return false;
|
|
}
|
|
|
|
return !cpumask_equal(cpumask, attrs->cpumask);
|
|
|
|
use_dfl:
|
|
cpumask_copy(cpumask, attrs->cpumask);
|
|
return false;
|
|
}
|
|
|
|
/* install @pwq into @wq's numa_pwq_tbl[] for @node and return the old pwq */
|
|
static struct pool_workqueue *numa_pwq_tbl_install(struct workqueue_struct *wq,
|
|
int node,
|
|
struct pool_workqueue *pwq)
|
|
{
|
|
struct pool_workqueue *old_pwq;
|
|
|
|
lockdep_assert_held(&wq_pool_mutex);
|
|
lockdep_assert_held(&wq->mutex);
|
|
|
|
/* link_pwq() can handle duplicate calls */
|
|
link_pwq(pwq);
|
|
|
|
old_pwq = rcu_access_pointer(wq->numa_pwq_tbl[node]);
|
|
rcu_assign_pointer(wq->numa_pwq_tbl[node], pwq);
|
|
return old_pwq;
|
|
}
|
|
|
|
/* context to store the prepared attrs & pwqs before applying */
|
|
struct apply_wqattrs_ctx {
|
|
struct workqueue_struct *wq; /* target workqueue */
|
|
struct workqueue_attrs *attrs; /* attrs to apply */
|
|
struct list_head list; /* queued for batching commit */
|
|
struct pool_workqueue *dfl_pwq;
|
|
struct pool_workqueue *pwq_tbl[];
|
|
};
|
|
|
|
/* free the resources after success or abort */
|
|
static void apply_wqattrs_cleanup(struct apply_wqattrs_ctx *ctx)
|
|
{
|
|
if (ctx) {
|
|
int node;
|
|
|
|
for_each_node(node)
|
|
put_pwq_unlocked(ctx->pwq_tbl[node]);
|
|
put_pwq_unlocked(ctx->dfl_pwq);
|
|
|
|
free_workqueue_attrs(ctx->attrs);
|
|
|
|
kfree(ctx);
|
|
}
|
|
}
|
|
|
|
/* allocate the attrs and pwqs for later installation */
|
|
static struct apply_wqattrs_ctx *
|
|
apply_wqattrs_prepare(struct workqueue_struct *wq,
|
|
const struct workqueue_attrs *attrs)
|
|
{
|
|
struct apply_wqattrs_ctx *ctx;
|
|
struct workqueue_attrs *new_attrs, *tmp_attrs;
|
|
int node;
|
|
|
|
lockdep_assert_held(&wq_pool_mutex);
|
|
|
|
ctx = kzalloc(struct_size(ctx, pwq_tbl, nr_node_ids), GFP_KERNEL);
|
|
|
|
new_attrs = alloc_workqueue_attrs();
|
|
tmp_attrs = alloc_workqueue_attrs();
|
|
if (!ctx || !new_attrs || !tmp_attrs)
|
|
goto out_free;
|
|
|
|
/*
|
|
* Calculate the attrs of the default pwq.
|
|
* If the user configured cpumask doesn't overlap with the
|
|
* wq_unbound_cpumask, we fallback to the wq_unbound_cpumask.
|
|
*/
|
|
copy_workqueue_attrs(new_attrs, attrs);
|
|
cpumask_and(new_attrs->cpumask, new_attrs->cpumask, wq_unbound_cpumask);
|
|
if (unlikely(cpumask_empty(new_attrs->cpumask)))
|
|
cpumask_copy(new_attrs->cpumask, wq_unbound_cpumask);
|
|
|
|
/*
|
|
* We may create multiple pwqs with differing cpumasks. Make a
|
|
* copy of @new_attrs which will be modified and used to obtain
|
|
* pools.
|
|
*/
|
|
copy_workqueue_attrs(tmp_attrs, new_attrs);
|
|
|
|
/*
|
|
* If something goes wrong during CPU up/down, we'll fall back to
|
|
* the default pwq covering whole @attrs->cpumask. Always create
|
|
* it even if we don't use it immediately.
|
|
*/
|
|
ctx->dfl_pwq = alloc_unbound_pwq(wq, new_attrs);
|
|
if (!ctx->dfl_pwq)
|
|
goto out_free;
|
|
|
|
for_each_node(node) {
|
|
if (wq_calc_node_cpumask(new_attrs, node, -1, tmp_attrs->cpumask)) {
|
|
ctx->pwq_tbl[node] = alloc_unbound_pwq(wq, tmp_attrs);
|
|
if (!ctx->pwq_tbl[node])
|
|
goto out_free;
|
|
} else {
|
|
ctx->dfl_pwq->refcnt++;
|
|
ctx->pwq_tbl[node] = ctx->dfl_pwq;
|
|
}
|
|
}
|
|
|
|
/* save the user configured attrs and sanitize it. */
|
|
copy_workqueue_attrs(new_attrs, attrs);
|
|
cpumask_and(new_attrs->cpumask, new_attrs->cpumask, cpu_possible_mask);
|
|
ctx->attrs = new_attrs;
|
|
|
|
ctx->wq = wq;
|
|
free_workqueue_attrs(tmp_attrs);
|
|
return ctx;
|
|
|
|
out_free:
|
|
free_workqueue_attrs(tmp_attrs);
|
|
free_workqueue_attrs(new_attrs);
|
|
apply_wqattrs_cleanup(ctx);
|
|
return NULL;
|
|
}
|
|
|
|
/* set attrs and install prepared pwqs, @ctx points to old pwqs on return */
|
|
static void apply_wqattrs_commit(struct apply_wqattrs_ctx *ctx)
|
|
{
|
|
int node;
|
|
|
|
/* all pwqs have been created successfully, let's install'em */
|
|
mutex_lock(&ctx->wq->mutex);
|
|
|
|
copy_workqueue_attrs(ctx->wq->unbound_attrs, ctx->attrs);
|
|
|
|
/* save the previous pwq and install the new one */
|
|
for_each_node(node)
|
|
ctx->pwq_tbl[node] = numa_pwq_tbl_install(ctx->wq, node,
|
|
ctx->pwq_tbl[node]);
|
|
|
|
/* @dfl_pwq might not have been used, ensure it's linked */
|
|
link_pwq(ctx->dfl_pwq);
|
|
swap(ctx->wq->dfl_pwq, ctx->dfl_pwq);
|
|
|
|
mutex_unlock(&ctx->wq->mutex);
|
|
}
|
|
|
|
static void apply_wqattrs_lock(void)
|
|
{
|
|
/* CPUs should stay stable across pwq creations and installations */
|
|
get_online_cpus();
|
|
mutex_lock(&wq_pool_mutex);
|
|
}
|
|
|
|
static void apply_wqattrs_unlock(void)
|
|
{
|
|
mutex_unlock(&wq_pool_mutex);
|
|
put_online_cpus();
|
|
}
|
|
|
|
static int apply_workqueue_attrs_locked(struct workqueue_struct *wq,
|
|
const struct workqueue_attrs *attrs)
|
|
{
|
|
struct apply_wqattrs_ctx *ctx;
|
|
|
|
/* only unbound workqueues can change attributes */
|
|
if (WARN_ON(!(wq->flags & WQ_UNBOUND)))
|
|
return -EINVAL;
|
|
|
|
/* creating multiple pwqs breaks ordering guarantee */
|
|
if (!list_empty(&wq->pwqs)) {
|
|
if (WARN_ON(wq->flags & __WQ_ORDERED_EXPLICIT))
|
|
return -EINVAL;
|
|
|
|
wq->flags &= ~__WQ_ORDERED;
|
|
}
|
|
|
|
ctx = apply_wqattrs_prepare(wq, attrs);
|
|
if (!ctx)
|
|
return -ENOMEM;
|
|
|
|
/* the ctx has been prepared successfully, let's commit it */
|
|
apply_wqattrs_commit(ctx);
|
|
apply_wqattrs_cleanup(ctx);
|
|
|
|
return 0;
|
|
}
|
|
|
|
/**
|
|
* apply_workqueue_attrs - apply new workqueue_attrs to an unbound workqueue
|
|
* @wq: the target workqueue
|
|
* @attrs: the workqueue_attrs to apply, allocated with alloc_workqueue_attrs()
|
|
*
|
|
* Apply @attrs to an unbound workqueue @wq. Unless disabled, on NUMA
|
|
* machines, this function maps a separate pwq to each NUMA node with
|
|
* possibles CPUs in @attrs->cpumask so that work items are affine to the
|
|
* NUMA node it was issued on. Older pwqs are released as in-flight work
|
|
* items finish. Note that a work item which repeatedly requeues itself
|
|
* back-to-back will stay on its current pwq.
|
|
*
|
|
* Performs GFP_KERNEL allocations.
|
|
*
|
|
* Assumes caller has CPU hotplug read exclusion, i.e. get_online_cpus().
|
|
*
|
|
* Return: 0 on success and -errno on failure.
|
|
*/
|
|
int apply_workqueue_attrs(struct workqueue_struct *wq,
|
|
const struct workqueue_attrs *attrs)
|
|
{
|
|
int ret;
|
|
|
|
lockdep_assert_cpus_held();
|
|
|
|
mutex_lock(&wq_pool_mutex);
|
|
ret = apply_workqueue_attrs_locked(wq, attrs);
|
|
mutex_unlock(&wq_pool_mutex);
|
|
|
|
return ret;
|
|
}
|
|
|
|
/**
|
|
* wq_update_unbound_numa - update NUMA affinity of a wq for CPU hot[un]plug
|
|
* @wq: the target workqueue
|
|
* @cpu: the CPU coming up or going down
|
|
* @online: whether @cpu is coming up or going down
|
|
*
|
|
* This function is to be called from %CPU_DOWN_PREPARE, %CPU_ONLINE and
|
|
* %CPU_DOWN_FAILED. @cpu is being hot[un]plugged, update NUMA affinity of
|
|
* @wq accordingly.
|
|
*
|
|
* If NUMA affinity can't be adjusted due to memory allocation failure, it
|
|
* falls back to @wq->dfl_pwq which may not be optimal but is always
|
|
* correct.
|
|
*
|
|
* Note that when the last allowed CPU of a NUMA node goes offline for a
|
|
* workqueue with a cpumask spanning multiple nodes, the workers which were
|
|
* already executing the work items for the workqueue will lose their CPU
|
|
* affinity and may execute on any CPU. This is similar to how per-cpu
|
|
* workqueues behave on CPU_DOWN. If a workqueue user wants strict
|
|
* affinity, it's the user's responsibility to flush the work item from
|
|
* CPU_DOWN_PREPARE.
|
|
*/
|
|
static void wq_update_unbound_numa(struct workqueue_struct *wq, int cpu,
|
|
bool online)
|
|
{
|
|
int node = cpu_to_node(cpu);
|
|
int cpu_off = online ? -1 : cpu;
|
|
struct pool_workqueue *old_pwq = NULL, *pwq;
|
|
struct workqueue_attrs *target_attrs;
|
|
cpumask_t *cpumask;
|
|
|
|
lockdep_assert_held(&wq_pool_mutex);
|
|
|
|
if (!wq_numa_enabled || !(wq->flags & WQ_UNBOUND) ||
|
|
wq->unbound_attrs->no_numa)
|
|
return;
|
|
|
|
/*
|
|
* We don't wanna alloc/free wq_attrs for each wq for each CPU.
|
|
* Let's use a preallocated one. The following buf is protected by
|
|
* CPU hotplug exclusion.
|
|
*/
|
|
target_attrs = wq_update_unbound_numa_attrs_buf;
|
|
cpumask = target_attrs->cpumask;
|
|
|
|
copy_workqueue_attrs(target_attrs, wq->unbound_attrs);
|
|
pwq = unbound_pwq_by_node(wq, node);
|
|
|
|
/*
|
|
* Let's determine what needs to be done. If the target cpumask is
|
|
* different from the default pwq's, we need to compare it to @pwq's
|
|
* and create a new one if they don't match. If the target cpumask
|
|
* equals the default pwq's, the default pwq should be used.
|
|
*/
|
|
if (wq_calc_node_cpumask(wq->dfl_pwq->pool->attrs, node, cpu_off, cpumask)) {
|
|
if (cpumask_equal(cpumask, pwq->pool->attrs->cpumask))
|
|
return;
|
|
} else {
|
|
goto use_dfl_pwq;
|
|
}
|
|
|
|
/* create a new pwq */
|
|
pwq = alloc_unbound_pwq(wq, target_attrs);
|
|
if (!pwq) {
|
|
pr_warn("workqueue: allocation failed while updating NUMA affinity of \"%s\"\n",
|
|
wq->name);
|
|
goto use_dfl_pwq;
|
|
}
|
|
|
|
/* Install the new pwq. */
|
|
mutex_lock(&wq->mutex);
|
|
old_pwq = numa_pwq_tbl_install(wq, node, pwq);
|
|
goto out_unlock;
|
|
|
|
use_dfl_pwq:
|
|
mutex_lock(&wq->mutex);
|
|
raw_spin_lock_irq(&wq->dfl_pwq->pool->lock);
|
|
get_pwq(wq->dfl_pwq);
|
|
raw_spin_unlock_irq(&wq->dfl_pwq->pool->lock);
|
|
old_pwq = numa_pwq_tbl_install(wq, node, wq->dfl_pwq);
|
|
out_unlock:
|
|
mutex_unlock(&wq->mutex);
|
|
put_pwq_unlocked(old_pwq);
|
|
}
|
|
|
|
static int alloc_and_link_pwqs(struct workqueue_struct *wq)
|
|
{
|
|
bool highpri = wq->flags & WQ_HIGHPRI;
|
|
int cpu, ret;
|
|
|
|
if (!(wq->flags & WQ_UNBOUND)) {
|
|
wq->cpu_pwqs = alloc_percpu(struct pool_workqueue);
|
|
if (!wq->cpu_pwqs)
|
|
return -ENOMEM;
|
|
|
|
for_each_possible_cpu(cpu) {
|
|
struct pool_workqueue *pwq =
|
|
per_cpu_ptr(wq->cpu_pwqs, cpu);
|
|
struct worker_pool *cpu_pools =
|
|
per_cpu(cpu_worker_pools, cpu);
|
|
|
|
init_pwq(pwq, wq, &cpu_pools[highpri]);
|
|
|
|
mutex_lock(&wq->mutex);
|
|
link_pwq(pwq);
|
|
mutex_unlock(&wq->mutex);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
get_online_cpus();
|
|
if (wq->flags & __WQ_ORDERED) {
|
|
ret = apply_workqueue_attrs(wq, ordered_wq_attrs[highpri]);
|
|
/* there should only be single pwq for ordering guarantee */
|
|
WARN(!ret && (wq->pwqs.next != &wq->dfl_pwq->pwqs_node ||
|
|
wq->pwqs.prev != &wq->dfl_pwq->pwqs_node),
|
|
"ordering guarantee broken for workqueue %s\n", wq->name);
|
|
} else {
|
|
ret = apply_workqueue_attrs(wq, unbound_std_wq_attrs[highpri]);
|
|
}
|
|
put_online_cpus();
|
|
|
|
return ret;
|
|
}
|
|
|
|
static int wq_clamp_max_active(int max_active, unsigned int flags,
|
|
const char *name)
|
|
{
|
|
int lim = flags & WQ_UNBOUND ? WQ_UNBOUND_MAX_ACTIVE : WQ_MAX_ACTIVE;
|
|
|
|
if (max_active < 1 || max_active > lim)
|
|
pr_warn("workqueue: max_active %d requested for %s is out of range, clamping between %d and %d\n",
|
|
max_active, name, 1, lim);
|
|
|
|
return clamp_val(max_active, 1, lim);
|
|
}
|
|
|
|
/*
|
|
* Workqueues which may be used during memory reclaim should have a rescuer
|
|
* to guarantee forward progress.
|
|
*/
|
|
static int init_rescuer(struct workqueue_struct *wq)
|
|
{
|
|
struct worker *rescuer;
|
|
int ret;
|
|
|
|
if (!(wq->flags & WQ_MEM_RECLAIM))
|
|
return 0;
|
|
|
|
rescuer = alloc_worker(NUMA_NO_NODE);
|
|
if (!rescuer)
|
|
return -ENOMEM;
|
|
|
|
rescuer->rescue_wq = wq;
|
|
rescuer->task = kthread_create(rescuer_thread, rescuer, "%s", wq->name);
|
|
if (IS_ERR(rescuer->task)) {
|
|
ret = PTR_ERR(rescuer->task);
|
|
kfree(rescuer);
|
|
return ret;
|
|
}
|
|
|
|
wq->rescuer = rescuer;
|
|
kthread_bind_mask(rescuer->task, cpu_possible_mask);
|
|
wake_up_process(rescuer->task);
|
|
|
|
return 0;
|
|
}
|
|
|
|
__printf(1, 4)
|
|
struct workqueue_struct *alloc_workqueue(const char *fmt,
|
|
unsigned int flags,
|
|
int max_active, ...)
|
|
{
|
|
size_t tbl_size = 0;
|
|
va_list args;
|
|
struct workqueue_struct *wq;
|
|
struct pool_workqueue *pwq;
|
|
|
|
/*
|
|
* Unbound && max_active == 1 used to imply ordered, which is no
|
|
* longer the case on NUMA machines due to per-node pools. While
|
|
* alloc_ordered_workqueue() is the right way to create an ordered
|
|
* workqueue, keep the previous behavior to avoid subtle breakages
|
|
* on NUMA.
|
|
*/
|
|
if ((flags & WQ_UNBOUND) && max_active == 1)
|
|
flags |= __WQ_ORDERED;
|
|
|
|
/* see the comment above the definition of WQ_POWER_EFFICIENT */
|
|
if ((flags & WQ_POWER_EFFICIENT) && wq_power_efficient)
|
|
flags |= WQ_UNBOUND;
|
|
|
|
/* allocate wq and format name */
|
|
if (flags & WQ_UNBOUND)
|
|
tbl_size = nr_node_ids * sizeof(wq->numa_pwq_tbl[0]);
|
|
|
|
wq = kzalloc(sizeof(*wq) + tbl_size, GFP_KERNEL);
|
|
if (!wq)
|
|
return NULL;
|
|
|
|
if (flags & WQ_UNBOUND) {
|
|
wq->unbound_attrs = alloc_workqueue_attrs();
|
|
if (!wq->unbound_attrs)
|
|
goto err_free_wq;
|
|
}
|
|
|
|
va_start(args, max_active);
|
|
vsnprintf(wq->name, sizeof(wq->name), fmt, args);
|
|
va_end(args);
|
|
|
|
max_active = max_active ?: WQ_DFL_ACTIVE;
|
|
max_active = wq_clamp_max_active(max_active, flags, wq->name);
|
|
|
|
/* init wq */
|
|
wq->flags = flags;
|
|
wq->saved_max_active = max_active;
|
|
mutex_init(&wq->mutex);
|
|
atomic_set(&wq->nr_pwqs_to_flush, 0);
|
|
INIT_LIST_HEAD(&wq->pwqs);
|
|
INIT_LIST_HEAD(&wq->flusher_queue);
|
|
INIT_LIST_HEAD(&wq->flusher_overflow);
|
|
INIT_LIST_HEAD(&wq->maydays);
|
|
|
|
wq_init_lockdep(wq);
|
|
INIT_LIST_HEAD(&wq->list);
|
|
|
|
if (alloc_and_link_pwqs(wq) < 0)
|
|
goto err_unreg_lockdep;
|
|
|
|
if (wq_online && init_rescuer(wq) < 0)
|
|
goto err_destroy;
|
|
|
|
if ((wq->flags & WQ_SYSFS) && workqueue_sysfs_register(wq))
|
|
goto err_destroy;
|
|
|
|
/*
|
|
* wq_pool_mutex protects global freeze state and workqueues list.
|
|
* Grab it, adjust max_active and add the new @wq to workqueues
|
|
* list.
|
|
*/
|
|
mutex_lock(&wq_pool_mutex);
|
|
|
|
mutex_lock(&wq->mutex);
|
|
for_each_pwq(pwq, wq)
|
|
pwq_adjust_max_active(pwq);
|
|
mutex_unlock(&wq->mutex);
|
|
|
|
list_add_tail_rcu(&wq->list, &workqueues);
|
|
|
|
mutex_unlock(&wq_pool_mutex);
|
|
|
|
return wq;
|
|
|
|
err_unreg_lockdep:
|
|
wq_unregister_lockdep(wq);
|
|
wq_free_lockdep(wq);
|
|
err_free_wq:
|
|
free_workqueue_attrs(wq->unbound_attrs);
|
|
kfree(wq);
|
|
return NULL;
|
|
err_destroy:
|
|
destroy_workqueue(wq);
|
|
return NULL;
|
|
}
|
|
EXPORT_SYMBOL_GPL(alloc_workqueue);
|
|
|
|
static bool pwq_busy(struct pool_workqueue *pwq)
|
|
{
|
|
int i;
|
|
|
|
for (i = 0; i < WORK_NR_COLORS; i++)
|
|
if (pwq->nr_in_flight[i])
|
|
return true;
|
|
|
|
if ((pwq != pwq->wq->dfl_pwq) && (pwq->refcnt > 1))
|
|
return true;
|
|
if (pwq->nr_active || !list_empty(&pwq->delayed_works))
|
|
return true;
|
|
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* destroy_workqueue - safely terminate a workqueue
|
|
* @wq: target workqueue
|
|
*
|
|
* Safely destroy a workqueue. All work currently pending will be done first.
|
|
*/
|
|
void destroy_workqueue(struct workqueue_struct *wq)
|
|
{
|
|
struct pool_workqueue *pwq;
|
|
int node;
|
|
|
|
/*
|
|
* Remove it from sysfs first so that sanity check failure doesn't
|
|
* lead to sysfs name conflicts.
|
|
*/
|
|
workqueue_sysfs_unregister(wq);
|
|
|
|
/* drain it before proceeding with destruction */
|
|
drain_workqueue(wq);
|
|
|
|
/* kill rescuer, if sanity checks fail, leave it w/o rescuer */
|
|
if (wq->rescuer) {
|
|
struct worker *rescuer = wq->rescuer;
|
|
|
|
/* this prevents new queueing */
|
|
raw_spin_lock_irq(&wq_mayday_lock);
|
|
wq->rescuer = NULL;
|
|
raw_spin_unlock_irq(&wq_mayday_lock);
|
|
|
|
/* rescuer will empty maydays list before exiting */
|
|
kthread_stop(rescuer->task);
|
|
kfree(rescuer);
|
|
}
|
|
|
|
/*
|
|
* Sanity checks - grab all the locks so that we wait for all
|
|
* in-flight operations which may do put_pwq().
|
|
*/
|
|
mutex_lock(&wq_pool_mutex);
|
|
mutex_lock(&wq->mutex);
|
|
for_each_pwq(pwq, wq) {
|
|
raw_spin_lock_irq(&pwq->pool->lock);
|
|
if (WARN_ON(pwq_busy(pwq))) {
|
|
pr_warn("%s: %s has the following busy pwq\n",
|
|
__func__, wq->name);
|
|
show_pwq(pwq);
|
|
raw_spin_unlock_irq(&pwq->pool->lock);
|
|
mutex_unlock(&wq->mutex);
|
|
mutex_unlock(&wq_pool_mutex);
|
|
show_workqueue_state();
|
|
return;
|
|
}
|
|
raw_spin_unlock_irq(&pwq->pool->lock);
|
|
}
|
|
mutex_unlock(&wq->mutex);
|
|
|
|
/*
|
|
* wq list is used to freeze wq, remove from list after
|
|
* flushing is complete in case freeze races us.
|
|
*/
|
|
list_del_rcu(&wq->list);
|
|
mutex_unlock(&wq_pool_mutex);
|
|
|
|
if (!(wq->flags & WQ_UNBOUND)) {
|
|
wq_unregister_lockdep(wq);
|
|
/*
|
|
* The base ref is never dropped on per-cpu pwqs. Directly
|
|
* schedule RCU free.
|
|
*/
|
|
call_rcu(&wq->rcu, rcu_free_wq);
|
|
} else {
|
|
/*
|
|
* We're the sole accessor of @wq at this point. Directly
|
|
* access numa_pwq_tbl[] and dfl_pwq to put the base refs.
|
|
* @wq will be freed when the last pwq is released.
|
|
*/
|
|
for_each_node(node) {
|
|
pwq = rcu_access_pointer(wq->numa_pwq_tbl[node]);
|
|
RCU_INIT_POINTER(wq->numa_pwq_tbl[node], NULL);
|
|
put_pwq_unlocked(pwq);
|
|
}
|
|
|
|
/*
|
|
* Put dfl_pwq. @wq may be freed any time after dfl_pwq is
|
|
* put. Don't access it afterwards.
|
|
*/
|
|
pwq = wq->dfl_pwq;
|
|
wq->dfl_pwq = NULL;
|
|
put_pwq_unlocked(pwq);
|
|
}
|
|
}
|
|
EXPORT_SYMBOL_GPL(destroy_workqueue);
|
|
|
|
/**
|
|
* workqueue_set_max_active - adjust max_active of a workqueue
|
|
* @wq: target workqueue
|
|
* @max_active: new max_active value.
|
|
*
|
|
* Set max_active of @wq to @max_active.
|
|
*
|
|
* CONTEXT:
|
|
* Don't call from IRQ context.
|
|
*/
|
|
void workqueue_set_max_active(struct workqueue_struct *wq, int max_active)
|
|
{
|
|
struct pool_workqueue *pwq;
|
|
|
|
/* disallow meddling with max_active for ordered workqueues */
|
|
if (WARN_ON(wq->flags & __WQ_ORDERED_EXPLICIT))
|
|
return;
|
|
|
|
max_active = wq_clamp_max_active(max_active, wq->flags, wq->name);
|
|
|
|
mutex_lock(&wq->mutex);
|
|
|
|
wq->flags &= ~__WQ_ORDERED;
|
|
wq->saved_max_active = max_active;
|
|
|
|
for_each_pwq(pwq, wq)
|
|
pwq_adjust_max_active(pwq);
|
|
|
|
mutex_unlock(&wq->mutex);
|
|
}
|
|
EXPORT_SYMBOL_GPL(workqueue_set_max_active);
|
|
|
|
/**
|
|
* current_work - retrieve %current task's work struct
|
|
*
|
|
* Determine if %current task is a workqueue worker and what it's working on.
|
|
* Useful to find out the context that the %current task is running in.
|
|
*
|
|
* Return: work struct if %current task is a workqueue worker, %NULL otherwise.
|
|
*/
|
|
struct work_struct *current_work(void)
|
|
{
|
|
struct worker *worker = current_wq_worker();
|
|
|
|
return worker ? worker->current_work : NULL;
|
|
}
|
|
EXPORT_SYMBOL(current_work);
|
|
|
|
/**
|
|
* current_is_workqueue_rescuer - is %current workqueue rescuer?
|
|
*
|
|
* Determine whether %current is a workqueue rescuer. Can be used from
|
|
* work functions to determine whether it's being run off the rescuer task.
|
|
*
|
|
* Return: %true if %current is a workqueue rescuer. %false otherwise.
|
|
*/
|
|
bool current_is_workqueue_rescuer(void)
|
|
{
|
|
struct worker *worker = current_wq_worker();
|
|
|
|
return worker && worker->rescue_wq;
|
|
}
|
|
|
|
/**
|
|
* workqueue_congested - test whether a workqueue is congested
|
|
* @cpu: CPU in question
|
|
* @wq: target workqueue
|
|
*
|
|
* Test whether @wq's cpu workqueue for @cpu is congested. There is
|
|
* no synchronization around this function and the test result is
|
|
* unreliable and only useful as advisory hints or for debugging.
|
|
*
|
|
* If @cpu is WORK_CPU_UNBOUND, the test is performed on the local CPU.
|
|
* Note that both per-cpu and unbound workqueues may be associated with
|
|
* multiple pool_workqueues which have separate congested states. A
|
|
* workqueue being congested on one CPU doesn't mean the workqueue is also
|
|
* contested on other CPUs / NUMA nodes.
|
|
*
|
|
* Return:
|
|
* %true if congested, %false otherwise.
|
|
*/
|
|
bool workqueue_congested(int cpu, struct workqueue_struct *wq)
|
|
{
|
|
struct pool_workqueue *pwq;
|
|
bool ret;
|
|
|
|
rcu_read_lock();
|
|
preempt_disable();
|
|
|
|
if (cpu == WORK_CPU_UNBOUND)
|
|
cpu = smp_processor_id();
|
|
|
|
if (!(wq->flags & WQ_UNBOUND))
|
|
pwq = per_cpu_ptr(wq->cpu_pwqs, cpu);
|
|
else
|
|
pwq = unbound_pwq_by_node(wq, cpu_to_node(cpu));
|
|
|
|
ret = !list_empty(&pwq->delayed_works);
|
|
preempt_enable();
|
|
rcu_read_unlock();
|
|
|
|
return ret;
|
|
}
|
|
EXPORT_SYMBOL_GPL(workqueue_congested);
|
|
|
|
/**
|
|
* work_busy - test whether a work is currently pending or running
|
|
* @work: the work to be tested
|
|
*
|
|
* Test whether @work is currently pending or running. There is no
|
|
* synchronization around this function and the test result is
|
|
* unreliable and only useful as advisory hints or for debugging.
|
|
*
|
|
* Return:
|
|
* OR'd bitmask of WORK_BUSY_* bits.
|
|
*/
|
|
unsigned int work_busy(struct work_struct *work)
|
|
{
|
|
struct worker_pool *pool;
|
|
unsigned long flags;
|
|
unsigned int ret = 0;
|
|
|
|
if (work_pending(work))
|
|
ret |= WORK_BUSY_PENDING;
|
|
|
|
rcu_read_lock();
|
|
pool = get_work_pool(work);
|
|
if (pool) {
|
|
raw_spin_lock_irqsave(&pool->lock, flags);
|
|
if (find_worker_executing_work(pool, work))
|
|
ret |= WORK_BUSY_RUNNING;
|
|
raw_spin_unlock_irqrestore(&pool->lock, flags);
|
|
}
|
|
rcu_read_unlock();
|
|
|
|
return ret;
|
|
}
|
|
EXPORT_SYMBOL_GPL(work_busy);
|
|
|
|
/**
|
|
* set_worker_desc - set description for the current work item
|
|
* @fmt: printf-style format string
|
|
* @...: arguments for the format string
|
|
*
|
|
* This function can be called by a running work function to describe what
|
|
* the work item is about. If the worker task gets dumped, this
|
|
* information will be printed out together to help debugging. The
|
|
* description can be at most WORKER_DESC_LEN including the trailing '\0'.
|
|
*/
|
|
void set_worker_desc(const char *fmt, ...)
|
|
{
|
|
struct worker *worker = current_wq_worker();
|
|
va_list args;
|
|
|
|
if (worker) {
|
|
va_start(args, fmt);
|
|
vsnprintf(worker->desc, sizeof(worker->desc), fmt, args);
|
|
va_end(args);
|
|
}
|
|
}
|
|
EXPORT_SYMBOL_GPL(set_worker_desc);
|
|
|
|
/**
|
|
* print_worker_info - print out worker information and description
|
|
* @log_lvl: the log level to use when printing
|
|
* @task: target task
|
|
*
|
|
* If @task is a worker and currently executing a work item, print out the
|
|
* name of the workqueue being serviced and worker description set with
|
|
* set_worker_desc() by the currently executing work item.
|
|
*
|
|
* This function can be safely called on any task as long as the
|
|
* task_struct itself is accessible. While safe, this function isn't
|
|
* synchronized and may print out mixups or garbages of limited length.
|
|
*/
|
|
void print_worker_info(const char *log_lvl, struct task_struct *task)
|
|
{
|
|
work_func_t *fn = NULL;
|
|
char name[WQ_NAME_LEN] = { };
|
|
char desc[WORKER_DESC_LEN] = { };
|
|
struct pool_workqueue *pwq = NULL;
|
|
struct workqueue_struct *wq = NULL;
|
|
struct worker *worker;
|
|
|
|
if (!(task->flags & PF_WQ_WORKER))
|
|
return;
|
|
|
|
/*
|
|
* This function is called without any synchronization and @task
|
|
* could be in any state. Be careful with dereferences.
|
|
*/
|
|
worker = kthread_probe_data(task);
|
|
|
|
/*
|
|
* Carefully copy the associated workqueue's workfn, name and desc.
|
|
* Keep the original last '\0' in case the original is garbage.
|
|
*/
|
|
copy_from_kernel_nofault(&fn, &worker->current_func, sizeof(fn));
|
|
copy_from_kernel_nofault(&pwq, &worker->current_pwq, sizeof(pwq));
|
|
copy_from_kernel_nofault(&wq, &pwq->wq, sizeof(wq));
|
|
copy_from_kernel_nofault(name, wq->name, sizeof(name) - 1);
|
|
copy_from_kernel_nofault(desc, worker->desc, sizeof(desc) - 1);
|
|
|
|
if (fn || name[0] || desc[0]) {
|
|
printk("%sWorkqueue: %s %ps", log_lvl, name, fn);
|
|
if (strcmp(name, desc))
|
|
pr_cont(" (%s)", desc);
|
|
pr_cont("\n");
|
|
}
|
|
}
|
|
|
|
static void pr_cont_pool_info(struct worker_pool *pool)
|
|
{
|
|
pr_cont(" cpus=%*pbl", nr_cpumask_bits, pool->attrs->cpumask);
|
|
if (pool->node != NUMA_NO_NODE)
|
|
pr_cont(" node=%d", pool->node);
|
|
pr_cont(" flags=0x%x nice=%d", pool->flags, pool->attrs->nice);
|
|
}
|
|
|
|
static void pr_cont_work(bool comma, struct work_struct *work)
|
|
{
|
|
if (work->func == wq_barrier_func) {
|
|
struct wq_barrier *barr;
|
|
|
|
barr = container_of(work, struct wq_barrier, work);
|
|
|
|
pr_cont("%s BAR(%d)", comma ? "," : "",
|
|
task_pid_nr(barr->task));
|
|
} else {
|
|
pr_cont("%s %ps", comma ? "," : "", work->func);
|
|
}
|
|
}
|
|
|
|
static void show_pwq(struct pool_workqueue *pwq)
|
|
{
|
|
struct worker_pool *pool = pwq->pool;
|
|
struct work_struct *work;
|
|
struct worker *worker;
|
|
bool has_in_flight = false, has_pending = false;
|
|
int bkt;
|
|
|
|
pr_info(" pwq %d:", pool->id);
|
|
pr_cont_pool_info(pool);
|
|
|
|
pr_cont(" active=%d/%d refcnt=%d%s\n",
|
|
pwq->nr_active, pwq->max_active, pwq->refcnt,
|
|
!list_empty(&pwq->mayday_node) ? " MAYDAY" : "");
|
|
|
|
hash_for_each(pool->busy_hash, bkt, worker, hentry) {
|
|
if (worker->current_pwq == pwq) {
|
|
has_in_flight = true;
|
|
break;
|
|
}
|
|
}
|
|
if (has_in_flight) {
|
|
bool comma = false;
|
|
|
|
pr_info(" in-flight:");
|
|
hash_for_each(pool->busy_hash, bkt, worker, hentry) {
|
|
if (worker->current_pwq != pwq)
|
|
continue;
|
|
|
|
pr_cont("%s %d%s:%ps", comma ? "," : "",
|
|
task_pid_nr(worker->task),
|
|
worker->rescue_wq ? "(RESCUER)" : "",
|
|
worker->current_func);
|
|
list_for_each_entry(work, &worker->scheduled, entry)
|
|
pr_cont_work(false, work);
|
|
comma = true;
|
|
}
|
|
pr_cont("\n");
|
|
}
|
|
|
|
list_for_each_entry(work, &pool->worklist, entry) {
|
|
if (get_work_pwq(work) == pwq) {
|
|
has_pending = true;
|
|
break;
|
|
}
|
|
}
|
|
if (has_pending) {
|
|
bool comma = false;
|
|
|
|
pr_info(" pending:");
|
|
list_for_each_entry(work, &pool->worklist, entry) {
|
|
if (get_work_pwq(work) != pwq)
|
|
continue;
|
|
|
|
pr_cont_work(comma, work);
|
|
comma = !(*work_data_bits(work) & WORK_STRUCT_LINKED);
|
|
}
|
|
pr_cont("\n");
|
|
}
|
|
|
|
if (!list_empty(&pwq->delayed_works)) {
|
|
bool comma = false;
|
|
|
|
pr_info(" delayed:");
|
|
list_for_each_entry(work, &pwq->delayed_works, entry) {
|
|
pr_cont_work(comma, work);
|
|
comma = !(*work_data_bits(work) & WORK_STRUCT_LINKED);
|
|
}
|
|
pr_cont("\n");
|
|
}
|
|
}
|
|
|
|
/**
|
|
* show_workqueue_state - dump workqueue state
|
|
*
|
|
* Called from a sysrq handler or try_to_freeze_tasks() and prints out
|
|
* all busy workqueues and pools.
|
|
*/
|
|
void show_workqueue_state(void)
|
|
{
|
|
struct workqueue_struct *wq;
|
|
struct worker_pool *pool;
|
|
unsigned long flags;
|
|
int pi;
|
|
|
|
rcu_read_lock();
|
|
|
|
pr_info("Showing busy workqueues and worker pools:\n");
|
|
|
|
list_for_each_entry_rcu(wq, &workqueues, list) {
|
|
struct pool_workqueue *pwq;
|
|
bool idle = true;
|
|
|
|
for_each_pwq(pwq, wq) {
|
|
if (pwq->nr_active || !list_empty(&pwq->delayed_works)) {
|
|
idle = false;
|
|
break;
|
|
}
|
|
}
|
|
if (idle)
|
|
continue;
|
|
|
|
pr_info("workqueue %s: flags=0x%x\n", wq->name, wq->flags);
|
|
|
|
for_each_pwq(pwq, wq) {
|
|
raw_spin_lock_irqsave(&pwq->pool->lock, flags);
|
|
if (pwq->nr_active || !list_empty(&pwq->delayed_works))
|
|
show_pwq(pwq);
|
|
raw_spin_unlock_irqrestore(&pwq->pool->lock, flags);
|
|
/*
|
|
* We could be printing a lot from atomic context, e.g.
|
|
* sysrq-t -> show_workqueue_state(). Avoid triggering
|
|
* hard lockup.
|
|
*/
|
|
touch_nmi_watchdog();
|
|
}
|
|
}
|
|
|
|
for_each_pool(pool, pi) {
|
|
struct worker *worker;
|
|
bool first = true;
|
|
|
|
raw_spin_lock_irqsave(&pool->lock, flags);
|
|
if (pool->nr_workers == pool->nr_idle)
|
|
goto next_pool;
|
|
|
|
pr_info("pool %d:", pool->id);
|
|
pr_cont_pool_info(pool);
|
|
pr_cont(" hung=%us workers=%d",
|
|
jiffies_to_msecs(jiffies - pool->watchdog_ts) / 1000,
|
|
pool->nr_workers);
|
|
if (pool->manager)
|
|
pr_cont(" manager: %d",
|
|
task_pid_nr(pool->manager->task));
|
|
list_for_each_entry(worker, &pool->idle_list, entry) {
|
|
pr_cont(" %s%d", first ? "idle: " : "",
|
|
task_pid_nr(worker->task));
|
|
first = false;
|
|
}
|
|
pr_cont("\n");
|
|
next_pool:
|
|
raw_spin_unlock_irqrestore(&pool->lock, flags);
|
|
/*
|
|
* We could be printing a lot from atomic context, e.g.
|
|
* sysrq-t -> show_workqueue_state(). Avoid triggering
|
|
* hard lockup.
|
|
*/
|
|
touch_nmi_watchdog();
|
|
}
|
|
|
|
rcu_read_unlock();
|
|
}
|
|
|
|
/* used to show worker information through /proc/PID/{comm,stat,status} */
|
|
void wq_worker_comm(char *buf, size_t size, struct task_struct *task)
|
|
{
|
|
int off;
|
|
|
|
/* always show the actual comm */
|
|
off = strscpy(buf, task->comm, size);
|
|
if (off < 0)
|
|
return;
|
|
|
|
/* stabilize PF_WQ_WORKER and worker pool association */
|
|
mutex_lock(&wq_pool_attach_mutex);
|
|
|
|
if (task->flags & PF_WQ_WORKER) {
|
|
struct worker *worker = kthread_data(task);
|
|
struct worker_pool *pool = worker->pool;
|
|
|
|
if (pool) {
|
|
raw_spin_lock_irq(&pool->lock);
|
|
/*
|
|
* ->desc tracks information (wq name or
|
|
* set_worker_desc()) for the latest execution. If
|
|
* current, prepend '+', otherwise '-'.
|
|
*/
|
|
if (worker->desc[0] != '\0') {
|
|
if (worker->current_work)
|
|
scnprintf(buf + off, size - off, "+%s",
|
|
worker->desc);
|
|
else
|
|
scnprintf(buf + off, size - off, "-%s",
|
|
worker->desc);
|
|
}
|
|
raw_spin_unlock_irq(&pool->lock);
|
|
}
|
|
}
|
|
|
|
mutex_unlock(&wq_pool_attach_mutex);
|
|
}
|
|
EXPORT_SYMBOL_GPL(wq_worker_comm);
|
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
/*
|
|
* CPU hotplug.
|
|
*
|
|
* There are two challenges in supporting CPU hotplug. Firstly, there
|
|
* are a lot of assumptions on strong associations among work, pwq and
|
|
* pool which make migrating pending and scheduled works very
|
|
* difficult to implement without impacting hot paths. Secondly,
|
|
* worker pools serve mix of short, long and very long running works making
|
|
* blocked draining impractical.
|
|
*
|
|
* This is solved by allowing the pools to be disassociated from the CPU
|
|
* running as an unbound one and allowing it to be reattached later if the
|
|
* cpu comes back online.
|
|
*/
|
|
|
|
static void unbind_workers(int cpu)
|
|
{
|
|
struct worker_pool *pool;
|
|
struct worker *worker;
|
|
|
|
for_each_cpu_worker_pool(pool, cpu) {
|
|
mutex_lock(&wq_pool_attach_mutex);
|
|
raw_spin_lock_irq(&pool->lock);
|
|
|
|
/*
|
|
* We've blocked all attach/detach operations. Make all workers
|
|
* unbound and set DISASSOCIATED. Before this, all workers
|
|
* except for the ones which are still executing works from
|
|
* before the last CPU down must be on the cpu. After
|
|
* this, they may become diasporas.
|
|
*/
|
|
for_each_pool_worker(worker, pool)
|
|
worker->flags |= WORKER_UNBOUND;
|
|
|
|
pool->flags |= POOL_DISASSOCIATED;
|
|
|
|
raw_spin_unlock_irq(&pool->lock);
|
|
mutex_unlock(&wq_pool_attach_mutex);
|
|
|
|
/*
|
|
* Call schedule() so that we cross rq->lock and thus can
|
|
* guarantee sched callbacks see the %WORKER_UNBOUND flag.
|
|
* This is necessary as scheduler callbacks may be invoked
|
|
* from other cpus.
|
|
*/
|
|
schedule();
|
|
|
|
/*
|
|
* Sched callbacks are disabled now. Zap nr_running.
|
|
* After this, nr_running stays zero and need_more_worker()
|
|
* and keep_working() are always true as long as the
|
|
* worklist is not empty. This pool now behaves as an
|
|
* unbound (in terms of concurrency management) pool which
|
|
* are served by workers tied to the pool.
|
|
*/
|
|
atomic_set(&pool->nr_running, 0);
|
|
|
|
/*
|
|
* With concurrency management just turned off, a busy
|
|
* worker blocking could lead to lengthy stalls. Kick off
|
|
* unbound chain execution of currently pending work items.
|
|
*/
|
|
raw_spin_lock_irq(&pool->lock);
|
|
wake_up_worker(pool);
|
|
raw_spin_unlock_irq(&pool->lock);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* rebind_workers - rebind all workers of a pool to the associated CPU
|
|
* @pool: pool of interest
|
|
*
|
|
* @pool->cpu is coming online. Rebind all workers to the CPU.
|
|
*/
|
|
static void rebind_workers(struct worker_pool *pool)
|
|
{
|
|
struct worker *worker;
|
|
|
|
lockdep_assert_held(&wq_pool_attach_mutex);
|
|
|
|
/*
|
|
* Restore CPU affinity of all workers. As all idle workers should
|
|
* be on the run-queue of the associated CPU before any local
|
|
* wake-ups for concurrency management happen, restore CPU affinity
|
|
* of all workers first and then clear UNBOUND. As we're called
|
|
* from CPU_ONLINE, the following shouldn't fail.
|
|
*/
|
|
for_each_pool_worker(worker, pool)
|
|
WARN_ON_ONCE(set_cpus_allowed_ptr(worker->task,
|
|
pool->attrs->cpumask) < 0);
|
|
|
|
raw_spin_lock_irq(&pool->lock);
|
|
|
|
pool->flags &= ~POOL_DISASSOCIATED;
|
|
|
|
for_each_pool_worker(worker, pool) {
|
|
unsigned int worker_flags = worker->flags;
|
|
|
|
/*
|
|
* A bound idle worker should actually be on the runqueue
|
|
* of the associated CPU for local wake-ups targeting it to
|
|
* work. Kick all idle workers so that they migrate to the
|
|
* associated CPU. Doing this in the same loop as
|
|
* replacing UNBOUND with REBOUND is safe as no worker will
|
|
* be bound before @pool->lock is released.
|
|
*/
|
|
if (worker_flags & WORKER_IDLE)
|
|
wake_up_process(worker->task);
|
|
|
|
/*
|
|
* We want to clear UNBOUND but can't directly call
|
|
* worker_clr_flags() or adjust nr_running. Atomically
|
|
* replace UNBOUND with another NOT_RUNNING flag REBOUND.
|
|
* @worker will clear REBOUND using worker_clr_flags() when
|
|
* it initiates the next execution cycle thus restoring
|
|
* concurrency management. Note that when or whether
|
|
* @worker clears REBOUND doesn't affect correctness.
|
|
*
|
|
* WRITE_ONCE() is necessary because @worker->flags may be
|
|
* tested without holding any lock in
|
|
* wq_worker_running(). Without it, NOT_RUNNING test may
|
|
* fail incorrectly leading to premature concurrency
|
|
* management operations.
|
|
*/
|
|
WARN_ON_ONCE(!(worker_flags & WORKER_UNBOUND));
|
|
worker_flags |= WORKER_REBOUND;
|
|
worker_flags &= ~WORKER_UNBOUND;
|
|
WRITE_ONCE(worker->flags, worker_flags);
|
|
}
|
|
|
|
raw_spin_unlock_irq(&pool->lock);
|
|
}
|
|
|
|
/**
|
|
* restore_unbound_workers_cpumask - restore cpumask of unbound workers
|
|
* @pool: unbound pool of interest
|
|
* @cpu: the CPU which is coming up
|
|
*
|
|
* An unbound pool may end up with a cpumask which doesn't have any online
|
|
* CPUs. When a worker of such pool get scheduled, the scheduler resets
|
|
* its cpus_allowed. If @cpu is in @pool's cpumask which didn't have any
|
|
* online CPU before, cpus_allowed of all its workers should be restored.
|
|
*/
|
|
static void restore_unbound_workers_cpumask(struct worker_pool *pool, int cpu)
|
|
{
|
|
static cpumask_t cpumask;
|
|
struct worker *worker;
|
|
|
|
lockdep_assert_held(&wq_pool_attach_mutex);
|
|
|
|
/* is @cpu allowed for @pool? */
|
|
if (!cpumask_test_cpu(cpu, pool->attrs->cpumask))
|
|
return;
|
|
|
|
cpumask_and(&cpumask, pool->attrs->cpumask, cpu_online_mask);
|
|
|
|
/* as we're called from CPU_ONLINE, the following shouldn't fail */
|
|
for_each_pool_worker(worker, pool)
|
|
WARN_ON_ONCE(set_cpus_allowed_ptr(worker->task, &cpumask) < 0);
|
|
}
|
|
|
|
int workqueue_prepare_cpu(unsigned int cpu)
|
|
{
|
|
struct worker_pool *pool;
|
|
|
|
for_each_cpu_worker_pool(pool, cpu) {
|
|
if (pool->nr_workers)
|
|
continue;
|
|
if (!create_worker(pool))
|
|
return -ENOMEM;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
int workqueue_online_cpu(unsigned int cpu)
|
|
{
|
|
struct worker_pool *pool;
|
|
struct workqueue_struct *wq;
|
|
int pi;
|
|
|
|
mutex_lock(&wq_pool_mutex);
|
|
|
|
for_each_pool(pool, pi) {
|
|
mutex_lock(&wq_pool_attach_mutex);
|
|
|
|
if (pool->cpu == cpu)
|
|
rebind_workers(pool);
|
|
else if (pool->cpu < 0)
|
|
restore_unbound_workers_cpumask(pool, cpu);
|
|
|
|
mutex_unlock(&wq_pool_attach_mutex);
|
|
}
|
|
|
|
/* update NUMA affinity of unbound workqueues */
|
|
list_for_each_entry(wq, &workqueues, list)
|
|
wq_update_unbound_numa(wq, cpu, true);
|
|
|
|
mutex_unlock(&wq_pool_mutex);
|
|
return 0;
|
|
}
|
|
|
|
int workqueue_offline_cpu(unsigned int cpu)
|
|
{
|
|
struct workqueue_struct *wq;
|
|
|
|
/* unbinding per-cpu workers should happen on the local CPU */
|
|
if (WARN_ON(cpu != smp_processor_id()))
|
|
return -1;
|
|
|
|
unbind_workers(cpu);
|
|
|
|
/* update NUMA affinity of unbound workqueues */
|
|
mutex_lock(&wq_pool_mutex);
|
|
list_for_each_entry(wq, &workqueues, list)
|
|
wq_update_unbound_numa(wq, cpu, false);
|
|
mutex_unlock(&wq_pool_mutex);
|
|
|
|
return 0;
|
|
}
|
|
|
|
struct work_for_cpu {
|
|
struct work_struct work;
|
|
long (*fn)(void *);
|
|
void *arg;
|
|
long ret;
|
|
};
|
|
|
|
static void work_for_cpu_fn(struct work_struct *work)
|
|
{
|
|
struct work_for_cpu *wfc = container_of(work, struct work_for_cpu, work);
|
|
|
|
wfc->ret = wfc->fn(wfc->arg);
|
|
}
|
|
|
|
/**
|
|
* work_on_cpu - run a function in thread context on a particular cpu
|
|
* @cpu: the cpu to run on
|
|
* @fn: the function to run
|
|
* @arg: the function arg
|
|
*
|
|
* It is up to the caller to ensure that the cpu doesn't go offline.
|
|
* The caller must not hold any locks which would prevent @fn from completing.
|
|
*
|
|
* Return: The value @fn returns.
|
|
*/
|
|
long work_on_cpu(int cpu, long (*fn)(void *), void *arg)
|
|
{
|
|
struct work_for_cpu wfc = { .fn = fn, .arg = arg };
|
|
|
|
INIT_WORK_ONSTACK(&wfc.work, work_for_cpu_fn);
|
|
schedule_work_on(cpu, &wfc.work);
|
|
flush_work(&wfc.work);
|
|
destroy_work_on_stack(&wfc.work);
|
|
return wfc.ret;
|
|
}
|
|
EXPORT_SYMBOL_GPL(work_on_cpu);
|
|
|
|
/**
|
|
* work_on_cpu_safe - run a function in thread context on a particular cpu
|
|
* @cpu: the cpu to run on
|
|
* @fn: the function to run
|
|
* @arg: the function argument
|
|
*
|
|
* Disables CPU hotplug and calls work_on_cpu(). The caller must not hold
|
|
* any locks which would prevent @fn from completing.
|
|
*
|
|
* Return: The value @fn returns.
|
|
*/
|
|
long work_on_cpu_safe(int cpu, long (*fn)(void *), void *arg)
|
|
{
|
|
long ret = -ENODEV;
|
|
|
|
get_online_cpus();
|
|
if (cpu_online(cpu))
|
|
ret = work_on_cpu(cpu, fn, arg);
|
|
put_online_cpus();
|
|
return ret;
|
|
}
|
|
EXPORT_SYMBOL_GPL(work_on_cpu_safe);
|
|
#endif /* CONFIG_SMP */
|
|
|
|
#ifdef CONFIG_FREEZER
|
|
|
|
/**
|
|
* freeze_workqueues_begin - begin freezing workqueues
|
|
*
|
|
* Start freezing workqueues. After this function returns, all freezable
|
|
* workqueues will queue new works to their delayed_works list instead of
|
|
* pool->worklist.
|
|
*
|
|
* CONTEXT:
|
|
* Grabs and releases wq_pool_mutex, wq->mutex and pool->lock's.
|
|
*/
|
|
void freeze_workqueues_begin(void)
|
|
{
|
|
struct workqueue_struct *wq;
|
|
struct pool_workqueue *pwq;
|
|
|
|
mutex_lock(&wq_pool_mutex);
|
|
|
|
WARN_ON_ONCE(workqueue_freezing);
|
|
workqueue_freezing = true;
|
|
|
|
list_for_each_entry(wq, &workqueues, list) {
|
|
mutex_lock(&wq->mutex);
|
|
for_each_pwq(pwq, wq)
|
|
pwq_adjust_max_active(pwq);
|
|
mutex_unlock(&wq->mutex);
|
|
}
|
|
|
|
mutex_unlock(&wq_pool_mutex);
|
|
}
|
|
|
|
/**
|
|
* freeze_workqueues_busy - are freezable workqueues still busy?
|
|
*
|
|
* Check whether freezing is complete. This function must be called
|
|
* between freeze_workqueues_begin() and thaw_workqueues().
|
|
*
|
|
* CONTEXT:
|
|
* Grabs and releases wq_pool_mutex.
|
|
*
|
|
* Return:
|
|
* %true if some freezable workqueues are still busy. %false if freezing
|
|
* is complete.
|
|
*/
|
|
bool freeze_workqueues_busy(void)
|
|
{
|
|
bool busy = false;
|
|
struct workqueue_struct *wq;
|
|
struct pool_workqueue *pwq;
|
|
|
|
mutex_lock(&wq_pool_mutex);
|
|
|
|
WARN_ON_ONCE(!workqueue_freezing);
|
|
|
|
list_for_each_entry(wq, &workqueues, list) {
|
|
if (!(wq->flags & WQ_FREEZABLE))
|
|
continue;
|
|
/*
|
|
* nr_active is monotonically decreasing. It's safe
|
|
* to peek without lock.
|
|
*/
|
|
rcu_read_lock();
|
|
for_each_pwq(pwq, wq) {
|
|
WARN_ON_ONCE(pwq->nr_active < 0);
|
|
if (pwq->nr_active) {
|
|
busy = true;
|
|
rcu_read_unlock();
|
|
goto out_unlock;
|
|
}
|
|
}
|
|
rcu_read_unlock();
|
|
}
|
|
out_unlock:
|
|
mutex_unlock(&wq_pool_mutex);
|
|
return busy;
|
|
}
|
|
|
|
/**
|
|
* thaw_workqueues - thaw workqueues
|
|
*
|
|
* Thaw workqueues. Normal queueing is restored and all collected
|
|
* frozen works are transferred to their respective pool worklists.
|
|
*
|
|
* CONTEXT:
|
|
* Grabs and releases wq_pool_mutex, wq->mutex and pool->lock's.
|
|
*/
|
|
void thaw_workqueues(void)
|
|
{
|
|
struct workqueue_struct *wq;
|
|
struct pool_workqueue *pwq;
|
|
|
|
mutex_lock(&wq_pool_mutex);
|
|
|
|
if (!workqueue_freezing)
|
|
goto out_unlock;
|
|
|
|
workqueue_freezing = false;
|
|
|
|
/* restore max_active and repopulate worklist */
|
|
list_for_each_entry(wq, &workqueues, list) {
|
|
mutex_lock(&wq->mutex);
|
|
for_each_pwq(pwq, wq)
|
|
pwq_adjust_max_active(pwq);
|
|
mutex_unlock(&wq->mutex);
|
|
}
|
|
|
|
out_unlock:
|
|
mutex_unlock(&wq_pool_mutex);
|
|
}
|
|
#endif /* CONFIG_FREEZER */
|
|
|
|
static int workqueue_apply_unbound_cpumask(void)
|
|
{
|
|
LIST_HEAD(ctxs);
|
|
int ret = 0;
|
|
struct workqueue_struct *wq;
|
|
struct apply_wqattrs_ctx *ctx, *n;
|
|
|
|
lockdep_assert_held(&wq_pool_mutex);
|
|
|
|
list_for_each_entry(wq, &workqueues, list) {
|
|
if (!(wq->flags & WQ_UNBOUND))
|
|
continue;
|
|
/* creating multiple pwqs breaks ordering guarantee */
|
|
if (wq->flags & __WQ_ORDERED)
|
|
continue;
|
|
|
|
ctx = apply_wqattrs_prepare(wq, wq->unbound_attrs);
|
|
if (!ctx) {
|
|
ret = -ENOMEM;
|
|
break;
|
|
}
|
|
|
|
list_add_tail(&ctx->list, &ctxs);
|
|
}
|
|
|
|
list_for_each_entry_safe(ctx, n, &ctxs, list) {
|
|
if (!ret)
|
|
apply_wqattrs_commit(ctx);
|
|
apply_wqattrs_cleanup(ctx);
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
|
|
/**
|
|
* workqueue_set_unbound_cpumask - Set the low-level unbound cpumask
|
|
* @cpumask: the cpumask to set
|
|
*
|
|
* The low-level workqueues cpumask is a global cpumask that limits
|
|
* the affinity of all unbound workqueues. This function check the @cpumask
|
|
* and apply it to all unbound workqueues and updates all pwqs of them.
|
|
*
|
|
* Retun: 0 - Success
|
|
* -EINVAL - Invalid @cpumask
|
|
* -ENOMEM - Failed to allocate memory for attrs or pwqs.
|
|
*/
|
|
int workqueue_set_unbound_cpumask(cpumask_var_t cpumask)
|
|
{
|
|
int ret = -EINVAL;
|
|
cpumask_var_t saved_cpumask;
|
|
|
|
/*
|
|
* Not excluding isolated cpus on purpose.
|
|
* If the user wishes to include them, we allow that.
|
|
*/
|
|
cpumask_and(cpumask, cpumask, cpu_possible_mask);
|
|
if (!cpumask_empty(cpumask)) {
|
|
apply_wqattrs_lock();
|
|
if (cpumask_equal(cpumask, wq_unbound_cpumask)) {
|
|
ret = 0;
|
|
goto out_unlock;
|
|
}
|
|
|
|
if (!zalloc_cpumask_var(&saved_cpumask, GFP_KERNEL)) {
|
|
ret = -ENOMEM;
|
|
goto out_unlock;
|
|
}
|
|
|
|
/* save the old wq_unbound_cpumask. */
|
|
cpumask_copy(saved_cpumask, wq_unbound_cpumask);
|
|
|
|
/* update wq_unbound_cpumask at first and apply it to wqs. */
|
|
cpumask_copy(wq_unbound_cpumask, cpumask);
|
|
ret = workqueue_apply_unbound_cpumask();
|
|
|
|
/* restore the wq_unbound_cpumask when failed. */
|
|
if (ret < 0)
|
|
cpumask_copy(wq_unbound_cpumask, saved_cpumask);
|
|
|
|
free_cpumask_var(saved_cpumask);
|
|
out_unlock:
|
|
apply_wqattrs_unlock();
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
|
|
#ifdef CONFIG_SYSFS
|
|
/*
|
|
* Workqueues with WQ_SYSFS flag set is visible to userland via
|
|
* /sys/bus/workqueue/devices/WQ_NAME. All visible workqueues have the
|
|
* following attributes.
|
|
*
|
|
* per_cpu RO bool : whether the workqueue is per-cpu or unbound
|
|
* max_active RW int : maximum number of in-flight work items
|
|
*
|
|
* Unbound workqueues have the following extra attributes.
|
|
*
|
|
* pool_ids RO int : the associated pool IDs for each node
|
|
* nice RW int : nice value of the workers
|
|
* cpumask RW mask : bitmask of allowed CPUs for the workers
|
|
* numa RW bool : whether enable NUMA affinity
|
|
*/
|
|
struct wq_device {
|
|
struct workqueue_struct *wq;
|
|
struct device dev;
|
|
};
|
|
|
|
static struct workqueue_struct *dev_to_wq(struct device *dev)
|
|
{
|
|
struct wq_device *wq_dev = container_of(dev, struct wq_device, dev);
|
|
|
|
return wq_dev->wq;
|
|
}
|
|
|
|
static ssize_t per_cpu_show(struct device *dev, struct device_attribute *attr,
|
|
char *buf)
|
|
{
|
|
struct workqueue_struct *wq = dev_to_wq(dev);
|
|
|
|
return scnprintf(buf, PAGE_SIZE, "%d\n", (bool)!(wq->flags & WQ_UNBOUND));
|
|
}
|
|
static DEVICE_ATTR_RO(per_cpu);
|
|
|
|
static ssize_t max_active_show(struct device *dev,
|
|
struct device_attribute *attr, char *buf)
|
|
{
|
|
struct workqueue_struct *wq = dev_to_wq(dev);
|
|
|
|
return scnprintf(buf, PAGE_SIZE, "%d\n", wq->saved_max_active);
|
|
}
|
|
|
|
static ssize_t max_active_store(struct device *dev,
|
|
struct device_attribute *attr, const char *buf,
|
|
size_t count)
|
|
{
|
|
struct workqueue_struct *wq = dev_to_wq(dev);
|
|
int val;
|
|
|
|
if (sscanf(buf, "%d", &val) != 1 || val <= 0)
|
|
return -EINVAL;
|
|
|
|
workqueue_set_max_active(wq, val);
|
|
return count;
|
|
}
|
|
static DEVICE_ATTR_RW(max_active);
|
|
|
|
static struct attribute *wq_sysfs_attrs[] = {
|
|
&dev_attr_per_cpu.attr,
|
|
&dev_attr_max_active.attr,
|
|
NULL,
|
|
};
|
|
ATTRIBUTE_GROUPS(wq_sysfs);
|
|
|
|
static ssize_t wq_pool_ids_show(struct device *dev,
|
|
struct device_attribute *attr, char *buf)
|
|
{
|
|
struct workqueue_struct *wq = dev_to_wq(dev);
|
|
const char *delim = "";
|
|
int node, written = 0;
|
|
|
|
get_online_cpus();
|
|
rcu_read_lock();
|
|
for_each_node(node) {
|
|
written += scnprintf(buf + written, PAGE_SIZE - written,
|
|
"%s%d:%d", delim, node,
|
|
unbound_pwq_by_node(wq, node)->pool->id);
|
|
delim = " ";
|
|
}
|
|
written += scnprintf(buf + written, PAGE_SIZE - written, "\n");
|
|
rcu_read_unlock();
|
|
put_online_cpus();
|
|
|
|
return written;
|
|
}
|
|
|
|
static ssize_t wq_nice_show(struct device *dev, struct device_attribute *attr,
|
|
char *buf)
|
|
{
|
|
struct workqueue_struct *wq = dev_to_wq(dev);
|
|
int written;
|
|
|
|
mutex_lock(&wq->mutex);
|
|
written = scnprintf(buf, PAGE_SIZE, "%d\n", wq->unbound_attrs->nice);
|
|
mutex_unlock(&wq->mutex);
|
|
|
|
return written;
|
|
}
|
|
|
|
/* prepare workqueue_attrs for sysfs store operations */
|
|
static struct workqueue_attrs *wq_sysfs_prep_attrs(struct workqueue_struct *wq)
|
|
{
|
|
struct workqueue_attrs *attrs;
|
|
|
|
lockdep_assert_held(&wq_pool_mutex);
|
|
|
|
attrs = alloc_workqueue_attrs();
|
|
if (!attrs)
|
|
return NULL;
|
|
|
|
copy_workqueue_attrs(attrs, wq->unbound_attrs);
|
|
return attrs;
|
|
}
|
|
|
|
static ssize_t wq_nice_store(struct device *dev, struct device_attribute *attr,
|
|
const char *buf, size_t count)
|
|
{
|
|
struct workqueue_struct *wq = dev_to_wq(dev);
|
|
struct workqueue_attrs *attrs;
|
|
int ret = -ENOMEM;
|
|
|
|
apply_wqattrs_lock();
|
|
|
|
attrs = wq_sysfs_prep_attrs(wq);
|
|
if (!attrs)
|
|
goto out_unlock;
|
|
|
|
if (sscanf(buf, "%d", &attrs->nice) == 1 &&
|
|
attrs->nice >= MIN_NICE && attrs->nice <= MAX_NICE)
|
|
ret = apply_workqueue_attrs_locked(wq, attrs);
|
|
else
|
|
ret = -EINVAL;
|
|
|
|
out_unlock:
|
|
apply_wqattrs_unlock();
|
|
free_workqueue_attrs(attrs);
|
|
return ret ?: count;
|
|
}
|
|
|
|
static ssize_t wq_cpumask_show(struct device *dev,
|
|
struct device_attribute *attr, char *buf)
|
|
{
|
|
struct workqueue_struct *wq = dev_to_wq(dev);
|
|
int written;
|
|
|
|
mutex_lock(&wq->mutex);
|
|
written = scnprintf(buf, PAGE_SIZE, "%*pb\n",
|
|
cpumask_pr_args(wq->unbound_attrs->cpumask));
|
|
mutex_unlock(&wq->mutex);
|
|
return written;
|
|
}
|
|
|
|
static ssize_t wq_cpumask_store(struct device *dev,
|
|
struct device_attribute *attr,
|
|
const char *buf, size_t count)
|
|
{
|
|
struct workqueue_struct *wq = dev_to_wq(dev);
|
|
struct workqueue_attrs *attrs;
|
|
int ret = -ENOMEM;
|
|
|
|
apply_wqattrs_lock();
|
|
|
|
attrs = wq_sysfs_prep_attrs(wq);
|
|
if (!attrs)
|
|
goto out_unlock;
|
|
|
|
ret = cpumask_parse(buf, attrs->cpumask);
|
|
if (!ret)
|
|
ret = apply_workqueue_attrs_locked(wq, attrs);
|
|
|
|
out_unlock:
|
|
apply_wqattrs_unlock();
|
|
free_workqueue_attrs(attrs);
|
|
return ret ?: count;
|
|
}
|
|
|
|
static ssize_t wq_numa_show(struct device *dev, struct device_attribute *attr,
|
|
char *buf)
|
|
{
|
|
struct workqueue_struct *wq = dev_to_wq(dev);
|
|
int written;
|
|
|
|
mutex_lock(&wq->mutex);
|
|
written = scnprintf(buf, PAGE_SIZE, "%d\n",
|
|
!wq->unbound_attrs->no_numa);
|
|
mutex_unlock(&wq->mutex);
|
|
|
|
return written;
|
|
}
|
|
|
|
static ssize_t wq_numa_store(struct device *dev, struct device_attribute *attr,
|
|
const char *buf, size_t count)
|
|
{
|
|
struct workqueue_struct *wq = dev_to_wq(dev);
|
|
struct workqueue_attrs *attrs;
|
|
int v, ret = -ENOMEM;
|
|
|
|
apply_wqattrs_lock();
|
|
|
|
attrs = wq_sysfs_prep_attrs(wq);
|
|
if (!attrs)
|
|
goto out_unlock;
|
|
|
|
ret = -EINVAL;
|
|
if (sscanf(buf, "%d", &v) == 1) {
|
|
attrs->no_numa = !v;
|
|
ret = apply_workqueue_attrs_locked(wq, attrs);
|
|
}
|
|
|
|
out_unlock:
|
|
apply_wqattrs_unlock();
|
|
free_workqueue_attrs(attrs);
|
|
return ret ?: count;
|
|
}
|
|
|
|
static struct device_attribute wq_sysfs_unbound_attrs[] = {
|
|
__ATTR(pool_ids, 0444, wq_pool_ids_show, NULL),
|
|
__ATTR(nice, 0644, wq_nice_show, wq_nice_store),
|
|
__ATTR(cpumask, 0644, wq_cpumask_show, wq_cpumask_store),
|
|
__ATTR(numa, 0644, wq_numa_show, wq_numa_store),
|
|
__ATTR_NULL,
|
|
};
|
|
|
|
static struct bus_type wq_subsys = {
|
|
.name = "workqueue",
|
|
.dev_groups = wq_sysfs_groups,
|
|
};
|
|
|
|
static ssize_t wq_unbound_cpumask_show(struct device *dev,
|
|
struct device_attribute *attr, char *buf)
|
|
{
|
|
int written;
|
|
|
|
mutex_lock(&wq_pool_mutex);
|
|
written = scnprintf(buf, PAGE_SIZE, "%*pb\n",
|
|
cpumask_pr_args(wq_unbound_cpumask));
|
|
mutex_unlock(&wq_pool_mutex);
|
|
|
|
return written;
|
|
}
|
|
|
|
static ssize_t wq_unbound_cpumask_store(struct device *dev,
|
|
struct device_attribute *attr, const char *buf, size_t count)
|
|
{
|
|
cpumask_var_t cpumask;
|
|
int ret;
|
|
|
|
if (!zalloc_cpumask_var(&cpumask, GFP_KERNEL))
|
|
return -ENOMEM;
|
|
|
|
ret = cpumask_parse(buf, cpumask);
|
|
if (!ret)
|
|
ret = workqueue_set_unbound_cpumask(cpumask);
|
|
|
|
free_cpumask_var(cpumask);
|
|
return ret ? ret : count;
|
|
}
|
|
|
|
static struct device_attribute wq_sysfs_cpumask_attr =
|
|
__ATTR(cpumask, 0644, wq_unbound_cpumask_show,
|
|
wq_unbound_cpumask_store);
|
|
|
|
static int __init wq_sysfs_init(void)
|
|
{
|
|
int err;
|
|
|
|
err = subsys_virtual_register(&wq_subsys, NULL);
|
|
if (err)
|
|
return err;
|
|
|
|
return device_create_file(wq_subsys.dev_root, &wq_sysfs_cpumask_attr);
|
|
}
|
|
core_initcall(wq_sysfs_init);
|
|
|
|
static void wq_device_release(struct device *dev)
|
|
{
|
|
struct wq_device *wq_dev = container_of(dev, struct wq_device, dev);
|
|
|
|
kfree(wq_dev);
|
|
}
|
|
|
|
/**
|
|
* workqueue_sysfs_register - make a workqueue visible in sysfs
|
|
* @wq: the workqueue to register
|
|
*
|
|
* Expose @wq in sysfs under /sys/bus/workqueue/devices.
|
|
* alloc_workqueue*() automatically calls this function if WQ_SYSFS is set
|
|
* which is the preferred method.
|
|
*
|
|
* Workqueue user should use this function directly iff it wants to apply
|
|
* workqueue_attrs before making the workqueue visible in sysfs; otherwise,
|
|
* apply_workqueue_attrs() may race against userland updating the
|
|
* attributes.
|
|
*
|
|
* Return: 0 on success, -errno on failure.
|
|
*/
|
|
int workqueue_sysfs_register(struct workqueue_struct *wq)
|
|
{
|
|
struct wq_device *wq_dev;
|
|
int ret;
|
|
|
|
/*
|
|
* Adjusting max_active or creating new pwqs by applying
|
|
* attributes breaks ordering guarantee. Disallow exposing ordered
|
|
* workqueues.
|
|
*/
|
|
if (WARN_ON(wq->flags & __WQ_ORDERED_EXPLICIT))
|
|
return -EINVAL;
|
|
|
|
wq->wq_dev = wq_dev = kzalloc(sizeof(*wq_dev), GFP_KERNEL);
|
|
if (!wq_dev)
|
|
return -ENOMEM;
|
|
|
|
wq_dev->wq = wq;
|
|
wq_dev->dev.bus = &wq_subsys;
|
|
wq_dev->dev.release = wq_device_release;
|
|
dev_set_name(&wq_dev->dev, "%s", wq->name);
|
|
|
|
/*
|
|
* unbound_attrs are created separately. Suppress uevent until
|
|
* everything is ready.
|
|
*/
|
|
dev_set_uevent_suppress(&wq_dev->dev, true);
|
|
|
|
ret = device_register(&wq_dev->dev);
|
|
if (ret) {
|
|
put_device(&wq_dev->dev);
|
|
wq->wq_dev = NULL;
|
|
return ret;
|
|
}
|
|
|
|
if (wq->flags & WQ_UNBOUND) {
|
|
struct device_attribute *attr;
|
|
|
|
for (attr = wq_sysfs_unbound_attrs; attr->attr.name; attr++) {
|
|
ret = device_create_file(&wq_dev->dev, attr);
|
|
if (ret) {
|
|
device_unregister(&wq_dev->dev);
|
|
wq->wq_dev = NULL;
|
|
return ret;
|
|
}
|
|
}
|
|
}
|
|
|
|
dev_set_uevent_suppress(&wq_dev->dev, false);
|
|
kobject_uevent(&wq_dev->dev.kobj, KOBJ_ADD);
|
|
return 0;
|
|
}
|
|
|
|
/**
|
|
* workqueue_sysfs_unregister - undo workqueue_sysfs_register()
|
|
* @wq: the workqueue to unregister
|
|
*
|
|
* If @wq is registered to sysfs by workqueue_sysfs_register(), unregister.
|
|
*/
|
|
static void workqueue_sysfs_unregister(struct workqueue_struct *wq)
|
|
{
|
|
struct wq_device *wq_dev = wq->wq_dev;
|
|
|
|
if (!wq->wq_dev)
|
|
return;
|
|
|
|
wq->wq_dev = NULL;
|
|
device_unregister(&wq_dev->dev);
|
|
}
|
|
#else /* CONFIG_SYSFS */
|
|
static void workqueue_sysfs_unregister(struct workqueue_struct *wq) { }
|
|
#endif /* CONFIG_SYSFS */
|
|
|
|
/*
|
|
* Workqueue watchdog.
|
|
*
|
|
* Stall may be caused by various bugs - missing WQ_MEM_RECLAIM, illegal
|
|
* flush dependency, a concurrency managed work item which stays RUNNING
|
|
* indefinitely. Workqueue stalls can be very difficult to debug as the
|
|
* usual warning mechanisms don't trigger and internal workqueue state is
|
|
* largely opaque.
|
|
*
|
|
* Workqueue watchdog monitors all worker pools periodically and dumps
|
|
* state if some pools failed to make forward progress for a while where
|
|
* forward progress is defined as the first item on ->worklist changing.
|
|
*
|
|
* This mechanism is controlled through the kernel parameter
|
|
* "workqueue.watchdog_thresh" which can be updated at runtime through the
|
|
* corresponding sysfs parameter file.
|
|
*/
|
|
#ifdef CONFIG_WQ_WATCHDOG
|
|
|
|
static unsigned long wq_watchdog_thresh = 30;
|
|
static struct timer_list wq_watchdog_timer;
|
|
|
|
static unsigned long wq_watchdog_touched = INITIAL_JIFFIES;
|
|
static DEFINE_PER_CPU(unsigned long, wq_watchdog_touched_cpu) = INITIAL_JIFFIES;
|
|
|
|
static void wq_watchdog_reset_touched(void)
|
|
{
|
|
int cpu;
|
|
|
|
wq_watchdog_touched = jiffies;
|
|
for_each_possible_cpu(cpu)
|
|
per_cpu(wq_watchdog_touched_cpu, cpu) = jiffies;
|
|
}
|
|
|
|
static void wq_watchdog_timer_fn(struct timer_list *unused)
|
|
{
|
|
unsigned long thresh = READ_ONCE(wq_watchdog_thresh) * HZ;
|
|
bool lockup_detected = false;
|
|
unsigned long now = jiffies;
|
|
struct worker_pool *pool;
|
|
int pi;
|
|
|
|
if (!thresh)
|
|
return;
|
|
|
|
rcu_read_lock();
|
|
|
|
for_each_pool(pool, pi) {
|
|
unsigned long pool_ts, touched, ts;
|
|
|
|
if (list_empty(&pool->worklist))
|
|
continue;
|
|
|
|
/*
|
|
* If a virtual machine is stopped by the host it can look to
|
|
* the watchdog like a stall.
|
|
*/
|
|
kvm_check_and_clear_guest_paused();
|
|
|
|
/* get the latest of pool and touched timestamps */
|
|
pool_ts = READ_ONCE(pool->watchdog_ts);
|
|
touched = READ_ONCE(wq_watchdog_touched);
|
|
|
|
if (time_after(pool_ts, touched))
|
|
ts = pool_ts;
|
|
else
|
|
ts = touched;
|
|
|
|
if (pool->cpu >= 0) {
|
|
unsigned long cpu_touched =
|
|
READ_ONCE(per_cpu(wq_watchdog_touched_cpu,
|
|
pool->cpu));
|
|
if (time_after(cpu_touched, ts))
|
|
ts = cpu_touched;
|
|
}
|
|
|
|
/* did we stall? */
|
|
if (time_after(now, ts + thresh)) {
|
|
lockup_detected = true;
|
|
pr_emerg("BUG: workqueue lockup - pool");
|
|
pr_cont_pool_info(pool);
|
|
pr_cont(" stuck for %us!\n",
|
|
jiffies_to_msecs(now - pool_ts) / 1000);
|
|
trace_android_vh_wq_lockup_pool(pool->cpu, pool_ts);
|
|
}
|
|
}
|
|
|
|
rcu_read_unlock();
|
|
|
|
if (lockup_detected)
|
|
show_workqueue_state();
|
|
|
|
wq_watchdog_reset_touched();
|
|
mod_timer(&wq_watchdog_timer, jiffies + thresh);
|
|
}
|
|
|
|
notrace void wq_watchdog_touch(int cpu)
|
|
{
|
|
if (cpu >= 0)
|
|
per_cpu(wq_watchdog_touched_cpu, cpu) = jiffies;
|
|
else
|
|
wq_watchdog_touched = jiffies;
|
|
}
|
|
|
|
static void wq_watchdog_set_thresh(unsigned long thresh)
|
|
{
|
|
wq_watchdog_thresh = 0;
|
|
del_timer_sync(&wq_watchdog_timer);
|
|
|
|
if (thresh) {
|
|
wq_watchdog_thresh = thresh;
|
|
wq_watchdog_reset_touched();
|
|
mod_timer(&wq_watchdog_timer, jiffies + thresh * HZ);
|
|
}
|
|
}
|
|
|
|
static int wq_watchdog_param_set_thresh(const char *val,
|
|
const struct kernel_param *kp)
|
|
{
|
|
unsigned long thresh;
|
|
int ret;
|
|
|
|
ret = kstrtoul(val, 0, &thresh);
|
|
if (ret)
|
|
return ret;
|
|
|
|
if (system_wq)
|
|
wq_watchdog_set_thresh(thresh);
|
|
else
|
|
wq_watchdog_thresh = thresh;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static const struct kernel_param_ops wq_watchdog_thresh_ops = {
|
|
.set = wq_watchdog_param_set_thresh,
|
|
.get = param_get_ulong,
|
|
};
|
|
|
|
module_param_cb(watchdog_thresh, &wq_watchdog_thresh_ops, &wq_watchdog_thresh,
|
|
0644);
|
|
|
|
static void wq_watchdog_init(void)
|
|
{
|
|
timer_setup(&wq_watchdog_timer, wq_watchdog_timer_fn, TIMER_DEFERRABLE);
|
|
wq_watchdog_set_thresh(wq_watchdog_thresh);
|
|
}
|
|
|
|
#else /* CONFIG_WQ_WATCHDOG */
|
|
|
|
static inline void wq_watchdog_init(void) { }
|
|
|
|
#endif /* CONFIG_WQ_WATCHDOG */
|
|
|
|
static void __init wq_numa_init(void)
|
|
{
|
|
cpumask_var_t *tbl;
|
|
int node, cpu;
|
|
|
|
if (num_possible_nodes() <= 1)
|
|
return;
|
|
|
|
if (wq_disable_numa) {
|
|
pr_info("workqueue: NUMA affinity support disabled\n");
|
|
return;
|
|
}
|
|
|
|
for_each_possible_cpu(cpu) {
|
|
if (WARN_ON(cpu_to_node(cpu) == NUMA_NO_NODE)) {
|
|
pr_warn("workqueue: NUMA node mapping not available for cpu%d, disabling NUMA support\n", cpu);
|
|
return;
|
|
}
|
|
}
|
|
|
|
wq_update_unbound_numa_attrs_buf = alloc_workqueue_attrs();
|
|
BUG_ON(!wq_update_unbound_numa_attrs_buf);
|
|
|
|
/*
|
|
* We want masks of possible CPUs of each node which isn't readily
|
|
* available. Build one from cpu_to_node() which should have been
|
|
* fully initialized by now.
|
|
*/
|
|
tbl = kcalloc(nr_node_ids, sizeof(tbl[0]), GFP_KERNEL);
|
|
BUG_ON(!tbl);
|
|
|
|
for_each_node(node)
|
|
BUG_ON(!zalloc_cpumask_var_node(&tbl[node], GFP_KERNEL,
|
|
node_online(node) ? node : NUMA_NO_NODE));
|
|
|
|
for_each_possible_cpu(cpu) {
|
|
node = cpu_to_node(cpu);
|
|
cpumask_set_cpu(cpu, tbl[node]);
|
|
}
|
|
|
|
wq_numa_possible_cpumask = tbl;
|
|
wq_numa_enabled = true;
|
|
}
|
|
|
|
/**
|
|
* workqueue_init_early - early init for workqueue subsystem
|
|
*
|
|
* This is the first half of two-staged workqueue subsystem initialization
|
|
* and invoked as soon as the bare basics - memory allocation, cpumasks and
|
|
* idr are up. It sets up all the data structures and system workqueues
|
|
* and allows early boot code to create workqueues and queue/cancel work
|
|
* items. Actual work item execution starts only after kthreads can be
|
|
* created and scheduled right before early initcalls.
|
|
*/
|
|
void __init workqueue_init_early(void)
|
|
{
|
|
int std_nice[NR_STD_WORKER_POOLS] = { 0, HIGHPRI_NICE_LEVEL };
|
|
int hk_flags = HK_FLAG_DOMAIN | HK_FLAG_WQ;
|
|
int i, cpu;
|
|
|
|
BUILD_BUG_ON(__alignof__(struct pool_workqueue) < __alignof__(long long));
|
|
|
|
BUG_ON(!alloc_cpumask_var(&wq_unbound_cpumask, GFP_KERNEL));
|
|
cpumask_copy(wq_unbound_cpumask, housekeeping_cpumask(hk_flags));
|
|
|
|
pwq_cache = KMEM_CACHE(pool_workqueue, SLAB_PANIC);
|
|
|
|
/* initialize CPU pools */
|
|
for_each_possible_cpu(cpu) {
|
|
struct worker_pool *pool;
|
|
|
|
i = 0;
|
|
for_each_cpu_worker_pool(pool, cpu) {
|
|
BUG_ON(init_worker_pool(pool));
|
|
pool->cpu = cpu;
|
|
cpumask_copy(pool->attrs->cpumask, cpumask_of(cpu));
|
|
pool->attrs->nice = std_nice[i++];
|
|
pool->node = cpu_to_node(cpu);
|
|
|
|
/* alloc pool ID */
|
|
mutex_lock(&wq_pool_mutex);
|
|
BUG_ON(worker_pool_assign_id(pool));
|
|
mutex_unlock(&wq_pool_mutex);
|
|
}
|
|
}
|
|
|
|
/* create default unbound and ordered wq attrs */
|
|
for (i = 0; i < NR_STD_WORKER_POOLS; i++) {
|
|
struct workqueue_attrs *attrs;
|
|
|
|
BUG_ON(!(attrs = alloc_workqueue_attrs()));
|
|
attrs->nice = std_nice[i];
|
|
unbound_std_wq_attrs[i] = attrs;
|
|
|
|
/*
|
|
* An ordered wq should have only one pwq as ordering is
|
|
* guaranteed by max_active which is enforced by pwqs.
|
|
* Turn off NUMA so that dfl_pwq is used for all nodes.
|
|
*/
|
|
BUG_ON(!(attrs = alloc_workqueue_attrs()));
|
|
attrs->nice = std_nice[i];
|
|
attrs->no_numa = true;
|
|
ordered_wq_attrs[i] = attrs;
|
|
}
|
|
|
|
system_wq = alloc_workqueue("events", 0, 0);
|
|
system_highpri_wq = alloc_workqueue("events_highpri", WQ_HIGHPRI, 0);
|
|
system_long_wq = alloc_workqueue("events_long", 0, 0);
|
|
system_unbound_wq = alloc_workqueue("events_unbound", WQ_UNBOUND,
|
|
WQ_UNBOUND_MAX_ACTIVE);
|
|
system_freezable_wq = alloc_workqueue("events_freezable",
|
|
WQ_FREEZABLE, 0);
|
|
system_power_efficient_wq = alloc_workqueue("events_power_efficient",
|
|
WQ_POWER_EFFICIENT, 0);
|
|
system_freezable_power_efficient_wq = alloc_workqueue("events_freezable_power_efficient",
|
|
WQ_FREEZABLE | WQ_POWER_EFFICIENT,
|
|
0);
|
|
BUG_ON(!system_wq || !system_highpri_wq || !system_long_wq ||
|
|
!system_unbound_wq || !system_freezable_wq ||
|
|
!system_power_efficient_wq ||
|
|
!system_freezable_power_efficient_wq);
|
|
}
|
|
|
|
/**
|
|
* workqueue_init - bring workqueue subsystem fully online
|
|
*
|
|
* This is the latter half of two-staged workqueue subsystem initialization
|
|
* and invoked as soon as kthreads can be created and scheduled.
|
|
* Workqueues have been created and work items queued on them, but there
|
|
* are no kworkers executing the work items yet. Populate the worker pools
|
|
* with the initial workers and enable future kworker creations.
|
|
*/
|
|
void __init workqueue_init(void)
|
|
{
|
|
struct workqueue_struct *wq;
|
|
struct worker_pool *pool;
|
|
int cpu, bkt;
|
|
|
|
/*
|
|
* It'd be simpler to initialize NUMA in workqueue_init_early() but
|
|
* CPU to node mapping may not be available that early on some
|
|
* archs such as power and arm64. As per-cpu pools created
|
|
* previously could be missing node hint and unbound pools NUMA
|
|
* affinity, fix them up.
|
|
*
|
|
* Also, while iterating workqueues, create rescuers if requested.
|
|
*/
|
|
wq_numa_init();
|
|
|
|
mutex_lock(&wq_pool_mutex);
|
|
|
|
for_each_possible_cpu(cpu) {
|
|
for_each_cpu_worker_pool(pool, cpu) {
|
|
pool->node = cpu_to_node(cpu);
|
|
}
|
|
}
|
|
|
|
list_for_each_entry(wq, &workqueues, list) {
|
|
wq_update_unbound_numa(wq, smp_processor_id(), true);
|
|
WARN(init_rescuer(wq),
|
|
"workqueue: failed to create early rescuer for %s",
|
|
wq->name);
|
|
}
|
|
|
|
mutex_unlock(&wq_pool_mutex);
|
|
|
|
/* create the initial workers */
|
|
for_each_online_cpu(cpu) {
|
|
for_each_cpu_worker_pool(pool, cpu) {
|
|
pool->flags &= ~POOL_DISASSOCIATED;
|
|
BUG_ON(!create_worker(pool));
|
|
}
|
|
}
|
|
|
|
hash_for_each(unbound_pool_hash, bkt, pool, hash_node)
|
|
BUG_ON(!create_worker(pool));
|
|
|
|
wq_online = true;
|
|
wq_watchdog_init();
|
|
}
|