On 15.09.22 14:49, Sander Eikelenboom wrote:
Hi Juergen,

I'm having trouble booting my DomU's when trying to use a linux-5.19 kernel for both Dom0 and DomU.
A dom0 5.19 kernel with a domU 5.18 kernel boots fine.
I'm using durect kernel boot to boot the domU guest (kernel=  and ramdisk= parameters).

Since both xen-blkback and xen-blkfront could be into play,
I bisected this by keeping dom0 fixed as a 5.19 kernel and do the bisecting on the domU kernel.

Bisecting leads to commit 4573240f0764ee79d7558d74fc535baa1e110d20 "xen/xenbus: eliminate xenbus_grant_ring()"
Reverting this specific commit makes the domU boot fine again.

I have added the splat from dom0 kernel below (from using 5.19.8 kernel for both dom0 and domU),
the domU does not seem to have any interessting logging,
apart from not being able to find the root filesystem.

Do you have any ideas ?

Ouch. What a silly, silly, silly error!

Does the attached patch fix it for you?


Juergen
From 390461f3fbde0a65d18e65999a1bd3db9830131b Mon Sep 17 00:00:00 2001
From: Juergen Gross <[email protected]>
To: [email protected]
Cc: Juergen Gross <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Oleksandr Tyshchenko <[email protected]>
Cc: [email protected]
Date: Thu, 15 Sep 2022 15:05:45 +0200
Subject: [PATCH] xen/xenbus: fix xenbus_setup_ring()

Commit 4573240f0764 ("xen/xenbus: eliminate xenbus_grant_ring()")
introduced an error for initialization of multi-page rings.

Cc: [email protected]
Fixes: 4573240f0764 ("xen/xenbus: eliminate xenbus_grant_ring()")
Reported-by: Sander Eikelenboom <[email protected]>
Signed-off-by: Juergen Gross <[email protected]>
---
 drivers/xen/xenbus/xenbus_client.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c
index d5f3f763717e..caa5c5c32f8e 100644
--- a/drivers/xen/xenbus/xenbus_client.c
+++ b/drivers/xen/xenbus/xenbus_client.c
@@ -382,9 +382,10 @@ int xenbus_setup_ring(struct xenbus_device *dev, gfp_t gfp, void **vaddr,
 	unsigned long ring_size = nr_pages * XEN_PAGE_SIZE;
 	grant_ref_t gref_head;
 	unsigned int i;
+	void *addr;
 	int ret;
 
-	*vaddr = alloc_pages_exact(ring_size, gfp | __GFP_ZERO);
+	addr = *vaddr = alloc_pages_exact(ring_size, gfp | __GFP_ZERO);
 	if (!*vaddr) {
 		ret = -ENOMEM;
 		goto err;
@@ -401,13 +402,15 @@ int xenbus_setup_ring(struct xenbus_device *dev, gfp_t gfp, void **vaddr,
 		unsigned long gfn;
 
 		if (is_vmalloc_addr(*vaddr))
-			gfn = pfn_to_gfn(vmalloc_to_pfn(vaddr[i]));
+			gfn = pfn_to_gfn(vmalloc_to_pfn(addr));
 		else
-			gfn = virt_to_gfn(vaddr[i]);
+			gfn = virt_to_gfn(addr);
 
 		grefs[i] = gnttab_claim_grant_reference(&gref_head);
 		gnttab_grant_foreign_access_ref(grefs[i], dev->otherend_id,
 						gfn, 0);
+
+		addr += PAGE_SIZE;
 	}
 
 	return 0;
-- 
2.35.3

Attachment: OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to