qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] hw/timer: fix int underflow


From: Paolo Bonzini
Subject: Re: [PATCH] hw/timer: fix int underflow
Date: Tue, 14 Jan 2025 11:40:06 +0100
User-agent: Mozilla Thunderbird

On 1/14/25 11:14, Peter Maydell wrote:
So, to my opinion, explicit cast to "long long" is necessary
here to get the expected behavior.

I wasn't saying the existing code was necessarily correct,
or that your proposed change was necessarily wrong.
I was saying your patch didn't come with any analysis of
what the actual hardware behaviour is, which is
how you would determine whether the fix you propose
is the correct one, or if it should be some other
change instead. (Some of my response was trying to
provide some of that analysis.)
I would say that the patch is more or less obvious in the sense that the intent of the code is to model a counter (which counts up by 1 and cannot miss a step) with a timer within a process that could be preempted. You probably will not find an answer in the datasheet, other than by analyzing the signal diagrams, because this scenario simply cannot exist with a hardware counter.

However, the patch has another problem, which is that it can cause a stack overflow at imx_gpt_compute_next_timeout(s, event).

Paolo




reply via email to

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