linux/drivers
Tvrtko Ursulin 1fe699e301 drm/i915/pmu: Fix sleep under atomic in RC6 readout
We are not allowed to call intel_runtime_pm_get from the PMU counter read
callback since the former can sleep, and the latter is running under IRQ
context.

To workaround this, we record the last known RC6 and while runtime
suspended estimate its increase by querying the runtime PM core
timestamps.

Downside of this approach is that we can temporarily lose a chunk of RC6
time, from the last PMU read-out to runtime suspend entry, but that will
eventually catch up, once device comes back online and in the presence of
PMU queries.

Also, we have to be careful not to overshoot the RC6 estimate, so once
resumed after a period of approximation, we only update the counter once
it catches up. With the observation that RC6 is increasing while the
device is suspended, this should not pose a problem and can only cause
slight inaccuracies due clock base differences.

v2: Simplify by estimating on top of PM core counters. (Imre)

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104943
Fixes: 6060b6aec0 ("drm/i915/pmu: Add RC6 residency metrics")
Testcase: igt/perf_pmu/rc6-runtime-pm
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: David Airlie <airlied@linux.ie>
Cc: intel-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20180206183311.17924-1-tvrtko.ursulin@linux.intel.com
2018-02-07 13:37:34 +00:00
..
accessibility
acpi Merge branch 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm 2017-12-23 13:47:22 -08:00
amba
android binder: fix proc->files use-after-free 2017-12-18 15:47:12 +01:00
ata
atm
auxdisplay
base Linux 4.15-rc8 2018-01-18 09:32:15 +10:00
bcma
block Two rbd fixes for 4.12 and 4.2 issues respectively, marked for stable. 2018-01-11 16:57:32 -08:00
bluetooth
bus Allwinner fixes for 4.15 2018-01-04 17:06:25 +01:00
cdrom
char - Fix documentation build issues (Randy, Markus) 2017-12-21 11:08:30 +10:00
clk clk: use atomic runtime pm api in clk_core_is_enabled 2017-12-26 17:34:03 -08:00
clocksource
connector
cpufreq cpufreq: governor: Ensure sufficiently large sampling intervals 2017-12-18 12:09:39 +01:00
cpuidle
crypto crypto: inside-secure - do not use areq->result for partial results 2017-12-22 19:48:01 +11:00
dax
dca
devfreq
dio
dma dmaengine: fsl-edma: disable clks on all error paths 2017-12-15 09:53:04 +05:30
dma-buf
edac
eisa
extcon
firewire
firmware efi/capsule-loader: Reinstate virtual capsule mapping 2018-01-03 13:54:31 +01:00
fmc
fpga
fsi
gpio gpio: Add missing open drain/source handling to gpiod_set_value_cansleep() 2018-01-10 14:17:17 +01:00
gpu drm/i915/pmu: Fix sleep under atomic in RC6 readout 2018-02-07 13:37:34 +00:00
hid Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid 2017-12-30 10:16:51 -08:00
hsi
hv vmbus: unregister device_obj->channels_kset 2017-12-18 15:47:12 +01:00
hwmon hwmon: Deal with errors from the thermal subsystem 2017-12-26 11:53:24 -08:00
hwspinlock
hwtracing
i2c i2c: piix4: Fix port number check on release 2017-12-12 23:27:04 +01:00
ide
idle
iio
infiniband Fourth pull request for 4.15-rc 2018-01-08 16:17:31 -08:00
input Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2018-01-05 16:45:06 -08:00
iommu iommu/arm-smmu-v3: Cope with duplicated Stream IDs 2018-01-02 16:45:51 +00:00
ipack
irqchip genirq/irqdomain: Rename early argument of irq_domain_activate_irq() 2017-12-29 21:13:04 +01:00
isdn
leds leds: core: Fix regression caused by commit 2b83ff96f5 2018-01-07 13:27:07 +01:00
lightnvm
macintosh
mailbox
mcb
md locking/barriers: Convert users of lockless_dereference() to READ_ONCE() 2017-12-17 13:57:15 +01:00
media Linux 4.15-rc4 2017-12-19 21:37:24 +10:00
memory
memstick
message
mfd mfd: rtsx: Release IRQ during shutdown 2018-01-05 11:14:57 +00:00
misc Merge branch 'WIP.x86-pti.base.prep-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-12-17 13:54:31 -08:00
mmc mmc: s3mci: mark debug_regs[] as static 2018-01-04 12:42:31 +01:00
mtd mtd: nand: pxa3xx: Fix READOOB implementation 2018-01-06 23:06:58 +01:00
mux mux: core: fix double get_device() 2018-01-09 14:19:41 +01:00
net mlxsw: spectrum_qdisc: Don't use variable array in mlxsw_sp_tclass_congestion_enable 2018-01-10 15:58:23 -05:00
nfc
ntb
nubus
nvdimm libnvdimm, btt: Fix an incompatibility in the log layout 2017-12-21 14:59:27 -08:00
nvme nvme-fabrics: initialize default host->id in nvmf_host_default() 2018-01-08 10:52:03 +01:00
nvmem nvmem: meson-mx-efuse: fix reading from an offset other than 0 2017-12-23 16:46:23 +01:00
of of_mdio: avoid MDIO bus removal when a PHY is missing 2018-01-10 15:07:47 -05:00
opp
oprofile
parisc parisc: Show unhashed EISA EEPROM address 2018-01-02 21:01:02 +01:00
parport
pci Merge branch 'x86/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-12-31 13:13:56 -08:00
pcmcia
perf
phy phy: rcar-gen3-usb2: select USB_COMMON 2017-12-15 16:00:41 +05:30
pinctrl genirq/irqdomain: Rename early argument of irq_domain_activate_irq() 2017-12-29 21:13:04 +01:00
platform platform/x86: wmi: Call acpi_wmi_init() later 2018-01-08 10:47:48 -08:00
pnp
power
powercap
pps
ps3
ptp
pwm
rapidio
ras
regulator
remoteproc
reset
rpmsg
rtc
s390 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2018-01-05 12:17:33 -08:00
sbus
scsi SCSI fixes on 20171230 2017-12-30 14:31:30 -08:00
sfi
sh
sn
soc
spi Merge remote-tracking branches 'spi/fix/armada', 'spi/fix/atmel', 'spi/fix/doc', 'spi/fix/imx', 'spi/fix/rspi', 'spi/fix/sun4i' and 'spi/fix/xilinx' into spi-linus 2017-12-19 11:07:00 +00:00
spmi
ssb
staging Linux 4.15-rc8 2018-01-18 09:32:15 +10:00
target block: fix blk_rq_append_bio 2017-12-18 13:55:43 -07:00
tc
tee
thermal
thunderbolt thunderbolt: Mask ring interrupt properly when polling starts 2017-12-16 16:37:51 +01:00
tty n_tty: fix EXTPROC vs ICANON interaction with TIOCINQ (aka FIONREAD) 2017-12-21 11:19:22 +01:00
uio
usb usb: misc: usb3503: make sure reset is low for at least 100us 2018-01-11 18:39:52 +01:00
uwb
vfio
vhost
video omapdrm: panel: td028ttec1: replace MODULE_ALIAS by MODULE_DEVICE_TABLE 2017-12-19 10:32:00 +02:00
virt
virtio virtio_mmio: fix devm cleanup 2017-12-14 21:01:40 +02:00
vlynq
vme
w1
watchdog
xen xen: fixes for 4.15-rc8 2018-01-12 10:00:15 -08:00
zorro
Kconfig
Makefile