Skip to contentSkip to conversation

Bisected: drivers/block/xen-blkback/xenbus.c:327 xen_blkif_disconnect+0x24f/0x260

DISCUSSION Sander Eikelenboom 2 participants 3 messages Sep 15, 2022 Xen hypervisor interface

lore
Share & tools
lore
#0 lore raw

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 ?

--
Sander

Dom0:

[144007.320877] xen_bridge: port 3(vif17.0) entered blocking state
[144007.320885] xen_bridge: port 3(vif17.0) entered disabled state
[144007.320993] device vif17.0 entered promiscuous mode
[144011.012144] xen-blkback: backend/vbd/17/51712: using 2 queues, protocol 1 (x86_64-abi) persistent grants
[144011.014046] vbd vbd-17-51712: 9 mapping in shared page 9 from domain 17
[144011.015339] vbd vbd-17-51712: 2 mapping ring-ref port 13
[144011.016666] ------------[ cut here ]------------
[144011.016672] WARNING: CPU: 0 PID: 50 at drivers/block/xen-blkback/xenbus.c:327 xen_blkif_disconnect+0x24f/0x260
[144011.016687] Modules linked in:
[144011.016691] CPU: 0 PID: 50 Comm: xenwatch Not tainted 5.19.8-20220913-doflr-mac80211debug+ #1
[144011.016695] Hardware name: MSI MS-7640/890FXA-GD70 (MS-7640)  , BIOS V1.8B1 09/13/2010
[144011.016698] RIP: e030:xen_blkif_disconnect+0x24f/0x260
[144011.016702] Code: 20 48 8d 56 20 48 8d 48 e0 48 3b 54 24 08 0f 84 a7 fe ff ff 4c 8b 74 24 10 48 89 4c 24 10 eb 82 0f 0b 0f 0b 0f 0b 0f 0b 0f 0b <0f> 0b e9 ef fe ff ff b8 f0 ff ff ff e9 34 ff ff ff 41 54 55 48 89
[144011.016705] RSP: e02b:ffffc90000847dd8 EFLAGS: 00010202
[144011.016708] RAX: 0000000000000040 RBX: 0000000000000001 RCX: ffff88802a03bc60
[144011.016710] RDX: 0000000000000000 RSI: 0000000000000200 RDI: 00000000ffffffff
[144011.016711] RBP: ffff88802a03bc00 R08: 0000000000000001 R09: ffffffff82296a93
[144011.016713] R10: 00000000fffffffc R11: 00000000000222cd R12: 0000000000000000
[144011.016715] R13: ffff8880187d5000 R14: ffff88802a03bc40 R15: ffff88801caf0c00
[144011.016730] FS:  0000000000000000(0000) GS:ffff88807d200000(0000) knlGS:0000000000000000
[144011.016732] CS:  e030 DS: 0000 ES: 0000 CR0: 0000000080050033
[144011.016740] CR2: 00007ffe03596084 CR3: 000000000adee000 CR4: 0000000000000660
[144011.016744] Call Trace:
[144011.016744]  <TASK>
[144011.016747]  frontend_changed+0x3b2/0x470
[144011.016752]  xenwatch_thread+0x9c/0x170
[144011.016757]  ? cpu_core_flags+0x10/0x10
[144011.016764]  ? find_watch+0x50/0x50
[144011.016766]  kthread+0xe3/0x110
[144011.016773]  ? kthread_complete_and_exit+0x20/0x20
[144011.016782]  ret_from_fork+0x22/0x30
[144011.016785]  </TASK>
[144011.016786] ---[ end trace 0000000000000000 ]---
[144011.016796] ------------[ cut here ]------------
[144011.016797] WARNING: CPU: 0 PID: 50 at drivers/block/xen-blkback/xenbus.c:327 xen_blkif_disconnect+0x24f/0x260
[144011.016801] Modules linked in:
[144011.016802] CPU: 0 PID: 50 Comm: xenwatch Tainted: G        W         5.19.8-20220913-doflr-mac80211debug+ #1
[144011.016805] Hardware name: MSI MS-7640/890FXA-GD70 (MS-7640)  , BIOS V1.8B1 09/13/2010
[144011.016806] RIP: e030:xen_blkif_disconnect+0x24f/0x260
[144011.016808] Code: 20 48 8d 56 20 48 8d 48 e0 48 3b 54 24 08 0f 84 a7 fe ff ff 4c 8b 74 24 10 48 89 4c 24 10 eb 82 0f 0b 0f 0b 0f 0b 0f 0b 0f 0b <0f> 0b e9 ef fe ff ff b8 f0 ff ff ff e9 34 ff ff ff 41 54 55 48 89
[144011.016811] RSP: e02b:ffffc90000847dd8 EFLAGS: 00010202
[144011.016813] RAX: 0000000000000040 RBX: 0000000000000001 RCX: ffff88802a03bdd8
[144011.016815] RDX: 0000000000000000 RSI: 0000000000000200 RDI: 00000000ffffffff
[144011.016816] RBP: ffff88802a03bd78 R08: 0000000000000001 R09: ffffffff82296a93
[144011.016818] R10: 00000000fffffffc R11: 00000000000222cd R12: 0000000000000001
[144011.016819] R13: ffff8880187d5000 R14: ffff88802a03bdb8 R15: ffff88801caf0c00
[144011.016824] FS:  0000000000000000(0000) GS:ffff88807d200000(0000) knlGS:0000000000000000
[144011.016825] CS:  e030 DS: 0000 ES: 0000 CR0: 0000000080050033
[144011.016827] CR2: 00007ffe03596084 CR3: 000000000adee000 CR4: 0000000000000660
[144011.016829] Call Trace:
[144011.016831]  <TASK>
[144011.016832]  frontend_changed+0x3b2/0x470
[144011.016835]  xenwatch_thread+0x9c/0x170
[144011.016837]  ? cpu_core_flags+0x10/0x10
[144011.016840]  ? find_watch+0x50/0x50
[144011.016842]  kthread+0xe3/0x110
[144011.016844]  ? kthread_complete_and_exit+0x20/0x20
[144011.016848]  ret_from_fork+0x22/0x30
[144011.016851]  </TASK>
[144011.016852] ---[ end trace 0000000000000000 ]---
[144011.154673] vif vif-17-0 vif17.0: Guest Rx ready
[144011.154711] xen_bridge: port 3(vif17.0) entered blocking state
[144011.154713] xen_bridge: port 3(vif17.0) entered forwarding state
maintainer
#1 lore raw
Quoted 9 lines · Sander Eikelenboom

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.

Quoted 8 lines

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.

Fixes 4573240f0764 ("xen/xenbus: eliminate xenbus_grant_ring()")
---
 drivers/xen/xenbus/xenbus_client.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/xen/xenbus/xenbus_client.c +6 -3
index d5f3f763717e..caa5c5c32f8e 100644
@@ -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;
Signature · 1 line
2.35.3
#2 lore raw
Quoted 22 lines · Juergen Gross
Quoted 21 lines · Sander Eikelenboom

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.

Quoted 8 lines
Quoted 1 line

Do you have any ideas ?

Ouch. What a silly, silly, silly error!

Does the attached patch fix it for you?

Juergen

Hi Juergen,

Yes this fixes the problem, thanks !

--
Sander