]> git.ipfire.org Git - thirdparty/qemu.git/commit
hw/ppc: Fix clock update drift
authorNicholas Piggin <npiggin@gmail.com>
Thu, 29 Jun 2023 02:07:13 +0000 (12:07 +1000)
committerDaniel Henrique Barboza <danielhb413@gmail.com>
Fri, 7 Jul 2023 07:18:26 +0000 (04:18 -0300)
commit2ad2e113deb5663e69a05dd6922cbfc6d7ea34d3
treed0feab9444b294d4702f5fc34601e319a3f855ed
parenta5ff7875a9e50180c354471f931f863a26283ce1
hw/ppc: Fix clock update drift

The clock update logic reads the clock twice to compute the new clock
value, with a value derived from the later time subtracted from a value
derived from the earlier time. The delta causes time to be lost.

This can ultimately result in time becoming unsynchronized between CPUs
and that can cause OS lockups, timeouts, watchdogs, etc. This can be
seen running a KVM guest (that causes lots of TB updates) on a powernv
SMP machine.

Fix this by reading the clock once.

Cc: qemu-stable@nongnu.org
Fixes: dbdd25065e90 ("Implement time-base start/stop helpers.")
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>
Message-ID: <20230629020713.327745-1-npiggin@gmail.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
hw/ppc/ppc.c