linux/drivers/cpufreq
Viresh Kumar 40c3bd4cfa cpufreq: stats: Defer stats update to cpufreq_stats_record_transition()
In order to prepare for lock-less stats update, add support to defer any
updates to it until cpufreq_stats_record_transition() is called.

The stats were updated from two places earlier:

- show_time_in_state(): This can be easily deferred, all we need is to
  calculate the delta duration again in this routine to show the current
  state's time-in-state.

- store_reset(): This is a bit tricky as we need to clear the stats
  here and avoid races with simultaneous call to
  cpufreq_stats_record_transition().

Fix that by deferring the reset of the stats (within the code) to the
next call to cpufreq_stats_record_transition(), but since we need to
keep showing the right stats until that time, we capture the reset
time and account for the time since last time reset was called until
the time cpufreq_stats_record_transition() update the stats.

User space will continue seeing the stats correctly, everything will
be 0 after the stats are reset, apart from the time-in-state of the
current state, until the time a frequency switch happens.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
[ rjw: Minor changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-10-05 15:13:42 +02:00
..
acpi-cpufreq.c cpufreq: acpi-cpufreq: Mark sometimes used ID structs as __maybe_unused 2020-07-15 15:17:06 +02:00
amd_freq_sensitivity.c cpufreq: amd_freq_sensitivity: Mark sometimes used ID structs as __maybe_unused 2020-07-15 15:17:06 +02:00
armada-8k-cpufreq.c cpufreq: ap806: Add NULL check after kcalloc 2019-07-22 11:12:15 +05:30
armada-37xx-cpufreq.c cpufreq: dt: fix oops on armada37xx 2020-07-30 10:57:45 +05:30
bmips-cpufreq.c cpufreq: Make cpufreq_generic_init() return void 2019-07-16 10:20:11 +02:00
brcmstb-avs-cpufreq.c cpufreq: brcmstb-avs-cpufreq: send S2_ENTER / S2_EXIT commands to AVS 2020-07-30 10:57:44 +05:30
cppc_cpufreq.c cpufreq: CPPC: Reuse caps variable in few routines 2020-07-30 10:57:47 +05:30
cpufreq-dt-platdev.c cpufreq: blacklist SC7180 in cpufreq-dt-platdev 2020-06-23 16:12:07 +05:30
cpufreq-dt.c cpufreq: move invariance setter calls in cpufreq core 2020-09-18 19:10:42 +02:00
cpufreq-dt.h cpufreq: dt: Allow platform specific intermediate callbacks 2020-03-12 15:43:52 +05:30
cpufreq-nforce2.c cpufreq: Avoid creating excessively large stack frames 2020-01-27 10:33:33 +01:00
cpufreq.c arch_topology, cpufreq: constify arch_* cpumasks 2020-09-18 19:11:04 +02:00
cpufreq_conservative.c cpufreq: Register governors at core_initcall 2020-07-02 13:03:30 +02:00
cpufreq_governor.c cpufreq: cpufreq_governor: Demote store_sampling_rate() header to standard comment block 2020-07-15 15:17:06 +02:00
cpufreq_governor.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
cpufreq_governor_attr_set.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
cpufreq_ondemand.c cpufreq: Register governors at core_initcall 2020-07-02 13:03:30 +02:00
cpufreq_ondemand.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
cpufreq_performance.c cpufreq: Register governors at core_initcall 2020-07-02 13:03:30 +02:00
cpufreq_powersave.c cpufreq: Register governors at core_initcall 2020-07-02 13:03:30 +02:00
cpufreq_stats.c cpufreq: stats: Defer stats update to cpufreq_stats_record_transition() 2020-10-05 15:13:42 +02:00
cpufreq_userspace.c cpufreq: Register governors at core_initcall 2020-07-02 13:03:30 +02:00
davinci-cpufreq.c cpufreq: Replace HTTP links with HTTPS ones 2020-07-13 17:54:37 +02:00
e_powersaver.c cpufreq: Convert to new X86 CPU match macros 2020-03-24 21:31:27 +01:00
elanfreq.c cpufreq: Convert to new X86 CPU match macros 2020-03-24 21:31:27 +01:00
freq_table.c cpufreq: freq_table: Demote obvious misuse of kerneldoc to standard comment blocks 2020-07-15 15:17:06 +02:00
gx-suspmod.c cpufreq: Avoid creating excessively large stack frames 2020-01-27 10:33:33 +01:00
highbank-cpufreq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ia64-acpi-cpufreq.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
imx-cpufreq-dt.c cpufreq: imx-cpufreq-dt: support i.MX7ULP 2020-04-28 14:26:20 +05:30
imx6q-cpufreq.c OPP: refactor dev_pm_opp_of_register_em() and update related drivers 2020-06-24 17:16:42 +02:00
intel_pstate.c cpufreq: intel_pstate: Fix missing return statement 2020-09-30 17:37:23 +02:00
Kconfig cpufreq: make schedutil the default for arm and arm64 2020-07-30 11:40:29 +05:30
Kconfig.arm cpufreq: Add Tegra194 cpufreq driver 2020-07-30 10:57:51 +05:30
Kconfig.powerpc cpufreq: Fix Kconfig indentation 2019-11-29 11:52:02 +01:00
Kconfig.x86 treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
kirkwood-cpufreq.c cpufreq: kirkwood: convert to devm_platform_ioremap_resource 2020-01-07 13:29:58 +05:30
longhaul.c cpufreq: Convert to new X86 CPU match macros 2020-03-24 21:31:27 +01:00
longhaul.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 166 2019-05-30 11:26:39 -07:00
longrun.c cpufreq: Convert to new X86 CPU match macros 2020-03-24 21:31:27 +01:00
loongson1-cpufreq.c cpufreq: Make cpufreq_generic_init() return void 2019-07-16 10:20:11 +02:00
loongson2_cpufreq.c mips: loongsoon2ef: remove private clk api 2020-04-16 17:34:23 +02:00
Makefile Merge branch 'cpufreq/arm/linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm 2020-08-04 12:44:53 +02:00
maple-cpufreq.c Merge branch 'pm-cpufreq' 2019-07-18 09:49:30 +02:00
mediatek-cpufreq.c OPP: refactor dev_pm_opp_of_register_em() and update related drivers 2020-06-24 17:16:42 +02:00
mvebu-cpufreq.c cpufreq: mvebu: Remove OPPs using dev_pm_opp_remove() 2018-09-19 14:56:44 -07:00
omap-cpufreq.c OPP: refactor dev_pm_opp_of_register_em() and update related drivers 2020-06-24 17:16:42 +02:00
p4-clockmod.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
pasemi-cpufreq.c cpufreq: pasemi: Include header file for {check,restore}_astate prototypes 2020-07-15 15:17:06 +02:00
pcc-cpufreq.c cpufreq: pcc-cpufreq: Mark sometimes used ID structs as __maybe_unused 2020-07-15 15:17:06 +02:00
pmac32-cpufreq.c Merge branch 'pm-cpufreq' 2019-07-18 09:49:30 +02:00
pmac64-cpufreq.c Merge branch 'pm-cpufreq' 2019-07-18 09:49:30 +02:00
powernow-k6.c cpufreq: Convert to new X86 CPU match macros 2020-03-24 21:31:27 +01:00
powernow-k7.c cpufreq: Convert to new X86 CPU match macros 2020-03-24 21:31:27 +01:00
powernow-k7.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 166 2019-05-30 11:26:39 -07:00
powernow-k8.c cpufreq: powernow-k8: Mark 'hi' and 'lo' dummy variables as __always_unused 2020-07-15 15:17:06 +02:00
powernow-k8.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 347 2019-06-05 17:37:08 +02:00
powernv-cpufreq.c cpufreq: powernv: Make some symbols static 2020-07-15 17:27:15 +02:00
ppc_cbe_cpufreq.c cpufreq: powerpc_cbe: Switch to QoS requests for freq limits 2019-08-26 10:02:01 +02:00
ppc_cbe_cpufreq.h cpufreq: powerpc_cbe: Switch to QoS requests for freq limits 2019-08-26 10:02:01 +02:00
ppc_cbe_cpufreq_pervasive.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 153 2019-05-30 11:26:32 -07:00
ppc_cbe_cpufreq_pmi.c cpufreq: Use per-policy frequency QoS 2019-10-21 02:05:21 +02:00
pxa2xx-cpufreq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
pxa3xx-cpufreq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
qcom-cpufreq-hw.c cpufreq: move invariance setter calls in cpufreq core 2020-09-18 19:10:42 +02:00
qcom-cpufreq-nvmem.c cpufreq: qcom: fix wrong compatible binding 2020-05-04 10:42:44 +05:30
qoriq-cpufreq.c cpufreq: qoriq: convert to a platform driver 2020-05-07 10:47:27 +05:30
raspberrypi-cpufreq.c cpufreq: add driver for Raspberry Pi 2019-06-13 08:58:22 +05:30
s3c24xx-cpufreq-debugfs.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
s3c24xx-cpufreq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
s3c64xx-cpufreq.c cpufreq: s3c64xx: Remove pointless NULL check in s3c64xx_cpufreq_driver_init 2019-10-23 08:53:23 +05:30
s3c2410-cpufreq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
s3c2412-cpufreq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
s3c2416-cpufreq.c cpufreq: s3c: fix unbalances of cpufreq policy refcount 2020-01-07 13:31:01 +05:30
s3c2440-cpufreq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
s5pv210-cpufreq.c cpufreq: s3c: fix unbalances of cpufreq policy refcount 2020-01-07 13:31:01 +05:30
sa1100-cpufreq.c cpufreq: Make cpufreq_generic_init() return void 2019-07-16 10:20:11 +02:00
sa1110-cpufreq.c Merge branch 'pm-cpufreq' 2019-07-18 09:49:30 +02:00
sc520_freq.c cpufreq: Convert to new X86 CPU match macros 2020-03-24 21:31:27 +01:00
scmi-cpufreq.c cpufreq: move invariance setter calls in cpufreq core 2020-09-18 19:10:42 +02:00
scpi-cpufreq.c cpufreq: move invariance setter calls in cpufreq core 2020-09-18 19:10:42 +02:00
sfi-cpufreq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 235 2019-06-19 17:09:07 +02:00
sh-cpufreq.c cpufreq: Avoid creating excessively large stack frames 2020-01-27 10:33:33 +01:00
sparc-us2e-cpufreq.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
sparc-us3-cpufreq.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
spear-cpufreq.c cpufreq: Make cpufreq_generic_init() return void 2019-07-16 10:20:11 +02:00
speedstep-centrino.c cpufreq: Convert to new X86 CPU match macros 2020-03-24 21:31:27 +01:00
speedstep-ich.c cpufreq: Convert to new X86 CPU match macros 2020-03-24 21:31:27 +01:00
speedstep-lib.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
speedstep-lib.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 166 2019-05-30 11:26:39 -07:00
speedstep-smi.c cpufreq: Convert to new X86 CPU match macros 2020-03-24 21:31:27 +01:00
sti-cpufreq.c cpufreq: sti-cpufreq: Fix some formatting and misspelling issues 2020-07-30 10:57:49 +05:30
sun50i-cpufreq-nvmem.c cpufreq: sun50i: Fix CPU speed bin detection 2019-11-05 15:06:49 +05:30
tango-cpufreq.c cpufreq: dt: Don't use generic platdev driver for tango 2017-07-22 02:20:59 +02:00
tegra20-cpufreq.c cpufreq: tegra20: Use generic cpufreq-dt driver (Tegra30 supported now) 2020-05-06 18:59:38 +02:00
tegra124-cpufreq.c cpufreq: tegra124: Add suspend and resume support 2019-10-29 13:25:29 +01:00
tegra186-cpufreq.c cpufreq: tegra186: Simplify probe return path 2020-07-30 10:57:48 +05:30
tegra194-cpufreq.c cpufreq: replace cpu_logical_map() with read_cpuid_mpir() 2020-08-21 20:17:01 +02:00
ti-cpufreq.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
vexpress-spc-cpufreq.c cpufreq: move invariance setter calls in cpufreq core 2020-09-18 19:10:42 +02:00