On 5/20/25 1:44 PM, Julian Ganz wrote:
Hi Pierrick,

May 20, 2025 at 10:01 PM, Pierrick Bouvier wrote:
Regarding the issue with the same tb being mapped at different virtual 
addresses, I'm ok with the current solution of comparing only page bits.

That said, a better solution could be to compare physical addresses when a 
discon is detected (on plugin side), and confirm it's really a discontinuity or 
just a different mapping. With this approach, it's not even needed to have a 
dedicated option, and there would be no false positive in the plugin. It's just 
a suggestion though.

I actually tried to do this before resorting to the current appraoch.
However, there is only API for querying an instruction's or TB's
hardware address and none that would let me translate the virtual
addresses we receive in the discon callback, which we need to compare
against.


It would be acceptable to add such a function allowing to query physical address for a virtual address (using cpu_get_phys_page_debug behind the hoods), as it's not leaking any QEMU implementation detail.

We can implement this later if you don't want to extend your series with this.

I considered also passing the hardware address to the callback (do the
translation in the `plugin_vcpu_cb__discon` hook), but that turned out
to be not straight forward and not something we'd want to do in the
hook, either.


Yes, in some cases, people will want virtual addresses, and sometimes physical ones. So passing physical ones only is too restrictive.

This plugin is a bit specific, as it's explicitely tracking all transitions between instructions, where a "normal" plugin will just work with discontinuities. That said, the use case to get physical address from a virtual one is a real need.

Regards,
Julian

Regards,
Pierrick

Reply via email to