timer.h: Provide better monotonic time
PATCH 1/1 timer.h: Provide better monotonic time
Tested and confirmed that the stretch i386 debian qcow2 image on a raspberry pi 2 works.
--- include/qemu/timer.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
include/qemu/timer.h +2 -3
@@ -1020,10 +1020,9 @@ static inline int64_t cpu_get_host_ticks(void)/* The host CPU doesn't have an easily accessible cycle counter. Just return a monotonically increasing value. This will be totally wrong, but hopefully better than nothing. */ -static inline int64_t cpu_get_host_ticks (void ) +static inline int64_t cpu_get_host_ticks (void ) { -static int64_t ticks =0 ; -return ticks++; +return get_clock (); }#endif
Signature · 1 line
2.11.0
Quoted 15 lines · Pranith Kumar
Tested and confirmed that the stretch i386 debian qcow2 image on a raspberry pi 2 works.
Fixes LP#: 893208 <https://bugs.launchpad.net/qemu/+bug/893208/>Signed-off-by Pranith Kumar <[email protected]>--- include/qemu/timer.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)include/qemu/timer.h +0
-0@@ -1020,10 +1020,9 @@ static inline int64_t cpu_get_host_ticks(void)/* The host CPU doesn't have an easily accessible cycle counter.
include/qemu/timer.h static inline int64_t cpu_get_host_ticks(void) · line 1027
Quoted 10 lines
include/qemu/timer.h +2
-3Just return a monotonically increasing value. This will be totally wrong, but hopefully better than nothing. */ -static inline int64_t cpu_get_host_ticks (void ) +static inline int64_t cpu_get_host_ticks (void ) { -static int64_t ticks =0 ; -return ticks++; +return get_clock (); }#endif
Hmm, it looks like this patch got lost. Paolo, did you want to give it a reviewed-by? From the discussion on v1 it sounded like you had the best grip on the timer code ;-)
(Does the comment on the function need updating ?)
thanks
-- PMM
Paolo Bonzini
Reviewed-byQuoted 22 lines · Peter Maydell
Quoted 21 lines · Pranith Kumar
Tested and confirmed that the stretch i386 debian qcow2 image on a raspberry pi 2 works.
Fixes LP#: 893208 <https://bugs.launchpad.net/qemu/+bug/893208/>Signed-off-by Pranith Kumar <[email protected]>--- include/qemu/timer.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)include/qemu/timer.h +1
-2@@ -1020,10 +1020,9 @@ static inline int64_t cpu_get_host_ticks(void)/* The host CPU doesn't have an easily accessible cycle counter. Just return a monotonically increasing value. This will be totally wrong, but hopefully better than nothing. */ -static inline int64_t cpu_get_host_ticks (void ) +static inline int64_t cpu_get_host_ticks (void ) { -static int64_t ticks =0 ;
Quoted 8 lines
include/qemu/timer.h static inline int64_t cpu_get_host_ticks(void) · line 1027
Quoted 4 lines
include/qemu/timer.h +1
-1- return ticks++; + return get_clock(); }#endif Hmm, it looks like this patch got lost. Paolo, did you want to give it a reviewed-by? From the discussion on v1 it sounded like you had the best grip on the timer code ;-)
Sure:
Quoted 1 line
(Does the comment on the function need updating ?)
Apart from "totally", it's still pretty correct. :)
Thanks,
Paolo
Quoted 34 lines · Paolo Bonzini
Quoted 22 lines · Peter Maydell
Quoted 21 lines · Pranith Kumar
Tested and confirmed that the stretch i386 debian qcow2 image on a raspberry pi 2 works.
Fixes LP#: 893208 <https://bugs.launchpad.net/qemu/+bug/893208/>Signed-off-by Pranith Kumar <[email protected]>--- include/qemu/timer.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)include/qemu/timer.h +1
-2@@ -1020,10 +1020,9 @@ static inline int64_t cpu_get_host_ticks(void)/* The host CPU doesn't have an easily accessible cycle counter. Just return a monotonically increasing value. This will be totally wrong, but hopefully better than nothing. */ -static inline int64_t cpu_get_host_ticks (void ) +static inline int64_t cpu_get_host_ticks (void ) { -static int64_t ticks =0 ;Quoted 8 lines
include/qemu/timer.h static inline int64_t cpu_get_host_ticks(void) · line 1027
Quoted 4 lines
include/qemu/timer.h +1
-1- return ticks++; + return get_clock(); }#endif Hmm, it looks like this patch got lost. Paolo, did you want to give it a reviewed-by? From the discussion on v1 it sounded like you had the best grip on the timer code ;-)
Quoted 7 lines
Sure:
Reviewed-by Paolo Bonzini <[email protected]>Quoted 1 line
(Does the comment on the function need updating ?)
Apart from "totally", it's still pretty correct. :)
Thanks. I'll apply this to my arm queue since in practice only ARM hosts are affected by this change.
-- PMM