|
From: | Mark Cave-Ayland |
Subject: | Re: [RFC 00/10] hw/mos6522: VIA timer emulation fixes and improvements |
Date: | Wed, 1 Sep 2021 08:57:26 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 |
On 31/08/2021 23:44, Finn Thain wrote:
You mentioned that the OS may compensate for the fact that the 6522 doesn't have an overflow flag: can you explain more as to how this works in Linux? Is the problem here that even if you read the counter value in the interrupt handler to work out the latency, the counter may still have already wrapped?Unbounded interrupt latency means that the guest kernel can not tell how many times the timer counter wrapped between timer interrupts. There will always be a race condition in the guest kernel. It's possible to code around this in the kernel with a ratchet to prevent backwards movement in the clocksource counter (I had to do something similar for the Atari clocksource driver) but that would address only one symptom. And that kind of hack certainly doesn't help any other guest operating system that's adversely affected by QEMU's design limitations (which is behavioural simulation rather than gate-level simulation). This patch series doesn't solve the timer problem but it does improve the situation (for the reasons given in the cover letter).
I had a quick look at your via-timer branch at https://github.com/fthain/qemu/commits/via-timer and spotted that your work is based upon the v6.0 release. Before digging further into this, can you try using vanilla git master or the v6.1 tag instead as there are a couple of related fixes from the 6.1 development cycle that you are missing:
82ff856fe7 ("mac_via: fix 60Hz VIA1 timer interval")- This fixed the 60Hz VIA1 timer interval (it was running 100x too fast) and so could limit the virtual CPUs ability to process the 100Hz timer.
30ca7eddc4 ("mac_via: remove VIA1 timer optimisations")- This fixed an issue whereby constant writes to portB would reset the 60Hz VIA1 timer and 1Hz VIA1 timer (Probably not relevant here, but worth having).
ATB, Mark.
[Prev in Thread] | Current Thread | [Next in Thread] |