[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 19/50] tcg: let plugins instrument memory acc
From: |
Alex Bennée |
Subject: |
Re: [Qemu-devel] [PATCH v3 19/50] tcg: let plugins instrument memory accesses |
Date: |
Fri, 28 Jun 2019 18:11:08 +0100 |
User-agent: |
mu4e 1.3.2; emacs 26.1 |
Aaron Lindsay OS <address@hidden> writes:
> On Jun 14 18:11, Alex Bennée wrote:
>> From: "Emilio G. Cota" <address@hidden>
>>
>> Here the trickiest feature is passing the host address to
>> memory callbacks that request it. Perhaps it would be more
>> appropriate to pass a "physical" address to plugins, but since
>> in QEMU host addr ~= guest physical, I'm going with that for
>> simplicity.
>
> How much more difficult would it be to get the true physical address (on
> the guest)?
Previously there was a helper that converted host address (i.e. where
QEMU actually stores that value) back to the physical address (ram
offset + ram base). However the code for calculating all of this is
pretty invasive and requires tweaks to all the softmmu TCG backends as
well as hooks into a slew of memory functions.
I'm re-working this now so we just have the one memory callback and we
provide a helper function that can provide an opaque hwaddr struct which
can then be queried. The catch is you can only call this helper during a
memory callback. I'm not sure if having this restriction violates our
aim of not leaking implementation details to the plugin but it makes the
code simpler.
Internally what the helper does is simply re-query the SoftMMU TLB. As
the TLBs are per-CPU nothing else can have touched the TLB and the cache
should be hot so the cost of lookup should be minor. We could also
potentially expand the helpers so if you are interested in only IO
accesses we can do the full resolution and figure out what device we
just accessed.
> This is important enough to me that I would be willing to help if
> pointed in the right direction.
Well I'll certainly CC on the next series (hopefully posted Monday,
softfreeze starts Tuesday). I'll welcome any testing and review. Also if
you can tell us more about your use case that will help.
>
> -Aaron
--
Alex Bennée
- [Qemu-devel] [PATCH v3 39/50] vl: support -plugin option, (continued)
- [Qemu-devel] [PATCH v3 39/50] vl: support -plugin option, Alex Bennée, 2019/06/14
- [Qemu-devel] [PATCH v3 38/50] plugin: add API symbols to qemu-plugins.symbols, Alex Bennée, 2019/06/14
- [Qemu-devel] [PATCH v3 47/50] accel/stubs: reduce headers from tcg-stub, Alex Bennée, 2019/06/14
- [Qemu-devel] [PATCH v3 30/50] target/hppa: fetch code with translator_ld, Alex Bennée, 2019/06/14
- [Qemu-devel] [PATCH v3 19/50] tcg: let plugins instrument memory accesses, Alex Bennée, 2019/06/14
[Qemu-devel] [PATCH v3 15/50] tcg: add MO_HADDR to TCGMemOp, Alex Bennée, 2019/06/14
[Qemu-devel] [PATCH v3 37/50] translator: inject instrumentation from plugins, Alex Bennée, 2019/06/14
[Qemu-devel] [PATCH v3 13/50] plugin-gen: add module for TCG-related code, Alex Bennée, 2019/06/14
[Qemu-devel] [PATCH v3 25/50] translator: add translator_ld{ub, sw, uw, l, q}, Alex Bennée, 2019/06/14