[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v1 1/2] physmem: Bail out qemu_ram_block_from_host() for invalid ram addrs
- To: Alex Bennée <alex.bennee@xxxxxxxxxx>
- From: "Edgar E. Iglesias" <edgar.iglesias@xxxxxxxxx>
- Date: Thu, 4 Jul 2024 14:42:25 +0300
- Cc: qemu-devel@xxxxxxxxxx, sstabellini@xxxxxxxxxx, anthony@xxxxxxxxxxxxxx, paul@xxxxxxx, edgar.iglesias@xxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, Paolo Bonzini <pbonzini@xxxxxxxxxx>, Peter Xu <peterx@xxxxxxxxxx>, David Hildenbrand <david@xxxxxxxxxx>, Philippe Mathieu-Daudé <philmd@xxxxxxxxxx>
- Delivery-date: Thu, 04 Jul 2024 11:42:47 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
"Edgar E. Iglesias" <edgar.iglesias@xxxxxxxxx> writes:
> From: "Edgar E. Iglesias" <edgar.iglesias@xxxxxxx>
>
> Bail out in qemu_ram_block_from_host() when
> xen_ram_addr_from_mapcache() does not find an existing
> mapping.
>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xxxxxxx>
> ---
> system/physmem.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/system/physmem.c b/system/physmem.c
> index 33d09f7571..59d1576c2b 100644
> --- a/system/physmem.c
> +++ b/system/physmem.c
> @@ -2277,6 +2277,10 @@ RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset,
> ram_addr_t ram_addr;
> RCU_READ_LOCK_GUARD();
> ram_addr = xen_ram_addr_from_mapcache(ptr);
> + if (ram_addr == RAM_ADDR_INVALID) {
> + return NULL;
> + }
> +
Isn't this indicative of a failure? Should there at least be a trace
point for failed mappings?
Yes but there are already trace points for the failure cases inside xen_ram_addr_from_mapcache(). Do those address your concerns or do you think we need additional trace points?
Cheers, Edgar
> block = qemu_get_ram_block(ram_addr);
> if (block) {
> *offset = ram_addr - block->offset;
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
|