On 2026/10/07 18:30, Philippe Mathieu-Daudé wrote:
From: Mark Burton <[email protected]>
Dirty-page logging handles a RAM write fault by marking the page dirty,
restoring write permission, and retrying the guest instruction.
The handler also retried when the resolved RAM region had no dirty-log
client. This path neither restores permission nor advances the PC, so
the instruction can repeatedly exit to QEMU.
Retry only after marking the page dirty and restoring write permission.
Otherwise, use the existing emulation path to complete the access and
advance the guest PC.
I can identify three cases of RAM write faults. The existing code
handles all three, but this patch breaks the third:
1. The RAM is read-only. assert(!mr->readonly) trips in this case.
2. Dirty logging is enabled. The vCPU marks the page dirty, restores
write permission, and retries the write.
3. Dirty logging is enabled when the fault occurs, but another thread
disables it before the vCPU acquires the BQL. The vCPU then observes
a zero dirty-log mask. The write still needs to be retried because
write permission has already been restored. The existing code does
this correctly, but this patch falls through to emulation instead.
This patch is useful only if there is another case that the existing
code does not handle correctly. Please describe that case and preserve
the retry behavior in case 3.
Regards,
Akihiko Odaki