]> xenbits.xensource.com Git - qemu-xen.git/commit
hw/ppc: Fix clock update drift
authorNicholas Piggin <npiggin@gmail.com>
Thu, 29 Jun 2023 02:07:13 +0000 (12:07 +1000)
committerMichael Tokarev <mjt@tls.msk.ru>
Mon, 17 Jul 2023 11:23:05 +0000 (14:23 +0300)
commit73d6ac24c81f1aeae554d469616c9181511e6523
tree1f7b364f01a2cb05e60d904138f81bdd52d7f9ea
parent720db12b8b08874fb2e83f6c039b72cad1f11b16
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>
(cherry picked from commit 2ad2e113deb5663e69a05dd6922cbfc6d7ea34d3)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
hw/ppc/ppc.c