qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] util/qemu-timer.c: Don't warp timer from timerlist_rearm()


From: Richard Henderson
Subject: Re: [PATCH] util/qemu-timer.c: Don't warp timer from timerlist_rearm()
Date: Mon, 10 Feb 2025 10:02:23 -0800
User-agent: Mozilla Thunderbird

On 2/10/25 06:08, Peter Maydell wrote:
On Mon, 10 Feb 2025 at 13:58, Peter Maydell <peter.maydell@linaro.org> wrote:

Currently we call icount_start_warp_timer() from timerlist_rearm().
This produces incorrect behaviour, because timerlist_rearm() is
called, for instance, when a timer callback modifies its timer.  We
cannot decide here to warp the timer forwards to the next timer
deadline merely because all_cpu_threads_idle() is true, because the
timer callback we were called from (or some other callback later in
the list of callbacks being invoked) may be about to raise a CPU
interrupt and move a CPU from idle to ready.5A

(oops, stray editor damage "5A" at end of line)


The only valid place to choose to warp the timer forward is from the
main loop, when we know we have no outstanding IO or timer callbacks
that might be about to wake up a CPU.

This raises actually another question: should the call to
icount_start_warp_timer() in main_loop_wait() maybe go after
qemu_clock_run_all_timers() rather than before? (Haven't tested
whether that breaks anything ;-))

It seems likely.  :-)


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]