mirror of
https://git.proxmox.com/git/pve-qemu
synced 2025-08-24 18:19:16 +00:00

As reported in the community forum [0][1], QEMU processes for Linux guests would consume more CPU on the host after an update to QEMU 9.2. The issue was reproduced and bisecting pointed to QEMU commit f0ccf77078 ("hpet: fix and cleanup persistence of interrupt status"). Some quick experimentation suggests that in particular the last part is responsible for the issue: > - the timer must be kept running even if not enabled, in > order to set the ISR flag, so writes to HPET_TN_CFG must > not call hpet_del_timer() Users confirmed that setting the hpet=off machine flag works around the issue[0]. For Windows (7 or later) guests, the flag is already disabled, because of issues in the past [2]. Upstream suggested reverting the relevant patches for now [3], because other issues were reported too. All except commit 5895879aca ("hpet: remove unnecessary variable "index"") are actually dependent on each other for cleanly reverting f0ccf77078, and while not strictly required, that one was reverted too for completeness. [0]: https://forum.proxmox.com/threads/163694/ [1]: https://forum.proxmox.com/threads/161849/post-756793 [2]: https://lists.proxmox.com/pipermail/pve-devel/2012-December/004958.html [3]: https://lore.kernel.org/qemu-devel/CABgObfaKJ5NFVKmYLFmu4C0iZZLJJtcWksLCzyA0tBoz0koZ4A@mail.gmail.com/ Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
65 lines
2.6 KiB
Diff
65 lines
2.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Fiona Ebner <f.ebner@proxmox.com>
|
|
Date: Wed, 19 Mar 2025 17:31:10 +0100
|
|
Subject: [PATCH] Revert "hpet: place read-only bits directly in "new_val""
|
|
|
|
This reverts commit ba88935b0fac2588b0a739f810b58dfabf7f92c8.
|
|
|
|
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
|
|
---
|
|
hw/timer/hpet.c | 15 ++++++++-------
|
|
1 file changed, 8 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c
|
|
index e1ac877759..b12bbaf10d 100644
|
|
--- a/hw/timer/hpet.c
|
|
+++ b/hw/timer/hpet.c
|
|
@@ -510,7 +510,7 @@ static void hpet_ram_write(void *opaque, hwaddr addr,
|
|
{
|
|
int i;
|
|
HPETState *s = opaque;
|
|
- uint64_t old_val, new_val, cleared;
|
|
+ uint64_t old_val, new_val, val;
|
|
|
|
trace_hpet_ram_write(addr, value);
|
|
old_val = hpet_ram_read(opaque, addr, 4);
|
|
@@ -536,12 +536,13 @@ static void hpet_ram_write(void *opaque, hwaddr addr,
|
|
*/
|
|
update_irq(timer, 0);
|
|
}
|
|
- new_val = hpet_fixup_reg(new_val, old_val, HPET_TN_CFG_WRITE_MASK);
|
|
- timer->config = (timer->config & 0xffffffff00000000ULL) | new_val;
|
|
+ val = hpet_fixup_reg(new_val, old_val, HPET_TN_CFG_WRITE_MASK);
|
|
+ timer->config = (timer->config & 0xffffffff00000000ULL) | val;
|
|
if (activating_bit(old_val, new_val, HPET_TN_ENABLE)
|
|
&& (s->isr & (1 << timer_id))) {
|
|
update_irq(timer, 1);
|
|
}
|
|
+
|
|
if (new_val & HPET_TN_32BIT) {
|
|
timer->cmp = (uint32_t)timer->cmp;
|
|
timer->period = (uint32_t)timer->period;
|
|
@@ -622,8 +623,8 @@ static void hpet_ram_write(void *opaque, hwaddr addr,
|
|
case HPET_ID:
|
|
return;
|
|
case HPET_CFG:
|
|
- new_val = hpet_fixup_reg(new_val, old_val, HPET_CFG_WRITE_MASK);
|
|
- s->config = (s->config & 0xffffffff00000000ULL) | new_val;
|
|
+ val = hpet_fixup_reg(new_val, old_val, HPET_CFG_WRITE_MASK);
|
|
+ s->config = (s->config & 0xffffffff00000000ULL) | val;
|
|
if (activating_bit(old_val, new_val, HPET_CFG_ENABLE)) {
|
|
/* Enable main counter and interrupt generation. */
|
|
s->hpet_offset =
|
|
@@ -657,9 +658,9 @@ static void hpet_ram_write(void *opaque, hwaddr addr,
|
|
trace_hpet_invalid_hpet_cfg(4);
|
|
break;
|
|
case HPET_STATUS:
|
|
- cleared = new_val & s->isr;
|
|
+ val = new_val & s->isr;
|
|
for (i = 0; i < s->num_timers; i++) {
|
|
- if (cleared & (1 << i)) {
|
|
+ if (val & (1 << i)) {
|
|
update_irq(&s->timer[i], 0);
|
|
}
|
|
}
|