* Re: [PATCH] accel/tcg/icount-common: Consolidate the use of warn_report_once()
2024-04-18 10:07 [PATCH] accel/tcg/icount-common: Consolidate the use of warn_report_once() Zhao Liu
@ 2024-04-18 10:06 ` Paolo Bonzini
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2024-04-18 10:06 UTC (permalink / raw)
To: Zhao Liu; +Cc: Richard Henderson, qemu-devel, Zhao Liu
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH] accel/tcg/icount-common: Consolidate the use of warn_report_once()
@ 2024-04-18 10:07 Zhao Liu
2024-04-18 10:06 ` Paolo Bonzini
0 siblings, 1 reply; 2+ messages in thread
From: Zhao Liu @ 2024-04-18 10:07 UTC (permalink / raw)
To: Richard Henderson, Paolo Bonzini; +Cc: qemu-devel, Zhao Liu
From: Zhao Liu <zhao1.liu@intel.com>
Use warn_report_once() to get rid of the static local variable "notified".
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
Note: After cleaning up similar uses in x86, only icount-common.c and
virtio-mem.c still have "only once" usage with static variables.
However, virtio-mem.c uses warn_report_err() and has no associated
*_err_once variant, so it does not need to be cleaned up.
---
accel/tcg/icount-common.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/accel/tcg/icount-common.c b/accel/tcg/icount-common.c
index a4a747d1dc99..8d3d3a7e9dc9 100644
--- a/accel/tcg/icount-common.c
+++ b/accel/tcg/icount-common.c
@@ -336,10 +336,8 @@ void icount_start_warp_timer(void)
deadline = qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL,
~QEMU_TIMER_ATTR_EXTERNAL);
if (deadline < 0) {
- static bool notified;
- if (!icount_sleep && !notified) {
- warn_report("icount sleep disabled and no active timers");
- notified = true;
+ if (!icount_sleep) {
+ warn_report_once("icount sleep disabled and no active timers");
}
return;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-04-18 10:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-18 10:07 [PATCH] accel/tcg/icount-common: Consolidate the use of warn_report_once() Zhao Liu
2024-04-18 10:06 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).