From: Anthony PERARD <anthony.perard@vates.tech>
To: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
Cc: qemu-devel@nongnu.org, sstabellini@kernel.org, jgross@suse.com,
"Edgar E. Iglesias" <edgar.iglesias@amd.com>,
Paul Durrant <paul@xen.org>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH v8 2/8] xen: mapcache: Unmap first entries in buckets
Date: Mon, 01 Jul 2024 12:55:30 +0000 [thread overview]
Message-ID: <ZoKnQLBwIwh004yy@l14> (raw)
In-Reply-To: <20240529140739.1387692-3-edgar.iglesias@gmail.com>
Hi all,
Following this commit, a test which install Debian in a guest with OVMF
as firmware started to fail. QEMU exit with an error when GRUB is
running on the freshly installed Debian (I don't know if GRUB is
starting Linux or not).
The error is:
Bad ram offset ffffffffffffffff
Some logs:
http://logs.test-lab.xenproject.org/osstest/logs/186611/test-amd64-amd64-xl-qemuu-ovmf-amd64/info.html
Any idea? Something is trying to do something with the address "-1" when
it shouldn't?
Cheers,
Anthony
On Wed, May 29, 2024 at 04:07:33PM +0200, Edgar E. Iglesias wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@amd.com>
>
> When invalidating memory ranges, if we happen to hit the first
> entry in a bucket we were never unmapping it. This was harmless
> for foreign mappings but now that we're looking to reuse the
> mapcache for transient grant mappings, we must unmap entries
> when invalidated.
>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
> ---
> hw/xen/xen-mapcache.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/hw/xen/xen-mapcache.c b/hw/xen/xen-mapcache.c
> index bc860f4373..ec95445696 100644
> --- a/hw/xen/xen-mapcache.c
> +++ b/hw/xen/xen-mapcache.c
> @@ -491,18 +491,23 @@ static void xen_invalidate_map_cache_entry_unlocked(MapCache *mc,
> return;
> }
> entry->lock--;
> - if (entry->lock > 0 || pentry == NULL) {
> + if (entry->lock > 0) {
> return;
> }
>
> - pentry->next = entry->next;
> ram_block_notify_remove(entry->vaddr_base, entry->size, entry->size);
> if (munmap(entry->vaddr_base, entry->size) != 0) {
> perror("unmap fails");
> exit(-1);
> }
> +
> g_free(entry->valid_mapping);
> - g_free(entry);
> + if (pentry) {
> + pentry->next = entry->next;
> + g_free(entry);
> + } else {
> + memset(entry, 0, sizeof *entry);
> + }
> }
>
> typedef struct XenMapCacheData {
> --
> 2.40.1
>
>
--
Anthony Perard | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
next prev parent reply other threads:[~2024-07-01 13:14 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-29 14:07 [PATCH v8 0/8] xen: Support grant mappings Edgar E. Iglesias
2024-05-29 14:07 ` [PATCH v8 1/8] xen: mapcache: Make MCACHE_BUCKET_SHIFT runtime configurable Edgar E. Iglesias
2024-06-03 15:57 ` Philippe Mathieu-Daudé
2024-05-29 14:07 ` [PATCH v8 2/8] xen: mapcache: Unmap first entries in buckets Edgar E. Iglesias
2024-07-01 12:55 ` Anthony PERARD [this message]
2024-07-01 13:58 ` Edgar E. Iglesias
2024-07-01 14:30 ` Edgar E. Iglesias
2024-07-01 14:34 ` Edgar E. Iglesias
2024-07-01 16:21 ` Anthony PERARD
2024-07-01 21:28 ` Edgar E. Iglesias
2024-05-29 14:07 ` [PATCH v8 3/8] xen: Add xen_mr_is_memory() Edgar E. Iglesias
2024-05-29 14:07 ` [PATCH v8 4/8] softmmu: xen: Always pass offset + addr to xen_map_cache Edgar E. Iglesias
2024-06-03 15:58 ` Philippe Mathieu-Daudé
2024-05-29 14:07 ` [PATCH v8 5/8] softmmu: Replace check for RAMBlock offset 0 with xen_mr_is_memory Edgar E. Iglesias
2024-05-29 14:07 ` [PATCH v8 6/8] xen: mapcache: Pass the ram_addr offset to xen_map_cache() Edgar E. Iglesias
2024-05-29 14:07 ` [PATCH v8 7/8] xen: mapcache: Add support for grant mappings Edgar E. Iglesias
2024-05-29 14:07 ` [PATCH v8 8/8] hw/arm: xen: Enable use of " Edgar E. Iglesias
2024-06-03 16:03 ` [PATCH v8 0/8] xen: Support " Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZoKnQLBwIwh004yy@l14 \
--to=anthony.perard@vates.tech \
--cc=edgar.iglesias@amd.com \
--cc=edgar.iglesias@gmail.com \
--cc=jgross@suse.com \
--cc=paul@xen.org \
--cc=qemu-devel@nongnu.org \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).