[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 06/11] cputlb: ensure we save the IOTLB data in case of r
From: |
Emilio G. Cota |
Subject: |
Re: [PATCH v2 06/11] cputlb: ensure we save the IOTLB data in case of reset |
Date: |
Sat, 18 Jul 2020 16:51:07 -0400 |
On Mon, Jul 13, 2020 at 21:04:10 +0100, Alex Bennée wrote:
> Any write to a device might cause a re-arrangement of memory
> triggering a TLB flush and potential re-size of the TLB invalidating
> previous entries. This would cause users of qemu_plugin_get_hwaddr()
> to see the warning:
>
> invalid use of qemu_plugin_get_hwaddr
>
> because of the failed tlb_lookup which should always succeed. To
> prevent this we save the IOTLB data in case it is later needed by a
> plugin doing a lookup.
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
(snip)
> +/*
> + * Save a potentially trashed IOTLB entry for later lookup by plugin.
> + *
> + * We also need to track the thread storage address because the RCU
> + * cleanup that runs when we leave the critical region (the current
> + * execution) is actually in a different thread.
As I mentioned in the previous iteration of this series, this comment is
outdated -- there is no thread storage nor RCU to worry about here.
> + * This almost never fails as the memory access being instrumented
> + * should have just filled the TLB. The one corner case is io_writex
> + * which can cause TLB flushes and potential resizing of the TLBs
> + * loosing the information we need. In those cases we need to recover
> + * data from a copy of the io_tlb entry.
> */
s/loosing/losing/
About the approach in this patch: it works as long as the caller is in
the same vCPU thread, otherwise we'd need a seqlock to avoid races
between readers and the writing vCPU. I see that qemu_plugin_get_hwaddr
does not even take a vCPU index, so this should be OK -- as long as this
is called only from a mem callback, it's in the same vCPU thread and it's
therefore safe.
With the above comments fixed,
Reviewed-by: Emilio G. Cota <cota@braap.org>
Thanks,
Emilio
- [PATCH v2 00/11] misc fixes for rc0 (docker, plugins, softfloat), Alex Bennée, 2020/07/13
- [PATCH v2 04/11] fpu/softfloat: fix up float16 nan recognition, Alex Bennée, 2020/07/13
- [PATCH v2 02/11] tests/docker: Remove the libssh workaround from the ubuntu 20.04 image, Alex Bennée, 2020/07/13
- [PATCH v2 01/11] configure: remove all dependencies on a (re)configure, Alex Bennée, 2020/07/13
- [PATCH v2 03/11] docker.py: fix fetching of FROM layers, Alex Bennée, 2020/07/13
- [PATCH v2 06/11] cputlb: ensure we save the IOTLB data in case of reset, Alex Bennée, 2020/07/13
- [PATCH v2 05/11] tests/plugins: don't unconditionally add -Wpsabi, Alex Bennée, 2020/07/13
- [PATCH v2 08/11] docs/devel: fix grammar in multi-thread-tcg, Alex Bennée, 2020/07/13
- [PATCH v2 10/11] plugins: add API to return a name for a IO device, Alex Bennée, 2020/07/13
- [PATCH v2 09/11] hw/virtio/pci: include vdev name in registered PCI sections, Alex Bennée, 2020/07/13