[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[QEMU][PATCH v1 4/7] xen: let xen_ram_addr_from_mapcache() return -1 in case of not found entry
- To: <qemu-devel@xxxxxxxxxx>
- From: Vikram Garhwal <vikram.garhwal@xxxxxxx>
- Date: Thu, 5 Oct 2023 11:16:26 -0700
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YyNjWn5SJhWUmcBag3JIZwDCIV00tRHA7KorZZW17+o=; b=m2V/cBQNQ7FpxkFhEFp2isEeAiOVdPXhntHDoIIoTsQ/6fHabY+1bdIpRJy54hiblBVyO+oYTjFKMModd87g48QjneGK36GTQeQM6h26raIkapTqZOOeYdVLTNfBhwcHYm2vdaaDfyUh2g+5FVP0iIncbs7cecN1r/26lJNpklcqb6ma6rLOGhY4t1EaV67TQEyY0swSKi83w1+suomgtBt3C/mCrZewq7p9QfKwJZtyygdE09qaffRAvQhYT/yFgXbZwheIh7LoWhC24uIwS5hJw3Ra9UWIwfNldAlbpob54puF2BdKfZ8+3Ov+1/501e5XpwSzZeW7bvYT2VrYmA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Hk5Q7zmxTeEefs94fBqp329rML9W7uIYqJEj/eeZqX5cDHiTusGDJRWSlC516STkj2loNtZQ2g2l8Gk4/nkgU3GwJPcCFP7CNAQ+PVCzQizr/d0ZyAHGpVxC+WqI5VSrlKgjoauMoC5nHeS2KFVmKxoXsXC84D9/kh5KtYZah1ews4lGH8Mj4VCyPkVcrMMewd6X+u7VuGHHphsOtWLNUYUF3Gd+qVzYLi/QxooYiVq+V7yY8Qz2o+EQKcZr4z+V7BBmxaivdJr1CnGz0C5VSnYxNk3f0AK6yUNb9MUcp4R8PWbBSjzehd475xWeYMF1kSIQNnFGw+VLc+Vvzymkbg==
- Cc: <sstabellini@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, "open list:X86 Xen CPUs" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Thu, 05 Oct 2023 18:17:24 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
From: Juergen Gross <jgross@xxxxxxxx>
Today xen_ram_addr_from_mapcache() will either abort() or return 0 in
case it can't find a matching entry for a pointer value. Both cases
are bad, so change that to return an invalid address instead.
Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
hw/xen/xen-mapcache.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/hw/xen/xen-mapcache.c b/hw/xen/xen-mapcache.c
index 8115c44c00..8a61c7dde6 100644
--- a/hw/xen/xen-mapcache.c
+++ b/hw/xen/xen-mapcache.c
@@ -404,13 +404,8 @@ ram_addr_t xen_ram_addr_from_mapcache(void *ptr)
}
}
if (!found) {
- fprintf(stderr, "%s, could not find %p\n", __func__, ptr);
- QTAILQ_FOREACH(reventry, &mapcache->locked_entries, next) {
- DPRINTF(" "HWADDR_FMT_plx" -> %p is present\n",
reventry->paddr_index,
- reventry->vaddr_req);
- }
- abort();
- return 0;
+ mapcache_unlock();
+ return RAM_ADDR_INVALID;
}
entry = &mapcache->entry[paddr_index % mapcache->nr_buckets];
@@ -418,8 +413,7 @@ ram_addr_t xen_ram_addr_from_mapcache(void *ptr)
entry = entry->next;
}
if (!entry) {
- DPRINTF("Trying to find address %p that is not in the mapcache!\n",
ptr);
- raddr = 0;
+ raddr = RAM_ADDR_INVALID;
} else {
raddr = (reventry->paddr_index << MCACHE_BUCKET_SHIFT) +
((unsigned long) ptr - (unsigned long) entry->vaddr_base);
--
2.17.1
|