
Changes in 5.10.65 locking/mutex: Fix HANDOFF condition regmap: fix the offset of register error log regulator: tps65910: Silence deferred probe error crypto: mxs-dcp - Check for DMA mapping errors sched/deadline: Fix reset_on_fork reporting of DL tasks power: supply: axp288_fuel_gauge: Report register-address on readb / writeb errors crypto: omap-sham - clear dma flags only after omap_sham_update_dma_stop() sched/deadline: Fix missing clock update in migrate_task_rq_dl() rcu/tree: Handle VM stoppage in stall detection EDAC/mce_amd: Do not load edac_mce_amd module on guests posix-cpu-timers: Force next expiration recalc after itimer reset hrtimer: Avoid double reprogramming in __hrtimer_start_range_ns() hrtimer: Ensure timerfd notification for HIGHRES=n udf: Check LVID earlier udf: Fix iocharset=utf8 mount option isofs: joliet: Fix iocharset=utf8 mount option bcache: add proper error unwinding in bcache_device_init blk-throtl: optimize IOPS throttle for large IO scenarios nvme-tcp: don't update queue count when failing to set io queues nvme-rdma: don't update queue count when failing to set io queues nvmet: pass back cntlid on successful completion power: supply: smb347-charger: Add missing pin control activation power: supply: max17042_battery: fix typo in MAx17042_TOFF s390/cio: add dev_busid sysfs entry for each subchannel s390/zcrypt: fix wrong offset index for APKA master key valid state libata: fix ata_host_start() crypto: omap - Fix inconsistent locking of device lists crypto: qat - do not ignore errors from enable_vf2pf_comms() crypto: qat - handle both source of interrupt in VF ISR crypto: qat - fix reuse of completion variable crypto: qat - fix naming for init/shutdown VF to PF notifications crypto: qat - do not export adf_iov_putmsg() fcntl: fix potential deadlock for &fasync_struct.fa_lock udf_get_extendedattr() had no boundary checks. s390/kasan: fix large PMD pages address alignment check s390/pci: fix misleading rc in clp_set_pci_fn() s390/debug: keep debug data on resize s390/debug: fix debug area life cycle s390/ap: fix state machine hang after failure to enable irq power: supply: cw2015: use dev_err_probe to allow deferred probe m68k: emu: Fix invalid free in nfeth_cleanup() sched/numa: Fix is_core_idle() sched: Fix UCLAMP_FLAG_IDLE setting rcu: Fix to include first blocked task in stall warning rcu: Add lockdep_assert_irqs_disabled() to rcu_sched_clock_irq() and callees rcu: Fix stall-warning deadlock due to non-release of rcu_node ->lock m68k: Fix invalid RMW_INSNS on CPUs that lack CAS block: return ELEVATOR_DISCARD_MERGE if possible spi: spi-fsl-dspi: Fix issue with uninitialized dma_slave_config spi: spi-pic32: Fix issue with uninitialized dma_slave_config genirq/timings: Fix error return code in irq_timings_test_irqs() irqchip/loongson-pch-pic: Improve edge triggered interrupt support lib/mpi: use kcalloc in mpi_resize clocksource/drivers/sh_cmt: Fix wrong setting if don't request IRQ for clock source channel block: nbd: add sanity check for first_minor spi: coldfire-qspi: Use clk_disable_unprepare in the remove function irqchip/gic-v3: Fix priority comparison when non-secure priorities are used crypto: qat - use proper type for vf_mask certs: Trigger creation of RSA module signing key if it's not an RSA key tpm: ibmvtpm: Avoid error message when process gets signal while waiting x86/mce: Defer processing of early errors spi: davinci: invoke chipselect callback blk-crypto: fix check for too-large dun_bytes regulator: vctrl: Use locked regulator_get_voltage in probe path regulator: vctrl: Avoid lockdep warning in enable/disable ops spi: sprd: Fix the wrong WDG_LOAD_VAL spi: spi-zynq-qspi: use wait_for_completion_timeout to make zynq_qspi_exec_mem_op not interruptible EDAC/i10nm: Fix NVDIMM detection drm/panfrost: Fix missing clk_disable_unprepare() on error in panfrost_clk_init() drm/gma500: Fix end of loop tests for list_for_each_entry ASoC: mediatek: mt8183: Fix Unbalanced pm_runtime_enable in mt8183_afe_pcm_dev_probe media: TDA1997x: enable EDID support leds: is31fl32xx: Fix missing error code in is31fl32xx_parse_dt() soc: rockchip: ROCKCHIP_GRF should not default to y, unconditionally media: cxd2880-spi: Fix an error handling path drm/of: free the right object bpf: Fix a typo of reuseport map in bpf.h. bpf: Fix potential memleak and UAF in the verifier. drm/of: free the iterator object on failure gve: fix the wrong AdminQ buffer overflow check libbpf: Fix the possible memory leak on error ARM: dts: aspeed-g6: Fix HVI3C function-group in pinctrl dtsi arm64: dts: renesas: r8a77995: draak: Remove bogus adv7511w properties i40e: improve locking of mac_filter_hash soc: qcom: rpmhpd: Use corner in power_off libbpf: Fix removal of inner map in bpf_object__create_map gfs2: Fix memory leak of object lsi on error return path firmware: fix theoretical UAF race with firmware cache and resume driver core: Fix error return code in really_probe() ionic: cleanly release devlink instance media: dvb-usb: fix uninit-value in dvb_usb_adapter_dvb_init media: dvb-usb: fix uninit-value in vp702x_read_mac_addr media: dvb-usb: Fix error handling in dvb_usb_i2c_init media: go7007: fix memory leak in go7007_usb_probe media: go7007: remove redundant initialization media: rockchip/rga: use pm_runtime_resume_and_get() media: rockchip/rga: fix error handling in probe media: coda: fix frame_mem_ctrl for YUV420 and YVU420 formats media: atomisp: fix the uninitialized use and rename "retvalue" Bluetooth: sco: prevent information leak in sco_conn_defer_accept() 6lowpan: iphc: Fix an off-by-one check of array index drm/amdgpu/acp: Make PM domain really work tcp: seq_file: Avoid skipping sk during tcp_seek_last_pos ARM: dts: meson8: Use a higher default GPU clock frequency ARM: dts: meson8b: odroidc1: Fix the pwm regulator supply properties ARM: dts: meson8b: mxq: Fix the pwm regulator supply properties ARM: dts: meson8b: ec100: Fix the pwm regulator supply properties net/mlx5e: Prohibit inner indir TIRs in IPoIB net/mlx5e: Block LRO if firmware asks for tunneled LRO cgroup/cpuset: Fix a partition bug with hotplug drm: mxsfb: Enable recovery on underflow drm: mxsfb: Increase number of outstanding requests on V4 and newer HW drm: mxsfb: Clear FIFO_CLEAR bit net: cipso: fix warnings in netlbl_cipsov4_add_std Bluetooth: mgmt: Fix wrong opcode in the response for add_adv cmd arm64: dts: renesas: rzg2: Convert EtherAVB to explicit delay handling arm64: dts: renesas: hihope-rzg2-ex: Add EtherAVB internal rx delay devlink: Break parameter notification sequence to be before/after unload/load driver net/mlx5: Fix missing return value in mlx5_devlink_eswitch_inline_mode_set() i2c: highlander: add IRQ check leds: lt3593: Put fwnode in any case during ->probe() leds: trigger: audio: Add an activate callback to ensure the initial brightness is set media: em28xx-input: fix refcount bug in em28xx_usb_disconnect media: venus: venc: Fix potential null pointer dereference on pointer fmt PCI: PM: Avoid forcing PCI_D0 for wakeup reasons inconsistently PCI: PM: Enable PME if it can be signaled from D3cold bpf, samples: Add missing mprog-disable to xdp_redirect_cpu's optstring soc: qcom: smsm: Fix missed interrupts if state changes while masked debugfs: Return error during {full/open}_proxy_open() on rmmod Bluetooth: increase BTNAMSIZ to 21 chars to fix potential buffer overflow PM: EM: Increase energy calculation precision selftests/bpf: Fix bpf-iter-tcp4 test to print correctly the dest IP drm/msm/mdp4: refactor HW revision detection into read_mdp_hw_revision drm/msm/mdp4: move HW revision detection to earlier phase drm/msm/dpu: make dpu_hw_ctl_clear_all_blendstages clear necessary LMs arm64: dts: exynos: correct GIC CPU interfaces address range on Exynos7 counter: 104-quad-8: Return error when invalid mode during ceiling_write cgroup/cpuset: Miscellaneous code cleanup cgroup/cpuset: Fix violation of cpuset locking rule ASoC: Intel: Fix platform ID matching Bluetooth: fix repeated calls to sco_sock_kill drm/msm/dsi: Fix some reference counted resource leaks net/mlx5: Register to devlink ingress VLAN filter trap net/mlx5: Fix unpublish devlink parameters ASoC: rt5682: Implement remove callback ASoC: rt5682: Properly turn off regulators if wrong device ID usb: dwc3: meson-g12a: add IRQ check usb: dwc3: qcom: add IRQ check usb: gadget: udc: at91: add IRQ check usb: gadget: udc: s3c2410: add IRQ check usb: phy: fsl-usb: add IRQ check usb: phy: twl6030: add IRQ checks usb: gadget: udc: renesas_usb3: Fix soc_device_match() abuse selftests/bpf: Fix test_core_autosize on big-endian machines devlink: Clear whole devlink_flash_notify struct samples: pktgen: add missing IPv6 option to pktgen scripts Bluetooth: Move shutdown callback before flushing tx and rx queue PM: cpu: Make notifier chain use a raw_spinlock_t usb: host: ohci-tmio: add IRQ check usb: phy: tahvo: add IRQ check libbpf: Re-build libbpf.so when libbpf.map changes mac80211: Fix insufficient headroom issue for AMSDU locking/lockdep: Mark local_lock_t locking/local_lock: Add missing owner initialization lockd: Fix invalid lockowner cast after vfs_test_lock nfsd4: Fix forced-expiry locking arm64: dts: marvell: armada-37xx: Extend PCIe MEM space clk: staging: correct reference to config IOMEM to config HAS_IOMEM i2c: synquacer: fix deferred probing firmware: raspberrypi: Keep count of all consumers firmware: raspberrypi: Fix a leak in 'rpi_firmware_get()' usb: gadget: mv_u3d: request_irq() after initializing UDC mm/swap: consider max pages in iomap_swapfile_add_extent lkdtm: replace SCSI_DISPATCH_CMD with SCSI_QUEUE_RQ Bluetooth: add timeout sanity check to hci_inquiry i2c: iop3xx: fix deferred probing i2c: s3c2410: fix IRQ check i2c: fix platform_get_irq.cocci warnings i2c: hix5hd2: fix IRQ check gfs2: init system threads before freeze lock rsi: fix error code in rsi_load_9116_firmware() rsi: fix an error code in rsi_probe() ASoC: Intel: kbl_da7219_max98927: Fix format selection for max98373 ASoC: Intel: Skylake: Leave data as is when invoking TLV IPCs ASoC: Intel: Skylake: Fix module resource and format selection mmc: sdhci: Fix issue with uninitialized dma_slave_config mmc: dw_mmc: Fix issue with uninitialized dma_slave_config mmc: moxart: Fix issue with uninitialized dma_slave_config bpf: Fix possible out of bound write in narrow load handling CIFS: Fix a potencially linear read overflow i2c: mt65xx: fix IRQ check i2c: xlp9xx: fix main IRQ check usb: ehci-orion: Handle errors of clk_prepare_enable() in probe usb: bdc: Fix an error handling path in 'bdc_probe()' when no suitable DMA config is available usb: bdc: Fix a resource leak in the error handling path of 'bdc_probe()' tty: serial: fsl_lpuart: fix the wrong mapbase value ASoC: wcd9335: Fix a double irq free in the remove function ASoC: wcd9335: Fix a memory leak in the error handling path of the probe function ASoC: wcd9335: Disable irq on slave ports in the remove function iwlwifi: follow the new inclusive terminology iwlwifi: skip first element in the WTAS ACPI table ice: Only lock to update netdev dev_addr ath6kl: wmi: fix an error code in ath6kl_wmi_sync_point() atlantic: Fix driver resume flow. bcma: Fix memory leak for internally-handled cores brcmfmac: pcie: fix oops on failure to resume and reprobe ipv6: make exception cache less predictible ipv4: make exception cache less predictible net: sched: Fix qdisc_rate_table refcount leak when get tcf_block failed net: qualcomm: fix QCA7000 checksum handling octeontx2-af: Fix loop in free and unmap counter octeontx2-af: Fix static code analyzer reported issues octeontx2-af: Set proper errorcode for IPv4 checksum errors ipv4: fix endianness issue in inet_rtm_getroute_build_skb() ASoC: rt5682: Remove unused variable in rt5682_i2c_remove() iwlwifi Add support for ax201 in Samsung Galaxy Book Flex2 Alpha f2fs: guarantee to write dirty data when enabling checkpoint back time: Handle negative seconds correctly in timespec64_to_ns() io_uring: IORING_OP_WRITE needs hash_reg_file set bio: fix page leak bio_add_hw_page failure tty: Fix data race between tiocsti() and flush_to_ldisc() perf/x86/amd/ibs: Extend PERF_PMU_CAP_NO_EXCLUDE to IBS Op x86/resctrl: Fix a maybe-uninitialized build warning treated as error Revert "KVM: x86: mmu: Add guest physical address check in translate_gpa()" KVM: s390: index kvm->arch.idle_mask by vcpu_idx KVM: x86: Update vCPU's hv_clock before back to guest when tsc_offset is adjusted KVM: VMX: avoid running vmx_handle_exit_irqoff in case of emulation KVM: nVMX: Unconditionally clear nested.pi_pending on nested VM-Enter ARM: dts: at91: add pinctrl-{names, 0} for all gpios fuse: truncate pagecache on atomic_o_trunc fuse: flush extending writes IMA: remove -Wmissing-prototypes warning IMA: remove the dependency on CRYPTO_MD5 fbmem: don't allow too huge resolutions backlight: pwm_bl: Improve bootloader/kernel device handover clk: kirkwood: Fix a clocking boot regression Linux 5.10.65 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: Ie0b9306ba6ee4193de3200df7cdacaeba152b83e
240 lines
7.7 KiB
C
240 lines
7.7 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _LINUX_ENERGY_MODEL_H
|
|
#define _LINUX_ENERGY_MODEL_H
|
|
#include <linux/cpumask.h>
|
|
#include <linux/device.h>
|
|
#include <linux/jump_label.h>
|
|
#include <linux/kobject.h>
|
|
#include <linux/rcupdate.h>
|
|
#include <linux/sched/cpufreq.h>
|
|
#include <linux/sched/topology.h>
|
|
#include <linux/types.h>
|
|
|
|
/**
|
|
* em_perf_state - Performance state of a performance domain
|
|
* @frequency: The frequency in KHz, for consistency with CPUFreq
|
|
* @power: The power consumed at this level, in milli-watts (by 1 CPU or
|
|
by a registered device). It can be a total power: static and
|
|
dynamic.
|
|
* @cost: The cost coefficient associated with this level, used during
|
|
* energy calculation. Equal to: power * max_frequency / frequency
|
|
*/
|
|
struct em_perf_state {
|
|
unsigned long frequency;
|
|
unsigned long power;
|
|
unsigned long cost;
|
|
};
|
|
|
|
/**
|
|
* em_perf_domain - Performance domain
|
|
* @table: List of performance states, in ascending order
|
|
* @nr_perf_states: Number of performance states
|
|
* @milliwatts: Flag indicating the power values are in milli-Watts
|
|
* or some other scale.
|
|
* @cpus: Cpumask covering the CPUs of the domain. It's here
|
|
* for performance reasons to avoid potential cache
|
|
* misses during energy calculations in the scheduler
|
|
* and simplifies allocating/freeing that memory region.
|
|
*
|
|
* In case of CPU device, a "performance domain" represents a group of CPUs
|
|
* whose performance is scaled together. All CPUs of a performance domain
|
|
* must have the same micro-architecture. Performance domains often have
|
|
* a 1-to-1 mapping with CPUFreq policies. In case of other devices the @cpus
|
|
* field is unused.
|
|
*/
|
|
struct em_perf_domain {
|
|
struct em_perf_state *table;
|
|
int nr_perf_states;
|
|
int milliwatts;
|
|
unsigned long cpus[];
|
|
};
|
|
|
|
#define em_span_cpus(em) (to_cpumask((em)->cpus))
|
|
|
|
#ifdef CONFIG_ENERGY_MODEL
|
|
#define EM_MAX_POWER 0xFFFF
|
|
|
|
/*
|
|
* Increase resolution of energy estimation calculations for 64-bit
|
|
* architectures. The extra resolution improves decision made by EAS for the
|
|
* task placement when two Performance Domains might provide similar energy
|
|
* estimation values (w/o better resolution the values could be equal).
|
|
*
|
|
* We increase resolution only if we have enough bits to allow this increased
|
|
* resolution (i.e. 64-bit). The costs for increasing resolution when 32-bit
|
|
* are pretty high and the returns do not justify the increased costs.
|
|
*/
|
|
#ifdef CONFIG_64BIT
|
|
#define em_scale_power(p) ((p) * 1000)
|
|
#else
|
|
#define em_scale_power(p) (p)
|
|
#endif
|
|
|
|
struct em_data_callback {
|
|
/**
|
|
* active_power() - Provide power at the next performance state of
|
|
* a device
|
|
* @power : Active power at the performance state in mW
|
|
* (modified)
|
|
* @freq : Frequency at the performance state in kHz
|
|
* (modified)
|
|
* @dev : Device for which we do this operation (can be a CPU)
|
|
*
|
|
* active_power() must find the lowest performance state of 'dev' above
|
|
* 'freq' and update 'power' and 'freq' to the matching active power
|
|
* and frequency.
|
|
*
|
|
* In case of CPUs, the power is the one of a single CPU in the domain,
|
|
* expressed in milli-watts. It is expected to fit in the
|
|
* [0, EM_MAX_POWER] range.
|
|
*
|
|
* Return 0 on success.
|
|
*/
|
|
int (*active_power)(unsigned long *power, unsigned long *freq,
|
|
struct device *dev);
|
|
};
|
|
#define EM_DATA_CB(_active_power_cb) { .active_power = &_active_power_cb }
|
|
|
|
struct em_perf_domain *em_cpu_get(int cpu);
|
|
struct em_perf_domain *em_pd_get(struct device *dev);
|
|
int em_dev_register_perf_domain(struct device *dev, unsigned int nr_states,
|
|
struct em_data_callback *cb, cpumask_t *span,
|
|
bool milliwatts);
|
|
void em_dev_unregister_perf_domain(struct device *dev);
|
|
|
|
/**
|
|
* em_cpu_energy() - Estimates the energy consumed by the CPUs of a
|
|
performance domain
|
|
* @pd : performance domain for which energy has to be estimated
|
|
* @max_util : highest utilization among CPUs of the domain
|
|
* @sum_util : sum of the utilization of all CPUs in the domain
|
|
*
|
|
* This function must be used only for CPU devices. There is no validation,
|
|
* i.e. if the EM is a CPU type and has cpumask allocated. It is called from
|
|
* the scheduler code quite frequently and that is why there is not checks.
|
|
*
|
|
* Return: the sum of the energy consumed by the CPUs of the domain assuming
|
|
* a capacity state satisfying the max utilization of the domain.
|
|
*/
|
|
static inline unsigned long em_cpu_energy(struct em_perf_domain *pd,
|
|
unsigned long max_util, unsigned long sum_util)
|
|
{
|
|
unsigned long freq, scale_cpu;
|
|
struct em_perf_state *ps;
|
|
int i, cpu;
|
|
|
|
if (!sum_util)
|
|
return 0;
|
|
|
|
/*
|
|
* In order to predict the performance state, map the utilization of
|
|
* the most utilized CPU of the performance domain to a requested
|
|
* frequency, like schedutil.
|
|
*/
|
|
cpu = cpumask_first(to_cpumask(pd->cpus));
|
|
scale_cpu = arch_scale_cpu_capacity(cpu);
|
|
ps = &pd->table[pd->nr_perf_states - 1];
|
|
freq = map_util_freq(max_util, ps->frequency, scale_cpu);
|
|
|
|
/*
|
|
* Find the lowest performance state of the Energy Model above the
|
|
* requested frequency.
|
|
*/
|
|
for (i = 0; i < pd->nr_perf_states; i++) {
|
|
ps = &pd->table[i];
|
|
if (ps->frequency >= freq)
|
|
break;
|
|
}
|
|
|
|
/*
|
|
* The capacity of a CPU in the domain at the performance state (ps)
|
|
* can be computed as:
|
|
*
|
|
* ps->freq * scale_cpu
|
|
* ps->cap = -------------------- (1)
|
|
* cpu_max_freq
|
|
*
|
|
* So, ignoring the costs of idle states (which are not available in
|
|
* the EM), the energy consumed by this CPU at that performance state
|
|
* is estimated as:
|
|
*
|
|
* ps->power * cpu_util
|
|
* cpu_nrg = -------------------- (2)
|
|
* ps->cap
|
|
*
|
|
* since 'cpu_util / ps->cap' represents its percentage of busy time.
|
|
*
|
|
* NOTE: Although the result of this computation actually is in
|
|
* units of power, it can be manipulated as an energy value
|
|
* over a scheduling period, since it is assumed to be
|
|
* constant during that interval.
|
|
*
|
|
* By injecting (1) in (2), 'cpu_nrg' can be re-expressed as a product
|
|
* of two terms:
|
|
*
|
|
* ps->power * cpu_max_freq cpu_util
|
|
* cpu_nrg = ------------------------ * --------- (3)
|
|
* ps->freq scale_cpu
|
|
*
|
|
* The first term is static, and is stored in the em_perf_state struct
|
|
* as 'ps->cost'.
|
|
*
|
|
* Since all CPUs of the domain have the same micro-architecture, they
|
|
* share the same 'ps->cost', and the same CPU capacity. Hence, the
|
|
* total energy of the domain (which is the simple sum of the energy of
|
|
* all of its CPUs) can be factorized as:
|
|
*
|
|
* ps->cost * \Sum cpu_util
|
|
* pd_nrg = ------------------------ (4)
|
|
* scale_cpu
|
|
*/
|
|
return ps->cost * sum_util / scale_cpu;
|
|
}
|
|
|
|
/**
|
|
* em_pd_nr_perf_states() - Get the number of performance states of a perf.
|
|
* domain
|
|
* @pd : performance domain for which this must be done
|
|
*
|
|
* Return: the number of performance states in the performance domain table
|
|
*/
|
|
static inline int em_pd_nr_perf_states(struct em_perf_domain *pd)
|
|
{
|
|
return pd->nr_perf_states;
|
|
}
|
|
|
|
#else
|
|
struct em_data_callback {};
|
|
#define EM_DATA_CB(_active_power_cb) { }
|
|
|
|
static inline
|
|
int em_dev_register_perf_domain(struct device *dev, unsigned int nr_states,
|
|
struct em_data_callback *cb, cpumask_t *span,
|
|
bool milliwatts)
|
|
{
|
|
return -EINVAL;
|
|
}
|
|
static inline void em_dev_unregister_perf_domain(struct device *dev)
|
|
{
|
|
}
|
|
static inline struct em_perf_domain *em_cpu_get(int cpu)
|
|
{
|
|
return NULL;
|
|
}
|
|
static inline struct em_perf_domain *em_pd_get(struct device *dev)
|
|
{
|
|
return NULL;
|
|
}
|
|
static inline unsigned long em_cpu_energy(struct em_perf_domain *pd,
|
|
unsigned long max_util, unsigned long sum_util)
|
|
{
|
|
return 0;
|
|
}
|
|
static inline int em_pd_nr_perf_states(struct em_perf_domain *pd)
|
|
{
|
|
return 0;
|
|
}
|
|
#endif
|
|
|
|
#endif
|