Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 09 Sep 2012 17:25:05 +0100
From:      Steven Chamberlain <steven@pyro.eu.org>
To:        freebsd-xen@freebsd.org
Subject:   xenstore panic booting XENHVM on NetBSD6/xen41
Message-ID:  <504CC2E1.5070404@pyro.eu.org>

next in thread | raw e-mail | index | archive | help
Hi!

I have been using the kernel of FreeBSD 9.0 GENERIC on a NetBSD 6
(BETA2/RC1) Xen 4.1 HVM host for some time using emulated IDE/SCSI
devices.  But I wanted to try to reduce the overhead of disk I/O and
hopefully increase performance.

When I rebuilt the kernel with XENHVM config options, it would panic at
boot.  The kernel of FreeBSD 9.1-RC1 has the same problem.  With
xen_platform_pci=0 it will boot okay (but then I'd still be unable to
use any PV devices).

> xenbusb_front0: <Xen Frontend Devices> on xenstore0
>
> Fatal trap 12: page fault while in kernel mode
[...]
> #0 0xffffffff8082a861 at kdb_backtrace+0x64
> #1 0xffffffff807f872d at panic+0x1c4
> #2 0xffffffff80a8a10d at trap_fatal+0x39d
> #3 0xffffffff80a8a24f at trap_pfault+0x124
> #4 0xffffffff80a8a933 at trap+0x3d3
> #5 0xffffffff80a76f6f at calltrap+0x8
> #6 0xffffffff80a5b26f at xs_directory+0x71
> #7 0xffffffff80a5b29c at xs_exists+0x15
> #8 0xffffffff80a58911 at xenbusb_add_device+0xae
> #9 0xffffffff80a595d7 at xenbusb_front_enumerate_type+0x5d
> #10 0xffffffff80a58e32 at xenbusb_attach+0xf9
> #11 0xffffffff80a59614 at xenbusb_front_attach+0x15
> #12 0xffffffff808265a6 at device_attach+0x337
> #13 0xffffffff80826ab3 at device_probe_and_attach+0x22
> #14 0xffffffff80826c24 at bus_generic_attach+0x1a
> #15 0xffffffff80a5a051 at xs_attach_deferred+0x21
> #16 0xffffffff80820a9a at run_interrupt_driven_config_hooks+0xea
> #17 0xffffffff80820b37 at boot_run_interrupt_driven_config_hooks+0x16

I seem to have traced this to the (inlined) split() function being given
a zero-length string from xs_directory() and it does not handle that
well.  So I came up with this workaround which results in a successful
boot and has been running fine (with PV disks and network interface) for
over a week now:

--- kfreebsd-9-9.0.orig/sys/xen/xenstore/xenstore.c	2011-09-21
00:44:34.000000000 +0100
+++ kfreebsd-9-9.0/sys/xen/xenstore/xenstore.c	2012-08-29
18:10:13.026462720 +0100
@@ -306,6 +306,10 @@
 {
 	const char **ret;

+	/* :XXX: */
+	if (len < 1)
+		return (NULL);
+
 	/* Protect against unterminated buffers. */
 	strings[len - 1] = '\0';


I'm still not sure sure why xs_directory() is trying to split a
zero-length string, if that's normal or if the Xen host is doing
something odd.

Thanks!
Regards,
-- 
Steven Chamberlain
steven@pyro.eu.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?504CC2E1.5070404>