77a132ea7e
First up: This is not the way the hardware behaves. However, it helps resolve real-world problems with short periods being used under Linux. Commit 4451d3f59f2a ("clocksource/drivers/fttmr010: Fix set_next_event handler") in Linux fixed the timer driver to correctly schedule the next event for the Aspeed controller, and in combination with 5daa8212c08e ("ARM: dts: aspeed: Describe random number device") Linux will now set a timer with a period as low as 1us. Configuring a qemu timer with such a short period results in spending time handling the interrupt in the model rather than executing guest code, leading to noticeable "sticky" behaviour in the guest. The behaviour of Linux is correct with respect to the hardware, so we need to improve our handling under emulation. The approach chosen is to provide back-pressure information by calculating an acceptable minimum number of ticks to be set on the model. Under Linux an additional read is added in the timer configuration path to detect back-pressure, which will never occur on hardware. However if back-pressure is observed, the driver alerts the clock event subsystem, which then performs its own next event dilation via a config option - d1748302f70b ("clockevents: Make minimum delay adjustments configurable") A minimum period of 5us was experimentally determined on a Lenovo T480s, which I've increased to 20us for "safety". Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Reviewed-by: Joel Stanley <joel@jms.id.au> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Tested-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Cédric Le Goater <clg@kaod.org> Message-id: 20190704055150.4899-1-clg@kaod.org [clg: - changed the computation of min_ticks to be done each time the timer value is reloaded. It removes the ordering issue of the timer and scu reset handlers but is slightly slower ] - introduced TIMER_MIN_NS - introduced calculate_min_ticks() ] Signed-off-by: Cédric Le Goater <clg@kaod.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
||
---|---|---|
.. | ||
a9gtimer.c | ||
allwinner-a10-pit.c | ||
altera_timer.c | ||
arm_mptimer.c | ||
arm_timer.c | ||
armv7m_systick.c | ||
aspeed_rtc.c | ||
aspeed_timer.c | ||
cadence_ttc.c | ||
cmsdk-apb-dualtimer.c | ||
cmsdk-apb-timer.c | ||
digic-timer.c | ||
ds1338.c | ||
etraxfs_timer.c | ||
exynos4210_mct.c | ||
exynos4210_pwm.c | ||
exynos4210_rtc.c | ||
grlib_gptimer.c | ||
hpet.c | ||
i8254_common.c | ||
i8254.c | ||
imx_epit.c | ||
imx_gpt.c | ||
Kconfig | ||
lm32_timer.c | ||
m41t80.c | ||
m48t59-internal.h | ||
m48t59-isa.c | ||
m48t59.c | ||
Makefile.objs | ||
mc146818rtc.c | ||
milkymist-sysctl.c | ||
mips_gictimer.c | ||
mss-timer.c | ||
nrf51_timer.c | ||
omap_gptimer.c | ||
omap_synctimer.c | ||
pl031.c | ||
puv3_ost.c | ||
pxa2xx_timer.c | ||
sh_timer.c | ||
slavio_timer.c | ||
stm32f2xx_timer.c | ||
sun4v-rtc.c | ||
trace-events | ||
twl92230.c | ||
xilinx_timer.c | ||
xlnx-zynqmp-rtc.c |