
This is the merge of the upstream LTS release of 5.10.66 into the android12-5.10 branch. There are 2 new symbols added to be tracked: Leaf changes summary: 2 artifacts changed (1 filtered out) Changed leaf types summary: 0 (1 filtered out) leaf type changed Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 2 Added functions Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable 2 Added functions: [A] 'function void __sdhci_set_timeout(sdhci_host*, mmc_command*)' [A] 'function void virtio_break_device(virtio_device*)' It contains the following new commits: a7b45c4c60c5 Merge tag 'android12-5.10.66_r00' into android12-5.10d3c86f460d
Merge 5.10.66 into android12-5.10-ltse1ad6bbfcc
ANDROID: GKI: update virtual device symbol list for led audio driver.44a32dcb2f
Linux 5.10.661de280adb2
Revert "time: Handle negative seconds correctly in timespec64_to_ns()"f49fd9882f
Revert "posix-cpu-timers: Force next expiration recalc after itimer reset"0daa75bf75
Revert "block: nbd: add sanity check for first_minor"d3c3f4e078
Revert "Bluetooth: Move shutdown callback before flushing tx and rx queue"2300418cc6
Merge 5.10.65 into android12-5.10-ltsc31c2cca22
Linux 5.10.65b216a075a9
clk: kirkwood: Fix a clocking boot regression5866b1175d
backlight: pwm_bl: Improve bootloader/kernel device handover4c00435cb8
fbmem: don't allow too huge resolutions34d099a330
IMA: remove the dependency on CRYPTO_MD55cc1ee3135
IMA: remove -Wmissing-prototypes warning1319689981
fuse: flush extending writes8018100c54
fuse: truncate pagecache on atomic_o_trunca8ca1fba54
ARM: dts: at91: add pinctrl-{names, 0} for all gpiosc2c7eefc93
KVM: nVMX: Unconditionally clear nested.pi_pending on nested VM-Enterbf36224463
KVM: VMX: avoid running vmx_handle_exit_irqoff in case of emulationc06e6ff2fc
KVM: x86: Update vCPU's hv_clock before back to guest when tsc_offset is adjusted1db337b10d
KVM: s390: index kvm->arch.idle_mask by vcpu_idxdc9db2a2aa
Revert "KVM: x86: mmu: Add guest physical address check in translate_gpa()"c6b42ec1c9
x86/resctrl: Fix a maybe-uninitialized build warning treated as errorbafece6cd1
perf/x86/amd/ibs: Extend PERF_PMU_CAP_NO_EXCLUDE to IBS Opae95c3a147
tty: Fix data race between tiocsti() and flush_to_ldisc()4d0e6d6fe4
bio: fix page leak bio_add_hw_page failure24fbd77d5a
io_uring: IORING_OP_WRITE needs hash_reg_file set656f343d72
time: Handle negative seconds correctly in timespec64_to_ns()611b7f9dc9
f2fs: guarantee to write dirty data when enabling checkpoint back75ffcd85df
iwlwifi Add support for ax201 in Samsung Galaxy Book Flex2 Alpha3853c0c070
ASoC: rt5682: Remove unused variable in rt5682_i2c_remove()c4f1ad3930
ipv4: fix endianness issue in inet_rtm_getroute_build_skb()dc4ff31506
octeontx2-af: Set proper errorcode for IPv4 checksum errorsbf2991f8e7
octeontx2-af: Fix static code analyzer reported issuesee485124b7
octeontx2-af: Fix loop in free and unmap countera67c66c1bb
net: qualcomm: fix QCA7000 checksum handlingf96bc82e03
net: sched: Fix qdisc_rate_table refcount leak when get tcf_block failed5867e20e18
ipv4: make exception cache less predictible8692f0bb29
ipv6: make exception cache less predictible4663aaef24
brcmfmac: pcie: fix oops on failure to resume and reprobee68128e078
bcma: Fix memory leak for internally-handled cores26fae720c1
atlantic: Fix driver resume flow.cb996dc9f9
ath6kl: wmi: fix an error code in ath6kl_wmi_sync_point()baecab8c46
ice: Only lock to update netdev dev_addrbd6d9c83f4
iwlwifi: skip first element in the WTAS ACPI table4c4f868082
iwlwifi: follow the new inclusive terminology5c305b90d8
ASoC: wcd9335: Disable irq on slave ports in the remove function729a459efd
ASoC: wcd9335: Fix a memory leak in the error handling path of the probe function9c640a2bb5
ASoC: wcd9335: Fix a double irq free in the remove function8446bb0ff1
tty: serial: fsl_lpuart: fix the wrong mapbase value9ee4ff8cbe
usb: bdc: Fix a resource leak in the error handling path of 'bdc_probe()'4d2823abd1
usb: bdc: Fix an error handling path in 'bdc_probe()' when no suitable DMA config is available86b79054d7
usb: ehci-orion: Handle errors of clk_prepare_enable() in probef0bb631273
i2c: xlp9xx: fix main IRQ check7ac3090e01
i2c: mt65xx: fix IRQ check6c4857203f
CIFS: Fix a potencially linear read overflowb0491ab7d4
bpf: Fix possible out of bound write in narrow load handlingcfaefbcc6b
mmc: moxart: Fix issue with uninitialized dma_slave_configced0bc7481
mmc: dw_mmc: Fix issue with uninitialized dma_slave_config8a9f9b9755
mmc: sdhci: Fix issue with uninitialized dma_slave_configdd903083cb
ASoC: Intel: Skylake: Fix module resource and format selectionb0159dbd1d
ASoC: Intel: Skylake: Leave data as is when invoking TLV IPCs7934c79fb0
ASoC: Intel: kbl_da7219_max98927: Fix format selection for max9837356d976f450
rsi: fix an error code in rsi_probe()110ce7d256
rsi: fix error code in rsi_load_9116_firmware()b4bbb77d88
gfs2: init system threads before freeze lockee029e3aa1
i2c: hix5hd2: fix IRQ checkd36ab9b3ee
i2c: fix platform_get_irq.cocci warnings187705a4b1
i2c: s3c2410: fix IRQ check3913fa307a
i2c: iop3xx: fix deferred probing50e6f34499
Bluetooth: add timeout sanity check to hci_inquirycc59ad70cf
lkdtm: replace SCSI_DISPATCH_CMD with SCSI_QUEUE_RQ9295566a13
mm/swap: consider max pages in iomap_swapfile_add_extenta9c29bc2a5
usb: gadget: mv_u3d: request_irq() after initializing UDCb2f4dd13b2
firmware: raspberrypi: Fix a leak in 'rpi_firmware_get()'60831f5ae6
firmware: raspberrypi: Keep count of all consumers5c68b7795b
i2c: synquacer: fix deferred probingf577e9f58f
clk: staging: correct reference to config IOMEM to config HAS_IOMEM5ae5f087c9
arm64: dts: marvell: armada-37xx: Extend PCIe MEM spacecb788d698a
nfsd4: Fix forced-expiry lockingc9773f42c1
lockd: Fix invalid lockowner cast after vfs_test_lock2600861b90
locking/local_lock: Add missing owner initializationd5462a630f
locking/lockdep: Mark local_lock_t22b106df73
mac80211: Fix insufficient headroom issue for AMSDU0ad4ddb27e
libbpf: Re-build libbpf.so when libbpf.map changes494629ba62
usb: phy: tahvo: add IRQ check46638d6941
usb: host: ohci-tmio: add IRQ check4b7874a32e
PM: cpu: Make notifier chain use a raw_spinlock_t4711284768
Bluetooth: Move shutdown callback before flushing tx and rx queued993a6f137
samples: pktgen: add missing IPv6 option to pktgen scripts2c0b826f4a
devlink: Clear whole devlink_flash_notify struct2aa3d5c9e1
selftests/bpf: Fix test_core_autosize on big-endian machinesc03bf1bc84
usb: gadget: udc: renesas_usb3: Fix soc_device_match() abuseeabbb2e8cc
usb: phy: twl6030: add IRQ checksfa5dbfd539
usb: phy: fsl-usb: add IRQ check99ad1be3e9
usb: gadget: udc: s3c2410: add IRQ check0a77314589
usb: gadget: udc: at91: add IRQ check27f102bcee
usb: dwc3: qcom: add IRQ checkc4e0f54a56
usb: dwc3: meson-g12a: add IRQ check96ba1e20e2
ASoC: rt5682: Properly turn off regulators if wrong device ID1a2feb2304
ASoC: rt5682: Implement remove callback628acf6ee2
net/mlx5: Fix unpublish devlink parametersfe6322774c
net/mlx5: Register to devlink ingress VLAN filter trapdbeb4574dd
drm/msm/dsi: Fix some reference counted resource leaks059c2c09f4
Bluetooth: fix repeated calls to sco_sock_kill6df58421da
ASoC: Intel: Fix platform ID matching10dfcfda5c
cgroup/cpuset: Fix violation of cpuset locking rulecbc9766143
cgroup/cpuset: Miscellaneous code cleanup974ab0a04f
counter: 104-quad-8: Return error when invalid mode during ceiling_writec158f9b232
arm64: dts: exynos: correct GIC CPU interfaces address range on Exynos77125705623
drm/msm/dpu: make dpu_hw_ctl_clear_all_blendstages clear necessary LMsa6e980b110
drm/msm/mdp4: move HW revision detection to earlier phase90363618b5
drm/msm/mdp4: refactor HW revision detection into read_mdp_hw_revision416929eaf4
selftests/bpf: Fix bpf-iter-tcp4 test to print correctly the dest IPd6337dfd1e
PM: EM: Increase energy calculation precision5014a8453f
Bluetooth: increase BTNAMSIZ to 21 chars to fix potential buffer overflowafffa7b4c6
debugfs: Return error during {full/open}_proxy_open() on rmmod17830b0415
soc: qcom: smsm: Fix missed interrupts if state changes while maskedb8361513ac
bpf, samples: Add missing mprog-disable to xdp_redirect_cpu's optstringcd6008e31a
PCI: PM: Enable PME if it can be signaled from D3cold3890c6e1da
PCI: PM: Avoid forcing PCI_D0 for wakeup reasons inconsistentlyeda4ccca90
media: venus: venc: Fix potential null pointer dereference on pointer fmt519ad41a09
media: em28xx-input: fix refcount bug in em28xx_usb_disconnecta7dd8b778a
leds: trigger: audio: Add an activate callback to ensure the initial brightness is set917191d582
leds: lt3593: Put fwnode in any case during ->probe()eef8496579
i2c: highlander: add IRQ check11dd40c189
net/mlx5: Fix missing return value in mlx5_devlink_eswitch_inline_mode_set()b376ae5597
devlink: Break parameter notification sequence to be before/after unload/load driver9fa9ff1040
arm64: dts: renesas: hihope-rzg2-ex: Add EtherAVB internal rx delaye4da0e0006
arm64: dts: renesas: rzg2: Convert EtherAVB to explicit delay handling61b1db2358
Bluetooth: mgmt: Fix wrong opcode in the response for add_adv cmdbca46d2283
net: cipso: fix warnings in netlbl_cipsov4_add_stdb6b5dc12bd
drm: mxsfb: Clear FIFO_CLEAR bit1a0014c1c6
drm: mxsfb: Increase number of outstanding requests on V4 and newer HW46f5463940
drm: mxsfb: Enable recovery on underflowe0f3de1573
cgroup/cpuset: Fix a partition bug with hotplug7a0b297480
net/mlx5e: Block LRO if firmware asks for tunneled LROc40ed983b8
net/mlx5e: Prohibit inner indir TIRs in IPoIBa11fc1cd8a
ARM: dts: meson8b: ec100: Fix the pwm regulator supply properties2e68547e99
ARM: dts: meson8b: mxq: Fix the pwm regulator supply properties0d40e59c03
ARM: dts: meson8b: odroidc1: Fix the pwm regulator supply propertieseda87dd473
ARM: dts: meson8: Use a higher default GPU clock frequencya7d0a59e21
tcp: seq_file: Avoid skipping sk during tcp_seek_last_pos1f60072320
drm/amdgpu/acp: Make PM domain really workc7ebd3622b
6lowpan: iphc: Fix an off-by-one check of array indexdef6efdf91
Bluetooth: sco: prevent information leak in sco_conn_defer_accept()e9a6274087
media: atomisp: fix the uninitialized use and rename "retvalue"b0e87701b8
media: coda: fix frame_mem_ctrl for YUV420 and YVU420 formatsc062253748
media: rockchip/rga: fix error handling in probedc49537334
media: rockchip/rga: use pm_runtime_resume_and_get()94d6aa2b87
media: go7007: remove redundant initializationffd9c8cecb
media: go7007: fix memory leak in go7007_usb_probefb22665c37
media: dvb-usb: Fix error handling in dvb_usb_i2c_init6b0fe69534
media: dvb-usb: fix uninit-value in vp702x_read_mac_addr372890e0b4
media: dvb-usb: fix uninit-value in dvb_usb_adapter_dvb_init83f7297a4a
ionic: cleanly release devlink instance203537ff35
driver core: Fix error return code in really_probe()4225d357bc
firmware: fix theoretical UAF race with firmware cache and resumec4aaad8a33
gfs2: Fix memory leak of object lsi on error return path8c3b5028ec
libbpf: Fix removal of inner map in bpf_object__create_mapffb887c15f
soc: qcom: rpmhpd: Use corner in power_offf32b433d8e
i40e: improve locking of mac_filter_hash5ac21a4e6e
arm64: dts: renesas: r8a77995: draak: Remove bogus adv7511w propertiesa8c1eaed23
ARM: dts: aspeed-g6: Fix HVI3C function-group in pinctrl dtsi6ca0b40891
libbpf: Fix the possible memory leak on errorf1673e8525
gve: fix the wrong AdminQ buffer overflow check1568dbe889
drm/of: free the iterator object on failure389dfd1147
bpf: Fix potential memleak and UAF in the verifier.d4213b7093
bpf: Fix a typo of reuseport map in bpf.h.56e5c527cc
drm/of: free the right object38235f195d
media: cxd2880-spi: Fix an error handling path25fbfc31ce
soc: rockchip: ROCKCHIP_GRF should not default to y, unconditionallyc391728c9b
leds: is31fl32xx: Fix missing error code in is31fl32xx_parse_dt()d4abb6e141
media: TDA1997x: enable EDID support8ce22f8538
ASoC: mediatek: mt8183: Fix Unbalanced pm_runtime_enable in mt8183_afe_pcm_dev_probe3d58f5e83f
drm/gma500: Fix end of loop tests for list_for_each_entry54912723f1
drm/panfrost: Fix missing clk_disable_unprepare() on error in panfrost_clk_init()1e1423449d
EDAC/i10nm: Fix NVDIMM detectiona20e6868cb
spi: spi-zynq-qspi: use wait_for_completion_timeout to make zynq_qspi_exec_mem_op not interruptiblee2cb04c61b
spi: sprd: Fix the wrong WDG_LOAD_VALcd8cca7268
regulator: vctrl: Avoid lockdep warning in enable/disable ops8665e30317
regulator: vctrl: Use locked regulator_get_voltage in probe path80b1a70b04
blk-crypto: fix check for too-large dun_bytesba6e5af621
spi: davinci: invoke chipselect callbackc0aec70a25
x86/mce: Defer processing of early errors6627be8b36
tpm: ibmvtpm: Avoid error message when process gets signal while waitingbd2028e9e2
certs: Trigger creation of RSA module signing key if it's not an RSA keyfddf3a72ab
crypto: qat - use proper type for vf_maske7273d57d2
irqchip/gic-v3: Fix priority comparison when non-secure priorities are usedf1f6d3d2ad
spi: coldfire-qspi: Use clk_disable_unprepare in the remove function4b21d4e820
block: nbd: add sanity check for first_minor31fc50cd93
clocksource/drivers/sh_cmt: Fix wrong setting if don't request IRQ for clock source channeldde7ff1c19
lib/mpi: use kcalloc in mpi_resize20d84fc59e
irqchip/loongson-pch-pic: Improve edge triggered interrupt supporte9a902f882
genirq/timings: Fix error return code in irq_timings_test_irqs()10d3bdd2d5
spi: spi-pic32: Fix issue with uninitialized dma_slave_configd4ec971bfa
spi: spi-fsl-dspi: Fix issue with uninitialized dma_slave_config87aa69aa10
block: return ELEVATOR_DISCARD_MERGE if possible3868507181
m68k: Fix invalid RMW_INSNS on CPUs that lack CAS497f3d9c3f
rcu: Fix stall-warning deadlock due to non-release of rcu_node ->lockea5e5bc881
rcu: Add lockdep_assert_irqs_disabled() to rcu_sched_clock_irq() and callees527b56d785
rcu: Fix to include first blocked task in stall warninge6778e1b22
sched: Fix UCLAMP_FLAG_IDLE setting718180c246
sched/numa: Fix is_core_idle()bf4b0fa3a2
m68k: emu: Fix invalid free in nfeth_cleanup()246c771b85
power: supply: cw2015: use dev_err_probe to allow deferred probea758b1d4ca
s390/ap: fix state machine hang after failure to enable irq86f9980909
s390/debug: fix debug area life cycle0980d2b21f
s390/debug: keep debug data on resize0404bf4a66
s390/pci: fix misleading rc in clp_set_pci_fn()8b471e72b5
s390/kasan: fix large PMD pages address alignment check9d999957cb
udf_get_extendedattr() had no boundary checks.db2f238d8d
fcntl: fix potential deadlock for &fasync_struct.fa_lock349633ed31
crypto: qat - do not export adf_iov_putmsg()205cfad5c0
crypto: qat - fix naming for init/shutdown VF to PF notificationsc29cc43e30
crypto: qat - fix reuse of completion variablee53575ea28
crypto: qat - handle both source of interrupt in VF ISR9819975c63
crypto: qat - do not ignore errors from enable_vf2pf_comms()6f3c58bd62
crypto: omap - Fix inconsistent locking of device listsfc4073df29
libata: fix ata_host_start()cf619a528e
s390/zcrypt: fix wrong offset index for APKA master key valid stateb4aa00bf8a
s390/cio: add dev_busid sysfs entry for each subchanneld0831db736
power: supply: max17042_battery: fix typo in MAx17042_TOFF5d59f38c6b
power: supply: smb347-charger: Add missing pin control activation10e759e350
nvmet: pass back cntlid on successful completionea4a353c0e
nvme-rdma: don't update queue count when failing to set io queues5d0f0c3bbe
nvme-tcp: don't update queue count when failing to set io queues591f69d7c4
blk-throtl: optimize IOPS throttle for large IO scenarioscf13537be5
bcache: add proper error unwinding in bcache_device_init48aa6e4e28
isofs: joliet: Fix iocharset=utf8 mount option940ac46132
udf: Fix iocharset=utf8 mount option4cf1551af3
udf: Check LVID earlier3d12ccecfa
hrtimer: Ensure timerfd notification for HIGHRES=naadfa1d6ca
hrtimer: Avoid double reprogramming in __hrtimer_start_range_ns()13ccaef77e
posix-cpu-timers: Force next expiration recalc after itimer reset8a6c5eec81
EDAC/mce_amd: Do not load edac_mce_amd module on guests4b680b3fc6
rcu/tree: Handle VM stoppage in stall detection1cc05d71f0
sched/deadline: Fix missing clock update in migrate_task_rq_dl()104adbffbe
crypto: omap-sham - clear dma flags only after omap_sham_update_dma_stop()ce7f2b516c
power: supply: axp288_fuel_gauge: Report register-address on readb / writeb errors3ebd7b3841
sched/deadline: Fix reset_on_fork reporting of DL tasks8c4d94db5a
crypto: mxs-dcp - Check for DMA mapping errors7bb6302e9d
regulator: tps65910: Silence deferred probe errora859850996
regmap: fix the offset of register error log97bc540bfb
locking/mutex: Fix HANDOFF condition5df7cc992d
ANDROID: GKI: update .xml after android12-5.10 merge639159686b
Merge branch 'android12-5.10' into `android12-5.10-lts`8a365a2340
Revert "tty: drop termiox user definitions"c8de3a470a
Merge 5.10.64 into android12-5.10-ltscb83afdc0b
Linux 5.10.64f72fce5507
PCI: Call Max Payload Size-related fixup quirks early8c04a16d20
x86/reboot: Limit Dell Optiplex 990 quirk to early BIOS versions1234849353
xhci: fix unsafe memory usage in xhci tracing3f7f1baf70
xhci: fix even more unsafe memory usage in xhci tracing30e6e9f8bf
usb: mtu3: fix the wrong HS mult value8a4439aaf4
usb: mtu3: use @mult for HS isoc or intr147819723c
usb: mtu3: restore HS function when set SS/SSPc75e2fd0d3
usb: gadget: tegra-xudc: fix the wrong mult value for HS isoc or intrd544c9a219
usb: host: xhci-rcar: Don't reload firmware after the completionc3fd7b0b9a
ALSA: usb-audio: Add registration quirk for JBL Quantum 800798679af79
blk-mq: clearing flush request reference in tags->rqs[]e51ff3ffc3
netfilter: nftables: clone set element expression template36983fc2f8
netfilter: nf_tables: initialize set before expression setup3fda454f90
netfilter: nftables: avoid potential overflows on 32bit archescad6239f50
blk-mq: fix is_flush_rqceffaa61b5
blk-mq: fix kernel panic during iterating over flush requestbc1b5c5f3e
x86/events/amd/iommu: Fix invalid Perf result due to IOMMU PMC power-gating554efc9a61
Revert "r8169: avoid link-up interrupt issue on RTL8106e if user enables ASPM"d24347e2ff
tty: drop termiox user definitions0757a883b9
net: linux/skbuff.h: combine SKB_EXTENSIONS + KCOV handling0b62660c6a
serial: 8250: 8250_omap: Fix unused variable warning7ff0b71b68
net: kcov: don't select SKB_EXTENSIONS when there is no NETc422599206
mm/page_alloc: speed up the iteration of max_order50e56c68e1
net: ll_temac: Remove left-over debug message6e2c4e6656
USB: serial: mos7720: improve OOM-handling in read_mos_reg()ddd7e8b7b8
igmp: Add ip_mc_list lock in ip_check_mc_rcu06e0ef2a71
ANDROID: GKI: fix up spi structure change77b971b479
Merge 5.10.63 into android12-5.10-ltse07f317d5a
Linux 5.10.634405ea221d
media: stkwebcam: fix memory leak in stk_camera_probead5e13f15d
fuse: fix illegal access to inode with reused nodeid40ba433a85
new helper: inode_wrong_type()ded9137fcf
spi: Switch to signed types for *_native_cs SPI controller fields55bb5193ce
serial: 8250: 8250_omap: Fix possible array out of bounds access8e41134a92
ALSA: pcm: fix divide error in snd_pcm_lib_ioctl4ffde17862
ALSA: hda/realtek: Workaround for conflicting SSID on ASUS ROG Strix G174ee2686b37
ALSA: hda/realtek: Quirk for HP Spectre x360 14 amp setup2808d59fb2
cryptoloop: add a deprecation warning61a038f80c
perf/x86/amd/power: Assign pmu.moduleec9a82e034
perf/x86/amd/ibs: Work around erratum #119723c29490b8
ceph: fix possible null-pointer dereference in ceph_mdsmap_decode()d2064a1444
perf/x86/intel/pt: Fix mask of num_address_ranges0e74bba604
qede: Fix memset corruption35f223cb21
net: macb: Add a NULL check on desc_ptpcf50d02e47
qed: Fix the VF msix vectors flow2177c4943e
reset: reset-zynqmp: Fixed the argument data type9872349b08
gpu: ipu-v3: Fix i.MX IPU-v3 offset calculations for (semi)planar U/V formatsb983d60292
ARM: OMAP1: ams-delta: remove unused function ams_delta_camera_powerbc860c3f09
xtensa: fix kconfig unmet dependency warning for HAVE_FUTEX_CMPXCHGb1075d2a70
static_call: Fix unused variable warn w/o MODULEae16b7c668
Revert "Add a reference to ucounts for each cred"1aa3f27e59
Revert "cred: add missing return error code when set_cred_ucounts() failed"0c1443874e
Revert "ucounts: Increase ucounts reference counter before the security hook"0479b2bd29
ubifs: report correct st_size for encrypted symlinks3ac01789f6
f2fs: report correct st_size for encrypted symlinks894a02236d
ext4: report correct st_size for encrypted symlinksb8c298cf57
fscrypt: add fscrypt_symlink_getattr() for computing st_size09a3795496
ext4: fix race writing to an inline_data file while its xattrs are changing0115d3d9f9
ANDROID: GKI: add virtio_break_device to the symbol list59911be7e5
Revert "once: Fix panic when module unload"4b20d2de0b
Revert "pipe: avoid unnecessary EPOLLET wakeups under normal loads"b6e7497caf
Revert "pipe: do FASYNC notifications for every pipe IO, not just state changes"674d2ac211
Merge 5.10.62 into android12-5.10-ltsf6dd002450
Linux 5.10.620c9a876f28
bpf: Fix potentially incorrect results with bpf_get_local_storage()38c1915d3e
audit: move put_tree() to avoid trim_trees refcount underflow and UAF1890ee7ff8
net: don't unconditionally copy_from_user a struct ifreq for socket ioctls0085646e02
Revert "parisc: Add assembly implementations for memset, strlen, strcpy, strncpy and strcat"17982c664f
Revert "floppy: reintroduce O_NDELAY fix"709c162ddc
kthread: Fix PF_KTHREAD vs to_kthread() racec43add24df
btrfs: fix NULL pointer dereference when deleting device by invalid id1604c42a1c
arm64: dts: qcom: msm8994-angler: Fix gpio-reserved-ranges 85-88f760c1101f
lkdtm: Enable DOUBLE_FAULT on all architecturesb6c657abb8
net: dsa: mt7530: fix VLAN traffic leaks againf8242f554c
usb: typec: ucsi: Clear pending after acking connector changee15e32d519
usb: typec: ucsi: Work around PPM losing change information08953884aa
usb: typec: ucsi: acpi: Always decode connector change information9a4f1dc8a1
tracepoint: Use rcu get state and cond sync for static call updatesb6ae385407
srcu: Provide polling interfaces for Tiny SRCU grace periods450948b06c
srcu: Make Tiny SRCU use multi-bit grace-period counter641e1d8840
srcu: Provide internal interface to start a Tiny SRCU grace periodf789de3be8
srcu: Provide polling interfaces for Tree SRCU grace periodsfdf66e5a7f
srcu: Provide internal interface to start a Tree SRCU grace periodd3c38d8549
powerpc/perf: Invoke per-CPU variable access with disabled interrupts77b77d45a4
perf annotate: Fix jump parsing for C++ code.9f9e40ddfc
perf tools: Fix arm64 build error with gcc-1194687c49b6
perf record: Fix memory leak in vDSO found using ASANe0ca67030f
perf symbol-elf: Fix memory leak by freeing sdt_note.args0d8e39bb94
perf env: Fix memory leak of bpf_prog_info_linear member133d7f93ee
riscv: Fixup patch_text panic in ftrace7e2087249e
riscv: Fixup wrong ftrace remove cflagb42fde92cd
Bluetooth: btusb: check conditions before enabling USB ALT 3 for WBS60d69cb4e6
vt_kdsetmode: extend console locking0a178a0151
tipc: call tipc_wait_for_connect only when dlen is not 0ded6da217c
mtd: spinand: Fix incorrect parameters for on-die ECC3b2018f9c9
pipe: do FASYNC notifications for every pipe IO, not just state changese91da23c1b
pipe: avoid unnecessary EPOLLET wakeups under normal loadsd845f89d59
btrfs: fix race between marking inode needs to be logged and log syncing6f38d95f33
net/rds: dma_map_sg is entitled to merge entriesb882dda2bf
drm/nouveau/kms/nv50: workaround EFI GOP window channel format differences7f422cda03
drm/nouveau/disp: power down unused DP links during init6fd6e20520
drm: Copy drm_wait_vblank to user before returning26ee94ba34
blk-mq: don't grab rq's refcount in blk_mq_check_expired()b00ca56757
drm/amd/pm: change the workload type for some cards3c37ec4350
Revert "drm/amd/pm: fix workload mismatch on vega10"cc126b400b
qed: Fix null-pointer dereference in qed_rdma_create_qp()18a65ba069
qed: qed ll2 race condition fixes4ac9c81e8a
tools/virtio: fix buildc7ee4d2261
vringh: Use wiov->used to check for read/write desc order6c074eaaf7
virtio_vdpa: reject invalid vq indices0698278e8e
virtio_pci: Support surprise removal of virtio pci device065a13c299
virtio: Improve vq->broken access to avoid any compiler optimizationf41c7462d8
cpufreq: blocklist Qualcomm sm8150 in cpufreq-dt-platdev3dea931590
opp: remove WARN when no valid OPPs remainbe37f7dbcd
iwlwifi: pnvm: accept multiple HW-type TLVs9a6a5602c2
clk: renesas: rcar-usb2-clock-sel: Fix kernel NULL pointer dereferencebdc5049c36
perf/x86/intel/uncore: Fix integer overflow on 23 bit left shift of a u32c5600b9146
dt-bindings: sifive-l2-cache: Fix 'select' matchingad5329a533
usb: gadget: u_audio: fix race condition on endpoint stop257ea8a5ed
drm/i915: Fix syncmap memory leake49b8d9c5e
net: stmmac: fix kernel panic due to NULL pointer dereference of plat->estb2091d47a1
net: stmmac: add mutex lock to protect est parametersac874290e7
Revert "mmc: sdhci-iproc: Set SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN on BCM2711"411680a07c
net: hns3: fix get wrong pfc_en when query PFC configuratione834ca7c79
net: hns3: fix duplicate node in VLAN list5931ec35e9
net: hns3: add waiting time before cmdq memory is released9820af16a8
net: hns3: clear hardware resource when loading driverad0db83855
rtnetlink: Return correct error on changing device netns51bc5c6660
cxgb4: dont touch blocked freelist bitmap after freebeefd5f0c6
ipv4: use siphash instead of Jenkins in fnhe_hashfun()dced8347a7
ipv6: use siphash in rt6_exception_hash()f517335a61
net/sched: ets: fix crash when flipping from 'strict' to 'quantum'b493af3a66
ucounts: Increase ucounts reference counter before the security hook8e0881f6f5
net: marvell: fix MVNETA_TX_IN_PRGRS bit number850401a23a
xgene-v2: Fix a resource leak in the error handling path of 'xge_probe()'fb45459d9d
ip_gre: add validation for csum_starte78006b59a
RDMA/efa: Free IRQ vectors on error flow8f1e3ad945
e1000e: Do not take care about recovery NVM checksum87285ac51e
e1000e: Fix the max snoop/no-snoop latency for 10M58b3dbf10c
igc: Use num_tx_queues when iterating over tx_ring queueae6480ba06
igc: fix page fault when thunderbolt is unplugged384dea502e
net: usb: pegasus: fixes of set_register(s) return value evaluation;3217c9d460
ice: do not abort devlink info if board identifier can't be found3a2c5fbb1c
RDMA/bnxt_re: Remove unpaired rtnl unlock in bnxt_re_dev_init()56ac7463a1
IB/hfi1: Fix possible null-pointer dereference in _extend_sdma_tx_descs()3e949aaa8b
RDMA/bnxt_re: Add missing spin lock initialization22c18102ec
scsi: core: Fix hang of freezing queue between blocking and running device01da7c1dc4
usb: dwc3: gadget: Stop EP0 transfers during pullup disable87b2016493
usb: dwc3: gadget: Fix dwc3_calc_trbs_left()56c92b8ddc
usb: renesas-xhci: Prefer firmware loading on unknown ROM stateb0bcc80388
USB: serial: option: add new VID/PID to support Fibocom FG1508437e07c37
Revert "USB: serial: ch341: fix character loss at high transfer rates"da3067eadc
drm/amdgpu: Cancel delayed work when GFXOFF is disabled3134292a8e
Revert "btrfs: compression: don't try to compress if we don't have enough pages"921c2533aa
riscv: Ensure the value of FP registers in the core dump file is up to datee55a8b4615
ceph: correctly handle releasing an embedded cap flush7008b9981b
can: usb: esd_usb2: esd_usb2_rx_event(): fix the interchange of the CAN RX and TX error counters45b7b20971
net: mscc: Fix non-GPL export of regmap APIsef2d68ef9a
ovl: fix uninitialized pointer read in ovl_lookup_real_one()c94d50979f
blk-iocost: fix lockdep warning on blkcg->lock6815e21fe2
once: Fix panic when module unloadf68ad168e2
netfilter: conntrack: collect all entries in one cyclea13a2df0b1
ARC: Fix CONFIG_STACKDEPOT0af6a9f82c
ASoC: component: Remove misplaced prefix handling in pin control functions34cc80ec12
ASoC: rt5682: Adjust headset volume button thresholdd81ddadabd
bpf: Fix NULL pointer dereference in bpf_get_local_storage() helper9dd6f6d896
bpf: Fix ringbuf helper function compatibilityad41706c77
net: qrtr: fix another OOB Read in qrtr_endpoint_post45cad77f78
ANDROID: GKI: update the android12-5.10-lts abi .xml fileaf06413d4c
Merge branch 'android12-5.10' into `android12-5.10-lts`383ea08168
ANDROID: GKI: db845c: Update symbols list and ABI for lts v5.10.61e0382dd2e5
Revert "virtio: Protect vqs list access"a6777a7cee
Merge 5.10.61 into android12-5.10-lts83da0c0fca
Revert "net: igmp: fix data-race in igmp_ifc_timer_expire()"a75a648f84
Revert "net: igmp: increase size of mr_ifc_count"63aa0473df
Revert "PCI/MSI: Protect msi_desc::masked for multi-MSI"b558262fdc
Merge 5.10.60 into android12-5.10-lts56f751a409
Merge branch 'android12-5.10' into `android12-5.10-lts`452ea6a15e
Linux 5.10.61f15e642673
io_uring: only assign io_uring_enter() SQPOLL error in actual error case695ab28a7f
io_uring: fix xa_alloc_cycle() error return value check0d5fcfc640
fs: warn about impending deprecation of mandatory locks8132fc2bf4
mm: memcontrol: fix occasional OOMs due to proportional memory.low reclaim53e81668e1
ASoC: intel: atom: Fix breakage for PCM buffer address setup88f65f57a0
ALSA: hda/realtek: Limit mic boost on HP ProBook 445 G8b6672f67ec
PCI: Increase D3 delay for AMD Renoir/Cezanne XHCIa69326e134
s390/pci: fix use after free of zpci_dev05b56e0554
ALSA: hda/via: Apply runtime PM workaround for ASUS B23E67fece6289
btrfs: prevent rename2 from exchanging a subvol with a directory from different parents16cfa72766
mmc: sdhci-iproc: Set SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN on BCM27112566c1d823
mmc: sdhci-iproc: Cap min clock frequency on BCM2711110b7f72f6
ALSA: hda/realtek: Enable 4-speaker output for Dell XPS 15 9510 laptop258782b937
ipack: tpci200: fix memory leak in the tpci200_register3ee1b08097
ipack: tpci200: fix many double free issues in tpci200_pci_probe0775bc462a
slimbus: ngd: reset dma setup during runtime pm45d6fc21cd
slimbus: messaging: check for valid transaction idb700b523dd
slimbus: messaging: start transaction ids from 1 instead of zerobd0c2f83d0
tracing / histogram: Fix NULL pointer dereference on strcmp() on NULL event namef7c125493c
ALSA: hda - fix the 'Capture Switch' value change notifications7451c309c7
clk: qcom: gdsc: Ensure regulator init state matches GDSC state7203b4986d
clk: imx6q: fix uart earlycon unwork3f8920c570
mmc: sdhci-msm: Update the software timeout value for sdhc8f499a90e7
mmc: mmci: stm32: Check when the voltage switch procedure should be donef8dac276a9
mmc: dw_mmc: Fix hang on data CRC error645fd92c3e
Revert "flow_offload: action should not be NULL when it is referenced"2f6c42806e
iavf: Fix ping is lost after untrusted VF had tried to change MAC7873c29832
i40e: Fix ATR queue selectione003a89219
r8152: fix writing USB_BP2_EN21ca0b18ad
iommu/vt-d: Fix incomplete cache flush in intel_pasid_tear_down_entry()81578e587c
iommu/vt-d: Consolidate duplicate cache invaliation codeeee84eafc3
ovs: clear skb->tstamp in forwarding path47a1161dac
net: mdio-mux: Handle -EPROBE_DEFER correctly13af9c81e6
net: mdio-mux: Don't ignore memory allocation errorsdf61235881
sch_cake: fix srchost/dsthost hashing modee1ec5858ba
ixgbe, xsk: clean up the resources in ixgbe_xsk_pool_enable error path3b7397b203
net: qlcnic: add missed unlock in qlcnic_83xx_flash_read329bc2d1a5a8
virtio-net: use NETIF_F_GRO_HW instead of NETIF_F_LROb7adfde949
virtio-net: support XDP when not more queues1ce62fe6e4
vrf: Reset skb conntrack connection on VRF rcv8ae539a361
bnxt_en: Add missing DMA memory barriers9751aa4436
bnxt_en: Disable aRFS if running on 212 firmwareefd9b79b92
ptp_pch: Restore dependency on PCI85e0518f18
net: 6pack: fix slab-out-of-bounds in decode_datae0ae168360
bnxt: count Tx drops296fe765dd
bnxt: make sure xmit_more + errors does not miss doorbellsd913d5cc3b
bnxt: disable napi before canceling DIM5b24ae8f05
bnxt: don't lock the tx queue from napi poll585ff7344e
bpf: Clear zext_dst of dead insns8dfdeeb1e9
drm/mediatek: Add AAL output size configurationa8b8d61bab
drm/mediatek: Fix aal size config6715cefa72
soc / drm: mediatek: Move DDP component defines into mtk-mmsys.h1b6fc6f739
vdpa/mlx5: Avoid destroying MR on empty iotlbecdd7c4880
vhost: Fix the calculation in vhost_overflow()e0b603c89a
bus: ti-sysc: Fix error handling for sysc_check_active_timer()1af7ccbd92
vhost-vdpa: Fix integer overflow in vhost_vdpa_process_iotlb_update()293180f593
virtio: Protect vqs list access9108120fbe
dccp: add do-while-0 stubs for dccp_pr_debug macrose352531ed0
cpufreq: armada-37xx: forbid cpufreq for 1.2 GHz variantd2ab5491de
iommu: Check if group is NULL before remove device44f454a146
arm64: dts: qcom: msm8992-bullhead: Remove PSCI95ed753d91
arm64: dts: qcom: c630: fix correct powerdown pin for WSA881xd7d04c6749
Bluetooth: hidp: use correct wait queue when removing ctrl_wait2e6cc93e1b
drm/amd/display: workaround for hard hang on HPD on native DPdcc8c5fb8d
drm/amd/display: Fix Dynamic bpp issue with 8K30 with Navi 1X8849a8c705
net: usb: lan78xx: don't modify phy_device state concurrently735e613fa5
net: usb: pegasus: Check the return value of get_geristers() and friends;6b368411bc
ARM: dts: nomadik: Fix up interrupt controller node names410d1ea4ff
qede: fix crash in rmmod qede while automatic debug collection7525f2e4de
drm/amdgpu: fix the doorbell missing when in CGPG issue for renoir.711459514e
scsi: core: Fix capacity set to zero after offlinining device8071dbe1bd
scsi: core: Avoid printing an error if target_alloc() returns -ENXIO4f78db7df6
scsi: scsi_dh_rdac: Avoid crash during rdac_bus_attach()cc312fa7e6
scsi: megaraid_mm: Fix end of loop tests for list_for_each_entry()968ee9176a
scsi: pm80xx: Fix TMF task completion race conditionb353028aed
dmaengine: of-dma: router_xlate to return -EPROBE_DEFER if controller is not yet available35f4162236
ARM: dts: am43x-epos-evm: Reduce i2c0 bus speed for tps65218505884a0c7
net: xfrm: Fix end of loop tests for list_for_each_entryf1c0533fae
spi: spi-mux: Add module info needed for autoloadingb618a32142
dmaengine: usb-dmac: Fix PM reference leak in usb_dmac_probe()c160df90b0
dmaengine: xilinx_dma: Fix read-after-free bug when terminating transfersd4930271a4
USB: core: Fix incorrect pipe calculation in do_proc_control()ba6c1b004a
USB: core: Avoid WARNings for 0-length descriptor requests8e100c72b6
KVM: X86: Fix warning caused by stale emulation context47d4c79997
KVM: x86: Factor out x86 instruction emulation with decodingff2fc9e4aa
media: drivers/media/usb: fix memory leak in zr364xx_probe56320b1ad4
media: zr364xx: fix memory leaks in probe()b5c7ec6d15
media: zr364xx: propagate errors from zr364xx_start_readpipe()779a0f4347
mtd: cfi_cmdset_0002: fix crash when erasing/writing AMD cardse2036bc3fc
ath9k: Postpone key cache entry deletion for TXQ frames reference it609c0cfd07
ath: Modify ath_key_delete() to not need full key entry2925a8385e
ath: Export ath_hw_keysetmac()6566c207e5
ath9k: Clear key cache explicitly on disabling hardware8f05076983
ath: Use safer key clearing with key cache entries2c5bd949b1
Linux 5.10.603a24e12130
net: dsa: microchip: ksz8795: Use software untagging on CPU port1e78179d75
net: dsa: microchip: ksz8795: Fix VLAN untagged flag change on deletion5033d5e231
net: dsa: microchip: ksz8795: Reject unsupported VLAN configuration60c007b527
net: dsa: microchip: ksz8795: Fix PVID tag insertionf365d53c86
net: dsa: microchip: Fix probing KSZ87xx switch with DT node for host port3dc5666baf
KVM: nSVM: always intercept VMLOAD/VMSAVE when nested (CVE-2021-3656)c0883f6931
KVM: nSVM: avoid picking up unsupported bits from L2 in int_ctl (CVE-2021-3653)b5f05bdfda
vmlinux.lds.h: Handle clang's module.{c,d}tor sections2fe07584a6
ceph: take snap_empty_lock atomically with snaprealm refcount changea23aced54c
ceph: clean up locking annotation for ceph_get_snap_realm and __lookup_snap_realmb0efc93271
ceph: add some lockdep assertions around snaprealm handlingdcdb587ac4
vboxsf: Add support for the atomic_open directory-inode op7cd14c1a7f
vboxsf: Add vboxsf_[create|release]_sf_handle() helpers433f0b31eb
KVM: nVMX: Use vmx_need_pf_intercept() when deciding if L0 wants a #PF0ab67e3dfc
KVM: VMX: Use current VMCS to query WAITPKG support for MSR emulation4a948c579e
efi/libstub: arm64: Double check image alignment at entryfc7da433fa
powerpc/smp: Fix OOPS in topology_init()312730cd15
PCI/MSI: Protect msi_desc::masked for multi-MSI724d0a9850
PCI/MSI: Use msi_mask_irq() in pci_msi_shutdown()9233687518
PCI/MSI: Correct misleading commentse42fb8e616
PCI/MSI: Do not set invalid bits in MSI mask042e03c9cd
PCI/MSI: Enforce MSI[X] entry updates to be visible0b2509d7a9
PCI/MSI: Enforce that MSI-X table entry is masked for updateaa8092c1d1
PCI/MSI: Mask all unused MSI-X entries7e90e81a4b
PCI/MSI: Enable and mask MSI-X early2d2c668480
genirq/timings: Prevent potential array overflow in __irq_timings_store()355754194b
genirq/msi: Ensure deactivation on teardownf0736bed18
x86/resctrl: Fix default monitoring groups reporting25216ed97d
x86/ioapic: Force affinity setup before startup19fb5dabed
x86/msi: Force affinity setup before startup4e52a4fe6f
genirq: Provide IRQCHIP_AFFINITY_PRE_STARTUP2a28b52306
x86/tools: Fix objdump version check again4acc0d9871
powerpc/kprobes: Fix kprobe Oops happens in booke015e2c900b
efi/libstub: arm64: Relax 2M alignment again for relocatable kernelsfeb4a01d3e
efi/libstub: arm64: Force Image reallocation if BSS was not reservedafcb84e6cf
arm64: efi: kaslr: Fix occasional random alloc (and boot) failuree0ee8d9c31
nbd: Aovid double completion of a requestf5cefe9a52
vsock/virtio: avoid potential deadlock when vsock device removedff830e5e7
xen/events: Fix race in set_evtchn_to_irq65395b053d
drm/i915: Only access SFC_DONE when media domain is not fused off4344440d91
net: igmp: increase size of mr_ifc_count696afe28dc
tcp_bbr: fix u32 wrap bug in round logic if bbr_init() called after 2B packets8976606ca3
net: linkwatch: fix failure to restore device state across suspend/resume4c2af90119
net: bridge: fix memleak in br_add_if()f333a5ca71
net: bridge: fix flags interpretation for extern learn fdb entriese3b949b86d
net: bridge: validate the NUD_PERMANENT bit when adding an extern_learn FDB entry1cad01aca1
net: dsa: sja1105: fix broken backpressure in .port_fdb_dump56cc3408ff
net: dsa: lantiq: fix broken backpressure in .port_fdb_dumpf7720b35cd
net: dsa: lan9303: fix broken backpressure in .port_fdb_dump24e1b7dbb1
net: igmp: fix data-race in igmp_ifc_timer_expire()69b13167a6
net: Fix memory leak in ieee802154_raw_deliverdbfaf7a6a2
net: dsa: microchip: ksz8795: Fix VLAN filteringccc1fe82c8
net: dsa: microchip: Fix ksz_read64()558092b8ed
drm/meson: fix colour distortion from HDR set during vendor u-boot6e1886465d
net/mlx5: Fix return value from tracer initialization303ba011f5
net/mlx5: Synchronize correct IRQ when destroying CQ00a0c11ddd
bareudp: Fix invalid read beyond skb's linear data30b1fc47f7
psample: Add a fwd declaration for skbuffb3f0b17084
iavf: Set RSS LUT and key in reset handle patha6192bae12
ice: don't remove netdev->dev_addr from uc sync listbae5b521fe
ice: Prevent probing virtual functions059238c52c
net: sched: act_mirred: Reset ct info when mirror/redirect skbf15f7716b0
net/smc: fix wait on already cleared link51f4965d77
ppp: Fix generating ifname when empty IFLA_IFNAME is specified046579c9fc
net: phy: micrel: Fix link detection on ksz87xx switch"e95620c3bd
bpf: Fix integer overflow involving bucket_size1960c3ac52
libbpf: Fix probe for BPF_PROG_TYPE_CGROUP_SOCKOPTa3e9a3e228
platform/x86: pcengines-apuv2: Add missing terminating entries to gpio-lookup tables53ebbfdd0e
net: mvvp2: fix short frame size on s390784320edb6
net: dsa: mt7530: add the missing RxUnicast MIB counter20a8031902
ASoC: cs42l42: Fix LRCLK frame start edge750503aecf
pinctrl: tigerlake: Fix GPIO mapping for newer version of softwarebe49d5437d
netfilter: nf_conntrack_bridge: Fix memory leak when erroraa6b17bfef
ASoC: cs42l42: Remove duplicate control for WNF filter frequencyb268f9f6b7
ASoC: cs42l42: Fix inversion of ADC Notch Switch control2386a8cde1
ASoC: SOF: Intel: hda-ipc: fix reply size checking0e47f99e86
ASoC: cs42l42: Don't allow SND_SOC_DAIFMT_LEFT_J576939671f
ASoC: cs42l42: Correct definition of ADC Volume controla21963c35f
pinctrl: mediatek: Fix fallback behavior for bias_set_combo27188a9382
ieee802154: hwsim: fix GPF in hwsim_new_edge_nl528f17c02d
ieee802154: hwsim: fix GPF in hwsim_set_edge_lqi95de3592f8
drm/amdgpu: don't enable baco on boco platforms in runpmbd80d11a51
drm/amd/display: use GFP_ATOMIC in amdgpu_dm_irq_schedule_workae311a7418
drm/amd/display: Remove invalid assert for ODM + MPC casec2351e5faa
libnvdimm/region: Fix label activation vs errors366de90ccf
ACPI: NFIT: Fix support for virtual SPA rangesf3fcf9d1b7
ceph: reduce contention in ceph_check_delayed_caps()ca6dea44bd
ARC: fp: set FPU_STATUS.FWE to enable FPU_STATUS update on context switch4716a2145b
net: ethernet: ti: cpsw: fix min eth packet size for non-switch use-cases561d13128b
seccomp: Fix setting loaded filter count during TSYNC54916988a0
scsi: lpfc: Move initialization of phba->poll_list earlier to avoid crash3db5cb9228
cifs: create sd context must be a multiple of 8d1398e3715
i2c: dev: zero out array used for i2c reads from userspaceb8bceace43
ASoC: intel: atom: Fix reference to PCM buffer address261613ef34
ASoC: tlv320aic31xx: Fix jack detection after suspend7e5a7fa68b
ASoC: uniphier: Fix reference to PCM buffer address209eb62b45
ASoC: xilinx: Fix reference to PCM buffer addressc419c4c91b
ASoC: amd: Fix reference to PCM buffer address0c9adae117
iio: adc: Fix incorrect exit of for-loop632279e505
iio: humidity: hdc100x: Add margin to the conversion time45de224b13
iio: adis: set GPIO reset pin directiond0532ed064
iio: adc: ti-ads7950: Ensure CS is deasserted after reading channels46f161a1b2
Merge 5.10.59 into android12-5.10-lts5805e5eec9
Linux 5.10.5925cff25ec6
net: xilinx_emaclite: Do not print real IOMEM pointer6a002d48a6
ovl: prevent private clone if bind mount is not allowedbffead8d36
ppp: Fix generating ppp unit id when ifname is not specified5df85901fe
ALSA: hda: Add quirk for ASUS Flow x138930f2c60a
ALSA: hda/realtek: fix mute/micmute LEDs for HP ProBook 650 G8 Notebook PC98c3fa3a9d
ALSA: pcm: Fix mmap breakage without explicit buffer setupcc1a4dff23
USB:ehci:fix Kunpeng920 ehci hardware problembd909fd387
vboxsf: Make vboxsf_dir_create() return the handle for the created file971703fc19
vboxsf: Honor excl flag to the dir-inode create op96b2232cb7
arm64: dts: renesas: beacon: Fix USB ref clock referencese0dd4a0ab0
arm64: dts: renesas: beacon: Fix USB extal reference0f47027d1b
arm64: dts: renesas: rzg2: Add usb2_clksel to RZ/G2 M/N/Heaa7feecd3
mm: make zone_to_nid() and zone_set_nid() available for DISCONTIGMEM0e70939037
Revert "selftests/resctrl: Use resctrl/info for feature detection"d8c3859870
bpf: Add lockdown check for probe_write_user helper5b5064ea9a
firmware: tee_bnxt: Release TEE shm, session, and context during kexecc5a625c6a4
tee: Correct inappropriate usage of TEE_SHM_DMA_BUF flag9f105d2d4f
KVM: SVM: Fix off-by-one indexing when nullifying last used SEV VMCBc80c82c899
Revert "xfrm: Fix RCU vs hash_resize_mutex lock inversion"af3bdb4304
Merge 5.10.58 into android12-5.10-ltsbd3afc373f
Merge branch 'android12-5.10' into `android12-5.10-lts`132a8267ad
Linux 5.10.583d7d1b0f5f
arm64: fix compat syscall return truncationbb65051dcd
drm/amdgpu/display: only enable aux backlight control for OLED panelsc8b7cfa674
smb3: rc uninitialized in one fallocate path8cfdd039ca
net/qla3xxx: fix schedule while atomic in ql_wait_for_drvr_lock and ql_adapter_resetfbbb209268
alpha: Send stop IPI to send to online CPUs13d0a9b3b9
net: qede: Fix end of loop tests for list_for_each_entry1478e902bc
virt_wifi: fix error on connectecd8614809
reiserfs: check directory items on read from diskdbe4f82fed
reiserfs: add check for root_inode in reiserfs_fill_super0f05e0ffa2
libata: fix ata_pio_sector for CONFIG_HIGHMEM11891adab2
drm/i915: avoid uninitialised var in eb_parse()a3e6bd0c71
sched/rt: Fix double enqueue caused by rt_effective_prioc797b8872b
perf/x86/amd: Don't touch the AMD64_EVENTSEL_HOSTONLY bit inside the guest2d94cffc94
soc: ixp4xx/qmgr: fix invalid __iomem access7397034905
drm/i915: Correct SFC_DONE register offset16aecf1e36
interconnect: qcom: icc-rpmh: Ensure floor BW is enforced for all nodes22b4917c85
interconnect: Always call pre_aggregate before aggregateccfe4f62ff
interconnect: Zero initial BW after sync-state05565b4693
spi: meson-spicc: fix memory leak in meson_spicc_remove1a084e7821
interconnect: Fix undersized devress_alloc allocationdcc23e5851
soc: ixp4xx: fix printing resources37cbd27ef4
arm64: vdso: Avoid ISB after reading from cntvct_el07a2b5bb00f
KVM: x86/mmu: Fix per-cpu counter corruption on 32-bit builds32f55c25ee
KVM: Do not leak memory for duplicate debugfs directories309a31127b
KVM: x86: accept userspace interrupt only if no event is injecteda786282b55
md/raid10: properly indicate failure when ending a failed write request3d7d2d2b06
ARM: omap2+: hwmod: fix potential NULL pointer access9851ad2f71
Revert "gpio: mpc8xxx: change the gpio interrupt flags."57c44e7ac7
bus: ti-sysc: AM3: RNG is GP onlyf4984f60ac
selinux: correct the return value when loads initial sids100f8396d1
pcmcia: i82092: fix a null pointer dereference bugafcd5a0e01
net/xfrm/compat: Copy xfrm_spdattr_type_t atributesf08b2d078c
xfrm: Fix RCU vs hash_resize_mutex lock inversion23e36a8610
timers: Move clearing of base::timer_running under base:: Lock9a69d0d24d
fpga: dfl: fme: Fix cpu hotplug issue in performance reportingbfb5f1a123
serial: 8250_pci: Avoid irq sharing for MSI(-X) interrupts.0f30fedced
serial: 8250_pci: Enumerate Elkhart Lake UARTs via dedicated driver17f3c64f70
MIPS: Malta: Do not byte-swap accesses to the CBUS UART8a1624f4a8
serial: 8250: Mask out floating 16/32-bit bus bitsc03cef6715
serial: 8250_mtk: fix uart corruption issue when rx power offa4f8bfc919
serial: tegra: Only print FIFO error message when an error occurscc73007768
ext4: fix potential htree corruption when growing large_dir directories6b5a3d2c2b
pipe: increase minimum default pipe size to 2 pages556e7f204d
media: rtl28xxu: fix zero-length control request551e0c5d6b
drivers core: Fix oops when driver probe failsfaec2c68ea
staging: rtl8712: error handling refactoringe468a357af
staging: rtl8712: get rid of flush_scheduled_work369101e399
staging: rtl8723bs: Fix a resource leak in sd_int_dpc1628b64efb
tpm_ftpm_tee: Free and unregister TEE shared memory during kexec2a879ff971
optee: fix tee out of memory failure seen during kexec rebootad80c25987
optee: Refuse to load the driver under the kdump kernel1340dc3fb7
optee: Fix memory leak when failing to register shm pages6b2ded93d3
tee: add tee_shm_alloc_kernel_buf()5e9d820214
optee: Clear stale cache entries during initializatione5d8fd8709
arm64: stacktrace: avoid tracing arch_stack_walk()7799ad4d18
tracepoint: Fix static call function vs data state mismatch14673e1929
tracepoint: static call: Compare data on transition from 2->1 callees046e12323a
tracing: Fix NULL pointer dereference in start_creatingb2aca8daa5
tracing: Reject string operand in the histogram expressionb10ccc2c58
tracing / histogram: Give calculation hist_fields a sizef972745280
scripts/tracing: fix the bug that can't parse raw_trace_funcfd3afb81f4
clk: fix leak on devm_clk_bulk_get_all() unwind948ff2f214
usb: otg-fsm: Fix hrtimer list corruption8f8645de09
usb: typec: tcpm: Keep other events when receiving FRS and Sourcing_vbus events5b4318885a
usb: host: ohci-at91: suspend/resume ports after/before OHCI accesses1f2015506d
usb: gadget: f_hid: idle uses the highest byte for duration825ac3f0bc
usb: gadget: f_hid: fixed NULL pointer dereference683702dff7
usb: gadget: f_hid: added GET_IDLE and SET_IDLE handlers051518d9cf
usb: cdns3: Fixed incorrect gadget state822bec5cbb
usb: gadget: remove leaked entry from udc driver list98c83d7261
usb: dwc3: gadget: Avoid runtime resume if disabling pullup79e9389038
ALSA: usb-audio: Add registration quirk for JBL Quantum 600b7532db2d4
ALSA: usb-audio: Fix superfluous autosuspend recovery80b7aa2651
ALSA: hda/realtek: Fix headset mic for Acer SWIFT SF314-56 (ALC256)de30786fb2
ALSA: hda/realtek: add mic quirk for Acer SF314-42c0b626f0a2
ALSA: pcm - fix mmap capability check for the snd-dummy driverdd3f7c5c89
drm/amdgpu/display: fix DMUB firmware version infoecb739cf15
firmware_loader: fix use-after-free in firmware_fallback_sysfs5019f5812b
firmware_loader: use -ETIMEDOUT instead of -EAGAIN in fw_load_sysfs_fallbackaa3b8bc17e
USB: serial: ftdi_sio: add device ID for Auto-M3 OP-COM v2d245a76719
USB: serial: ch341: fix character loss at high transfer rates0470385e63
USB: serial: option: add Telit FD980 composition 0x1056ba4a395668
USB: usbtmc: Fix RCU stall warningf2f856b65a
Bluetooth: defer cleanup of resources in hci_unregister_dev()821e6a6133
blk-iolatency: error out if blk_get_queue() failed in iolatency_set_limit()c5a499b860
net: vxge: fix use-after-free in vxge_device_unregisterfb49d67262
net: fec: fix use-after-free in fec_drv_removef12b6b6bc1
net: pegasus: fix uninit-value in get_interrupt_intervalc66d273b70
bnx2x: fix an error code in bnx2x_nic_load()f76f9caccb
mips: Fix non-POSIX regexpf93b7b0000
MIPS: check return value of pgtable_pmd_page_ctor9b2b2f0771
net: sched: fix lockdep_set_class() typo error for sch->seqlockd1f2abe57b
net: dsa: qca: ar9331: reorder MDIO write sequencea45ee8ed0c
net: ipv6: fix returned variable type in ip6_skb_dst_mtuf87be69b7f
nfp: update ethtool reporting of pauseframe control44f2e360e7
sctp: move the active_key update after sh_keys is addede74551ba93
RDMA/mlx5: Delay emptying a cache entry when a new MR is added to it recently1242ca9369
gpio: tqmx86: really make IRQ optional4ef549dc9c
net: natsemi: Fix missing pci_disable_device() in probe and remove1dc3eef381
net: phy: micrel: Fix detection of ksz87xx switche09dba75ca
net: dsa: sja1105: match FDB entries regardless of inner/outer VLAN tagc0b14a0e61
net: dsa: sja1105: be stateless with FDB entries on SJA1105P/Q/R/S/SJA1110 too00bf923dce
net: dsa: sja1105: invalidate dynamic FDB entries learned concurrently with statically added onesde425f1c3a
net: dsa: sja1105: overwrite dynamic FDB entries with static ones in .port_fdb_add74bcf85ff1
net, gro: Set inner transport header offset in tcp/udp GRO hook80fd533ac3
dmaengine: imx-dma: configure the generic DMA type to make it work163e6d8721
ARM: dts: stm32: Fix touchscreen IRQ line assignment on DHCOM442f7e04d5
ARM: dts: stm32: Disable LAN8710 EDPD on DHCOM449991df08
media: videobuf2-core: dequeue if start_streaming fails3e8bba6012
scsi: sr: Return correct event when media event code is 3aaaf6e6e41
spi: imx: mx51-ecspi: Fix low-speed CONFIGREG delay calculationcd989e1192
spi: imx: mx51-ecspi: Reinstate low-speed CONFIGREG delay281514da66
dmaengine: stm32-dmamux: Fix PM usage counter unbalance in stm32 dmamux opsbbce3c99f6
dmaengine: stm32-dma: Fix PM usage counter imbalance in stm32 dma ops84656b4c27
clk: tegra: Implement disable_unused() of tegra_clk_sdmmc_mux_opsedf1b7911a
dmaengine: uniphier-xdmac: Use readl_poll_timeout_atomic() in atomic state4ebd11d1c7
omap5-board-common: remove not physically existing vdds_1v8_main fixed-regulator9bf056b99f
ARM: dts: am437x-l4: fix typo in can@0 nodee79a30f71d
clk: stm32f4: fix post divisor setup for I2S/SAI PLLs71f39badc8
ALSA: usb-audio: fix incorrect clock source settingc4fcda1287
arm64: dts: armada-3720-turris-mox: remove mrvl,i2c-fast-mode8d13f6a0a6
arm64: dts: armada-3720-turris-mox: fixed indices for the SDHC controllersf239369f37
ARM: dts: imx: Swap M53Menlo pinctrl_power_button/pinctrl_power_out pinsee6f708432
ARM: imx: fix missing 3rd argument in macro imx_mmdc_perf_inite1011b9c59
ARM: dts: colibri-imx6ull: limit SDIO clock to 25MHzc0f61abbef
arm64: dts: ls1028: sl28: fix networking for variant 254555c3996
ARM: dts: imx6qdl-sr-som: Increase the PHY reset duration to 10ms3790f94098
ARM: imx: add missing clk_disable_unprepare()a28569b510
ARM: imx: add missing iounmap()9189d77f0e
arm64: dts: ls1028a: fix node name for the sysclkd61dc8c634
net: xfrm: fix memory leak in xfrm_user_rcv_msg8efe3a635f
bus: ti-sysc: Fix gpt12 system timer issue with reserved statuse32a291736
ALSA: seq: Fix racy deletion of subscriberb917f123b5
Revert "ACPICA: Fix memory leak caused by _CID repair function"a15695131a
Merge 5.10.57 into android12-5.10-ltsafeb953f87
Merge branch 'android12-5.10' into `android12-5.10-lts`1cd6e30b83
Linux 5.10.579c645a020b
spi: mediatek: Fix fifo transfer7254e2d9eb
selftest/bpf: Verifier tests for var-off access30ea1c5352
bpf, selftests: Adjust few selftest outcomes wrt unreachable code98bf2906d3
bpf: Update selftests to reflect new error states360e5b7af6
bpf, selftests: Adjust few selftest result_unpriv outcomes5abcd138cb
selftest/bpf: Adjust expected verifier errors83bbf953f6
selftests/bpf: Add a test for ptr_to_map_value on stack for helper accesse2b7a4ccbf
Revert "watchdog: iTCO_wdt: Account for rebooting on second timeout"1b1a00b13c
firmware: arm_scmi: Add delayed response status check93ef561406
firmware: arm_scmi: Ensure drivers provide a probe function1812895f17
Revert "Bluetooth: Shutdown controller after workqueues are flushed or cancelled"cae3fa3d81
ACPI: fix NULL pointer dereference98b070694f
drm/amd/display: Fix max vstartup calculation for modes with bordersf9d875c8c9
drm/amd/display: Fix comparison error in dcn21 DML91865b458e
nvme: fix nvme_setup_command metadata trace event06a9092f66
efi/mokvar: Reserve the table only if it is in boot services data27ff30c8b3
ASoC: ti: j721e-evm: Check for not initialized parent_clk_ida00bcc5298
ASoC: ti: j721e-evm: Fix unbalanced domain activity tracking during startupe8b287e783
net: Fix zero-copy head len calculation.c6bdf7d97d
ASoC: rt5682: Fix the issue of garbled recording after powerd_dbus_suspend74b53ee4b8
qed: fix possible unpaired spin_{un}lock_bh in _qed_mcp_cmd_and_union()f6a2ff040b
r8152: Fix potential PM refcount imbalancec98a7916cd
ASoC: tlv320aic31xx: fix reversed bclk/wclk master bits03258515c9
spi: stm32h7: fix full duplex irq handler handlingcfb8173a23
regulator: rt5033: Fix n_voltages settings for BUCK and LDO81dc9a4868
regulator: rtmv20: Fix wrong mask for strobe-polarity-high9e55b9278c
btrfs: fix lost inode on log replay after mix of fsync, rename and inode evictione2419c5709
btrfs: fix race causing unnecessary inode logging during link and rename118b070bf4
Revert "drm/i915: Propagate errors on awaiting already signaled fences"6976f3cf34
drm/i915: Revert "drm/i915/gem: Asynchronous cmdparser"2da9d8f1db
Merge branch 'android12-5.10' into `android12-5.10-lts`8b444656fa
Merge 5.10.56 into android12-5.10-lts75ca4a8efe
Merge branch 'android12-5.10' into `android12-5.10-lts`9746c25334
Linux 5.10.5655dd22c5d0
can: j1939: j1939_session_deactivate(): clarify lifetime of session object75ebe1d355
i40e: Add additional info to PHY type error2ca5ec188b
Revert "perf map: Fix dso->nsinfo refcounting"c14cee5bc4
powerpc/pseries: Fix regression while building external modulesbfc8e67c60
SMB3: fix readpage for large swap cachebe561c0154
bpf: Fix pointer arithmetic mask tightening under state pruningffb9d5c48b
bpf: verifier: Allocate idmap scratch in verifier enva11ca29c65
bpf: Remove superfluous aux sanitation on subprog rejection0e9280654a
bpf: Fix leakage due to insufficient speculative store bypass mitigationbea9e2fd18
bpf: Introduce BPF nospec instruction for mitigating Spectre v4cd61e665a1
can: hi311x: fix a signedness bug in hi3110_cmd()65dfa6cb22
sis900: Fix missing pci_disable_device() in probe and remove93e5bf4b29
tulip: windbond-840: Fix missing pci_disable_device() in probe and remove58b8c812c7
sctp: fix return value check in __sctp_rcv_asconf_lookup362e9d23cf
net/mlx5e: Fix nullptr in mlx5e_hairpin_get_mdev()bd744f2a27
net/mlx5: Fix flow table chaining1b148bd72e
skmsg: Make sk_psock_destroy() static645a1d3bef
drm/msm/dp: Initialize the INTF_CONFIG register4a6841921c
drm/msm/dpu: Fix sm8250_mdp register lengthe6097071a4
net: llc: fix skb_over_panic01f3581d44
KVM: x86: Check the right feature bit for MSR_KVM_ASYNC_PF_ACK accessf5f78ae5f1
mlx4: Fix missing error code in mlx4_load_one()51b751fc06
octeontx2-pf: Fix interface down flag on error4951ffa3fa
tipc: do not write skb_shinfo frags when doing decrytion7eefa0b74f
ionic: count csum_none when offload enabled60decbe01d
ionic: fix up dim accounting for tx and rxa7c85a516c
ionic: remove intr coalesce update from napi6961323eed
net: qrtr: fix memory leaks91350564ea
net: Set true network header for ECN decapsulationa41282e82a
tipc: fix sleeping in tipc accept routine10f585740c
tipc: fix implicit-connect for SYN+bb60616162
i40e: Fix log TC creation failure when max num of queues is exceededc1cc6bce1a
i40e: Fix queue-to-TC mapping on Tx4382cca179
i40e: Fix firmware LLDP agent related warninge090ffdf05
i40e: Fix logic of disabling queuescbc8012902
netfilter: nft_nat: allow to specify layer 4 protocol NAT only3dbda8483f
netfilter: conntrack: adjust stop timestamp to real expiry valueac038f4152
mac80211: fix enabling 4-address mode on a sta vif after assoc076bc6ebce
bpf: Fix OOB read when printing XDP link fdinfoe6a06a13ec
RDMA/bnxt_re: Fix stats countersc8667cb406
cfg80211: Fix possible memory leak in function cfg80211_bss_update9ab284bc35
nfc: nfcsim: fix use after free during module unloadea04a3b572
blk-iocost: fix operation ordering in iocg_wake_fn()fc2756cce0
drm/amdgpu: Fix resource leak on probe error pathccc7a1bb32
drm/amdgpu: Avoid printing of stack contents on firmware load error63570e5780
drm/amd/display: ensure dentist display clock update finished in DCN202eab387507
NIU: fix incorrect error return, missed in previous revertcb71730a63
HID: wacom: Re-enable touch by default for Cintiq 24HDT / 27QHDT7bca5da005
alpha: register early reserved memory in memblock30e19d072e
can: esd_usb2: fix memory leak88b4025816
can: ems_usb: fix memory leakf58ac91ff8
can: usb_8dev: fix memory leaka6ebfbdaca
can: mcba_usb_start(): add missing urb->transfer_dma initialization2fc2c2816c
can: peak_usb: pcan_usb_handle_bus_evt(): fix reading rxerr/txerr valuesafe2ffd920
can: raw: raw_setsockopt(): fix raw_rcv panic for sock UAFa9c02d0e15
can: j1939: j1939_xtp_rx_dat_one(): fix rxtimer value between consecutive TP.DT to 750msda4f4916da
ocfs2: issue zeroout to EOF blocks9430145930
ocfs2: fix zero out valid data52acb6c147
KVM: add missing compat KVM_CLEAR_DIRTY_LOG7d67d4ab28
x86/kvm: fix vcpu-id indexed array sizes2388c7674f
ACPI: DPTF: Fix reading of attributes0d6afa2597
Revert "ACPI: resources: Add checks for ACPI IRQ override"0a421a2fc5
btrfs: mark compressed range uptodate only if all bio succeed4e1a57d752
btrfs: fix rw device counting in __btrfs_free_extra_devids27aa7171fe
pipe: make pipe writes always wake up readers02210a5e18
x86/asm: Ensure asm/proto.h can be included stand-alone65b2658634
io_uring: fix null-ptr-deref in io_sq_offload_start()e44d22fdf7
selftest: fix build error in tools/testing/selftests/vm/userfaultfd.c1afedcdcf8
Merge 5.10.55 into android12-5.10-lts11fe69a171
Linux 5.10.55984e93b8e2
ipv6: ip6_finish_output2: set sk into newly allocated nskba74054ca75
ARM: dts: versatile: Fix up interrupt controller node names3510b9b41c
iomap: remove the length variable in iomap_seek_hole8659186e72
iomap: remove the length variable in iomap_seek_data6503940748
cifs: fix the out of range assignment to bit fields in parse_server_interfacesfe5fe0b1c8
firmware: arm_scmi: Fix range check for the maximum number of pending messages8f8e5475a3
firmware: arm_scmi: Fix possible scmi_linux_errmap buffer overflowd01328fef6
hfs: add lock nesting notation to hfs_find_init06b3d9923f
hfs: fix high memory mapping in hfs_bnode_read680b2917e6
hfs: add missing clean-up in hfs_fill_super5c3d753b87
drm/ttm: add a check against null pointer dereference2323690eb0
ipv6: allocate enough headroom in ip6_finish_output2()86cb49e731
rcu-tasks: Don't delete holdouts within trc_wait_for_one_reader()55ddab2bfd
rcu-tasks: Don't delete holdouts within trc_inspect_reader()4d972881f8
sctp: move 198 addresses from unusable to private scope915226f31f
net: annotate data race around sk_ll_usec92289f58f0
net/802/garp: fix memleak in garp_request_join()5d93810761
net/802/mrp: fix memleak in mrp_request_join()df34f88862
cgroup1: fix leaked context root causing sporadic NULL deref in LTPdcd00801f3
workqueue: fix UAF in pwq_unbound_release_workfn()93c5951e0c
af_unix: fix garbage collect vs MSG_PEEKdee8119eaa
KVM: x86: determine if an exception has an error code only when injecting it.6f5d7a45f5
io_uring: fix link timeout refs475312897e
tools: Allow proper CC/CXX/... override with LLVM=1 in Makefile.include57e177ea01
Merge branch 'android12-5.10' into `android12-5.10-lts`e4cac2c332
Merge 5.10.54 into android12-5.10-lts0482d070e7
Merge branch 'android12-5.10' into `android12-5.10-lts`08277b9dde
Linux 5.10.54c9f8e17990
skbuff: Fix build with SKB extensions disabledba28765d33
xhci: add xhci_get_virt_ep() helper624290f368
sfc: ensure correct number of XDP queues1df4fe5a88
drm/i915/gvt: Clear d3_entered on elsp cmd submission.c938e65768
usb: ehci: Prevent missed ehci interrupts with edge-triggered MSI25af91a806
perf inject: Close inject.output on exitfb35426d12
Documentation: Fix intiramfs script name570341f10e
skbuff: Release nfct refcount on napi stolen or re-used skbs31828ffdab
bonding: fix build issuec9d97b7bb8
PCI: Mark AMD Navi14 GPU ATS as brokenf7ee361182
net: dsa: mv88e6xxx: enable SerDes PCS register dump via ethtool -d on Topaz30f1d4d036
net: dsa: mv88e6xxx: enable SerDes RX stats for Topazfc31b5be13
drm/amdgpu: update golden setting for sienna_cichlid69a603aa17
drm: Return -ENOTTY for non-drm ioctls2831eeb7bc
driver core: Prevent warning when removing a device link from unregistered consumer0e75938323
nds32: fix up stack guard gap7497f4c91d
misc: eeprom: at24: Always append device id even if label property is set.8571daace5
rbd: always kick acquire on "acquired" and "released" notifications2f3731de5e
rbd: don't hold lock_rwsem while running_list is being drained92291fa2d1
hugetlbfs: fix mount mode command line processing1a25c5738d
memblock: make for_each_mem_range() traverse MEMBLOCK_HOTPLUG regions0b591c020d
userfaultfd: do not untag user pointersfca5343b48
io_uring: remove double poll entry on arm failure9eef902915
io_uring: explicitly count entries for poll reqs1077e2b152
selftest: use mmap instead of posix_memalign to allocate memory6e81e2c38a
posix-cpu-timers: Fix rearm racing against process tick3efec3b4b1
bus: mhi: core: Validate channel ID when processing command completionsb3f3a58a86
ixgbe: Fix packet corruption due to missing DMA synce991457afd
media: ngene: Fix out-of-bounds bug in ngene_command_config_free_buf()755971dc7e
btrfs: check for missing device in btrfs_trim_fs552b053f1a
tracing: Synthetic event field_pos is an index not a boolean757bdba802
tracing: Fix bug in rb_per_cpu_empty() that might cause deadloop.a5e1aff589
tracing/histogram: Rename "cpu" to "common_cpu"0edad8b9f6
tracepoints: Update static_call before tp_funcs when adding a tracepoint4ed4074c6c
firmware/efi: Tell memblock about EFI iomem reservations647e26b03e
usb: typec: stusb160x: register role switch before interrupt registrationa206167bd6
usb: dwc2: gadget: Fix sending zero length packet in DDMA mode.f2c04f6b21
usb: dwc2: gadget: Fix GOUTNAK flow for Slave mode.7073acb51a
usb: gadget: Fix Unbalanced pm_runtime_enable in tegra_xudc_probe1bf7371b90
USB: serial: cp210x: add ID for CEL EM3588 USB ZigBee stick45c87a9433
USB: serial: cp210x: fix comments for GE CS1000f528521c15
USB: serial: option: add support for u-blox LARA-R6 family311fd7f7f1
usb: renesas_usbhs: Fix superfluous irqs happen after usb_pkt_pop()7af54a4e22
usb: max-3421: Prevent corruption of freed memory69da81a964
USB: usb-storage: Add LaCie Rugged USB3-FW to IGNORE_UASe6343aab3e
usb: hub: Fix link power management max exit latency (MEL) calculations8f087b4cf1
usb: hub: Disable USB 3 device initiated lpm if exit latency is too high709137c853
KVM: PPC: Book3S HV Nested: Sanitise H_ENTER_NESTED TM statec1fbdf0f3c
KVM: PPC: Book3S: Fix H_RTAS rets buffer overflowe3eb672c16
xhci: Fix lost USB 2 remote wake02e2e96ba5
usb: xhci: avoid renesas_usb_fw.mem when it's unusable9e9cf23b77
Revert "usb: renesas-xhci: Fix handling of unknown ROM state"ebaa67086f
ALSA: pcm: Fix mmap capability check431e311055
ALSA: pcm: Call substream ack() method upon compat mmap commit3c9afa23f3
ALSA: hdmi: Expose all pins on MSI MS-7C94 board253759df80
ALSA: hda/realtek: Fix pop noise and 2 Front Mic issues on a machine2b3cdf5819
ALSA: sb: Fix potential ABBA deadlock in CSP driver5858c8a464
ALSA: usb-audio: Add registration quirk for JBL Quantum headsets2de518548d
ALSA: usb-audio: Add missing proc text entry for BESPOKEN type37a88b41dc
s390/boot: fix use of expolines in the DMA coded1ab962880
s390/ftrace: fix ftrace_update_ftrace_func implementation3b4009b496
mmc: core: Don't allocate IDA for OF aliasesfc6ac92cfc
proc: Avoid mixing integer types in mem_rw()76f7eae7ec
cifs: fix fallocate when trying to allocate a hole.c26372b8a8
cifs: only write 64kb at a time when fallocating a small region of a fileb91e5b6347
drm/panel: raspberrypi-touchscreen: Prevent double-free9e0373945e
net: sched: cls_api: Fix the the wrong parameterc8ebf135c1
net: dsa: sja1105: make VID 4095 a bridge VLAN too164294d09c
tcp: disable TFO blackhole logic by default8eb2258732
sctp: update active_key for asoc when old key is being replacedef799bd8ff
nvme: set the PRACT bit when using Write Zeroes with T10 PI7850f03ed8
r8169: Avoid duplicate sysfs entry creation error0f5dc39714
afs: Fix tracepoint string placement with built-in AFS711057846a
Revert "USB: quirks: ignore remote wake-up on Fibocom L850-GL LTE modem"8985dc2cab
nvme-pci: don't WARN_ON in nvme_reset_work if ctrl.state is not RESETTINGfb28b15920
ceph: don't WARN if we're still opening a session to an MDSce8fafb680
ipv6: fix another slab-out-of-bounds in fib6_nh_flush_exceptions071729150b
net/sched: act_skbmod: Skip non-Ethernet packetsee36bb4713
spi: spi-bcm2835: Fix deadlock432738c974
net: hns3: fix rx VLAN offload state inconsistent issue3e903e0b57
net: hns3: fix possible mismatches resp of mailboxf4305375f0
ALSA: hda: intel-dsp-cfg: add missing ElkhartLake PCI ID41a839437a
net/tcp_fastopen: fix data races around tfo_active_disable_stampba33363976
net: hisilicon: rename CACHE_LINE_MASK to avoid redefinition320dcbdec4
bnxt_en: Check abort error state in bnxt_half_open_nic()134a0536f0
bnxt_en: Validate vlan protocol ID on RX packets4f7da0f97b
bnxt_en: Add missing check for BNXT_STATE_ABORT_ERR in bnxt_fw_rset_task()927370485e
bnxt_en: Refresh RoCE capabilities in bnxt_ulp_probe()ab830c3bae
bnxt_en: don't disable an already disabled PCI device2646368944
ACPI: Kconfig: Fix table override from built-in initrd113ce8c504
spi: cadence: Correct initialisation of runtime PM again3ea448b62b
scsi: target: Fix protect handling in WRITE SAME(32)b82a1a26aa
scsi: iscsi: Fix iface sysfs attr detection6811744bd0
netrom: Decrease sock refcount when sock timers expire096a8dca8c
sctp: trim optlen when it's a huge value in sctp_setsockopt8e9662fde6
net: sched: fix memory leak in tcindex_partial_destroy_worke14ef10953
KVM: PPC: Fix kvm_arch_vcpu_ioctl vcpu_load leakfcbad8e18d
KVM: PPC: Book3S: Fix CONFIG_TRANSACTIONAL_MEM=n crash30b8302151
net: decnet: Fix sleeping inside in af_decnetd402c60da0
efi/tpm: Differentiate missing and invalid final event log table.8983766903
dma-mapping: handle vmalloc addresses in dma_common_{mmap,get_sgtable}115e4f5b64
usb: hso: fix error handling code of hso_create_net_device1582a02fec
net: fix uninit-value in caif_seqpkt_sendmsg2fc8048265
bpftool: Check malloc return value in mount_bpffs_for_pin3b5b0afd8d
bpf, sockmap, udp: sk_prot needs inuse_idx set for proc statsc260442431
bpf, sockmap, tcp: sk_prot needs inuse_idx set for proc stats715f378f42
bpf, sockmap: Fix potential memory leak on unlikely error casee3a9548ae5
s390/bpf: Perform r1 range checking before accessing jit->seen_reg[r1]9264bebe9e
liquidio: Fix unintentional sign extension issue on left shift of u160ff2ea9d8f
timers: Fix get_next_timer_interrupt() with no timers pendingca9ba1de8f
xdp, net: Fix use-after-free in bpf_xdp_link_release39f1735c81
bpf: Fix tail_call_reachable rejection for interpreter when jit failed2b4046e64f
bpf, test: fix NULL pointer dereference on invalid expected_attach_type3dba72d1fc
ASoC: rt5631: Fix regcache sync errors on resume2435dcfd16
spi: mediatek: fix fifo rx modea9a85bfedd
regulator: hi6421: Fix getting wrong drvdata5cdc986aad
regulator: hi6421: Use correct variable type for regmap api val argument23811b75fd
spi: stm32: fixes pm_runtime calls in probe/remove844ab04b62
spi: imx: add a check for speed_hz before calculating the clock3b6c430d12
ASoC: wm_adsp: Correct wm_coeff_tlv_get handling57efe4f82a
perf sched: Fix record failure when CONFIG_SCHEDSTATS is not set61f2e1e795
perf data: Close all files in close_dir()7c91e0ce26
perf probe-file: Delete namelist in del_events() on the error patha6c32317cd
perf lzma: Close lzma stream on exit2ae8f40a8f
perf script: Fix memory 'threads' and 'cpus' leaks on exit51077d315a
perf report: Free generated help strings for sort option2bfa3c53ea
perf env: Fix memory leak of cpu_pmu_capsa2f0da3af6
perf test maps__merge_in: Fix memory leak of mapsb7bfd8aeb9
perf dso: Fix memory leak in dso__new_map()c9c101da3e
perf test event_update: Fix memory leak of evlistb768db7f80
perf test session_topology: Delete session->evlistb8892d16a9
perf env: Fix sibling_dies memory leak306411a8bf
perf probe: Fix dso->nsinfo refcountingf21987d7bb
perf map: Fix dso->nsinfo refcounting7337ff2093
perf inject: Fix dso->nsinfo refcountinga87d42ae7f
KVM: x86/pmu: Clear anythread deprecated bit when 0xa leaf is unsupported on the SVMb990585f9b
nvme-pci: do not call nvme_dev_remove_admin from nvme_remove0fa11e1a20
mptcp: fix warning in __skb_flow_dissect() when do syn cookie for subflow join3714e0bb0d
cxgb4: fix IRQ free race during driver unloadd92337bf54
pwm: sprd: Ensure configuring period and duty_cycle isn't wrongly skippedf1edbcc47f
selftests: icmp_redirect: IPv6 PMTU info should be cleared after redirect906bbb18db
selftests: icmp_redirect: remove from checking for IPv6 route getbb737eceb9
stmmac: platform: Fix signedness bug in stmmac_probe_config_dt()79ec7b5b2f
ipv6: fix 'disable_policy' for fwd packets35eaefb44e
bonding: fix incorrect return value of bond_ipsec_offload_ok()13626bad63
bonding: fix suspicious RCU usage in bond_ipsec_offload_ok()56ccdf868a
bonding: Add struct bond_ipesc to manage SAb3bd1f5e50
bonding: disallow setting nested bonding + ipsec offload43511a6a16
bonding: fix suspicious RCU usage in bond_ipsec_del_sa()6ca0e55a13
ixgbevf: use xso.real_dev instead of xso.dev in callback functions of struct xfrmdev_opsba7bfcdff1
bonding: fix null dereference in bond_ipsec_add_sa()3ae639af36
bonding: fix suspicious RCU usage in bond_ipsec_add_sa()4a31baf55f
net: add kcov handle to skb extensions78e4baff95
gve: Fix an error handling path in 'gve_probe()'813449fb85
igb: Fix position of assignment to *ring44171801d3
igb: Check if num of q_vectors is smaller than max before array accesscb9292445d
iavf: Fix an error handling path in 'iavf_probe()'a6756d637b
e1000e: Fix an error handling path in 'e1000_probe()'dea695a2ee
fm10k: Fix an error handling path in 'fm10k_probe()'a099192fe7
igb: Fix an error handling path in 'igb_probe()'db4c32c1b9
igc: Fix an error handling path in 'igc_probe()'7bc9fb1f80
ixgbe: Fix an error handling path in 'ixgbe_probe()'02d1af0bee
igc: change default return of igc_read_phy_reg()f153664d8e
igb: Fix use-after-free error during resete15f629036
igc: Fix use-after-free error during reset67e686fc73
Revert "bpf: Track subprog poke descriptors correctly and fix use-after-free"afe9ed0e13
Merge 5.10.53 into android12-5.10-lts71046eac2d
Linux 5.10.536cd9bd2a2d
udp: annotate data races around unix_sk(sk)->gso_sizebfdb38a426
drm/panel: nt35510: Do not fail if DSI read fails0d90d8492f
perf test bpf: Free obj_bufa9f36bf361
bpf: Track subprog poke descriptors correctly and fix use-after-free782d71e29b
bpftool: Properly close va_list 'ap' by va_end() on error2381b8e882
tools: bpf: Fix error in 'make -C tools/ bpf_install'638632997c
tcp: call sk_wmem_schedule before sk_mem_charge in zerocopy path2fee3cf4c9
ipv6: tcp: drop silly ICMPv6 packet too big messagesad4ba34049
tcp: fix tcp_init_transfer() to not reset icsk_ca_initializedd60f07bcb7
tcp: annotate data races around tp->mtu_infoea66fcb296
tcp: consistently disable header prediction for mptcpc28c747e37
ARM: dts: tacoma: Add phase corrections for eMMCe55160537d
ARM: dts: aspeed: Fix AST2600 machines line namesff4b8f35c9
kbuild: do not suppress Kconfig prompts for silent build0d514185ae
dma-buf/sync_file: Don't leak fences on merge failuref33605908a
net: fddi: fix UAF in fza_probe66c73f187d
net: dsa: properly check for the bridge_leave methods in dsa_switch_bridge_leave()7d7d0e84ac
Revert "mm/shmem: fix shmem_swapin() race with swapoff"2179d96ec7
net: validate lwtstate->data before returning from skb_tunnel_info()b61d8814c4
net: send SYNACK packet with accepted fwmarkf2a062fcfe
net: ti: fix UAF in tlan_remove_oneb560521eca
net: qcom/emac: fix UAF in emac_removedbbf5b957b
net: moxa: fix UAF in moxart_mac_probe88ff9ec9c6
net: ip_tunnel: fix mtu calculation for ETHER tunnel devices846829e75d
net: bcmgenet: Ensure all TX/RX queues DMAs are disabledb9fa66072f
net: netdevsim: use xso.real_dev instead of xso.dev in callback functions of struct xfrmdev_ops59070cc43d
net: bridge: sync fdb to new unicast-filtering ports7b5a2910e7
net/sched: act_ct: remove and free nf_table callbacks6d4476236f
vmxnet3: fix cksum offload issues for tunnels with non-default udp portsc3bc9ce7d4
net/sched: act_ct: fix err check for nf_conntrack_confirmfc40fdefd9
netfilter: ctnetlink: suspicious RCU usage in ctnetlink_dump_helpinfo34365de508
net: ipv6: fix return value of ip6_skb_dst_mtu73146745ff
net: dsa: mv88e6xxx: enable devlink ATU hash param for Topaza8c7ba3687
net: dsa: mv88e6xxx: enable .rmu_disable() on Topaz14cd8ce80a
net: dsa: mv88e6xxx: use correct .stats_set_histogram() on Topazc657413dcd
net: dsa: mv88e6xxx: enable .port_set_policy() on Topazfcb970edc0
net: bcmgenet: ensure EXT_ENERGY_DET_MASK is clear4e275a4aca
usb: cdns3: Enable TDL_CHK only for OUT epce6ee46e0f
mm/page_alloc: fix memory map initialization for descending nodes9e1cf2d1ed
mm/userfaultfd: fix uffd-wp special cases for fork()84ff5f66c3
mm/thp: simplify copying of huge zero page pmd when forka62177b357
f2fs: Show casefolding support only when supported277b311ae1
Revert "swap: fix do_swap_page() race with swapoff"d92aa22f24
arm64: dts: marvell: armada-37xx: move firmware node to generic dtsi file0e67c76384
firmware: turris-mox-rwtm: add marvell,armada-3700-rwtm-firmware compatible stringe58c162789
cifs: prevent NULL deref in cifs_compose_mount_options()faa3e7da48
s390: introduce proper type handling call_on_stack() macrobe10fff3a4
s390/traps: do not test MONITOR CALL without CONFIG_BUG9beba14699
thermal/core/thermal_of: Stop zone device before unregistering it7412c988fe
perf/x86/intel/uncore: Clean up error handling path of iio mapping892387e761
sched/fair: Fix CFS bandwidth hrtimer expiry typeeb859b043c
scsi: qedf: Add check to synchronize abort and flusha4a54c54af
scsi: libfc: Fix array index out of bound exception0d7596a954
scsi: libsas: Add LUN number check in .slave_alloc callback2f8df6332e
scsi: aic7xxx: Fix unintentional sign extension issue on left shift of u8cdb995a6cb
rtc: max77686: Do not enforce (incorrect) interrupt trigger typed3ba15fb04
arch/arm64/boot/dts/marvell: fix NAND partitioning schemee378db1189
kbuild: mkcompile_h: consider timestamp if KBUILD_BUILD_TIMESTAMP is set8c12a3a68d
thermal/drivers/sprd: Add missing of_node_put for loop iteration20babcd830
thermal/drivers/imx_sc: Add missing of_node_put for loop iteration469951ce4b
thermal/drivers/rcar_gen3_thermal: Do not shadow rcar_gen3_ths_tj_1bd40e2da3a
thermal/core: Correct function name thermal_zone_device_unregister()6c099d595f
arm64: dts: imx8mq: assign PCIe clocks24c41aa9d0
arm64: dts: ls208xa: remove bus-num from dspi node7e3f5739cc
firmware: tegra: bpmp: Fix Tegra234-only builds7c03982fa1
soc/tegra: fuse: Fix Tegra234-only buildsffa6f08be1
ARM: OMAP2+: Block suspend for am3 and am4 if PM is not configuredf40a7c9b8e
ARM: dts: stm32: fix stpmic node for stm32mp1 boards2670d3d1ef
ARM: dts: stm32: Rename spi-flash/mx66l51235l@N to flash@N on DHCOM SoM26cd441c52
ARM: dts: stm32: Drop unused linux,wakeup from touchscreen node on DHCOM SoMa5bc2a2d83
ARM: dts: stm32: fix the Odyssey SoM eMMC VQMMC supplye27052f21a
ARM: dts: stm32: move stmmac axi config in ethernet node on stm32mp156a7af63478
ARM: dts: stm32: fix i2c node name on stm32f746 to prevent warnings160c92d728
ARM: dts: rockchip: fix supply properties in io-domains nodesd671fae046
arm64: dts: juno: Update SCPI nodes as per the YAML schemafc71d8df58
ARM: dts: bcm283x: Fix up GPIO LED node names4bc03e321f
ARM: dts: bcm283x: Fix up MMC node names15d727c044
firmware: arm_scmi: Fix the build when CONFIG_MAILBOX is not selectedb4009ea92f
firmware: arm_scmi: Add SMCCC discovery dependency in Kconfig41e2bcca23
memory: tegra: Fix compilation warnings on 64bit platforms7ad965c8a7
ARM: dts: stm32: fix timer nodes on STM32 MCU to prevent warningsccec32f771
ARM: dts: stm32: fix RCC node name on stm32f429 MCUbfbc4b4820
ARM: dts: stm32: fix gpio-keys node on STM32 MCU boards34ec6702a2
ARM: dts: stm32: fix stm32mp157c-odyssey card detect pin44f4e344f4
ARM: dts: stm32: Fix touchscreen node on dhcom-pdk23534a4b2d0
ARM: dts: stm32: Remove extra size-cells on dhcom-pdk28da771b552
arm64: dts: qcom: sc7180: Move rmtfs memory regiona74d3bbe05
ARM: tegra: nexus7: Correct 3v3 regulator GPIO of PM269 variante89f4098d5
ARM: tegra: wm8903: Fix polarity of headphones-detection GPIO in device-treesc8815d6fee
arm64: dts: ti: k3-am654x/j721e/j7200-common-proc-board: Fix MCU_RGMII1_TXC direction28d2ae9815
ARM: dts: OMAP2+: Replace underscores in sub-mailbox node namesa73a22a69f
ARM: dts: am335x: fix ti,no-reset-on-init flag for gpiosddf2d14894
ARM: dts: am437x-gp-evm: fix ti,no-reset-on-init flag for gpiosa09b4c4449
ARM: dts: am57xx-cl-som-am57x: fix ti,no-reset-on-init flag for gpios3f09485699
kbuild: sink stdout from cmd for silent build27582c9fa2
rtc: mxc_v2: add missing MODULE_DEVICE_TABLE6f5891a560
ARM: dts: imx6dl-riotboard: configure PHY clock and set proper EEE value5190a6604a
ARM: dts: ux500: Fix orientation of accelerometer61fda04276
ARM: dts: ux500: Rename gpio-controller node985947c535
ARM: dts: ux500: Fix interrupt cellsff9ef21bb6
arm64: dts: rockchip: fix regulator-gpio states array31e1b8c07d
ARM: imx: pm-imx5: Fix references to imx5_cpu_suspend_infod05ebeffca
ARM: dts: imx6: phyFLEX: Fix UART hardware flow control249d8e4ea1
ARM: dts: Hurricane 2: Fix NAND nodes namesf6541401db
ARM: dts: BCM63xx: Fix NAND nodes namesb5fc6b9ab4
ARM: NSP: dts: fix NAND nodes names5f844007eb
ARM: Cygnus: dts: fix NAND nodes names9525d58c5a
ARM: brcmstb: dts: fix NAND nodes names4e8eb51ae6
reset: ti-syscon: fix to_ti_syscon_reset_data macrocabcb576fc
arm64: dts: rockchip: Fix power-controller node names for rk339981ea23d988
arm64: dts: rockchip: Fix power-controller node names for rk3328e4f97b740d
arm64: dts: rockchip: Fix power-controller node names for px3095b64be2e7
ARM: dts: rockchip: Fix power-controller node names for rk32885881af8d69
ARM: dts: rockchip: Fix power-controller node names for rk318870abb82831
ARM: dts: rockchip: Fix power-controller node names for rk3066afc01549d7b
ARM: dts: rockchip: Fix IOMMU nodes properties on rk322x55014c38e7
ARM: dts: rockchip: Fix the timer clocks order2e1f681b68
arm64: dts: rockchip: fix pinctrl sleep nodename for rk3399.dtsi7d3408c723
ARM: dts: rockchip: fix pinctrl sleep nodename for rk3036-kylin and rk3288e2d1e44161
ARM: dts: rockchip: Fix thermal sensor cells o rk322xc8f0cef75d
ARM: dts: gemini: add device_type on pci191523dcfa
ARM: dts: gemini: rename mdio to the right name90a010f605
Merge branch 'android12-5.10' into `android12-5.10-lts`c0dd8de281
Merge branch 'android12-5.10' into `android12-5.10-lts`51ab149d5f
Merge 5.10.52 into android12-5.10-lts2cd5fe24a7
Linux 5.10.52174c34d9cd
seq_file: disallow extremely large seq buffer allocationsb33aa0dbd7
scsi: scsi_dh_alua: Fix signedness bug in alua_rtpg()e09c9b5584
MIPS: vdso: Invalid GIC access through VDSO20f79ce2b1
mips: disable branch profiling in boot/decompress.o4e2764e96a
mips: always link byteswap helpers into decompressor53c5c2496f
static_call: Fix static_call_text_reserved() vs __init59ae35884c
jump_label: Fix jump_label_text_reserved() vs __init143a6b8ec5
sched/uclamp: Ignore max aggregation if rq is idle43b89ef7bc
scsi: be2iscsi: Fix an error handling path in beiscsi_dev_probe()f71f13034f
arm64: dts: rockchip: Re-add regulator-always-on for vcc_sdio for rk3399-roc-pcb3231050c7
arm64: dts: rockchip: Re-add regulator-boot-on, regulator-always-on for vdd_gpu on rk3399-roc-pc9436e9001d
firmware: turris-mox-rwtm: show message about HWRNG registrationb2a5949a91
firmware: turris-mox-rwtm: fail probing when firmware does not support hwrngddf380b094
firmware: turris-mox-rwtm: report failures better271c12dbeb
firmware: turris-mox-rwtm: fix reply status decoding function804aabb509
thermal/drivers/rcar_gen3_thermal: Fix coefficient calculationsdae7775232
ARM: dts: imx6q-dhcom: Add gpios pinctrl for i2c bus recovery936446f15a
ARM: dts: imx6q-dhcom: Fix ethernet plugin detection problemsf12a456f1c
ARM: dts: imx6q-dhcom: Fix ethernet reset time propertiesb1995806d0
thermal/drivers/sprd: Add missing MODULE_DEVICE_TABLE4d9ea28586
ARM: dts: am437x: align ti,pindir-d0-out-d1-in property with dt-shema6641724d68
ARM: dts: am335x: align ti,pindir-d0-out-d1-in property with dt-shema0724764c08
ARM: dts: dra7: Fix duplicate USB4 target module node6cd58375c5
arm64: dts: allwinner: a64-sopine-baseboard: change RGMII mode to TXIDb5789e2377
memory: fsl_ifc: fix leak of private memory on probe failure8d071d270a
memory: fsl_ifc: fix leak of IO mapping on probe failure1479998d80
arm64: dts: ti: k3-j721e-main: Fix external refclk input to SERDES668ca46870
arm64: dts: renesas: r8a779a0: Drop power-domains property from GIC node884d09d1f1
reset: bail if try_module_get() fails8c07e1a8c5
ARM: dts: BCM5301X: Fixup SPI bindingdb4e87ab60
dt-bindings: i2c: at91: fix example for scl-gpios4b4c61049e
firmware: arm_scmi: Reset Rx buffer to max size during async commandsc381e695cf
firmware: tegra: Fix error return code in tegra210_bpmp_init()f58a3bc94a
arm64: dts: qcom: trogdor: Add no-hpd to DSI bridge noded99524d13d
ARM: dts: stm32: Rework LAN8710Ai PHY reset on DHCOM SoM91df7f4a04
ARM: dts: stm32: Connect PHY IRQ line on DH STM32MP1 SoMc4218acd68
arm64: dts: renesas: r8a7796[01]: Fix OPP table entry voltages305df11389
arm64: dts: renesas: Add missing opp-suspend properties55fd1d3ca5
arm64: dts: ti: j7200-main: Enable USB2 PHY RX sensitivity workaroundb8d350b4ac
ARM: dts: r8a7779, marzen: Fix DU clock namesb02a65061e
arm64: dts: renesas: v3msk: Fix memory sizeab4d76eb77
rtc: fix snprintf() checking in is_rtc_hctosys()e352463654
ARM: dts: sun8i: h3: orangepi-plus: Fix ethernet phy-mode3199ff7b9f
memory: pl353: Fix error return code in pl353_smc_probe()fc7a8347ce
reset: brcmstb: Add missing MODULE_DEVICE_TABLE3f526ea670
memory: atmel-ebi: add missing of_node_put for loop iteration84fa4a1063
memory: stm32-fmc2-ebi: add missing of_node_put for loop iterationc385d93c3c
ARM: dts: exynos: fix PWM LED max brightness on Odroid XU4b7016870fe
ARM: dts: exynos: fix PWM LED max brightness on Odroid HC1640105e7c0
ARM: dts: exynos: fix PWM LED max brightness on Odroid XU/XU36870bc4267
ARM: exynos: add missing of_node_put for loop iteration85dd41383b
reset: a10sr: add missing of_match_table reference685ec4c0f2
reset: RESET_INTEL_GW should depend on X862ca912471d
reset: RESET_BRCMSTB_RESCAL should depend on ARCH_BRCMSTBf75cec5c20
ARM: dts: gemini-rut1xx: remove duplicate ethernet nodef11508ecc6
hexagon: use common DISCARDS macrof712169279
hexagon: handle {,SOFT}IRQENTRY_TEXT in linker script4aa17d058a
NFSv4/pNFS: Don't call _nfs4_pnfs_v3_ds_connect multiple times885c0cc2ac
NFSv4/pnfs: Fix layoutget behaviour after invalidationa668a77e6a
NFSv4/pnfs: Fix the layout barrier update6ccccc03f8
vdpa/mlx5: Clear vq ready indication upon device reset0e5f204ea5
ALSA: isa: Fix error return code in snd_cmi8330_probe()6612c41233
nfsd: Reduce contention for the nfsd_file nf_rwsem89047f0089
nvme-tcp: can't set sk_user_data without write_lock4b3fd33f58
virtio_net: move tx vq operation under tx queue lock8795692f0d
vdpa/mlx5: Fix possible failure in umem size calculation63272b1ffd
vdpa/mlx5: Fix umem sizes assignments on VQ createe22051e7c9
PCI: tegra194: Fix tegra_pcie_ep_raise_msi_irq() ill-defined shift527bb29eb1
pwm: imx1: Don't disable clocks at device remove time12d84de59d
PCI: intel-gw: Fix INTx enableb5859dacd2
x86/fpu: Limit xstate copy size in xstateregs_set()07b760a791
x86/fpu: Fix copy_xstate_to_kernel() gap handlingaa7fccd383
f2fs: fix to avoid adding tab before doc section607caa0801
PCI: iproc: Support multi-MSI only on uniprocessor kernel54dc6fcce3
PCI: iproc: Fix multi-MSI base vector number allocationac2e498ab2
ubifs: Set/Clear I_LINKABLE under i_lock for whiteout inode4b515308ab
nfs: fix acl memory leak of posix_acl_create()b8eace7d3b
SUNRPC: prevent port reuse on transports which don't request it.5577eece79
watchdog: jz4740: Fix return value check in jz4740_wdt_probe()3b93d520ac
watchdog: aspeed: fix hardware timeout calculation412ef737be
ubifs: journal: Fix error return code in ubifs_jnl_write_inode()6bcc0590cb
ubifs: Fix off-by-one erroraab881d7f0
um: fix error return code in winch_tramp()9bb3f31b25
um: fix error return code in slip_open()0bfb6d4949
misc: alcor_pci: fix inverted branch condition5c7ef8a370
NFSv4: Fix an Oops in pnfs_mark_request_commit() when doing O_DIRECTff4023d019
NFSv4: Initialise connection to the server in nfs4_alloc_client()36291fd627
power: supply: rt5033_battery: Fix device tree enumerationae56850d36
PCI/sysfs: Fix dsm_label_utf16s_to_utf8s() buffer overrun6594d0aa1c
remoteproc: k3-r5: Fix an error messaged3c150978e
f2fs: compress: fix to disallow temp extension43cefd1264
f2fs: add MODULE_SOFTDEP to ensure crc32 is included in the initramfs74569cb9ed
x86/signal: Detect and prevent an alternate signal stack overflowf0e905df68
NFSD: Fix TP_printk() format specifier in nfsd_clid_class2830dd2faa
f2fs: atgc: fix to set default age thresholdf6ec306b93
virtio_console: Assure used length from device is limited09a94a89d7
virtio_net: Fix error handling in virtnet_restore()cd24da0db9
virtio-blk: Fix memory leak among suspend/resume procedured420b11666
PCI: rockchip: Register IRQ handlers after device and data are ready424fc30298
ACPI: video: Add quirk for the Dell Vostro 33504f2b140658
ACPI: AMBA: Fix resource name in /proc/iomem9dcc9ad343
pwm: tegra: Don't modify HW state in .remove callback3d82361abd
pwm: img: Fix PM reference leak in img_pwm_enable()b3205768cd
drm/amdkfd: fix sysfs kobj leak687875fa9c
power: supply: ab8500: add missing MODULE_DEVICE_TABLEe88d524c66
power: supply: charger-manager: add missing MODULE_DEVICE_TABLE89786fbc4d
NFS: nfs_find_open_context() may only select open files0fedfa72ae
drm/gma500: Add the missed drm_gem_object_put() in psb_user_framebuffer_create()59d912fe9b
ceph: remove bogus checks and WARN_ONs from ceph_set_page_dirty3c586f8255
orangefs: fix orangefs df output.6e43cdcbb7
PCI: tegra: Add missing MODULE_DEVICE_TABLE2df1abffc4
remoteproc: core: Fix cdev remove and rproc delf3a56cd3ea
x86/fpu: Return proper error codes from user access functions39ed17de8c
watchdog: iTCO_wdt: Account for rebooting on second timeout9cc9f5de28
watchdog: imx_sc_wdt: fix pretimeout66ba9cf929
watchdog: Fix possible use-after-free by calling del_timer_sync()a173e3b62c
watchdog: sc520_wdt: Fix possible use-after-free in wdt_turnoff()a397cb4576
watchdog: Fix possible use-after-free in wdt_startup()96c0bf0912
PCI: pciehp: Ignore Link Down/Up caused by DPC4970647404
NFSv4: Fix delegation return in cases where we have to retryb05c555c8d
PCI/P2PDMA: Avoid pci_get_slot(), which may sleep8e3f27bb7f
ARM: 9087/1: kprobes: test-thumb: fix for LLVM_IAS=19d829ca43b
power: reset: gpio-poweroff: add missing MODULE_DEVICE_TABLEefc6443c1a
power: supply: max17042: Do not enforce (incorrect) interrupt trigger type7667cdc4b7
PCI: hv: Fix a race condition when removing the device14016c1728
power: supply: ab8500: Avoid NULL pointers0df49cdc7c
PCI: ftpci100: Rename macro name collisione133435232
pwm: spear: Don't modify HW state in .remove callback15a19c5a92
power: supply: sc2731_charger: Add missing MODULE_DEVICE_TABLEd7897890ba
power: supply: sc27xx: Add missing MODULE_DEVICE_TABLE6ed9f9899b
kcov: add __no_sanitize_coverage to fix noinstr for all architecturesff53dfb323
lib/decompress_unlz4.c: correctly handle zero-padding around initrds.b85b43c3e4
phy: intel: Fix for warnings due to EMMC clock 175Mhz change in FIPa9d986be49
i2c: core: Disable client irq on reboot/shutdown9c6c657047
intel_th: Wait until port is in reset before programming it45f1de1fff
staging: rtl8723bs: fix macro value for 2.4Ghz only device1f577093c8
leds: turris-omnia: add missing MODULE_DEVICE_TABLEff8f11860e
ALSA: firewire-motu: fix detection for S/PDIF source on optical interface in v2 protocol9ada4baae6
ALSA: usb-audio: scarlett2: Fix 6i6 Gen 2 line out descriptionsfb7c8bfa2e
ALSA: hda: Add IRQ check for platform_get_irq()63c49cfa2f
backlight: lm3630a: Fix return code of .update_status() callback719c45a41c
ASoC: Intel: kbl_da7219_max98357a: shrink platform_id below 20 characters692e16958f
powerpc/boot: Fixup device-tree on little endianb41cb0e4af
usb: gadget: hid: fix error return code in hid_bind()309b44d316
usb: gadget: f_hid: fix endianness issue with descriptors16668cc656
ALSA: usb-audio: scarlett2: Fix scarlett2_*_ctl_put() return values3005d48b40
ALSA: usb-audio: scarlett2: Fix data_mutex lock8f075c61ea
ALSA: usb-audio: scarlett2: Fix 18i8 Gen 2 PCM Input count3b7bd795cb
ALSA: bebob: add support for ToneWeal FW6690cd79aa9a
Input: hideep - fix the uninitialized use in hideep_nvm_unlock()a50b56ffc0
s390/mem_detect: fix tprot() program check new psw handling7e1e0235b3
s390/mem_detect: fix diag260() program check new psw handlingc25be19aa9
s390/ipl_parm: fix program check new psw handling3794633dfd
s390/processor: always inline stap() and __load_psw_mask()f22649cf90
habanalabs: remove node from list before freeing the node25ddb0a42f
habanalabs/gaudi: set the correct cpu_id on MME2_QM failure3dd2a9daa7
ASoC: soc-core: Fix the error return code in snd_soc_of_parse_audio_routing()8e18158ea7
powerpc/mm/book3s64: Fix possible build errored0b4b56a9
gpio: pca953x: Add support for the On Semi pca9655b7f4423c7d
selftests/powerpc: Fix "no_handler" EBB selftestc7f2112e7a
ALSA: ppc: fix error return code in snd_pmac_probe()1004c52e3c
scsi: storvsc: Correctly handle multiple flags in srb_statusb3d3a2466e
gpio: zynq: Check return value of irq_get_irq_data3d2b0818da
gpio: zynq: Check return value of pm_runtime_get_sync71f8d7fbfe
ASoC: soc-pcm: fix the return value in dpcm_apply_symmetry()43d1aaa196
iommu/arm-smmu: Fix arm_smmu_device refcount leak in address translationc4007596fb
iommu/arm-smmu: Fix arm_smmu_device refcount leak when arm_smmu_rpm_get failsf8763ab3fb
powerpc/ps3: Add dma_mask to ps3_dma_region0e54f8ee6b
ALSA: sb: Fix potential double-free of CSP mixer elements52d242f2bf
selftests: timers: rtcpie: skip test if default RTC device does not exist7b18f26d82
s390: disable SSP when needed78cddc9aa6
s390/sclp_vt220: fix console name to match device2f4e7363a9
serial: tty: uartlite: fix console setupdc9db46292
fsi: Add missing MODULE_DEVICE_TABLE0c67c2e203
ASoC: img: Fix PM reference leak in img_i2s_in_probe()af8b891cd3
mfd: cpcap: Fix cpcap dmamask not set warningsd339f6a0d1
mfd: da9052/stmpe: Add and modify MODULE_DEVICE_TABLE5dd2955565
scsi: qedi: Fix cleanup session block/unblock use6f36afa155
scsi: qedi: Fix TMF session block/unblock use57fa983ea7
scsi: qedi: Fix race during abort timeoutsafa1c8ee7e
scsi: qedi: Fix null ref during abort handlingfa7adae4b5
scsi: iscsi: Fix shost->max_id use89812e7957
scsi: iscsi: Fix conn use after free during resets21962a5dd6
scsi: iscsi: Add iscsi_cls_conn refcount helpers5ac2428f2b
scsi: megaraid_sas: Handle missing interrupts while re-enabling IRQs422fb12054
scsi: megaraid_sas: Early detection of VD deletion through RaidMap update0680db6f41
scsi: megaraid_sas: Fix resource leak in case of probe failurec851de0215
fs/jfs: Fix missing error code in lmLogInit()7207cd708e
scsi: scsi_dh_alua: Check for negative result value6bad74b2b4
scsi: core: Fixup calling convention for scsi_mode_sense()b4fd2ab0a9
scsi: mpt3sas: Fix deadlock while cancelling the running firmware event7a80f71601
tty: serial: 8250: serial_cs: Fix a memory leak in error handling path75452cc776
ALSA: ac97: fix PM reference leak in ac97_bus_remove()664695a754
scsi: core: Cap scsi_host cmd_per_lun at can_queue21d8b90cec
scsi: lpfc: Fix crash when lpfc_sli4_hba_setup() fails to initialize the SGLs2626d5ed6b
scsi: lpfc: Fix "Unexpected timeout" error in direct attach topologybb1d1c2149
scsi: hisi_sas: Propagate errors in interrupt_init_v1_hw()0245504090
scsi: arcmsr: Fix doorbell status being updated late on ARC-188620c62caf2e
w1: ds2438: fixing bug that would always get page08e8d910e9a
usb: common: usb-conn-gpio: fix NULL pointer dereference of chargerb30a115e4a
Revert "ALSA: bebob/oxfw: fix Kconfig entry for Mackie d.2 Pro"7d7f30cf18
ALSA: usx2y: Don't call free_pages_exact() with NULL addressf4997bf6c4
ALSA: usx2y: Avoid camelCase1b1d6aa1a8
iio: magn: bmc150: Balance runtime pm + use pm_runtime_resume_and_get()5ecb0acc45
iio: gyro: fxa21002c: Balance runtime pm + use pm_runtime_resume_and_get().5f69841c22
partitions: msdos: fix one-byte get_unaligned()a8c3d1a515
ASoC: intel/boards: add missing MODULE_DEVICE_TABLE58f69684ba
misc: alcor_pci: fix null-ptr-deref when there is no PCI bridgeb9c87ce3bc
misc/libmasm/module: Fix two use after free in ibmasm_init_one4f3c807739
serial: fsl_lpuart: disable DMA for console and fix sysrq6942fbc009
tty: serial: fsl_lpuart: fix the potential risk of division or modulo by zero35a35909ec
rcu: Reject RCU_LOCKDEP_WARN() false positives23597afbe0
srcu: Fix broken node geometry after early ssp init4d395142d9
scsi: arcmsr: Fix the wrong CDB payload report to IOP22d22fef9c
dmaengine: fsl-qdma: check dma_set_mask return value3206433070
ASoC: Intel: sof_sdw: add mutual exclusion between PCH DMIC and RT715164a3880a7
leds: tlc591xx: fix return value check in tlc591xx_probe()9ebcc60565
net: bridge: multicast: fix MRD advertisement router port marking race664cc645bd
net: bridge: multicast: fix PIM hello router port marking raceb3aea76efe
Revert "drm/ast: Remove reference to struct drm_device.pdev"b3f8120039
drm/ingenic: Switch IPU plane to type OVERLAY8f6dcc4dd7
drm/ingenic: Fix non-OSD modecae871baa4
drm/dp_mst: Add missing drm parameters to recently added call to drm_dbg_kms()16fb4e9c39
drm/dp_mst: Avoid to mess up payload table by ports in stale topology3462bc8b1a
drm/dp_mst: Do not set proposed vcpi directly087bff9acd
fbmem: Do not delete the mode that is still in use811763e3be
cgroup: verify that source is a string0728df8048
drm/i915/gt: Fix -EDEADLK handling regression81dd2d60f6
drm/i915/gtt: drop the page table optimisation905169794d
tracing: Do not reference char * as a string in histogramse1261c7a84
scsi: zfcp: Report port fc_security as unknown early during remote cable pullea518b70ed
scsi: core: Fix bad pointer dereference when ehandler kthread is invalid8b2ae2de53
KVM: X86: Disable hardware breakpoints unconditionally before kvm_x86->run()bedc5d0911
KVM: nSVM: Check the value written to MSR_VM_HSAVE_PA5b779e597c
KVM: x86/mmu: Do not apply HPA (memory encryption) mask to GPAs1a1a5e4409
KVM: x86: Use guest MAXPHYADDR from CPUID.0x8000_0008 iff TDP is enabled679837dc0a
KVM: mmio: Fix use-after-free Read in kvm_vm_ioctl_unregister_coalesced_mmio72797ffca1
cifs: handle reconnect of tcon when there is no cached dfs referralb93f949942
certs: add 'x509_revocation_list' to gitignoreff7ea0d0e9
Revert "media: subdev: disallow ioctl for saa6588/davinci"8db62be3c3
Merge 5.10.51 into android12-5.10-ltsf682613465
Linux 5.10.518678660301
f2fs: fix to avoid racing on fsync_entry_slab by multi filesystem instances5e4f5138bd
ext4: fix memory leak in ext4_fill_super3780348c1a
smackfs: restrict bytes count in smk_set_cipso()8018936950
jfs: fix GPF in diFreefcb041ca5c
drm/ast: Remove reference to struct drm_device.pdev3785f3c1e3
pinctrl: mcp23s08: Fix missing unlock on error in mcp23s08_irq()b716ccffbc
dm writecache: write at least 4k when committing090588059c
io_uring: fix clear IORING_SETUP_R_DISABLED in wrong functionaa57b2d6b3
media: uvcvideo: Fix pixel format change for Elgato Cam Link 4K31874b6b63
media: gspca/sunplus: fix zero-length control requestsde95c0bd79
media: gspca/sq905: fix control-request directionc57bfd8000
media: zr364xx: fix memory leak in zr364xx_start_readpipedbd58d3978
media: dtv5100: fix control-request directionsdb317a3722
media: subdev: disallow ioctl for saa6588/davincie2c1218ddc
PCI: aardvark: Implement workaround for the readback value of VEND_ID1309197089
PCI: aardvark: Fix checking for PIO Non-posted Requestf147115018
PCI: Leave Apple Thunderbolt controllers on for s2idle or standbyba47e65a5d
dm btree remove: assign new_root only when removal succeeds1b5918b087
dm writecache: flush origin device when writing and cache is fullcbc03ffec2
dm zoned: check zone capacity35c1c4bd2d
coresight: tmc-etf: Fix global-out-of-bounds in tmc_update_etf_buffer()048624ad56
coresight: Propagate symlink failure0c2bc14891
ipack/carriers/tpci200: Fix a double free in tpci200_pci_probeeb81b5a37d
tracing: Resize tgid_map to pid_max, not PID_MAX_DEFAULT3cda5b7f4e
tracing: Simplify & fix saved_tgids logic8cc58a6e2c
rq-qos: fix missed wake-ups in rq_qos_throttle try twof9fb4986f4
seq_buf: Fix overflow in seq_buf_putmem_hex()418b333afb
extcon: intel-mrfld: Sync hardware and software state on initaf092ec16e
selftests/lkdtm: Fix expected text for CR4 pinning0af643fa7e
lkdtm/bugs: XFAIL UNALIGNED_LOAD_STORE_WRITEbaedb1f5a0
nvmem: core: add a missing of_node_putf0a079c0ba
mfd: syscon: Free the allocated name field of struct regmap_configa8a2e506ea
power: supply: ab8500: Fix an old bug38dde03eb2
ubifs: Fix races between xattr_{set|get} and listxattr operations690a11fb4e
thermal/drivers/int340x/processor_thermal: Fix tcc settingef5066f95c
ipmi/watchdog: Stop watchdog timer when the current action is 'none'7ade84f8df
qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute02671eda9a
i40e: fix PTP on 5Gb linksab9d7c5fc9
ASoC: tegra: Set driver_name=tegra for all machine driverse0d9beb44a
fpga: stratix10-soc: Add missing fpga_mgr_free() call5a5ebf5d48
clocksource/arm_arch_timer: Improve Allwinner A64 timer workaroundb5e26be407
cpu/hotplug: Cure the cpusets trainwrecka11a457820
arm64: tlb: fix the TTL value of tlb_get_level0afa6ad0c4
ata: ahci_sunxi: Disable DIPM5543f61e2e
mmc: core: Allow UHS-I voltage switch for SDSC cards if supportedb53b0ca4a4
mmc: core: clear flags before allowing to retune658f58189a
mmc: sdhci: Fix warning message when accessing RPMB in HS400 mode5ced01c0e8
mmc: sdhci-acpi: Disable write protect detection on Toshiba Encore 2 WT8-B3f9c2a058e
drm/i915/display: Do not zero past infoframes.vsc8abf5eec0e
drm/nouveau: Don't set allow_fb_modifiers explicitly42a333ea4b
drm/arm/malidp: Always list modifiers0bcc074f90
drm/msm/mdp4: Fix modifier support enabling4d61ddd740
drm/tegra: Don't set allow_fb_modifiers explicitlyc601693617
drm/amd/display: Reject non-zero src_y and src_x for video planes7d30538894
pinctrl/amd: Add device HID for new AMD GPIO controllerb13574fa83
drm/amd/display: fix incorrrect valid irq check3c8216b350
drm/rockchip: dsi: remove extra component_del() call2998599fb1
drm/dp: Handle zeroed port counts in drm_dp_read_downstream_info()98bd09d928
drm/vc4: hdmi: Prevent clock unbalancea2b8835cb4
drm/vc4: crtc: Skip the TXP293e520d20
drm/vc4: txp: Properly set the possible_crtcs mask0d50d93d05
drm/radeon: Call radeon_suspend_kms() in radeon_pci_shutdown() for Loongson647aa28f2f67
drm/radeon: Add the missed drm_gem_object_put() in radeon_user_framebuffer_create()2674ffcad0
drm/amdgpu: enable sdma0 tmz for Raven/Renoir(V2)8f933b27cb
drm/amdgpu: Update NV SIMD-per-CU to 297ebbfe445
powerpc/powernv/vas: Release reference to tgid during window closea024e88f8a
powerpc/barrier: Avoid collision with clang's __lwsync macrod2e52d4664
powerpc/mm: Fix lockup on kernel exec fault4ad382bc4a
scsi: iscsi: Fix iSCSI cls conn state221b7e1e76
scsi: iscsi: Fix race condition between login and sync thread9073188835
io_uring: convert io_buffer_idr to XArrayc5a50a220a
io_uring: Convert personality_idr to XArraycb2985feb1
io_uring: simplify io_remove_personalities()7d4f961588
mm,hwpoison: return -EBUSY when migration failsfd6625a1ec
loop: fix I/O error on fsync() in detached loop devices88f0bc830c
arm64: dts: rockchip: Enable USB3 for rk3328 Rock64421aff50af
arm64: dts: rockchip: add rk3328 dwc3 usb controller node8eb12fa96b
ath11k: unlock on error path in ath11k_mac_op_add_interface()9706c53433
MIPS: MT extensions are not available on MIPS32r16cf2e905b1
selftests/resctrl: Fix incorrect parsing of option "-t"10f8fca676
MIPS: set mips32r5 for virt extensionsff4762bcb9
MIPS: loongsoon64: Reserve memory below starting pfn to prevent Oops6ef81a5c0e
sctp: add size validation when walking chunksd4dbef7046
sctp: validate from_addr_param returne83f312114
flow_offload: action should not be NULL when it is referenceda61af01141
bpf: Fix false positive kmemleak report in bpf_ringbuf_area_alloc()20285dc271
sched/fair: Ensure _sum and _avg values stay consistente2296a4365
Bluetooth: btusb: fix bt fiwmare downloading failure issue for qca btsoc.8d7a3989c1
Bluetooth: mgmt: Fix the command returns garbage parameter value05298f1733
Bluetooth: btusb: Add support USB ALT 3 for WBScc49ab24ec
Bluetooth: L2CAP: Fix invalid access on ECRED Connection response79a3130864
Bluetooth: L2CAP: Fix invalid access if ECRED Reconfigure failsc4a9967e4d
Bluetooth: btusb: Add a new QCA_ROME device (0cf3:e500)60789afc02
Bluetooth: Shutdown controller after workqueues are flushed or cancelled5147d86c4a
Bluetooth: Fix alt settings for incoming SCO with transparent coding format8f939b4c25
Bluetooth: Fix the HCI to MGMT status conversion table5f5f8022c1
Bluetooth: btusb: Fixed too many in-token issue for Mediatek Chip.3d08b59179
RDMA/cma: Fix rdma_resolve_route() memory leaka8585fdf42
net: ip: avoid OOM kills with large UDP sends over loopback04177aa99a
media, bpf: Do not copy more entries than user space requestedd8bb134d80
IB/isert: Align target max I/O size to initiator sized330f5f8df
mac80211_hwsim: add concurrent channels scanning support over virtio97f0677226
mac80211: consider per-CPU statistics if present1b728869a1
cfg80211: fix default HE tx bitrate mask in 2G band0a7ba5d373
wireless: wext-spy: Fix out-of-bounds warningc1ad55b6a1
sfc: error code if SRIOV cannot be disabled1013dc896d
sfc: avoid double pci_remove of VFs7cd6986f2d
iwlwifi: pcie: fix context info freeingb98ec6d8b3
iwlwifi: pcie: free IML DMA memory allocation78eadadff3
iwlwifi: mvm: fix error print when session protection ends1e1bb1efd6
iwlwifi: mvm: don't change band on bound PHY contexts1df3603039
RDMA/rxe: Don't overwrite errno from ib_umem_get()ee33c042f4
vsock: notify server to shutdown when client has pending signal38bc2ebf34
atm: nicstar: register the interrupt handler in the right place90efb7f100
atm: nicstar: use 'dma_free_coherent' instead of 'kfree'1d304c7ddd
net: fec: add ndo_select_queue to fix TX bandwidth fluctuationsc7a31ae63e
MIPS: add PMD table accounting into MIPS'pmd_alloc_one50ce920fe1
rtl8xxxu: Fix device info for RTL8192EU devicesa10e871b73
mt76: mt7915: fix IEEE80211_HE_PHY_CAP7_MAX_NC for station mode4cd713e48c
drm/amdkfd: Walk through list with dqm lock holda2122e0792
drm/amdgpu: fix bad address translation for sienna_cichlid932be4cf2b
io_uring: fix false WARN_ONCE92a9fb51e5
net: sched: fix error return code in tcf_del_walker()d2801d1118
net: ipa: Add missing of_node_put() in ipa_firmware_load()5cc0cf735f
net: fix mistake path for netdev_features_strings891db094a0
mt76: mt7615: fix fixed-rate tx status reporting090b06b25a
ice: mark PTYPE 2 as reservedb88a907830
ice: fix incorrect payload indicator on PTYPE2e66c36f13
bpf: Fix up register-based shifts in interpreter to silence KUBSAN0e72b151e3
drm/amdkfd: Fix circular lock in nocpsch pathcd29db48bb
drm/amdkfd: fix circular locking on get_wave_state9d21abc8fd
cw1200: add missing MODULE_DEVICE_TABLEc5e4a10d7b
wl1251: Fix possible buffer overflow in wl1251_cmd_scan5a3d373c4a
wlcore/wl12xx: Fix wl12xx get_mac error if device is in ELPad7083a95d
dm writecache: commit just one block, not a full page57f7ed25bd
xfrm: Fix error reporting in xfrm_state_construct.a5f8862967
drm/amd/display: Verify Gamma & Degamma LUT sizes in amdgpu_dm_atomic_checkdb3c3643d5
r8169: avoid link-up interrupt issue on RTL8106e if user enables ASPMf38371821c
selinux: use __GFP_NOWARN with GFP_NOWAIT in the AVC0a244be95b
fjes: check return value after calling platform_get_resource()378c156f9d
drm/amdkfd: use allowed domain for vmbo validationfb3b4bcdd3
net: sgi: ioc3-eth: check return value after calling platform_get_resource()e613f67f1b
selftests: Clean forgotten resources as part of cleanup()8a4318c14a
net: phy: realtek: add delay to fix RXC generation issuec71de31b2e
drm/amd/display: Fix off-by-one error in DMLafa06442d2
drm/amd/display: Set DISPCLK_MAX_ERRDET_CYCLES to 702f444321b
drm/amd/display: Release MST resources on switch from MST to SST01d6a69319
drm/amd/display: Update scaling settings on modeset57c63b47d6
drm/amd/display: Fix DCN 3.01 DSCCLK validation8e4da40142
net: moxa: Use devm_platform_get_and_ioremap_resource()278dc34b71
net: micrel: check return value after calling platform_get_resource()ce1307ec62
net: mvpp2: check return value after calling platform_get_resource()49b3a7f38a
net: bcmgenet: check return value after calling platform_get_resource()92820a1282
net: mscc: ocelot: check return value after calling platform_get_resource()f3b96f4b6b
virtio_net: Remove BUG() to avoid machine dead87c39048ec
ice: fix clang warning regarding deadcode.DeadStorese352556ace
ice: set the value of global config lock timeout longerb5f2982e06
pinctrl: mcp23s08: fix race condition in irq handlera4a86400c6
net: bridge: mrp: Update ring transitions.cc4f0a9d5a
dm: Fix dm_accept_partial_bio() relative to zone management commands939f750215
dm writecache: don't split bios when overwriting contiguous cache content65e780667c
dm space maps: don't reset space map allocation cursor when committing313d9f2580
RDMA/cxgb4: Fix missing error code in create_qp()f9c67c179e
net: tcp better handling of reordering then loss cases8fa6473a61
drm/amdgpu: remove unsafe optimization to drop preamble ibc5b518f4b9
drm/amd/display: Avoid HDCP over-read and corruption3c172f6e44
MIPS: ingenic: Select CPU_SUPPORTS_CPUFREQ && MIPS_EXTERNAL_TIMER0903ac8f09
MIPS: cpu-probe: Fix FPU detection on Ingenic JZ4760(B)8f939b7957
ipv6: use prandom_u32() for ID generationc92298d228
virtio-net: Add validation for used length5e039a80a7
drm: bridge: cdns-mhdp8546: Fix PM reference leak ind1eaf4cb44
clk: tegra: Ensure that PLLU configuration is applied properlydc5bacea94
clk: tegra: Fix refcounting of gate clocks315988817a
RDMA/rtrs: Change MAX_SESS_QUEUE_DEPTH4f6a0f31c6
net: stmmac: the XPCS obscures a potential "PHY not found" errora7d608bb78
drm: rockchip: add missing registers for RK3066d89ea206e9
drm: rockchip: add missing registers for RK3188e54b4a5348
net/mlx5: Fix lag port remapping logic62137d1ae5
net/mlx5e: IPsec/rep_tc: Fix rep_tc_update_skb drops IPsec packet219150485d
clk: renesas: r8a77995: Add ZA2 clock0680344d71
drm/bridge: cdns: Fix PM reference leak in cdns_dsi_transfer()95f8ce9f18
igb: fix assignment on big endian machines66d593aa3a
igb: handle vlan types with checker enabledffb865715a
e100: handle eeprom as little endianf06ea024c1
drm/vc4: hdmi: Fix PM reference leak in vc4_hdmi_encoder_pre_crtc_co()48c96d5bac
drm/vc4: Fix clock source for VEC PixelValve on BCM271121bf141458
udf: Fix NULL pointer dereference in udf_symlink function0687411e2a
drm/sched: Avoid data corruptions5ed8c298b2
drm/scheduler: Fix hang when sched_entity released73ac001f06
pinctrl: equilibrium: Add missing MODULE_DEVICE_TABLE1b832bd777
net/sched: cls_api: increase max_reclassify_loop6ceb0182b0
net: mdio: provide shim implementation of devm_of_mdiobus_registerd2d17ca924
drm/virtio: Fix double free on probe failure69a71b59b1
reiserfs: add check for invalid 1st journal blockc5073100dc
drm/bridge: lt9611: Add missing MODULE_DEVICE_TABLEb5713dac19
net: mdio: ipq8064: add regmap config to disable REGCACHEc0dd36bcb6
drm/mediatek: Fix PM reference leak in mtk_crtc_ddp_hw_init()3393405257
net: Treat __napi_schedule_irqoff() as __napi_schedule() on PREEMPT_RTa7f7c42e31
atm: nicstar: Fix possible use-after-free in nicstar_cleanup()b7ee9ae1e0
mISDN: fix possible use-after-free in HFC_cleanup()e759ff76eb
atm: iphase: fix possible use-after-free in ia_module_exit()2292d9691c
hugetlb: clear huge pte during flush function on mips platforma74872106e
clk: renesas: rcar-usb2-clock-sel: Fix error handling in .probe()3ca86d44b9
drm/amd/display: fix use_max_lb flag for 420 pixel formats5953b984c3
net: pch_gbe: Use proper accessors to BE data in pch_ptp_match()fb960728f8
drm/bridge: nwl-dsi: Force a full modeset when crtc_state->active is changed to be true796554d3d6
drm/vc4: fix argument ordering in vc4_crtc_get_margins()b025bc07c9
drm/amd/amdgpu/sriov disable all ip hw status by defaultfb7479d64d
drm/amd/display: fix HDCP reset sequence on reinitialized055669e66
drm/ast: Fixed CVE for DP50195c3133bc8
drm/zte: Don't select DRM_KMS_FB_HELPERb60ae0fab5
drm/mxsfb: Don't select DRM_KMS_FB_HELPER1328352dcd
Merge branch 'android12-5.10' into `android12-5.10-lts`a3cd27f5c4
ANDROID: GKI: fix up crc change in ip.h11b396dfd9
Revert "Add a reference to ucounts for each cred"049c7d395d
Revert "cred: add missing return error code when set_cred_ucounts() failed"cf08d2746d
Revert "Bluetooth: Fix Set Extended (Scan Response) Data"2df0fb4a4b
Merge 5.10.50 into android12-5.10-lts43b0742ef4
Linux 5.10.50bdf4d33e83
powerpc/preempt: Don't touch the idle task's preempt_count during hotplug9b07d817f7
iommu/dma: Fix compile warning in 32-bit builds0855952ed4
cred: add missing return error code when set_cred_ucounts() failedce04375e2d
s390: preempt: Fix preempt_count initializatione4a577d617
crypto: qce - fix error return code in qce_skcipher_async_req_handle()fb0c0a04e4
scsi: core: Retry I/O for Notify (Enable Spinup) Required error2b541b6c74
media: exynos4-is: remove a now unused integer2b58f5154a
mmc: vub3000: fix control-request direction39ac3e1945
mmc: block: Disable CMDQ on the ioctl patha75457f630
io_uring: fix blocking inline submissionc98d9318dc
block: return the correct bvec when checking for gaps51c19f4a62
erofs: fix error return code in erofs_read_superblock()97cbddc8a2
tpm: Replace WARN_ONCE() with dev_err_once() in tpm_tis_status()b5a2b5b642
fscrypt: fix derivation of SipHash keys on big endian CPUs089057af71
fscrypt: don't ignore minor_hash when hash is 0b9c3b48559
mailbox: qcom-ipcc: Fix IPCC mbox channel exhaustion2a7c96c2e2
scsi: target: cxgbit: Unmap DMA buffer before calling target_execute_cmd()e2e615e631
scsi: fc: Correct RHBA attributes length5c6956e664
exfat: handle wrong stream entry size in exfat_readdir()b6a41435c8
csky: syscache: Fixup duplicate cache flush3483e1a41c
csky: fix syscache.c fallthrough warning8ff266de89
perf llvm: Return -ENOMEM when asprintf() fails58fa4b36ab
selftests/vm/pkeys: refill shadow register after implicit kernel write1dd18fda3e
selftests/vm/pkeys: handle negative sys_pkey_alloc() return code92125cb883
selftests/vm/pkeys: fix alloc_random_pkey() to make it really, really random456554040e
lib/math/rational.c: fix divide by zero787f4e7a7d
mm/z3fold: use release_z3fold_page_locked() to release locked z3fold page0fe11b79c2
mm/z3fold: fix potential memory leak in z3fold_destroy_pool()555dffa484
include/linux/huge_mm.h: remove extern keywordebd6a295b5
hugetlb: remove prep_compound_huge_page cleanup2e16ad5611
mm/hugetlb: remove redundant check in preparing and destroying gigantic page0da83a815d
mm/hugetlb: use helper huge_page_order and pages_per_huge_page31be4ea35c
mm/huge_memory.c: don't discard hugepage if other processes are mapping itb65597377b
mm/huge_memory.c: add missing read-only THP checking in transparent_hugepage_enabled()aa41f7a2a6
mm/huge_memory.c: remove dedicated macro HPAGE_CACHE_INDEX_MASK9b0b9edea1
mm/pmem: avoid inserting hugepage PTE entry with fsdax if hugepage support is disabled0885ea1d47
vfio/pci: Handle concurrent vma faults363d85bfae
arm64: dts: marvell: armada-37xx: Fix reg for standard variant of UART347af865b6
serial: mvebu-uart: correctly calculate minimal possible baudrate9ad82f0412
serial: mvebu-uart: do not allow changing baudrate when uartclk is not availabledd6d4e92e7
ALSA: firewire-lib: Fix 'amdtp_domain_start()' when no AMDTP_OUT_STREAM stream is found53fa3ba808
powerpc/papr_scm: Make 'perf_stats' invisible if perf-stats unavailable04db493fc7
powerpc/64s: Fix copy-paste data exposure into newly created tasksac08ba518c
powerpc/papr_scm: Properly handle UUID types and APId3358c66ee
powerpc: Offline CPU in stop_this_cpu()9443acbd25
serial: 8250: 8250_omap: Fix possible interrupt storm on K3 SoCse0e3e0b7da
serial: 8250: 8250_omap: Disable RX interrupt after DMA enable786461739a
selftests/ftrace: fix event-no-pid on 1-core machine57e49a0bc4
leds: ktd2692: Fix an error handling path53cb671592
leds: as3645a: Fix error return code in as3645a_parse_node()f3bf888507
ASoC: fsl_spdif: Fix unexpected interrupt after suspend2938ffd568
ASoC: Intel: sof_sdw: add SOF_RT715_DAI_ID_FIX for AlderLake5f2dfce8d8
configfs: fix memleak in configfs_release_bin_filee30e636447
ASoC: atmel-i2s: Fix usage of capture and playback at the same timeaf497961ab
powerpc/powernv: Fix machine check reporting of async store errorsf8d223f80a
extcon: max8997: Add missing modalias stringe16fcc8374
extcon: sm5502: Drop invalid register write in sm5502_reg_data25c7efb387
phy: ti: dm816x: Fix the error handling path in 'dm816x_usb_phy_probe()6398fc0e57
phy: uniphier-pcie: Fix updating phy parametersa4b7c0af61
soundwire: stream: Fix test for DP prepare completeb0be06493e
scsi: mpt3sas: Fix error return value in _scsih_expander_add()f51088868b
habanalabs: Fix an error handling path in 'hl_pci_probe()'c183b55ed7
mtd: rawnand: marvell: add missing clk_disable_unprepare() on error in marvell_nfc_resume()f929d21af7
of: Fix truncation of memory sizes on 32-bit platformsdb45ea8767
ASoC: cs42l42: Correct definition of CS42L42_ADC_PDN_MASK55bb225c08
iio: prox: isl29501: Fix buffer alignment in iio_push_to_buffers_with_timestamp()4973967504
iio: light: vcnl4035: Fix buffer alignment in iio_push_to_buffers_with_timestamp()c850b52e47
serial: 8250: Actually allow UPF_MAGIC_MULTIPLIER baud rates5db39ad3fa
staging: mt7621-dts: fix pci address for PCI memory rangec5cd4b74fd
coresight: core: Fix use of uninitialized pointer58c0621c44
staging: rtl8712: fix memory leak in rtl871x_load_fw_cbbf5d6f6979
staging: rtl8712: fix error handling in r871xu_drv_init7bc3fa5db4
staging: gdm724x: check for overflow in gdm_lte_netif_rx()f937370610
staging: gdm724x: check for buffer overflow in gdm_lte_multi_sdu_pkt()14106b90e1
ASoC: fsl_spdif: Fix error handler with pm_runtime_enable9cf11dca57
iio: light: vcnl4000: Fix buffer alignment in iio_push_to_buffers_with_timestamp()8c85c0f8cb
iio: magn: rm3100: Fix alignment of buffer in iio_push_to_buffers_with_timestamp()c923e9effe
iio: adc: ti-ads8688: Fix alignment of buffer in iio_push_to_buffers_with_timestamp()15634d6dce
iio: adc: mxs-lradc: Fix buffer alignment in iio_push_to_buffers_with_timestamp()a6a1e347c7
iio: adc: hx711: Fix buffer alignment in iio_push_to_buffers_with_timestamp()2abfdd6132
iio: adc: at91-sama5d2: Fix buffer alignment in iio_push_to_buffers_with_timestamp()2abfa52947
thunderbolt: Bond lanes only when dual_link_port != NULL in alloc_dev_default()36f60700f9
eeprom: idt_89hpesx: Restore printing the unsupported fwnode namefc8ab06001
eeprom: idt_89hpesx: Put fwnode in matching case during ->probe()c7188d1998
usb: dwc2: Don't reset the core after setting turnaround time8aa1cb46b7
usb: gadget: f_fs: Fix setting of device and driver data cross-referencesd4d3cd4c76
ASoC: mediatek: mtk-btcvsd: Fix an error handling path in 'mtk_btcvsd_snd_probe()'92a30a90d6
ASoC: rt5682-sdw: set regcache_cache_only false before reading RT5682_DEVICE_ID696cfb2567
ASoC: rt5682: fix getting the wrong device id when the suspend_stress_test8ef111db5e
ASoC: rt715-sdw: use first_hw_init flag on resume36dc6957f7
ASoC: rt711-sdw: use first_hw_init flag on resumede77f9d92c
ASoC: rt700-sdw: use first_hw_init flag on resumee1456cba8e
ASoC: rt5682-sdw: use first_hw_init flag on resume16674ae3b2
ASoC: rt1308-sdw: use first_hw_init flag on resumedc15216412
ASoC: max98373-sdw: use first_hw_init flag on resume45a3d00eaf
iommu/dma: Fix IOVA reserve dma rangesad73683815
selftests: splice: Adjust for handler fallback removal045c29902f
s390: appldata depends on PROC_SYSCTL485b1c02b5
s390: enable HAVE_IOREMAP_PROTd65f69deac
s390/irq: select HAVE_IRQ_EXIT_ON_IRQ_STACKd8fe62cb91
iommu/amd: Fix extended features loggingbd95a3e159
visorbus: fix error return code in visorchipset_init()e5a3a3108f
fsi/sbefifo: Fix reset timeout4a95eb0c80
fsi/sbefifo: Clean up correct FIFO when receiving reset request from SBE719c4db394
fsi: occ: Don't accept response from un-initialized OCCaf3d7f9e26
fsi: scom: Reset the FSI2PIB engine for any error446eed9c85
fsi: core: Fix return of error values on failuresd22bef4101
mfd: rn5t618: Fix IRQ trigger by changing it to level mode9b8bfdbc7e
mfd: mp2629: Select MFD_CORE to fix build error68f2f83f6f
scsi: iscsi: Flush block work before unblockb5371faa06
scsi: FlashPoint: Rename si_flags field0b2f741113
leds: lp50xx: Put fwnode in error case during ->probe()5f7bda9ba8
leds: lm3697: Don't spam logs when probe is deferred8fc7d4a3f0
leds: lm3692x: Put fwnode in any case during ->probe()c54ad49e2f
leds: lm36274: Put fwnode in error case during ->probe()1ed9133171
leds: lm3532: select regmap I2C APIb504e279e5
leds: class: The -ENOTSUPP should never be seen by user space58279b341b
tty: nozomi: Fix the error handling path of 'nozomi_card_init()'28c947b072
firmware: stratix10-svc: Fix a resource leak in an error handling path1e1b9cd400
char: pcmcia: error out if 'num_bytes_read' is greater than 4 in set_protocol()5a766253e3
staging: mmal-vchiq: Fix incorrect static vchiq_instance.cf05986cc4
mtd: rawnand: arasan: Ensure proper configuration for the asserted target2f8824f556
mtd: partitions: redboot: seek fis-index-block in the right nodea16eae11f0
perf scripting python: Fix tuple_set_u64()201b975c16
Input: hil_kbd - fix error return code in hil_dev_connect()000c70680d
ASoC: rsnd: tidyup loop on rsnd_adg_clk_query()2e1d76c3b9
backlight: lm3630a_bl: Put fwnode in error case during ->probe()d4ebf352a7
ASoC: hisilicon: fix missing clk_disable_unprepare() on error in hi6210_i2s_startup()2541d78f78
ASoC: rk3328: fix missing clk_disable_unprepare() on error in rk3328_platform_probe()246b4f1e20
iio: potentiostat: lmp91000: Fix alignment of buffer in iio_push_to_buffers_with_timestamp()71dbba0b95
iio: cros_ec_sensors: Fix alignment of buffer in iio_push_to_buffers_with_timestamp()1fa3107759
iio: chemical: atlas: Fix buffer alignment in iio_push_to_buffers_with_timestamp()93a5538d50
iio: light: tcs3472: Fix buffer alignment in iio_push_to_buffers_with_timestamp()daecb8c0a1
iio: light: tcs3414: Fix buffer alignment in iio_push_to_buffers_with_timestamp()293b8246a0
iio: light: isl29125: Fix buffer alignment in iio_push_to_buffers_with_timestamp()f960139a3c
iio: magn: bmc150: Fix buffer alignment in iio_push_to_buffers_with_timestamp()e5e102f4b5
iio: magn: hmc5843: Fix buffer alignment in iio_push_to_buffers_with_timestamp()4613232e0b
iio: prox: as3935: Fix buffer alignment in iio_push_to_buffers_with_timestamp()ab16be53b2
iio: prox: pulsed-light: Fix buffer alignment in iio_push_to_buffers_with_timestamp()8e23dd6236
iio: prox: srf08: Fix buffer alignment in iio_push_to_buffers_with_timestamp()c61ac1f83b
iio: humidity: am2315: Fix buffer alignment in iio_push_to_buffers_with_timestamp()8ea878287c
iio: gyro: bmg160: Fix buffer alignment in iio_push_to_buffers_with_timestamp()718a67a909
iio: adc: vf610: Fix buffer alignment in iio_push_to_buffers_with_timestamp()df5343bd59
iio: adc: ti-ads1015: Fix buffer alignment in iio_push_to_buffers_with_timestamp()f0bc78df4a
iio: accel: stk8ba50: Fix buffer alignment in iio_push_to_buffers_with_timestamp()cd62282a51
iio: accel: stk8312: Fix buffer alignment in iio_push_to_buffers_with_timestamp()638ba5aa15
iio: accel: mxc4005: Fix overread of data and alignment issue.0d220d40b3
iio: accel: kxcjk-1013: Fix buffer alignment in iio_push_to_buffers_with_timestamp()9eb5fb66b6
iio: accel: hid: Fix buffer alignment in iio_push_to_buffers_with_timestamp()4b362443dc
iio: accel: bma220: Fix buffer alignment in iio_push_to_buffers_with_timestamp()3cca4db5f7
iio: accel: bma180: Fix buffer alignment in iio_push_to_buffers_with_timestamp()2edfba8a55
iio: adis16475: do not return ints in irq handlers92efd6396e
iio: adis16400: do not return ints in irq handlers2e41116e6e
iio: adis_buffer: do not return ints in irq handlers67d88b7bf6
mwifiex: re-fix for unaligned accesses460bee9009
tty: nozomi: Fix a resource leak in an error handling functionf5186bd17f
serial: 8250_omap: fix a timeout loop condition5dcff72fe4
serial: fsl_lpuart: remove RTSCTS handling from get_mctrl()685d53abc9
serial: fsl_lpuart: don't modify arbitrary data on lpuart32728f23e53c
rcu: Invoke rcu_spawn_core_kthreads() from rcu_spawn_gp_kthread()66111dfe22
ASoC: rt5682: Disable irq on shutdown8b195380cd
staging: fbtft: Don't spam logs when probe is deferred7a42f3c30d
staging: fbtft: Rectify GPIO handlingd8c1504cf1
MIPS: Fix PKMAP with 32-bit MIPS huge page supporta23ba98e91
RDMA/core: Always release restrack objecta938d4e8c6
RDMA/mlx5: Don't access NULL-cleared mpi pointerc6965316d6
net: tipc: fix FB_MTU eat two pages1148952dc6
net: sched: fix warning in tcindex_alloc_perfect_hash4476568069
net: lwtunnel: handle MTU calculation in forwading6939c39a41
writeback: fix obtain a reference to a freeing memcg css4c3e839bfd
clk: si5341: Update initialization magic55aaba36d7
clk: si5341: Check for input clock presence and PLL lock on startup42ac32d834
clk: si5341: Avoid divide errors due to bogus register contents043637617d
clk: si5341: Wait for DEVICE_READY on startup29746bd0f7
clk: qcom: clk-alpha-pll: fix CAL_L write in alpha_pll_fabia_prepare94221679ee
clk: actions: Fix AHPPREDIV-H-AHB clock chain on Owl S500 SoCf3b6df5dfd
clk: actions: Fix bisp_factor_table based clocks on Owl S500 SoCced193bc08
clk: actions: Fix SD clocks factor table on Owl S500 SoC12d2d6fd11
clk: actions: Fix UART clock dividers on Owl S500 SoC7d97522e6e
Bluetooth: Fix handling of HCI_LE_Advertising_Set_Terminated event4f5fc3be2c
Bluetooth: Fix Set Extended (Scan Response) Datac5fedfcc20
Bluetooth: Fix not sending Set Extended Scan Responsea2dcad039e
Bluetooth: mgmt: Fix slab-out-of-bounds in tlv_data_is_validd28e780431
Revert "be2net: disable bh with spin_lock in be_process_mcc"342b06b600
gve: Fix swapped vars when fetching max queues11044f8c2c
RDMA/cma: Fix incorrect Packet Lifetime calculationfc2ea819b9
bpfilter: Specify the log level for the kmsg message4228c00e14
net: dsa: sja1105: fix NULL pointer dereference in sja1105_reload_cbs()393d48b3de
e1000e: Check the PCIm statecebff3d9f7
ipv6: fix out-of-bound access in ip6_parse_tlv()9e753c47b9
net: atlantic: fix the macsec key length1c95d4d432
net: phy: mscc: fix macsec key length711a28d24d
net: macsec: fix the length used to copy the key for offloadingc764f2d899
RDMA/cma: Protect RMW with qp_mutexd52ceed845
ibmvnic: free tx_pool if tso_pool alloc failsf25accc4fd
ibmvnic: set ltb->buff to NULL after freeing3f85d2ca32
Revert "ibmvnic: remove duplicate napi_schedule call in open function"cad22e48ca
i40e: Fix missing rtnl locking when setting up pf switchd9a5d19706
i40e: Fix autoneg disabling for non-10GBaseT links88819239e9
i40e: Fix error handling in i40e_vsi_openaefa927744
bpf: Do not change gso_size during bpf_skb_change_proto()0dac8b0ad0
can: j1939: j1939_sk_setsockopt(): prevent allocation of j1939 filter for optlen == 02d58a38275
ipv6: exthdrs: do not blindly use init_netb559d003f0
net: bcmgenet: Fix attaching to PYH failed on RPi 4B514c96bf65
mac80211: remove iwlwifi specific workaround NDPs of null_response1b3985aa53
drm/msm/dpu: Fix error return code in dpu_mdss_init()134a561aee
drm/msm: Fix error return code in msm_drm_init()f97b9c4c07
bpf: Fix null ptr deref with mixed tail calls and subprogs56c31bc9aa
ieee802154: hwsim: avoid possible crash in hwsim_del_edge_nl()71a345ede5
ieee802154: hwsim: Fix memory leak in hwsim_add_one4b44486b8b
tc-testing: fix list handling997285646a
net: ti: am65-cpsw-nuss: Fix crash when changing number of TX queues6610d5a73b
net/ipv4: swap flow ports when validating sourcec3fcfc4e36
ip6_tunnel: fix GRE6 segmentation162e75687e
vxlan: add missing rcu_read_lock() in neigh_reduce()6cd23b5f40
rtw88: 8822c: fix lc calibration timingdb2386fa43
iwlwifi: increase PNVM load timeout78e6587585
xfrm: Fix xfrm offload fallback fail case5c8e5fecea
pkt_sched: sch_qfq: fix qfq_change_class() error pathb2ce4ebdd9
netfilter: nf_tables_offload: check FLOW_DISSECTOR_KEY_BASIC in VLAN transfer logic581e37ad5c
tls: prevent oversized sendfile() hangs by ignoring MSG_MOREe7c3ae4797
net: sched: add barrier to ensure correct ordering for lockless qdiscca9b5ab791
vrf: do not push non-ND strict packets with a source LLA through packet taps againe72d9e4b98
net: ethernet: ezchip: fix error handling161f8b73da
net: ethernet: ezchip: fix UAF in nps_enet_removef026d82211
net: ethernet: aeroflex: fix UAF in greth_of_remove6a8c7c5c07
mt76: mt7615: fix NULL pointer dereference in tx_prepare_skb()6987ee9bf0
mt76: fix possible NULL pointer dereference in mt76_txe717f974ce
samples/bpf: Fix the error return code of xdp_redirect's main()79bf8f04ce
samples/bpf: Fix Segmentation fault for xdp_redirect commandfcd8d6371a
RDMA/rtrs-srv: Set minimal max_send_wr and max_recv_wra9355b201d
bpf: Fix libelf endian handling in resolv_btfids607706027c
xsk: Fix broken Tx ring validationcd7877a39f
xsk: Fix missing validation for skb and unaligned mode89621945b6
selftests/bpf: Whitelist test_progs.h from .gitignore49c25a1a8d
RDMA/rxe: Fix qp reference counting for atomic ops58da10487a
netfilter: nft_tproxy: restrict support to TCP and UDP transport protocolsed3d498834
netfilter: nft_osf: check for TCP packet before further processingcf28cb51f0
netfilter: nft_exthdr: check for IPv6 packet before further processing8f6714f3c1
RDMA/mlx5: Don't add slave port to unaffiliated lista158ee32d4
netlabel: Fix memory leak in netlbl_mgmt_add_common28e8df0c65
ath11k: send beacon template after vdev_start/restart during csa48b69f31de
ath10k: Fix an error code in ath10k_add_interface()e0727a61b0
ath11k: Fix an error handling path in ath11k_core_fetch_board_data_api_n()a54e9166e7
cw1200: Revert unnecessary patches that fix unreal use-after-free bugs30efdcaca3
brcmsmac: mac80211_if: Fix a resource leak in an error handling path5d452eafbd
brcmfmac: Fix a double-free in brcmf_sdio_bus_reset5b8d0b0727
brcmfmac: correctly report average RSSI in station infodb4de88d43
brcmfmac: fix setting of station info chains bitmask80ad538a87
ssb: Fix error return code in ssb_bus_scan()0147e6ccb8
wcn36xx: Move hal_buf allocation to devm_kmalloc in probe581098969c
clk: imx8mq: remove SYS PLL 1/2 clock gatesda8904c465
ieee802154: hwsim: Fix possible memory leak in hwsim_subscribe_all_others7142f92412
wireless: carl9170: fix LEDS build errors & warningsecb6797501
ath10k: add missing error return code in ath10k_pci_probe()668c0663d6
ath10k: go to path err_unsupported when chip id is not supported4654f1fc30
tools/bpftool: Fix error return code in do_batch()1ccbb552e3
drm: qxl: ensure surf.data is ininitializedbdc16fe9df
clk: vc5: fix output disabling when enabling a FOD43b7f1dec6
drm/vc4: hdmi: Fix error path of hpd-gpios756679a123
drm/pl111: Actually fix CONFIG_VEXPRESS_CONFIG depends87890e1113
RDMA/rxe: Fix failure during driver loadc5db39c4df
drm/pl111: depend on CONFIG_VEXPRESS_CONFIG42800fcff3
RDMA/core: Sanitize WQ state received from the userspacec470dd34c6
net/sched: act_vlan: Fix modify to allow 06a56913355
xfrm: remove the fragment check for ipv6 beet mode9fddbe9495
clk: tegra30: Use 300MHz for video decoder by default48bcd756af
ehea: fix error return code in ehea_restart_qps()6cbc167bc1
RDMA/rtrs-clt: Fix memory leak of not-freed sess->stats and stats->pcpu_stats6569ae1deb
RDMA/rtrs-clt: Check if the queue_depth has changed during a reconnection8651ad0e29
RDMA/rtrs-srv: Fix memory leak when having multiple sessionse7df730884
RDMA/rtrs-srv: Fix memory leak of unfreed rtrs_srv_stats objectf03d4c1296
RDMA/rtrs: Do not reset hb_missed_max after re-connectionbd4df557ae
RDMA/rtrs-clt: Check state of the rtrs_clt_sess before reading its stats067b663131
RDMA/srp: Fix a recently introduced memory leak116d5cdfac
mptcp: generate subflow hmac after mptcp_finish_join()284e741c4e
mptcp: fix pr_debug in mptcp_token_new_connecteee0f7d399
drm/rockchip: cdn-dp: fix sign extension on an int multiply for a u64 result75db503c9c
drm/rockchip: lvds: Fix an error handling path59eb7193be
drm/rockchip: dsi: move all lane config except LCDC mux to bind()40492ebd29
drm/rockchip: cdn-dp-core: add missing clk_disable_unprepare() on error in cdn_dp_grf_write()ef61b0826c
drm: rockchip: set alpha_en to 0 if it is not used7902ee2fae
net: ftgmac100: add missing error return code in ftgmac100_probe()28b3837b40
clk: meson: g12a: fix gp0 and hifi ranges27e9e0c468
net: qrtr: ns: Fix error return code in qrtr_ns_init()40b701707e
drm/vmwgfx: Fix cpu updates of coherent multisample surfacesa8e85ed088
drm/vmwgfx: Mark a surface gpu-dirty after the SVGA3dCmdDXGenMips command8f2b15ec3b
pinctrl: renesas: r8a77990: JTAG pins do not have pull-down capabilities6f4718c134
pinctrl: renesas: r8a7796: Add missing bias for PRESET# pin2d487941ee
net: pch_gbe: Propagate error from devm_gpio_request_one()2f9f23c43a
net: mvpp2: Put fwnode in error case during ->probe()b3fecbf60e
video: fbdev: imxfb: Fix an error message1655266d91
drm/ast: Fix missing conversions to managed API5885fce7b4
drm/amd/dc: Fix a missing check bug in dm_dp_mst_detect()0cd39c9657
drm/bridge: Fix the stop condition of drm_bridge_chain_pre_enable()45415d1f99
drm/bridge/sii8620: fix dependency on extcon1de9425286
xfrm: xfrm_state_mtu should return at least 1280 for ipv610f32b8c9e
mm/page_alloc: fix counting of managed_pagesd7deea31ed
mm: page_alloc: refactor setup_per_zone_lowmem_reserve()5458985533
mm: memcg/slab: properly set up gfp flags for objcg pointer array8e4af3917b
mm/shmem: fix shmem_swapin() race with swapoffa5dcdfe4cb
swap: fix do_swap_page() race with swapoff29ae2c9c9c
mm/debug_vm_pgtable: ensure THP availability via has_transparent_hugepage()7abf6e5763
mm/debug_vm_pgtable/basic: iterate over entire protection_map[]27634d63ca
mm/debug_vm_pgtable/basic: add validation for dirtiness after write protectc872674da7
dax: fix ENOMEM handling in grab_mapping_entry()c015295b28
ocfs2: fix snprintf() checking512106ae23
blk-mq: update hctx->dispatch_busy in case of real scheduler3e33b1329c
cpufreq: Make cpufreq_online() call driver->offline() on errorscc0b1776fd
ACPI: bgrt: Fix CFI violation3cbe01ac28
ACPI: Use DEVICE_ATTR_<RW|RO|WO> macrosd3dd2fe274
blk-wbt: make sure throttle is enabled properly1c2f21a8a0
blk-wbt: introduce a new disable state to prevent false positive by rwb_enabled()e0afab5181
ACPI: APEI: fix synchronous external aborts in user-modef626452df8
extcon: extcon-max8997: Fix IRQ freeing at error path45b399e309
clocksource/drivers/timer-ti-dm: Save and restore timer TIOCP_CFG0317b728d8
mark pstore-blk as broken296fbe2608
ACPI: sysfs: Fix a buffer overrun problem with description_show()ce47ae8961
nvme-pci: look for StorageD3Enable on companion ACPI device instead3ffe41f25f
block: avoid double io accounting for flush request17e77feadd
ACPI: PM / fan: Put fan device IDs into separate header file4dcb59d6a2
PM / devfreq: Add missing error code in devfreq_add_device()a61f8a2e45
media: video-mux: Skip dangling endpoints62c666805a
media: v4l2-async: Clean v4l2_async_notifier_add_fwnode_remote_subdev6bfcb61789
psi: Fix race between psi_trigger_create/destroy8d7debe744
crypto: nx - Fix RCU warning in nx842_OF_upd_statusc43082d284
spi: spi-sun6i: Fix chipselect/clock bugf18f7a2276
lockdep/selftests: Fix selftests vs PROVE_RAW_LOCK_NESTINGfca9e784a3
lockdep: Fix wait-type for empty stackca47a4fa89
sched/uclamp: Fix uclamp_tg_restrict()aea030cefc
sched/rt: Fix Deadline utilization tracking during policy changec576472a05
sched/rt: Fix RT utilization tracking during policy change67f66d48bd
x86/sev: Split up runtime #VC handler for correct state tracking2e1003f3ee
x86/sev: Make sure IRQs are disabled while GHCB is activeeefebcda89
btrfs: clear log tree recovering status if starting transaction failsaec3a574c6
regulator: hi655x: Fix pass wrong pointer to config.driver_data96275c8f6c
KVM: arm64: Don't zero the cycle count register when PMCR_EL0.P is sete5154bf217
perf/arm-cmn: Fix invalid pointer when access dtc object sharing the same IRQ number31dcfec19d
KVM: x86/mmu: Fix return value in tdp_mmu_map_handle_target_level()64d31137b1
KVM: nVMX: Don't clobber nested MMU's A/D status on EPTP switchbac38bd7c4
KVM: nVMX: Ensure 64-bit shift when checking VMFUNC bitmapb2c5af71ce
KVM: nVMX: Sync all PGDs on nested transition with shadow paging5ac406b81c
hwmon: (max31790) Fix fan speed reporting for fan7..12e02d52b7e9
hwmon: (max31722) Remove non-standard ACPI device IDs5c00e99497
hwmon: (lm70) Revert "hwmon: (lm70) Add support for ACPI"5cfc66b454
hwmon: (lm70) Use device_get_match_data()c9f8416e43
media: s5p-g2d: Fix a memory leak on ctx->fh.m2m_ctx921d2518db
media: subdev: remove VIDIOC_DQEVENT_TIME32 handlingbb5e089df7
arm64/mm: Fix ttbr0 values stored in struct thread_info for software-pan8d6acfe80d
arm64: consistently use reserved_pg_dirf1f30b3373
mmc: usdhi6rol0: fix error return code in usdhi6_probe()cd909ebb73
crypto: sm2 - fix a memory leak in sm2d598b8b77b
crypto: sm2 - remove unnecessary reset operationsdeef40c47e
crypto: x86/curve25519 - fix cpu feature checking logic in mod_exitbc50c40385
crypto: omap-sham - Fix PM reference leak in omap sham ops615f2f5e7e
crypto: nitrox - fix unchecked variable in nitrox_register_interrupts5d4cb7c394
regulator: fan53880: Fix vsel_mask setting for FAN53880_BUCK082d977b46
media: siano: Fix out-of-bounds warnings in smscore_load_firmware_family2()52734fb99e
m68k: atari: Fix ATARI_KBD_CORE kconfig unmet dependency warningb54a0f7926
media: gspca/gl860: fix zero-length control requests0109910cbd
media: tc358743: Fix error return code in tc358743_probe_of()5091f2738d
media: au0828: fix a NULL vs IS_ERR() check31157148a5
media: exynos4-is: Fix a use after free in isp_video_release2a91d7cc42
media: rkvdec: Fix .buf_prepare5a3ac10611
locking/lockdep: Reduce LOCKDEP dependency list1328decacd
pata_ep93xx: fix deferred probingbab207d352
media: rc: i2c: Fix an error messagea9d02976e9
crypto: ccp - Fix a resource leak in an error handling pathc3285441b4
crypto: sa2ul - Fix pm_runtime enable in sa_ul_probe()8ac033d9c4
crypto: sa2ul - Fix leaks on failure paths with sa_dma_init()c0ec4ac436
x86/elf: Use _BITUL() macro in UAPI headers912d16a2d7
evm: fix writing <securityfs>/evm overflow403577f75d
pata_octeon_cf: avoid WARN_ON() in ata_host_activate()5f9aaaaac8
kbuild: Fix objtool dependency for 'OBJECT_FILES_NON_STANDARD_<obj> := n'37481ad72d
sched/uclamp: Fix locking around cpu_util_update_eff()6c2b3d565f
sched/uclamp: Fix wrong implementation of cpu.uclamp.minb49d231c67
media: I2C: change 'RST' to "RSET" to fix multiple build errorse7a376edb4
pata_rb532_cf: fix deferred probing9df79fd17b
sata_highbank: fix deferred probing45d2d67833
crypto: ux500 - Fix error return code in hash_hw_final()8c8c11b4df
crypto: ixp4xx - update IV after requestsf00454ac40
crypto: ixp4xx - dma_unmap the correct address2c3164f31a
media: hantro: do a PM resume earlier6efd8921eb
media: s5p_cec: decrement usage count if disablede23dc4a3e8
media: venus: Rework error fail recover logic08d0aa16a1
spi: Avoid undefined behaviour when counting unused native CSsdb5a7e22c9
spi: Allow to have all native CSs in use along with GPIOs0c1d1517d6
writeback, cgroup: increment isw_nr_in_flight before grabbing an inode3bf8076a7b
ia64: mca_drv: fix incorrect array size calculationfc12d8fbcf
kthread_worker: fix return value when kthread_mod_delayed_work() races with kthread_cancel_delayed_work_sync()1208f10b4b
block: fix discard request merge9d0634f6cb
mailbox: qcom: Use PLATFORM_DEVID_AUTO to register platform devicec35b484130
cifs: fix missing spinlock around update to ses->statusa72d660c0d
HID: wacom: Correct base usage for capacitive ExpressKey status bits6bac00744b
ACPI: tables: Add custom DSDT file as makefile prerequisite5c93dd7c59
tpm_tis_spi: add missing SPI device ID entriesd9b40ebd44
clocksource: Check per-CPU clock synchronization when marked unstable03a65c14ab
clocksource: Retry clock read if long delays detected8ab9714fd8
ACPI: EC: trust DSDT GPE for certain HP laptopc406bb9ece
cifs: improve fallocate emulation998d9fefdd
PCI: hv: Add check for hyperv_initialized in init_hv_pci_drv()f5a90d44a1
EDAC/Intel: Do not load EDAC driver when running as a guest950a739905
nvmet-fc: do not check for invalid target port in nvmet_fc_handle_fcp_rqst()66e8848482
nvme-pci: fix var. type for increasing cq_head9dc2c2b941
platform/x86: toshiba_acpi: Fix missing error code in toshiba_acpi_setup_keyboard()e2cf3b5cb2
platform/x86: asus-nb-wmi: Revert "add support for ASUS ROG Zephyrus G14 and G15"dff2466722
platform/x86: asus-nb-wmi: Revert "Drop duplicate DMI quirk structures"1da08a428e
block: fix race between adding/removing rq qos and normal IO555dba7c63
ACPI: resources: Add checks for ACPI IRQ overridec79852298c
ACPI: bus: Call kobject_put() in acpi_init() error patha8c0057aee
ACPICA: Fix memory leak caused by _CID repair function2ebbe3a620
fs: dlm: fix memory leak when fencededa609d864
drivers: hv: Fix missing error code in vmbus_connect()019d04f914
open: don't silently ignore unknown O-flags in openat2()d838dddf3f
random32: Fix implicit truncation warning in prandom_seed_state()7425fe57d9
fs: dlm: cancel work sync othercon747b654e40
blk-mq: clear stale request in tags->rq[] before freeing one request poola3362ff043
blk-mq: grab rq->refcount before calling ->fn in blk_mq_tagset_busy_iterf58625bf2c
block_dump: remove block_dump feature in mark_inode_dirty()ca8541015d
ACPI: EC: Make more Asus laptops use ECDT _GPEb74b839a16
platform/x86: touchscreen_dmi: Add info for the Goodix GT912 panel of TM800A550L tabletsd4801889d6
platform/x86: touchscreen_dmi: Add an extra entry for the upside down Goodix touchscreen on Teclast X89 tabletsbb3a3a6ceb
Input: goodix - platform/x86: touchscreen_dmi - Move upside down quirks to touchscreen_dmi.c9e914f59cc
lib: vsprintf: Fix handling of number field widths in vsscanff8c3236890
hv_utils: Fix passing zero to 'PTR_ERR' warning0f2f529302
ACPI: processor idle: Fix up C-state latency if not orderedae281fbbc4
EDAC/ti: Add missing MODULE_DEVICE_TABLE2c0285062d
HID: do not use down_interruptible() when unbinding devices51b7499cec
ACPI: video: use native backlight for GA401/GA502/GA50383653ace03
media: Fix Media Controller API config checksf0b8f5682d
regulator: da9052: Ensure enough delay time for .set_voltage_time_sel5d9e3279f5
regulator: mt6358: Fix vdram2 .vsel_maskb58b54ef49
KVM: s390: get rid of register asm usage963baea02d
lockding/lockdep: Avoid to find wrong lock dep path in check_irq_usage()93cc59d8d0
locking/lockdep: Fix the dep path printing for backwards BFS9c0835c69d
btrfs: disable build on platforms having page size 256Kad71a9ad74
btrfs: don't clear page extent mapped if we're not invalidating the full page703b494a68
btrfs: sysfs: fix format string for some discard stats8d05e30c97
btrfs: abort transaction if we fail to update the delayed inodee0ffb169a3
btrfs: fix error handling in __btrfs_update_delayed_inode9b28291237
KVM: PPC: Book3S HV: Fix TLB management on SMT8 POWER9 and POWER10 processors00b1a9f0e8
drivers/perf: fix the missed ida_simple_remove() in ddr_perf_probe()625ee7d267
hwmon: (max31790) Fix pwmX_enable attributesc1eb091dbb
hwmon: (max31790) Report correct current pwm duty cycles49623e4b73
media: imx-csi: Skip first few frames from a BT.656 source72962620ef
media: siano: fix device register error pathcc4ba5a397
media: dvb_net: avoid speculation from net slotc34f3912a7
crypto: shash - avoid comparing pointers to exported functions under CFI0d201fee96
spi: meson-spicc: fix memory leak in meson_spicc_probea0bbb5d378
spi: meson-spicc: fix a wrong goto jump for avoiding memory leak.ea7e1b581b
mmc: via-sdmmc: add a check against NULL pointer dereference237999da70
mmc: sdhci-sprd: use sdhci_sprd_writewb6cbe1fcf8
memstick: rtsx_usb_ms: fix UAF8c252a6303
media: dvd_usb: memory leak in cinergyt2_fe_attache78a588b59
Makefile: fix GDB warning with CONFIG_RELRbce4838273
crypto: hisilicon/sec - fixup 3des minimum key size declaration74ef2418a7
media: st-hva: Fix potential NULL pointer dereferences617afcee2a
media: bt8xx: Fix a missing check bug in bt878_probe1f9cff025d
media: v4l2-core: Avoid the dangling pointer in v4l2_fh_release1d2838152e
media: cedrus: Fix .buf_preparecbfb77c2f9
media: hantro: Fix .buf_prepare6e08d3ab5c
media: em28xx: Fix possible memory leak of em28xx struct75c45a8188
media: bt878: do not schedule tasklet when it is not setupa61d119248
media: i2c: ov2659: Use clk_{prepare_enable,disable_unprepare}() to set xvclk on/off9fa8542a63
sched/fair: Fix ascii art by relpacing tabsd0214b841c
arm64: perf: Convert snprintf to sysfs_emitaddcb6bb58
crypto: qce: skcipher: Fix incorrect sg count for dma transfersd000c598db
crypto: qat - remove unused macro in FW loader5daa889433
crypto: qat - check return code of qat_hal_rd_rel_reg()9962341807
media: imx: imx7_mipi_csis: Fix logging of only error event counters179d9c18ba
media: pvrusb2: fix warning in pvr2_i2c_core_done893c243e52
media: hevc: Fix dependent slice segment flagsa245f93ad0
media: cobalt: fix race condition in setting HPD4626df7f65
media: cpia2: fix memory leak in cpia2_usb_probee717d6c291
media: sti: fix obj-$(config) targets93f80a0bbd
crypto: nx - add missing MODULE_DEVICE_TABLE4e8c9510b7
hwrng: exynos - Fix runtime PM imbalance on error3c51d82d0b
sched/core: Initialize the idle task with preemption disabledf8607f5ebe
regulator: uniphier: Add missing MODULE_DEVICE_TABLE66f0f478ec
spi: omap-100k: Fix the length judgment problem8692603ff1
spi: spi-topcliff-pch: Fix potential double free in pch_spi_process_messages()cb42cf32ce
spi: spi-loopback-test: Fix 'tx_buf' might be 'rx_buf'b980385a70
media: exynos-gsc: fix pm_runtime_get_sync() usage counta8b1889cd6
media: exynos4-is: fix pm_runtime_get_sync() usage count29fd79b628
media: sti/bdisp: fix pm_runtime_get_sync() usage countabdc897710
media: sunxi: fix pm_runtime_get_sync() usage countd627fc298c
media: s5p-jpeg: fix pm_runtime_get_sync() usage count3c90c3fbdc
media: mtk-vcodec: fix PM runtime get logic8318f7bc0e
media: sh_vou: fix pm_runtime_get_sync() usage count64e291d697
media: am437x: fix pm_runtime_get_sync() usage countadf052c779
media: s5p: fix pm_runtime_get_sync() usage count437ca06c78
media: mdk-mdp: fix pm_runtime_get_sync() usage countff7e4b94db
media: marvel-ccic: fix some issues when getting pm_runtimeccf0a291f7
staging: media: rkvdec: fix pm_runtime_get_sync() usage countb2c4d9a33c
Add a reference to ucounts for each cred61a7a634a0
spi: Make of_register_spi_device also set the fwnodef2b2400476
thermal/cpufreq_cooling: Update offline CPUs per-cpu thermal_pressure4eab2e2e98
fuse: reject internal errnobb7ee90ea5
fuse: check connected before queueing on fpq->io912e98505a
fuse: ignore PG_workingset after stealing576b44c326
fuse: Fix infinite loop in sget_fc()ae6ab39251
fuse: Fix crash if superblock of submount gets killed early91c2aa2c64
fuse: Fix crash in fuse_dentry_automount() error path53124265fc
evm: Refuse EVM_ALLOW_METADATA_WRITES only if an HMAC key is loaded7b84c7d7e2
evm: Execute evm_inode_init_security() only when an HMAC key is loadeda7e18f57ed
loop: Fix missing discard support when using LOOP_CONFIGURE75395690e5
powerpc/stacktrace: Fix spurious "stale" traces in raise_backtrace_ipi()c556b938b3
seq_buf: Make trace_seq_putmem_hex() support data longer than 80531e84bc8
tracepoint: Add tracepoint_probe_register_may_exist() for BPF tracing2aedacfaf6
tracing/histograms: Fix parsing of "sym-offset" modifier998de999ba
rsi: fix AP mode with WPA failure due to encrypted EAPOL71808ec5b9
rsi: Assign beacon rate settings to the correct rate_info descriptor field43189683fe
ssb: sdio: Don't overwrite const buffer if block_write fails58940e88ba
ath9k: Fix kernel NULL pointer dereference during ath_reset_internal()cc46d6d14f
serial_cs: remove wrong GLOBETROTTER.cis entrycf727d99ab
serial_cs: Add Option International GSM-Ready 56K/ISDN modem23055da561
serial: sh-sci: Stop dmaengine transfer in sci_stop_tx()17451bd036
serial: mvebu-uart: fix calculation of clock divisor8c90ec9965
iio: accel: bma180: Fix BMA25x bandwidth register values9efc775c28
iio: ltr501: ltr501_read_ps(): add missing endianness conversionc6c3ea1d9d
iio: ltr501: ltr559: fix initialization of LTR501_ALS_CONTRfbadeba72e
iio: ltr501: mark register holding upper 8 bits of ALS_DATA{0,1} and PS_DATA as volatile, too17c67f4848
iio: light: tcs3472: do not free unallocated IRQ6534a5e0c2
iio: frequency: adf4350: disable reg and clk on error in adf4350_probe()a6f7bf2652
rtc: stm32: Fix unbalanced clk_disable_unprepare() on probe error pathe92bd19246
clk: agilex/stratix10: fix bypass representation3093214a6a
clk: agilex/stratix10: remove noc_clk308d01f525
clk: agilex/stratix10/n5x: fix how the bypass_reg is handlede582a2f352
f2fs: Prevent swap file in LFS mode36ae903607
s390: mm: Fix secure storage access exception handling38a2ba82e2
s390/cio: dont call css_wait_for_slow_path() inside a lock9aae145dc5
KVM: x86/mmu: Use MMU's role to detect CR4.SMEP value in nested NPT walka9ac58f85f
KVM: x86/mmu: Treat NX as used (not reserved) for all !TDP shadow MMUs30c44537cb
KVM: PPC: Book3S HV: Workaround high stack usage with clang39d0dfab6c
KVM: nVMX: Handle split-lock #AC exceptions that happen in L27510c5cd0d
perf/smmuv3: Don't trample existing events with global filter9109e15709
mm/gup: fix try_grab_compound_head() race with split_huge_page()9b0d1f4cb8
bus: mhi: Wait for M2 state during system resumecbcbfb0488
SUNRPC: Should wake up the privileged task firstly.30f5608498
SUNRPC: Fix the batch tasks count wraparound.c6d864601e
mac80211: remove iwlwifi specific workaround that broke sta NDP tx507925fff0
can: peak_pciefd: pucan_handle_status(): fix a potential starvation issue in TX pathf79ea4755f
can: j1939: j1939_sk_init(): set SOCK_RCU_FREE to call sk_destruct() after RCU is done22bfa94db2
can: isotp: isotp_release(): omit unintended hrtimer restart on socket releaseaf94ef8f0b
can: gw: synchronize rcu operations before removing gw job entryb52e0cf0bf
can: bcm: delay release of struct bcm_op after synchronize_rcu()aa07327083
ext4: use ext4_grp_locked_error in mb_find_extent6903f99f19
ext4: fix avefreec in find_group_orlov98cd580211
ext4: remove check for zero nr_to_scan in ext4_es_scan()68a40ff916
ext4: correct the cache_nr in tracepoint ext4_es_shrink_exitf4e91a4e0d
ext4: return error code when ext4_fill_flex_info() failsb368b0375e
ext4: fix overflow in ext4_iomap_alloc()ea5466f1a7
ext4: fix kernel infoleak via ext4_extent_header076d9b0623
ext4: cleanup in-core orphan list if ext4_truncate() failed to get a transaction handle80d05ce58a
btrfs: clear defrag status of a root if starting transaction fails6b00b1717f
btrfs: compression: don't try to compress if we don't have enough pages34172f601a
btrfs: send: fix invalid path for unlink operations after parent orphanization2fa9298035
ARM: dts: at91: sama5d4: fix pinctrl muxingea45145e6c
ARM: dts: ux500: Fix LED probingb34aa5aaaa
arm_pmu: Fix write counter incorrect in ARMv7 big-endian mode123c1b05b0
crypto: ccp - Annotate SEV Firmware file names834c47a387
crypto: nx - Fix memcpy() over-reading in nonceb4c35e9e80
Input: joydev - prevent use of not validated data in JSIOCSBTNMAP ioctl7b0393e6f6
iov_iter_fault_in_readable() should do nothing in xarray caseb6df9e43d5
copy_page_to_iter(): fix ITER_DISCARD cased91638f70e
selftests/lkdtm: Avoid needing explicit sub-shell1738bcf9e6
ntfs: fix validity check for file name attributef794c839df
gfs2: Fix error handling in init_statfs3ae1c663bd
gfs2: Fix underflow in gfs2_page_mkwriteb242ae99fa
xhci: solve a double free problem while doing s4ff0f59d2d8
usb: typec: Add the missed altmode_id_remove() in typec_register_altmode()63d6029e66
usb: dwc3: Fix debugfs creation flow022d22a311
USB: cdc-acm: blacklist Heimann USB Appset devicef9d9db593d
usb: renesas-xhci: Fix handling of unknown ROM state3b54578850
usb: gadget: eem: fix echo command packet response issuec964c4682e
net: can: ems_usb: fix use-after-free in ems_usb_disconnect()a2ad0bddd0
Input: usbtouchscreen - fix control-request directions23e8f46884
media: dvb-usb: fix wrong definitiona6f433fd9e
ALSA: hda/realtek: fix mute/micmute LEDs for HP EliteBook 830 G8 Notebook PCba65dd6eb8
ALSA: hda/realtek: Apply LED fixup for HP Dragonfly G1, too13a05c7b43
ALSA: hda/realtek: Fix bass speaker DAC mapping for Asus UM431D37e179c028
ALSA: hda/realtek: Improve fixup for HP Spectre x360 15-df0xxxea824a31a3
ALSA: hda/realtek: fix mute/micmute LEDs for HP EliteBook x360 830 G8659b440a8d
ALSA: hda/realtek: Add another ALC236 variant support36bc25ec61
ALSA: hda/realtek: fix mute/micmute LEDs for HP ProBook 630 G80535de167b
ALSA: hda/realtek: fix mute/micmute LEDs for HP ProBook 445 G82a13d43821
ALSA: hda/realtek: fix mute/micmute LEDs for HP ProBook 450 G89127b27703
ALSA: intel8x0: Fix breakage at ac97 clock measurement19418ed317
ALSA: usb-audio: scarlett2: Fix wrong resume call5c4d51b438
ALSA: firewire-motu: fix stream format for MOTU 8pre FireWire313a5e869d
ALSA: usb-audio: Fix OOB access at proc outputcfd3c66ca7
ALSA: usb-audio: fix rate on Ozone Z90 USB headsetae9957b3ee
Bluetooth: Remove spurious error messagef5af19889f
Bluetooth: btqca: Don't modify firmware contents in-place3cdcbd1b8c
Bluetooth: hci_qca: fix potential GPFb1a6760ddf
Merge branch 'android12-5.10' into `android12-5.10-lts`e722f1d83b
Merge 5.10.49 into android12-5.10-lts9c4e6d448c
Merge 5.10.48 into android12-5.10-lts904ad453ba
Linux 5.10.49064b57a8da
xen/events: reset active flag for lateeoi events latera245f6842d
Hexagon: change jumps to must-extend in futex_atomic_*a7f51048c5
Hexagon: add target builtins to kernel243f325ecc
Hexagon: fix build errors8148665cb7
media: uvcvideo: Support devices that report an OT as an entity sourced5737410d2
KVM: PPC: Book3S HV: Save and restore FSCR in the P9 patha09a522772
Linux 5.10.484dc9680428
Revert "KVM: x86/mmu: Drop kvm_mmu_extended_role.cr4_la57 hack"4ab869e028
RDMA/mlx5: Block FDB rules when not in switchdev mode348143a380
gpio: AMD8111 and TQMX86 require HAS_IOPORT_MAP45ca6df5df
drm/nouveau: fix dma_address check for CPU/GPU syncd191c3d6ad
gpio: mxc: Fix disabled interrupt wake-up supportf77f972384
scsi: sr: Return appropriate error code when disk is ejectedc37b834212
Merge branch 'android12-5.10' into `android12-5.10-lts`3213549c5d
ANDROID: ABI: update android12-5.10-lts ABI for 7/2 KMI update2fcffe3f27
ANDROID: ABI: hikey960_gki.fragment: Add cfg80211 and mac80211 as modulesfd7a54895d
ANDROID: ABI: gki_defconfig: Make cfg80211 and mac80211 modulesd43e5a796b
Revert "ANDROID: GKI: Enable some necessary CFG80211 configs for WIFI"194be71cc6
Merge 5.10.47 into android12-5.10-ltsbc9699030e
Merge branch 'android12-5.10' into `android12-5.10-lts`4357ae26d4
Linux 5.10.471573d595e2
integrity: Load mokx variables into the blacklist keyringc6ae6f89fc
certs: Add ability to preload revocation certs72d6f5d982
certs: Move load_system_certificate_list to a common function45109066f6
certs: Add EFI_CERT_X509_GUID support for dbx entries0ba128fa68
Revert "drm: add a locked version of drm_is_current_master"0463b49e02
netfs: fix test for whether we can skip read when writing beyond EOFe6108147dd
swiotlb: manipulate orig_addr when tlb_addr has offset7570a8b5dd
KVM: SVM: Call SEV Guest Decommission if ASID binding fails377a796e7a
mm, futex: fix shared futex pgoff on shmem huge pageab9d178167
mm/thp: another PVMW_SYNC fix in page_vma_mapped_walk()915c3a262c
mm/thp: fix page_vma_mapped_walk() if THP mapped by ptes90073aecc3
mm: page_vma_mapped_walk(): get vma_address_end() earlierbf60fc2314
mm: page_vma_mapped_walk(): use goto instead of while (1)9f85dcaf15
mm: page_vma_mapped_walk(): add a level of indentatione56bdb3976
mm: page_vma_mapped_walk(): crossing page table boundary8dc191ed9c
mm: page_vma_mapped_walk(): prettify PVMW_MIGRATION block7b55a4bcfc
mm: page_vma_mapped_walk(): use pmde for *pvmw->pmd1cb0b9059f
mm: page_vma_mapped_walk(): settle PageHuge on entry65febb41b4
mm: page_vma_mapped_walk(): use page for pvmw->page825c28052b
mm: thp: replace DEBUG_VM BUG with VM_WARN when unmap fails for split0010275ca2
mm/thp: unmap_mapping_page() to fix THP truncate_cleanup_page()38cda6b5ab
mm/thp: fix page_address_in_vma() on file THP tails37ffe9f4d7
mm/thp: fix vma_address() if virtual address below file offset66be14a926
mm/thp: try_to_unmap() use TTU_SYNC for safe splitting6527d8ef68
mm/thp: make is_huge_zero_pmd() safe and quickera8f4ea1d38
mm/thp: fix __split_huge_pmd_locked() on shmem migration entry32f954e961
mm, thp: use head page in __migration_entry_wait()bfd90b56d7
mm/rmap: use page_not_mapped in try_to_unmap()ff81af8259
mm/rmap: remove unneeded semicolon in page_not_mapped()a0ad7ea018
mm: add VM_WARN_ON_ONCE_PAGE() macro130a1d76ee
x86/fpu: Make init_fpstate correct with optimized XSAVE51d8011782
x86/fpu: Preserve supervisor states in sanitize_restored_user_xstate()2b35a4eaaa
kthread: prevent deadlock when kthread_mod_delayed_work() races with kthread_cancel_delayed_work_sync()bfe28af78a
kthread_worker: split code for canceling the delayed work timer02c303f3b9
ceph: must hold snap_rwsem when filling inode for async createde0af2651d
i2c: robotfuzz-osif: fix control-request directionsdd8ed6c9bc
KVM: do not allow mapping valid but non-reference-counted pages5fd0c2cf7b
s390/stack: fix possible register corruption with stack switch helperab5bef9780
nilfs2: fix memory leak in nilfs_sysfs_delete_device_groupace31c91fd
scsi: sd: Call sd_revalidate_disk() for ioctl(BLKRRPART)b9e6c20d4c
gpiolib: cdev: zero padding during conversion to gpioline_info_changed0221a5a4db
i2c: i801: Ensure that SMBHSTSTS_INUSE_STS is cleared when leaving i801_access018d03fcf7
pinctrl: stm32: fix the reported number of GPIO lines per bankdf654cd3d3
perf/x86: Track pmu in per-CPU cpu_hw_eventsf9e73b2967
net: ll_temac: Avoid ndo_start_xmit returning NETDEV_TX_BUSY1c9cf96f56
net: ll_temac: Add memory-barriers for TX BD accessbafb6cdd4f
PCI: Add AMD RS690 quirk to enable 64-bit DMAd91c50e6a6
recordmcount: Correct st_shndx handlingfb71d81ccd
mac80211: handle various extensible elements correctly676a7cb1a9
mac80211: reset profile_periodicity/ema_apca0e1fefbb
net: qed: Fix memcpy() overflow of qed_dcbx_params()4658a8d307
KVM: selftests: Fix kvm_check_cap() assertione83e3c5d85
r8169: Avoid memcpy() over-reading of ETH_SS_STATS992b105abf
sh_eth: Avoid memcpy() over-reading of ETH_SS_STATSa10856ea60
r8152: Avoid memcpy() over-reading of ETH_SS_STATS196b22ef6c
net/packet: annotate accesses to po->ifindexda8b3aeff4
net/packet: annotate accesses to po->bind18ed1789bb
net: caif: fix memory leak in ldisc_openedcd7594ad
riscv32: Use medany C model for modules47c07f919f
net: phy: dp83867: perform soft reset and retain established linkf57132a887
net/packet: annotate data race in packet_sendmsg()9707960ecf
inet: annotate date races around sk->sk_txhash7293f63b7b
net: annotate data race in sock_error()61b132f67c
ping: Check return value of function 'ping_queue_rcv_skb'08c389de6d
inet: annotate data race in inet_send_prepare() and inet_dgram_connect()c2311fd6de
net: ethtool: clear heap allocations for ethtool functionc2813d1966
mac80211: drop multicast fragmentsfedc4d4f54
net: ipv4: Remove unneed BUG() function93c2aac13b
dmaengine: mediatek: use GFP_NOWAIT instead of GFP_ATOMIC in prep_dma0f48f92771
dmaengine: mediatek: do not issue a new desc if one is still current63fa5b2d4b
dmaengine: mediatek: free the proper desc in desc_free handler78fa0f707d
dmaengine: rcar-dmac: Fix PM reference leak in rcar_dmac_probe()6a07cf3606
cfg80211: call cfg80211_leave_ocb when switching away from OCBa902833300
mac80211_hwsim: drop pending frames on stop8cfe765afd
mac80211: remove warning in ieee80211_get_sband()b671b98169
dmaengine: xilinx: dpdma: Limit descriptor IDs to 16 bits524f70b30e
dmaengine: xilinx: dpdma: Add missing dependencies to Kconfig13b245a7bd
dmaengine: stm32-mdma: fix PM reference leak in stm32_mdma_alloc_chan_resourc()86f3e72dcb
dmaengine: zynqmp_dma: Fix PM reference leak in zynqmp_dma_alloc_chan_resourc()4df9ed0edb
perf/x86/intel/lbr: Zero the xstate buffer on allocation56bc20e5fc
perf/x86/lbr: Remove cpuc->lbr_xsave allocation from atomic contextca2acbd548
locking/lockdep: Improve noinstr vs errors59aa5c91f8
x86/xen: Fix noinstr fail in exc_xen_unknown_trap()cb83c99cf6
x86/entry: Fix noinstr fail in __do_fast_syscall_32()cf59354875
drm/vc4: hdmi: Make sure the controller is powered in detectf73aca83fd
drm/vc4: hdmi: Move the HSM clock enable to runtime_pmf11f9ff8a7
Revert "PCI: PM: Do not read power state in pci_enable_device_flags()"4b06ebab4a
spi: spi-nxp-fspi: move the register operation after the clock enable50a1312a29
arm64: Force NO_BLOCK_MAPPINGS if crashkernel reservation is requiredbd5d4df4dc
arm64: Ignore any DMA offsets in the max_zone_phys() calculation3bbdf5a6fc
MIPS: generic: Update node names to avoid unit addresses03096a4601
mmc: meson-gx: use memcpy_to/fromio for dram-access-quirkb8fd230ae0
ARM: 9081/1: fix gcc-10 thumb2-kernel regression3d6c4f78ec
drm/amdgpu: wait for moving fence after pinning694bb36aa7
drm/radeon: wait for moving fence after pinningbcfea2412f
drm/nouveau: wait for moving fence after pinning v23ef0ca0ec9
drm: add a locked version of drm_is_current_masterfea853aca3
Revert "drm/amdgpu/gfx10: enlarge CP_MEC_DOORBELL_RANGE_UPPER to cover full doorbell."1bd81429d5
Revert "drm/amdgpu/gfx9: fix the doorbell missing when in CGPG issue."3051f230f1
module: limit enabling module.sig_enforce76d5608135
Revert "mm: relocate 'write_protect_seq' in struct mm_struct"948d38f94d
Merge 5.10.46 into android12-5.10-lts78b5962cda
Merge branch 'android12-5.10' into `android12-5.10-lts`3de043c685
Linux 5.10.46174c27583b
usb: dwc3: core: fix kernel panic when do reboote52d43c82f
usb: dwc3: debugfs: Add and remove endpoint dirs dynamically1b5fbb6618
perf beauty: Update copy of linux/socket.h with the kernel sources69371e0482
tools headers UAPI: Sync linux/in.h copy with the kernel sources4f6e7098f1
net: fec_ptp: add clock rate zero check1af3a8e91f
net: stmmac: disable clocks in stmmac_remove_config_dt()f71ca814c2
mm/slub.c: include swab.hf6ed235754
mm/slub: actually fix freelist pointer vs redzoning4314c8c63b
mm/slub: fix redzoning for small allocations4a36fda16b
mm/slub: clarify verification reporting12eb3c2c1a
mm/swap: fix pte_same_as_swp() not removing uffd-wp bit when comparefc7fdd8c5c
net: bridge: fix vlan tunnel dst refcnt when egressingfe0448a3fa
net: bridge: fix vlan tunnel dst null pointer dereferencecfe403f209
net: ll_temac: Fix TX BD buffer overwrite019ab7d044
net: ll_temac: Make sure to free skb when it is completely used41984d4fbe
drm/amdgpu/gfx9: fix the doorbell missing when in CGPG issue.bc58ec307c
drm/amdgpu/gfx10: enlarge CP_MEC_DOORBELL_RANGE_UPPER to cover full doorbell.96b4126f8c
cfg80211: avoid double free of PMSR request5493b0c2a7
cfg80211: make certificate generation more robustf74df6e086
mac80211: Fix NULL ptr deref for injected rate infodf203c1fda
dmaengine: pl330: fix wrong usage of spinlock flags in dma_cyclcb842b568a5
crash_core, vmcoreinfo: append 'SECTION_SIZE_BITS' to vmcoreinfo63ba83563e
x86/fpu: Reset state for all signal restore failuresa7748e021b
x86/fpu: Invalidate FPU state after a failed XRSTOR from a user buffer076f732b16
x86/fpu: Prevent state corruption in __fpu__restore_sig()abc790bdbb
x86/pkru: Write hardware init value to PKRU when xstate is init208bb686e7
x86/ioremap: Map EFI-reserved memory as encrypted for SEV75a55bc2e5
x86/process: Check PF_KTHREAD and not current->mm for kernel threadsddaaf38e19
x86/mm: Avoid truncating memblocks for SGX memoryf6bcb1a628
ARCv2: save ABI registers across signal handlingb516daed99
s390/ap: Fix hanging ioctl caused by wrong msg counter7c003dab43
s390/mcck: fix calculation of SIE critical section size3a9934d6b8
KVM: X86: Fix x86_emulator slab cache leak18eca69f88
KVM: x86/mmu: Calculate and check "full" mmu_role for nested MMU669a8866e4
KVM: x86: Immediately reset the MMU context when the SMM flag is cleared077cb8946f
PCI: Work around Huawei Intelligent NIC VF FLR erratumee1a9cfed2
PCI: Add ACS quirk for Broadcom BCM57414 NIC1a1dbc4473
PCI: aardvark: Fix kernel panic during PIO transferdac77a14fa
PCI: Mark some NVIDIA GPUs to avoid bus reset1e460ddf5b
PCI: Mark TI C667X to avoid bus resetc9fd0ab39f
tracing: Do no increment trace_clock_global() by oneb313bd944d
tracing: Do not stop recording comms if the trace file is being readadb3849ed8
tracing: Do not stop recording cmdlines when tracing is off1a91fafa3e
usb: chipidea: imx: Fix Battery Charger 1.2 CDP detection576996b64e
usb: core: hub: Disable autosuspend for Cypress CY7C656326bd3d80d1f
can: mcba_usb: fix memory leak in mcba_usb509ab6bfdd
can: j1939: fix Use-after-Free, hold skb ref while in use0cf4b37790
can: bcm/raw/isotp: use per module netdevice notifieracb755be1f
can: bcm: fix infoleak in struct bcm_msg_head8c82c52d1d
bpf: Do not mark insn as seen under speculative path verificatione9d271731d
bpf: Inherit expanded/patched seen count from old aux dataed423d80bb
irqchip/gic-v3: Workaround inconsistent PMR setting on NMI entry103c4a08ba
mm: relocate 'write_protect_seq' in struct mm_structa87abba03a
hwmon: (scpi-hwmon) shows the negative temperature properly57b21ef118
radeon: use memcpy_to/fromio for UVD fw upload3e4b0fbb72
ASoC: qcom: lpass-cpu: Fix pop noise during audio capture begin360609fc8b
drm/sun4i: dw-hdmi: Make HDMI PHY into a platform device5bd6bcb353
pinctrl: ralink: rt2880: avoid to error in calls is pin is already enabled6d0dc1b34c
ASoC: rt5682: Fix the fast discharge for headset unplugging in soundwire modeba8a26a7ce
regulator: rt4801: Fix NULL pointer dereference if priv->enable_gpios is NULL2f8f0e97ce
spi: stm32-qspi: Always wait BUSY bit to be cleared in stm32_qspi_wait_cmd()e03c8b3516
ASoC: tas2562: Fix TDM_CFG0_SAMPRATE values813ff24f1d
sched/pelt: Ensure that *_sum is always synced with *_avgf6d28f0e36
spi: spi-zynq-qspi: Fix some wrong goto jumps & missing error code0ea21221dd
regulator: rtmv20: Fix to make regcache value first reading back from HW3c5064cd29
ASoC: fsl-asoc-card: Set .owner attribute when registering card.9a17907946
phy: phy-mtk-tphy: Fix some resource leaks in mtk_phy_init()02e2455748
ASoC: rt5659: Fix the lost powers for the HDA header3fb6c6acc1
platform/x86: thinkpad_acpi: Add X1 Carbon Gen 9 second fan support0609c36696
regulator: bd70528: Fix off-by-one for buck123 .n_voltages setting0ea923519a
regulator: cros-ec: Fix error code in dev_err message95deeb29d8
net: ethernet: fix potential use-after-free in ec_bhf_remove8c0c2d97ad
icmp: don't send out ICMP messages with a source address of 0.0.0.0c5d70dbc4d
bnxt_en: Call bnxt_ethtool_free() in bnxt_init_one() error pathf8774be4dc
bnxt_en: Fix TQM fastpath ring backing store computationacc9175541
bnxt_en: Rediscover PHY capabilities after firmware resetacc3589959
cxgb4: fix wrong shift.05b2b9f7d2
net: cdc_eem: fix tx fixup skb leak290b0b6432
net: hamradio: fix memory leak in mkiss_close45bf43d868
be2net: Fix an error handling path in 'be_probe()'327e626c39
net/mlx5: Reset mkey index on creation38aafe678c
net/mlx5: E-Switch, Allow setting GUID for host PF vport601be24dba
net/mlx5: E-Switch, Read PF mac address5f2ccc58a3
net/af_unix: fix a data-race in unix_dgram_sendmsg / unix_release_sockac31cc837c
net: ipv4: fix memory leak in ip_mc_add1_srcd08f726cd5
net: fec_ptp: fix issue caused by refactor the fec_devtype570a52cf3e
net: usb: fix possible use-after-free in smsc75xx_bind70c8418469
lantiq: net: fix duplicated skb in rx descriptor ring11fac7e912
net: cdc_ncm: switch to eth%d interface naming9a47949562
ptp: improve max_adj check against unreasonable values5fc6ed1831
bpf: Fix leakage under speculation on mispredicted branches960b08dd36
net: qrtr: fix OOB Read in qrtr_endpoint_post0239c439ce
ipv4: Fix device used for dst_alloc with local routes4b5ad4b5ae
cxgb4: fix wrong ethtool n-tuple rule lookupd708e5efdd
netxen_nic: Fix an error handling path in 'netxen_nic_probe()'70513cdb93
qlcnic: Fix an error handling path in 'qlcnic_probe()'fb3a948143
ethtool: strset: fix message length calculation0e185a7b28
net: qualcomm: rmnet: don't over-count statisticse3577776d6
net: qualcomm: rmnet: Update rmnet device MTU based on real device4abfd597fe
net: make get_net_ns return error if NET_NS is disabled6a4b39944e
net: stmmac: dwmac1000: Fix extended MAC address registers definition6392ed82ad
cxgb4: halt chip before flashing PHY firmware imageb38ec782d0
cxgb4: fix sleep in atomic when flashing PHY firmware3d60457d74
cxgb4: fix endianness when flashing boot image5bf940fe91
alx: Fix an error handling path in 'alx_probe()'0adf32c033
selftests: mptcp: enable syncookie only in absence of reorderseab06f7504
mptcp: do not warn on bad input from the network222ebeda17
mptcp: try harder to borrow memory from subflow under pressure3b491dd593
sch_cake: Fix out of bounds when parsing TCP options and header73eeba71dc
mptcp: Fix out of bounds when parsing TCP options9cdf299ba4
netfilter: synproxy: Fix out of bounds when parsing TCP optionsa336dc6fdd
net/mlx5e: Block offload of outer header csum for UDP tunnels34ff3770bf
net/mlx5: DR, Don't use SW steering when RoCE is not supported3623bfcab3
net/mlx5: DR, Allow SW steering for sw_owner_v2 devices792f16e083
net/mlx5: Consider RoCE cap before init RDMA resourcesbe7f3f401d
net/mlx5e: Fix page reclaim for dead peer hairpin02c55a2570
net/mlx5e: Remove dependency in IPsec initialization flows4733b73709
net/sched: act_ct: handle DNAT tuple collisionc8f1437c01
rtnetlink: Fix regression in bridge VLAN configuration8729ec8a22
udp: fix race between close() and udp_abort()7dd7b1e4d9
ice: parameterize functions responsible for Tx ring management805ae44fc0
ice: add ndo_bpf callback for safe mode netdev ops27e3d7da65
netfilter: nft_fib_ipv6: skip ipv6 packets from any to link-local5cea03aef6
net: lantiq: disable interrupt before sheduling NAPIdb5f4adc93
net: dsa: felix: re-enable TX flow control in ocelot_port_flush()5946fbf483
net: rds: fix memory leak in rds_recvmsgaba26b3838
vrf: fix maximum MTUdeeeb65c6e
net: ipv4: fix memory leak in netlbl_cipsov4_add_std2088824ac9
libbpf: Fixes incorrect rx_ring_setup_done195585ddb7
mlxsw: core: Set thermal zone polling delay argument to real value at inite95848e9b5
mlxsw: reg: Spectrum-3: Enforce lowest max-shaper burst size of 115a1cd67a80
mac80211: fix skb length check in ieee80211_scan_rx()282baa8104
batman-adv: Avoid WARN_ON timing related checksae1d3b989d
fanotify: fix copy_event_to_user() fid error clean up018685461a
kvm: LAPIC: Restore guard to prevent illegal APIC register access9e379da727
mm/memory-failure: make sure wait for page writeback in memory_failure090b1bb928
afs: Fix an IS_ERR() vs NULL check5efb0b3886
dmaengine: stedma40: add missing iounmap() on error in d40_probe()ff864fa71a
dmaengine: SF_PDMA depends on HAS_IOMEMc0090b0169
dmaengine: QCOM_HIDMA_MGMT depends on HAS_IOMEMf984fa006b
dmaengine: ALTERA_MSGDMA depends on HAS_IOMEMbe4789636f
dmaengine: xilinx: dpdma: initialize registers before request_irqedd60afc3f
dmaengine: fsl-dpaa2-qdma: Fix error return code in two functions4d74c98023
dmaengine: idxd: add missing dsa driver unregistere52dde966a
Merge 5.10.45 into android12-5.10-ltsdefb903783
Merge branch 'android12-5.10' into `android12-5.10-lts`037a447b7a
Linux 5.10.45808fcc1e70
fib: Return the correct errno coded8b2e3e17c
net: Return the correct errno code04c1556bfc
net/x25: Return the correct errno code0aa3569508
rtnetlink: Fix missing error code in rtnl_bridge_notify()9250f97fd5
drm/amd/amdgpu:save psp ring wptr to avoid attack9e8c2af010
drm/amd/display: Fix potential memory leak in DMUB hw_init75fa7fbef1
drm/amdgpu: refine amdgpu_fru_get_product_info34fe4ccb1f
drm/amd/display: Allow bandwidth validation for 0 streams.ecd26536ec
net: ipconfig: Don't override command-line hostnames or domains511a010291
nvme-loop: do not warn for deleted controllers during reset155c2fea4b
nvme-loop: check for NVME_LOOP_Q_LIVE in nvme_loop_destroy_admin_queue()620424df29
nvme-loop: clear NVME_LOOP_Q_LIVE when nvme_loop_configure_admin_queue() fails1c80ca596c
nvme-loop: reset queue count to 1 in nvme_loop_destroy_io_queues()b8fdea0695
scsi: scsi_devinfo: Add blacklist entry for HPE OPEN-Vf8ac1bd527
Bluetooth: Add a new USB ID for RTL8822CE5491d97078
scsi: qedf: Do not put host in qedf_vport_create() unconditionally609b56e979
ethernet: myri10ge: Fix missing error code in myri10ge_probe()5d5f0d945d
scsi: target: core: Fix warning on realtime kernelsa61156314b
gfs2: Fix use-after-free in gfs2_glock_shrink_scanbb73f2f789
riscv: Use -mno-relax when using lld linker35277c1a66
HID: gt683r: add missing MODULE_DEVICE_TABLE7a557de079
gfs2: fix a deadlock on withdraw-during-mountc3e9ea16ad
gfs2: Prevent direct-I/O write fallback errors from getting lost864b5a8d53
ARM: OMAP2+: Fix build warning when mmc_omap is not built247ec8ee0b
ARM: OMAP1: Fix use of possibly uninitialized irq variable3c0ad70cba
drm/tegra: sor: Fully initialize SOR before registration9c1d492baa
gpu: host1x: Split up client initalization and registration570b3e4020
drm/tegra: sor: Do not leak runtime PM referenceb1e3596416
HID: usbhid: fix info leak in hid_submit_ctrl1dfd9f18ca
HID: Add BUS_VIRTUAL to hid_connect logging258d3fdbb1
HID: multitouch: set Stylus suffix for Stylus-application devices, too6a142ea610
HID: quirks: Add quirk for Lenovo optical mouse716a087adc
HID: hid-sensor-hub: Return error for hid_set_field() failure0bd8a4b46c
HID: hid-input: add mapping for emoji picker keyb3c5bfc43c
HID: a4tech: use A4_2WHEEL_MOUSE_HACK_B8 for A4TECH NB-95be6c988792
HID: quirks: Set INCREMENT_USAGE_ON_DUPLICATE for Saitek X65c7836de2ca
net: ieee802154: fix null deref in parse dev addr82658bfd88
Merge 5.10.44 into android12-5.10-ltsf2b1fc360f
Linux 5.10.44ef9a0d224b
proc: only require mm_struct for writing43c32c2225
tracing: Correct the length check which causes memory corruption5b537408f2
scsi: core: Only put parent device if host state differs from SHOST_CREATED0a31d1237a
scsi: core: Put .shost_dev in failure path if host state changes to RUNNING146446a43b
scsi: core: Fix failure handling of scsi_add_host_with_dma()7a696ce1d5
scsi: core: Fix error handling of scsi_host_alloc()6e13b9bc66
NFSv4: nfs4_proc_set_acl needs to restore NFS_CAP_UIDGID_NOMAP on error.d973bd0d6e
NFSv4: Fix second deadlock in nfs4_evict_inode()c3b6cf64df
NFS: Fix use-after-free in nfs4_init_client()9064c9d544
kvm: fix previous commit for 32-bit builds351075bcfe
perf session: Correct buffer copying when peeking eventsb4651cea43
NFSv4: Fix deadlock between nfs4_evict_inode() and nfs4_opendata_get_inode()279ad78a00
NFS: Fix a potential NULL dereference in nfs_get_client()91f7fdc4cc
IB/mlx5: Fix initializing CQ fragments bufferd046f724bb
KVM: x86: Ensure liveliness of nested VM-Enter fail tracepoint message4921feb0e5
x86/nmi_watchdog: Fix old-style NMI watchdog regression on old Intel CPUs190a7f9089
sched/fair: Fix util_est UTIL_AVG_UNCHANGED handling32e22db8b2
sched/fair: Make sure to update tg contrib for blocked load4c37b062ed
sched/fair: Keep load_avg and load_sum syncedc64a3be39f
perf: Fix data race between pin_count increment/decremente0b518a2eb
gpio: wcd934x: Fix shift-out-of-bounds error56a388a9cc
phy: ti: Fix an error code in wiz_probe()62d891861f
ASoC: meson: gx-card: fix sound-dai dt schema0e2c9aeb00
ASoC: core: Fix Null-point-dereference in fmt_single_name()d83075c25a
phy: cadence: Sierra: Fix error return code in cdns_sierra_phy_probe()c9cb5837e9
tools/bootconfig: Fix error return code in apply_xbc()16ccdcdfe6
vmlinux.lds.h: Avoid orphan section with !SMPc25ec6386a
ARM: cpuidle: Avoid orphan section warningcb1aa1da04
RDMA/mlx4: Do not map the core_clock page to user space unless enabled67cf4e447b
RDMA/ipoib: Fix warning caused by destroying non-initial netnsfd681a8c7a
drm/msm/a6xx: avoid shadow NULL reference in failure path0bc79f4b7a
drm/msm/a6xx: update/fix CP_PROTECT initialization5b7dc8329d
drm/msm/a6xx: fix incorrectly set uavflagprd_inv field for A6505a61f69da3
drm/mcde: Fix off by 10^3 in calculationd688892980
usb: typec: mux: Fix copy-paste mistake in typec_mux_match9e0677c2e3
usb: dwc3: gadget: Disable gadget IRQ during pullup disablecc440da4aa
phy: usb: Fix misuse of IS_ENABLEDaafc51fddf
regulator: rtmv20: Fix .set_current_limit/.get_current_limit callbacks4579f65176
regulator: bd71828: Fix .n_voltages settings5a5f5cfb5f
regulator: fan53880: Fix missing n_voltages settingc365ff9761
regulator: bd718x7: Fix the BUCK7 voltage setting on BD71837e3a502abf5
regulator: max77620: Use device_set_of_node_from_dev()06653ebc0a
regulator: core: resolve supply for boot-on/always-on regulators7dcdfa28e1
usb: typec: tcpm: cancel frs hrtimer when unregister tcpm port18eaf0de50
usb: typec: tcpm: cancel vdm and state machine hrtimer when unregister tcpm portb972eff874
usb: fix various gadget panics on 10gbps cabling4b289a0f30
usb: fix various gadgets null ptr deref on 10gbps cabling.6bf8ff7d05
usb: gadget: eem: fix wrong eem header operation21bee94fb9
USB: serial: cp210x: fix alternate function for CP2102N QFN204fa815beea
USB: serial: quatech2: fix control-request directionsef91a6bd94
USB: serial: omninet: add device id for Zyxel Omni 56K Plus1e2d41c17f
USB: serial: ftdi_sio: add NovaTech OrionMX product ID5cead89696
usb: gadget: f_fs: Ensure io_completion_wq is idle during unbind0b3bb7950e
usb: typec: intel_pmc_mux: Add missed error check for devm_ioremap_resource()6900ef1b10
usb: typec: intel_pmc_mux: Put fwnode in error case during ->probe()572de10087
usb: typec: ucsi: Clear PPM capability data in ucsi_init() error path7cee4344cb
usb: typec: wcove: Use LE to CPU conversion when accessing msg->header199af8a06d
usb: musb: fix MUSB_QUIRK_B_DISCONNECT_99 handling4704036391
usb: dwc3: ep0: fix NULL pointer exception851dee5a5d
usb: dwc3: gadget: Bail from dwc3_gadget_exit() if dwc->gadget is NULL2af93b437a
usb: dwc3: meson-g12a: Disable the regulator in the error handling path of the probe750a0d7556
usb: dwc3-meson-g12a: fix usb2 PHY glue init when phy0 is disabledb452e8bb7c
usb: pd: Set PD_T_SINK_WAIT_CAP to 310ms0ff5f83ae1
usb: f_ncm: only first packet of aggregate needs to start timer0f5a20b1fd
USB: f_ncm: ncm_bitrate (speed) is unsigned1bf2c28ab2
mmc: renesas_sdhi: Fix HS400 on R-Car M3-W+67aca230ca
mmc: renesas_sdhi: abort tuning when timeout detected9752438476
ftrace: Do not blindly read the ip address in ftrace_bug()74d3b20b1b
cgroup1: don't allow '\n' in renaming31fe243a63
btrfs: promote debugging asserts to full-fledged checks in validate_superca69dc891b
btrfs: return value from btrfs_mark_extent_written() in case of errorbf240fee5b
async_xor: check src_offs is not NULL before updating it8d5c0f6b7a
staging: rtl8723bs: Fix uninitialized variables7af299b977
kvm: avoid speculation-based attacks from out-of-range memslot accesses6b6ff4d1f3
KVM: X86: MMU: Use the correct inherited permissions to get shadow page14831b7956
perf/x86/intel/uncore: Fix M2M event umask for Ice Lake serveraa8591a58c
drm: Lock pointer access in drm_master_release()491d52e007
drm: Fix use-after-free read in drm_getunique()afd87792db
Revert "ACPI: sleep: Put the FACS table after using it"82a8ffba54
spi: bcm2835: Fix out-of-bounds access with more than 4 slaves05e6b71594
ALSA: hda/realtek: fix mute/micmute LEDs for HP ZBook Power G8d62d55f394
ALSA: hda/realtek: fix mute/micmute LEDs for HP EliteBook 840 Aero G85573068067
ALSA: hda/realtek: fix mute/micmute LEDs and speaker for HP EliteBook x360 1040 G8bd0fe358d1
ALSA: hda/realtek: fix mute/micmute LEDs and speaker for HP Elite Dragonfly G26a81e47788
ALSA: hda/realtek: headphone and mic don't work on an Acer laptop98f842951f
ALSA: firewire-lib: fix the context to call snd_pcm_stop_xrun()bd7d88b087
ALSA: seq: Fix race of snd_seq_timer_open()fff6af6dea
i2c: mpc: implement erratum A-004447 workaroundd78b76af9f
i2c: mpc: Make use of i2c_recover_bus()fa05ba6196
spi: Cleanup on failure of initial setup0c4d4de2da
spi: Don't have controller clean up spi device before driver unbind3a5b982463
powerpc/fsl: set fsl,i2c-erratum-a004447 flag for P1010 i2c controllersa7c3c17867
powerpc/fsl: set fsl,i2c-erratum-a004447 flag for P2041 i2c controllers590f718a64
nvmet: fix false keep-alive timeout when a controller is torn down2538f06f94
nvme-tcp: remove incorrect Kconfig dep in BLK_DEV_NVMEb0308804b2
bnx2x: Fix missing error code in bnx2x_iov_init_one()90547d5db5
dm verity: fix require_signatures module_param permissions7519ece673
MIPS: Fix kernel hang under FUNCTION_GRAPH_TRACER and PREEMPT_TRACER37a079a6ae
nvme-fabrics: decode host pathing error for connectf42afc0f29
net: dsa: microchip: enable phy errata workaround on 9567ee144b7980
net: appletalk: cops: Fix data race in cops_probe1a385cbf31e
net: macb: ensure the device is available before accessing GEMGXL control registersbbb48789b6
scsi: target: qla2xxx: Wait for stop_phase1 at WWN removal1676363528
scsi: hisi_sas: Drop free_irq() of devm_request_irq() allocated irqeac1d159b7
scsi: vmw_pvscsi: Set correct residual data length30030c6ff3
scsi: bnx2fc: Return failure if io_req is already in ABTS processing8d717c9135
net:sfc: fix non-freed irq in legacy irq modee806df71ee
RDS tcp loopback connection can hang4353eb4218
net/qla3xxx: fix schedule while atomic in ql_sem_spinlockad241cb1cf
wq: handle VM suspension in stall detection5ca472d40e
cgroup: disable controllers at parse timebe23c4af3d
net: mdiobus: get rid of a BUG_ON()1d6d43d480
netlink: disable IRQs for netlink_lock_table()42e4900138
bonding: init notify_work earlier to avoid uninitialized use143fc72209
isdn: mISDN: netjet: Fix crash in nj_probe:2e2145ccfb
usb: chipidea: udc: assign interrupt number to USB gadget structure06e84ea1f4
spi: sprd: Add missing MODULE_DEVICE_TABLE369f3caa4d
ASoC: sti-sas: add missing MODULE_DEVICE_TABLE01905f3232
vfio-ccw: Serialize FSM IDLE state with I/O completioncad3dc73c0
vfio-ccw: Reset FSM state to IDLE inside FSM4352209ed0
ASoC: Intel: bytcr_rt5640: Add quirk for the Lenovo Miix 3-830 tableta5ee8f54d0
ASoC: Intel: bytcr_rt5640: Add quirk for the Glavey TM800A550L tablet2f523cd4a9
usb: cdns3: Fix runtime PM imbalance on error1e5cab5020
net/nfc/rawsock.c: fix a permission check bug584b2c7ce2
bpf: Forbid trampoline attach for functions with variable argumentsfb91ab403e
spi: spi-zynq-qspi: Fix stack violation bug4b8b7bc3a7
spi: Fix spi device unregister flowcb24d57ad5
ASoC: amd: fix for pcm_read() error3b89db7468
ASoC: max98088: fix ni clock divider calculationf70102cb36
proc: Track /proc/$pid/attr/ opener mm_struct3c79e1658f
Merge branch 'android12-5.10' 'android12-5.10-lts'2935d31616
Merge branch 'android12-5.10' 'android12-5.10-lts'3956bf29b2
ANDROID: clang: update to 12.0.5f9761818fe
ANDROID: GKI: Refresh ABI following trimmed symbol CRC fixe913e8a922
FROMLIST: export: Make CRCs robust to symbol trimmingb0c3c31639
Merge branch 'android12-5.10' into android12-5.10-ltse9fa24e154
ANDROID: Add GKI_HIDDEN_MM_CONFIGS to support ballooning. Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: I4cb43e42abd29006bab26b7e65ecfa052e10eed9
8904 lines
225 KiB
C
8904 lines
225 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* kernel/sched/core.c
|
|
*
|
|
* Core kernel scheduler code and related syscalls
|
|
*
|
|
* Copyright (C) 1991-2002 Linus Torvalds
|
|
*/
|
|
#define CREATE_TRACE_POINTS
|
|
#include <trace/events/sched.h>
|
|
#undef CREATE_TRACE_POINTS
|
|
|
|
#include "sched.h"
|
|
|
|
#include <linux/nospec.h>
|
|
|
|
#include <linux/kcov.h>
|
|
#include <linux/scs.h>
|
|
|
|
#include <asm/switch_to.h>
|
|
#include <asm/tlb.h>
|
|
|
|
#include "../workqueue_internal.h"
|
|
#include "../../fs/io-wq.h"
|
|
#include "../smpboot.h"
|
|
|
|
#include "pelt.h"
|
|
#include "smp.h"
|
|
|
|
#include <trace/hooks/sched.h>
|
|
#include <trace/hooks/dtask.h>
|
|
|
|
/*
|
|
* Export tracepoints that act as a bare tracehook (ie: have no trace event
|
|
* associated with them) to allow external modules to probe them.
|
|
*/
|
|
EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_cfs_tp);
|
|
EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_rt_tp);
|
|
EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_dl_tp);
|
|
EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_irq_tp);
|
|
EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_se_tp);
|
|
EXPORT_TRACEPOINT_SYMBOL_GPL(sched_cpu_capacity_tp);
|
|
EXPORT_TRACEPOINT_SYMBOL_GPL(sched_overutilized_tp);
|
|
EXPORT_TRACEPOINT_SYMBOL_GPL(sched_util_est_cfs_tp);
|
|
EXPORT_TRACEPOINT_SYMBOL_GPL(sched_util_est_se_tp);
|
|
EXPORT_TRACEPOINT_SYMBOL_GPL(sched_update_nr_running_tp);
|
|
EXPORT_TRACEPOINT_SYMBOL_GPL(sched_switch);
|
|
EXPORT_TRACEPOINT_SYMBOL_GPL(sched_waking);
|
|
#ifdef CONFIG_SCHEDSTATS
|
|
EXPORT_TRACEPOINT_SYMBOL_GPL(sched_stat_sleep);
|
|
EXPORT_TRACEPOINT_SYMBOL_GPL(sched_stat_wait);
|
|
EXPORT_TRACEPOINT_SYMBOL_GPL(sched_stat_iowait);
|
|
EXPORT_TRACEPOINT_SYMBOL_GPL(sched_stat_blocked);
|
|
#endif
|
|
|
|
DEFINE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues);
|
|
EXPORT_SYMBOL_GPL(runqueues);
|
|
|
|
#ifdef CONFIG_SCHED_DEBUG
|
|
/*
|
|
* Debugging: various feature bits
|
|
*
|
|
* If SCHED_DEBUG is disabled, each compilation unit has its own copy of
|
|
* sysctl_sched_features, defined in sched.h, to allow constants propagation
|
|
* at compile time and compiler optimization based on features default.
|
|
*/
|
|
#define SCHED_FEAT(name, enabled) \
|
|
(1UL << __SCHED_FEAT_##name) * enabled |
|
|
const_debug unsigned int sysctl_sched_features =
|
|
#include "features.h"
|
|
0;
|
|
EXPORT_SYMBOL_GPL(sysctl_sched_features);
|
|
#undef SCHED_FEAT
|
|
#endif
|
|
|
|
/*
|
|
* Number of tasks to iterate in a single balance run.
|
|
* Limited because this is done with IRQs disabled.
|
|
*/
|
|
const_debug unsigned int sysctl_sched_nr_migrate = 32;
|
|
|
|
/*
|
|
* period over which we measure -rt task CPU usage in us.
|
|
* default: 1s
|
|
*/
|
|
unsigned int sysctl_sched_rt_period = 1000000;
|
|
|
|
__read_mostly int scheduler_running;
|
|
|
|
/*
|
|
* part of the period that we allow rt tasks to run in us.
|
|
* default: 0.95s
|
|
*/
|
|
int sysctl_sched_rt_runtime = 950000;
|
|
|
|
|
|
/*
|
|
* Serialization rules:
|
|
*
|
|
* Lock order:
|
|
*
|
|
* p->pi_lock
|
|
* rq->lock
|
|
* hrtimer_cpu_base->lock (hrtimer_start() for bandwidth controls)
|
|
*
|
|
* rq1->lock
|
|
* rq2->lock where: rq1 < rq2
|
|
*
|
|
* Regular state:
|
|
*
|
|
* Normal scheduling state is serialized by rq->lock. __schedule() takes the
|
|
* local CPU's rq->lock, it optionally removes the task from the runqueue and
|
|
* always looks at the local rq data structures to find the most elegible task
|
|
* to run next.
|
|
*
|
|
* Task enqueue is also under rq->lock, possibly taken from another CPU.
|
|
* Wakeups from another LLC domain might use an IPI to transfer the enqueue to
|
|
* the local CPU to avoid bouncing the runqueue state around [ see
|
|
* ttwu_queue_wakelist() ]
|
|
*
|
|
* Task wakeup, specifically wakeups that involve migration, are horribly
|
|
* complicated to avoid having to take two rq->locks.
|
|
*
|
|
* Special state:
|
|
*
|
|
* System-calls and anything external will use task_rq_lock() which acquires
|
|
* both p->pi_lock and rq->lock. As a consequence the state they change is
|
|
* stable while holding either lock:
|
|
*
|
|
* - sched_setaffinity()/
|
|
* set_cpus_allowed_ptr(): p->cpus_ptr, p->nr_cpus_allowed
|
|
* - set_user_nice(): p->se.load, p->*prio
|
|
* - __sched_setscheduler(): p->sched_class, p->policy, p->*prio,
|
|
* p->se.load, p->rt_priority,
|
|
* p->dl.dl_{runtime, deadline, period, flags, bw, density}
|
|
* - sched_setnuma(): p->numa_preferred_nid
|
|
* - sched_move_task()/
|
|
* cpu_cgroup_fork(): p->sched_task_group
|
|
* - uclamp_update_active() p->uclamp*
|
|
*
|
|
* p->state <- TASK_*:
|
|
*
|
|
* is changed locklessly using set_current_state(), __set_current_state() or
|
|
* set_special_state(), see their respective comments, or by
|
|
* try_to_wake_up(). This latter uses p->pi_lock to serialize against
|
|
* concurrent self.
|
|
*
|
|
* p->on_rq <- { 0, 1 = TASK_ON_RQ_QUEUED, 2 = TASK_ON_RQ_MIGRATING }:
|
|
*
|
|
* is set by activate_task() and cleared by deactivate_task(), under
|
|
* rq->lock. Non-zero indicates the task is runnable, the special
|
|
* ON_RQ_MIGRATING state is used for migration without holding both
|
|
* rq->locks. It indicates task_cpu() is not stable, see task_rq_lock().
|
|
*
|
|
* p->on_cpu <- { 0, 1 }:
|
|
*
|
|
* is set by prepare_task() and cleared by finish_task() such that it will be
|
|
* set before p is scheduled-in and cleared after p is scheduled-out, both
|
|
* under rq->lock. Non-zero indicates the task is running on its CPU.
|
|
*
|
|
* [ The astute reader will observe that it is possible for two tasks on one
|
|
* CPU to have ->on_cpu = 1 at the same time. ]
|
|
*
|
|
* task_cpu(p): is changed by set_task_cpu(), the rules are:
|
|
*
|
|
* - Don't call set_task_cpu() on a blocked task:
|
|
*
|
|
* We don't care what CPU we're not running on, this simplifies hotplug,
|
|
* the CPU assignment of blocked tasks isn't required to be valid.
|
|
*
|
|
* - for try_to_wake_up(), called under p->pi_lock:
|
|
*
|
|
* This allows try_to_wake_up() to only take one rq->lock, see its comment.
|
|
*
|
|
* - for migration called under rq->lock:
|
|
* [ see task_on_rq_migrating() in task_rq_lock() ]
|
|
*
|
|
* o move_queued_task()
|
|
* o detach_task()
|
|
*
|
|
* - for migration called under double_rq_lock():
|
|
*
|
|
* o __migrate_swap_task()
|
|
* o push_rt_task() / pull_rt_task()
|
|
* o push_dl_task() / pull_dl_task()
|
|
* o dl_task_offline_migration()
|
|
*
|
|
*/
|
|
|
|
/*
|
|
* __task_rq_lock - lock the rq @p resides on.
|
|
*/
|
|
struct rq *__task_rq_lock(struct task_struct *p, struct rq_flags *rf)
|
|
__acquires(rq->lock)
|
|
{
|
|
struct rq *rq;
|
|
|
|
lockdep_assert_held(&p->pi_lock);
|
|
|
|
for (;;) {
|
|
rq = task_rq(p);
|
|
raw_spin_lock(&rq->lock);
|
|
if (likely(rq == task_rq(p) && !task_on_rq_migrating(p))) {
|
|
rq_pin_lock(rq, rf);
|
|
return rq;
|
|
}
|
|
raw_spin_unlock(&rq->lock);
|
|
|
|
while (unlikely(task_on_rq_migrating(p)))
|
|
cpu_relax();
|
|
}
|
|
}
|
|
EXPORT_SYMBOL_GPL(__task_rq_lock);
|
|
|
|
/*
|
|
* task_rq_lock - lock p->pi_lock and lock the rq @p resides on.
|
|
*/
|
|
struct rq *task_rq_lock(struct task_struct *p, struct rq_flags *rf)
|
|
__acquires(p->pi_lock)
|
|
__acquires(rq->lock)
|
|
{
|
|
struct rq *rq;
|
|
|
|
for (;;) {
|
|
raw_spin_lock_irqsave(&p->pi_lock, rf->flags);
|
|
rq = task_rq(p);
|
|
raw_spin_lock(&rq->lock);
|
|
/*
|
|
* move_queued_task() task_rq_lock()
|
|
*
|
|
* ACQUIRE (rq->lock)
|
|
* [S] ->on_rq = MIGRATING [L] rq = task_rq()
|
|
* WMB (__set_task_cpu()) ACQUIRE (rq->lock);
|
|
* [S] ->cpu = new_cpu [L] task_rq()
|
|
* [L] ->on_rq
|
|
* RELEASE (rq->lock)
|
|
*
|
|
* If we observe the old CPU in task_rq_lock(), the acquire of
|
|
* the old rq->lock will fully serialize against the stores.
|
|
*
|
|
* If we observe the new CPU in task_rq_lock(), the address
|
|
* dependency headed by '[L] rq = task_rq()' and the acquire
|
|
* will pair with the WMB to ensure we then also see migrating.
|
|
*/
|
|
if (likely(rq == task_rq(p) && !task_on_rq_migrating(p))) {
|
|
rq_pin_lock(rq, rf);
|
|
return rq;
|
|
}
|
|
raw_spin_unlock(&rq->lock);
|
|
raw_spin_unlock_irqrestore(&p->pi_lock, rf->flags);
|
|
|
|
while (unlikely(task_on_rq_migrating(p)))
|
|
cpu_relax();
|
|
}
|
|
}
|
|
EXPORT_SYMBOL_GPL(task_rq_lock);
|
|
|
|
/*
|
|
* RQ-clock updating methods:
|
|
*/
|
|
|
|
static void update_rq_clock_task(struct rq *rq, s64 delta)
|
|
{
|
|
/*
|
|
* In theory, the compile should just see 0 here, and optimize out the call
|
|
* to sched_rt_avg_update. But I don't trust it...
|
|
*/
|
|
s64 __maybe_unused steal = 0, irq_delta = 0;
|
|
|
|
#ifdef CONFIG_IRQ_TIME_ACCOUNTING
|
|
irq_delta = irq_time_read(cpu_of(rq)) - rq->prev_irq_time;
|
|
|
|
/*
|
|
* Since irq_time is only updated on {soft,}irq_exit, we might run into
|
|
* this case when a previous update_rq_clock() happened inside a
|
|
* {soft,}irq region.
|
|
*
|
|
* When this happens, we stop ->clock_task and only update the
|
|
* prev_irq_time stamp to account for the part that fit, so that a next
|
|
* update will consume the rest. This ensures ->clock_task is
|
|
* monotonic.
|
|
*
|
|
* It does however cause some slight miss-attribution of {soft,}irq
|
|
* time, a more accurate solution would be to update the irq_time using
|
|
* the current rq->clock timestamp, except that would require using
|
|
* atomic ops.
|
|
*/
|
|
if (irq_delta > delta)
|
|
irq_delta = delta;
|
|
|
|
rq->prev_irq_time += irq_delta;
|
|
delta -= irq_delta;
|
|
#endif
|
|
#ifdef CONFIG_PARAVIRT_TIME_ACCOUNTING
|
|
if (static_key_false((¶virt_steal_rq_enabled))) {
|
|
steal = paravirt_steal_clock(cpu_of(rq));
|
|
steal -= rq->prev_steal_time_rq;
|
|
|
|
if (unlikely(steal > delta))
|
|
steal = delta;
|
|
|
|
rq->prev_steal_time_rq += steal;
|
|
delta -= steal;
|
|
}
|
|
#endif
|
|
|
|
rq->clock_task += delta;
|
|
|
|
#ifdef CONFIG_HAVE_SCHED_AVG_IRQ
|
|
if ((irq_delta + steal) && sched_feat(NONTASK_CAPACITY))
|
|
update_irq_load_avg(rq, irq_delta + steal);
|
|
#endif
|
|
update_rq_clock_pelt(rq, delta);
|
|
}
|
|
|
|
void update_rq_clock(struct rq *rq)
|
|
{
|
|
s64 delta;
|
|
|
|
lockdep_assert_held(&rq->lock);
|
|
|
|
if (rq->clock_update_flags & RQCF_ACT_SKIP)
|
|
return;
|
|
|
|
#ifdef CONFIG_SCHED_DEBUG
|
|
if (sched_feat(WARN_DOUBLE_CLOCK))
|
|
SCHED_WARN_ON(rq->clock_update_flags & RQCF_UPDATED);
|
|
rq->clock_update_flags |= RQCF_UPDATED;
|
|
#endif
|
|
|
|
delta = sched_clock_cpu(cpu_of(rq)) - rq->clock;
|
|
if (delta < 0)
|
|
return;
|
|
rq->clock += delta;
|
|
update_rq_clock_task(rq, delta);
|
|
}
|
|
EXPORT_SYMBOL_GPL(update_rq_clock);
|
|
|
|
static inline void
|
|
rq_csd_init(struct rq *rq, struct __call_single_data *csd, smp_call_func_t func)
|
|
{
|
|
csd->flags = 0;
|
|
csd->func = func;
|
|
csd->info = rq;
|
|
}
|
|
|
|
#ifdef CONFIG_SCHED_HRTICK
|
|
/*
|
|
* Use HR-timers to deliver accurate preemption points.
|
|
*/
|
|
|
|
static void hrtick_clear(struct rq *rq)
|
|
{
|
|
if (hrtimer_active(&rq->hrtick_timer))
|
|
hrtimer_cancel(&rq->hrtick_timer);
|
|
}
|
|
|
|
/*
|
|
* High-resolution timer tick.
|
|
* Runs from hardirq context with interrupts disabled.
|
|
*/
|
|
static enum hrtimer_restart hrtick(struct hrtimer *timer)
|
|
{
|
|
struct rq *rq = container_of(timer, struct rq, hrtick_timer);
|
|
struct rq_flags rf;
|
|
|
|
WARN_ON_ONCE(cpu_of(rq) != smp_processor_id());
|
|
|
|
rq_lock(rq, &rf);
|
|
update_rq_clock(rq);
|
|
rq->curr->sched_class->task_tick(rq, rq->curr, 1);
|
|
rq_unlock(rq, &rf);
|
|
|
|
return HRTIMER_NORESTART;
|
|
}
|
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
static void __hrtick_restart(struct rq *rq)
|
|
{
|
|
struct hrtimer *timer = &rq->hrtick_timer;
|
|
ktime_t time = rq->hrtick_time;
|
|
|
|
hrtimer_start(timer, time, HRTIMER_MODE_ABS_PINNED_HARD);
|
|
}
|
|
|
|
/*
|
|
* called from hardirq (IPI) context
|
|
*/
|
|
static void __hrtick_start(void *arg)
|
|
{
|
|
struct rq *rq = arg;
|
|
struct rq_flags rf;
|
|
|
|
rq_lock(rq, &rf);
|
|
__hrtick_restart(rq);
|
|
rq_unlock(rq, &rf);
|
|
}
|
|
|
|
/*
|
|
* Called to set the hrtick timer state.
|
|
*
|
|
* called with rq->lock held and irqs disabled
|
|
*/
|
|
void hrtick_start(struct rq *rq, u64 delay)
|
|
{
|
|
struct hrtimer *timer = &rq->hrtick_timer;
|
|
s64 delta;
|
|
|
|
/*
|
|
* Don't schedule slices shorter than 10000ns, that just
|
|
* doesn't make sense and can cause timer DoS.
|
|
*/
|
|
delta = max_t(s64, delay, 10000LL);
|
|
rq->hrtick_time = ktime_add_ns(timer->base->get_time(), delta);
|
|
|
|
if (rq == this_rq())
|
|
__hrtick_restart(rq);
|
|
else
|
|
smp_call_function_single_async(cpu_of(rq), &rq->hrtick_csd);
|
|
}
|
|
|
|
#else
|
|
/*
|
|
* Called to set the hrtick timer state.
|
|
*
|
|
* called with rq->lock held and irqs disabled
|
|
*/
|
|
void hrtick_start(struct rq *rq, u64 delay)
|
|
{
|
|
/*
|
|
* Don't schedule slices shorter than 10000ns, that just
|
|
* doesn't make sense. Rely on vruntime for fairness.
|
|
*/
|
|
delay = max_t(u64, delay, 10000LL);
|
|
hrtimer_start(&rq->hrtick_timer, ns_to_ktime(delay),
|
|
HRTIMER_MODE_REL_PINNED_HARD);
|
|
}
|
|
|
|
#endif /* CONFIG_SMP */
|
|
|
|
static void hrtick_rq_init(struct rq *rq)
|
|
{
|
|
#ifdef CONFIG_SMP
|
|
rq_csd_init(rq, &rq->hrtick_csd, __hrtick_start);
|
|
#endif
|
|
hrtimer_init(&rq->hrtick_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD);
|
|
rq->hrtick_timer.function = hrtick;
|
|
}
|
|
#else /* CONFIG_SCHED_HRTICK */
|
|
static inline void hrtick_clear(struct rq *rq)
|
|
{
|
|
}
|
|
|
|
static inline void hrtick_rq_init(struct rq *rq)
|
|
{
|
|
}
|
|
#endif /* CONFIG_SCHED_HRTICK */
|
|
|
|
/*
|
|
* cmpxchg based fetch_or, macro so it works for different integer types
|
|
*/
|
|
#define fetch_or(ptr, mask) \
|
|
({ \
|
|
typeof(ptr) _ptr = (ptr); \
|
|
typeof(mask) _mask = (mask); \
|
|
typeof(*_ptr) _old, _val = *_ptr; \
|
|
\
|
|
for (;;) { \
|
|
_old = cmpxchg(_ptr, _val, _val | _mask); \
|
|
if (_old == _val) \
|
|
break; \
|
|
_val = _old; \
|
|
} \
|
|
_old; \
|
|
})
|
|
|
|
#if defined(CONFIG_SMP) && defined(TIF_POLLING_NRFLAG)
|
|
/*
|
|
* Atomically set TIF_NEED_RESCHED and test for TIF_POLLING_NRFLAG,
|
|
* this avoids any races wrt polling state changes and thereby avoids
|
|
* spurious IPIs.
|
|
*/
|
|
static bool set_nr_and_not_polling(struct task_struct *p)
|
|
{
|
|
struct thread_info *ti = task_thread_info(p);
|
|
return !(fetch_or(&ti->flags, _TIF_NEED_RESCHED) & _TIF_POLLING_NRFLAG);
|
|
}
|
|
|
|
/*
|
|
* Atomically set TIF_NEED_RESCHED if TIF_POLLING_NRFLAG is set.
|
|
*
|
|
* If this returns true, then the idle task promises to call
|
|
* sched_ttwu_pending() and reschedule soon.
|
|
*/
|
|
static bool set_nr_if_polling(struct task_struct *p)
|
|
{
|
|
struct thread_info *ti = task_thread_info(p);
|
|
typeof(ti->flags) old, val = READ_ONCE(ti->flags);
|
|
|
|
for (;;) {
|
|
if (!(val & _TIF_POLLING_NRFLAG))
|
|
return false;
|
|
if (val & _TIF_NEED_RESCHED)
|
|
return true;
|
|
old = cmpxchg(&ti->flags, val, val | _TIF_NEED_RESCHED);
|
|
if (old == val)
|
|
break;
|
|
val = old;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
#else
|
|
static bool set_nr_and_not_polling(struct task_struct *p)
|
|
{
|
|
set_tsk_need_resched(p);
|
|
return true;
|
|
}
|
|
|
|
#ifdef CONFIG_SMP
|
|
static bool set_nr_if_polling(struct task_struct *p)
|
|
{
|
|
return false;
|
|
}
|
|
#endif
|
|
#endif
|
|
|
|
static bool __wake_q_add(struct wake_q_head *head, struct task_struct *task)
|
|
{
|
|
struct wake_q_node *node = &task->wake_q;
|
|
|
|
/*
|
|
* Atomically grab the task, if ->wake_q is !nil already it means
|
|
* its already queued (either by us or someone else) and will get the
|
|
* wakeup due to that.
|
|
*
|
|
* In order to ensure that a pending wakeup will observe our pending
|
|
* state, even in the failed case, an explicit smp_mb() must be used.
|
|
*/
|
|
smp_mb__before_atomic();
|
|
if (unlikely(cmpxchg_relaxed(&node->next, NULL, WAKE_Q_TAIL)))
|
|
return false;
|
|
|
|
/*
|
|
* The head is context local, there can be no concurrency.
|
|
*/
|
|
*head->lastp = node;
|
|
head->lastp = &node->next;
|
|
head->count++;
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* wake_q_add() - queue a wakeup for 'later' waking.
|
|
* @head: the wake_q_head to add @task to
|
|
* @task: the task to queue for 'later' wakeup
|
|
*
|
|
* Queue a task for later wakeup, most likely by the wake_up_q() call in the
|
|
* same context, _HOWEVER_ this is not guaranteed, the wakeup can come
|
|
* instantly.
|
|
*
|
|
* This function must be used as-if it were wake_up_process(); IOW the task
|
|
* must be ready to be woken at this location.
|
|
*/
|
|
void wake_q_add(struct wake_q_head *head, struct task_struct *task)
|
|
{
|
|
if (__wake_q_add(head, task))
|
|
get_task_struct(task);
|
|
}
|
|
|
|
/**
|
|
* wake_q_add_safe() - safely queue a wakeup for 'later' waking.
|
|
* @head: the wake_q_head to add @task to
|
|
* @task: the task to queue for 'later' wakeup
|
|
*
|
|
* Queue a task for later wakeup, most likely by the wake_up_q() call in the
|
|
* same context, _HOWEVER_ this is not guaranteed, the wakeup can come
|
|
* instantly.
|
|
*
|
|
* This function must be used as-if it were wake_up_process(); IOW the task
|
|
* must be ready to be woken at this location.
|
|
*
|
|
* This function is essentially a task-safe equivalent to wake_q_add(). Callers
|
|
* that already hold reference to @task can call the 'safe' version and trust
|
|
* wake_q to do the right thing depending whether or not the @task is already
|
|
* queued for wakeup.
|
|
*/
|
|
void wake_q_add_safe(struct wake_q_head *head, struct task_struct *task)
|
|
{
|
|
if (!__wake_q_add(head, task))
|
|
put_task_struct(task);
|
|
}
|
|
|
|
void wake_up_q(struct wake_q_head *head)
|
|
{
|
|
struct wake_q_node *node = head->first;
|
|
|
|
while (node != WAKE_Q_TAIL) {
|
|
struct task_struct *task;
|
|
|
|
task = container_of(node, struct task_struct, wake_q);
|
|
BUG_ON(!task);
|
|
/* Task can safely be re-inserted now: */
|
|
node = node->next;
|
|
task->wake_q.next = NULL;
|
|
task->wake_q_count = head->count;
|
|
|
|
/*
|
|
* wake_up_process() executes a full barrier, which pairs with
|
|
* the queueing in wake_q_add() so as not to miss wakeups.
|
|
*/
|
|
wake_up_process(task);
|
|
task->wake_q_count = 0;
|
|
put_task_struct(task);
|
|
}
|
|
}
|
|
|
|
/*
|
|
* resched_curr - mark rq's current task 'to be rescheduled now'.
|
|
*
|
|
* On UP this means the setting of the need_resched flag, on SMP it
|
|
* might also involve a cross-CPU call to trigger the scheduler on
|
|
* the target CPU.
|
|
*/
|
|
void resched_curr(struct rq *rq)
|
|
{
|
|
struct task_struct *curr = rq->curr;
|
|
int cpu;
|
|
|
|
lockdep_assert_held(&rq->lock);
|
|
|
|
if (test_tsk_need_resched(curr))
|
|
return;
|
|
|
|
cpu = cpu_of(rq);
|
|
|
|
if (cpu == smp_processor_id()) {
|
|
set_tsk_need_resched(curr);
|
|
set_preempt_need_resched();
|
|
return;
|
|
}
|
|
|
|
if (set_nr_and_not_polling(curr))
|
|
smp_send_reschedule(cpu);
|
|
else
|
|
trace_sched_wake_idle_without_ipi(cpu);
|
|
}
|
|
EXPORT_SYMBOL_GPL(resched_curr);
|
|
|
|
void resched_cpu(int cpu)
|
|
{
|
|
struct rq *rq = cpu_rq(cpu);
|
|
unsigned long flags;
|
|
|
|
raw_spin_lock_irqsave(&rq->lock, flags);
|
|
if (cpu_online(cpu) || cpu == smp_processor_id())
|
|
resched_curr(rq);
|
|
raw_spin_unlock_irqrestore(&rq->lock, flags);
|
|
}
|
|
|
|
#ifdef CONFIG_SMP
|
|
#ifdef CONFIG_NO_HZ_COMMON
|
|
/*
|
|
* In the semi idle case, use the nearest busy CPU for migrating timers
|
|
* from an idle CPU. This is good for power-savings.
|
|
*
|
|
* We don't do similar optimization for completely idle system, as
|
|
* selecting an idle CPU will add more delays to the timers than intended
|
|
* (as that CPU's timer base may not be uptodate wrt jiffies etc).
|
|
*/
|
|
int get_nohz_timer_target(void)
|
|
{
|
|
int i, cpu = smp_processor_id(), default_cpu = -1;
|
|
struct sched_domain *sd;
|
|
|
|
if (housekeeping_cpu(cpu, HK_FLAG_TIMER) && cpu_active(cpu)) {
|
|
if (!idle_cpu(cpu))
|
|
return cpu;
|
|
default_cpu = cpu;
|
|
}
|
|
|
|
rcu_read_lock();
|
|
for_each_domain(cpu, sd) {
|
|
for_each_cpu_and(i, sched_domain_span(sd),
|
|
housekeeping_cpumask(HK_FLAG_TIMER)) {
|
|
if (cpu == i)
|
|
continue;
|
|
|
|
if (!idle_cpu(i)) {
|
|
cpu = i;
|
|
goto unlock;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (default_cpu == -1) {
|
|
for_each_cpu_and(i, cpu_active_mask,
|
|
housekeeping_cpumask(HK_FLAG_TIMER)) {
|
|
if (cpu == i)
|
|
continue;
|
|
|
|
if (!idle_cpu(i)) {
|
|
cpu = i;
|
|
goto unlock;
|
|
}
|
|
}
|
|
|
|
/* no active, not-idle, housekpeeing CPU found. */
|
|
default_cpu = cpumask_any(cpu_active_mask);
|
|
|
|
if (unlikely(default_cpu >= nr_cpu_ids))
|
|
goto unlock;
|
|
}
|
|
|
|
cpu = default_cpu;
|
|
unlock:
|
|
rcu_read_unlock();
|
|
return cpu;
|
|
}
|
|
|
|
/*
|
|
* When add_timer_on() enqueues a timer into the timer wheel of an
|
|
* idle CPU then this timer might expire before the next timer event
|
|
* which is scheduled to wake up that CPU. In case of a completely
|
|
* idle system the next event might even be infinite time into the
|
|
* future. wake_up_idle_cpu() ensures that the CPU is woken up and
|
|
* leaves the inner idle loop so the newly added timer is taken into
|
|
* account when the CPU goes back to idle and evaluates the timer
|
|
* wheel for the next timer event.
|
|
*/
|
|
static void wake_up_idle_cpu(int cpu)
|
|
{
|
|
struct rq *rq = cpu_rq(cpu);
|
|
|
|
if (cpu == smp_processor_id())
|
|
return;
|
|
|
|
if (set_nr_and_not_polling(rq->idle))
|
|
smp_send_reschedule(cpu);
|
|
else
|
|
trace_sched_wake_idle_without_ipi(cpu);
|
|
}
|
|
|
|
static bool wake_up_full_nohz_cpu(int cpu)
|
|
{
|
|
/*
|
|
* We just need the target to call irq_exit() and re-evaluate
|
|
* the next tick. The nohz full kick at least implies that.
|
|
* If needed we can still optimize that later with an
|
|
* empty IRQ.
|
|
*/
|
|
if (cpu_is_offline(cpu))
|
|
return true; /* Don't try to wake offline CPUs. */
|
|
if (tick_nohz_full_cpu(cpu)) {
|
|
if (cpu != smp_processor_id() ||
|
|
tick_nohz_tick_stopped())
|
|
tick_nohz_full_kick_cpu(cpu);
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
/*
|
|
* Wake up the specified CPU. If the CPU is going offline, it is the
|
|
* caller's responsibility to deal with the lost wakeup, for example,
|
|
* by hooking into the CPU_DEAD notifier like timers and hrtimers do.
|
|
*/
|
|
void wake_up_nohz_cpu(int cpu)
|
|
{
|
|
if (!wake_up_full_nohz_cpu(cpu))
|
|
wake_up_idle_cpu(cpu);
|
|
}
|
|
|
|
static void nohz_csd_func(void *info)
|
|
{
|
|
struct rq *rq = info;
|
|
int cpu = cpu_of(rq);
|
|
unsigned int flags;
|
|
|
|
/*
|
|
* Release the rq::nohz_csd.
|
|
*/
|
|
flags = atomic_fetch_andnot(NOHZ_KICK_MASK, nohz_flags(cpu));
|
|
WARN_ON(!(flags & NOHZ_KICK_MASK));
|
|
|
|
rq->idle_balance = idle_cpu(cpu);
|
|
if (rq->idle_balance && !need_resched()) {
|
|
rq->nohz_idle_balance = flags;
|
|
raise_softirq_irqoff(SCHED_SOFTIRQ);
|
|
}
|
|
}
|
|
|
|
#endif /* CONFIG_NO_HZ_COMMON */
|
|
|
|
#ifdef CONFIG_NO_HZ_FULL
|
|
bool sched_can_stop_tick(struct rq *rq)
|
|
{
|
|
int fifo_nr_running;
|
|
|
|
/* Deadline tasks, even if single, need the tick */
|
|
if (rq->dl.dl_nr_running)
|
|
return false;
|
|
|
|
/*
|
|
* If there are more than one RR tasks, we need the tick to effect the
|
|
* actual RR behaviour.
|
|
*/
|
|
if (rq->rt.rr_nr_running) {
|
|
if (rq->rt.rr_nr_running == 1)
|
|
return true;
|
|
else
|
|
return false;
|
|
}
|
|
|
|
/*
|
|
* If there's no RR tasks, but FIFO tasks, we can skip the tick, no
|
|
* forced preemption between FIFO tasks.
|
|
*/
|
|
fifo_nr_running = rq->rt.rt_nr_running - rq->rt.rr_nr_running;
|
|
if (fifo_nr_running)
|
|
return true;
|
|
|
|
/*
|
|
* If there are no DL,RR/FIFO tasks, there must only be CFS tasks left;
|
|
* if there's more than one we need the tick for involuntary
|
|
* preemption.
|
|
*/
|
|
if (rq->nr_running > 1)
|
|
return false;
|
|
|
|
return true;
|
|
}
|
|
#endif /* CONFIG_NO_HZ_FULL */
|
|
#endif /* CONFIG_SMP */
|
|
|
|
#if defined(CONFIG_RT_GROUP_SCHED) || (defined(CONFIG_FAIR_GROUP_SCHED) && \
|
|
(defined(CONFIG_SMP) || defined(CONFIG_CFS_BANDWIDTH)))
|
|
/*
|
|
* Iterate task_group tree rooted at *from, calling @down when first entering a
|
|
* node and @up when leaving it for the final time.
|
|
*
|
|
* Caller must hold rcu_lock or sufficient equivalent.
|
|
*/
|
|
int walk_tg_tree_from(struct task_group *from,
|
|
tg_visitor down, tg_visitor up, void *data)
|
|
{
|
|
struct task_group *parent, *child;
|
|
int ret;
|
|
|
|
parent = from;
|
|
|
|
down:
|
|
ret = (*down)(parent, data);
|
|
if (ret)
|
|
goto out;
|
|
list_for_each_entry_rcu(child, &parent->children, siblings) {
|
|
parent = child;
|
|
goto down;
|
|
|
|
up:
|
|
continue;
|
|
}
|
|
ret = (*up)(parent, data);
|
|
if (ret || parent == from)
|
|
goto out;
|
|
|
|
child = parent;
|
|
parent = parent->parent;
|
|
if (parent)
|
|
goto up;
|
|
out:
|
|
return ret;
|
|
}
|
|
|
|
int tg_nop(struct task_group *tg, void *data)
|
|
{
|
|
return 0;
|
|
}
|
|
#endif
|
|
|
|
static void set_load_weight(struct task_struct *p, bool update_load)
|
|
{
|
|
int prio = p->static_prio - MAX_RT_PRIO;
|
|
struct load_weight *load = &p->se.load;
|
|
|
|
/*
|
|
* SCHED_IDLE tasks get minimal weight:
|
|
*/
|
|
if (task_has_idle_policy(p)) {
|
|
load->weight = scale_load(WEIGHT_IDLEPRIO);
|
|
load->inv_weight = WMULT_IDLEPRIO;
|
|
return;
|
|
}
|
|
|
|
/*
|
|
* SCHED_OTHER tasks have to update their load when changing their
|
|
* weight
|
|
*/
|
|
if (update_load && p->sched_class == &fair_sched_class) {
|
|
reweight_task(p, prio);
|
|
} else {
|
|
load->weight = scale_load(sched_prio_to_weight[prio]);
|
|
load->inv_weight = sched_prio_to_wmult[prio];
|
|
}
|
|
}
|
|
|
|
#ifdef CONFIG_UCLAMP_TASK
|
|
/*
|
|
* Serializes updates of utilization clamp values
|
|
*
|
|
* The (slow-path) user-space triggers utilization clamp value updates which
|
|
* can require updates on (fast-path) scheduler's data structures used to
|
|
* support enqueue/dequeue operations.
|
|
* While the per-CPU rq lock protects fast-path update operations, user-space
|
|
* requests are serialized using a mutex to reduce the risk of conflicting
|
|
* updates or API abuses.
|
|
*/
|
|
static DEFINE_MUTEX(uclamp_mutex);
|
|
|
|
/* Max allowed minimum utilization */
|
|
unsigned int sysctl_sched_uclamp_util_min = SCHED_CAPACITY_SCALE;
|
|
|
|
/* Max allowed maximum utilization */
|
|
unsigned int sysctl_sched_uclamp_util_max = SCHED_CAPACITY_SCALE;
|
|
|
|
/*
|
|
* By default RT tasks run at the maximum performance point/capacity of the
|
|
* system. Uclamp enforces this by always setting UCLAMP_MIN of RT tasks to
|
|
* SCHED_CAPACITY_SCALE.
|
|
*
|
|
* This knob allows admins to change the default behavior when uclamp is being
|
|
* used. In battery powered devices, particularly, running at the maximum
|
|
* capacity and frequency will increase energy consumption and shorten the
|
|
* battery life.
|
|
*
|
|
* This knob only affects RT tasks that their uclamp_se->user_defined == false.
|
|
*
|
|
* This knob will not override the system default sched_util_clamp_min defined
|
|
* above.
|
|
*/
|
|
unsigned int sysctl_sched_uclamp_util_min_rt_default = SCHED_CAPACITY_SCALE;
|
|
|
|
/* All clamps are required to be less or equal than these values */
|
|
static struct uclamp_se uclamp_default[UCLAMP_CNT];
|
|
|
|
/*
|
|
* This static key is used to reduce the uclamp overhead in the fast path. It
|
|
* primarily disables the call to uclamp_rq_{inc, dec}() in
|
|
* enqueue/dequeue_task().
|
|
*
|
|
* This allows users to continue to enable uclamp in their kernel config with
|
|
* minimum uclamp overhead in the fast path.
|
|
*
|
|
* As soon as userspace modifies any of the uclamp knobs, the static key is
|
|
* enabled, since we have an actual users that make use of uclamp
|
|
* functionality.
|
|
*
|
|
* The knobs that would enable this static key are:
|
|
*
|
|
* * A task modifying its uclamp value with sched_setattr().
|
|
* * An admin modifying the sysctl_sched_uclamp_{min, max} via procfs.
|
|
* * An admin modifying the cgroup cpu.uclamp.{min, max}
|
|
*/
|
|
DEFINE_STATIC_KEY_FALSE(sched_uclamp_used);
|
|
EXPORT_SYMBOL_GPL(sched_uclamp_used);
|
|
|
|
/* Integer rounded range for each bucket */
|
|
#define UCLAMP_BUCKET_DELTA DIV_ROUND_CLOSEST(SCHED_CAPACITY_SCALE, UCLAMP_BUCKETS)
|
|
|
|
#define for_each_clamp_id(clamp_id) \
|
|
for ((clamp_id) = 0; (clamp_id) < UCLAMP_CNT; (clamp_id)++)
|
|
|
|
static inline unsigned int uclamp_bucket_id(unsigned int clamp_value)
|
|
{
|
|
return min_t(unsigned int, clamp_value / UCLAMP_BUCKET_DELTA, UCLAMP_BUCKETS - 1);
|
|
}
|
|
|
|
static inline unsigned int uclamp_none(enum uclamp_id clamp_id)
|
|
{
|
|
if (clamp_id == UCLAMP_MIN)
|
|
return 0;
|
|
return SCHED_CAPACITY_SCALE;
|
|
}
|
|
|
|
static inline void uclamp_se_set(struct uclamp_se *uc_se,
|
|
unsigned int value, bool user_defined)
|
|
{
|
|
uc_se->value = value;
|
|
uc_se->bucket_id = uclamp_bucket_id(value);
|
|
uc_se->user_defined = user_defined;
|
|
}
|
|
|
|
static inline unsigned int
|
|
uclamp_idle_value(struct rq *rq, enum uclamp_id clamp_id,
|
|
unsigned int clamp_value)
|
|
{
|
|
/*
|
|
* Avoid blocked utilization pushing up the frequency when we go
|
|
* idle (which drops the max-clamp) by retaining the last known
|
|
* max-clamp.
|
|
*/
|
|
if (clamp_id == UCLAMP_MAX) {
|
|
rq->uclamp_flags |= UCLAMP_FLAG_IDLE;
|
|
return clamp_value;
|
|
}
|
|
|
|
return uclamp_none(UCLAMP_MIN);
|
|
}
|
|
|
|
static inline void uclamp_idle_reset(struct rq *rq, enum uclamp_id clamp_id,
|
|
unsigned int clamp_value)
|
|
{
|
|
/* Reset max-clamp retention only on idle exit */
|
|
if (!(rq->uclamp_flags & UCLAMP_FLAG_IDLE))
|
|
return;
|
|
|
|
WRITE_ONCE(rq->uclamp[clamp_id].value, clamp_value);
|
|
}
|
|
|
|
static inline
|
|
unsigned int uclamp_rq_max_value(struct rq *rq, enum uclamp_id clamp_id,
|
|
unsigned int clamp_value)
|
|
{
|
|
struct uclamp_bucket *bucket = rq->uclamp[clamp_id].bucket;
|
|
int bucket_id = UCLAMP_BUCKETS - 1;
|
|
|
|
/*
|
|
* Since both min and max clamps are max aggregated, find the
|
|
* top most bucket with tasks in.
|
|
*/
|
|
for ( ; bucket_id >= 0; bucket_id--) {
|
|
if (!bucket[bucket_id].tasks)
|
|
continue;
|
|
return bucket[bucket_id].value;
|
|
}
|
|
|
|
/* No tasks -- default clamp values */
|
|
return uclamp_idle_value(rq, clamp_id, clamp_value);
|
|
}
|
|
|
|
static void __uclamp_update_util_min_rt_default(struct task_struct *p)
|
|
{
|
|
unsigned int default_util_min;
|
|
struct uclamp_se *uc_se;
|
|
|
|
lockdep_assert_held(&p->pi_lock);
|
|
|
|
uc_se = &p->uclamp_req[UCLAMP_MIN];
|
|
|
|
/* Only sync if user didn't override the default */
|
|
if (uc_se->user_defined)
|
|
return;
|
|
|
|
default_util_min = sysctl_sched_uclamp_util_min_rt_default;
|
|
uclamp_se_set(uc_se, default_util_min, false);
|
|
}
|
|
|
|
static void uclamp_update_util_min_rt_default(struct task_struct *p)
|
|
{
|
|
struct rq_flags rf;
|
|
struct rq *rq;
|
|
|
|
if (!rt_task(p))
|
|
return;
|
|
|
|
/* Protect updates to p->uclamp_* */
|
|
rq = task_rq_lock(p, &rf);
|
|
__uclamp_update_util_min_rt_default(p);
|
|
task_rq_unlock(rq, p, &rf);
|
|
}
|
|
|
|
static void uclamp_sync_util_min_rt_default(void)
|
|
{
|
|
struct task_struct *g, *p;
|
|
|
|
/*
|
|
* copy_process() sysctl_uclamp
|
|
* uclamp_min_rt = X;
|
|
* write_lock(&tasklist_lock) read_lock(&tasklist_lock)
|
|
* // link thread smp_mb__after_spinlock()
|
|
* write_unlock(&tasklist_lock) read_unlock(&tasklist_lock);
|
|
* sched_post_fork() for_each_process_thread()
|
|
* __uclamp_sync_rt() __uclamp_sync_rt()
|
|
*
|
|
* Ensures that either sched_post_fork() will observe the new
|
|
* uclamp_min_rt or for_each_process_thread() will observe the new
|
|
* task.
|
|
*/
|
|
read_lock(&tasklist_lock);
|
|
smp_mb__after_spinlock();
|
|
read_unlock(&tasklist_lock);
|
|
|
|
rcu_read_lock();
|
|
for_each_process_thread(g, p)
|
|
uclamp_update_util_min_rt_default(p);
|
|
rcu_read_unlock();
|
|
}
|
|
|
|
static inline struct uclamp_se
|
|
uclamp_tg_restrict(struct task_struct *p, enum uclamp_id clamp_id)
|
|
{
|
|
/* Copy by value as we could modify it */
|
|
struct uclamp_se uc_req = p->uclamp_req[clamp_id];
|
|
#ifdef CONFIG_UCLAMP_TASK_GROUP
|
|
unsigned int tg_min, tg_max, value;
|
|
|
|
/*
|
|
* Tasks in autogroups or root task group will be
|
|
* restricted by system defaults.
|
|
*/
|
|
if (task_group_is_autogroup(task_group(p)))
|
|
return uc_req;
|
|
if (task_group(p) == &root_task_group)
|
|
return uc_req;
|
|
|
|
tg_min = task_group(p)->uclamp[UCLAMP_MIN].value;
|
|
tg_max = task_group(p)->uclamp[UCLAMP_MAX].value;
|
|
value = uc_req.value;
|
|
value = clamp(value, tg_min, tg_max);
|
|
uclamp_se_set(&uc_req, value, false);
|
|
#endif
|
|
|
|
return uc_req;
|
|
}
|
|
|
|
/*
|
|
* The effective clamp bucket index of a task depends on, by increasing
|
|
* priority:
|
|
* - the task specific clamp value, when explicitly requested from userspace
|
|
* - the task group effective clamp value, for tasks not either in the root
|
|
* group or in an autogroup
|
|
* - the system default clamp value, defined by the sysadmin
|
|
*/
|
|
static inline struct uclamp_se
|
|
uclamp_eff_get(struct task_struct *p, enum uclamp_id clamp_id)
|
|
{
|
|
struct uclamp_se uc_req = uclamp_tg_restrict(p, clamp_id);
|
|
struct uclamp_se uc_max = uclamp_default[clamp_id];
|
|
struct uclamp_se uc_eff;
|
|
int ret = 0;
|
|
|
|
trace_android_rvh_uclamp_eff_get(p, clamp_id, &uc_max, &uc_eff, &ret);
|
|
if (ret)
|
|
return uc_eff;
|
|
|
|
/* System default restrictions always apply */
|
|
if (unlikely(uc_req.value > uc_max.value))
|
|
return uc_max;
|
|
|
|
return uc_req;
|
|
}
|
|
|
|
unsigned long uclamp_eff_value(struct task_struct *p, enum uclamp_id clamp_id)
|
|
{
|
|
struct uclamp_se uc_eff;
|
|
|
|
/* Task currently refcounted: use back-annotated (effective) value */
|
|
if (p->uclamp[clamp_id].active)
|
|
return (unsigned long)p->uclamp[clamp_id].value;
|
|
|
|
uc_eff = uclamp_eff_get(p, clamp_id);
|
|
|
|
return (unsigned long)uc_eff.value;
|
|
}
|
|
EXPORT_SYMBOL_GPL(uclamp_eff_value);
|
|
|
|
/*
|
|
* When a task is enqueued on a rq, the clamp bucket currently defined by the
|
|
* task's uclamp::bucket_id is refcounted on that rq. This also immediately
|
|
* updates the rq's clamp value if required.
|
|
*
|
|
* Tasks can have a task-specific value requested from user-space, track
|
|
* within each bucket the maximum value for tasks refcounted in it.
|
|
* This "local max aggregation" allows to track the exact "requested" value
|
|
* for each bucket when all its RUNNABLE tasks require the same clamp.
|
|
*/
|
|
static inline void uclamp_rq_inc_id(struct rq *rq, struct task_struct *p,
|
|
enum uclamp_id clamp_id)
|
|
{
|
|
struct uclamp_rq *uc_rq = &rq->uclamp[clamp_id];
|
|
struct uclamp_se *uc_se = &p->uclamp[clamp_id];
|
|
struct uclamp_bucket *bucket;
|
|
|
|
lockdep_assert_held(&rq->lock);
|
|
|
|
/* Update task effective clamp */
|
|
p->uclamp[clamp_id] = uclamp_eff_get(p, clamp_id);
|
|
|
|
bucket = &uc_rq->bucket[uc_se->bucket_id];
|
|
bucket->tasks++;
|
|
uc_se->active = true;
|
|
|
|
uclamp_idle_reset(rq, clamp_id, uc_se->value);
|
|
|
|
/*
|
|
* Local max aggregation: rq buckets always track the max
|
|
* "requested" clamp value of its RUNNABLE tasks.
|
|
*/
|
|
if (bucket->tasks == 1 || uc_se->value > bucket->value)
|
|
bucket->value = uc_se->value;
|
|
|
|
if (uc_se->value > READ_ONCE(uc_rq->value))
|
|
WRITE_ONCE(uc_rq->value, uc_se->value);
|
|
}
|
|
|
|
/*
|
|
* When a task is dequeued from a rq, the clamp bucket refcounted by the task
|
|
* is released. If this is the last task reference counting the rq's max
|
|
* active clamp value, then the rq's clamp value is updated.
|
|
*
|
|
* Both refcounted tasks and rq's cached clamp values are expected to be
|
|
* always valid. If it's detected they are not, as defensive programming,
|
|
* enforce the expected state and warn.
|
|
*/
|
|
static inline void uclamp_rq_dec_id(struct rq *rq, struct task_struct *p,
|
|
enum uclamp_id clamp_id)
|
|
{
|
|
struct uclamp_rq *uc_rq = &rq->uclamp[clamp_id];
|
|
struct uclamp_se *uc_se = &p->uclamp[clamp_id];
|
|
struct uclamp_bucket *bucket;
|
|
unsigned int bkt_clamp;
|
|
unsigned int rq_clamp;
|
|
|
|
lockdep_assert_held(&rq->lock);
|
|
|
|
/*
|
|
* If sched_uclamp_used was enabled after task @p was enqueued,
|
|
* we could end up with unbalanced call to uclamp_rq_dec_id().
|
|
*
|
|
* In this case the uc_se->active flag should be false since no uclamp
|
|
* accounting was performed at enqueue time and we can just return
|
|
* here.
|
|
*
|
|
* Need to be careful of the following enqeueue/dequeue ordering
|
|
* problem too
|
|
*
|
|
* enqueue(taskA)
|
|
* // sched_uclamp_used gets enabled
|
|
* enqueue(taskB)
|
|
* dequeue(taskA)
|
|
* // Must not decrement bukcet->tasks here
|
|
* dequeue(taskB)
|
|
*
|
|
* where we could end up with stale data in uc_se and
|
|
* bucket[uc_se->bucket_id].
|
|
*
|
|
* The following check here eliminates the possibility of such race.
|
|
*/
|
|
if (unlikely(!uc_se->active))
|
|
return;
|
|
|
|
bucket = &uc_rq->bucket[uc_se->bucket_id];
|
|
|
|
SCHED_WARN_ON(!bucket->tasks);
|
|
if (likely(bucket->tasks))
|
|
bucket->tasks--;
|
|
|
|
uc_se->active = false;
|
|
|
|
/*
|
|
* Keep "local max aggregation" simple and accept to (possibly)
|
|
* overboost some RUNNABLE tasks in the same bucket.
|
|
* The rq clamp bucket value is reset to its base value whenever
|
|
* there are no more RUNNABLE tasks refcounting it.
|
|
*/
|
|
if (likely(bucket->tasks))
|
|
return;
|
|
|
|
rq_clamp = READ_ONCE(uc_rq->value);
|
|
/*
|
|
* Defensive programming: this should never happen. If it happens,
|
|
* e.g. due to future modification, warn and fixup the expected value.
|
|
*/
|
|
SCHED_WARN_ON(bucket->value > rq_clamp);
|
|
if (bucket->value >= rq_clamp) {
|
|
bkt_clamp = uclamp_rq_max_value(rq, clamp_id, uc_se->value);
|
|
WRITE_ONCE(uc_rq->value, bkt_clamp);
|
|
}
|
|
}
|
|
|
|
static inline void uclamp_rq_inc(struct rq *rq, struct task_struct *p)
|
|
{
|
|
enum uclamp_id clamp_id;
|
|
|
|
/*
|
|
* Avoid any overhead until uclamp is actually used by the userspace.
|
|
*
|
|
* The condition is constructed such that a NOP is generated when
|
|
* sched_uclamp_used is disabled.
|
|
*/
|
|
if (!static_branch_unlikely(&sched_uclamp_used))
|
|
return;
|
|
|
|
if (unlikely(!p->sched_class->uclamp_enabled))
|
|
return;
|
|
|
|
for_each_clamp_id(clamp_id)
|
|
uclamp_rq_inc_id(rq, p, clamp_id);
|
|
|
|
/* Reset clamp idle holding when there is one RUNNABLE task */
|
|
if (rq->uclamp_flags & UCLAMP_FLAG_IDLE)
|
|
rq->uclamp_flags &= ~UCLAMP_FLAG_IDLE;
|
|
}
|
|
|
|
static inline void uclamp_rq_dec(struct rq *rq, struct task_struct *p)
|
|
{
|
|
enum uclamp_id clamp_id;
|
|
|
|
/*
|
|
* Avoid any overhead until uclamp is actually used by the userspace.
|
|
*
|
|
* The condition is constructed such that a NOP is generated when
|
|
* sched_uclamp_used is disabled.
|
|
*/
|
|
if (!static_branch_unlikely(&sched_uclamp_used))
|
|
return;
|
|
|
|
if (unlikely(!p->sched_class->uclamp_enabled))
|
|
return;
|
|
|
|
for_each_clamp_id(clamp_id)
|
|
uclamp_rq_dec_id(rq, p, clamp_id);
|
|
}
|
|
|
|
static inline void uclamp_rq_reinc_id(struct rq *rq, struct task_struct *p,
|
|
enum uclamp_id clamp_id)
|
|
{
|
|
if (!p->uclamp[clamp_id].active)
|
|
return;
|
|
|
|
uclamp_rq_dec_id(rq, p, clamp_id);
|
|
uclamp_rq_inc_id(rq, p, clamp_id);
|
|
|
|
/*
|
|
* Make sure to clear the idle flag if we've transiently reached 0
|
|
* active tasks on rq.
|
|
*/
|
|
if (clamp_id == UCLAMP_MAX && (rq->uclamp_flags & UCLAMP_FLAG_IDLE))
|
|
rq->uclamp_flags &= ~UCLAMP_FLAG_IDLE;
|
|
}
|
|
|
|
static inline void
|
|
uclamp_update_active(struct task_struct *p)
|
|
{
|
|
enum uclamp_id clamp_id;
|
|
struct rq_flags rf;
|
|
struct rq *rq;
|
|
|
|
/*
|
|
* Lock the task and the rq where the task is (or was) queued.
|
|
*
|
|
* We might lock the (previous) rq of a !RUNNABLE task, but that's the
|
|
* price to pay to safely serialize util_{min,max} updates with
|
|
* enqueues, dequeues and migration operations.
|
|
* This is the same locking schema used by __set_cpus_allowed_ptr().
|
|
*/
|
|
rq = task_rq_lock(p, &rf);
|
|
|
|
/*
|
|
* Setting the clamp bucket is serialized by task_rq_lock().
|
|
* If the task is not yet RUNNABLE and its task_struct is not
|
|
* affecting a valid clamp bucket, the next time it's enqueued,
|
|
* it will already see the updated clamp bucket value.
|
|
*/
|
|
for_each_clamp_id(clamp_id)
|
|
uclamp_rq_reinc_id(rq, p, clamp_id);
|
|
|
|
task_rq_unlock(rq, p, &rf);
|
|
}
|
|
|
|
#ifdef CONFIG_UCLAMP_TASK_GROUP
|
|
static inline void
|
|
uclamp_update_active_tasks(struct cgroup_subsys_state *css)
|
|
{
|
|
struct css_task_iter it;
|
|
struct task_struct *p;
|
|
|
|
css_task_iter_start(css, 0, &it);
|
|
while ((p = css_task_iter_next(&it)))
|
|
uclamp_update_active(p);
|
|
css_task_iter_end(&it);
|
|
}
|
|
|
|
static void cpu_util_update_eff(struct cgroup_subsys_state *css);
|
|
static void uclamp_update_root_tg(void)
|
|
{
|
|
struct task_group *tg = &root_task_group;
|
|
|
|
uclamp_se_set(&tg->uclamp_req[UCLAMP_MIN],
|
|
sysctl_sched_uclamp_util_min, false);
|
|
uclamp_se_set(&tg->uclamp_req[UCLAMP_MAX],
|
|
sysctl_sched_uclamp_util_max, false);
|
|
|
|
rcu_read_lock();
|
|
cpu_util_update_eff(&root_task_group.css);
|
|
rcu_read_unlock();
|
|
}
|
|
#else
|
|
static void uclamp_update_root_tg(void) { }
|
|
#endif
|
|
|
|
int sysctl_sched_uclamp_handler(struct ctl_table *table, int write,
|
|
void *buffer, size_t *lenp, loff_t *ppos)
|
|
{
|
|
bool update_root_tg = false;
|
|
int old_min, old_max, old_min_rt;
|
|
int result;
|
|
|
|
mutex_lock(&uclamp_mutex);
|
|
old_min = sysctl_sched_uclamp_util_min;
|
|
old_max = sysctl_sched_uclamp_util_max;
|
|
old_min_rt = sysctl_sched_uclamp_util_min_rt_default;
|
|
|
|
result = proc_dointvec(table, write, buffer, lenp, ppos);
|
|
if (result)
|
|
goto undo;
|
|
if (!write)
|
|
goto done;
|
|
|
|
if (sysctl_sched_uclamp_util_min > sysctl_sched_uclamp_util_max ||
|
|
sysctl_sched_uclamp_util_max > SCHED_CAPACITY_SCALE ||
|
|
sysctl_sched_uclamp_util_min_rt_default > SCHED_CAPACITY_SCALE) {
|
|
|
|
result = -EINVAL;
|
|
goto undo;
|
|
}
|
|
|
|
if (old_min != sysctl_sched_uclamp_util_min) {
|
|
uclamp_se_set(&uclamp_default[UCLAMP_MIN],
|
|
sysctl_sched_uclamp_util_min, false);
|
|
update_root_tg = true;
|
|
}
|
|
if (old_max != sysctl_sched_uclamp_util_max) {
|
|
uclamp_se_set(&uclamp_default[UCLAMP_MAX],
|
|
sysctl_sched_uclamp_util_max, false);
|
|
update_root_tg = true;
|
|
}
|
|
|
|
if (update_root_tg) {
|
|
static_branch_enable(&sched_uclamp_used);
|
|
uclamp_update_root_tg();
|
|
}
|
|
|
|
if (old_min_rt != sysctl_sched_uclamp_util_min_rt_default) {
|
|
static_branch_enable(&sched_uclamp_used);
|
|
uclamp_sync_util_min_rt_default();
|
|
}
|
|
|
|
/*
|
|
* We update all RUNNABLE tasks only when task groups are in use.
|
|
* Otherwise, keep it simple and do just a lazy update at each next
|
|
* task enqueue time.
|
|
*/
|
|
|
|
goto done;
|
|
|
|
undo:
|
|
sysctl_sched_uclamp_util_min = old_min;
|
|
sysctl_sched_uclamp_util_max = old_max;
|
|
sysctl_sched_uclamp_util_min_rt_default = old_min_rt;
|
|
done:
|
|
mutex_unlock(&uclamp_mutex);
|
|
|
|
return result;
|
|
}
|
|
|
|
static int uclamp_validate(struct task_struct *p,
|
|
const struct sched_attr *attr)
|
|
{
|
|
int util_min = p->uclamp_req[UCLAMP_MIN].value;
|
|
int util_max = p->uclamp_req[UCLAMP_MAX].value;
|
|
|
|
if (attr->sched_flags & SCHED_FLAG_UTIL_CLAMP_MIN) {
|
|
util_min = attr->sched_util_min;
|
|
|
|
if (util_min + 1 > SCHED_CAPACITY_SCALE + 1)
|
|
return -EINVAL;
|
|
}
|
|
|
|
if (attr->sched_flags & SCHED_FLAG_UTIL_CLAMP_MAX) {
|
|
util_max = attr->sched_util_max;
|
|
|
|
if (util_max + 1 > SCHED_CAPACITY_SCALE + 1)
|
|
return -EINVAL;
|
|
}
|
|
|
|
if (util_min != -1 && util_max != -1 && util_min > util_max)
|
|
return -EINVAL;
|
|
|
|
/*
|
|
* We have valid uclamp attributes; make sure uclamp is enabled.
|
|
*
|
|
* We need to do that here, because enabling static branches is a
|
|
* blocking operation which obviously cannot be done while holding
|
|
* scheduler locks.
|
|
*/
|
|
static_branch_enable(&sched_uclamp_used);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static bool uclamp_reset(const struct sched_attr *attr,
|
|
enum uclamp_id clamp_id,
|
|
struct uclamp_se *uc_se)
|
|
{
|
|
/* Reset on sched class change for a non user-defined clamp value. */
|
|
if (likely(!(attr->sched_flags & SCHED_FLAG_UTIL_CLAMP)) &&
|
|
!uc_se->user_defined)
|
|
return true;
|
|
|
|
/* Reset on sched_util_{min,max} == -1. */
|
|
if (clamp_id == UCLAMP_MIN &&
|
|
attr->sched_flags & SCHED_FLAG_UTIL_CLAMP_MIN &&
|
|
attr->sched_util_min == -1) {
|
|
return true;
|
|
}
|
|
|
|
if (clamp_id == UCLAMP_MAX &&
|
|
attr->sched_flags & SCHED_FLAG_UTIL_CLAMP_MAX &&
|
|
attr->sched_util_max == -1) {
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
static void __setscheduler_uclamp(struct task_struct *p,
|
|
const struct sched_attr *attr)
|
|
{
|
|
enum uclamp_id clamp_id;
|
|
|
|
for_each_clamp_id(clamp_id) {
|
|
struct uclamp_se *uc_se = &p->uclamp_req[clamp_id];
|
|
unsigned int value;
|
|
|
|
if (!uclamp_reset(attr, clamp_id, uc_se))
|
|
continue;
|
|
|
|
/*
|
|
* RT by default have a 100% boost value that could be modified
|
|
* at runtime.
|
|
*/
|
|
if (unlikely(rt_task(p) && clamp_id == UCLAMP_MIN))
|
|
value = sysctl_sched_uclamp_util_min_rt_default;
|
|
else
|
|
value = uclamp_none(clamp_id);
|
|
|
|
uclamp_se_set(uc_se, value, false);
|
|
|
|
}
|
|
|
|
if (likely(!(attr->sched_flags & SCHED_FLAG_UTIL_CLAMP)))
|
|
return;
|
|
|
|
if (attr->sched_flags & SCHED_FLAG_UTIL_CLAMP_MIN &&
|
|
attr->sched_util_min != -1) {
|
|
uclamp_se_set(&p->uclamp_req[UCLAMP_MIN],
|
|
attr->sched_util_min, true);
|
|
trace_android_vh_setscheduler_uclamp(p, UCLAMP_MIN, attr->sched_util_min);
|
|
}
|
|
|
|
if (attr->sched_flags & SCHED_FLAG_UTIL_CLAMP_MAX &&
|
|
attr->sched_util_max != -1) {
|
|
uclamp_se_set(&p->uclamp_req[UCLAMP_MAX],
|
|
attr->sched_util_max, true);
|
|
trace_android_vh_setscheduler_uclamp(p, UCLAMP_MAX, attr->sched_util_max);
|
|
}
|
|
}
|
|
|
|
static void uclamp_fork(struct task_struct *p)
|
|
{
|
|
enum uclamp_id clamp_id;
|
|
|
|
/*
|
|
* We don't need to hold task_rq_lock() when updating p->uclamp_* here
|
|
* as the task is still at its early fork stages.
|
|
*/
|
|
for_each_clamp_id(clamp_id)
|
|
p->uclamp[clamp_id].active = false;
|
|
|
|
if (likely(!p->sched_reset_on_fork))
|
|
return;
|
|
|
|
for_each_clamp_id(clamp_id) {
|
|
uclamp_se_set(&p->uclamp_req[clamp_id],
|
|
uclamp_none(clamp_id), false);
|
|
}
|
|
}
|
|
|
|
static void uclamp_post_fork(struct task_struct *p)
|
|
{
|
|
uclamp_update_util_min_rt_default(p);
|
|
}
|
|
|
|
static void __init init_uclamp_rq(struct rq *rq)
|
|
{
|
|
enum uclamp_id clamp_id;
|
|
struct uclamp_rq *uc_rq = rq->uclamp;
|
|
|
|
for_each_clamp_id(clamp_id) {
|
|
uc_rq[clamp_id] = (struct uclamp_rq) {
|
|
.value = uclamp_none(clamp_id)
|
|
};
|
|
}
|
|
|
|
rq->uclamp_flags = 0;
|
|
}
|
|
|
|
static void __init init_uclamp(void)
|
|
{
|
|
struct uclamp_se uc_max = {};
|
|
enum uclamp_id clamp_id;
|
|
int cpu;
|
|
|
|
for_each_possible_cpu(cpu)
|
|
init_uclamp_rq(cpu_rq(cpu));
|
|
|
|
for_each_clamp_id(clamp_id) {
|
|
uclamp_se_set(&init_task.uclamp_req[clamp_id],
|
|
uclamp_none(clamp_id), false);
|
|
}
|
|
|
|
/* System defaults allow max clamp values for both indexes */
|
|
uclamp_se_set(&uc_max, uclamp_none(UCLAMP_MAX), false);
|
|
for_each_clamp_id(clamp_id) {
|
|
uclamp_default[clamp_id] = uc_max;
|
|
#ifdef CONFIG_UCLAMP_TASK_GROUP
|
|
root_task_group.uclamp_req[clamp_id] = uc_max;
|
|
root_task_group.uclamp[clamp_id] = uc_max;
|
|
#endif
|
|
}
|
|
}
|
|
|
|
#else /* CONFIG_UCLAMP_TASK */
|
|
static inline void uclamp_rq_inc(struct rq *rq, struct task_struct *p) { }
|
|
static inline void uclamp_rq_dec(struct rq *rq, struct task_struct *p) { }
|
|
static inline int uclamp_validate(struct task_struct *p,
|
|
const struct sched_attr *attr)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
static void __setscheduler_uclamp(struct task_struct *p,
|
|
const struct sched_attr *attr) { }
|
|
static inline void uclamp_fork(struct task_struct *p) { }
|
|
static inline void uclamp_post_fork(struct task_struct *p) { }
|
|
static inline void init_uclamp(void) { }
|
|
#endif /* CONFIG_UCLAMP_TASK */
|
|
|
|
static inline void enqueue_task(struct rq *rq, struct task_struct *p, int flags)
|
|
{
|
|
if (!(flags & ENQUEUE_NOCLOCK))
|
|
update_rq_clock(rq);
|
|
|
|
if (!(flags & ENQUEUE_RESTORE)) {
|
|
sched_info_queued(rq, p);
|
|
psi_enqueue(p, flags & ENQUEUE_WAKEUP);
|
|
}
|
|
|
|
uclamp_rq_inc(rq, p);
|
|
trace_android_rvh_enqueue_task(rq, p, flags);
|
|
p->sched_class->enqueue_task(rq, p, flags);
|
|
trace_android_rvh_after_enqueue_task(rq, p);
|
|
}
|
|
|
|
static inline void dequeue_task(struct rq *rq, struct task_struct *p, int flags)
|
|
{
|
|
if (!(flags & DEQUEUE_NOCLOCK))
|
|
update_rq_clock(rq);
|
|
|
|
if (!(flags & DEQUEUE_SAVE)) {
|
|
sched_info_dequeued(rq, p);
|
|
psi_dequeue(p, flags & DEQUEUE_SLEEP);
|
|
}
|
|
|
|
uclamp_rq_dec(rq, p);
|
|
trace_android_rvh_dequeue_task(rq, p, flags);
|
|
p->sched_class->dequeue_task(rq, p, flags);
|
|
trace_android_rvh_after_dequeue_task(rq, p);
|
|
}
|
|
|
|
void activate_task(struct rq *rq, struct task_struct *p, int flags)
|
|
{
|
|
enqueue_task(rq, p, flags);
|
|
|
|
p->on_rq = TASK_ON_RQ_QUEUED;
|
|
}
|
|
EXPORT_SYMBOL_GPL(activate_task);
|
|
|
|
void deactivate_task(struct rq *rq, struct task_struct *p, int flags)
|
|
{
|
|
p->on_rq = (flags & DEQUEUE_SLEEP) ? 0 : TASK_ON_RQ_MIGRATING;
|
|
|
|
dequeue_task(rq, p, flags);
|
|
}
|
|
EXPORT_SYMBOL_GPL(deactivate_task);
|
|
|
|
static inline int __normal_prio(int policy, int rt_prio, int nice)
|
|
{
|
|
int prio;
|
|
|
|
if (dl_policy(policy))
|
|
prio = MAX_DL_PRIO - 1;
|
|
else if (rt_policy(policy))
|
|
prio = MAX_RT_PRIO - 1 - rt_prio;
|
|
else
|
|
prio = NICE_TO_PRIO(nice);
|
|
|
|
return prio;
|
|
}
|
|
|
|
/*
|
|
* Calculate the expected normal priority: i.e. priority
|
|
* without taking RT-inheritance into account. Might be
|
|
* boosted by interactivity modifiers. Changes upon fork,
|
|
* setprio syscalls, and whenever the interactivity
|
|
* estimator recalculates.
|
|
*/
|
|
static inline int normal_prio(struct task_struct *p)
|
|
{
|
|
return __normal_prio(p->policy, p->rt_priority, PRIO_TO_NICE(p->static_prio));
|
|
}
|
|
|
|
/*
|
|
* Calculate the current priority, i.e. the priority
|
|
* taken into account by the scheduler. This value might
|
|
* be boosted by RT tasks, or might be boosted by
|
|
* interactivity modifiers. Will be RT if the task got
|
|
* RT-boosted. If not then it returns p->normal_prio.
|
|
*/
|
|
static int effective_prio(struct task_struct *p)
|
|
{
|
|
p->normal_prio = normal_prio(p);
|
|
/*
|
|
* If we are RT tasks or we were boosted to RT priority,
|
|
* keep the priority unchanged. Otherwise, update priority
|
|
* to the normal priority:
|
|
*/
|
|
if (!rt_prio(p->prio))
|
|
return p->normal_prio;
|
|
return p->prio;
|
|
}
|
|
|
|
/**
|
|
* task_curr - is this task currently executing on a CPU?
|
|
* @p: the task in question.
|
|
*
|
|
* Return: 1 if the task is currently executing. 0 otherwise.
|
|
*/
|
|
inline int task_curr(const struct task_struct *p)
|
|
{
|
|
return cpu_curr(task_cpu(p)) == p;
|
|
}
|
|
|
|
/*
|
|
* switched_from, switched_to and prio_changed must _NOT_ drop rq->lock,
|
|
* use the balance_callback list if you want balancing.
|
|
*
|
|
* this means any call to check_class_changed() must be followed by a call to
|
|
* balance_callback().
|
|
*/
|
|
static inline void check_class_changed(struct rq *rq, struct task_struct *p,
|
|
const struct sched_class *prev_class,
|
|
int oldprio)
|
|
{
|
|
if (prev_class != p->sched_class) {
|
|
if (prev_class->switched_from)
|
|
prev_class->switched_from(rq, p);
|
|
|
|
p->sched_class->switched_to(rq, p);
|
|
} else if (oldprio != p->prio || dl_task(p))
|
|
p->sched_class->prio_changed(rq, p, oldprio);
|
|
}
|
|
|
|
void check_preempt_curr(struct rq *rq, struct task_struct *p, int flags)
|
|
{
|
|
if (p->sched_class == rq->curr->sched_class)
|
|
rq->curr->sched_class->check_preempt_curr(rq, p, flags);
|
|
else if (p->sched_class > rq->curr->sched_class)
|
|
resched_curr(rq);
|
|
|
|
/*
|
|
* A queue event has occurred, and we're going to schedule. In
|
|
* this case, we can save a useless back to back clock update.
|
|
*/
|
|
if (task_on_rq_queued(rq->curr) && test_tsk_need_resched(rq->curr))
|
|
rq_clock_skip_update(rq);
|
|
}
|
|
EXPORT_SYMBOL_GPL(check_preempt_curr);
|
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
/*
|
|
* Per-CPU kthreads are allowed to run on !active && online CPUs, see
|
|
* __set_cpus_allowed_ptr() and select_fallback_rq().
|
|
*/
|
|
static inline bool is_cpu_allowed(struct task_struct *p, int cpu)
|
|
{
|
|
if (!cpumask_test_cpu(cpu, p->cpus_ptr))
|
|
return false;
|
|
|
|
if (is_per_cpu_kthread(p))
|
|
return cpu_online(cpu);
|
|
|
|
if (!cpu_active(cpu))
|
|
return false;
|
|
|
|
return cpumask_test_cpu(cpu, task_cpu_possible_mask(p));
|
|
}
|
|
|
|
/*
|
|
* This is how migration works:
|
|
*
|
|
* 1) we invoke migration_cpu_stop() on the target CPU using
|
|
* stop_one_cpu().
|
|
* 2) stopper starts to run (implicitly forcing the migrated thread
|
|
* off the CPU)
|
|
* 3) it checks whether the migrated task is still in the wrong runqueue.
|
|
* 4) if it's in the wrong runqueue then the migration thread removes
|
|
* it and puts it into the right queue.
|
|
* 5) stopper completes and stop_one_cpu() returns and the migration
|
|
* is done.
|
|
*/
|
|
|
|
/*
|
|
* move_queued_task - move a queued task to new rq.
|
|
*
|
|
* Returns (locked) new rq. Old rq's lock is released.
|
|
*/
|
|
static struct rq *move_queued_task(struct rq *rq, struct rq_flags *rf,
|
|
struct task_struct *p, int new_cpu)
|
|
{
|
|
int detached = 0;
|
|
|
|
lockdep_assert_held(&rq->lock);
|
|
|
|
/*
|
|
* The vendor hook may drop the lock temporarily, so
|
|
* pass the rq flags to unpin lock. We expect the
|
|
* rq lock to be held after return.
|
|
*/
|
|
trace_android_rvh_migrate_queued_task(rq, rf, p, new_cpu, &detached);
|
|
if (detached)
|
|
goto attach;
|
|
|
|
deactivate_task(rq, p, DEQUEUE_NOCLOCK);
|
|
set_task_cpu(p, new_cpu);
|
|
|
|
attach:
|
|
rq_unlock(rq, rf);
|
|
rq = cpu_rq(new_cpu);
|
|
|
|
rq_lock(rq, rf);
|
|
BUG_ON(task_cpu(p) != new_cpu);
|
|
activate_task(rq, p, 0);
|
|
check_preempt_curr(rq, p, 0);
|
|
|
|
return rq;
|
|
}
|
|
|
|
struct migration_arg {
|
|
struct task_struct *task;
|
|
int dest_cpu;
|
|
};
|
|
|
|
/*
|
|
* Move (not current) task off this CPU, onto the destination CPU. We're doing
|
|
* this because either it can't run here any more (set_cpus_allowed()
|
|
* away from this CPU, or CPU going down), or because we're
|
|
* attempting to rebalance this task on exec (sched_exec).
|
|
*
|
|
* So we race with normal scheduler movements, but that's OK, as long
|
|
* as the task is no longer on this CPU.
|
|
*/
|
|
static struct rq *__migrate_task(struct rq *rq, struct rq_flags *rf,
|
|
struct task_struct *p, int dest_cpu)
|
|
{
|
|
/* Affinity changed (again). */
|
|
if (!is_cpu_allowed(p, dest_cpu))
|
|
return rq;
|
|
|
|
update_rq_clock(rq);
|
|
rq = move_queued_task(rq, rf, p, dest_cpu);
|
|
|
|
return rq;
|
|
}
|
|
|
|
/*
|
|
* migration_cpu_stop - this will be executed by a highprio stopper thread
|
|
* and performs thread migration by bumping thread off CPU then
|
|
* 'pushing' onto another runqueue.
|
|
*/
|
|
static int migration_cpu_stop(void *data)
|
|
{
|
|
struct migration_arg *arg = data;
|
|
struct task_struct *p = arg->task;
|
|
struct rq *rq = this_rq();
|
|
struct rq_flags rf;
|
|
|
|
/*
|
|
* The original target CPU might have gone down and we might
|
|
* be on another CPU but it doesn't matter.
|
|
*/
|
|
local_irq_disable();
|
|
/*
|
|
* We need to explicitly wake pending tasks before running
|
|
* __migrate_task() such that we will not miss enforcing cpus_ptr
|
|
* during wakeups, see set_cpus_allowed_ptr()'s TASK_WAKING test.
|
|
*/
|
|
flush_smp_call_function_from_idle();
|
|
|
|
raw_spin_lock(&p->pi_lock);
|
|
rq_lock(rq, &rf);
|
|
/*
|
|
* If task_rq(p) != rq, it cannot be migrated here, because we're
|
|
* holding rq->lock, if p->on_rq == 0 it cannot get enqueued because
|
|
* we're holding p->pi_lock.
|
|
*/
|
|
if (task_rq(p) == rq) {
|
|
if (task_on_rq_queued(p))
|
|
rq = __migrate_task(rq, &rf, p, arg->dest_cpu);
|
|
else
|
|
p->wake_cpu = arg->dest_cpu;
|
|
}
|
|
rq_unlock(rq, &rf);
|
|
raw_spin_unlock(&p->pi_lock);
|
|
|
|
local_irq_enable();
|
|
return 0;
|
|
}
|
|
|
|
/*
|
|
* sched_class::set_cpus_allowed must do the below, but is not required to
|
|
* actually call this function.
|
|
*/
|
|
void set_cpus_allowed_common(struct task_struct *p, const struct cpumask *new_mask)
|
|
{
|
|
cpumask_copy(&p->cpus_mask, new_mask);
|
|
p->nr_cpus_allowed = cpumask_weight(new_mask);
|
|
trace_android_rvh_set_cpus_allowed_comm(p, new_mask);
|
|
}
|
|
|
|
void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask)
|
|
{
|
|
struct rq *rq = task_rq(p);
|
|
bool queued, running;
|
|
|
|
lockdep_assert_held(&p->pi_lock);
|
|
|
|
queued = task_on_rq_queued(p);
|
|
running = task_current(rq, p);
|
|
|
|
if (queued) {
|
|
/*
|
|
* Because __kthread_bind() calls this on blocked tasks without
|
|
* holding rq->lock.
|
|
*/
|
|
lockdep_assert_held(&rq->lock);
|
|
dequeue_task(rq, p, DEQUEUE_SAVE | DEQUEUE_NOCLOCK);
|
|
}
|
|
if (running)
|
|
put_prev_task(rq, p);
|
|
|
|
p->sched_class->set_cpus_allowed(p, new_mask);
|
|
|
|
if (queued)
|
|
enqueue_task(rq, p, ENQUEUE_RESTORE | ENQUEUE_NOCLOCK);
|
|
if (running)
|
|
set_next_task(rq, p);
|
|
}
|
|
|
|
/*
|
|
* Called with both p->pi_lock and rq->lock held; drops both before returning.
|
|
*/
|
|
static int __set_cpus_allowed_ptr_locked(struct task_struct *p,
|
|
const struct cpumask *new_mask,
|
|
bool check,
|
|
struct rq *rq,
|
|
struct rq_flags *rf)
|
|
{
|
|
const struct cpumask *cpu_valid_mask = cpu_active_mask;
|
|
const struct cpumask *cpu_allowed_mask = task_cpu_possible_mask(p);
|
|
unsigned int dest_cpu;
|
|
int ret = 0;
|
|
|
|
update_rq_clock(rq);
|
|
|
|
if (p->flags & PF_KTHREAD) {
|
|
/*
|
|
* Kernel threads are allowed on online && !active CPUs
|
|
*/
|
|
cpu_valid_mask = cpu_online_mask;
|
|
} else if (!cpumask_subset(new_mask, cpu_allowed_mask)) {
|
|
ret = -EINVAL;
|
|
goto out;
|
|
}
|
|
|
|
/*
|
|
* Must re-check here, to close a race against __kthread_bind(),
|
|
* sched_setaffinity() is not guaranteed to observe the flag.
|
|
*/
|
|
if (check && (p->flags & PF_NO_SETAFFINITY)) {
|
|
ret = -EINVAL;
|
|
goto out;
|
|
}
|
|
|
|
if (cpumask_equal(&p->cpus_mask, new_mask))
|
|
goto out;
|
|
|
|
/*
|
|
* Picking a ~random cpu helps in cases where we are changing affinity
|
|
* for groups of tasks (ie. cpuset), so that load balancing is not
|
|
* immediately required to distribute the tasks within their new mask.
|
|
*/
|
|
dest_cpu = cpumask_any_and_distribute(cpu_valid_mask, new_mask);
|
|
if (dest_cpu >= nr_cpu_ids) {
|
|
ret = -EINVAL;
|
|
goto out;
|
|
}
|
|
|
|
do_set_cpus_allowed(p, new_mask);
|
|
|
|
if (p->flags & PF_KTHREAD) {
|
|
/*
|
|
* For kernel threads that do indeed end up on online &&
|
|
* !active we want to ensure they are strict per-CPU threads.
|
|
*/
|
|
WARN_ON(cpumask_intersects(new_mask, cpu_online_mask) &&
|
|
!cpumask_intersects(new_mask, cpu_active_mask) &&
|
|
p->nr_cpus_allowed != 1);
|
|
}
|
|
|
|
/* Can the task run on the task's current CPU? If so, we're done */
|
|
if (cpumask_test_cpu(task_cpu(p), new_mask))
|
|
goto out;
|
|
|
|
if (task_running(rq, p) || p->state == TASK_WAKING) {
|
|
struct migration_arg arg = { p, dest_cpu };
|
|
/* Need help from migration thread: drop lock and wait. */
|
|
task_rq_unlock(rq, p, rf);
|
|
stop_one_cpu(cpu_of(rq), migration_cpu_stop, &arg);
|
|
return 0;
|
|
} else if (task_on_rq_queued(p)) {
|
|
/*
|
|
* OK, since we're going to drop the lock immediately
|
|
* afterwards anyway.
|
|
*/
|
|
rq = move_queued_task(rq, rf, p, dest_cpu);
|
|
}
|
|
out:
|
|
task_rq_unlock(rq, p, rf);
|
|
|
|
return ret;
|
|
}
|
|
|
|
/*
|
|
* Change a given task's CPU affinity. Migrate the thread to a
|
|
* proper CPU and schedule it away if the CPU it's executing on
|
|
* is removed from the allowed bitmask.
|
|
*
|
|
* NOTE: the caller must have a valid reference to the task, the
|
|
* task must not exit() & deallocate itself prematurely. The
|
|
* call is not atomic; no spinlocks may be held.
|
|
*/
|
|
static int __set_cpus_allowed_ptr(struct task_struct *p,
|
|
const struct cpumask *new_mask, bool check)
|
|
{
|
|
struct rq_flags rf;
|
|
struct rq *rq;
|
|
|
|
rq = task_rq_lock(p, &rf);
|
|
return __set_cpus_allowed_ptr_locked(p, new_mask, check, rq, &rf);
|
|
}
|
|
|
|
int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask)
|
|
{
|
|
return __set_cpus_allowed_ptr(p, new_mask, false);
|
|
}
|
|
EXPORT_SYMBOL_GPL(set_cpus_allowed_ptr);
|
|
|
|
/*
|
|
* Change a given task's CPU affinity to the intersection of its current
|
|
* affinity mask and @subset_mask, writing the resulting mask to @new_mask.
|
|
* If the resulting mask is empty, leave the affinity unchanged and return
|
|
* -EINVAL.
|
|
*/
|
|
static int restrict_cpus_allowed_ptr(struct task_struct *p,
|
|
struct cpumask *new_mask,
|
|
const struct cpumask *subset_mask)
|
|
{
|
|
struct rq_flags rf;
|
|
struct rq *rq;
|
|
|
|
rq = task_rq_lock(p, &rf);
|
|
if (!cpumask_and(new_mask, &p->cpus_mask, subset_mask)) {
|
|
task_rq_unlock(rq, p, &rf);
|
|
return -EINVAL;
|
|
}
|
|
|
|
return __set_cpus_allowed_ptr_locked(p, new_mask, false, rq, &rf);
|
|
}
|
|
|
|
/*
|
|
* Restrict a given task's CPU affinity so that it is a subset of
|
|
* task_cpu_possible_mask(). If the resulting mask is empty, we warn and
|
|
* walk up the cpuset hierarchy until we find a suitable mask.
|
|
*/
|
|
void force_compatible_cpus_allowed_ptr(struct task_struct *p)
|
|
{
|
|
cpumask_var_t new_mask;
|
|
const struct cpumask *override_mask = task_cpu_possible_mask(p);
|
|
|
|
alloc_cpumask_var(&new_mask, GFP_KERNEL);
|
|
|
|
/*
|
|
* __migrate_task() can fail silently in the face of concurrent
|
|
* offlining of the chosen destination CPU, so take the hotplug
|
|
* lock to ensure that the migration succeeds.
|
|
*/
|
|
trace_android_rvh_force_compatible_pre(NULL);
|
|
cpus_read_lock();
|
|
if (!cpumask_available(new_mask))
|
|
goto out_set_mask;
|
|
|
|
if (!restrict_cpus_allowed_ptr(p, new_mask, override_mask))
|
|
goto out_free_mask;
|
|
|
|
/*
|
|
* We failed to find a valid subset of the affinity mask for the
|
|
* task, so override it based on its cpuset hierarchy.
|
|
*/
|
|
cpuset_cpus_allowed(p, new_mask);
|
|
override_mask = new_mask;
|
|
|
|
out_set_mask:
|
|
if (printk_ratelimit()) {
|
|
printk_deferred("Overriding affinity for process %d (%s) to CPUs %*pbl\n",
|
|
task_pid_nr(p), p->comm,
|
|
cpumask_pr_args(override_mask));
|
|
}
|
|
|
|
WARN_ON(set_cpus_allowed_ptr(p, override_mask));
|
|
out_free_mask:
|
|
cpus_read_unlock();
|
|
trace_android_rvh_force_compatible_post(NULL);
|
|
free_cpumask_var(new_mask);
|
|
}
|
|
|
|
void set_task_cpu(struct task_struct *p, unsigned int new_cpu)
|
|
{
|
|
#ifdef CONFIG_SCHED_DEBUG
|
|
/*
|
|
* We should never call set_task_cpu() on a blocked task,
|
|
* ttwu() will sort out the placement.
|
|
*/
|
|
WARN_ON_ONCE(p->state != TASK_RUNNING && p->state != TASK_WAKING &&
|
|
!p->on_rq);
|
|
|
|
/*
|
|
* Migrating fair class task must have p->on_rq = TASK_ON_RQ_MIGRATING,
|
|
* because schedstat_wait_{start,end} rebase migrating task's wait_start
|
|
* time relying on p->on_rq.
|
|
*/
|
|
WARN_ON_ONCE(p->state == TASK_RUNNING &&
|
|
p->sched_class == &fair_sched_class &&
|
|
(p->on_rq && !task_on_rq_migrating(p)));
|
|
|
|
#ifdef CONFIG_LOCKDEP
|
|
/*
|
|
* The caller should hold either p->pi_lock or rq->lock, when changing
|
|
* a task's CPU. ->pi_lock for waking tasks, rq->lock for runnable tasks.
|
|
*
|
|
* sched_move_task() holds both and thus holding either pins the cgroup,
|
|
* see task_group().
|
|
*
|
|
* Furthermore, all task_rq users should acquire both locks, see
|
|
* task_rq_lock().
|
|
*/
|
|
WARN_ON_ONCE(debug_locks && !(lockdep_is_held(&p->pi_lock) ||
|
|
lockdep_is_held(&task_rq(p)->lock)));
|
|
#endif
|
|
/*
|
|
* Clearly, migrating tasks to offline CPUs is a fairly daft thing.
|
|
*/
|
|
WARN_ON_ONCE(!cpu_online(new_cpu));
|
|
#endif
|
|
|
|
trace_sched_migrate_task(p, new_cpu);
|
|
|
|
if (task_cpu(p) != new_cpu) {
|
|
if (p->sched_class->migrate_task_rq)
|
|
p->sched_class->migrate_task_rq(p, new_cpu);
|
|
p->se.nr_migrations++;
|
|
rseq_migrate(p);
|
|
perf_event_task_migrate(p);
|
|
trace_android_rvh_set_task_cpu(p, new_cpu);
|
|
}
|
|
|
|
__set_task_cpu(p, new_cpu);
|
|
}
|
|
EXPORT_SYMBOL_GPL(set_task_cpu);
|
|
|
|
static void __migrate_swap_task(struct task_struct *p, int cpu)
|
|
{
|
|
if (task_on_rq_queued(p)) {
|
|
struct rq *src_rq, *dst_rq;
|
|
struct rq_flags srf, drf;
|
|
|
|
src_rq = task_rq(p);
|
|
dst_rq = cpu_rq(cpu);
|
|
|
|
rq_pin_lock(src_rq, &srf);
|
|
rq_pin_lock(dst_rq, &drf);
|
|
|
|
deactivate_task(src_rq, p, 0);
|
|
set_task_cpu(p, cpu);
|
|
activate_task(dst_rq, p, 0);
|
|
check_preempt_curr(dst_rq, p, 0);
|
|
|
|
rq_unpin_lock(dst_rq, &drf);
|
|
rq_unpin_lock(src_rq, &srf);
|
|
|
|
} else {
|
|
/*
|
|
* Task isn't running anymore; make it appear like we migrated
|
|
* it before it went to sleep. This means on wakeup we make the
|
|
* previous CPU our target instead of where it really is.
|
|
*/
|
|
p->wake_cpu = cpu;
|
|
}
|
|
}
|
|
|
|
struct migration_swap_arg {
|
|
struct task_struct *src_task, *dst_task;
|
|
int src_cpu, dst_cpu;
|
|
};
|
|
|
|
static int migrate_swap_stop(void *data)
|
|
{
|
|
struct migration_swap_arg *arg = data;
|
|
struct rq *src_rq, *dst_rq;
|
|
int ret = -EAGAIN;
|
|
|
|
if (!cpu_active(arg->src_cpu) || !cpu_active(arg->dst_cpu))
|
|
return -EAGAIN;
|
|
|
|
src_rq = cpu_rq(arg->src_cpu);
|
|
dst_rq = cpu_rq(arg->dst_cpu);
|
|
|
|
double_raw_lock(&arg->src_task->pi_lock,
|
|
&arg->dst_task->pi_lock);
|
|
double_rq_lock(src_rq, dst_rq);
|
|
|
|
if (task_cpu(arg->dst_task) != arg->dst_cpu)
|
|
goto unlock;
|
|
|
|
if (task_cpu(arg->src_task) != arg->src_cpu)
|
|
goto unlock;
|
|
|
|
if (!cpumask_test_cpu(arg->dst_cpu, arg->src_task->cpus_ptr))
|
|
goto unlock;
|
|
|
|
if (!cpumask_test_cpu(arg->src_cpu, arg->dst_task->cpus_ptr))
|
|
goto unlock;
|
|
|
|
__migrate_swap_task(arg->src_task, arg->dst_cpu);
|
|
__migrate_swap_task(arg->dst_task, arg->src_cpu);
|
|
|
|
ret = 0;
|
|
|
|
unlock:
|
|
double_rq_unlock(src_rq, dst_rq);
|
|
raw_spin_unlock(&arg->dst_task->pi_lock);
|
|
raw_spin_unlock(&arg->src_task->pi_lock);
|
|
|
|
return ret;
|
|
}
|
|
|
|
/*
|
|
* Cross migrate two tasks
|
|
*/
|
|
int migrate_swap(struct task_struct *cur, struct task_struct *p,
|
|
int target_cpu, int curr_cpu)
|
|
{
|
|
struct migration_swap_arg arg;
|
|
int ret = -EINVAL;
|
|
|
|
arg = (struct migration_swap_arg){
|
|
.src_task = cur,
|
|
.src_cpu = curr_cpu,
|
|
.dst_task = p,
|
|
.dst_cpu = target_cpu,
|
|
};
|
|
|
|
if (arg.src_cpu == arg.dst_cpu)
|
|
goto out;
|
|
|
|
/*
|
|
* These three tests are all lockless; this is OK since all of them
|
|
* will be re-checked with proper locks held further down the line.
|
|
*/
|
|
if (!cpu_active(arg.src_cpu) || !cpu_active(arg.dst_cpu))
|
|
goto out;
|
|
|
|
if (!cpumask_test_cpu(arg.dst_cpu, arg.src_task->cpus_ptr))
|
|
goto out;
|
|
|
|
if (!cpumask_test_cpu(arg.src_cpu, arg.dst_task->cpus_ptr))
|
|
goto out;
|
|
|
|
trace_sched_swap_numa(cur, arg.src_cpu, p, arg.dst_cpu);
|
|
ret = stop_two_cpus(arg.dst_cpu, arg.src_cpu, migrate_swap_stop, &arg);
|
|
|
|
out:
|
|
return ret;
|
|
}
|
|
EXPORT_SYMBOL_GPL(migrate_swap);
|
|
|
|
/*
|
|
* wait_task_inactive - wait for a thread to unschedule.
|
|
*
|
|
* If @match_state is nonzero, it's the @p->state value just checked and
|
|
* not expected to change. If it changes, i.e. @p might have woken up,
|
|
* then return zero. When we succeed in waiting for @p to be off its CPU,
|
|
* we return a positive number (its total switch count). If a second call
|
|
* a short while later returns the same number, the caller can be sure that
|
|
* @p has remained unscheduled the whole time.
|
|
*
|
|
* The caller must ensure that the task *will* unschedule sometime soon,
|
|
* else this function might spin for a *long* time. This function can't
|
|
* be called with interrupts off, or it may introduce deadlock with
|
|
* smp_call_function() if an IPI is sent by the same process we are
|
|
* waiting to become inactive.
|
|
*/
|
|
unsigned long wait_task_inactive(struct task_struct *p, long match_state)
|
|
{
|
|
int running, queued;
|
|
struct rq_flags rf;
|
|
unsigned long ncsw;
|
|
struct rq *rq;
|
|
|
|
for (;;) {
|
|
/*
|
|
* We do the initial early heuristics without holding
|
|
* any task-queue locks at all. We'll only try to get
|
|
* the runqueue lock when things look like they will
|
|
* work out!
|
|
*/
|
|
rq = task_rq(p);
|
|
|
|
/*
|
|
* If the task is actively running on another CPU
|
|
* still, just relax and busy-wait without holding
|
|
* any locks.
|
|
*
|
|
* NOTE! Since we don't hold any locks, it's not
|
|
* even sure that "rq" stays as the right runqueue!
|
|
* But we don't care, since "task_running()" will
|
|
* return false if the runqueue has changed and p
|
|
* is actually now running somewhere else!
|
|
*/
|
|
while (task_running(rq, p)) {
|
|
if (match_state && unlikely(p->state != match_state))
|
|
return 0;
|
|
cpu_relax();
|
|
}
|
|
|
|
/*
|
|
* Ok, time to look more closely! We need the rq
|
|
* lock now, to be *sure*. If we're wrong, we'll
|
|
* just go back and repeat.
|
|
*/
|
|
rq = task_rq_lock(p, &rf);
|
|
trace_sched_wait_task(p);
|
|
running = task_running(rq, p);
|
|
queued = task_on_rq_queued(p);
|
|
ncsw = 0;
|
|
if (!match_state || p->state == match_state)
|
|
ncsw = p->nvcsw | LONG_MIN; /* sets MSB */
|
|
task_rq_unlock(rq, p, &rf);
|
|
|
|
/*
|
|
* If it changed from the expected state, bail out now.
|
|
*/
|
|
if (unlikely(!ncsw))
|
|
break;
|
|
|
|
/*
|
|
* Was it really running after all now that we
|
|
* checked with the proper locks actually held?
|
|
*
|
|
* Oops. Go back and try again..
|
|
*/
|
|
if (unlikely(running)) {
|
|
cpu_relax();
|
|
continue;
|
|
}
|
|
|
|
/*
|
|
* It's not enough that it's not actively running,
|
|
* it must be off the runqueue _entirely_, and not
|
|
* preempted!
|
|
*
|
|
* So if it was still runnable (but just not actively
|
|
* running right now), it's preempted, and we should
|
|
* yield - it could be a while.
|
|
*/
|
|
if (unlikely(queued)) {
|
|
ktime_t to = NSEC_PER_SEC / HZ;
|
|
|
|
set_current_state(TASK_UNINTERRUPTIBLE);
|
|
schedule_hrtimeout(&to, HRTIMER_MODE_REL);
|
|
continue;
|
|
}
|
|
|
|
/*
|
|
* Ahh, all good. It wasn't running, and it wasn't
|
|
* runnable, which means that it will never become
|
|
* running in the future either. We're all done!
|
|
*/
|
|
break;
|
|
}
|
|
|
|
return ncsw;
|
|
}
|
|
|
|
/***
|
|
* kick_process - kick a running thread to enter/exit the kernel
|
|
* @p: the to-be-kicked thread
|
|
*
|
|
* Cause a process which is running on another CPU to enter
|
|
* kernel-mode, without any delay. (to get signals handled.)
|
|
*
|
|
* NOTE: this function doesn't have to take the runqueue lock,
|
|
* because all it wants to ensure is that the remote task enters
|
|
* the kernel. If the IPI races and the task has been migrated
|
|
* to another CPU then no harm is done and the purpose has been
|
|
* achieved as well.
|
|
*/
|
|
void kick_process(struct task_struct *p)
|
|
{
|
|
int cpu;
|
|
|
|
preempt_disable();
|
|
cpu = task_cpu(p);
|
|
if ((cpu != smp_processor_id()) && task_curr(p))
|
|
smp_send_reschedule(cpu);
|
|
preempt_enable();
|
|
}
|
|
EXPORT_SYMBOL_GPL(kick_process);
|
|
|
|
/*
|
|
* ->cpus_ptr is protected by both rq->lock and p->pi_lock
|
|
*
|
|
* A few notes on cpu_active vs cpu_online:
|
|
*
|
|
* - cpu_active must be a subset of cpu_online
|
|
*
|
|
* - on CPU-up we allow per-CPU kthreads on the online && !active CPU,
|
|
* see __set_cpus_allowed_ptr(). At this point the newly online
|
|
* CPU isn't yet part of the sched domains, and balancing will not
|
|
* see it.
|
|
*
|
|
* - on CPU-down we clear cpu_active() to mask the sched domains and
|
|
* avoid the load balancer to place new tasks on the to be removed
|
|
* CPU. Existing tasks will remain running there and will be taken
|
|
* off.
|
|
*
|
|
* This means that fallback selection must not select !active CPUs.
|
|
* And can assume that any active CPU must be online. Conversely
|
|
* select_task_rq() below may allow selection of !active CPUs in order
|
|
* to satisfy the above rules.
|
|
*/
|
|
static int select_fallback_rq(int cpu, struct task_struct *p)
|
|
{
|
|
int nid = cpu_to_node(cpu);
|
|
const struct cpumask *nodemask = NULL;
|
|
enum { cpuset, possible, fail } state = cpuset;
|
|
int dest_cpu = -1;
|
|
|
|
trace_android_rvh_select_fallback_rq(cpu, p, &dest_cpu);
|
|
if (dest_cpu >= 0)
|
|
return dest_cpu;
|
|
|
|
/*
|
|
* If the node that the CPU is on has been offlined, cpu_to_node()
|
|
* will return -1. There is no CPU on the node, and we should
|
|
* select the CPU on the other node.
|
|
*/
|
|
if (nid != -1) {
|
|
nodemask = cpumask_of_node(nid);
|
|
|
|
/* Look for allowed, online CPU in same node. */
|
|
for_each_cpu(dest_cpu, nodemask) {
|
|
if (is_cpu_allowed(p, dest_cpu))
|
|
return dest_cpu;
|
|
}
|
|
}
|
|
|
|
for (;;) {
|
|
/* Any allowed, online CPU? */
|
|
for_each_cpu(dest_cpu, p->cpus_ptr) {
|
|
if (!is_cpu_allowed(p, dest_cpu))
|
|
continue;
|
|
|
|
goto out;
|
|
}
|
|
|
|
/* No more Mr. Nice Guy. */
|
|
switch (state) {
|
|
case cpuset:
|
|
if (IS_ENABLED(CONFIG_CPUSETS)) {
|
|
cpuset_cpus_allowed_fallback(p);
|
|
state = possible;
|
|
break;
|
|
}
|
|
fallthrough;
|
|
case possible:
|
|
do_set_cpus_allowed(p, task_cpu_possible_mask(p));
|
|
state = fail;
|
|
break;
|
|
case fail:
|
|
BUG();
|
|
break;
|
|
}
|
|
}
|
|
|
|
out:
|
|
if (state != cpuset) {
|
|
/*
|
|
* Don't tell them about moving exiting tasks or
|
|
* kernel threads (both mm NULL), since they never
|
|
* leave kernel.
|
|
*/
|
|
if (p->mm && printk_ratelimit()) {
|
|
printk_deferred("process %d (%s) no longer affine to cpu%d\n",
|
|
task_pid_nr(p), p->comm, cpu);
|
|
}
|
|
}
|
|
|
|
return dest_cpu;
|
|
}
|
|
|
|
/*
|
|
* The caller (fork, wakeup) owns p->pi_lock, ->cpus_ptr is stable.
|
|
*/
|
|
static inline
|
|
int select_task_rq(struct task_struct *p, int cpu, int sd_flags, int wake_flags)
|
|
{
|
|
lockdep_assert_held(&p->pi_lock);
|
|
|
|
if (p->nr_cpus_allowed > 1)
|
|
cpu = p->sched_class->select_task_rq(p, cpu, sd_flags, wake_flags);
|
|
else
|
|
cpu = cpumask_any(p->cpus_ptr);
|
|
|
|
/*
|
|
* In order not to call set_task_cpu() on a blocking task we need
|
|
* to rely on ttwu() to place the task on a valid ->cpus_ptr
|
|
* CPU.
|
|
*
|
|
* Since this is common to all placement strategies, this lives here.
|
|
*
|
|
* [ this allows ->select_task() to simply return task_cpu(p) and
|
|
* not worry about this generic constraint ]
|
|
*/
|
|
if (unlikely(!is_cpu_allowed(p, cpu)))
|
|
cpu = select_fallback_rq(task_cpu(p), p);
|
|
|
|
return cpu;
|
|
}
|
|
|
|
void sched_set_stop_task(int cpu, struct task_struct *stop)
|
|
{
|
|
struct sched_param param = { .sched_priority = MAX_RT_PRIO - 1 };
|
|
struct task_struct *old_stop = cpu_rq(cpu)->stop;
|
|
|
|
if (stop) {
|
|
/*
|
|
* Make it appear like a SCHED_FIFO task, its something
|
|
* userspace knows about and won't get confused about.
|
|
*
|
|
* Also, it will make PI more or less work without too
|
|
* much confusion -- but then, stop work should not
|
|
* rely on PI working anyway.
|
|
*/
|
|
sched_setscheduler_nocheck(stop, SCHED_FIFO, ¶m);
|
|
|
|
stop->sched_class = &stop_sched_class;
|
|
}
|
|
|
|
cpu_rq(cpu)->stop = stop;
|
|
|
|
if (old_stop) {
|
|
/*
|
|
* Reset it back to a normal scheduling class so that
|
|
* it can die in pieces.
|
|
*/
|
|
old_stop->sched_class = &rt_sched_class;
|
|
}
|
|
}
|
|
|
|
#else
|
|
|
|
static inline int __set_cpus_allowed_ptr(struct task_struct *p,
|
|
const struct cpumask *new_mask, bool check)
|
|
{
|
|
return set_cpus_allowed_ptr(p, new_mask);
|
|
}
|
|
|
|
#endif /* CONFIG_SMP */
|
|
|
|
static void
|
|
ttwu_stat(struct task_struct *p, int cpu, int wake_flags)
|
|
{
|
|
struct rq *rq;
|
|
|
|
if (!schedstat_enabled())
|
|
return;
|
|
|
|
rq = this_rq();
|
|
|
|
#ifdef CONFIG_SMP
|
|
if (cpu == rq->cpu) {
|
|
__schedstat_inc(rq->ttwu_local);
|
|
__schedstat_inc(p->se.statistics.nr_wakeups_local);
|
|
} else {
|
|
struct sched_domain *sd;
|
|
|
|
__schedstat_inc(p->se.statistics.nr_wakeups_remote);
|
|
rcu_read_lock();
|
|
for_each_domain(rq->cpu, sd) {
|
|
if (cpumask_test_cpu(cpu, sched_domain_span(sd))) {
|
|
__schedstat_inc(sd->ttwu_wake_remote);
|
|
break;
|
|
}
|
|
}
|
|
rcu_read_unlock();
|
|
}
|
|
|
|
if (wake_flags & WF_MIGRATED)
|
|
__schedstat_inc(p->se.statistics.nr_wakeups_migrate);
|
|
#endif /* CONFIG_SMP */
|
|
|
|
__schedstat_inc(rq->ttwu_count);
|
|
__schedstat_inc(p->se.statistics.nr_wakeups);
|
|
|
|
if (wake_flags & WF_SYNC)
|
|
__schedstat_inc(p->se.statistics.nr_wakeups_sync);
|
|
}
|
|
|
|
/*
|
|
* Mark the task runnable and perform wakeup-preemption.
|
|
*/
|
|
static void ttwu_do_wakeup(struct rq *rq, struct task_struct *p, int wake_flags,
|
|
struct rq_flags *rf)
|
|
{
|
|
check_preempt_curr(rq, p, wake_flags);
|
|
p->state = TASK_RUNNING;
|
|
trace_sched_wakeup(p);
|
|
|
|
#ifdef CONFIG_SMP
|
|
if (p->sched_class->task_woken) {
|
|
/*
|
|
* Our task @p is fully woken up and running; so its safe to
|
|
* drop the rq->lock, hereafter rq is only used for statistics.
|
|
*/
|
|
rq_unpin_lock(rq, rf);
|
|
p->sched_class->task_woken(rq, p);
|
|
rq_repin_lock(rq, rf);
|
|
}
|
|
|
|
if (rq->idle_stamp) {
|
|
u64 delta = rq_clock(rq) - rq->idle_stamp;
|
|
u64 max = 2*rq->max_idle_balance_cost;
|
|
|
|
update_avg(&rq->avg_idle, delta);
|
|
|
|
if (rq->avg_idle > max)
|
|
rq->avg_idle = max;
|
|
|
|
rq->idle_stamp = 0;
|
|
}
|
|
#endif
|
|
}
|
|
|
|
static void
|
|
ttwu_do_activate(struct rq *rq, struct task_struct *p, int wake_flags,
|
|
struct rq_flags *rf)
|
|
{
|
|
int en_flags = ENQUEUE_WAKEUP | ENQUEUE_NOCLOCK;
|
|
|
|
if (wake_flags & WF_SYNC)
|
|
en_flags |= ENQUEUE_WAKEUP_SYNC;
|
|
|
|
lockdep_assert_held(&rq->lock);
|
|
|
|
if (p->sched_contributes_to_load)
|
|
rq->nr_uninterruptible--;
|
|
|
|
#ifdef CONFIG_SMP
|
|
if (wake_flags & WF_MIGRATED)
|
|
en_flags |= ENQUEUE_MIGRATED;
|
|
else
|
|
#endif
|
|
if (p->in_iowait) {
|
|
delayacct_blkio_end(p);
|
|
atomic_dec(&task_rq(p)->nr_iowait);
|
|
}
|
|
|
|
activate_task(rq, p, en_flags);
|
|
ttwu_do_wakeup(rq, p, wake_flags, rf);
|
|
}
|
|
|
|
/*
|
|
* Consider @p being inside a wait loop:
|
|
*
|
|
* for (;;) {
|
|
* set_current_state(TASK_UNINTERRUPTIBLE);
|
|
*
|
|
* if (CONDITION)
|
|
* break;
|
|
*
|
|
* schedule();
|
|
* }
|
|
* __set_current_state(TASK_RUNNING);
|
|
*
|
|
* between set_current_state() and schedule(). In this case @p is still
|
|
* runnable, so all that needs doing is change p->state back to TASK_RUNNING in
|
|
* an atomic manner.
|
|
*
|
|
* By taking task_rq(p)->lock we serialize against schedule(), if @p->on_rq
|
|
* then schedule() must still happen and p->state can be changed to
|
|
* TASK_RUNNING. Otherwise we lost the race, schedule() has happened, and we
|
|
* need to do a full wakeup with enqueue.
|
|
*
|
|
* Returns: %true when the wakeup is done,
|
|
* %false otherwise.
|
|
*/
|
|
static int ttwu_runnable(struct task_struct *p, int wake_flags)
|
|
{
|
|
struct rq_flags rf;
|
|
struct rq *rq;
|
|
int ret = 0;
|
|
|
|
rq = __task_rq_lock(p, &rf);
|
|
if (task_on_rq_queued(p)) {
|
|
/* check_preempt_curr() may use rq clock */
|
|
update_rq_clock(rq);
|
|
ttwu_do_wakeup(rq, p, wake_flags, &rf);
|
|
ret = 1;
|
|
}
|
|
__task_rq_unlock(rq, &rf);
|
|
|
|
return ret;
|
|
}
|
|
|
|
#ifdef CONFIG_SMP
|
|
void sched_ttwu_pending(void *arg)
|
|
{
|
|
struct llist_node *llist = arg;
|
|
struct rq *rq = this_rq();
|
|
struct task_struct *p, *t;
|
|
struct rq_flags rf;
|
|
|
|
if (!llist)
|
|
return;
|
|
|
|
/*
|
|
* rq::ttwu_pending racy indication of out-standing wakeups.
|
|
* Races such that false-negatives are possible, since they
|
|
* are shorter lived that false-positives would be.
|
|
*/
|
|
WRITE_ONCE(rq->ttwu_pending, 0);
|
|
|
|
rq_lock_irqsave(rq, &rf);
|
|
update_rq_clock(rq);
|
|
|
|
llist_for_each_entry_safe(p, t, llist, wake_entry.llist) {
|
|
if (WARN_ON_ONCE(p->on_cpu))
|
|
smp_cond_load_acquire(&p->on_cpu, !VAL);
|
|
|
|
if (WARN_ON_ONCE(task_cpu(p) != cpu_of(rq)))
|
|
set_task_cpu(p, cpu_of(rq));
|
|
|
|
ttwu_do_activate(rq, p, p->sched_remote_wakeup ? WF_MIGRATED : 0, &rf);
|
|
}
|
|
|
|
rq_unlock_irqrestore(rq, &rf);
|
|
}
|
|
|
|
void send_call_function_single_ipi(int cpu)
|
|
{
|
|
struct rq *rq = cpu_rq(cpu);
|
|
|
|
if (!set_nr_if_polling(rq->idle))
|
|
arch_send_call_function_single_ipi(cpu);
|
|
else
|
|
trace_sched_wake_idle_without_ipi(cpu);
|
|
}
|
|
|
|
/*
|
|
* Queue a task on the target CPUs wake_list and wake the CPU via IPI if
|
|
* necessary. The wakee CPU on receipt of the IPI will queue the task
|
|
* via sched_ttwu_wakeup() for activation so the wakee incurs the cost
|
|
* of the wakeup instead of the waker.
|
|
*/
|
|
static void __ttwu_queue_wakelist(struct task_struct *p, int cpu, int wake_flags)
|
|
{
|
|
struct rq *rq = cpu_rq(cpu);
|
|
|
|
p->sched_remote_wakeup = !!(wake_flags & WF_MIGRATED);
|
|
|
|
WRITE_ONCE(rq->ttwu_pending, 1);
|
|
__smp_call_single_queue(cpu, &p->wake_entry.llist);
|
|
}
|
|
|
|
void wake_up_if_idle(int cpu)
|
|
{
|
|
struct rq *rq = cpu_rq(cpu);
|
|
struct rq_flags rf;
|
|
|
|
rcu_read_lock();
|
|
|
|
if (!is_idle_task(rcu_dereference(rq->curr)))
|
|
goto out;
|
|
|
|
if (set_nr_if_polling(rq->idle)) {
|
|
trace_sched_wake_idle_without_ipi(cpu);
|
|
} else {
|
|
rq_lock_irqsave(rq, &rf);
|
|
if (is_idle_task(rq->curr))
|
|
smp_send_reschedule(cpu);
|
|
/* Else CPU is not idle, do nothing here: */
|
|
rq_unlock_irqrestore(rq, &rf);
|
|
}
|
|
|
|
out:
|
|
rcu_read_unlock();
|
|
}
|
|
EXPORT_SYMBOL_GPL(wake_up_if_idle);
|
|
|
|
bool cpus_share_cache(int this_cpu, int that_cpu)
|
|
{
|
|
return per_cpu(sd_llc_id, this_cpu) == per_cpu(sd_llc_id, that_cpu);
|
|
}
|
|
|
|
static inline bool ttwu_queue_cond(int cpu, int wake_flags)
|
|
{
|
|
/*
|
|
* If the CPU does not share cache, then queue the task on the
|
|
* remote rqs wakelist to avoid accessing remote data.
|
|
*/
|
|
if (!cpus_share_cache(smp_processor_id(), cpu))
|
|
return true;
|
|
|
|
/*
|
|
* If the task is descheduling and the only running task on the
|
|
* CPU then use the wakelist to offload the task activation to
|
|
* the soon-to-be-idle CPU as the current CPU is likely busy.
|
|
* nr_running is checked to avoid unnecessary task stacking.
|
|
*/
|
|
if ((wake_flags & WF_ON_CPU) && cpu_rq(cpu)->nr_running <= 1)
|
|
return true;
|
|
|
|
return false;
|
|
}
|
|
|
|
static bool ttwu_queue_wakelist(struct task_struct *p, int cpu, int wake_flags)
|
|
{
|
|
bool cond = false;
|
|
|
|
trace_android_rvh_ttwu_cond(&cond);
|
|
|
|
if ((sched_feat(TTWU_QUEUE) && ttwu_queue_cond(cpu, wake_flags)) ||
|
|
cond) {
|
|
if (WARN_ON_ONCE(cpu == smp_processor_id()))
|
|
return false;
|
|
|
|
sched_clock_cpu(cpu); /* Sync clocks across CPUs */
|
|
__ttwu_queue_wakelist(p, cpu, wake_flags);
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
#else /* !CONFIG_SMP */
|
|
|
|
static inline bool ttwu_queue_wakelist(struct task_struct *p, int cpu, int wake_flags)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
#endif /* CONFIG_SMP */
|
|
|
|
static void ttwu_queue(struct task_struct *p, int cpu, int wake_flags)
|
|
{
|
|
struct rq *rq = cpu_rq(cpu);
|
|
struct rq_flags rf;
|
|
|
|
if (ttwu_queue_wakelist(p, cpu, wake_flags))
|
|
return;
|
|
|
|
rq_lock(rq, &rf);
|
|
update_rq_clock(rq);
|
|
ttwu_do_activate(rq, p, wake_flags, &rf);
|
|
rq_unlock(rq, &rf);
|
|
}
|
|
|
|
/*
|
|
* Notes on Program-Order guarantees on SMP systems.
|
|
*
|
|
* MIGRATION
|
|
*
|
|
* The basic program-order guarantee on SMP systems is that when a task [t]
|
|
* migrates, all its activity on its old CPU [c0] happens-before any subsequent
|
|
* execution on its new CPU [c1].
|
|
*
|
|
* For migration (of runnable tasks) this is provided by the following means:
|
|
*
|
|
* A) UNLOCK of the rq(c0)->lock scheduling out task t
|
|
* B) migration for t is required to synchronize *both* rq(c0)->lock and
|
|
* rq(c1)->lock (if not at the same time, then in that order).
|
|
* C) LOCK of the rq(c1)->lock scheduling in task
|
|
*
|
|
* Release/acquire chaining guarantees that B happens after A and C after B.
|
|
* Note: the CPU doing B need not be c0 or c1
|
|
*
|
|
* Example:
|
|
*
|
|
* CPU0 CPU1 CPU2
|
|
*
|
|
* LOCK rq(0)->lock
|
|
* sched-out X
|
|
* sched-in Y
|
|
* UNLOCK rq(0)->lock
|
|
*
|
|
* LOCK rq(0)->lock // orders against CPU0
|
|
* dequeue X
|
|
* UNLOCK rq(0)->lock
|
|
*
|
|
* LOCK rq(1)->lock
|
|
* enqueue X
|
|
* UNLOCK rq(1)->lock
|
|
*
|
|
* LOCK rq(1)->lock // orders against CPU2
|
|
* sched-out Z
|
|
* sched-in X
|
|
* UNLOCK rq(1)->lock
|
|
*
|
|
*
|
|
* BLOCKING -- aka. SLEEP + WAKEUP
|
|
*
|
|
* For blocking we (obviously) need to provide the same guarantee as for
|
|
* migration. However the means are completely different as there is no lock
|
|
* chain to provide order. Instead we do:
|
|
*
|
|
* 1) smp_store_release(X->on_cpu, 0) -- finish_task()
|
|
* 2) smp_cond_load_acquire(!X->on_cpu) -- try_to_wake_up()
|
|
*
|
|
* Example:
|
|
*
|
|
* CPU0 (schedule) CPU1 (try_to_wake_up) CPU2 (schedule)
|
|
*
|
|
* LOCK rq(0)->lock LOCK X->pi_lock
|
|
* dequeue X
|
|
* sched-out X
|
|
* smp_store_release(X->on_cpu, 0);
|
|
*
|
|
* smp_cond_load_acquire(&X->on_cpu, !VAL);
|
|
* X->state = WAKING
|
|
* set_task_cpu(X,2)
|
|
*
|
|
* LOCK rq(2)->lock
|
|
* enqueue X
|
|
* X->state = RUNNING
|
|
* UNLOCK rq(2)->lock
|
|
*
|
|
* LOCK rq(2)->lock // orders against CPU1
|
|
* sched-out Z
|
|
* sched-in X
|
|
* UNLOCK rq(2)->lock
|
|
*
|
|
* UNLOCK X->pi_lock
|
|
* UNLOCK rq(0)->lock
|
|
*
|
|
*
|
|
* However, for wakeups there is a second guarantee we must provide, namely we
|
|
* must ensure that CONDITION=1 done by the caller can not be reordered with
|
|
* accesses to the task state; see try_to_wake_up() and set_current_state().
|
|
*/
|
|
|
|
/**
|
|
* try_to_wake_up - wake up a thread
|
|
* @p: the thread to be awakened
|
|
* @state: the mask of task states that can be woken
|
|
* @wake_flags: wake modifier flags (WF_*)
|
|
*
|
|
* Conceptually does:
|
|
*
|
|
* If (@state & @p->state) @p->state = TASK_RUNNING.
|
|
*
|
|
* If the task was not queued/runnable, also place it back on a runqueue.
|
|
*
|
|
* This function is atomic against schedule() which would dequeue the task.
|
|
*
|
|
* It issues a full memory barrier before accessing @p->state, see the comment
|
|
* with set_current_state().
|
|
*
|
|
* Uses p->pi_lock to serialize against concurrent wake-ups.
|
|
*
|
|
* Relies on p->pi_lock stabilizing:
|
|
* - p->sched_class
|
|
* - p->cpus_ptr
|
|
* - p->sched_task_group
|
|
* in order to do migration, see its use of select_task_rq()/set_task_cpu().
|
|
*
|
|
* Tries really hard to only take one task_rq(p)->lock for performance.
|
|
* Takes rq->lock in:
|
|
* - ttwu_runnable() -- old rq, unavoidable, see comment there;
|
|
* - ttwu_queue() -- new rq, for enqueue of the task;
|
|
* - psi_ttwu_dequeue() -- much sadness :-( accounting will kill us.
|
|
*
|
|
* As a consequence we race really badly with just about everything. See the
|
|
* many memory barriers and their comments for details.
|
|
*
|
|
* Return: %true if @p->state changes (an actual wakeup was done),
|
|
* %false otherwise.
|
|
*/
|
|
static int
|
|
try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
|
|
{
|
|
unsigned long flags;
|
|
int cpu, success = 0;
|
|
|
|
preempt_disable();
|
|
if (p == current) {
|
|
/*
|
|
* We're waking current, this means 'p->on_rq' and 'task_cpu(p)
|
|
* == smp_processor_id()'. Together this means we can special
|
|
* case the whole 'p->on_rq && ttwu_runnable()' case below
|
|
* without taking any locks.
|
|
*
|
|
* In particular:
|
|
* - we rely on Program-Order guarantees for all the ordering,
|
|
* - we're serialized against set_special_state() by virtue of
|
|
* it disabling IRQs (this allows not taking ->pi_lock).
|
|
*/
|
|
if (!(p->state & state))
|
|
goto out;
|
|
|
|
success = 1;
|
|
trace_sched_waking(p);
|
|
p->state = TASK_RUNNING;
|
|
trace_sched_wakeup(p);
|
|
goto out;
|
|
}
|
|
|
|
/*
|
|
* If we are going to wake up a thread waiting for CONDITION we
|
|
* need to ensure that CONDITION=1 done by the caller can not be
|
|
* reordered with p->state check below. This pairs with smp_store_mb()
|
|
* in set_current_state() that the waiting thread does.
|
|
*/
|
|
raw_spin_lock_irqsave(&p->pi_lock, flags);
|
|
smp_mb__after_spinlock();
|
|
if (!(p->state & state))
|
|
goto unlock;
|
|
|
|
#ifdef CONFIG_FREEZER
|
|
/*
|
|
* If we're going to wake up a thread which may be frozen, then
|
|
* we can only do so if we have an active CPU which is capable of
|
|
* running it. This may not be the case when resuming from suspend,
|
|
* as the secondary CPUs may not yet be back online. See __thaw_task()
|
|
* for the actual wakeup.
|
|
*/
|
|
if (unlikely(frozen_or_skipped(p)) &&
|
|
!cpumask_intersects(cpu_active_mask, task_cpu_possible_mask(p)))
|
|
goto unlock;
|
|
#endif
|
|
|
|
trace_sched_waking(p);
|
|
|
|
/* We're going to change ->state: */
|
|
success = 1;
|
|
|
|
/*
|
|
* Ensure we load p->on_rq _after_ p->state, otherwise it would
|
|
* be possible to, falsely, observe p->on_rq == 0 and get stuck
|
|
* in smp_cond_load_acquire() below.
|
|
*
|
|
* sched_ttwu_pending() try_to_wake_up()
|
|
* STORE p->on_rq = 1 LOAD p->state
|
|
* UNLOCK rq->lock
|
|
*
|
|
* __schedule() (switch to task 'p')
|
|
* LOCK rq->lock smp_rmb();
|
|
* smp_mb__after_spinlock();
|
|
* UNLOCK rq->lock
|
|
*
|
|
* [task p]
|
|
* STORE p->state = UNINTERRUPTIBLE LOAD p->on_rq
|
|
*
|
|
* Pairs with the LOCK+smp_mb__after_spinlock() on rq->lock in
|
|
* __schedule(). See the comment for smp_mb__after_spinlock().
|
|
*
|
|
* A similar smb_rmb() lives in try_invoke_on_locked_down_task().
|
|
*/
|
|
smp_rmb();
|
|
if (READ_ONCE(p->on_rq) && ttwu_runnable(p, wake_flags))
|
|
goto unlock;
|
|
|
|
if (p->state & TASK_UNINTERRUPTIBLE)
|
|
trace_sched_blocked_reason(p);
|
|
|
|
#ifdef CONFIG_SMP
|
|
/*
|
|
* Ensure we load p->on_cpu _after_ p->on_rq, otherwise it would be
|
|
* possible to, falsely, observe p->on_cpu == 0.
|
|
*
|
|
* One must be running (->on_cpu == 1) in order to remove oneself
|
|
* from the runqueue.
|
|
*
|
|
* __schedule() (switch to task 'p') try_to_wake_up()
|
|
* STORE p->on_cpu = 1 LOAD p->on_rq
|
|
* UNLOCK rq->lock
|
|
*
|
|
* __schedule() (put 'p' to sleep)
|
|
* LOCK rq->lock smp_rmb();
|
|
* smp_mb__after_spinlock();
|
|
* STORE p->on_rq = 0 LOAD p->on_cpu
|
|
*
|
|
* Pairs with the LOCK+smp_mb__after_spinlock() on rq->lock in
|
|
* __schedule(). See the comment for smp_mb__after_spinlock().
|
|
*
|
|
* Form a control-dep-acquire with p->on_rq == 0 above, to ensure
|
|
* schedule()'s deactivate_task() has 'happened' and p will no longer
|
|
* care about it's own p->state. See the comment in __schedule().
|
|
*/
|
|
smp_acquire__after_ctrl_dep();
|
|
|
|
/*
|
|
* We're doing the wakeup (@success == 1), they did a dequeue (p->on_rq
|
|
* == 0), which means we need to do an enqueue, change p->state to
|
|
* TASK_WAKING such that we can unlock p->pi_lock before doing the
|
|
* enqueue, such as ttwu_queue_wakelist().
|
|
*/
|
|
p->state = TASK_WAKING;
|
|
|
|
/*
|
|
* If the owning (remote) CPU is still in the middle of schedule() with
|
|
* this task as prev, considering queueing p on the remote CPUs wake_list
|
|
* which potentially sends an IPI instead of spinning on p->on_cpu to
|
|
* let the waker make forward progress. This is safe because IRQs are
|
|
* disabled and the IPI will deliver after on_cpu is cleared.
|
|
*
|
|
* Ensure we load task_cpu(p) after p->on_cpu:
|
|
*
|
|
* set_task_cpu(p, cpu);
|
|
* STORE p->cpu = @cpu
|
|
* __schedule() (switch to task 'p')
|
|
* LOCK rq->lock
|
|
* smp_mb__after_spin_lock() smp_cond_load_acquire(&p->on_cpu)
|
|
* STORE p->on_cpu = 1 LOAD p->cpu
|
|
*
|
|
* to ensure we observe the correct CPU on which the task is currently
|
|
* scheduling.
|
|
*/
|
|
if (smp_load_acquire(&p->on_cpu) &&
|
|
ttwu_queue_wakelist(p, task_cpu(p), wake_flags | WF_ON_CPU))
|
|
goto unlock;
|
|
|
|
/*
|
|
* If the owning (remote) CPU is still in the middle of schedule() with
|
|
* this task as prev, wait until its done referencing the task.
|
|
*
|
|
* Pairs with the smp_store_release() in finish_task().
|
|
*
|
|
* This ensures that tasks getting woken will be fully ordered against
|
|
* their previous state and preserve Program Order.
|
|
*/
|
|
smp_cond_load_acquire(&p->on_cpu, !VAL);
|
|
|
|
trace_android_rvh_try_to_wake_up(p);
|
|
|
|
cpu = select_task_rq(p, p->wake_cpu, SD_BALANCE_WAKE, wake_flags);
|
|
if (task_cpu(p) != cpu) {
|
|
if (p->in_iowait) {
|
|
delayacct_blkio_end(p);
|
|
atomic_dec(&task_rq(p)->nr_iowait);
|
|
}
|
|
|
|
wake_flags |= WF_MIGRATED;
|
|
psi_ttwu_dequeue(p);
|
|
set_task_cpu(p, cpu);
|
|
}
|
|
#else
|
|
cpu = task_cpu(p);
|
|
#endif /* CONFIG_SMP */
|
|
|
|
ttwu_queue(p, cpu, wake_flags);
|
|
unlock:
|
|
raw_spin_unlock_irqrestore(&p->pi_lock, flags);
|
|
out:
|
|
if (success) {
|
|
trace_android_rvh_try_to_wake_up_success(p);
|
|
ttwu_stat(p, task_cpu(p), wake_flags);
|
|
}
|
|
preempt_enable();
|
|
|
|
return success;
|
|
}
|
|
|
|
/**
|
|
* try_invoke_on_locked_down_task - Invoke a function on task in fixed state
|
|
* @p: Process for which the function is to be invoked, can be @current.
|
|
* @func: Function to invoke.
|
|
* @arg: Argument to function.
|
|
*
|
|
* If the specified task can be quickly locked into a definite state
|
|
* (either sleeping or on a given runqueue), arrange to keep it in that
|
|
* state while invoking @func(@arg). This function can use ->on_rq and
|
|
* task_curr() to work out what the state is, if required. Given that
|
|
* @func can be invoked with a runqueue lock held, it had better be quite
|
|
* lightweight.
|
|
*
|
|
* Returns:
|
|
* @false if the task slipped out from under the locks.
|
|
* @true if the task was locked onto a runqueue or is sleeping.
|
|
* However, @func can override this by returning @false.
|
|
*/
|
|
bool try_invoke_on_locked_down_task(struct task_struct *p, bool (*func)(struct task_struct *t, void *arg), void *arg)
|
|
{
|
|
struct rq_flags rf;
|
|
bool ret = false;
|
|
struct rq *rq;
|
|
|
|
raw_spin_lock_irqsave(&p->pi_lock, rf.flags);
|
|
if (p->on_rq) {
|
|
rq = __task_rq_lock(p, &rf);
|
|
if (task_rq(p) == rq)
|
|
ret = func(p, arg);
|
|
rq_unlock(rq, &rf);
|
|
} else {
|
|
switch (p->state) {
|
|
case TASK_RUNNING:
|
|
case TASK_WAKING:
|
|
break;
|
|
default:
|
|
smp_rmb(); // See smp_rmb() comment in try_to_wake_up().
|
|
if (!p->on_rq)
|
|
ret = func(p, arg);
|
|
}
|
|
}
|
|
raw_spin_unlock_irqrestore(&p->pi_lock, rf.flags);
|
|
return ret;
|
|
}
|
|
|
|
/**
|
|
* wake_up_process - Wake up a specific process
|
|
* @p: The process to be woken up.
|
|
*
|
|
* Attempt to wake up the nominated process and move it to the set of runnable
|
|
* processes.
|
|
*
|
|
* Return: 1 if the process was woken up, 0 if it was already running.
|
|
*
|
|
* This function executes a full memory barrier before accessing the task state.
|
|
*/
|
|
int wake_up_process(struct task_struct *p)
|
|
{
|
|
return try_to_wake_up(p, TASK_NORMAL, 0);
|
|
}
|
|
EXPORT_SYMBOL(wake_up_process);
|
|
|
|
int wake_up_state(struct task_struct *p, unsigned int state)
|
|
{
|
|
return try_to_wake_up(p, state, 0);
|
|
}
|
|
|
|
/*
|
|
* Perform scheduler related setup for a newly forked process p.
|
|
* p is forked by current.
|
|
*
|
|
* __sched_fork() is basic setup used by init_idle() too:
|
|
*/
|
|
static void __sched_fork(unsigned long clone_flags, struct task_struct *p)
|
|
{
|
|
p->on_rq = 0;
|
|
|
|
p->se.on_rq = 0;
|
|
p->se.exec_start = 0;
|
|
p->se.sum_exec_runtime = 0;
|
|
p->se.prev_sum_exec_runtime = 0;
|
|
p->se.nr_migrations = 0;
|
|
p->se.vruntime = 0;
|
|
INIT_LIST_HEAD(&p->se.group_node);
|
|
|
|
#ifdef CONFIG_FAIR_GROUP_SCHED
|
|
p->se.cfs_rq = NULL;
|
|
#endif
|
|
|
|
trace_android_rvh_sched_fork_init(p);
|
|
|
|
#ifdef CONFIG_SCHEDSTATS
|
|
/* Even if schedstat is disabled, there should not be garbage */
|
|
memset(&p->se.statistics, 0, sizeof(p->se.statistics));
|
|
#endif
|
|
|
|
RB_CLEAR_NODE(&p->dl.rb_node);
|
|
init_dl_task_timer(&p->dl);
|
|
init_dl_inactive_task_timer(&p->dl);
|
|
__dl_clear_params(p);
|
|
|
|
INIT_LIST_HEAD(&p->rt.run_list);
|
|
p->rt.timeout = 0;
|
|
p->rt.time_slice = sched_rr_timeslice;
|
|
p->rt.on_rq = 0;
|
|
p->rt.on_list = 0;
|
|
|
|
#ifdef CONFIG_PREEMPT_NOTIFIERS
|
|
INIT_HLIST_HEAD(&p->preempt_notifiers);
|
|
#endif
|
|
|
|
#ifdef CONFIG_COMPACTION
|
|
p->capture_control = NULL;
|
|
#endif
|
|
init_numa_balancing(clone_flags, p);
|
|
#ifdef CONFIG_SMP
|
|
p->wake_entry.u_flags = CSD_TYPE_TTWU;
|
|
#endif
|
|
}
|
|
|
|
DEFINE_STATIC_KEY_FALSE(sched_numa_balancing);
|
|
|
|
#ifdef CONFIG_NUMA_BALANCING
|
|
|
|
void set_numabalancing_state(bool enabled)
|
|
{
|
|
if (enabled)
|
|
static_branch_enable(&sched_numa_balancing);
|
|
else
|
|
static_branch_disable(&sched_numa_balancing);
|
|
}
|
|
|
|
#ifdef CONFIG_PROC_SYSCTL
|
|
int sysctl_numa_balancing(struct ctl_table *table, int write,
|
|
void *buffer, size_t *lenp, loff_t *ppos)
|
|
{
|
|
struct ctl_table t;
|
|
int err;
|
|
int state = static_branch_likely(&sched_numa_balancing);
|
|
|
|
if (write && !capable(CAP_SYS_ADMIN))
|
|
return -EPERM;
|
|
|
|
t = *table;
|
|
t.data = &state;
|
|
err = proc_dointvec_minmax(&t, write, buffer, lenp, ppos);
|
|
if (err < 0)
|
|
return err;
|
|
if (write)
|
|
set_numabalancing_state(state);
|
|
return err;
|
|
}
|
|
#endif
|
|
#endif
|
|
|
|
#ifdef CONFIG_SCHEDSTATS
|
|
|
|
DEFINE_STATIC_KEY_FALSE(sched_schedstats);
|
|
static bool __initdata __sched_schedstats = false;
|
|
|
|
static void set_schedstats(bool enabled)
|
|
{
|
|
if (enabled)
|
|
static_branch_enable(&sched_schedstats);
|
|
else
|
|
static_branch_disable(&sched_schedstats);
|
|
}
|
|
|
|
void force_schedstat_enabled(void)
|
|
{
|
|
if (!schedstat_enabled()) {
|
|
pr_info("kernel profiling enabled schedstats, disable via kernel.sched_schedstats.\n");
|
|
static_branch_enable(&sched_schedstats);
|
|
}
|
|
}
|
|
|
|
static int __init setup_schedstats(char *str)
|
|
{
|
|
int ret = 0;
|
|
if (!str)
|
|
goto out;
|
|
|
|
/*
|
|
* This code is called before jump labels have been set up, so we can't
|
|
* change the static branch directly just yet. Instead set a temporary
|
|
* variable so init_schedstats() can do it later.
|
|
*/
|
|
if (!strcmp(str, "enable")) {
|
|
__sched_schedstats = true;
|
|
ret = 1;
|
|
} else if (!strcmp(str, "disable")) {
|
|
__sched_schedstats = false;
|
|
ret = 1;
|
|
}
|
|
out:
|
|
if (!ret)
|
|
pr_warn("Unable to parse schedstats=\n");
|
|
|
|
return ret;
|
|
}
|
|
__setup("schedstats=", setup_schedstats);
|
|
|
|
static void __init init_schedstats(void)
|
|
{
|
|
set_schedstats(__sched_schedstats);
|
|
}
|
|
|
|
#ifdef CONFIG_PROC_SYSCTL
|
|
int sysctl_schedstats(struct ctl_table *table, int write, void *buffer,
|
|
size_t *lenp, loff_t *ppos)
|
|
{
|
|
struct ctl_table t;
|
|
int err;
|
|
int state = static_branch_likely(&sched_schedstats);
|
|
|
|
if (write && !capable(CAP_SYS_ADMIN))
|
|
return -EPERM;
|
|
|
|
t = *table;
|
|
t.data = &state;
|
|
err = proc_dointvec_minmax(&t, write, buffer, lenp, ppos);
|
|
if (err < 0)
|
|
return err;
|
|
if (write)
|
|
set_schedstats(state);
|
|
return err;
|
|
}
|
|
#endif /* CONFIG_PROC_SYSCTL */
|
|
#else /* !CONFIG_SCHEDSTATS */
|
|
static inline void init_schedstats(void) {}
|
|
#endif /* CONFIG_SCHEDSTATS */
|
|
|
|
/*
|
|
* fork()/clone()-time setup:
|
|
*/
|
|
int sched_fork(unsigned long clone_flags, struct task_struct *p)
|
|
{
|
|
unsigned long flags;
|
|
|
|
trace_android_rvh_sched_fork(p);
|
|
|
|
__sched_fork(clone_flags, p);
|
|
/*
|
|
* We mark the process as NEW here. This guarantees that
|
|
* nobody will actually run it, and a signal or other external
|
|
* event cannot wake it up and insert it on the runqueue either.
|
|
*/
|
|
p->state = TASK_NEW;
|
|
|
|
/*
|
|
* Make sure we do not leak PI boosting priority to the child.
|
|
*/
|
|
p->prio = current->normal_prio;
|
|
trace_android_rvh_prepare_prio_fork(p);
|
|
|
|
uclamp_fork(p);
|
|
|
|
/*
|
|
* Revert to default priority/policy on fork if requested.
|
|
*/
|
|
if (unlikely(p->sched_reset_on_fork)) {
|
|
if (task_has_dl_policy(p) || task_has_rt_policy(p)) {
|
|
p->policy = SCHED_NORMAL;
|
|
p->static_prio = NICE_TO_PRIO(0);
|
|
p->rt_priority = 0;
|
|
} else if (PRIO_TO_NICE(p->static_prio) < 0)
|
|
p->static_prio = NICE_TO_PRIO(0);
|
|
|
|
p->prio = p->normal_prio = p->static_prio;
|
|
set_load_weight(p, false);
|
|
|
|
/*
|
|
* We don't need the reset flag anymore after the fork. It has
|
|
* fulfilled its duty:
|
|
*/
|
|
p->sched_reset_on_fork = 0;
|
|
}
|
|
|
|
if (dl_prio(p->prio))
|
|
return -EAGAIN;
|
|
else if (rt_prio(p->prio))
|
|
p->sched_class = &rt_sched_class;
|
|
else
|
|
p->sched_class = &fair_sched_class;
|
|
|
|
init_entity_runnable_average(&p->se);
|
|
trace_android_rvh_finish_prio_fork(p);
|
|
|
|
/*
|
|
* The child is not yet in the pid-hash so no cgroup attach races,
|
|
* and the cgroup is pinned to this child due to cgroup_fork()
|
|
* is ran before sched_fork().
|
|
*
|
|
* Silence PROVE_RCU.
|
|
*/
|
|
raw_spin_lock_irqsave(&p->pi_lock, flags);
|
|
rseq_migrate(p);
|
|
/*
|
|
* We're setting the CPU for the first time, we don't migrate,
|
|
* so use __set_task_cpu().
|
|
*/
|
|
__set_task_cpu(p, smp_processor_id());
|
|
if (p->sched_class->task_fork)
|
|
p->sched_class->task_fork(p);
|
|
raw_spin_unlock_irqrestore(&p->pi_lock, flags);
|
|
|
|
#ifdef CONFIG_SCHED_INFO
|
|
if (likely(sched_info_on()))
|
|
memset(&p->sched_info, 0, sizeof(p->sched_info));
|
|
#endif
|
|
#if defined(CONFIG_SMP)
|
|
p->on_cpu = 0;
|
|
#endif
|
|
init_task_preempt_count(p);
|
|
#ifdef CONFIG_SMP
|
|
plist_node_init(&p->pushable_tasks, MAX_PRIO);
|
|
RB_CLEAR_NODE(&p->pushable_dl_tasks);
|
|
#endif
|
|
return 0;
|
|
}
|
|
|
|
void sched_post_fork(struct task_struct *p)
|
|
{
|
|
uclamp_post_fork(p);
|
|
}
|
|
|
|
unsigned long to_ratio(u64 period, u64 runtime)
|
|
{
|
|
if (runtime == RUNTIME_INF)
|
|
return BW_UNIT;
|
|
|
|
/*
|
|
* Doing this here saves a lot of checks in all
|
|
* the calling paths, and returning zero seems
|
|
* safe for them anyway.
|
|
*/
|
|
if (period == 0)
|
|
return 0;
|
|
|
|
return div64_u64(runtime << BW_SHIFT, period);
|
|
}
|
|
|
|
/*
|
|
* wake_up_new_task - wake up a newly created task for the first time.
|
|
*
|
|
* This function will do some initial scheduler statistics housekeeping
|
|
* that must be done for every newly created context, then puts the task
|
|
* on the runqueue and wakes it.
|
|
*/
|
|
void wake_up_new_task(struct task_struct *p)
|
|
{
|
|
struct rq_flags rf;
|
|
struct rq *rq;
|
|
|
|
trace_android_rvh_wake_up_new_task(p);
|
|
|
|
raw_spin_lock_irqsave(&p->pi_lock, rf.flags);
|
|
p->state = TASK_RUNNING;
|
|
#ifdef CONFIG_SMP
|
|
/*
|
|
* Fork balancing, do it here and not earlier because:
|
|
* - cpus_ptr can change in the fork path
|
|
* - any previously selected CPU might disappear through hotplug
|
|
*
|
|
* Use __set_task_cpu() to avoid calling sched_class::migrate_task_rq,
|
|
* as we're not fully set-up yet.
|
|
*/
|
|
p->recent_used_cpu = task_cpu(p);
|
|
rseq_migrate(p);
|
|
__set_task_cpu(p, select_task_rq(p, task_cpu(p), SD_BALANCE_FORK, 0));
|
|
#endif
|
|
rq = __task_rq_lock(p, &rf);
|
|
update_rq_clock(rq);
|
|
post_init_entity_util_avg(p);
|
|
trace_android_rvh_new_task_stats(p);
|
|
|
|
activate_task(rq, p, ENQUEUE_NOCLOCK);
|
|
trace_sched_wakeup_new(p);
|
|
check_preempt_curr(rq, p, WF_FORK);
|
|
#ifdef CONFIG_SMP
|
|
if (p->sched_class->task_woken) {
|
|
/*
|
|
* Nothing relies on rq->lock after this, so its fine to
|
|
* drop it.
|
|
*/
|
|
rq_unpin_lock(rq, &rf);
|
|
p->sched_class->task_woken(rq, p);
|
|
rq_repin_lock(rq, &rf);
|
|
}
|
|
#endif
|
|
task_rq_unlock(rq, p, &rf);
|
|
}
|
|
|
|
#ifdef CONFIG_PREEMPT_NOTIFIERS
|
|
|
|
static DEFINE_STATIC_KEY_FALSE(preempt_notifier_key);
|
|
|
|
void preempt_notifier_inc(void)
|
|
{
|
|
static_branch_inc(&preempt_notifier_key);
|
|
}
|
|
EXPORT_SYMBOL_GPL(preempt_notifier_inc);
|
|
|
|
void preempt_notifier_dec(void)
|
|
{
|
|
static_branch_dec(&preempt_notifier_key);
|
|
}
|
|
EXPORT_SYMBOL_GPL(preempt_notifier_dec);
|
|
|
|
/**
|
|
* preempt_notifier_register - tell me when current is being preempted & rescheduled
|
|
* @notifier: notifier struct to register
|
|
*/
|
|
void preempt_notifier_register(struct preempt_notifier *notifier)
|
|
{
|
|
if (!static_branch_unlikely(&preempt_notifier_key))
|
|
WARN(1, "registering preempt_notifier while notifiers disabled\n");
|
|
|
|
hlist_add_head(¬ifier->link, ¤t->preempt_notifiers);
|
|
}
|
|
EXPORT_SYMBOL_GPL(preempt_notifier_register);
|
|
|
|
/**
|
|
* preempt_notifier_unregister - no longer interested in preemption notifications
|
|
* @notifier: notifier struct to unregister
|
|
*
|
|
* This is *not* safe to call from within a preemption notifier.
|
|
*/
|
|
void preempt_notifier_unregister(struct preempt_notifier *notifier)
|
|
{
|
|
hlist_del(¬ifier->link);
|
|
}
|
|
EXPORT_SYMBOL_GPL(preempt_notifier_unregister);
|
|
|
|
static void __fire_sched_in_preempt_notifiers(struct task_struct *curr)
|
|
{
|
|
struct preempt_notifier *notifier;
|
|
|
|
hlist_for_each_entry(notifier, &curr->preempt_notifiers, link)
|
|
notifier->ops->sched_in(notifier, raw_smp_processor_id());
|
|
}
|
|
|
|
static __always_inline void fire_sched_in_preempt_notifiers(struct task_struct *curr)
|
|
{
|
|
if (static_branch_unlikely(&preempt_notifier_key))
|
|
__fire_sched_in_preempt_notifiers(curr);
|
|
}
|
|
|
|
static void
|
|
__fire_sched_out_preempt_notifiers(struct task_struct *curr,
|
|
struct task_struct *next)
|
|
{
|
|
struct preempt_notifier *notifier;
|
|
|
|
hlist_for_each_entry(notifier, &curr->preempt_notifiers, link)
|
|
notifier->ops->sched_out(notifier, next);
|
|
}
|
|
|
|
static __always_inline void
|
|
fire_sched_out_preempt_notifiers(struct task_struct *curr,
|
|
struct task_struct *next)
|
|
{
|
|
if (static_branch_unlikely(&preempt_notifier_key))
|
|
__fire_sched_out_preempt_notifiers(curr, next);
|
|
}
|
|
|
|
#else /* !CONFIG_PREEMPT_NOTIFIERS */
|
|
|
|
static inline void fire_sched_in_preempt_notifiers(struct task_struct *curr)
|
|
{
|
|
}
|
|
|
|
static inline void
|
|
fire_sched_out_preempt_notifiers(struct task_struct *curr,
|
|
struct task_struct *next)
|
|
{
|
|
}
|
|
|
|
#endif /* CONFIG_PREEMPT_NOTIFIERS */
|
|
|
|
static inline void prepare_task(struct task_struct *next)
|
|
{
|
|
#ifdef CONFIG_SMP
|
|
/*
|
|
* Claim the task as running, we do this before switching to it
|
|
* such that any running task will have this set.
|
|
*
|
|
* See the ttwu() WF_ON_CPU case and its ordering comment.
|
|
*/
|
|
WRITE_ONCE(next->on_cpu, 1);
|
|
#endif
|
|
}
|
|
|
|
static inline void finish_task(struct task_struct *prev)
|
|
{
|
|
#ifdef CONFIG_SMP
|
|
/*
|
|
* This must be the very last reference to @prev from this CPU. After
|
|
* p->on_cpu is cleared, the task can be moved to a different CPU. We
|
|
* must ensure this doesn't happen until the switch is completely
|
|
* finished.
|
|
*
|
|
* In particular, the load of prev->state in finish_task_switch() must
|
|
* happen before this.
|
|
*
|
|
* Pairs with the smp_cond_load_acquire() in try_to_wake_up().
|
|
*/
|
|
smp_store_release(&prev->on_cpu, 0);
|
|
#endif
|
|
}
|
|
|
|
static inline void
|
|
prepare_lock_switch(struct rq *rq, struct task_struct *next, struct rq_flags *rf)
|
|
{
|
|
/*
|
|
* Since the runqueue lock will be released by the next
|
|
* task (which is an invalid locking op but in the case
|
|
* of the scheduler it's an obvious special-case), so we
|
|
* do an early lockdep release here:
|
|
*/
|
|
rq_unpin_lock(rq, rf);
|
|
spin_release(&rq->lock.dep_map, _THIS_IP_);
|
|
#ifdef CONFIG_DEBUG_SPINLOCK
|
|
/* this is a valid case when another task releases the spinlock */
|
|
rq->lock.owner = next;
|
|
#endif
|
|
}
|
|
|
|
static inline void finish_lock_switch(struct rq *rq)
|
|
{
|
|
/*
|
|
* If we are tracking spinlock dependencies then we have to
|
|
* fix up the runqueue lock - which gets 'carried over' from
|
|
* prev into current:
|
|
*/
|
|
spin_acquire(&rq->lock.dep_map, 0, 0, _THIS_IP_);
|
|
raw_spin_unlock_irq(&rq->lock);
|
|
}
|
|
|
|
/*
|
|
* NOP if the arch has not defined these:
|
|
*/
|
|
|
|
#ifndef prepare_arch_switch
|
|
# define prepare_arch_switch(next) do { } while (0)
|
|
#endif
|
|
|
|
#ifndef finish_arch_post_lock_switch
|
|
# define finish_arch_post_lock_switch() do { } while (0)
|
|
#endif
|
|
|
|
/**
|
|
* prepare_task_switch - prepare to switch tasks
|
|
* @rq: the runqueue preparing to switch
|
|
* @prev: the current task that is being switched out
|
|
* @next: the task we are going to switch to.
|
|
*
|
|
* This is called with the rq lock held and interrupts off. It must
|
|
* be paired with a subsequent finish_task_switch after the context
|
|
* switch.
|
|
*
|
|
* prepare_task_switch sets up locking and calls architecture specific
|
|
* hooks.
|
|
*/
|
|
static inline void
|
|
prepare_task_switch(struct rq *rq, struct task_struct *prev,
|
|
struct task_struct *next)
|
|
{
|
|
kcov_prepare_switch(prev);
|
|
sched_info_switch(rq, prev, next);
|
|
perf_event_task_sched_out(prev, next);
|
|
rseq_preempt(prev);
|
|
fire_sched_out_preempt_notifiers(prev, next);
|
|
prepare_task(next);
|
|
prepare_arch_switch(next);
|
|
}
|
|
|
|
/**
|
|
* finish_task_switch - clean up after a task-switch
|
|
* @prev: the thread we just switched away from.
|
|
*
|
|
* finish_task_switch must be called after the context switch, paired
|
|
* with a prepare_task_switch call before the context switch.
|
|
* finish_task_switch will reconcile locking set up by prepare_task_switch,
|
|
* and do any other architecture-specific cleanup actions.
|
|
*
|
|
* Note that we may have delayed dropping an mm in context_switch(). If
|
|
* so, we finish that here outside of the runqueue lock. (Doing it
|
|
* with the lock held can cause deadlocks; see schedule() for
|
|
* details.)
|
|
*
|
|
* The context switch have flipped the stack from under us and restored the
|
|
* local variables which were saved when this task called schedule() in the
|
|
* past. prev == current is still correct but we need to recalculate this_rq
|
|
* because prev may have moved to another CPU.
|
|
*/
|
|
static struct rq *finish_task_switch(struct task_struct *prev)
|
|
__releases(rq->lock)
|
|
{
|
|
struct rq *rq = this_rq();
|
|
struct mm_struct *mm = rq->prev_mm;
|
|
long prev_state;
|
|
|
|
/*
|
|
* The previous task will have left us with a preempt_count of 2
|
|
* because it left us after:
|
|
*
|
|
* schedule()
|
|
* preempt_disable(); // 1
|
|
* __schedule()
|
|
* raw_spin_lock_irq(&rq->lock) // 2
|
|
*
|
|
* Also, see FORK_PREEMPT_COUNT.
|
|
*/
|
|
if (WARN_ONCE(preempt_count() != 2*PREEMPT_DISABLE_OFFSET,
|
|
"corrupted preempt_count: %s/%d/0x%x\n",
|
|
current->comm, current->pid, preempt_count()))
|
|
preempt_count_set(FORK_PREEMPT_COUNT);
|
|
|
|
rq->prev_mm = NULL;
|
|
|
|
/*
|
|
* A task struct has one reference for the use as "current".
|
|
* If a task dies, then it sets TASK_DEAD in tsk->state and calls
|
|
* schedule one last time. The schedule call will never return, and
|
|
* the scheduled task must drop that reference.
|
|
*
|
|
* We must observe prev->state before clearing prev->on_cpu (in
|
|
* finish_task), otherwise a concurrent wakeup can get prev
|
|
* running on another CPU and we could rave with its RUNNING -> DEAD
|
|
* transition, resulting in a double drop.
|
|
*/
|
|
prev_state = prev->state;
|
|
vtime_task_switch(prev);
|
|
perf_event_task_sched_in(prev, current);
|
|
finish_task(prev);
|
|
finish_lock_switch(rq);
|
|
finish_arch_post_lock_switch();
|
|
kcov_finish_switch(current);
|
|
|
|
fire_sched_in_preempt_notifiers(current);
|
|
/*
|
|
* When switching through a kernel thread, the loop in
|
|
* membarrier_{private,global}_expedited() may have observed that
|
|
* kernel thread and not issued an IPI. It is therefore possible to
|
|
* schedule between user->kernel->user threads without passing though
|
|
* switch_mm(). Membarrier requires a barrier after storing to
|
|
* rq->curr, before returning to userspace, so provide them here:
|
|
*
|
|
* - a full memory barrier for {PRIVATE,GLOBAL}_EXPEDITED, implicitly
|
|
* provided by mmdrop(),
|
|
* - a sync_core for SYNC_CORE.
|
|
*/
|
|
if (mm) {
|
|
membarrier_mm_sync_core_before_usermode(mm);
|
|
mmdrop(mm);
|
|
}
|
|
if (unlikely(prev_state == TASK_DEAD)) {
|
|
if (prev->sched_class->task_dead)
|
|
prev->sched_class->task_dead(prev);
|
|
|
|
/*
|
|
* Remove function-return probe instances associated with this
|
|
* task and put them back on the free list.
|
|
*/
|
|
kprobe_flush_task(prev);
|
|
trace_android_rvh_flush_task(prev);
|
|
|
|
/* Task is done with its stack. */
|
|
put_task_stack(prev);
|
|
|
|
put_task_struct_rcu_user(prev);
|
|
}
|
|
|
|
tick_nohz_task_switch();
|
|
return rq;
|
|
}
|
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
/* rq->lock is NOT held, but preemption is disabled */
|
|
static void __balance_callback(struct rq *rq)
|
|
{
|
|
struct callback_head *head, *next;
|
|
void (*func)(struct rq *rq);
|
|
unsigned long flags;
|
|
|
|
raw_spin_lock_irqsave(&rq->lock, flags);
|
|
head = rq->balance_callback;
|
|
rq->balance_callback = NULL;
|
|
while (head) {
|
|
func = (void (*)(struct rq *))head->func;
|
|
next = head->next;
|
|
head->next = NULL;
|
|
head = next;
|
|
|
|
func(rq);
|
|
}
|
|
raw_spin_unlock_irqrestore(&rq->lock, flags);
|
|
}
|
|
|
|
static inline void balance_callback(struct rq *rq)
|
|
{
|
|
if (unlikely(rq->balance_callback))
|
|
__balance_callback(rq);
|
|
}
|
|
|
|
#else
|
|
|
|
static inline void balance_callback(struct rq *rq)
|
|
{
|
|
}
|
|
|
|
#endif
|
|
|
|
/**
|
|
* schedule_tail - first thing a freshly forked thread must call.
|
|
* @prev: the thread we just switched away from.
|
|
*/
|
|
asmlinkage __visible void schedule_tail(struct task_struct *prev)
|
|
__releases(rq->lock)
|
|
{
|
|
struct rq *rq;
|
|
|
|
/*
|
|
* New tasks start with FORK_PREEMPT_COUNT, see there and
|
|
* finish_task_switch() for details.
|
|
*
|
|
* finish_task_switch() will drop rq->lock() and lower preempt_count
|
|
* and the preempt_enable() will end up enabling preemption (on
|
|
* PREEMPT_COUNT kernels).
|
|
*/
|
|
|
|
rq = finish_task_switch(prev);
|
|
balance_callback(rq);
|
|
preempt_enable();
|
|
|
|
if (current->set_child_tid)
|
|
put_user(task_pid_vnr(current), current->set_child_tid);
|
|
|
|
calculate_sigpending();
|
|
}
|
|
|
|
/*
|
|
* context_switch - switch to the new MM and the new thread's register state.
|
|
*/
|
|
static __always_inline struct rq *
|
|
context_switch(struct rq *rq, struct task_struct *prev,
|
|
struct task_struct *next, struct rq_flags *rf)
|
|
{
|
|
prepare_task_switch(rq, prev, next);
|
|
|
|
/*
|
|
* For paravirt, this is coupled with an exit in switch_to to
|
|
* combine the page table reload and the switch backend into
|
|
* one hypercall.
|
|
*/
|
|
arch_start_context_switch(prev);
|
|
|
|
/*
|
|
* kernel -> kernel lazy + transfer active
|
|
* user -> kernel lazy + mmgrab() active
|
|
*
|
|
* kernel -> user switch + mmdrop() active
|
|
* user -> user switch
|
|
*/
|
|
if (!next->mm) { // to kernel
|
|
enter_lazy_tlb(prev->active_mm, next);
|
|
|
|
next->active_mm = prev->active_mm;
|
|
if (prev->mm) // from user
|
|
mmgrab(prev->active_mm);
|
|
else
|
|
prev->active_mm = NULL;
|
|
} else { // to user
|
|
membarrier_switch_mm(rq, prev->active_mm, next->mm);
|
|
/*
|
|
* sys_membarrier() requires an smp_mb() between setting
|
|
* rq->curr / membarrier_switch_mm() and returning to userspace.
|
|
*
|
|
* The below provides this either through switch_mm(), or in
|
|
* case 'prev->active_mm == next->mm' through
|
|
* finish_task_switch()'s mmdrop().
|
|
*/
|
|
switch_mm_irqs_off(prev->active_mm, next->mm, next);
|
|
|
|
if (!prev->mm) { // from kernel
|
|
/* will mmdrop() in finish_task_switch(). */
|
|
rq->prev_mm = prev->active_mm;
|
|
prev->active_mm = NULL;
|
|
}
|
|
}
|
|
|
|
rq->clock_update_flags &= ~(RQCF_ACT_SKIP|RQCF_REQ_SKIP);
|
|
|
|
prepare_lock_switch(rq, next, rf);
|
|
|
|
/* Here we just switch the register state and the stack. */
|
|
switch_to(prev, next, prev);
|
|
barrier();
|
|
|
|
return finish_task_switch(prev);
|
|
}
|
|
|
|
/*
|
|
* nr_running and nr_context_switches:
|
|
*
|
|
* externally visible scheduler statistics: current number of runnable
|
|
* threads, total number of context switches performed since bootup.
|
|
*/
|
|
unsigned long nr_running(void)
|
|
{
|
|
unsigned long i, sum = 0;
|
|
|
|
for_each_online_cpu(i)
|
|
sum += cpu_rq(i)->nr_running;
|
|
|
|
return sum;
|
|
}
|
|
|
|
/*
|
|
* Check if only the current task is running on the CPU.
|
|
*
|
|
* Caution: this function does not check that the caller has disabled
|
|
* preemption, thus the result might have a time-of-check-to-time-of-use
|
|
* race. The caller is responsible to use it correctly, for example:
|
|
*
|
|
* - from a non-preemptible section (of course)
|
|
*
|
|
* - from a thread that is bound to a single CPU
|
|
*
|
|
* - in a loop with very short iterations (e.g. a polling loop)
|
|
*/
|
|
bool single_task_running(void)
|
|
{
|
|
return raw_rq()->nr_running == 1;
|
|
}
|
|
EXPORT_SYMBOL(single_task_running);
|
|
|
|
unsigned long long nr_context_switches(void)
|
|
{
|
|
int i;
|
|
unsigned long long sum = 0;
|
|
|
|
for_each_possible_cpu(i)
|
|
sum += cpu_rq(i)->nr_switches;
|
|
|
|
return sum;
|
|
}
|
|
|
|
/*
|
|
* Consumers of these two interfaces, like for example the cpuidle menu
|
|
* governor, are using nonsensical data. Preferring shallow idle state selection
|
|
* for a CPU that has IO-wait which might not even end up running the task when
|
|
* it does become runnable.
|
|
*/
|
|
|
|
unsigned long nr_iowait_cpu(int cpu)
|
|
{
|
|
return atomic_read(&cpu_rq(cpu)->nr_iowait);
|
|
}
|
|
|
|
/*
|
|
* IO-wait accounting, and how its mostly bollocks (on SMP).
|
|
*
|
|
* The idea behind IO-wait account is to account the idle time that we could
|
|
* have spend running if it were not for IO. That is, if we were to improve the
|
|
* storage performance, we'd have a proportional reduction in IO-wait time.
|
|
*
|
|
* This all works nicely on UP, where, when a task blocks on IO, we account
|
|
* idle time as IO-wait, because if the storage were faster, it could've been
|
|
* running and we'd not be idle.
|
|
*
|
|
* This has been extended to SMP, by doing the same for each CPU. This however
|
|
* is broken.
|
|
*
|
|
* Imagine for instance the case where two tasks block on one CPU, only the one
|
|
* CPU will have IO-wait accounted, while the other has regular idle. Even
|
|
* though, if the storage were faster, both could've ran at the same time,
|
|
* utilising both CPUs.
|
|
*
|
|
* This means, that when looking globally, the current IO-wait accounting on
|
|
* SMP is a lower bound, by reason of under accounting.
|
|
*
|
|
* Worse, since the numbers are provided per CPU, they are sometimes
|
|
* interpreted per CPU, and that is nonsensical. A blocked task isn't strictly
|
|
* associated with any one particular CPU, it can wake to another CPU than it
|
|
* blocked on. This means the per CPU IO-wait number is meaningless.
|
|
*
|
|
* Task CPU affinities can make all that even more 'interesting'.
|
|
*/
|
|
|
|
unsigned long nr_iowait(void)
|
|
{
|
|
unsigned long i, sum = 0;
|
|
|
|
for_each_possible_cpu(i)
|
|
sum += nr_iowait_cpu(i);
|
|
|
|
return sum;
|
|
}
|
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
/*
|
|
* sched_exec - execve() is a valuable balancing opportunity, because at
|
|
* this point the task has the smallest effective memory and cache footprint.
|
|
*/
|
|
void sched_exec(void)
|
|
{
|
|
struct task_struct *p = current;
|
|
unsigned long flags;
|
|
int dest_cpu;
|
|
bool cond = false;
|
|
|
|
trace_android_rvh_sched_exec(&cond);
|
|
if (cond)
|
|
return;
|
|
|
|
raw_spin_lock_irqsave(&p->pi_lock, flags);
|
|
dest_cpu = p->sched_class->select_task_rq(p, task_cpu(p), SD_BALANCE_EXEC, 0);
|
|
if (dest_cpu == smp_processor_id())
|
|
goto unlock;
|
|
|
|
if (likely(cpu_active(dest_cpu))) {
|
|
struct migration_arg arg = { p, dest_cpu };
|
|
|
|
raw_spin_unlock_irqrestore(&p->pi_lock, flags);
|
|
stop_one_cpu(task_cpu(p), migration_cpu_stop, &arg);
|
|
return;
|
|
}
|
|
unlock:
|
|
raw_spin_unlock_irqrestore(&p->pi_lock, flags);
|
|
}
|
|
|
|
#endif
|
|
|
|
DEFINE_PER_CPU(struct kernel_stat, kstat);
|
|
DEFINE_PER_CPU(struct kernel_cpustat, kernel_cpustat);
|
|
|
|
EXPORT_PER_CPU_SYMBOL(kstat);
|
|
EXPORT_PER_CPU_SYMBOL(kernel_cpustat);
|
|
|
|
/*
|
|
* The function fair_sched_class.update_curr accesses the struct curr
|
|
* and its field curr->exec_start; when called from task_sched_runtime(),
|
|
* we observe a high rate of cache misses in practice.
|
|
* Prefetching this data results in improved performance.
|
|
*/
|
|
static inline void prefetch_curr_exec_start(struct task_struct *p)
|
|
{
|
|
#ifdef CONFIG_FAIR_GROUP_SCHED
|
|
struct sched_entity *curr = (&p->se)->cfs_rq->curr;
|
|
#else
|
|
struct sched_entity *curr = (&task_rq(p)->cfs)->curr;
|
|
#endif
|
|
prefetch(curr);
|
|
prefetch(&curr->exec_start);
|
|
}
|
|
|
|
/*
|
|
* Return accounted runtime for the task.
|
|
* In case the task is currently running, return the runtime plus current's
|
|
* pending runtime that have not been accounted yet.
|
|
*/
|
|
unsigned long long task_sched_runtime(struct task_struct *p)
|
|
{
|
|
struct rq_flags rf;
|
|
struct rq *rq;
|
|
u64 ns;
|
|
|
|
#if defined(CONFIG_64BIT) && defined(CONFIG_SMP)
|
|
/*
|
|
* 64-bit doesn't need locks to atomically read a 64-bit value.
|
|
* So we have a optimization chance when the task's delta_exec is 0.
|
|
* Reading ->on_cpu is racy, but this is ok.
|
|
*
|
|
* If we race with it leaving CPU, we'll take a lock. So we're correct.
|
|
* If we race with it entering CPU, unaccounted time is 0. This is
|
|
* indistinguishable from the read occurring a few cycles earlier.
|
|
* If we see ->on_cpu without ->on_rq, the task is leaving, and has
|
|
* been accounted, so we're correct here as well.
|
|
*/
|
|
if (!p->on_cpu || !task_on_rq_queued(p))
|
|
return p->se.sum_exec_runtime;
|
|
#endif
|
|
|
|
rq = task_rq_lock(p, &rf);
|
|
/*
|
|
* Must be ->curr _and_ ->on_rq. If dequeued, we would
|
|
* project cycles that may never be accounted to this
|
|
* thread, breaking clock_gettime().
|
|
*/
|
|
if (task_current(rq, p) && task_on_rq_queued(p)) {
|
|
prefetch_curr_exec_start(p);
|
|
update_rq_clock(rq);
|
|
p->sched_class->update_curr(rq);
|
|
}
|
|
ns = p->se.sum_exec_runtime;
|
|
task_rq_unlock(rq, p, &rf);
|
|
|
|
return ns;
|
|
}
|
|
EXPORT_SYMBOL_GPL(task_sched_runtime);
|
|
|
|
/*
|
|
* This function gets called by the timer code, with HZ frequency.
|
|
* We call it with interrupts disabled.
|
|
*/
|
|
void scheduler_tick(void)
|
|
{
|
|
int cpu = smp_processor_id();
|
|
struct rq *rq = cpu_rq(cpu);
|
|
struct task_struct *curr = rq->curr;
|
|
struct rq_flags rf;
|
|
unsigned long thermal_pressure;
|
|
|
|
arch_scale_freq_tick();
|
|
sched_clock_tick();
|
|
|
|
rq_lock(rq, &rf);
|
|
|
|
trace_android_rvh_tick_entry(rq);
|
|
update_rq_clock(rq);
|
|
thermal_pressure = arch_scale_thermal_pressure(cpu_of(rq));
|
|
update_thermal_load_avg(rq_clock_thermal(rq), rq, thermal_pressure);
|
|
curr->sched_class->task_tick(rq, curr, 0);
|
|
calc_global_load_tick(rq);
|
|
psi_task_tick(rq);
|
|
|
|
rq_unlock(rq, &rf);
|
|
|
|
perf_event_task_tick();
|
|
|
|
#ifdef CONFIG_SMP
|
|
rq->idle_balance = idle_cpu(cpu);
|
|
trigger_load_balance(rq);
|
|
#endif
|
|
|
|
trace_android_vh_scheduler_tick(rq);
|
|
}
|
|
|
|
#ifdef CONFIG_NO_HZ_FULL
|
|
|
|
struct tick_work {
|
|
int cpu;
|
|
atomic_t state;
|
|
struct delayed_work work;
|
|
};
|
|
/* Values for ->state, see diagram below. */
|
|
#define TICK_SCHED_REMOTE_OFFLINE 0
|
|
#define TICK_SCHED_REMOTE_OFFLINING 1
|
|
#define TICK_SCHED_REMOTE_RUNNING 2
|
|
|
|
/*
|
|
* State diagram for ->state:
|
|
*
|
|
*
|
|
* TICK_SCHED_REMOTE_OFFLINE
|
|
* | ^
|
|
* | |
|
|
* | | sched_tick_remote()
|
|
* | |
|
|
* | |
|
|
* +--TICK_SCHED_REMOTE_OFFLINING
|
|
* | ^
|
|
* | |
|
|
* sched_tick_start() | | sched_tick_stop()
|
|
* | |
|
|
* V |
|
|
* TICK_SCHED_REMOTE_RUNNING
|
|
*
|
|
*
|
|
* Other transitions get WARN_ON_ONCE(), except that sched_tick_remote()
|
|
* and sched_tick_start() are happy to leave the state in RUNNING.
|
|
*/
|
|
|
|
static struct tick_work __percpu *tick_work_cpu;
|
|
|
|
static void sched_tick_remote(struct work_struct *work)
|
|
{
|
|
struct delayed_work *dwork = to_delayed_work(work);
|
|
struct tick_work *twork = container_of(dwork, struct tick_work, work);
|
|
int cpu = twork->cpu;
|
|
struct rq *rq = cpu_rq(cpu);
|
|
struct task_struct *curr;
|
|
struct rq_flags rf;
|
|
u64 delta;
|
|
int os;
|
|
|
|
/*
|
|
* Handle the tick only if it appears the remote CPU is running in full
|
|
* dynticks mode. The check is racy by nature, but missing a tick or
|
|
* having one too much is no big deal because the scheduler tick updates
|
|
* statistics and checks timeslices in a time-independent way, regardless
|
|
* of when exactly it is running.
|
|
*/
|
|
if (!tick_nohz_tick_stopped_cpu(cpu))
|
|
goto out_requeue;
|
|
|
|
rq_lock_irq(rq, &rf);
|
|
curr = rq->curr;
|
|
if (cpu_is_offline(cpu))
|
|
goto out_unlock;
|
|
|
|
update_rq_clock(rq);
|
|
|
|
if (!is_idle_task(curr)) {
|
|
/*
|
|
* Make sure the next tick runs within a reasonable
|
|
* amount of time.
|
|
*/
|
|
delta = rq_clock_task(rq) - curr->se.exec_start;
|
|
WARN_ON_ONCE(delta > (u64)NSEC_PER_SEC * 3);
|
|
}
|
|
curr->sched_class->task_tick(rq, curr, 0);
|
|
|
|
calc_load_nohz_remote(rq);
|
|
out_unlock:
|
|
rq_unlock_irq(rq, &rf);
|
|
out_requeue:
|
|
|
|
/*
|
|
* Run the remote tick once per second (1Hz). This arbitrary
|
|
* frequency is large enough to avoid overload but short enough
|
|
* to keep scheduler internal stats reasonably up to date. But
|
|
* first update state to reflect hotplug activity if required.
|
|
*/
|
|
os = atomic_fetch_add_unless(&twork->state, -1, TICK_SCHED_REMOTE_RUNNING);
|
|
WARN_ON_ONCE(os == TICK_SCHED_REMOTE_OFFLINE);
|
|
if (os == TICK_SCHED_REMOTE_RUNNING)
|
|
queue_delayed_work(system_unbound_wq, dwork, HZ);
|
|
}
|
|
|
|
static void sched_tick_start(int cpu)
|
|
{
|
|
int os;
|
|
struct tick_work *twork;
|
|
|
|
if (housekeeping_cpu(cpu, HK_FLAG_TICK))
|
|
return;
|
|
|
|
WARN_ON_ONCE(!tick_work_cpu);
|
|
|
|
twork = per_cpu_ptr(tick_work_cpu, cpu);
|
|
os = atomic_xchg(&twork->state, TICK_SCHED_REMOTE_RUNNING);
|
|
WARN_ON_ONCE(os == TICK_SCHED_REMOTE_RUNNING);
|
|
if (os == TICK_SCHED_REMOTE_OFFLINE) {
|
|
twork->cpu = cpu;
|
|
INIT_DELAYED_WORK(&twork->work, sched_tick_remote);
|
|
queue_delayed_work(system_unbound_wq, &twork->work, HZ);
|
|
}
|
|
}
|
|
|
|
#ifdef CONFIG_HOTPLUG_CPU
|
|
static void sched_tick_stop(int cpu)
|
|
{
|
|
struct tick_work *twork;
|
|
int os;
|
|
|
|
if (housekeeping_cpu(cpu, HK_FLAG_TICK))
|
|
return;
|
|
|
|
WARN_ON_ONCE(!tick_work_cpu);
|
|
|
|
twork = per_cpu_ptr(tick_work_cpu, cpu);
|
|
/* There cannot be competing actions, but don't rely on stop-machine. */
|
|
os = atomic_xchg(&twork->state, TICK_SCHED_REMOTE_OFFLINING);
|
|
WARN_ON_ONCE(os != TICK_SCHED_REMOTE_RUNNING);
|
|
/* Don't cancel, as this would mess up the state machine. */
|
|
}
|
|
#endif /* CONFIG_HOTPLUG_CPU */
|
|
|
|
int __init sched_tick_offload_init(void)
|
|
{
|
|
tick_work_cpu = alloc_percpu(struct tick_work);
|
|
BUG_ON(!tick_work_cpu);
|
|
return 0;
|
|
}
|
|
|
|
#else /* !CONFIG_NO_HZ_FULL */
|
|
static inline void sched_tick_start(int cpu) { }
|
|
static inline void sched_tick_stop(int cpu) { }
|
|
#endif
|
|
|
|
#if defined(CONFIG_PREEMPTION) && (defined(CONFIG_DEBUG_PREEMPT) || \
|
|
defined(CONFIG_TRACE_PREEMPT_TOGGLE))
|
|
/*
|
|
* If the value passed in is equal to the current preempt count
|
|
* then we just disabled preemption. Start timing the latency.
|
|
*/
|
|
static inline void preempt_latency_start(int val)
|
|
{
|
|
if (preempt_count() == val) {
|
|
unsigned long ip = get_lock_parent_ip();
|
|
#ifdef CONFIG_DEBUG_PREEMPT
|
|
current->preempt_disable_ip = ip;
|
|
#endif
|
|
trace_preempt_off(CALLER_ADDR0, ip);
|
|
}
|
|
}
|
|
|
|
void preempt_count_add(int val)
|
|
{
|
|
#ifdef CONFIG_DEBUG_PREEMPT
|
|
/*
|
|
* Underflow?
|
|
*/
|
|
if (DEBUG_LOCKS_WARN_ON((preempt_count() < 0)))
|
|
return;
|
|
#endif
|
|
__preempt_count_add(val);
|
|
#ifdef CONFIG_DEBUG_PREEMPT
|
|
/*
|
|
* Spinlock count overflowing soon?
|
|
*/
|
|
DEBUG_LOCKS_WARN_ON((preempt_count() & PREEMPT_MASK) >=
|
|
PREEMPT_MASK - 10);
|
|
#endif
|
|
preempt_latency_start(val);
|
|
}
|
|
EXPORT_SYMBOL(preempt_count_add);
|
|
NOKPROBE_SYMBOL(preempt_count_add);
|
|
|
|
/*
|
|
* If the value passed in equals to the current preempt count
|
|
* then we just enabled preemption. Stop timing the latency.
|
|
*/
|
|
static inline void preempt_latency_stop(int val)
|
|
{
|
|
if (preempt_count() == val)
|
|
trace_preempt_on(CALLER_ADDR0, get_lock_parent_ip());
|
|
}
|
|
|
|
void preempt_count_sub(int val)
|
|
{
|
|
#ifdef CONFIG_DEBUG_PREEMPT
|
|
/*
|
|
* Underflow?
|
|
*/
|
|
if (DEBUG_LOCKS_WARN_ON(val > preempt_count()))
|
|
return;
|
|
/*
|
|
* Is the spinlock portion underflowing?
|
|
*/
|
|
if (DEBUG_LOCKS_WARN_ON((val < PREEMPT_MASK) &&
|
|
!(preempt_count() & PREEMPT_MASK)))
|
|
return;
|
|
#endif
|
|
|
|
preempt_latency_stop(val);
|
|
__preempt_count_sub(val);
|
|
}
|
|
EXPORT_SYMBOL(preempt_count_sub);
|
|
NOKPROBE_SYMBOL(preempt_count_sub);
|
|
|
|
#else
|
|
static inline void preempt_latency_start(int val) { }
|
|
static inline void preempt_latency_stop(int val) { }
|
|
#endif
|
|
|
|
static inline unsigned long get_preempt_disable_ip(struct task_struct *p)
|
|
{
|
|
#ifdef CONFIG_DEBUG_PREEMPT
|
|
return p->preempt_disable_ip;
|
|
#else
|
|
return 0;
|
|
#endif
|
|
}
|
|
|
|
/*
|
|
* Print scheduling while atomic bug:
|
|
*/
|
|
static noinline void __schedule_bug(struct task_struct *prev)
|
|
{
|
|
/* Save this before calling printk(), since that will clobber it */
|
|
unsigned long preempt_disable_ip = get_preempt_disable_ip(current);
|
|
|
|
if (oops_in_progress)
|
|
return;
|
|
|
|
printk(KERN_ERR "BUG: scheduling while atomic: %s/%d/0x%08x\n",
|
|
prev->comm, prev->pid, preempt_count());
|
|
|
|
debug_show_held_locks(prev);
|
|
print_modules();
|
|
if (irqs_disabled())
|
|
print_irqtrace_events(prev);
|
|
if (IS_ENABLED(CONFIG_DEBUG_PREEMPT)
|
|
&& in_atomic_preempt_off()) {
|
|
pr_err("Preemption disabled at:");
|
|
print_ip_sym(KERN_ERR, preempt_disable_ip);
|
|
}
|
|
if (panic_on_warn)
|
|
panic("scheduling while atomic\n");
|
|
|
|
trace_android_rvh_schedule_bug(prev);
|
|
|
|
dump_stack();
|
|
add_taint(TAINT_WARN, LOCKDEP_STILL_OK);
|
|
}
|
|
|
|
/*
|
|
* Various schedule()-time debugging checks and statistics:
|
|
*/
|
|
static inline void schedule_debug(struct task_struct *prev, bool preempt)
|
|
{
|
|
#ifdef CONFIG_SCHED_STACK_END_CHECK
|
|
if (task_stack_end_corrupted(prev))
|
|
panic("corrupted stack end detected inside scheduler\n");
|
|
|
|
if (task_scs_end_corrupted(prev))
|
|
panic("corrupted shadow stack detected inside scheduler\n");
|
|
#endif
|
|
|
|
#ifdef CONFIG_DEBUG_ATOMIC_SLEEP
|
|
if (!preempt && prev->state && prev->non_block_count) {
|
|
printk(KERN_ERR "BUG: scheduling in a non-blocking section: %s/%d/%i\n",
|
|
prev->comm, prev->pid, prev->non_block_count);
|
|
dump_stack();
|
|
add_taint(TAINT_WARN, LOCKDEP_STILL_OK);
|
|
}
|
|
#endif
|
|
|
|
if (unlikely(in_atomic_preempt_off())) {
|
|
__schedule_bug(prev);
|
|
preempt_count_set(PREEMPT_DISABLED);
|
|
}
|
|
rcu_sleep_check();
|
|
|
|
profile_hit(SCHED_PROFILING, __builtin_return_address(0));
|
|
|
|
schedstat_inc(this_rq()->sched_count);
|
|
}
|
|
|
|
static void put_prev_task_balance(struct rq *rq, struct task_struct *prev,
|
|
struct rq_flags *rf)
|
|
{
|
|
#ifdef CONFIG_SMP
|
|
const struct sched_class *class;
|
|
/*
|
|
* We must do the balancing pass before put_prev_task(), such
|
|
* that when we release the rq->lock the task is in the same
|
|
* state as before we took rq->lock.
|
|
*
|
|
* We can terminate the balance pass as soon as we know there is
|
|
* a runnable task of @class priority or higher.
|
|
*/
|
|
for_class_range(class, prev->sched_class, &idle_sched_class) {
|
|
if (class->balance(rq, prev, rf))
|
|
break;
|
|
}
|
|
#endif
|
|
|
|
put_prev_task(rq, prev);
|
|
}
|
|
|
|
/*
|
|
* Pick up the highest-prio task:
|
|
*/
|
|
static inline struct task_struct *
|
|
pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
|
|
{
|
|
const struct sched_class *class;
|
|
struct task_struct *p;
|
|
|
|
/*
|
|
* Optimization: we know that if all tasks are in the fair class we can
|
|
* call that function directly, but only if the @prev task wasn't of a
|
|
* higher scheduling class, because otherwise those loose the
|
|
* opportunity to pull in more work from other CPUs.
|
|
*/
|
|
if (likely(prev->sched_class <= &fair_sched_class &&
|
|
rq->nr_running == rq->cfs.h_nr_running)) {
|
|
|
|
p = pick_next_task_fair(rq, prev, rf);
|
|
if (unlikely(p == RETRY_TASK))
|
|
goto restart;
|
|
|
|
/* Assumes fair_sched_class->next == idle_sched_class */
|
|
if (!p) {
|
|
put_prev_task(rq, prev);
|
|
p = pick_next_task_idle(rq);
|
|
}
|
|
|
|
return p;
|
|
}
|
|
|
|
restart:
|
|
put_prev_task_balance(rq, prev, rf);
|
|
|
|
for_each_class(class) {
|
|
p = class->pick_next_task(rq);
|
|
if (p)
|
|
return p;
|
|
}
|
|
|
|
/* The idle class should always have a runnable task: */
|
|
BUG();
|
|
}
|
|
|
|
/*
|
|
* __schedule() is the main scheduler function.
|
|
*
|
|
* The main means of driving the scheduler and thus entering this function are:
|
|
*
|
|
* 1. Explicit blocking: mutex, semaphore, waitqueue, etc.
|
|
*
|
|
* 2. TIF_NEED_RESCHED flag is checked on interrupt and userspace return
|
|
* paths. For example, see arch/x86/entry_64.S.
|
|
*
|
|
* To drive preemption between tasks, the scheduler sets the flag in timer
|
|
* interrupt handler scheduler_tick().
|
|
*
|
|
* 3. Wakeups don't really cause entry into schedule(). They add a
|
|
* task to the run-queue and that's it.
|
|
*
|
|
* Now, if the new task added to the run-queue preempts the current
|
|
* task, then the wakeup sets TIF_NEED_RESCHED and schedule() gets
|
|
* called on the nearest possible occasion:
|
|
*
|
|
* - If the kernel is preemptible (CONFIG_PREEMPTION=y):
|
|
*
|
|
* - in syscall or exception context, at the next outmost
|
|
* preempt_enable(). (this might be as soon as the wake_up()'s
|
|
* spin_unlock()!)
|
|
*
|
|
* - in IRQ context, return from interrupt-handler to
|
|
* preemptible context
|
|
*
|
|
* - If the kernel is not preemptible (CONFIG_PREEMPTION is not set)
|
|
* then at the next:
|
|
*
|
|
* - cond_resched() call
|
|
* - explicit schedule() call
|
|
* - return from syscall or exception to user-space
|
|
* - return from interrupt-handler to user-space
|
|
*
|
|
* WARNING: must be called with preemption disabled!
|
|
*/
|
|
static void __sched notrace __schedule(bool preempt)
|
|
{
|
|
struct task_struct *prev, *next;
|
|
unsigned long *switch_count;
|
|
unsigned long prev_state;
|
|
struct rq_flags rf;
|
|
struct rq *rq;
|
|
int cpu;
|
|
|
|
cpu = smp_processor_id();
|
|
rq = cpu_rq(cpu);
|
|
prev = rq->curr;
|
|
|
|
schedule_debug(prev, preempt);
|
|
|
|
if (sched_feat(HRTICK))
|
|
hrtick_clear(rq);
|
|
|
|
local_irq_disable();
|
|
rcu_note_context_switch(preempt);
|
|
|
|
/*
|
|
* Make sure that signal_pending_state()->signal_pending() below
|
|
* can't be reordered with __set_current_state(TASK_INTERRUPTIBLE)
|
|
* done by the caller to avoid the race with signal_wake_up():
|
|
*
|
|
* __set_current_state(@state) signal_wake_up()
|
|
* schedule() set_tsk_thread_flag(p, TIF_SIGPENDING)
|
|
* wake_up_state(p, state)
|
|
* LOCK rq->lock LOCK p->pi_state
|
|
* smp_mb__after_spinlock() smp_mb__after_spinlock()
|
|
* if (signal_pending_state()) if (p->state & @state)
|
|
*
|
|
* Also, the membarrier system call requires a full memory barrier
|
|
* after coming from user-space, before storing to rq->curr.
|
|
*/
|
|
rq_lock(rq, &rf);
|
|
smp_mb__after_spinlock();
|
|
|
|
/* Promote REQ to ACT */
|
|
rq->clock_update_flags <<= 1;
|
|
update_rq_clock(rq);
|
|
|
|
switch_count = &prev->nivcsw;
|
|
|
|
/*
|
|
* We must load prev->state once (task_struct::state is volatile), such
|
|
* that:
|
|
*
|
|
* - we form a control dependency vs deactivate_task() below.
|
|
* - ptrace_{,un}freeze_traced() can change ->state underneath us.
|
|
*/
|
|
prev_state = prev->state;
|
|
if (!preempt && prev_state) {
|
|
if (signal_pending_state(prev_state, prev)) {
|
|
prev->state = TASK_RUNNING;
|
|
} else {
|
|
prev->sched_contributes_to_load =
|
|
(prev_state & TASK_UNINTERRUPTIBLE) &&
|
|
!(prev_state & TASK_NOLOAD) &&
|
|
!(prev->flags & PF_FROZEN);
|
|
|
|
if (prev->sched_contributes_to_load)
|
|
rq->nr_uninterruptible++;
|
|
|
|
/*
|
|
* __schedule() ttwu()
|
|
* prev_state = prev->state; if (p->on_rq && ...)
|
|
* if (prev_state) goto out;
|
|
* p->on_rq = 0; smp_acquire__after_ctrl_dep();
|
|
* p->state = TASK_WAKING
|
|
*
|
|
* Where __schedule() and ttwu() have matching control dependencies.
|
|
*
|
|
* After this, schedule() must not care about p->state any more.
|
|
*/
|
|
deactivate_task(rq, prev, DEQUEUE_SLEEP | DEQUEUE_NOCLOCK);
|
|
|
|
if (prev->in_iowait) {
|
|
atomic_inc(&rq->nr_iowait);
|
|
delayacct_blkio_start();
|
|
}
|
|
}
|
|
switch_count = &prev->nvcsw;
|
|
}
|
|
|
|
next = pick_next_task(rq, prev, &rf);
|
|
clear_tsk_need_resched(prev);
|
|
clear_preempt_need_resched();
|
|
|
|
trace_android_rvh_schedule(prev, next, rq);
|
|
if (likely(prev != next)) {
|
|
rq->nr_switches++;
|
|
/*
|
|
* RCU users of rcu_dereference(rq->curr) may not see
|
|
* changes to task_struct made by pick_next_task().
|
|
*/
|
|
RCU_INIT_POINTER(rq->curr, next);
|
|
/*
|
|
* The membarrier system call requires each architecture
|
|
* to have a full memory barrier after updating
|
|
* rq->curr, before returning to user-space.
|
|
*
|
|
* Here are the schemes providing that barrier on the
|
|
* various architectures:
|
|
* - mm ? switch_mm() : mmdrop() for x86, s390, sparc, PowerPC.
|
|
* switch_mm() rely on membarrier_arch_switch_mm() on PowerPC.
|
|
* - finish_lock_switch() for weakly-ordered
|
|
* architectures where spin_unlock is a full barrier,
|
|
* - switch_to() for arm64 (weakly-ordered, spin_unlock
|
|
* is a RELEASE barrier),
|
|
*/
|
|
++*switch_count;
|
|
|
|
psi_sched_switch(prev, next, !task_on_rq_queued(prev));
|
|
|
|
trace_sched_switch(preempt, prev, next);
|
|
|
|
/* Also unlocks the rq: */
|
|
rq = context_switch(rq, prev, next, &rf);
|
|
} else {
|
|
rq->clock_update_flags &= ~(RQCF_ACT_SKIP|RQCF_REQ_SKIP);
|
|
rq_unlock_irq(rq, &rf);
|
|
}
|
|
|
|
balance_callback(rq);
|
|
}
|
|
|
|
void __noreturn do_task_dead(void)
|
|
{
|
|
/* Causes final put_task_struct in finish_task_switch(): */
|
|
set_special_state(TASK_DEAD);
|
|
|
|
/* Tell freezer to ignore us: */
|
|
current->flags |= PF_NOFREEZE;
|
|
|
|
__schedule(false);
|
|
BUG();
|
|
|
|
/* Avoid "noreturn function does return" - but don't continue if BUG() is a NOP: */
|
|
for (;;)
|
|
cpu_relax();
|
|
}
|
|
|
|
static inline void sched_submit_work(struct task_struct *tsk)
|
|
{
|
|
unsigned int task_flags;
|
|
|
|
if (!tsk->state)
|
|
return;
|
|
|
|
task_flags = tsk->flags;
|
|
/*
|
|
* If a worker went to sleep, notify and ask workqueue whether
|
|
* it wants to wake up a task to maintain concurrency.
|
|
* As this function is called inside the schedule() context,
|
|
* we disable preemption to avoid it calling schedule() again
|
|
* in the possible wakeup of a kworker and because wq_worker_sleeping()
|
|
* requires it.
|
|
*/
|
|
if (task_flags & (PF_WQ_WORKER | PF_IO_WORKER)) {
|
|
preempt_disable();
|
|
if (task_flags & PF_WQ_WORKER)
|
|
wq_worker_sleeping(tsk);
|
|
else
|
|
io_wq_worker_sleeping(tsk);
|
|
preempt_enable_no_resched();
|
|
}
|
|
|
|
if (tsk_is_pi_blocked(tsk))
|
|
return;
|
|
|
|
/*
|
|
* If we are going to sleep and we have plugged IO queued,
|
|
* make sure to submit it to avoid deadlocks.
|
|
*/
|
|
if (blk_needs_flush_plug(tsk))
|
|
blk_schedule_flush_plug(tsk);
|
|
}
|
|
|
|
static void sched_update_worker(struct task_struct *tsk)
|
|
{
|
|
if (tsk->flags & (PF_WQ_WORKER | PF_IO_WORKER)) {
|
|
if (tsk->flags & PF_WQ_WORKER)
|
|
wq_worker_running(tsk);
|
|
else
|
|
io_wq_worker_running(tsk);
|
|
}
|
|
}
|
|
|
|
asmlinkage __visible void __sched schedule(void)
|
|
{
|
|
struct task_struct *tsk = current;
|
|
|
|
sched_submit_work(tsk);
|
|
do {
|
|
preempt_disable();
|
|
__schedule(false);
|
|
sched_preempt_enable_no_resched();
|
|
} while (need_resched());
|
|
sched_update_worker(tsk);
|
|
}
|
|
EXPORT_SYMBOL(schedule);
|
|
|
|
/*
|
|
* synchronize_rcu_tasks() makes sure that no task is stuck in preempted
|
|
* state (have scheduled out non-voluntarily) by making sure that all
|
|
* tasks have either left the run queue or have gone into user space.
|
|
* As idle tasks do not do either, they must not ever be preempted
|
|
* (schedule out non-voluntarily).
|
|
*
|
|
* schedule_idle() is similar to schedule_preempt_disable() except that it
|
|
* never enables preemption because it does not call sched_submit_work().
|
|
*/
|
|
void __sched schedule_idle(void)
|
|
{
|
|
/*
|
|
* As this skips calling sched_submit_work(), which the idle task does
|
|
* regardless because that function is a nop when the task is in a
|
|
* TASK_RUNNING state, make sure this isn't used someplace that the
|
|
* current task can be in any other state. Note, idle is always in the
|
|
* TASK_RUNNING state.
|
|
*/
|
|
WARN_ON_ONCE(current->state);
|
|
do {
|
|
__schedule(false);
|
|
} while (need_resched());
|
|
}
|
|
|
|
#ifdef CONFIG_CONTEXT_TRACKING
|
|
asmlinkage __visible void __sched schedule_user(void)
|
|
{
|
|
/*
|
|
* If we come here after a random call to set_need_resched(),
|
|
* or we have been woken up remotely but the IPI has not yet arrived,
|
|
* we haven't yet exited the RCU idle mode. Do it here manually until
|
|
* we find a better solution.
|
|
*
|
|
* NB: There are buggy callers of this function. Ideally we
|
|
* should warn if prev_state != CONTEXT_USER, but that will trigger
|
|
* too frequently to make sense yet.
|
|
*/
|
|
enum ctx_state prev_state = exception_enter();
|
|
schedule();
|
|
exception_exit(prev_state);
|
|
}
|
|
#endif
|
|
|
|
/**
|
|
* schedule_preempt_disabled - called with preemption disabled
|
|
*
|
|
* Returns with preemption disabled. Note: preempt_count must be 1
|
|
*/
|
|
void __sched schedule_preempt_disabled(void)
|
|
{
|
|
sched_preempt_enable_no_resched();
|
|
schedule();
|
|
preempt_disable();
|
|
}
|
|
|
|
static void __sched notrace preempt_schedule_common(void)
|
|
{
|
|
do {
|
|
/*
|
|
* Because the function tracer can trace preempt_count_sub()
|
|
* and it also uses preempt_enable/disable_notrace(), if
|
|
* NEED_RESCHED is set, the preempt_enable_notrace() called
|
|
* by the function tracer will call this function again and
|
|
* cause infinite recursion.
|
|
*
|
|
* Preemption must be disabled here before the function
|
|
* tracer can trace. Break up preempt_disable() into two
|
|
* calls. One to disable preemption without fear of being
|
|
* traced. The other to still record the preemption latency,
|
|
* which can also be traced by the function tracer.
|
|
*/
|
|
preempt_disable_notrace();
|
|
preempt_latency_start(1);
|
|
__schedule(true);
|
|
preempt_latency_stop(1);
|
|
preempt_enable_no_resched_notrace();
|
|
|
|
/*
|
|
* Check again in case we missed a preemption opportunity
|
|
* between schedule and now.
|
|
*/
|
|
} while (need_resched());
|
|
}
|
|
|
|
#ifdef CONFIG_PREEMPTION
|
|
/*
|
|
* This is the entry point to schedule() from in-kernel preemption
|
|
* off of preempt_enable.
|
|
*/
|
|
asmlinkage __visible void __sched notrace preempt_schedule(void)
|
|
{
|
|
/*
|
|
* If there is a non-zero preempt_count or interrupts are disabled,
|
|
* we do not want to preempt the current task. Just return..
|
|
*/
|
|
if (likely(!preemptible()))
|
|
return;
|
|
|
|
preempt_schedule_common();
|
|
}
|
|
NOKPROBE_SYMBOL(preempt_schedule);
|
|
EXPORT_SYMBOL(preempt_schedule);
|
|
|
|
/**
|
|
* preempt_schedule_notrace - preempt_schedule called by tracing
|
|
*
|
|
* The tracing infrastructure uses preempt_enable_notrace to prevent
|
|
* recursion and tracing preempt enabling caused by the tracing
|
|
* infrastructure itself. But as tracing can happen in areas coming
|
|
* from userspace or just about to enter userspace, a preempt enable
|
|
* can occur before user_exit() is called. This will cause the scheduler
|
|
* to be called when the system is still in usermode.
|
|
*
|
|
* To prevent this, the preempt_enable_notrace will use this function
|
|
* instead of preempt_schedule() to exit user context if needed before
|
|
* calling the scheduler.
|
|
*/
|
|
asmlinkage __visible void __sched notrace preempt_schedule_notrace(void)
|
|
{
|
|
enum ctx_state prev_ctx;
|
|
|
|
if (likely(!preemptible()))
|
|
return;
|
|
|
|
do {
|
|
/*
|
|
* Because the function tracer can trace preempt_count_sub()
|
|
* and it also uses preempt_enable/disable_notrace(), if
|
|
* NEED_RESCHED is set, the preempt_enable_notrace() called
|
|
* by the function tracer will call this function again and
|
|
* cause infinite recursion.
|
|
*
|
|
* Preemption must be disabled here before the function
|
|
* tracer can trace. Break up preempt_disable() into two
|
|
* calls. One to disable preemption without fear of being
|
|
* traced. The other to still record the preemption latency,
|
|
* which can also be traced by the function tracer.
|
|
*/
|
|
preempt_disable_notrace();
|
|
preempt_latency_start(1);
|
|
/*
|
|
* Needs preempt disabled in case user_exit() is traced
|
|
* and the tracer calls preempt_enable_notrace() causing
|
|
* an infinite recursion.
|
|
*/
|
|
prev_ctx = exception_enter();
|
|
__schedule(true);
|
|
exception_exit(prev_ctx);
|
|
|
|
preempt_latency_stop(1);
|
|
preempt_enable_no_resched_notrace();
|
|
} while (need_resched());
|
|
}
|
|
EXPORT_SYMBOL_GPL(preempt_schedule_notrace);
|
|
|
|
#endif /* CONFIG_PREEMPTION */
|
|
|
|
/*
|
|
* This is the entry point to schedule() from kernel preemption
|
|
* off of irq context.
|
|
* Note, that this is called and return with irqs disabled. This will
|
|
* protect us against recursive calling from irq.
|
|
*/
|
|
asmlinkage __visible void __sched preempt_schedule_irq(void)
|
|
{
|
|
enum ctx_state prev_state;
|
|
|
|
/* Catch callers which need to be fixed */
|
|
BUG_ON(preempt_count() || !irqs_disabled());
|
|
|
|
prev_state = exception_enter();
|
|
|
|
do {
|
|
preempt_disable();
|
|
local_irq_enable();
|
|
__schedule(true);
|
|
local_irq_disable();
|
|
sched_preempt_enable_no_resched();
|
|
} while (need_resched());
|
|
|
|
exception_exit(prev_state);
|
|
}
|
|
|
|
int default_wake_function(wait_queue_entry_t *curr, unsigned mode, int wake_flags,
|
|
void *key)
|
|
{
|
|
WARN_ON_ONCE(IS_ENABLED(CONFIG_SCHED_DEBUG) && wake_flags & ~(WF_SYNC | WF_ANDROID_VENDOR));
|
|
return try_to_wake_up(curr->private, mode, wake_flags);
|
|
}
|
|
EXPORT_SYMBOL(default_wake_function);
|
|
|
|
static void __setscheduler_prio(struct task_struct *p, int prio)
|
|
{
|
|
if (dl_prio(prio))
|
|
p->sched_class = &dl_sched_class;
|
|
else if (rt_prio(prio))
|
|
p->sched_class = &rt_sched_class;
|
|
else
|
|
p->sched_class = &fair_sched_class;
|
|
|
|
p->prio = prio;
|
|
}
|
|
|
|
#ifdef CONFIG_RT_MUTEXES
|
|
|
|
static inline int __rt_effective_prio(struct task_struct *pi_task, int prio)
|
|
{
|
|
if (pi_task)
|
|
prio = min(prio, pi_task->prio);
|
|
|
|
return prio;
|
|
}
|
|
|
|
static inline int rt_effective_prio(struct task_struct *p, int prio)
|
|
{
|
|
struct task_struct *pi_task = rt_mutex_get_top_task(p);
|
|
|
|
return __rt_effective_prio(pi_task, prio);
|
|
}
|
|
|
|
/*
|
|
* rt_mutex_setprio - set the current priority of a task
|
|
* @p: task to boost
|
|
* @pi_task: donor task
|
|
*
|
|
* This function changes the 'effective' priority of a task. It does
|
|
* not touch ->normal_prio like __setscheduler().
|
|
*
|
|
* Used by the rt_mutex code to implement priority inheritance
|
|
* logic. Call site only calls if the priority of the task changed.
|
|
*/
|
|
void rt_mutex_setprio(struct task_struct *p, struct task_struct *pi_task)
|
|
{
|
|
int prio, oldprio, queued, running, queue_flag =
|
|
DEQUEUE_SAVE | DEQUEUE_MOVE | DEQUEUE_NOCLOCK;
|
|
const struct sched_class *prev_class;
|
|
struct rq_flags rf;
|
|
struct rq *rq;
|
|
|
|
trace_android_rvh_rtmutex_prepare_setprio(p, pi_task);
|
|
/* XXX used to be waiter->prio, not waiter->task->prio */
|
|
prio = __rt_effective_prio(pi_task, p->normal_prio);
|
|
|
|
/*
|
|
* If nothing changed; bail early.
|
|
*/
|
|
if (p->pi_top_task == pi_task && prio == p->prio && !dl_prio(prio))
|
|
return;
|
|
|
|
rq = __task_rq_lock(p, &rf);
|
|
update_rq_clock(rq);
|
|
/*
|
|
* Set under pi_lock && rq->lock, such that the value can be used under
|
|
* either lock.
|
|
*
|
|
* Note that there is loads of tricky to make this pointer cache work
|
|
* right. rt_mutex_slowunlock()+rt_mutex_postunlock() work together to
|
|
* ensure a task is de-boosted (pi_task is set to NULL) before the
|
|
* task is allowed to run again (and can exit). This ensures the pointer
|
|
* points to a blocked task -- which guaratees the task is present.
|
|
*/
|
|
p->pi_top_task = pi_task;
|
|
|
|
/*
|
|
* For FIFO/RR we only need to set prio, if that matches we're done.
|
|
*/
|
|
if (prio == p->prio && !dl_prio(prio))
|
|
goto out_unlock;
|
|
|
|
/*
|
|
* Idle task boosting is a nono in general. There is one
|
|
* exception, when PREEMPT_RT and NOHZ is active:
|
|
*
|
|
* The idle task calls get_next_timer_interrupt() and holds
|
|
* the timer wheel base->lock on the CPU and another CPU wants
|
|
* to access the timer (probably to cancel it). We can safely
|
|
* ignore the boosting request, as the idle CPU runs this code
|
|
* with interrupts disabled and will complete the lock
|
|
* protected section without being interrupted. So there is no
|
|
* real need to boost.
|
|
*/
|
|
if (unlikely(p == rq->idle)) {
|
|
WARN_ON(p != rq->curr);
|
|
WARN_ON(p->pi_blocked_on);
|
|
goto out_unlock;
|
|
}
|
|
|
|
trace_sched_pi_setprio(p, pi_task);
|
|
oldprio = p->prio;
|
|
|
|
if (oldprio == prio)
|
|
queue_flag &= ~DEQUEUE_MOVE;
|
|
|
|
prev_class = p->sched_class;
|
|
queued = task_on_rq_queued(p);
|
|
running = task_current(rq, p);
|
|
if (queued)
|
|
dequeue_task(rq, p, queue_flag);
|
|
if (running)
|
|
put_prev_task(rq, p);
|
|
|
|
/*
|
|
* Boosting condition are:
|
|
* 1. -rt task is running and holds mutex A
|
|
* --> -dl task blocks on mutex A
|
|
*
|
|
* 2. -dl task is running and holds mutex A
|
|
* --> -dl task blocks on mutex A and could preempt the
|
|
* running task
|
|
*/
|
|
if (dl_prio(prio)) {
|
|
if (!dl_prio(p->normal_prio) ||
|
|
(pi_task && dl_prio(pi_task->prio) &&
|
|
dl_entity_preempt(&pi_task->dl, &p->dl))) {
|
|
p->dl.pi_se = pi_task->dl.pi_se;
|
|
queue_flag |= ENQUEUE_REPLENISH;
|
|
} else {
|
|
p->dl.pi_se = &p->dl;
|
|
}
|
|
} else if (rt_prio(prio)) {
|
|
if (dl_prio(oldprio))
|
|
p->dl.pi_se = &p->dl;
|
|
if (oldprio < prio)
|
|
queue_flag |= ENQUEUE_HEAD;
|
|
} else {
|
|
if (dl_prio(oldprio))
|
|
p->dl.pi_se = &p->dl;
|
|
if (rt_prio(oldprio))
|
|
p->rt.timeout = 0;
|
|
}
|
|
|
|
__setscheduler_prio(p, prio);
|
|
|
|
if (queued)
|
|
enqueue_task(rq, p, queue_flag);
|
|
if (running)
|
|
set_next_task(rq, p);
|
|
|
|
check_class_changed(rq, p, prev_class, oldprio);
|
|
out_unlock:
|
|
/* Avoid rq from going away on us: */
|
|
preempt_disable();
|
|
__task_rq_unlock(rq, &rf);
|
|
|
|
balance_callback(rq);
|
|
preempt_enable();
|
|
}
|
|
#else
|
|
static inline int rt_effective_prio(struct task_struct *p, int prio)
|
|
{
|
|
return prio;
|
|
}
|
|
#endif
|
|
|
|
void set_user_nice(struct task_struct *p, long nice)
|
|
{
|
|
bool queued, running, allowed = false;
|
|
int old_prio;
|
|
struct rq_flags rf;
|
|
struct rq *rq;
|
|
|
|
trace_android_rvh_set_user_nice(p, &nice, &allowed);
|
|
if ((task_nice(p) == nice || nice < MIN_NICE || nice > MAX_NICE) && !allowed)
|
|
return;
|
|
/*
|
|
* We have to be careful, if called from sys_setpriority(),
|
|
* the task might be in the middle of scheduling on another CPU.
|
|
*/
|
|
rq = task_rq_lock(p, &rf);
|
|
update_rq_clock(rq);
|
|
|
|
/*
|
|
* The RT priorities are set via sched_setscheduler(), but we still
|
|
* allow the 'normal' nice value to be set - but as expected
|
|
* it wont have any effect on scheduling until the task is
|
|
* SCHED_DEADLINE, SCHED_FIFO or SCHED_RR:
|
|
*/
|
|
if (task_has_dl_policy(p) || task_has_rt_policy(p)) {
|
|
p->static_prio = NICE_TO_PRIO(nice);
|
|
goto out_unlock;
|
|
}
|
|
queued = task_on_rq_queued(p);
|
|
running = task_current(rq, p);
|
|
if (queued)
|
|
dequeue_task(rq, p, DEQUEUE_SAVE | DEQUEUE_NOCLOCK);
|
|
if (running)
|
|
put_prev_task(rq, p);
|
|
|
|
p->static_prio = NICE_TO_PRIO(nice);
|
|
set_load_weight(p, true);
|
|
old_prio = p->prio;
|
|
p->prio = effective_prio(p);
|
|
|
|
if (queued)
|
|
enqueue_task(rq, p, ENQUEUE_RESTORE | ENQUEUE_NOCLOCK);
|
|
if (running)
|
|
set_next_task(rq, p);
|
|
|
|
/*
|
|
* If the task increased its priority or is running and
|
|
* lowered its priority, then reschedule its CPU:
|
|
*/
|
|
p->sched_class->prio_changed(rq, p, old_prio);
|
|
|
|
out_unlock:
|
|
task_rq_unlock(rq, p, &rf);
|
|
}
|
|
EXPORT_SYMBOL(set_user_nice);
|
|
|
|
/*
|
|
* can_nice - check if a task can reduce its nice value
|
|
* @p: task
|
|
* @nice: nice value
|
|
*/
|
|
int can_nice(const struct task_struct *p, const int nice)
|
|
{
|
|
/* Convert nice value [19,-20] to rlimit style value [1,40]: */
|
|
int nice_rlim = nice_to_rlimit(nice);
|
|
|
|
return (nice_rlim <= task_rlimit(p, RLIMIT_NICE) ||
|
|
capable(CAP_SYS_NICE));
|
|
}
|
|
|
|
#ifdef __ARCH_WANT_SYS_NICE
|
|
|
|
/*
|
|
* sys_nice - change the priority of the current process.
|
|
* @increment: priority increment
|
|
*
|
|
* sys_setpriority is a more generic, but much slower function that
|
|
* does similar things.
|
|
*/
|
|
SYSCALL_DEFINE1(nice, int, increment)
|
|
{
|
|
long nice, retval;
|
|
|
|
/*
|
|
* Setpriority might change our priority at the same moment.
|
|
* We don't have to worry. Conceptually one call occurs first
|
|
* and we have a single winner.
|
|
*/
|
|
increment = clamp(increment, -NICE_WIDTH, NICE_WIDTH);
|
|
nice = task_nice(current) + increment;
|
|
|
|
nice = clamp_val(nice, MIN_NICE, MAX_NICE);
|
|
if (increment < 0 && !can_nice(current, nice))
|
|
return -EPERM;
|
|
|
|
retval = security_task_setnice(current, nice);
|
|
if (retval)
|
|
return retval;
|
|
|
|
set_user_nice(current, nice);
|
|
return 0;
|
|
}
|
|
|
|
#endif
|
|
|
|
/**
|
|
* task_prio - return the priority value of a given task.
|
|
* @p: the task in question.
|
|
*
|
|
* Return: The priority value as seen by users in /proc.
|
|
* RT tasks are offset by -200. Normal tasks are centered
|
|
* around 0, value goes from -16 to +15.
|
|
*/
|
|
int task_prio(const struct task_struct *p)
|
|
{
|
|
return p->prio - MAX_RT_PRIO;
|
|
}
|
|
|
|
/**
|
|
* idle_cpu - is a given CPU idle currently?
|
|
* @cpu: the processor in question.
|
|
*
|
|
* Return: 1 if the CPU is currently idle. 0 otherwise.
|
|
*/
|
|
int idle_cpu(int cpu)
|
|
{
|
|
struct rq *rq = cpu_rq(cpu);
|
|
|
|
if (rq->curr != rq->idle)
|
|
return 0;
|
|
|
|
if (rq->nr_running)
|
|
return 0;
|
|
|
|
#ifdef CONFIG_SMP
|
|
if (rq->ttwu_pending)
|
|
return 0;
|
|
#endif
|
|
|
|
return 1;
|
|
}
|
|
|
|
/**
|
|
* available_idle_cpu - is a given CPU idle for enqueuing work.
|
|
* @cpu: the CPU in question.
|
|
*
|
|
* Return: 1 if the CPU is currently idle. 0 otherwise.
|
|
*/
|
|
int available_idle_cpu(int cpu)
|
|
{
|
|
if (!idle_cpu(cpu))
|
|
return 0;
|
|
|
|
if (vcpu_is_preempted(cpu))
|
|
return 0;
|
|
|
|
return 1;
|
|
}
|
|
EXPORT_SYMBOL_GPL(available_idle_cpu);
|
|
|
|
/**
|
|
* idle_task - return the idle task for a given CPU.
|
|
* @cpu: the processor in question.
|
|
*
|
|
* Return: The idle task for the CPU @cpu.
|
|
*/
|
|
struct task_struct *idle_task(int cpu)
|
|
{
|
|
return cpu_rq(cpu)->idle;
|
|
}
|
|
|
|
/**
|
|
* find_process_by_pid - find a process with a matching PID value.
|
|
* @pid: the pid in question.
|
|
*
|
|
* The task of @pid, if found. %NULL otherwise.
|
|
*/
|
|
static struct task_struct *find_process_by_pid(pid_t pid)
|
|
{
|
|
return pid ? find_task_by_vpid(pid) : current;
|
|
}
|
|
|
|
/*
|
|
* sched_setparam() passes in -1 for its policy, to let the functions
|
|
* it calls know not to change it.
|
|
*/
|
|
#define SETPARAM_POLICY -1
|
|
|
|
static void __setscheduler_params(struct task_struct *p,
|
|
const struct sched_attr *attr)
|
|
{
|
|
int policy = attr->sched_policy;
|
|
|
|
if (policy == SETPARAM_POLICY)
|
|
policy = p->policy;
|
|
|
|
p->policy = policy;
|
|
|
|
if (dl_policy(policy))
|
|
__setparam_dl(p, attr);
|
|
else if (fair_policy(policy))
|
|
p->static_prio = NICE_TO_PRIO(attr->sched_nice);
|
|
|
|
/*
|
|
* __sched_setscheduler() ensures attr->sched_priority == 0 when
|
|
* !rt_policy. Always setting this ensures that things like
|
|
* getparam()/getattr() don't report silly values for !rt tasks.
|
|
*/
|
|
p->rt_priority = attr->sched_priority;
|
|
p->normal_prio = normal_prio(p);
|
|
set_load_weight(p, true);
|
|
}
|
|
|
|
/*
|
|
* Check the target process has a UID that matches the current process's:
|
|
*/
|
|
static bool check_same_owner(struct task_struct *p)
|
|
{
|
|
const struct cred *cred = current_cred(), *pcred;
|
|
bool match;
|
|
|
|
rcu_read_lock();
|
|
pcred = __task_cred(p);
|
|
match = (uid_eq(cred->euid, pcred->euid) ||
|
|
uid_eq(cred->euid, pcred->uid));
|
|
rcu_read_unlock();
|
|
return match;
|
|
}
|
|
|
|
static int __sched_setscheduler(struct task_struct *p,
|
|
const struct sched_attr *attr,
|
|
bool user, bool pi)
|
|
{
|
|
int oldpolicy = -1, policy = attr->sched_policy;
|
|
int retval, oldprio, newprio, queued, running;
|
|
const struct sched_class *prev_class;
|
|
struct rq_flags rf;
|
|
int reset_on_fork;
|
|
int queue_flags = DEQUEUE_SAVE | DEQUEUE_MOVE | DEQUEUE_NOCLOCK;
|
|
struct rq *rq;
|
|
|
|
/* The pi code expects interrupts enabled */
|
|
BUG_ON(pi && in_interrupt());
|
|
recheck:
|
|
/* Double check policy once rq lock held: */
|
|
if (policy < 0) {
|
|
reset_on_fork = p->sched_reset_on_fork;
|
|
policy = oldpolicy = p->policy;
|
|
} else {
|
|
reset_on_fork = !!(attr->sched_flags & SCHED_FLAG_RESET_ON_FORK);
|
|
|
|
if (!valid_policy(policy))
|
|
return -EINVAL;
|
|
}
|
|
|
|
if (attr->sched_flags & ~(SCHED_FLAG_ALL | SCHED_FLAG_SUGOV))
|
|
return -EINVAL;
|
|
|
|
/*
|
|
* Valid priorities for SCHED_FIFO and SCHED_RR are
|
|
* 1..MAX_USER_RT_PRIO-1, valid priority for SCHED_NORMAL,
|
|
* SCHED_BATCH and SCHED_IDLE is 0.
|
|
*/
|
|
if ((p->mm && attr->sched_priority > MAX_USER_RT_PRIO-1) ||
|
|
(!p->mm && attr->sched_priority > MAX_RT_PRIO-1))
|
|
return -EINVAL;
|
|
if ((dl_policy(policy) && !__checkparam_dl(attr)) ||
|
|
(rt_policy(policy) != (attr->sched_priority != 0)))
|
|
return -EINVAL;
|
|
|
|
/*
|
|
* Allow unprivileged RT tasks to decrease priority:
|
|
*/
|
|
if (user && !capable(CAP_SYS_NICE)) {
|
|
if (fair_policy(policy)) {
|
|
if (attr->sched_nice < task_nice(p) &&
|
|
!can_nice(p, attr->sched_nice))
|
|
return -EPERM;
|
|
}
|
|
|
|
if (rt_policy(policy)) {
|
|
unsigned long rlim_rtprio =
|
|
task_rlimit(p, RLIMIT_RTPRIO);
|
|
|
|
/* Can't set/change the rt policy: */
|
|
if (policy != p->policy && !rlim_rtprio)
|
|
return -EPERM;
|
|
|
|
/* Can't increase priority: */
|
|
if (attr->sched_priority > p->rt_priority &&
|
|
attr->sched_priority > rlim_rtprio)
|
|
return -EPERM;
|
|
}
|
|
|
|
/*
|
|
* Can't set/change SCHED_DEADLINE policy at all for now
|
|
* (safest behavior); in the future we would like to allow
|
|
* unprivileged DL tasks to increase their relative deadline
|
|
* or reduce their runtime (both ways reducing utilization)
|
|
*/
|
|
if (dl_policy(policy))
|
|
return -EPERM;
|
|
|
|
/*
|
|
* Treat SCHED_IDLE as nice 20. Only allow a switch to
|
|
* SCHED_NORMAL if the RLIMIT_NICE would normally permit it.
|
|
*/
|
|
if (task_has_idle_policy(p) && !idle_policy(policy)) {
|
|
if (!can_nice(p, task_nice(p)))
|
|
return -EPERM;
|
|
}
|
|
|
|
/* Can't change other user's priorities: */
|
|
if (!check_same_owner(p))
|
|
return -EPERM;
|
|
|
|
/* Normal users shall not reset the sched_reset_on_fork flag: */
|
|
if (p->sched_reset_on_fork && !reset_on_fork)
|
|
return -EPERM;
|
|
|
|
/* Can't change util-clamps */
|
|
if (attr->sched_flags & SCHED_FLAG_UTIL_CLAMP)
|
|
return -EPERM;
|
|
}
|
|
|
|
if (user) {
|
|
if (attr->sched_flags & SCHED_FLAG_SUGOV)
|
|
return -EINVAL;
|
|
|
|
retval = security_task_setscheduler(p);
|
|
if (retval)
|
|
return retval;
|
|
}
|
|
|
|
/* Update task specific "requested" clamps */
|
|
if (attr->sched_flags & SCHED_FLAG_UTIL_CLAMP) {
|
|
retval = uclamp_validate(p, attr);
|
|
if (retval)
|
|
return retval;
|
|
}
|
|
|
|
/*
|
|
* Make sure no PI-waiters arrive (or leave) while we are
|
|
* changing the priority of the task:
|
|
*
|
|
* To be able to change p->policy safely, the appropriate
|
|
* runqueue lock must be held.
|
|
*/
|
|
rq = task_rq_lock(p, &rf);
|
|
update_rq_clock(rq);
|
|
|
|
/*
|
|
* Changing the policy of the stop threads its a very bad idea:
|
|
*/
|
|
if (p == rq->stop) {
|
|
retval = -EINVAL;
|
|
goto unlock;
|
|
}
|
|
|
|
/*
|
|
* If not changing anything there's no need to proceed further,
|
|
* but store a possible modification of reset_on_fork.
|
|
*/
|
|
if (unlikely(policy == p->policy)) {
|
|
if (fair_policy(policy) && attr->sched_nice != task_nice(p))
|
|
goto change;
|
|
if (rt_policy(policy) && attr->sched_priority != p->rt_priority)
|
|
goto change;
|
|
if (dl_policy(policy) && dl_param_changed(p, attr))
|
|
goto change;
|
|
if (attr->sched_flags & SCHED_FLAG_UTIL_CLAMP)
|
|
goto change;
|
|
|
|
p->sched_reset_on_fork = reset_on_fork;
|
|
retval = 0;
|
|
goto unlock;
|
|
}
|
|
change:
|
|
|
|
if (user) {
|
|
#ifdef CONFIG_RT_GROUP_SCHED
|
|
/*
|
|
* Do not allow realtime tasks into groups that have no runtime
|
|
* assigned.
|
|
*/
|
|
if (rt_bandwidth_enabled() && rt_policy(policy) &&
|
|
task_group(p)->rt_bandwidth.rt_runtime == 0 &&
|
|
!task_group_is_autogroup(task_group(p))) {
|
|
retval = -EPERM;
|
|
goto unlock;
|
|
}
|
|
#endif
|
|
#ifdef CONFIG_SMP
|
|
if (dl_bandwidth_enabled() && dl_policy(policy) &&
|
|
!(attr->sched_flags & SCHED_FLAG_SUGOV)) {
|
|
cpumask_t *span = rq->rd->span;
|
|
|
|
/*
|
|
* Don't allow tasks with an affinity mask smaller than
|
|
* the entire root_domain to become SCHED_DEADLINE. We
|
|
* will also fail if there's no bandwidth available.
|
|
*/
|
|
if (!cpumask_subset(span, p->cpus_ptr) ||
|
|
rq->rd->dl_bw.bw == 0) {
|
|
retval = -EPERM;
|
|
goto unlock;
|
|
}
|
|
}
|
|
#endif
|
|
}
|
|
|
|
/* Re-check policy now with rq lock held: */
|
|
if (unlikely(oldpolicy != -1 && oldpolicy != p->policy)) {
|
|
policy = oldpolicy = -1;
|
|
task_rq_unlock(rq, p, &rf);
|
|
goto recheck;
|
|
}
|
|
|
|
/*
|
|
* If setscheduling to SCHED_DEADLINE (or changing the parameters
|
|
* of a SCHED_DEADLINE task) we need to check if enough bandwidth
|
|
* is available.
|
|
*/
|
|
if ((dl_policy(policy) || dl_task(p)) && sched_dl_overflow(p, policy, attr)) {
|
|
retval = -EBUSY;
|
|
goto unlock;
|
|
}
|
|
|
|
p->sched_reset_on_fork = reset_on_fork;
|
|
oldprio = p->prio;
|
|
|
|
newprio = __normal_prio(policy, attr->sched_priority, attr->sched_nice);
|
|
if (pi) {
|
|
/*
|
|
* Take priority boosted tasks into account. If the new
|
|
* effective priority is unchanged, we just store the new
|
|
* normal parameters and do not touch the scheduler class and
|
|
* the runqueue. This will be done when the task deboost
|
|
* itself.
|
|
*/
|
|
newprio = rt_effective_prio(p, newprio);
|
|
if (newprio == oldprio)
|
|
queue_flags &= ~DEQUEUE_MOVE;
|
|
}
|
|
|
|
queued = task_on_rq_queued(p);
|
|
running = task_current(rq, p);
|
|
if (queued)
|
|
dequeue_task(rq, p, queue_flags);
|
|
if (running)
|
|
put_prev_task(rq, p);
|
|
|
|
prev_class = p->sched_class;
|
|
|
|
if (!(attr->sched_flags & SCHED_FLAG_KEEP_PARAMS)) {
|
|
__setscheduler_params(p, attr);
|
|
__setscheduler_prio(p, newprio);
|
|
trace_android_rvh_setscheduler(p);
|
|
}
|
|
__setscheduler_uclamp(p, attr);
|
|
|
|
if (queued) {
|
|
/*
|
|
* We enqueue to tail when the priority of a task is
|
|
* increased (user space view).
|
|
*/
|
|
if (oldprio < p->prio)
|
|
queue_flags |= ENQUEUE_HEAD;
|
|
|
|
enqueue_task(rq, p, queue_flags);
|
|
}
|
|
if (running)
|
|
set_next_task(rq, p);
|
|
|
|
check_class_changed(rq, p, prev_class, oldprio);
|
|
|
|
/* Avoid rq from going away on us: */
|
|
preempt_disable();
|
|
task_rq_unlock(rq, p, &rf);
|
|
|
|
if (pi)
|
|
rt_mutex_adjust_pi(p);
|
|
|
|
/* Run balance callbacks after we've adjusted the PI chain: */
|
|
balance_callback(rq);
|
|
preempt_enable();
|
|
|
|
return 0;
|
|
|
|
unlock:
|
|
task_rq_unlock(rq, p, &rf);
|
|
return retval;
|
|
}
|
|
|
|
static int _sched_setscheduler(struct task_struct *p, int policy,
|
|
const struct sched_param *param, bool check)
|
|
{
|
|
struct sched_attr attr = {
|
|
.sched_policy = policy,
|
|
.sched_priority = param->sched_priority,
|
|
.sched_nice = PRIO_TO_NICE(p->static_prio),
|
|
};
|
|
|
|
/* Fixup the legacy SCHED_RESET_ON_FORK hack. */
|
|
if ((policy != SETPARAM_POLICY) && (policy & SCHED_RESET_ON_FORK)) {
|
|
attr.sched_flags |= SCHED_FLAG_RESET_ON_FORK;
|
|
policy &= ~SCHED_RESET_ON_FORK;
|
|
attr.sched_policy = policy;
|
|
}
|
|
|
|
return __sched_setscheduler(p, &attr, check, true);
|
|
}
|
|
/**
|
|
* sched_setscheduler - change the scheduling policy and/or RT priority of a thread.
|
|
* @p: the task in question.
|
|
* @policy: new policy.
|
|
* @param: structure containing the new RT priority.
|
|
*
|
|
* Use sched_set_fifo(), read its comment.
|
|
*
|
|
* Return: 0 on success. An error code otherwise.
|
|
*
|
|
* NOTE that the task may be already dead.
|
|
*/
|
|
int sched_setscheduler(struct task_struct *p, int policy,
|
|
const struct sched_param *param)
|
|
{
|
|
return _sched_setscheduler(p, policy, param, true);
|
|
}
|
|
EXPORT_SYMBOL_GPL(sched_setscheduler);
|
|
|
|
int sched_setattr(struct task_struct *p, const struct sched_attr *attr)
|
|
{
|
|
return __sched_setscheduler(p, attr, true, true);
|
|
}
|
|
EXPORT_SYMBOL_GPL(sched_setattr);
|
|
|
|
int sched_setattr_nocheck(struct task_struct *p, const struct sched_attr *attr)
|
|
{
|
|
return __sched_setscheduler(p, attr, false, true);
|
|
}
|
|
EXPORT_SYMBOL_GPL(sched_setattr_nocheck);
|
|
|
|
/**
|
|
* sched_setscheduler_nocheck - change the scheduling policy and/or RT priority of a thread from kernelspace.
|
|
* @p: the task in question.
|
|
* @policy: new policy.
|
|
* @param: structure containing the new RT priority.
|
|
*
|
|
* Just like sched_setscheduler, only don't bother checking if the
|
|
* current context has permission. For example, this is needed in
|
|
* stop_machine(): we create temporary high priority worker threads,
|
|
* but our caller might not have that capability.
|
|
*
|
|
* Return: 0 on success. An error code otherwise.
|
|
*/
|
|
int sched_setscheduler_nocheck(struct task_struct *p, int policy,
|
|
const struct sched_param *param)
|
|
{
|
|
return _sched_setscheduler(p, policy, param, false);
|
|
}
|
|
EXPORT_SYMBOL_GPL(sched_setscheduler_nocheck);
|
|
|
|
/*
|
|
* SCHED_FIFO is a broken scheduler model; that is, it is fundamentally
|
|
* incapable of resource management, which is the one thing an OS really should
|
|
* be doing.
|
|
*
|
|
* This is of course the reason it is limited to privileged users only.
|
|
*
|
|
* Worse still; it is fundamentally impossible to compose static priority
|
|
* workloads. You cannot take two correctly working static prio workloads
|
|
* and smash them together and still expect them to work.
|
|
*
|
|
* For this reason 'all' FIFO tasks the kernel creates are basically at:
|
|
*
|
|
* MAX_RT_PRIO / 2
|
|
*
|
|
* The administrator _MUST_ configure the system, the kernel simply doesn't
|
|
* know enough information to make a sensible choice.
|
|
*/
|
|
void sched_set_fifo(struct task_struct *p)
|
|
{
|
|
struct sched_param sp = { .sched_priority = MAX_RT_PRIO / 2 };
|
|
WARN_ON_ONCE(sched_setscheduler_nocheck(p, SCHED_FIFO, &sp) != 0);
|
|
}
|
|
EXPORT_SYMBOL_GPL(sched_set_fifo);
|
|
|
|
/*
|
|
* For when you don't much care about FIFO, but want to be above SCHED_NORMAL.
|
|
*/
|
|
void sched_set_fifo_low(struct task_struct *p)
|
|
{
|
|
struct sched_param sp = { .sched_priority = 1 };
|
|
WARN_ON_ONCE(sched_setscheduler_nocheck(p, SCHED_FIFO, &sp) != 0);
|
|
}
|
|
EXPORT_SYMBOL_GPL(sched_set_fifo_low);
|
|
|
|
void sched_set_normal(struct task_struct *p, int nice)
|
|
{
|
|
struct sched_attr attr = {
|
|
.sched_policy = SCHED_NORMAL,
|
|
.sched_nice = nice,
|
|
};
|
|
WARN_ON_ONCE(sched_setattr_nocheck(p, &attr) != 0);
|
|
}
|
|
EXPORT_SYMBOL_GPL(sched_set_normal);
|
|
|
|
static int
|
|
do_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param)
|
|
{
|
|
struct sched_param lparam;
|
|
struct task_struct *p;
|
|
int retval;
|
|
|
|
if (!param || pid < 0)
|
|
return -EINVAL;
|
|
if (copy_from_user(&lparam, param, sizeof(struct sched_param)))
|
|
return -EFAULT;
|
|
|
|
rcu_read_lock();
|
|
retval = -ESRCH;
|
|
p = find_process_by_pid(pid);
|
|
if (p != NULL)
|
|
retval = sched_setscheduler(p, policy, &lparam);
|
|
rcu_read_unlock();
|
|
|
|
return retval;
|
|
}
|
|
|
|
/*
|
|
* Mimics kernel/events/core.c perf_copy_attr().
|
|
*/
|
|
static int sched_copy_attr(struct sched_attr __user *uattr, struct sched_attr *attr)
|
|
{
|
|
u32 size;
|
|
int ret;
|
|
|
|
/* Zero the full structure, so that a short copy will be nice: */
|
|
memset(attr, 0, sizeof(*attr));
|
|
|
|
ret = get_user(size, &uattr->size);
|
|
if (ret)
|
|
return ret;
|
|
|
|
/* ABI compatibility quirk: */
|
|
if (!size)
|
|
size = SCHED_ATTR_SIZE_VER0;
|
|
if (size < SCHED_ATTR_SIZE_VER0 || size > PAGE_SIZE)
|
|
goto err_size;
|
|
|
|
ret = copy_struct_from_user(attr, sizeof(*attr), uattr, size);
|
|
if (ret) {
|
|
if (ret == -E2BIG)
|
|
goto err_size;
|
|
return ret;
|
|
}
|
|
|
|
if ((attr->sched_flags & SCHED_FLAG_UTIL_CLAMP) &&
|
|
size < SCHED_ATTR_SIZE_VER1)
|
|
return -EINVAL;
|
|
|
|
/*
|
|
* XXX: Do we want to be lenient like existing syscalls; or do we want
|
|
* to be strict and return an error on out-of-bounds values?
|
|
*/
|
|
attr->sched_nice = clamp(attr->sched_nice, MIN_NICE, MAX_NICE);
|
|
|
|
return 0;
|
|
|
|
err_size:
|
|
put_user(sizeof(*attr), &uattr->size);
|
|
return -E2BIG;
|
|
}
|
|
|
|
static void get_params(struct task_struct *p, struct sched_attr *attr)
|
|
{
|
|
if (task_has_dl_policy(p))
|
|
__getparam_dl(p, attr);
|
|
else if (task_has_rt_policy(p))
|
|
attr->sched_priority = p->rt_priority;
|
|
else
|
|
attr->sched_nice = task_nice(p);
|
|
}
|
|
|
|
/**
|
|
* sys_sched_setscheduler - set/change the scheduler policy and RT priority
|
|
* @pid: the pid in question.
|
|
* @policy: new policy.
|
|
* @param: structure containing the new RT priority.
|
|
*
|
|
* Return: 0 on success. An error code otherwise.
|
|
*/
|
|
SYSCALL_DEFINE3(sched_setscheduler, pid_t, pid, int, policy, struct sched_param __user *, param)
|
|
{
|
|
if (policy < 0)
|
|
return -EINVAL;
|
|
|
|
return do_sched_setscheduler(pid, policy, param);
|
|
}
|
|
|
|
/**
|
|
* sys_sched_setparam - set/change the RT priority of a thread
|
|
* @pid: the pid in question.
|
|
* @param: structure containing the new RT priority.
|
|
*
|
|
* Return: 0 on success. An error code otherwise.
|
|
*/
|
|
SYSCALL_DEFINE2(sched_setparam, pid_t, pid, struct sched_param __user *, param)
|
|
{
|
|
return do_sched_setscheduler(pid, SETPARAM_POLICY, param);
|
|
}
|
|
|
|
/**
|
|
* sys_sched_setattr - same as above, but with extended sched_attr
|
|
* @pid: the pid in question.
|
|
* @uattr: structure containing the extended parameters.
|
|
* @flags: for future extension.
|
|
*/
|
|
SYSCALL_DEFINE3(sched_setattr, pid_t, pid, struct sched_attr __user *, uattr,
|
|
unsigned int, flags)
|
|
{
|
|
struct sched_attr attr;
|
|
struct task_struct *p;
|
|
int retval;
|
|
|
|
if (!uattr || pid < 0 || flags)
|
|
return -EINVAL;
|
|
|
|
retval = sched_copy_attr(uattr, &attr);
|
|
if (retval)
|
|
return retval;
|
|
|
|
if ((int)attr.sched_policy < 0)
|
|
return -EINVAL;
|
|
if (attr.sched_flags & SCHED_FLAG_KEEP_POLICY)
|
|
attr.sched_policy = SETPARAM_POLICY;
|
|
|
|
rcu_read_lock();
|
|
retval = -ESRCH;
|
|
p = find_process_by_pid(pid);
|
|
if (likely(p))
|
|
get_task_struct(p);
|
|
rcu_read_unlock();
|
|
|
|
if (likely(p)) {
|
|
if (attr.sched_flags & SCHED_FLAG_KEEP_PARAMS)
|
|
get_params(p, &attr);
|
|
retval = sched_setattr(p, &attr);
|
|
put_task_struct(p);
|
|
}
|
|
|
|
return retval;
|
|
}
|
|
|
|
/**
|
|
* sys_sched_getscheduler - get the policy (scheduling class) of a thread
|
|
* @pid: the pid in question.
|
|
*
|
|
* Return: On success, the policy of the thread. Otherwise, a negative error
|
|
* code.
|
|
*/
|
|
SYSCALL_DEFINE1(sched_getscheduler, pid_t, pid)
|
|
{
|
|
struct task_struct *p;
|
|
int retval;
|
|
|
|
if (pid < 0)
|
|
return -EINVAL;
|
|
|
|
retval = -ESRCH;
|
|
rcu_read_lock();
|
|
p = find_process_by_pid(pid);
|
|
if (p) {
|
|
retval = security_task_getscheduler(p);
|
|
if (!retval)
|
|
retval = p->policy
|
|
| (p->sched_reset_on_fork ? SCHED_RESET_ON_FORK : 0);
|
|
}
|
|
rcu_read_unlock();
|
|
return retval;
|
|
}
|
|
|
|
/**
|
|
* sys_sched_getparam - get the RT priority of a thread
|
|
* @pid: the pid in question.
|
|
* @param: structure containing the RT priority.
|
|
*
|
|
* Return: On success, 0 and the RT priority is in @param. Otherwise, an error
|
|
* code.
|
|
*/
|
|
SYSCALL_DEFINE2(sched_getparam, pid_t, pid, struct sched_param __user *, param)
|
|
{
|
|
struct sched_param lp = { .sched_priority = 0 };
|
|
struct task_struct *p;
|
|
int retval;
|
|
|
|
if (!param || pid < 0)
|
|
return -EINVAL;
|
|
|
|
rcu_read_lock();
|
|
p = find_process_by_pid(pid);
|
|
retval = -ESRCH;
|
|
if (!p)
|
|
goto out_unlock;
|
|
|
|
retval = security_task_getscheduler(p);
|
|
if (retval)
|
|
goto out_unlock;
|
|
|
|
if (task_has_rt_policy(p))
|
|
lp.sched_priority = p->rt_priority;
|
|
rcu_read_unlock();
|
|
|
|
/*
|
|
* This one might sleep, we cannot do it with a spinlock held ...
|
|
*/
|
|
retval = copy_to_user(param, &lp, sizeof(*param)) ? -EFAULT : 0;
|
|
|
|
return retval;
|
|
|
|
out_unlock:
|
|
rcu_read_unlock();
|
|
return retval;
|
|
}
|
|
|
|
/*
|
|
* Copy the kernel size attribute structure (which might be larger
|
|
* than what user-space knows about) to user-space.
|
|
*
|
|
* Note that all cases are valid: user-space buffer can be larger or
|
|
* smaller than the kernel-space buffer. The usual case is that both
|
|
* have the same size.
|
|
*/
|
|
static int
|
|
sched_attr_copy_to_user(struct sched_attr __user *uattr,
|
|
struct sched_attr *kattr,
|
|
unsigned int usize)
|
|
{
|
|
unsigned int ksize = sizeof(*kattr);
|
|
|
|
if (!access_ok(uattr, usize))
|
|
return -EFAULT;
|
|
|
|
/*
|
|
* sched_getattr() ABI forwards and backwards compatibility:
|
|
*
|
|
* If usize == ksize then we just copy everything to user-space and all is good.
|
|
*
|
|
* If usize < ksize then we only copy as much as user-space has space for,
|
|
* this keeps ABI compatibility as well. We skip the rest.
|
|
*
|
|
* If usize > ksize then user-space is using a newer version of the ABI,
|
|
* which part the kernel doesn't know about. Just ignore it - tooling can
|
|
* detect the kernel's knowledge of attributes from the attr->size value
|
|
* which is set to ksize in this case.
|
|
*/
|
|
kattr->size = min(usize, ksize);
|
|
|
|
if (copy_to_user(uattr, kattr, kattr->size))
|
|
return -EFAULT;
|
|
|
|
return 0;
|
|
}
|
|
|
|
/**
|
|
* sys_sched_getattr - similar to sched_getparam, but with sched_attr
|
|
* @pid: the pid in question.
|
|
* @uattr: structure containing the extended parameters.
|
|
* @usize: sizeof(attr) for fwd/bwd comp.
|
|
* @flags: for future extension.
|
|
*/
|
|
SYSCALL_DEFINE4(sched_getattr, pid_t, pid, struct sched_attr __user *, uattr,
|
|
unsigned int, usize, unsigned int, flags)
|
|
{
|
|
struct sched_attr kattr = { };
|
|
struct task_struct *p;
|
|
int retval;
|
|
|
|
if (!uattr || pid < 0 || usize > PAGE_SIZE ||
|
|
usize < SCHED_ATTR_SIZE_VER0 || flags)
|
|
return -EINVAL;
|
|
|
|
rcu_read_lock();
|
|
p = find_process_by_pid(pid);
|
|
retval = -ESRCH;
|
|
if (!p)
|
|
goto out_unlock;
|
|
|
|
retval = security_task_getscheduler(p);
|
|
if (retval)
|
|
goto out_unlock;
|
|
|
|
kattr.sched_policy = p->policy;
|
|
if (p->sched_reset_on_fork)
|
|
kattr.sched_flags |= SCHED_FLAG_RESET_ON_FORK;
|
|
get_params(p, &kattr);
|
|
kattr.sched_flags &= SCHED_FLAG_ALL;
|
|
|
|
#ifdef CONFIG_UCLAMP_TASK
|
|
/*
|
|
* This could race with another potential updater, but this is fine
|
|
* because it'll correctly read the old or the new value. We don't need
|
|
* to guarantee who wins the race as long as it doesn't return garbage.
|
|
*/
|
|
kattr.sched_util_min = p->uclamp_req[UCLAMP_MIN].value;
|
|
kattr.sched_util_max = p->uclamp_req[UCLAMP_MAX].value;
|
|
#endif
|
|
|
|
rcu_read_unlock();
|
|
|
|
return sched_attr_copy_to_user(uattr, &kattr, usize);
|
|
|
|
out_unlock:
|
|
rcu_read_unlock();
|
|
return retval;
|
|
}
|
|
|
|
long sched_setaffinity(pid_t pid, const struct cpumask *in_mask)
|
|
{
|
|
cpumask_var_t cpus_allowed, new_mask;
|
|
struct task_struct *p;
|
|
int retval;
|
|
int skip = 0;
|
|
|
|
rcu_read_lock();
|
|
|
|
p = find_process_by_pid(pid);
|
|
if (!p) {
|
|
rcu_read_unlock();
|
|
return -ESRCH;
|
|
}
|
|
|
|
/* Prevent p going away */
|
|
get_task_struct(p);
|
|
rcu_read_unlock();
|
|
|
|
if (p->flags & PF_NO_SETAFFINITY) {
|
|
retval = -EINVAL;
|
|
goto out_put_task;
|
|
}
|
|
if (!alloc_cpumask_var(&cpus_allowed, GFP_KERNEL)) {
|
|
retval = -ENOMEM;
|
|
goto out_put_task;
|
|
}
|
|
if (!alloc_cpumask_var(&new_mask, GFP_KERNEL)) {
|
|
retval = -ENOMEM;
|
|
goto out_free_cpus_allowed;
|
|
}
|
|
retval = -EPERM;
|
|
if (!check_same_owner(p)) {
|
|
rcu_read_lock();
|
|
if (!ns_capable(__task_cred(p)->user_ns, CAP_SYS_NICE)) {
|
|
rcu_read_unlock();
|
|
goto out_free_new_mask;
|
|
}
|
|
rcu_read_unlock();
|
|
}
|
|
|
|
trace_android_vh_sched_setaffinity_early(p, in_mask, &skip);
|
|
if (skip)
|
|
goto out_free_new_mask;
|
|
retval = security_task_setscheduler(p);
|
|
if (retval)
|
|
goto out_free_new_mask;
|
|
|
|
|
|
cpuset_cpus_allowed(p, cpus_allowed);
|
|
cpumask_and(new_mask, in_mask, cpus_allowed);
|
|
|
|
/*
|
|
* Since bandwidth control happens on root_domain basis,
|
|
* if admission test is enabled, we only admit -deadline
|
|
* tasks allowed to run on all the CPUs in the task's
|
|
* root_domain.
|
|
*/
|
|
#ifdef CONFIG_SMP
|
|
if (task_has_dl_policy(p) && dl_bandwidth_enabled()) {
|
|
rcu_read_lock();
|
|
if (!cpumask_subset(task_rq(p)->rd->span, new_mask)) {
|
|
retval = -EBUSY;
|
|
rcu_read_unlock();
|
|
goto out_free_new_mask;
|
|
}
|
|
rcu_read_unlock();
|
|
}
|
|
#endif
|
|
again:
|
|
retval = __set_cpus_allowed_ptr(p, new_mask, true);
|
|
|
|
if (!retval) {
|
|
cpuset_cpus_allowed(p, cpus_allowed);
|
|
if (!cpumask_subset(new_mask, cpus_allowed)) {
|
|
/*
|
|
* We must have raced with a concurrent cpuset
|
|
* update. Just reset the cpus_allowed to the
|
|
* cpuset's cpus_allowed
|
|
*/
|
|
cpumask_copy(new_mask, cpus_allowed);
|
|
goto again;
|
|
}
|
|
}
|
|
|
|
trace_android_rvh_sched_setaffinity(p, in_mask, &retval);
|
|
|
|
out_free_new_mask:
|
|
free_cpumask_var(new_mask);
|
|
out_free_cpus_allowed:
|
|
free_cpumask_var(cpus_allowed);
|
|
out_put_task:
|
|
put_task_struct(p);
|
|
return retval;
|
|
}
|
|
|
|
static int get_user_cpu_mask(unsigned long __user *user_mask_ptr, unsigned len,
|
|
struct cpumask *new_mask)
|
|
{
|
|
if (len < cpumask_size())
|
|
cpumask_clear(new_mask);
|
|
else if (len > cpumask_size())
|
|
len = cpumask_size();
|
|
|
|
return copy_from_user(new_mask, user_mask_ptr, len) ? -EFAULT : 0;
|
|
}
|
|
|
|
/**
|
|
* sys_sched_setaffinity - set the CPU affinity of a process
|
|
* @pid: pid of the process
|
|
* @len: length in bytes of the bitmask pointed to by user_mask_ptr
|
|
* @user_mask_ptr: user-space pointer to the new CPU mask
|
|
*
|
|
* Return: 0 on success. An error code otherwise.
|
|
*/
|
|
SYSCALL_DEFINE3(sched_setaffinity, pid_t, pid, unsigned int, len,
|
|
unsigned long __user *, user_mask_ptr)
|
|
{
|
|
cpumask_var_t new_mask;
|
|
int retval;
|
|
|
|
if (!alloc_cpumask_var(&new_mask, GFP_KERNEL))
|
|
return -ENOMEM;
|
|
|
|
retval = get_user_cpu_mask(user_mask_ptr, len, new_mask);
|
|
if (retval == 0)
|
|
retval = sched_setaffinity(pid, new_mask);
|
|
free_cpumask_var(new_mask);
|
|
return retval;
|
|
}
|
|
|
|
long sched_getaffinity(pid_t pid, struct cpumask *mask)
|
|
{
|
|
struct task_struct *p;
|
|
unsigned long flags;
|
|
int retval;
|
|
|
|
rcu_read_lock();
|
|
|
|
retval = -ESRCH;
|
|
p = find_process_by_pid(pid);
|
|
if (!p)
|
|
goto out_unlock;
|
|
|
|
retval = security_task_getscheduler(p);
|
|
if (retval)
|
|
goto out_unlock;
|
|
|
|
raw_spin_lock_irqsave(&p->pi_lock, flags);
|
|
cpumask_and(mask, &p->cpus_mask, cpu_active_mask);
|
|
raw_spin_unlock_irqrestore(&p->pi_lock, flags);
|
|
|
|
out_unlock:
|
|
rcu_read_unlock();
|
|
|
|
return retval;
|
|
}
|
|
|
|
/**
|
|
* sys_sched_getaffinity - get the CPU affinity of a process
|
|
* @pid: pid of the process
|
|
* @len: length in bytes of the bitmask pointed to by user_mask_ptr
|
|
* @user_mask_ptr: user-space pointer to hold the current CPU mask
|
|
*
|
|
* Return: size of CPU mask copied to user_mask_ptr on success. An
|
|
* error code otherwise.
|
|
*/
|
|
SYSCALL_DEFINE3(sched_getaffinity, pid_t, pid, unsigned int, len,
|
|
unsigned long __user *, user_mask_ptr)
|
|
{
|
|
int ret;
|
|
cpumask_var_t mask;
|
|
|
|
if ((len * BITS_PER_BYTE) < nr_cpu_ids)
|
|
return -EINVAL;
|
|
if (len & (sizeof(unsigned long)-1))
|
|
return -EINVAL;
|
|
|
|
if (!alloc_cpumask_var(&mask, GFP_KERNEL))
|
|
return -ENOMEM;
|
|
|
|
ret = sched_getaffinity(pid, mask);
|
|
if (ret == 0) {
|
|
unsigned int retlen = min(len, cpumask_size());
|
|
|
|
if (copy_to_user(user_mask_ptr, mask, retlen))
|
|
ret = -EFAULT;
|
|
else
|
|
ret = retlen;
|
|
}
|
|
free_cpumask_var(mask);
|
|
|
|
return ret;
|
|
}
|
|
|
|
/**
|
|
* sys_sched_yield - yield the current processor to other threads.
|
|
*
|
|
* This function yields the current CPU to other tasks. If there are no
|
|
* other threads running on this CPU then this function will return.
|
|
*
|
|
* Return: 0.
|
|
*/
|
|
static void do_sched_yield(void)
|
|
{
|
|
struct rq_flags rf;
|
|
struct rq *rq;
|
|
|
|
rq = this_rq_lock_irq(&rf);
|
|
|
|
schedstat_inc(rq->yld_count);
|
|
current->sched_class->yield_task(rq);
|
|
|
|
preempt_disable();
|
|
rq_unlock_irq(rq, &rf);
|
|
sched_preempt_enable_no_resched();
|
|
|
|
schedule();
|
|
}
|
|
|
|
SYSCALL_DEFINE0(sched_yield)
|
|
{
|
|
do_sched_yield();
|
|
return 0;
|
|
}
|
|
|
|
#ifndef CONFIG_PREEMPTION
|
|
int __sched _cond_resched(void)
|
|
{
|
|
if (should_resched(0)) {
|
|
preempt_schedule_common();
|
|
return 1;
|
|
}
|
|
rcu_all_qs();
|
|
return 0;
|
|
}
|
|
EXPORT_SYMBOL(_cond_resched);
|
|
#endif
|
|
|
|
/*
|
|
* __cond_resched_lock() - if a reschedule is pending, drop the given lock,
|
|
* call schedule, and on return reacquire the lock.
|
|
*
|
|
* This works OK both with and without CONFIG_PREEMPTION. We do strange low-level
|
|
* operations here to prevent schedule() from being called twice (once via
|
|
* spin_unlock(), once by hand).
|
|
*/
|
|
int __cond_resched_lock(spinlock_t *lock)
|
|
{
|
|
int resched = should_resched(PREEMPT_LOCK_OFFSET);
|
|
int ret = 0;
|
|
|
|
lockdep_assert_held(lock);
|
|
|
|
if (spin_needbreak(lock) || resched) {
|
|
spin_unlock(lock);
|
|
if (resched)
|
|
preempt_schedule_common();
|
|
else
|
|
cpu_relax();
|
|
ret = 1;
|
|
spin_lock(lock);
|
|
}
|
|
return ret;
|
|
}
|
|
EXPORT_SYMBOL(__cond_resched_lock);
|
|
|
|
/**
|
|
* yield - yield the current processor to other threads.
|
|
*
|
|
* Do not ever use this function, there's a 99% chance you're doing it wrong.
|
|
*
|
|
* The scheduler is at all times free to pick the calling task as the most
|
|
* eligible task to run, if removing the yield() call from your code breaks
|
|
* it, its already broken.
|
|
*
|
|
* Typical broken usage is:
|
|
*
|
|
* while (!event)
|
|
* yield();
|
|
*
|
|
* where one assumes that yield() will let 'the other' process run that will
|
|
* make event true. If the current task is a SCHED_FIFO task that will never
|
|
* happen. Never use yield() as a progress guarantee!!
|
|
*
|
|
* If you want to use yield() to wait for something, use wait_event().
|
|
* If you want to use yield() to be 'nice' for others, use cond_resched().
|
|
* If you still want to use yield(), do not!
|
|
*/
|
|
void __sched yield(void)
|
|
{
|
|
set_current_state(TASK_RUNNING);
|
|
do_sched_yield();
|
|
}
|
|
EXPORT_SYMBOL(yield);
|
|
|
|
/**
|
|
* yield_to - yield the current processor to another thread in
|
|
* your thread group, or accelerate that thread toward the
|
|
* processor it's on.
|
|
* @p: target task
|
|
* @preempt: whether task preemption is allowed or not
|
|
*
|
|
* It's the caller's job to ensure that the target task struct
|
|
* can't go away on us before we can do any checks.
|
|
*
|
|
* Return:
|
|
* true (>0) if we indeed boosted the target task.
|
|
* false (0) if we failed to boost the target.
|
|
* -ESRCH if there's no task to yield to.
|
|
*/
|
|
int __sched yield_to(struct task_struct *p, bool preempt)
|
|
{
|
|
struct task_struct *curr = current;
|
|
struct rq *rq, *p_rq;
|
|
unsigned long flags;
|
|
int yielded = 0;
|
|
|
|
local_irq_save(flags);
|
|
rq = this_rq();
|
|
|
|
again:
|
|
p_rq = task_rq(p);
|
|
/*
|
|
* If we're the only runnable task on the rq and target rq also
|
|
* has only one task, there's absolutely no point in yielding.
|
|
*/
|
|
if (rq->nr_running == 1 && p_rq->nr_running == 1) {
|
|
yielded = -ESRCH;
|
|
goto out_irq;
|
|
}
|
|
|
|
double_rq_lock(rq, p_rq);
|
|
if (task_rq(p) != p_rq) {
|
|
double_rq_unlock(rq, p_rq);
|
|
goto again;
|
|
}
|
|
|
|
if (!curr->sched_class->yield_to_task)
|
|
goto out_unlock;
|
|
|
|
if (curr->sched_class != p->sched_class)
|
|
goto out_unlock;
|
|
|
|
if (task_running(p_rq, p) || p->state)
|
|
goto out_unlock;
|
|
|
|
yielded = curr->sched_class->yield_to_task(rq, p);
|
|
if (yielded) {
|
|
schedstat_inc(rq->yld_count);
|
|
/*
|
|
* Make p's CPU reschedule; pick_next_entity takes care of
|
|
* fairness.
|
|
*/
|
|
if (preempt && rq != p_rq)
|
|
resched_curr(p_rq);
|
|
}
|
|
|
|
out_unlock:
|
|
double_rq_unlock(rq, p_rq);
|
|
out_irq:
|
|
local_irq_restore(flags);
|
|
|
|
if (yielded > 0)
|
|
schedule();
|
|
|
|
return yielded;
|
|
}
|
|
EXPORT_SYMBOL_GPL(yield_to);
|
|
|
|
int io_schedule_prepare(void)
|
|
{
|
|
int old_iowait = current->in_iowait;
|
|
|
|
current->in_iowait = 1;
|
|
blk_schedule_flush_plug(current);
|
|
|
|
return old_iowait;
|
|
}
|
|
|
|
void io_schedule_finish(int token)
|
|
{
|
|
current->in_iowait = token;
|
|
}
|
|
|
|
/*
|
|
* This task is about to go to sleep on IO. Increment rq->nr_iowait so
|
|
* that process accounting knows that this is a task in IO wait state.
|
|
*/
|
|
long __sched io_schedule_timeout(long timeout)
|
|
{
|
|
int token;
|
|
long ret;
|
|
|
|
token = io_schedule_prepare();
|
|
ret = schedule_timeout(timeout);
|
|
io_schedule_finish(token);
|
|
|
|
return ret;
|
|
}
|
|
EXPORT_SYMBOL(io_schedule_timeout);
|
|
|
|
void __sched io_schedule(void)
|
|
{
|
|
int token;
|
|
|
|
token = io_schedule_prepare();
|
|
schedule();
|
|
io_schedule_finish(token);
|
|
}
|
|
EXPORT_SYMBOL(io_schedule);
|
|
|
|
/**
|
|
* sys_sched_get_priority_max - return maximum RT priority.
|
|
* @policy: scheduling class.
|
|
*
|
|
* Return: On success, this syscall returns the maximum
|
|
* rt_priority that can be used by a given scheduling class.
|
|
* On failure, a negative error code is returned.
|
|
*/
|
|
SYSCALL_DEFINE1(sched_get_priority_max, int, policy)
|
|
{
|
|
int ret = -EINVAL;
|
|
|
|
switch (policy) {
|
|
case SCHED_FIFO:
|
|
case SCHED_RR:
|
|
ret = MAX_USER_RT_PRIO-1;
|
|
break;
|
|
case SCHED_DEADLINE:
|
|
case SCHED_NORMAL:
|
|
case SCHED_BATCH:
|
|
case SCHED_IDLE:
|
|
ret = 0;
|
|
break;
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
/**
|
|
* sys_sched_get_priority_min - return minimum RT priority.
|
|
* @policy: scheduling class.
|
|
*
|
|
* Return: On success, this syscall returns the minimum
|
|
* rt_priority that can be used by a given scheduling class.
|
|
* On failure, a negative error code is returned.
|
|
*/
|
|
SYSCALL_DEFINE1(sched_get_priority_min, int, policy)
|
|
{
|
|
int ret = -EINVAL;
|
|
|
|
switch (policy) {
|
|
case SCHED_FIFO:
|
|
case SCHED_RR:
|
|
ret = 1;
|
|
break;
|
|
case SCHED_DEADLINE:
|
|
case SCHED_NORMAL:
|
|
case SCHED_BATCH:
|
|
case SCHED_IDLE:
|
|
ret = 0;
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
static int sched_rr_get_interval(pid_t pid, struct timespec64 *t)
|
|
{
|
|
struct task_struct *p;
|
|
unsigned int time_slice;
|
|
struct rq_flags rf;
|
|
struct rq *rq;
|
|
int retval;
|
|
|
|
if (pid < 0)
|
|
return -EINVAL;
|
|
|
|
retval = -ESRCH;
|
|
rcu_read_lock();
|
|
p = find_process_by_pid(pid);
|
|
if (!p)
|
|
goto out_unlock;
|
|
|
|
retval = security_task_getscheduler(p);
|
|
if (retval)
|
|
goto out_unlock;
|
|
|
|
rq = task_rq_lock(p, &rf);
|
|
time_slice = 0;
|
|
if (p->sched_class->get_rr_interval)
|
|
time_slice = p->sched_class->get_rr_interval(rq, p);
|
|
task_rq_unlock(rq, p, &rf);
|
|
|
|
rcu_read_unlock();
|
|
jiffies_to_timespec64(time_slice, t);
|
|
return 0;
|
|
|
|
out_unlock:
|
|
rcu_read_unlock();
|
|
return retval;
|
|
}
|
|
|
|
/**
|
|
* sys_sched_rr_get_interval - return the default timeslice of a process.
|
|
* @pid: pid of the process.
|
|
* @interval: userspace pointer to the timeslice value.
|
|
*
|
|
* this syscall writes the default timeslice value of a given process
|
|
* into the user-space timespec buffer. A value of '0' means infinity.
|
|
*
|
|
* Return: On success, 0 and the timeslice is in @interval. Otherwise,
|
|
* an error code.
|
|
*/
|
|
SYSCALL_DEFINE2(sched_rr_get_interval, pid_t, pid,
|
|
struct __kernel_timespec __user *, interval)
|
|
{
|
|
struct timespec64 t;
|
|
int retval = sched_rr_get_interval(pid, &t);
|
|
|
|
if (retval == 0)
|
|
retval = put_timespec64(&t, interval);
|
|
|
|
return retval;
|
|
}
|
|
|
|
#ifdef CONFIG_COMPAT_32BIT_TIME
|
|
SYSCALL_DEFINE2(sched_rr_get_interval_time32, pid_t, pid,
|
|
struct old_timespec32 __user *, interval)
|
|
{
|
|
struct timespec64 t;
|
|
int retval = sched_rr_get_interval(pid, &t);
|
|
|
|
if (retval == 0)
|
|
retval = put_old_timespec32(&t, interval);
|
|
return retval;
|
|
}
|
|
#endif
|
|
|
|
void sched_show_task(struct task_struct *p)
|
|
{
|
|
unsigned long free = 0;
|
|
int ppid;
|
|
|
|
if (!try_get_task_stack(p))
|
|
return;
|
|
|
|
pr_info("task:%-15.15s state:%c", p->comm, task_state_to_char(p));
|
|
|
|
if (p->state == TASK_RUNNING)
|
|
pr_cont(" running task ");
|
|
#ifdef CONFIG_DEBUG_STACK_USAGE
|
|
free = stack_not_used(p);
|
|
#endif
|
|
ppid = 0;
|
|
rcu_read_lock();
|
|
if (pid_alive(p))
|
|
ppid = task_pid_nr(rcu_dereference(p->real_parent));
|
|
rcu_read_unlock();
|
|
pr_cont(" stack:%5lu pid:%5d ppid:%6d flags:0x%08lx\n",
|
|
free, task_pid_nr(p), ppid,
|
|
(unsigned long)task_thread_info(p)->flags);
|
|
|
|
print_worker_info(KERN_INFO, p);
|
|
trace_android_vh_sched_show_task(p);
|
|
show_stack(p, NULL, KERN_INFO);
|
|
put_task_stack(p);
|
|
}
|
|
EXPORT_SYMBOL_GPL(sched_show_task);
|
|
|
|
static inline bool
|
|
state_filter_match(unsigned long state_filter, struct task_struct *p)
|
|
{
|
|
/* no filter, everything matches */
|
|
if (!state_filter)
|
|
return true;
|
|
|
|
/* filter, but doesn't match */
|
|
if (!(p->state & state_filter))
|
|
return false;
|
|
|
|
/*
|
|
* When looking for TASK_UNINTERRUPTIBLE skip TASK_IDLE (allows
|
|
* TASK_KILLABLE).
|
|
*/
|
|
if (state_filter == TASK_UNINTERRUPTIBLE && p->state == TASK_IDLE)
|
|
return false;
|
|
|
|
return true;
|
|
}
|
|
|
|
|
|
void show_state_filter(unsigned long state_filter)
|
|
{
|
|
struct task_struct *g, *p;
|
|
|
|
rcu_read_lock();
|
|
for_each_process_thread(g, p) {
|
|
/*
|
|
* reset the NMI-timeout, listing all files on a slow
|
|
* console might take a lot of time:
|
|
* Also, reset softlockup watchdogs on all CPUs, because
|
|
* another CPU might be blocked waiting for us to process
|
|
* an IPI.
|
|
*/
|
|
touch_nmi_watchdog();
|
|
touch_all_softlockup_watchdogs();
|
|
if (state_filter_match(state_filter, p))
|
|
sched_show_task(p);
|
|
}
|
|
|
|
#ifdef CONFIG_SCHED_DEBUG
|
|
if (!state_filter)
|
|
sysrq_sched_debug_show();
|
|
#endif
|
|
rcu_read_unlock();
|
|
/*
|
|
* Only show locks if all tasks are dumped:
|
|
*/
|
|
if (!state_filter)
|
|
debug_show_all_locks();
|
|
}
|
|
|
|
/**
|
|
* init_idle - set up an idle thread for a given CPU
|
|
* @idle: task in question
|
|
* @cpu: CPU the idle task belongs to
|
|
*
|
|
* NOTE: this function does not set the idle thread's NEED_RESCHED
|
|
* flag, to make booting more robust.
|
|
*/
|
|
void __init init_idle(struct task_struct *idle, int cpu)
|
|
{
|
|
struct rq *rq = cpu_rq(cpu);
|
|
unsigned long flags;
|
|
|
|
__sched_fork(0, idle);
|
|
|
|
raw_spin_lock_irqsave(&idle->pi_lock, flags);
|
|
raw_spin_lock(&rq->lock);
|
|
|
|
idle->state = TASK_RUNNING;
|
|
idle->se.exec_start = sched_clock();
|
|
idle->flags |= PF_IDLE;
|
|
|
|
scs_task_reset(idle);
|
|
kasan_unpoison_task_stack(idle);
|
|
|
|
#ifdef CONFIG_SMP
|
|
/*
|
|
* Its possible that init_idle() gets called multiple times on a task,
|
|
* in that case do_set_cpus_allowed() will not do the right thing.
|
|
*
|
|
* And since this is boot we can forgo the serialization.
|
|
*/
|
|
set_cpus_allowed_common(idle, cpumask_of(cpu));
|
|
#endif
|
|
/*
|
|
* We're having a chicken and egg problem, even though we are
|
|
* holding rq->lock, the CPU isn't yet set to this CPU so the
|
|
* lockdep check in task_group() will fail.
|
|
*
|
|
* Similar case to sched_fork(). / Alternatively we could
|
|
* use task_rq_lock() here and obtain the other rq->lock.
|
|
*
|
|
* Silence PROVE_RCU
|
|
*/
|
|
rcu_read_lock();
|
|
__set_task_cpu(idle, cpu);
|
|
rcu_read_unlock();
|
|
|
|
rq->idle = idle;
|
|
rcu_assign_pointer(rq->curr, idle);
|
|
idle->on_rq = TASK_ON_RQ_QUEUED;
|
|
#ifdef CONFIG_SMP
|
|
idle->on_cpu = 1;
|
|
#endif
|
|
raw_spin_unlock(&rq->lock);
|
|
raw_spin_unlock_irqrestore(&idle->pi_lock, flags);
|
|
|
|
/* Set the preempt count _outside_ the spinlocks! */
|
|
init_idle_preempt_count(idle, cpu);
|
|
|
|
/*
|
|
* The idle tasks have their own, simple scheduling class:
|
|
*/
|
|
idle->sched_class = &idle_sched_class;
|
|
ftrace_graph_init_idle_task(idle, cpu);
|
|
vtime_init_idle(idle, cpu);
|
|
#ifdef CONFIG_SMP
|
|
sprintf(idle->comm, "%s/%d", INIT_TASK_COMM, cpu);
|
|
#endif
|
|
}
|
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
int cpuset_cpumask_can_shrink(const struct cpumask *cur,
|
|
const struct cpumask *trial)
|
|
{
|
|
int ret = 1;
|
|
|
|
if (!cpumask_weight(cur))
|
|
return ret;
|
|
|
|
ret = dl_cpuset_cpumask_can_shrink(cur, trial);
|
|
|
|
return ret;
|
|
}
|
|
|
|
int task_can_attach(struct task_struct *p,
|
|
const struct cpumask *cs_cpus_allowed)
|
|
{
|
|
int ret = 0;
|
|
|
|
/*
|
|
* Kthreads which disallow setaffinity shouldn't be moved
|
|
* to a new cpuset; we don't want to change their CPU
|
|
* affinity and isolating such threads by their set of
|
|
* allowed nodes is unnecessary. Thus, cpusets are not
|
|
* applicable for such threads. This prevents checking for
|
|
* success of set_cpus_allowed_ptr() on all attached tasks
|
|
* before cpus_mask may be changed.
|
|
*/
|
|
if (p->flags & PF_NO_SETAFFINITY) {
|
|
ret = -EINVAL;
|
|
goto out;
|
|
}
|
|
|
|
if (dl_task(p) && !cpumask_intersects(task_rq(p)->rd->span,
|
|
cs_cpus_allowed))
|
|
ret = dl_task_can_attach(p, cs_cpus_allowed);
|
|
|
|
out:
|
|
return ret;
|
|
}
|
|
|
|
bool sched_smp_initialized __read_mostly;
|
|
|
|
#ifdef CONFIG_NUMA_BALANCING
|
|
/* Migrate current task p to target_cpu */
|
|
int migrate_task_to(struct task_struct *p, int target_cpu)
|
|
{
|
|
struct migration_arg arg = { p, target_cpu };
|
|
int curr_cpu = task_cpu(p);
|
|
|
|
if (curr_cpu == target_cpu)
|
|
return 0;
|
|
|
|
if (!cpumask_test_cpu(target_cpu, p->cpus_ptr))
|
|
return -EINVAL;
|
|
|
|
/* TODO: This is not properly updating schedstats */
|
|
|
|
trace_sched_move_numa(p, curr_cpu, target_cpu);
|
|
return stop_one_cpu(curr_cpu, migration_cpu_stop, &arg);
|
|
}
|
|
|
|
/*
|
|
* Requeue a task on a given node and accurately track the number of NUMA
|
|
* tasks on the runqueues
|
|
*/
|
|
void sched_setnuma(struct task_struct *p, int nid)
|
|
{
|
|
bool queued, running;
|
|
struct rq_flags rf;
|
|
struct rq *rq;
|
|
|
|
rq = task_rq_lock(p, &rf);
|
|
queued = task_on_rq_queued(p);
|
|
running = task_current(rq, p);
|
|
|
|
if (queued)
|
|
dequeue_task(rq, p, DEQUEUE_SAVE);
|
|
if (running)
|
|
put_prev_task(rq, p);
|
|
|
|
p->numa_preferred_nid = nid;
|
|
|
|
if (queued)
|
|
enqueue_task(rq, p, ENQUEUE_RESTORE | ENQUEUE_NOCLOCK);
|
|
if (running)
|
|
set_next_task(rq, p);
|
|
task_rq_unlock(rq, p, &rf);
|
|
}
|
|
#endif /* CONFIG_NUMA_BALANCING */
|
|
|
|
#ifdef CONFIG_HOTPLUG_CPU
|
|
/*
|
|
* Ensure that the idle task is using init_mm right before its CPU goes
|
|
* offline.
|
|
*/
|
|
void idle_task_exit(void)
|
|
{
|
|
struct mm_struct *mm = current->active_mm;
|
|
|
|
BUG_ON(cpu_online(smp_processor_id()));
|
|
BUG_ON(current != this_rq()->idle);
|
|
|
|
if (mm != &init_mm) {
|
|
switch_mm(mm, &init_mm, current);
|
|
finish_arch_post_lock_switch();
|
|
}
|
|
|
|
/* finish_cpu(), as ran on the BP, will clean up the active_mm state */
|
|
}
|
|
|
|
/*
|
|
* Since this CPU is going 'away' for a while, fold any nr_active delta
|
|
* we might have. Assumes we're called after migrate_tasks() so that the
|
|
* nr_active count is stable. We need to take the teardown thread which
|
|
* is calling this into account, so we hand in adjust = 1 to the load
|
|
* calculation.
|
|
*
|
|
* Also see the comment "Global load-average calculations".
|
|
*/
|
|
static void calc_load_migrate(struct rq *rq)
|
|
{
|
|
long delta = calc_load_fold_active(rq, 1);
|
|
if (delta)
|
|
atomic_long_add(delta, &calc_load_tasks);
|
|
}
|
|
|
|
static struct task_struct *__pick_migrate_task(struct rq *rq)
|
|
{
|
|
const struct sched_class *class;
|
|
struct task_struct *next;
|
|
|
|
for_each_class(class) {
|
|
next = class->pick_next_task(rq);
|
|
if (next) {
|
|
next->sched_class->put_prev_task(rq, next);
|
|
return next;
|
|
}
|
|
}
|
|
|
|
/* The idle class should always have a runnable task */
|
|
BUG();
|
|
}
|
|
|
|
/*
|
|
* Migrate all tasks from the rq, sleeping tasks will be migrated by
|
|
* try_to_wake_up()->select_task_rq().
|
|
*
|
|
* Called with rq->lock held even though we'er in stop_machine() and
|
|
* there's no concurrency possible, we hold the required locks anyway
|
|
* because of lock validation efforts.
|
|
*
|
|
* force: if false, the function will skip CPU pinned kthreads.
|
|
*/
|
|
static void migrate_tasks(struct rq *dead_rq, struct rq_flags *rf, bool force)
|
|
{
|
|
struct rq *rq = dead_rq;
|
|
struct task_struct *next, *tmp, *stop = rq->stop;
|
|
LIST_HEAD(percpu_kthreads);
|
|
struct rq_flags orf = *rf;
|
|
int dest_cpu;
|
|
|
|
/*
|
|
* Fudge the rq selection such that the below task selection loop
|
|
* doesn't get stuck on the currently eligible stop task.
|
|
*
|
|
* We're currently inside stop_machine() and the rq is either stuck
|
|
* in the stop_machine_cpu_stop() loop, or we're executing this code,
|
|
* either way we should never end up calling schedule() until we're
|
|
* done here.
|
|
*/
|
|
rq->stop = NULL;
|
|
|
|
/*
|
|
* put_prev_task() and pick_next_task() sched
|
|
* class method both need to have an up-to-date
|
|
* value of rq->clock[_task]
|
|
*/
|
|
update_rq_clock(rq);
|
|
|
|
#ifdef CONFIG_SCHED_DEBUG
|
|
/* note the clock update in orf */
|
|
orf.clock_update_flags |= RQCF_UPDATED;
|
|
#endif
|
|
|
|
for (;;) {
|
|
/*
|
|
* There's this thread running, bail when that's the only
|
|
* remaining thread:
|
|
*/
|
|
if (rq->nr_running == 1)
|
|
break;
|
|
|
|
next = __pick_migrate_task(rq);
|
|
|
|
/*
|
|
* Argh ... no iterator for tasks, we need to remove the
|
|
* kthread from the run-queue to continue.
|
|
*/
|
|
if (!force && is_per_cpu_kthread(next)) {
|
|
INIT_LIST_HEAD(&next->percpu_kthread_node);
|
|
list_add(&next->percpu_kthread_node, &percpu_kthreads);
|
|
|
|
/* DEQUEUE_SAVE not used due to move_entity in rt */
|
|
deactivate_task(rq, next,
|
|
DEQUEUE_NOCLOCK);
|
|
continue;
|
|
}
|
|
|
|
/*
|
|
* Rules for changing task_struct::cpus_mask are holding
|
|
* both pi_lock and rq->lock, such that holding either
|
|
* stabilizes the mask.
|
|
*
|
|
* Drop rq->lock is not quite as disastrous as it usually is
|
|
* because !cpu_active at this point, which means load-balance
|
|
* will not interfere. Also, stop-machine.
|
|
*/
|
|
rq_unlock(rq, rf);
|
|
raw_spin_lock(&next->pi_lock);
|
|
rq_relock(rq, rf);
|
|
|
|
/*
|
|
* Since we're inside stop-machine, _nothing_ should have
|
|
* changed the task, WARN if weird stuff happened, because in
|
|
* that case the above rq->lock drop is a fail too.
|
|
*/
|
|
if (task_rq(next) != rq || !task_on_rq_queued(next)) {
|
|
/*
|
|
* In the !force case, there is a hole between
|
|
* rq_unlock() and rq_relock(), where another CPU might
|
|
* not observe an up to date cpu_active_mask and try to
|
|
* move tasks around.
|
|
*/
|
|
WARN_ON(force);
|
|
raw_spin_unlock(&next->pi_lock);
|
|
continue;
|
|
}
|
|
|
|
/* Find suitable destination for @next, with force if needed. */
|
|
dest_cpu = select_fallback_rq(dead_rq->cpu, next);
|
|
rq = __migrate_task(rq, rf, next, dest_cpu);
|
|
if (rq != dead_rq) {
|
|
rq_unlock(rq, rf);
|
|
rq = dead_rq;
|
|
*rf = orf;
|
|
rq_relock(rq, rf);
|
|
}
|
|
raw_spin_unlock(&next->pi_lock);
|
|
}
|
|
|
|
list_for_each_entry_safe(next, tmp, &percpu_kthreads,
|
|
percpu_kthread_node) {
|
|
|
|
/* ENQUEUE_RESTORE not used due to move_entity in rt */
|
|
activate_task(rq, next, ENQUEUE_NOCLOCK);
|
|
list_del(&next->percpu_kthread_node);
|
|
}
|
|
|
|
rq->stop = stop;
|
|
}
|
|
|
|
static int drain_rq_cpu_stop(void *data)
|
|
{
|
|
struct rq *rq = this_rq();
|
|
struct rq_flags rf;
|
|
|
|
rq_lock_irqsave(rq, &rf);
|
|
migrate_tasks(rq, &rf, false);
|
|
rq_unlock_irqrestore(rq, &rf);
|
|
|
|
return 0;
|
|
}
|
|
|
|
int sched_cpu_drain_rq(unsigned int cpu)
|
|
{
|
|
struct cpu_stop_work *rq_drain = &(cpu_rq(cpu)->drain);
|
|
struct cpu_stop_done *rq_drain_done = &(cpu_rq(cpu)->drain_done);
|
|
|
|
if (idle_cpu(cpu)) {
|
|
rq_drain->done = NULL;
|
|
return 0;
|
|
}
|
|
|
|
return stop_one_cpu_async(cpu, drain_rq_cpu_stop, NULL, rq_drain,
|
|
rq_drain_done);
|
|
}
|
|
|
|
void sched_cpu_drain_rq_wait(unsigned int cpu)
|
|
{
|
|
struct cpu_stop_work *rq_drain = &(cpu_rq(cpu)->drain);
|
|
|
|
if (rq_drain->done)
|
|
cpu_stop_work_wait(rq_drain);
|
|
}
|
|
#endif /* CONFIG_HOTPLUG_CPU */
|
|
|
|
void set_rq_online(struct rq *rq)
|
|
{
|
|
if (!rq->online) {
|
|
const struct sched_class *class;
|
|
|
|
cpumask_set_cpu(rq->cpu, rq->rd->online);
|
|
rq->online = 1;
|
|
|
|
for_each_class(class) {
|
|
if (class->rq_online)
|
|
class->rq_online(rq);
|
|
}
|
|
}
|
|
}
|
|
|
|
void set_rq_offline(struct rq *rq)
|
|
{
|
|
if (rq->online) {
|
|
const struct sched_class *class;
|
|
|
|
for_each_class(class) {
|
|
if (class->rq_offline)
|
|
class->rq_offline(rq);
|
|
}
|
|
|
|
cpumask_clear_cpu(rq->cpu, rq->rd->online);
|
|
rq->online = 0;
|
|
}
|
|
}
|
|
|
|
/*
|
|
* used to mark begin/end of suspend/resume:
|
|
*/
|
|
static int num_cpus_frozen;
|
|
|
|
/*
|
|
* Update cpusets according to cpu_active mask. If cpusets are
|
|
* disabled, cpuset_update_active_cpus() becomes a simple wrapper
|
|
* around partition_sched_domains().
|
|
*
|
|
* If we come here as part of a suspend/resume, don't touch cpusets because we
|
|
* want to restore it back to its original state upon resume anyway.
|
|
*/
|
|
static void cpuset_cpu_active(void)
|
|
{
|
|
if (cpuhp_tasks_frozen) {
|
|
/*
|
|
* num_cpus_frozen tracks how many CPUs are involved in suspend
|
|
* resume sequence. As long as this is not the last online
|
|
* operation in the resume sequence, just build a single sched
|
|
* domain, ignoring cpusets.
|
|
*/
|
|
partition_sched_domains(1, NULL, NULL);
|
|
if (--num_cpus_frozen)
|
|
return;
|
|
/*
|
|
* This is the last CPU online operation. So fall through and
|
|
* restore the original sched domains by considering the
|
|
* cpuset configurations.
|
|
*/
|
|
cpuset_force_rebuild();
|
|
}
|
|
cpuset_update_active_cpus();
|
|
}
|
|
|
|
static int cpuset_cpu_inactive(unsigned int cpu)
|
|
{
|
|
if (!cpuhp_tasks_frozen) {
|
|
if (dl_cpu_busy(cpu))
|
|
return -EBUSY;
|
|
cpuset_update_active_cpus();
|
|
} else {
|
|
num_cpus_frozen++;
|
|
partition_sched_domains(1, NULL, NULL);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
int sched_cpu_activate(unsigned int cpu)
|
|
{
|
|
struct rq *rq = cpu_rq(cpu);
|
|
struct rq_flags rf;
|
|
|
|
#ifdef CONFIG_SCHED_SMT
|
|
/*
|
|
* When going up, increment the number of cores with SMT present.
|
|
*/
|
|
if (cpumask_weight(cpu_smt_mask(cpu)) == 2)
|
|
static_branch_inc_cpuslocked(&sched_smt_present);
|
|
#endif
|
|
set_cpu_active(cpu, true);
|
|
|
|
if (sched_smp_initialized) {
|
|
sched_domains_numa_masks_set(cpu);
|
|
cpuset_cpu_active();
|
|
}
|
|
|
|
/*
|
|
* Put the rq online, if not already. This happens:
|
|
*
|
|
* 1) In the early boot process, because we build the real domains
|
|
* after all CPUs have been brought up.
|
|
*
|
|
* 2) At runtime, if cpuset_cpu_active() fails to rebuild the
|
|
* domains.
|
|
*/
|
|
rq_lock_irqsave(rq, &rf);
|
|
if (rq->rd) {
|
|
BUG_ON(!cpumask_test_cpu(cpu, rq->rd->span));
|
|
set_rq_online(rq);
|
|
}
|
|
rq_unlock_irqrestore(rq, &rf);
|
|
|
|
update_max_interval();
|
|
|
|
return 0;
|
|
}
|
|
|
|
int sched_cpus_activate(struct cpumask *cpus)
|
|
{
|
|
unsigned int cpu;
|
|
|
|
for_each_cpu(cpu, cpus) {
|
|
if (sched_cpu_activate(cpu)) {
|
|
for_each_cpu_and(cpu, cpus, cpu_active_mask)
|
|
sched_cpu_deactivate(cpu);
|
|
|
|
return -EBUSY;
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
int _sched_cpu_deactivate(unsigned int cpu)
|
|
{
|
|
int ret;
|
|
|
|
set_cpu_active(cpu, false);
|
|
|
|
#ifdef CONFIG_SCHED_SMT
|
|
/*
|
|
* When going down, decrement the number of cores with SMT present.
|
|
*/
|
|
if (cpumask_weight(cpu_smt_mask(cpu)) == 2)
|
|
static_branch_dec_cpuslocked(&sched_smt_present);
|
|
#endif
|
|
|
|
if (!sched_smp_initialized)
|
|
return 0;
|
|
|
|
ret = cpuset_cpu_inactive(cpu);
|
|
if (ret) {
|
|
set_cpu_active(cpu, true);
|
|
return ret;
|
|
}
|
|
sched_domains_numa_masks_clear(cpu);
|
|
|
|
update_max_interval();
|
|
|
|
return 0;
|
|
}
|
|
|
|
int sched_cpu_deactivate(unsigned int cpu)
|
|
{
|
|
int ret = _sched_cpu_deactivate(cpu);
|
|
|
|
if (ret)
|
|
return ret;
|
|
|
|
/*
|
|
* We've cleared cpu_active_mask, wait for all preempt-disabled and RCU
|
|
* users of this state to go away such that all new such users will
|
|
* observe it.
|
|
*
|
|
* Do sync before park smpboot threads to take care the rcu boost case.
|
|
*/
|
|
synchronize_rcu();
|
|
|
|
return 0;
|
|
}
|
|
|
|
int sched_cpus_deactivate_nosync(struct cpumask *cpus)
|
|
{
|
|
unsigned int cpu;
|
|
|
|
for_each_cpu(cpu, cpus) {
|
|
if (_sched_cpu_deactivate(cpu)) {
|
|
for_each_cpu(cpu, cpus) {
|
|
if (!cpu_active(cpu))
|
|
sched_cpu_activate(cpu);
|
|
}
|
|
|
|
return -EBUSY;
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
static void sched_rq_cpu_starting(unsigned int cpu)
|
|
{
|
|
struct rq *rq = cpu_rq(cpu);
|
|
|
|
rq->calc_load_update = calc_load_update;
|
|
}
|
|
|
|
int sched_cpu_starting(unsigned int cpu)
|
|
{
|
|
sched_rq_cpu_starting(cpu);
|
|
sched_tick_start(cpu);
|
|
trace_android_rvh_sched_cpu_starting(cpu);
|
|
return 0;
|
|
}
|
|
|
|
#ifdef CONFIG_HOTPLUG_CPU
|
|
int sched_cpu_dying(unsigned int cpu)
|
|
{
|
|
struct rq *rq = cpu_rq(cpu);
|
|
struct rq_flags rf;
|
|
|
|
/* Handle pending wakeups and then migrate everything off */
|
|
sched_tick_stop(cpu);
|
|
|
|
rq_lock_irqsave(rq, &rf);
|
|
if (rq->rd) {
|
|
BUG_ON(!cpumask_test_cpu(cpu, rq->rd->span));
|
|
set_rq_offline(rq);
|
|
}
|
|
migrate_tasks(rq, &rf, true);
|
|
BUG_ON(rq->nr_running != 1);
|
|
rq_unlock_irqrestore(rq, &rf);
|
|
|
|
trace_android_rvh_sched_cpu_dying(cpu);
|
|
|
|
calc_load_migrate(rq);
|
|
nohz_balance_exit_idle(rq);
|
|
hrtick_clear(rq);
|
|
return 0;
|
|
}
|
|
#endif
|
|
|
|
void __init sched_init_smp(void)
|
|
{
|
|
sched_init_numa();
|
|
|
|
/*
|
|
* There's no userspace yet to cause hotplug operations; hence all the
|
|
* CPU masks are stable and all blatant races in the below code cannot
|
|
* happen.
|
|
*/
|
|
mutex_lock(&sched_domains_mutex);
|
|
sched_init_domains(cpu_active_mask);
|
|
mutex_unlock(&sched_domains_mutex);
|
|
|
|
/* Move init over to a non-isolated CPU */
|
|
if (set_cpus_allowed_ptr(current, housekeeping_cpumask(HK_FLAG_DOMAIN)) < 0)
|
|
BUG();
|
|
|
|
sched_init_granularity();
|
|
|
|
init_sched_rt_class();
|
|
init_sched_dl_class();
|
|
|
|
sched_smp_initialized = true;
|
|
}
|
|
|
|
static int __init migration_init(void)
|
|
{
|
|
sched_cpu_starting(smp_processor_id());
|
|
return 0;
|
|
}
|
|
early_initcall(migration_init);
|
|
|
|
#else
|
|
void __init sched_init_smp(void)
|
|
{
|
|
sched_init_granularity();
|
|
}
|
|
#endif /* CONFIG_SMP */
|
|
|
|
int in_sched_functions(unsigned long addr)
|
|
{
|
|
return in_lock_functions(addr) ||
|
|
(addr >= (unsigned long)__sched_text_start
|
|
&& addr < (unsigned long)__sched_text_end);
|
|
}
|
|
|
|
#ifdef CONFIG_CGROUP_SCHED
|
|
/*
|
|
* Default task group.
|
|
* Every task in system belongs to this group at bootup.
|
|
*/
|
|
struct task_group root_task_group;
|
|
EXPORT_SYMBOL_GPL(root_task_group);
|
|
LIST_HEAD(task_groups);
|
|
EXPORT_SYMBOL_GPL(task_groups);
|
|
|
|
/* Cacheline aligned slab cache for task_group */
|
|
static struct kmem_cache *task_group_cache __read_mostly;
|
|
#endif
|
|
|
|
DECLARE_PER_CPU(cpumask_var_t, load_balance_mask);
|
|
DECLARE_PER_CPU(cpumask_var_t, select_idle_mask);
|
|
|
|
void __init sched_init(void)
|
|
{
|
|
unsigned long ptr = 0;
|
|
int i;
|
|
|
|
/* Make sure the linker didn't screw up */
|
|
BUG_ON(&idle_sched_class + 1 != &fair_sched_class ||
|
|
&fair_sched_class + 1 != &rt_sched_class ||
|
|
&rt_sched_class + 1 != &dl_sched_class);
|
|
#ifdef CONFIG_SMP
|
|
BUG_ON(&dl_sched_class + 1 != &stop_sched_class);
|
|
#endif
|
|
|
|
wait_bit_init();
|
|
|
|
#ifdef CONFIG_FAIR_GROUP_SCHED
|
|
ptr += 2 * nr_cpu_ids * sizeof(void **);
|
|
#endif
|
|
#ifdef CONFIG_RT_GROUP_SCHED
|
|
ptr += 2 * nr_cpu_ids * sizeof(void **);
|
|
#endif
|
|
if (ptr) {
|
|
ptr = (unsigned long)kzalloc(ptr, GFP_NOWAIT);
|
|
|
|
#ifdef CONFIG_FAIR_GROUP_SCHED
|
|
root_task_group.se = (struct sched_entity **)ptr;
|
|
ptr += nr_cpu_ids * sizeof(void **);
|
|
|
|
root_task_group.cfs_rq = (struct cfs_rq **)ptr;
|
|
ptr += nr_cpu_ids * sizeof(void **);
|
|
|
|
root_task_group.shares = ROOT_TASK_GROUP_LOAD;
|
|
init_cfs_bandwidth(&root_task_group.cfs_bandwidth);
|
|
#endif /* CONFIG_FAIR_GROUP_SCHED */
|
|
#ifdef CONFIG_RT_GROUP_SCHED
|
|
root_task_group.rt_se = (struct sched_rt_entity **)ptr;
|
|
ptr += nr_cpu_ids * sizeof(void **);
|
|
|
|
root_task_group.rt_rq = (struct rt_rq **)ptr;
|
|
ptr += nr_cpu_ids * sizeof(void **);
|
|
|
|
#endif /* CONFIG_RT_GROUP_SCHED */
|
|
}
|
|
#ifdef CONFIG_CPUMASK_OFFSTACK
|
|
for_each_possible_cpu(i) {
|
|
per_cpu(load_balance_mask, i) = (cpumask_var_t)kzalloc_node(
|
|
cpumask_size(), GFP_KERNEL, cpu_to_node(i));
|
|
per_cpu(select_idle_mask, i) = (cpumask_var_t)kzalloc_node(
|
|
cpumask_size(), GFP_KERNEL, cpu_to_node(i));
|
|
}
|
|
#endif /* CONFIG_CPUMASK_OFFSTACK */
|
|
|
|
init_rt_bandwidth(&def_rt_bandwidth, global_rt_period(), global_rt_runtime());
|
|
init_dl_bandwidth(&def_dl_bandwidth, global_rt_period(), global_rt_runtime());
|
|
|
|
#ifdef CONFIG_SMP
|
|
init_defrootdomain();
|
|
#endif
|
|
|
|
#ifdef CONFIG_RT_GROUP_SCHED
|
|
init_rt_bandwidth(&root_task_group.rt_bandwidth,
|
|
global_rt_period(), global_rt_runtime());
|
|
#endif /* CONFIG_RT_GROUP_SCHED */
|
|
|
|
#ifdef CONFIG_CGROUP_SCHED
|
|
task_group_cache = KMEM_CACHE(task_group, 0);
|
|
|
|
list_add(&root_task_group.list, &task_groups);
|
|
INIT_LIST_HEAD(&root_task_group.children);
|
|
INIT_LIST_HEAD(&root_task_group.siblings);
|
|
autogroup_init(&init_task);
|
|
#endif /* CONFIG_CGROUP_SCHED */
|
|
|
|
for_each_possible_cpu(i) {
|
|
struct rq *rq;
|
|
|
|
rq = cpu_rq(i);
|
|
raw_spin_lock_init(&rq->lock);
|
|
rq->nr_running = 0;
|
|
rq->calc_load_active = 0;
|
|
rq->calc_load_update = jiffies + LOAD_FREQ;
|
|
init_cfs_rq(&rq->cfs);
|
|
init_rt_rq(&rq->rt);
|
|
init_dl_rq(&rq->dl);
|
|
#ifdef CONFIG_FAIR_GROUP_SCHED
|
|
INIT_LIST_HEAD(&rq->leaf_cfs_rq_list);
|
|
rq->tmp_alone_branch = &rq->leaf_cfs_rq_list;
|
|
/*
|
|
* How much CPU bandwidth does root_task_group get?
|
|
*
|
|
* In case of task-groups formed thr' the cgroup filesystem, it
|
|
* gets 100% of the CPU resources in the system. This overall
|
|
* system CPU resource is divided among the tasks of
|
|
* root_task_group and its child task-groups in a fair manner,
|
|
* based on each entity's (task or task-group's) weight
|
|
* (se->load.weight).
|
|
*
|
|
* In other words, if root_task_group has 10 tasks of weight
|
|
* 1024) and two child groups A0 and A1 (of weight 1024 each),
|
|
* then A0's share of the CPU resource is:
|
|
*
|
|
* A0's bandwidth = 1024 / (10*1024 + 1024 + 1024) = 8.33%
|
|
*
|
|
* We achieve this by letting root_task_group's tasks sit
|
|
* directly in rq->cfs (i.e root_task_group->se[] = NULL).
|
|
*/
|
|
init_tg_cfs_entry(&root_task_group, &rq->cfs, NULL, i, NULL);
|
|
#endif /* CONFIG_FAIR_GROUP_SCHED */
|
|
|
|
rq->rt.rt_runtime = def_rt_bandwidth.rt_runtime;
|
|
#ifdef CONFIG_RT_GROUP_SCHED
|
|
init_tg_rt_entry(&root_task_group, &rq->rt, NULL, i, NULL);
|
|
#endif
|
|
#ifdef CONFIG_SMP
|
|
rq->sd = NULL;
|
|
rq->rd = NULL;
|
|
rq->cpu_capacity = rq->cpu_capacity_orig = SCHED_CAPACITY_SCALE;
|
|
rq->balance_callback = NULL;
|
|
rq->active_balance = 0;
|
|
rq->next_balance = jiffies;
|
|
rq->push_cpu = 0;
|
|
rq->cpu = i;
|
|
rq->online = 0;
|
|
rq->idle_stamp = 0;
|
|
rq->avg_idle = 2*sysctl_sched_migration_cost;
|
|
rq->max_idle_balance_cost = sysctl_sched_migration_cost;
|
|
|
|
INIT_LIST_HEAD(&rq->cfs_tasks);
|
|
|
|
rq_attach_root(rq, &def_root_domain);
|
|
#ifdef CONFIG_NO_HZ_COMMON
|
|
rq->last_blocked_load_update_tick = jiffies;
|
|
atomic_set(&rq->nohz_flags, 0);
|
|
|
|
rq_csd_init(rq, &rq->nohz_csd, nohz_csd_func);
|
|
#endif
|
|
#endif /* CONFIG_SMP */
|
|
hrtick_rq_init(rq);
|
|
atomic_set(&rq->nr_iowait, 0);
|
|
}
|
|
|
|
set_load_weight(&init_task, false);
|
|
|
|
/*
|
|
* The boot idle thread does lazy MMU switching as well:
|
|
*/
|
|
mmgrab(&init_mm);
|
|
enter_lazy_tlb(&init_mm, current);
|
|
|
|
/*
|
|
* Make us the idle thread. Technically, schedule() should not be
|
|
* called from this thread, however somewhere below it might be,
|
|
* but because we are the idle thread, we just pick up running again
|
|
* when this runqueue becomes "idle".
|
|
*/
|
|
init_idle(current, smp_processor_id());
|
|
|
|
calc_load_update = jiffies + LOAD_FREQ;
|
|
|
|
#ifdef CONFIG_SMP
|
|
idle_thread_set_boot_cpu();
|
|
#endif
|
|
init_sched_fair_class();
|
|
|
|
init_schedstats();
|
|
|
|
psi_init();
|
|
|
|
init_uclamp();
|
|
|
|
scheduler_running = 1;
|
|
}
|
|
|
|
#ifdef CONFIG_DEBUG_ATOMIC_SLEEP
|
|
static inline int preempt_count_equals(int preempt_offset)
|
|
{
|
|
int nested = preempt_count() + rcu_preempt_depth();
|
|
|
|
return (nested == preempt_offset);
|
|
}
|
|
|
|
void __might_sleep(const char *file, int line, int preempt_offset)
|
|
{
|
|
/*
|
|
* Blocking primitives will set (and therefore destroy) current->state,
|
|
* since we will exit with TASK_RUNNING make sure we enter with it,
|
|
* otherwise we will destroy state.
|
|
*/
|
|
WARN_ONCE(current->state != TASK_RUNNING && current->task_state_change,
|
|
"do not call blocking ops when !TASK_RUNNING; "
|
|
"state=%lx set at [<%p>] %pS\n",
|
|
current->state,
|
|
(void *)current->task_state_change,
|
|
(void *)current->task_state_change);
|
|
|
|
___might_sleep(file, line, preempt_offset);
|
|
}
|
|
EXPORT_SYMBOL(__might_sleep);
|
|
|
|
void ___might_sleep(const char *file, int line, int preempt_offset)
|
|
{
|
|
/* Ratelimiting timestamp: */
|
|
static unsigned long prev_jiffy;
|
|
|
|
unsigned long preempt_disable_ip;
|
|
|
|
/* WARN_ON_ONCE() by default, no rate limit required: */
|
|
rcu_sleep_check();
|
|
|
|
if ((preempt_count_equals(preempt_offset) && !irqs_disabled() &&
|
|
!is_idle_task(current) && !current->non_block_count) ||
|
|
system_state == SYSTEM_BOOTING || system_state > SYSTEM_RUNNING ||
|
|
oops_in_progress)
|
|
return;
|
|
|
|
if (time_before(jiffies, prev_jiffy + HZ) && prev_jiffy)
|
|
return;
|
|
prev_jiffy = jiffies;
|
|
|
|
/* Save this before calling printk(), since that will clobber it: */
|
|
preempt_disable_ip = get_preempt_disable_ip(current);
|
|
|
|
printk(KERN_ERR
|
|
"BUG: sleeping function called from invalid context at %s:%d\n",
|
|
file, line);
|
|
printk(KERN_ERR
|
|
"in_atomic(): %d, irqs_disabled(): %d, non_block: %d, pid: %d, name: %s\n",
|
|
in_atomic(), irqs_disabled(), current->non_block_count,
|
|
current->pid, current->comm);
|
|
|
|
if (task_stack_end_corrupted(current))
|
|
printk(KERN_EMERG "Thread overran stack, or stack corrupted\n");
|
|
|
|
debug_show_held_locks(current);
|
|
if (irqs_disabled())
|
|
print_irqtrace_events(current);
|
|
if (IS_ENABLED(CONFIG_DEBUG_PREEMPT)
|
|
&& !preempt_count_equals(preempt_offset)) {
|
|
pr_err("Preemption disabled at:");
|
|
print_ip_sym(KERN_ERR, preempt_disable_ip);
|
|
}
|
|
|
|
trace_android_rvh_schedule_bug(NULL);
|
|
|
|
dump_stack();
|
|
add_taint(TAINT_WARN, LOCKDEP_STILL_OK);
|
|
}
|
|
EXPORT_SYMBOL(___might_sleep);
|
|
|
|
void __cant_sleep(const char *file, int line, int preempt_offset)
|
|
{
|
|
static unsigned long prev_jiffy;
|
|
|
|
if (irqs_disabled())
|
|
return;
|
|
|
|
if (!IS_ENABLED(CONFIG_PREEMPT_COUNT))
|
|
return;
|
|
|
|
if (preempt_count() > preempt_offset)
|
|
return;
|
|
|
|
if (time_before(jiffies, prev_jiffy + HZ) && prev_jiffy)
|
|
return;
|
|
prev_jiffy = jiffies;
|
|
|
|
printk(KERN_ERR "BUG: assuming atomic context at %s:%d\n", file, line);
|
|
printk(KERN_ERR "in_atomic(): %d, irqs_disabled(): %d, pid: %d, name: %s\n",
|
|
in_atomic(), irqs_disabled(),
|
|
current->pid, current->comm);
|
|
|
|
debug_show_held_locks(current);
|
|
dump_stack();
|
|
add_taint(TAINT_WARN, LOCKDEP_STILL_OK);
|
|
}
|
|
EXPORT_SYMBOL_GPL(__cant_sleep);
|
|
#endif
|
|
|
|
#ifdef CONFIG_MAGIC_SYSRQ
|
|
void normalize_rt_tasks(void)
|
|
{
|
|
struct task_struct *g, *p;
|
|
struct sched_attr attr = {
|
|
.sched_policy = SCHED_NORMAL,
|
|
};
|
|
|
|
read_lock(&tasklist_lock);
|
|
for_each_process_thread(g, p) {
|
|
/*
|
|
* Only normalize user tasks:
|
|
*/
|
|
if (p->flags & PF_KTHREAD)
|
|
continue;
|
|
|
|
p->se.exec_start = 0;
|
|
schedstat_set(p->se.statistics.wait_start, 0);
|
|
schedstat_set(p->se.statistics.sleep_start, 0);
|
|
schedstat_set(p->se.statistics.block_start, 0);
|
|
|
|
if (!dl_task(p) && !rt_task(p)) {
|
|
/*
|
|
* Renice negative nice level userspace
|
|
* tasks back to 0:
|
|
*/
|
|
if (task_nice(p) < 0)
|
|
set_user_nice(p, 0);
|
|
continue;
|
|
}
|
|
|
|
__sched_setscheduler(p, &attr, false, false);
|
|
}
|
|
read_unlock(&tasklist_lock);
|
|
}
|
|
|
|
#endif /* CONFIG_MAGIC_SYSRQ */
|
|
|
|
#if defined(CONFIG_IA64) || defined(CONFIG_KGDB_KDB)
|
|
/*
|
|
* These functions are only useful for the IA64 MCA handling, or kdb.
|
|
*
|
|
* They can only be called when the whole system has been
|
|
* stopped - every CPU needs to be quiescent, and no scheduling
|
|
* activity can take place. Using them for anything else would
|
|
* be a serious bug, and as a result, they aren't even visible
|
|
* under any other configuration.
|
|
*/
|
|
|
|
/**
|
|
* curr_task - return the current task for a given CPU.
|
|
* @cpu: the processor in question.
|
|
*
|
|
* ONLY VALID WHEN THE WHOLE SYSTEM IS STOPPED!
|
|
*
|
|
* Return: The current task for @cpu.
|
|
*/
|
|
struct task_struct *curr_task(int cpu)
|
|
{
|
|
return cpu_curr(cpu);
|
|
}
|
|
|
|
#endif /* defined(CONFIG_IA64) || defined(CONFIG_KGDB_KDB) */
|
|
|
|
#ifdef CONFIG_IA64
|
|
/**
|
|
* ia64_set_curr_task - set the current task for a given CPU.
|
|
* @cpu: the processor in question.
|
|
* @p: the task pointer to set.
|
|
*
|
|
* Description: This function must only be used when non-maskable interrupts
|
|
* are serviced on a separate stack. It allows the architecture to switch the
|
|
* notion of the current task on a CPU in a non-blocking manner. This function
|
|
* must be called with all CPU's synchronized, and interrupts disabled, the
|
|
* and caller must save the original value of the current task (see
|
|
* curr_task() above) and restore that value before reenabling interrupts and
|
|
* re-starting the system.
|
|
*
|
|
* ONLY VALID WHEN THE WHOLE SYSTEM IS STOPPED!
|
|
*/
|
|
void ia64_set_curr_task(int cpu, struct task_struct *p)
|
|
{
|
|
cpu_curr(cpu) = p;
|
|
}
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_CGROUP_SCHED
|
|
/* task_group_lock serializes the addition/removal of task groups */
|
|
static DEFINE_SPINLOCK(task_group_lock);
|
|
|
|
static inline void alloc_uclamp_sched_group(struct task_group *tg,
|
|
struct task_group *parent)
|
|
{
|
|
#ifdef CONFIG_UCLAMP_TASK_GROUP
|
|
enum uclamp_id clamp_id;
|
|
|
|
for_each_clamp_id(clamp_id) {
|
|
uclamp_se_set(&tg->uclamp_req[clamp_id],
|
|
uclamp_none(clamp_id), false);
|
|
tg->uclamp[clamp_id] = parent->uclamp[clamp_id];
|
|
}
|
|
#endif
|
|
}
|
|
|
|
static void sched_free_group(struct task_group *tg)
|
|
{
|
|
free_fair_sched_group(tg);
|
|
free_rt_sched_group(tg);
|
|
autogroup_free(tg);
|
|
kmem_cache_free(task_group_cache, tg);
|
|
}
|
|
|
|
/* allocate runqueue etc for a new task group */
|
|
struct task_group *sched_create_group(struct task_group *parent)
|
|
{
|
|
struct task_group *tg;
|
|
|
|
tg = kmem_cache_alloc(task_group_cache, GFP_KERNEL | __GFP_ZERO);
|
|
if (!tg)
|
|
return ERR_PTR(-ENOMEM);
|
|
|
|
if (!alloc_fair_sched_group(tg, parent))
|
|
goto err;
|
|
|
|
if (!alloc_rt_sched_group(tg, parent))
|
|
goto err;
|
|
|
|
alloc_uclamp_sched_group(tg, parent);
|
|
|
|
return tg;
|
|
|
|
err:
|
|
sched_free_group(tg);
|
|
return ERR_PTR(-ENOMEM);
|
|
}
|
|
|
|
void sched_online_group(struct task_group *tg, struct task_group *parent)
|
|
{
|
|
unsigned long flags;
|
|
|
|
spin_lock_irqsave(&task_group_lock, flags);
|
|
list_add_rcu(&tg->list, &task_groups);
|
|
|
|
/* Root should already exist: */
|
|
WARN_ON(!parent);
|
|
|
|
tg->parent = parent;
|
|
INIT_LIST_HEAD(&tg->children);
|
|
list_add_rcu(&tg->siblings, &parent->children);
|
|
spin_unlock_irqrestore(&task_group_lock, flags);
|
|
|
|
online_fair_sched_group(tg);
|
|
}
|
|
|
|
/* rcu callback to free various structures associated with a task group */
|
|
static void sched_free_group_rcu(struct rcu_head *rhp)
|
|
{
|
|
/* Now it should be safe to free those cfs_rqs: */
|
|
sched_free_group(container_of(rhp, struct task_group, rcu));
|
|
}
|
|
|
|
void sched_destroy_group(struct task_group *tg)
|
|
{
|
|
/* Wait for possible concurrent references to cfs_rqs complete: */
|
|
call_rcu(&tg->rcu, sched_free_group_rcu);
|
|
}
|
|
|
|
void sched_offline_group(struct task_group *tg)
|
|
{
|
|
unsigned long flags;
|
|
|
|
/* End participation in shares distribution: */
|
|
unregister_fair_sched_group(tg);
|
|
|
|
spin_lock_irqsave(&task_group_lock, flags);
|
|
list_del_rcu(&tg->list);
|
|
list_del_rcu(&tg->siblings);
|
|
spin_unlock_irqrestore(&task_group_lock, flags);
|
|
}
|
|
|
|
static void sched_change_group(struct task_struct *tsk, int type)
|
|
{
|
|
struct task_group *tg;
|
|
|
|
/*
|
|
* All callers are synchronized by task_rq_lock(); we do not use RCU
|
|
* which is pointless here. Thus, we pass "true" to task_css_check()
|
|
* to prevent lockdep warnings.
|
|
*/
|
|
tg = container_of(task_css_check(tsk, cpu_cgrp_id, true),
|
|
struct task_group, css);
|
|
tg = autogroup_task_group(tsk, tg);
|
|
tsk->sched_task_group = tg;
|
|
|
|
#ifdef CONFIG_FAIR_GROUP_SCHED
|
|
if (tsk->sched_class->task_change_group)
|
|
tsk->sched_class->task_change_group(tsk, type);
|
|
else
|
|
#endif
|
|
set_task_rq(tsk, task_cpu(tsk));
|
|
}
|
|
|
|
/*
|
|
* Change task's runqueue when it moves between groups.
|
|
*
|
|
* The caller of this function should have put the task in its new group by
|
|
* now. This function just updates tsk->se.cfs_rq and tsk->se.parent to reflect
|
|
* its new group.
|
|
*/
|
|
void sched_move_task(struct task_struct *tsk)
|
|
{
|
|
int queued, running, queue_flags =
|
|
DEQUEUE_SAVE | DEQUEUE_MOVE | DEQUEUE_NOCLOCK;
|
|
struct rq_flags rf;
|
|
struct rq *rq;
|
|
|
|
rq = task_rq_lock(tsk, &rf);
|
|
update_rq_clock(rq);
|
|
|
|
running = task_current(rq, tsk);
|
|
queued = task_on_rq_queued(tsk);
|
|
|
|
if (queued)
|
|
dequeue_task(rq, tsk, queue_flags);
|
|
if (running)
|
|
put_prev_task(rq, tsk);
|
|
|
|
sched_change_group(tsk, TASK_MOVE_GROUP);
|
|
|
|
if (queued)
|
|
enqueue_task(rq, tsk, queue_flags);
|
|
if (running) {
|
|
set_next_task(rq, tsk);
|
|
/*
|
|
* After changing group, the running task may have joined a
|
|
* throttled one but it's still the running task. Trigger a
|
|
* resched to make sure that task can still run.
|
|
*/
|
|
resched_curr(rq);
|
|
}
|
|
|
|
task_rq_unlock(rq, tsk, &rf);
|
|
}
|
|
|
|
static inline struct task_group *css_tg(struct cgroup_subsys_state *css)
|
|
{
|
|
return css ? container_of(css, struct task_group, css) : NULL;
|
|
}
|
|
|
|
static struct cgroup_subsys_state *
|
|
cpu_cgroup_css_alloc(struct cgroup_subsys_state *parent_css)
|
|
{
|
|
struct task_group *parent = css_tg(parent_css);
|
|
struct task_group *tg;
|
|
|
|
if (!parent) {
|
|
/* This is early initialization for the top cgroup */
|
|
return &root_task_group.css;
|
|
}
|
|
|
|
tg = sched_create_group(parent);
|
|
if (IS_ERR(tg))
|
|
return ERR_PTR(-ENOMEM);
|
|
|
|
return &tg->css;
|
|
}
|
|
|
|
/* Expose task group only after completing cgroup initialization */
|
|
static int cpu_cgroup_css_online(struct cgroup_subsys_state *css)
|
|
{
|
|
struct task_group *tg = css_tg(css);
|
|
struct task_group *parent = css_tg(css->parent);
|
|
|
|
if (parent)
|
|
sched_online_group(tg, parent);
|
|
|
|
#ifdef CONFIG_UCLAMP_TASK_GROUP
|
|
/* Propagate the effective uclamp value for the new group */
|
|
mutex_lock(&uclamp_mutex);
|
|
rcu_read_lock();
|
|
cpu_util_update_eff(css);
|
|
rcu_read_unlock();
|
|
mutex_unlock(&uclamp_mutex);
|
|
#endif
|
|
|
|
trace_android_rvh_cpu_cgroup_online(css);
|
|
return 0;
|
|
}
|
|
|
|
static void cpu_cgroup_css_released(struct cgroup_subsys_state *css)
|
|
{
|
|
struct task_group *tg = css_tg(css);
|
|
|
|
sched_offline_group(tg);
|
|
}
|
|
|
|
static void cpu_cgroup_css_free(struct cgroup_subsys_state *css)
|
|
{
|
|
struct task_group *tg = css_tg(css);
|
|
|
|
/*
|
|
* Relies on the RCU grace period between css_released() and this.
|
|
*/
|
|
sched_free_group(tg);
|
|
}
|
|
|
|
/*
|
|
* This is called before wake_up_new_task(), therefore we really only
|
|
* have to set its group bits, all the other stuff does not apply.
|
|
*/
|
|
static void cpu_cgroup_fork(struct task_struct *task)
|
|
{
|
|
struct rq_flags rf;
|
|
struct rq *rq;
|
|
|
|
rq = task_rq_lock(task, &rf);
|
|
|
|
update_rq_clock(rq);
|
|
sched_change_group(task, TASK_SET_GROUP);
|
|
|
|
task_rq_unlock(rq, task, &rf);
|
|
}
|
|
|
|
static int cpu_cgroup_can_attach(struct cgroup_taskset *tset)
|
|
{
|
|
struct task_struct *task;
|
|
struct cgroup_subsys_state *css;
|
|
int ret = 0;
|
|
|
|
cgroup_taskset_for_each(task, css, tset) {
|
|
#ifdef CONFIG_RT_GROUP_SCHED
|
|
if (!sched_rt_can_attach(css_tg(css), task))
|
|
return -EINVAL;
|
|
#endif
|
|
/*
|
|
* Serialize against wake_up_new_task() such that if its
|
|
* running, we're sure to observe its full state.
|
|
*/
|
|
raw_spin_lock_irq(&task->pi_lock);
|
|
/*
|
|
* Avoid calling sched_move_task() before wake_up_new_task()
|
|
* has happened. This would lead to problems with PELT, due to
|
|
* move wanting to detach+attach while we're not attached yet.
|
|
*/
|
|
if (task->state == TASK_NEW)
|
|
ret = -EINVAL;
|
|
raw_spin_unlock_irq(&task->pi_lock);
|
|
|
|
if (ret)
|
|
break;
|
|
}
|
|
|
|
trace_android_rvh_cpu_cgroup_can_attach(tset, &ret);
|
|
|
|
return ret;
|
|
}
|
|
|
|
static void cpu_cgroup_attach(struct cgroup_taskset *tset)
|
|
{
|
|
struct task_struct *task;
|
|
struct cgroup_subsys_state *css;
|
|
|
|
cgroup_taskset_for_each(task, css, tset)
|
|
sched_move_task(task);
|
|
|
|
trace_android_rvh_cpu_cgroup_attach(tset);
|
|
}
|
|
|
|
#ifdef CONFIG_UCLAMP_TASK_GROUP
|
|
static void cpu_util_update_eff(struct cgroup_subsys_state *css)
|
|
{
|
|
struct cgroup_subsys_state *top_css = css;
|
|
struct uclamp_se *uc_parent = NULL;
|
|
struct uclamp_se *uc_se = NULL;
|
|
unsigned int eff[UCLAMP_CNT];
|
|
enum uclamp_id clamp_id;
|
|
unsigned int clamps;
|
|
|
|
lockdep_assert_held(&uclamp_mutex);
|
|
SCHED_WARN_ON(!rcu_read_lock_held());
|
|
|
|
css_for_each_descendant_pre(css, top_css) {
|
|
uc_parent = css_tg(css)->parent
|
|
? css_tg(css)->parent->uclamp : NULL;
|
|
|
|
for_each_clamp_id(clamp_id) {
|
|
/* Assume effective clamps matches requested clamps */
|
|
eff[clamp_id] = css_tg(css)->uclamp_req[clamp_id].value;
|
|
/* Cap effective clamps with parent's effective clamps */
|
|
if (uc_parent &&
|
|
eff[clamp_id] > uc_parent[clamp_id].value) {
|
|
eff[clamp_id] = uc_parent[clamp_id].value;
|
|
}
|
|
}
|
|
/* Ensure protection is always capped by limit */
|
|
eff[UCLAMP_MIN] = min(eff[UCLAMP_MIN], eff[UCLAMP_MAX]);
|
|
|
|
/* Propagate most restrictive effective clamps */
|
|
clamps = 0x0;
|
|
uc_se = css_tg(css)->uclamp;
|
|
for_each_clamp_id(clamp_id) {
|
|
if (eff[clamp_id] == uc_se[clamp_id].value)
|
|
continue;
|
|
uc_se[clamp_id].value = eff[clamp_id];
|
|
uc_se[clamp_id].bucket_id = uclamp_bucket_id(eff[clamp_id]);
|
|
clamps |= (0x1 << clamp_id);
|
|
}
|
|
if (!clamps) {
|
|
css = css_rightmost_descendant(css);
|
|
continue;
|
|
}
|
|
|
|
/* Immediately update descendants RUNNABLE tasks */
|
|
uclamp_update_active_tasks(css);
|
|
}
|
|
}
|
|
|
|
/*
|
|
* Integer 10^N with a given N exponent by casting to integer the literal "1eN"
|
|
* C expression. Since there is no way to convert a macro argument (N) into a
|
|
* character constant, use two levels of macros.
|
|
*/
|
|
#define _POW10(exp) ((unsigned int)1e##exp)
|
|
#define POW10(exp) _POW10(exp)
|
|
|
|
struct uclamp_request {
|
|
#define UCLAMP_PERCENT_SHIFT 2
|
|
#define UCLAMP_PERCENT_SCALE (100 * POW10(UCLAMP_PERCENT_SHIFT))
|
|
s64 percent;
|
|
u64 util;
|
|
int ret;
|
|
};
|
|
|
|
static inline struct uclamp_request
|
|
capacity_from_percent(char *buf)
|
|
{
|
|
struct uclamp_request req = {
|
|
.percent = UCLAMP_PERCENT_SCALE,
|
|
.util = SCHED_CAPACITY_SCALE,
|
|
.ret = 0,
|
|
};
|
|
|
|
buf = strim(buf);
|
|
if (strcmp(buf, "max")) {
|
|
req.ret = cgroup_parse_float(buf, UCLAMP_PERCENT_SHIFT,
|
|
&req.percent);
|
|
if (req.ret)
|
|
return req;
|
|
if ((u64)req.percent > UCLAMP_PERCENT_SCALE) {
|
|
req.ret = -ERANGE;
|
|
return req;
|
|
}
|
|
|
|
req.util = req.percent << SCHED_CAPACITY_SHIFT;
|
|
req.util = DIV_ROUND_CLOSEST_ULL(req.util, UCLAMP_PERCENT_SCALE);
|
|
}
|
|
|
|
return req;
|
|
}
|
|
|
|
static ssize_t cpu_uclamp_write(struct kernfs_open_file *of, char *buf,
|
|
size_t nbytes, loff_t off,
|
|
enum uclamp_id clamp_id)
|
|
{
|
|
struct uclamp_request req;
|
|
struct task_group *tg;
|
|
|
|
req = capacity_from_percent(buf);
|
|
if (req.ret)
|
|
return req.ret;
|
|
|
|
static_branch_enable(&sched_uclamp_used);
|
|
|
|
mutex_lock(&uclamp_mutex);
|
|
rcu_read_lock();
|
|
|
|
tg = css_tg(of_css(of));
|
|
if (tg->uclamp_req[clamp_id].value != req.util)
|
|
uclamp_se_set(&tg->uclamp_req[clamp_id], req.util, false);
|
|
|
|
/*
|
|
* Because of not recoverable conversion rounding we keep track of the
|
|
* exact requested value
|
|
*/
|
|
tg->uclamp_pct[clamp_id] = req.percent;
|
|
|
|
/* Update effective clamps to track the most restrictive value */
|
|
cpu_util_update_eff(of_css(of));
|
|
|
|
rcu_read_unlock();
|
|
mutex_unlock(&uclamp_mutex);
|
|
|
|
return nbytes;
|
|
}
|
|
|
|
static ssize_t cpu_uclamp_min_write(struct kernfs_open_file *of,
|
|
char *buf, size_t nbytes,
|
|
loff_t off)
|
|
{
|
|
return cpu_uclamp_write(of, buf, nbytes, off, UCLAMP_MIN);
|
|
}
|
|
|
|
static ssize_t cpu_uclamp_max_write(struct kernfs_open_file *of,
|
|
char *buf, size_t nbytes,
|
|
loff_t off)
|
|
{
|
|
return cpu_uclamp_write(of, buf, nbytes, off, UCLAMP_MAX);
|
|
}
|
|
|
|
static inline void cpu_uclamp_print(struct seq_file *sf,
|
|
enum uclamp_id clamp_id)
|
|
{
|
|
struct task_group *tg;
|
|
u64 util_clamp;
|
|
u64 percent;
|
|
u32 rem;
|
|
|
|
rcu_read_lock();
|
|
tg = css_tg(seq_css(sf));
|
|
util_clamp = tg->uclamp_req[clamp_id].value;
|
|
rcu_read_unlock();
|
|
|
|
if (util_clamp == SCHED_CAPACITY_SCALE) {
|
|
seq_puts(sf, "max\n");
|
|
return;
|
|
}
|
|
|
|
percent = tg->uclamp_pct[clamp_id];
|
|
percent = div_u64_rem(percent, POW10(UCLAMP_PERCENT_SHIFT), &rem);
|
|
seq_printf(sf, "%llu.%0*u\n", percent, UCLAMP_PERCENT_SHIFT, rem);
|
|
}
|
|
|
|
static int cpu_uclamp_min_show(struct seq_file *sf, void *v)
|
|
{
|
|
cpu_uclamp_print(sf, UCLAMP_MIN);
|
|
return 0;
|
|
}
|
|
|
|
static int cpu_uclamp_max_show(struct seq_file *sf, void *v)
|
|
{
|
|
cpu_uclamp_print(sf, UCLAMP_MAX);
|
|
return 0;
|
|
}
|
|
|
|
static int cpu_uclamp_ls_write_u64(struct cgroup_subsys_state *css,
|
|
struct cftype *cftype, u64 ls)
|
|
{
|
|
struct task_group *tg;
|
|
|
|
if (ls > 1)
|
|
return -EINVAL;
|
|
tg = css_tg(css);
|
|
tg->latency_sensitive = (unsigned int) ls;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static u64 cpu_uclamp_ls_read_u64(struct cgroup_subsys_state *css,
|
|
struct cftype *cft)
|
|
{
|
|
struct task_group *tg = css_tg(css);
|
|
|
|
return (u64) tg->latency_sensitive;
|
|
}
|
|
#endif /* CONFIG_UCLAMP_TASK_GROUP */
|
|
|
|
#ifdef CONFIG_FAIR_GROUP_SCHED
|
|
static int cpu_shares_write_u64(struct cgroup_subsys_state *css,
|
|
struct cftype *cftype, u64 shareval)
|
|
{
|
|
if (shareval > scale_load_down(ULONG_MAX))
|
|
shareval = MAX_SHARES;
|
|
return sched_group_set_shares(css_tg(css), scale_load(shareval));
|
|
}
|
|
|
|
static u64 cpu_shares_read_u64(struct cgroup_subsys_state *css,
|
|
struct cftype *cft)
|
|
{
|
|
struct task_group *tg = css_tg(css);
|
|
|
|
return (u64) scale_load_down(tg->shares);
|
|
}
|
|
|
|
#ifdef CONFIG_CFS_BANDWIDTH
|
|
static DEFINE_MUTEX(cfs_constraints_mutex);
|
|
|
|
const u64 max_cfs_quota_period = 1 * NSEC_PER_SEC; /* 1s */
|
|
static const u64 min_cfs_quota_period = 1 * NSEC_PER_MSEC; /* 1ms */
|
|
/* More than 203 days if BW_SHIFT equals 20. */
|
|
static const u64 max_cfs_runtime = MAX_BW * NSEC_PER_USEC;
|
|
|
|
static int __cfs_schedulable(struct task_group *tg, u64 period, u64 runtime);
|
|
|
|
static int tg_set_cfs_bandwidth(struct task_group *tg, u64 period, u64 quota)
|
|
{
|
|
int i, ret = 0, runtime_enabled, runtime_was_enabled;
|
|
struct cfs_bandwidth *cfs_b = &tg->cfs_bandwidth;
|
|
|
|
if (tg == &root_task_group)
|
|
return -EINVAL;
|
|
|
|
/*
|
|
* Ensure we have at some amount of bandwidth every period. This is
|
|
* to prevent reaching a state of large arrears when throttled via
|
|
* entity_tick() resulting in prolonged exit starvation.
|
|
*/
|
|
if (quota < min_cfs_quota_period || period < min_cfs_quota_period)
|
|
return -EINVAL;
|
|
|
|
/*
|
|
* Likewise, bound things on the otherside by preventing insane quota
|
|
* periods. This also allows us to normalize in computing quota
|
|
* feasibility.
|
|
*/
|
|
if (period > max_cfs_quota_period)
|
|
return -EINVAL;
|
|
|
|
/*
|
|
* Bound quota to defend quota against overflow during bandwidth shift.
|
|
*/
|
|
if (quota != RUNTIME_INF && quota > max_cfs_runtime)
|
|
return -EINVAL;
|
|
|
|
/*
|
|
* Prevent race between setting of cfs_rq->runtime_enabled and
|
|
* unthrottle_offline_cfs_rqs().
|
|
*/
|
|
get_online_cpus();
|
|
mutex_lock(&cfs_constraints_mutex);
|
|
ret = __cfs_schedulable(tg, period, quota);
|
|
if (ret)
|
|
goto out_unlock;
|
|
|
|
runtime_enabled = quota != RUNTIME_INF;
|
|
runtime_was_enabled = cfs_b->quota != RUNTIME_INF;
|
|
/*
|
|
* If we need to toggle cfs_bandwidth_used, off->on must occur
|
|
* before making related changes, and on->off must occur afterwards
|
|
*/
|
|
if (runtime_enabled && !runtime_was_enabled)
|
|
cfs_bandwidth_usage_inc();
|
|
raw_spin_lock_irq(&cfs_b->lock);
|
|
cfs_b->period = ns_to_ktime(period);
|
|
cfs_b->quota = quota;
|
|
|
|
__refill_cfs_bandwidth_runtime(cfs_b);
|
|
|
|
/* Restart the period timer (if active) to handle new period expiry: */
|
|
if (runtime_enabled)
|
|
start_cfs_bandwidth(cfs_b);
|
|
|
|
raw_spin_unlock_irq(&cfs_b->lock);
|
|
|
|
for_each_online_cpu(i) {
|
|
struct cfs_rq *cfs_rq = tg->cfs_rq[i];
|
|
struct rq *rq = cfs_rq->rq;
|
|
struct rq_flags rf;
|
|
|
|
rq_lock_irq(rq, &rf);
|
|
cfs_rq->runtime_enabled = runtime_enabled;
|
|
cfs_rq->runtime_remaining = 0;
|
|
|
|
if (cfs_rq->throttled)
|
|
unthrottle_cfs_rq(cfs_rq);
|
|
rq_unlock_irq(rq, &rf);
|
|
}
|
|
if (runtime_was_enabled && !runtime_enabled)
|
|
cfs_bandwidth_usage_dec();
|
|
out_unlock:
|
|
mutex_unlock(&cfs_constraints_mutex);
|
|
put_online_cpus();
|
|
|
|
return ret;
|
|
}
|
|
|
|
static int tg_set_cfs_quota(struct task_group *tg, long cfs_quota_us)
|
|
{
|
|
u64 quota, period;
|
|
|
|
period = ktime_to_ns(tg->cfs_bandwidth.period);
|
|
if (cfs_quota_us < 0)
|
|
quota = RUNTIME_INF;
|
|
else if ((u64)cfs_quota_us <= U64_MAX / NSEC_PER_USEC)
|
|
quota = (u64)cfs_quota_us * NSEC_PER_USEC;
|
|
else
|
|
return -EINVAL;
|
|
|
|
return tg_set_cfs_bandwidth(tg, period, quota);
|
|
}
|
|
|
|
static long tg_get_cfs_quota(struct task_group *tg)
|
|
{
|
|
u64 quota_us;
|
|
|
|
if (tg->cfs_bandwidth.quota == RUNTIME_INF)
|
|
return -1;
|
|
|
|
quota_us = tg->cfs_bandwidth.quota;
|
|
do_div(quota_us, NSEC_PER_USEC);
|
|
|
|
return quota_us;
|
|
}
|
|
|
|
static int tg_set_cfs_period(struct task_group *tg, long cfs_period_us)
|
|
{
|
|
u64 quota, period;
|
|
|
|
if ((u64)cfs_period_us > U64_MAX / NSEC_PER_USEC)
|
|
return -EINVAL;
|
|
|
|
period = (u64)cfs_period_us * NSEC_PER_USEC;
|
|
quota = tg->cfs_bandwidth.quota;
|
|
|
|
return tg_set_cfs_bandwidth(tg, period, quota);
|
|
}
|
|
|
|
static long tg_get_cfs_period(struct task_group *tg)
|
|
{
|
|
u64 cfs_period_us;
|
|
|
|
cfs_period_us = ktime_to_ns(tg->cfs_bandwidth.period);
|
|
do_div(cfs_period_us, NSEC_PER_USEC);
|
|
|
|
return cfs_period_us;
|
|
}
|
|
|
|
static s64 cpu_cfs_quota_read_s64(struct cgroup_subsys_state *css,
|
|
struct cftype *cft)
|
|
{
|
|
return tg_get_cfs_quota(css_tg(css));
|
|
}
|
|
|
|
static int cpu_cfs_quota_write_s64(struct cgroup_subsys_state *css,
|
|
struct cftype *cftype, s64 cfs_quota_us)
|
|
{
|
|
return tg_set_cfs_quota(css_tg(css), cfs_quota_us);
|
|
}
|
|
|
|
static u64 cpu_cfs_period_read_u64(struct cgroup_subsys_state *css,
|
|
struct cftype *cft)
|
|
{
|
|
return tg_get_cfs_period(css_tg(css));
|
|
}
|
|
|
|
static int cpu_cfs_period_write_u64(struct cgroup_subsys_state *css,
|
|
struct cftype *cftype, u64 cfs_period_us)
|
|
{
|
|
return tg_set_cfs_period(css_tg(css), cfs_period_us);
|
|
}
|
|
|
|
struct cfs_schedulable_data {
|
|
struct task_group *tg;
|
|
u64 period, quota;
|
|
};
|
|
|
|
/*
|
|
* normalize group quota/period to be quota/max_period
|
|
* note: units are usecs
|
|
*/
|
|
static u64 normalize_cfs_quota(struct task_group *tg,
|
|
struct cfs_schedulable_data *d)
|
|
{
|
|
u64 quota, period;
|
|
|
|
if (tg == d->tg) {
|
|
period = d->period;
|
|
quota = d->quota;
|
|
} else {
|
|
period = tg_get_cfs_period(tg);
|
|
quota = tg_get_cfs_quota(tg);
|
|
}
|
|
|
|
/* note: these should typically be equivalent */
|
|
if (quota == RUNTIME_INF || quota == -1)
|
|
return RUNTIME_INF;
|
|
|
|
return to_ratio(period, quota);
|
|
}
|
|
|
|
static int tg_cfs_schedulable_down(struct task_group *tg, void *data)
|
|
{
|
|
struct cfs_schedulable_data *d = data;
|
|
struct cfs_bandwidth *cfs_b = &tg->cfs_bandwidth;
|
|
s64 quota = 0, parent_quota = -1;
|
|
|
|
if (!tg->parent) {
|
|
quota = RUNTIME_INF;
|
|
} else {
|
|
struct cfs_bandwidth *parent_b = &tg->parent->cfs_bandwidth;
|
|
|
|
quota = normalize_cfs_quota(tg, d);
|
|
parent_quota = parent_b->hierarchical_quota;
|
|
|
|
/*
|
|
* Ensure max(child_quota) <= parent_quota. On cgroup2,
|
|
* always take the min. On cgroup1, only inherit when no
|
|
* limit is set:
|
|
*/
|
|
if (cgroup_subsys_on_dfl(cpu_cgrp_subsys)) {
|
|
quota = min(quota, parent_quota);
|
|
} else {
|
|
if (quota == RUNTIME_INF)
|
|
quota = parent_quota;
|
|
else if (parent_quota != RUNTIME_INF && quota > parent_quota)
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
cfs_b->hierarchical_quota = quota;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int __cfs_schedulable(struct task_group *tg, u64 period, u64 quota)
|
|
{
|
|
int ret;
|
|
struct cfs_schedulable_data data = {
|
|
.tg = tg,
|
|
.period = period,
|
|
.quota = quota,
|
|
};
|
|
|
|
if (quota != RUNTIME_INF) {
|
|
do_div(data.period, NSEC_PER_USEC);
|
|
do_div(data.quota, NSEC_PER_USEC);
|
|
}
|
|
|
|
rcu_read_lock();
|
|
ret = walk_tg_tree(tg_cfs_schedulable_down, tg_nop, &data);
|
|
rcu_read_unlock();
|
|
|
|
return ret;
|
|
}
|
|
|
|
static int cpu_cfs_stat_show(struct seq_file *sf, void *v)
|
|
{
|
|
struct task_group *tg = css_tg(seq_css(sf));
|
|
struct cfs_bandwidth *cfs_b = &tg->cfs_bandwidth;
|
|
|
|
seq_printf(sf, "nr_periods %d\n", cfs_b->nr_periods);
|
|
seq_printf(sf, "nr_throttled %d\n", cfs_b->nr_throttled);
|
|
seq_printf(sf, "throttled_time %llu\n", cfs_b->throttled_time);
|
|
|
|
if (schedstat_enabled() && tg != &root_task_group) {
|
|
u64 ws = 0;
|
|
int i;
|
|
|
|
for_each_possible_cpu(i)
|
|
ws += schedstat_val(tg->se[i]->statistics.wait_sum);
|
|
|
|
seq_printf(sf, "wait_sum %llu\n", ws);
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
#endif /* CONFIG_CFS_BANDWIDTH */
|
|
#endif /* CONFIG_FAIR_GROUP_SCHED */
|
|
|
|
#ifdef CONFIG_RT_GROUP_SCHED
|
|
static int cpu_rt_runtime_write(struct cgroup_subsys_state *css,
|
|
struct cftype *cft, s64 val)
|
|
{
|
|
return sched_group_set_rt_runtime(css_tg(css), val);
|
|
}
|
|
|
|
static s64 cpu_rt_runtime_read(struct cgroup_subsys_state *css,
|
|
struct cftype *cft)
|
|
{
|
|
return sched_group_rt_runtime(css_tg(css));
|
|
}
|
|
|
|
static int cpu_rt_period_write_uint(struct cgroup_subsys_state *css,
|
|
struct cftype *cftype, u64 rt_period_us)
|
|
{
|
|
return sched_group_set_rt_period(css_tg(css), rt_period_us);
|
|
}
|
|
|
|
static u64 cpu_rt_period_read_uint(struct cgroup_subsys_state *css,
|
|
struct cftype *cft)
|
|
{
|
|
return sched_group_rt_period(css_tg(css));
|
|
}
|
|
#endif /* CONFIG_RT_GROUP_SCHED */
|
|
|
|
static struct cftype cpu_legacy_files[] = {
|
|
#ifdef CONFIG_FAIR_GROUP_SCHED
|
|
{
|
|
.name = "shares",
|
|
.read_u64 = cpu_shares_read_u64,
|
|
.write_u64 = cpu_shares_write_u64,
|
|
},
|
|
#endif
|
|
#ifdef CONFIG_CFS_BANDWIDTH
|
|
{
|
|
.name = "cfs_quota_us",
|
|
.read_s64 = cpu_cfs_quota_read_s64,
|
|
.write_s64 = cpu_cfs_quota_write_s64,
|
|
},
|
|
{
|
|
.name = "cfs_period_us",
|
|
.read_u64 = cpu_cfs_period_read_u64,
|
|
.write_u64 = cpu_cfs_period_write_u64,
|
|
},
|
|
{
|
|
.name = "stat",
|
|
.seq_show = cpu_cfs_stat_show,
|
|
},
|
|
#endif
|
|
#ifdef CONFIG_RT_GROUP_SCHED
|
|
{
|
|
.name = "rt_runtime_us",
|
|
.read_s64 = cpu_rt_runtime_read,
|
|
.write_s64 = cpu_rt_runtime_write,
|
|
},
|
|
{
|
|
.name = "rt_period_us",
|
|
.read_u64 = cpu_rt_period_read_uint,
|
|
.write_u64 = cpu_rt_period_write_uint,
|
|
},
|
|
#endif
|
|
#ifdef CONFIG_UCLAMP_TASK_GROUP
|
|
{
|
|
.name = "uclamp.min",
|
|
.flags = CFTYPE_NOT_ON_ROOT,
|
|
.seq_show = cpu_uclamp_min_show,
|
|
.write = cpu_uclamp_min_write,
|
|
},
|
|
{
|
|
.name = "uclamp.max",
|
|
.flags = CFTYPE_NOT_ON_ROOT,
|
|
.seq_show = cpu_uclamp_max_show,
|
|
.write = cpu_uclamp_max_write,
|
|
},
|
|
{
|
|
.name = "uclamp.latency_sensitive",
|
|
.flags = CFTYPE_NOT_ON_ROOT,
|
|
.read_u64 = cpu_uclamp_ls_read_u64,
|
|
.write_u64 = cpu_uclamp_ls_write_u64,
|
|
},
|
|
#endif
|
|
{ } /* Terminate */
|
|
};
|
|
|
|
static int cpu_extra_stat_show(struct seq_file *sf,
|
|
struct cgroup_subsys_state *css)
|
|
{
|
|
#ifdef CONFIG_CFS_BANDWIDTH
|
|
{
|
|
struct task_group *tg = css_tg(css);
|
|
struct cfs_bandwidth *cfs_b = &tg->cfs_bandwidth;
|
|
u64 throttled_usec;
|
|
|
|
throttled_usec = cfs_b->throttled_time;
|
|
do_div(throttled_usec, NSEC_PER_USEC);
|
|
|
|
seq_printf(sf, "nr_periods %d\n"
|
|
"nr_throttled %d\n"
|
|
"throttled_usec %llu\n",
|
|
cfs_b->nr_periods, cfs_b->nr_throttled,
|
|
throttled_usec);
|
|
}
|
|
#endif
|
|
return 0;
|
|
}
|
|
|
|
#ifdef CONFIG_FAIR_GROUP_SCHED
|
|
static u64 cpu_weight_read_u64(struct cgroup_subsys_state *css,
|
|
struct cftype *cft)
|
|
{
|
|
struct task_group *tg = css_tg(css);
|
|
u64 weight = scale_load_down(tg->shares);
|
|
|
|
return DIV_ROUND_CLOSEST_ULL(weight * CGROUP_WEIGHT_DFL, 1024);
|
|
}
|
|
|
|
static int cpu_weight_write_u64(struct cgroup_subsys_state *css,
|
|
struct cftype *cft, u64 weight)
|
|
{
|
|
/*
|
|
* cgroup weight knobs should use the common MIN, DFL and MAX
|
|
* values which are 1, 100 and 10000 respectively. While it loses
|
|
* a bit of range on both ends, it maps pretty well onto the shares
|
|
* value used by scheduler and the round-trip conversions preserve
|
|
* the original value over the entire range.
|
|
*/
|
|
if (weight < CGROUP_WEIGHT_MIN || weight > CGROUP_WEIGHT_MAX)
|
|
return -ERANGE;
|
|
|
|
weight = DIV_ROUND_CLOSEST_ULL(weight * 1024, CGROUP_WEIGHT_DFL);
|
|
|
|
return sched_group_set_shares(css_tg(css), scale_load(weight));
|
|
}
|
|
|
|
static s64 cpu_weight_nice_read_s64(struct cgroup_subsys_state *css,
|
|
struct cftype *cft)
|
|
{
|
|
unsigned long weight = scale_load_down(css_tg(css)->shares);
|
|
int last_delta = INT_MAX;
|
|
int prio, delta;
|
|
|
|
/* find the closest nice value to the current weight */
|
|
for (prio = 0; prio < ARRAY_SIZE(sched_prio_to_weight); prio++) {
|
|
delta = abs(sched_prio_to_weight[prio] - weight);
|
|
if (delta >= last_delta)
|
|
break;
|
|
last_delta = delta;
|
|
}
|
|
|
|
return PRIO_TO_NICE(prio - 1 + MAX_RT_PRIO);
|
|
}
|
|
|
|
static int cpu_weight_nice_write_s64(struct cgroup_subsys_state *css,
|
|
struct cftype *cft, s64 nice)
|
|
{
|
|
unsigned long weight;
|
|
int idx;
|
|
|
|
if (nice < MIN_NICE || nice > MAX_NICE)
|
|
return -ERANGE;
|
|
|
|
idx = NICE_TO_PRIO(nice) - MAX_RT_PRIO;
|
|
idx = array_index_nospec(idx, 40);
|
|
weight = sched_prio_to_weight[idx];
|
|
|
|
return sched_group_set_shares(css_tg(css), scale_load(weight));
|
|
}
|
|
#endif
|
|
|
|
static void __maybe_unused cpu_period_quota_print(struct seq_file *sf,
|
|
long period, long quota)
|
|
{
|
|
if (quota < 0)
|
|
seq_puts(sf, "max");
|
|
else
|
|
seq_printf(sf, "%ld", quota);
|
|
|
|
seq_printf(sf, " %ld\n", period);
|
|
}
|
|
|
|
/* caller should put the current value in *@periodp before calling */
|
|
static int __maybe_unused cpu_period_quota_parse(char *buf,
|
|
u64 *periodp, u64 *quotap)
|
|
{
|
|
char tok[21]; /* U64_MAX */
|
|
|
|
if (sscanf(buf, "%20s %llu", tok, periodp) < 1)
|
|
return -EINVAL;
|
|
|
|
*periodp *= NSEC_PER_USEC;
|
|
|
|
if (sscanf(tok, "%llu", quotap))
|
|
*quotap *= NSEC_PER_USEC;
|
|
else if (!strcmp(tok, "max"))
|
|
*quotap = RUNTIME_INF;
|
|
else
|
|
return -EINVAL;
|
|
|
|
return 0;
|
|
}
|
|
|
|
#ifdef CONFIG_CFS_BANDWIDTH
|
|
static int cpu_max_show(struct seq_file *sf, void *v)
|
|
{
|
|
struct task_group *tg = css_tg(seq_css(sf));
|
|
|
|
cpu_period_quota_print(sf, tg_get_cfs_period(tg), tg_get_cfs_quota(tg));
|
|
return 0;
|
|
}
|
|
|
|
static ssize_t cpu_max_write(struct kernfs_open_file *of,
|
|
char *buf, size_t nbytes, loff_t off)
|
|
{
|
|
struct task_group *tg = css_tg(of_css(of));
|
|
u64 period = tg_get_cfs_period(tg);
|
|
u64 quota;
|
|
int ret;
|
|
|
|
ret = cpu_period_quota_parse(buf, &period, "a);
|
|
if (!ret)
|
|
ret = tg_set_cfs_bandwidth(tg, period, quota);
|
|
return ret ?: nbytes;
|
|
}
|
|
#endif
|
|
|
|
static struct cftype cpu_files[] = {
|
|
#ifdef CONFIG_FAIR_GROUP_SCHED
|
|
{
|
|
.name = "weight",
|
|
.flags = CFTYPE_NOT_ON_ROOT,
|
|
.read_u64 = cpu_weight_read_u64,
|
|
.write_u64 = cpu_weight_write_u64,
|
|
},
|
|
{
|
|
.name = "weight.nice",
|
|
.flags = CFTYPE_NOT_ON_ROOT,
|
|
.read_s64 = cpu_weight_nice_read_s64,
|
|
.write_s64 = cpu_weight_nice_write_s64,
|
|
},
|
|
#endif
|
|
#ifdef CONFIG_CFS_BANDWIDTH
|
|
{
|
|
.name = "max",
|
|
.flags = CFTYPE_NOT_ON_ROOT,
|
|
.seq_show = cpu_max_show,
|
|
.write = cpu_max_write,
|
|
},
|
|
#endif
|
|
#ifdef CONFIG_UCLAMP_TASK_GROUP
|
|
{
|
|
.name = "uclamp.min",
|
|
.flags = CFTYPE_NOT_ON_ROOT,
|
|
.seq_show = cpu_uclamp_min_show,
|
|
.write = cpu_uclamp_min_write,
|
|
},
|
|
{
|
|
.name = "uclamp.max",
|
|
.flags = CFTYPE_NOT_ON_ROOT,
|
|
.seq_show = cpu_uclamp_max_show,
|
|
.write = cpu_uclamp_max_write,
|
|
},
|
|
{
|
|
.name = "uclamp.latency_sensitive",
|
|
.flags = CFTYPE_NOT_ON_ROOT,
|
|
.read_u64 = cpu_uclamp_ls_read_u64,
|
|
.write_u64 = cpu_uclamp_ls_write_u64,
|
|
},
|
|
#endif
|
|
{ } /* terminate */
|
|
};
|
|
|
|
struct cgroup_subsys cpu_cgrp_subsys = {
|
|
.css_alloc = cpu_cgroup_css_alloc,
|
|
.css_online = cpu_cgroup_css_online,
|
|
.css_released = cpu_cgroup_css_released,
|
|
.css_free = cpu_cgroup_css_free,
|
|
.css_extra_stat_show = cpu_extra_stat_show,
|
|
.fork = cpu_cgroup_fork,
|
|
.can_attach = cpu_cgroup_can_attach,
|
|
.attach = cpu_cgroup_attach,
|
|
.legacy_cftypes = cpu_legacy_files,
|
|
.dfl_cftypes = cpu_files,
|
|
.early_init = true,
|
|
.threaded = true,
|
|
};
|
|
|
|
#endif /* CONFIG_CGROUP_SCHED */
|
|
|
|
void dump_cpu_task(int cpu)
|
|
{
|
|
pr_info("Task dump for CPU %d:\n", cpu);
|
|
sched_show_task(cpu_curr(cpu));
|
|
}
|
|
|
|
/*
|
|
* Nice levels are multiplicative, with a gentle 10% change for every
|
|
* nice level changed. I.e. when a CPU-bound task goes from nice 0 to
|
|
* nice 1, it will get ~10% less CPU time than another CPU-bound task
|
|
* that remained on nice 0.
|
|
*
|
|
* The "10% effect" is relative and cumulative: from _any_ nice level,
|
|
* if you go up 1 level, it's -10% CPU usage, if you go down 1 level
|
|
* it's +10% CPU usage. (to achieve that we use a multiplier of 1.25.
|
|
* If a task goes up by ~10% and another task goes down by ~10% then
|
|
* the relative distance between them is ~25%.)
|
|
*/
|
|
const int sched_prio_to_weight[40] = {
|
|
/* -20 */ 88761, 71755, 56483, 46273, 36291,
|
|
/* -15 */ 29154, 23254, 18705, 14949, 11916,
|
|
/* -10 */ 9548, 7620, 6100, 4904, 3906,
|
|
/* -5 */ 3121, 2501, 1991, 1586, 1277,
|
|
/* 0 */ 1024, 820, 655, 526, 423,
|
|
/* 5 */ 335, 272, 215, 172, 137,
|
|
/* 10 */ 110, 87, 70, 56, 45,
|
|
/* 15 */ 36, 29, 23, 18, 15,
|
|
};
|
|
|
|
/*
|
|
* Inverse (2^32/x) values of the sched_prio_to_weight[] array, precalculated.
|
|
*
|
|
* In cases where the weight does not change often, we can use the
|
|
* precalculated inverse to speed up arithmetics by turning divisions
|
|
* into multiplications:
|
|
*/
|
|
const u32 sched_prio_to_wmult[40] = {
|
|
/* -20 */ 48388, 59856, 76040, 92818, 118348,
|
|
/* -15 */ 147320, 184698, 229616, 287308, 360437,
|
|
/* -10 */ 449829, 563644, 704093, 875809, 1099582,
|
|
/* -5 */ 1376151, 1717300, 2157191, 2708050, 3363326,
|
|
/* 0 */ 4194304, 5237765, 6557202, 8165337, 10153587,
|
|
/* 5 */ 12820798, 15790321, 19976592, 24970740, 31350126,
|
|
/* 10 */ 39045157, 49367440, 61356676, 76695844, 95443717,
|
|
/* 15 */ 119304647, 148102320, 186737708, 238609294, 286331153,
|
|
};
|
|
|
|
void call_trace_sched_update_nr_running(struct rq *rq, int count)
|
|
{
|
|
trace_sched_update_nr_running_tp(rq, count);
|
|
}
|