kern/154302: [xen] [panic] [patch] xn0: Error 2 parsing device/vif/0/mac

Janne Snabb snabb at epipe.com
Wed Jan 26 09:00:27 UTC 2011


>Number:         154302
>Category:       kern
>Synopsis:       [xen] [panic] [patch] xn0: Error 2 parsing device/vif/0/mac
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jan 26 09:00:23 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Janne Snabb <snabb at epipe.com>
>Release:        FreeBSD 8.2-RC2 amd64
>Organization:
EPIPE Communications
>Environment:
8.2RC1 (i386 and amd64) as distributed and 8.2RC2 (amd64) as of
2011-01-14 as well as CURRENT (amd64) as of 2011-01-14 (r217387).

Xen 4.0.1 with Gentoo (x86_64 testing) dom0 and also Xen 4.0.1,
3.4.3 and 3.3.2 with CentOS 5.5 (x86_64) dom0. Various Linux dom0
kernel versions.

>Description:
I have been trying to get Xen para-virtualized device drivers to
work with RELENG_8_2 and -current. It appears that that the netfront
driver fails to get the vif mac address which leads to panic shortly
afterwards. The Xen networking mode is bridged (with default config,
automatically allocated mac address). Setting the mac address manually
in Xen config does not help.

If I enable the xenbus drivers (XENHVM kernel config on amd64 or
XEN on i386) I always get the following result:

[..]
xenpci0: <Xen Platform Device> port 0xc000-0xc0ff mem 0xf2000000-0xf2ffffff
irq 28 at device 3.0 on pci0
xs_probe: Probe retuns 0
xenstore0: <XenStore> on xenpci0
[..]
xenbusb_front0: <Xen Frontend Devices> on xenstore0
xn0: <Virtual Network Interface> at device/vif/0 on xenbusb_front0
xn0: Error 2 parsing device/vif/0/mac
xn0: Fatal error. Transitioning to Closing State
xbd0: 30720MB <Virtual Block Device> at device/vbd/768 on xenbusb_front0
xbd0: attaching as ad0
xbd1: 332MB <Virtual Block Device> at device/vbd/5632 on xenbusb_front0
xbd1: attaching as ad2
panic: do something smart

When using full HVM mode (emulated realtek) I have no problems with
Xen 4.0.1 nor 3.4.3 (both i386 and amd64 GENERIC kernels work fine).

There is a mailing list thread by myself about this at:

http://lists.freebsd.org/pipermail/freebsd-xen/2011-January/000761.html

...where one other person also confirms this problem at:

http://lists.freebsd.org/pipermail/freebsd-xen/2011-January/000775.html

He also confirms that my patch fixes the problem for him.

Below is one full boot message log with a kernel backtrace. RELENG_8_2
kernel amd64 config XENHVM (Xen 4.0.1 HVM mode):

KDB: debugger backends: ddb
KDB: current backend: ddb
Copyright (c) 1992-2011 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 8.2-RC2 #2: Fri Jan 14 06:05:39 UTC 2011
    snabb at xxx.epipe.com:/usr/obj/usr/src/sys/XENHVM amd64
Timecounter "i8254" frequency 1193182 Hz quality 0
CPU: Intel(R) Xeon(R) CPU           X3460  @ 2.80GHz (2800.02-MHz K8-class CPU)
  Origin = "GenuineIntel"  Id = 0x106e5  Family = 6  Model = 1e  Stepping = 5
  Features=0x1781fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,MMX,FXSR,SSE,SSE2,HTT>
  Features2=0x80982201<SSE3,SSSE3,CX16,SSE4.1,SSE4.2,POPCNT,<b31>>
  AMD Features=0x28100800<SYSCALL,NX,RDTSCP,LM>
  AMD Features2=0x1<LAHF>
  TSC: P-state invariant
real memory  = 1073741824 (1024 MB)
avail memory = 1016918016 (969 MB)
ACPI APIC Table: <Xen HVM>
FreeBSD/SMP: Multiprocessor System Detected: 8 CPUs
FreeBSD/SMP: 1 package(s) x 8 core(s)
 cpu0 (BSP): APIC ID:  0
 cpu1 (AP): APIC ID:  2
 cpu2 (AP): APIC ID:  4
 cpu3 (AP): APIC ID:  6
 cpu4 (AP): APIC ID:  8
 cpu5 (AP): APIC ID: 10
 cpu6 (AP): APIC ID: 12
 cpu7 (AP): APIC ID: 14
ioapic0: Changing APIC ID to 1
MADT: Forcing active-low polarity and level trigger for SCI
ioapic0 <Version 1.1> irqs 0-47 on motherboard
kbd1 at kbdmux0
acpi0: <Xen> on motherboard
acpi0: [ITHREAD]
acpi0: Power Button (fixed)
acpi0: Sleep Button (fixed)
Timecounter "ACPI-safe" frequency 3579545 Hz quality 850
acpi_timer0: <32-bit timer at 3.579545MHz> port 0x1f48-0x1f4b on acpi0
cpu0: <ACPI CPU> on acpi0
cpu1: <ACPI CPU> on acpi0
cpu2: <ACPI CPU> on acpi0
cpu3: <ACPI CPU> on acpi0
cpu4: <ACPI CPU> on acpi0
cpu5: <ACPI CPU> on acpi0
cpu6: <ACPI CPU> on acpi0
cpu7: <ACPI CPU> on acpi0
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
pci0: <ACPI PCI bus> on pcib0
isab0: <PCI-ISA bridge> at device 1.0 on pci0
isa0: <ISA bus> on isab0
atapci0: <Intel PIIX3 WDMA2 controller> port 0x1f0-0x1f7,0x3f6,0x170-0x177,0x376,0xc200-0xc20f at device 1.1 on pci0
ata0: <ATA channel 0> on atapci0
ata0: [ITHREAD]
ata1: <ATA channel 1> on atapci0
ata1: [ITHREAD]
pci0: <bridge> at device 1.3 (no driver attached)
vgapci0: <VGA-compatible display> mem 0xf0000000-0xf1ffffff,0xf3000000-0xf3000fff at device 2.0 on pci0
xenpci0: <Xen Platform Device> port 0xc000-0xc0ff mem 0xf2000000-0xf2ffffff irq 28 at device 3.0 on pci0
xs_probe: Probe retuns 0
xenstore0: <XenStore> on xenpci0
atrtc0: <AT realtime clock> port 0x70-0x71 irq 8 on acpi0
atkbdc0: <Keyboard controller (i8042)> port 0x60,0x64 irq 1 on acpi0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
kbd0 at atkbd0
atkbd0: [GIANT-LOCKED]
atkbd0: [ITHREAD]
psm0: <PS/2 Mouse> irq 12 on atkbdc0
psm0: [GIANT-LOCKED]
psm0: [ITHREAD]
psm0: model IntelliMouse Explorer, device ID 4
fdc0: <floppy drive controller> port 0x3f0-0x3f5,0x3f7 irq 6 drq 2 on acpi0
fdc0: does not respond
device_attach: fdc0 attach returned 6
uart0: <16550 or compatible> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0
uart0: [FILTER]
uart0: console (9600,n,8,1)
ppc0: <Parallel port> port 0x378-0x37f irq 7 on acpi0
ppc0: Generic chipset (NIBBLE-only) in COMPATIBLE mode
ppc0: [ITHREAD]
ppbus0: <Parallel port bus> on ppc0
plip0: <PLIP network interface> on ppbus0
plip0: [ITHREAD]
lpt0: <Printer> on ppbus0
lpt0: [ITHREAD]
lpt0: Interrupt-driven port
ppi0: <Parallel I/O> on ppbus0
orm0: <ISA Option ROM> at iomem 0xc9000-0xc97ff on isa0
sc0: <System console> at flags 0x100 on isa0
sc0: VGA <16 virtual consoles, flags=0x100>
vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
Timecounters tick every 10.000 msec
acd0: CDROM <QEMU DVD-ROM/0.10.2> at ata1-master WDMA2 
xenbusb_front0: <Xen Frontend Devices> on xenstore0
xn0: <Virtual Network Interface> at device/vif/0 on xenbusb_front0
xn0: Error 2 parsing device/vif/0/mac
xn0: Fatal error. Transitioning to Closing State
xbd0: 30720MB <Virtual Block Device> at device/vbd/768 on xenbusb_front0
xbd0: attaching as ad0
xbd1: 332MB <Virtual Block Device> at device/vbd/5632 on xenbusb_front0
xbd1: attaching as ad2
panic: do something smart
cpuid = 0
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2a
kdb_backtrace() at kdb_backtrace+0x37
panic() at panic+0x187
netfront_attach() at netfront_attach+0x18c
device_attach() at device_attach+0x69
xenbusb_probe_children() at xenbusb_probe_children+0xdf
xenbusb_attach() at xenbusb_attach+0x11c
device_attach() at device_attach+0x69
bus_generic_attach() at bus_generic_attach+0x1a
xs_attach_deferred() at xs_attach_deferred+0x21
run_interrupt_driven_config_hooks() at run_interrupt_driven_config_hooks+0xab
boot_run_interrupt_driven_config_hooks() at boot_run_interrupt_driven_config_hooks+0x2c
mi_startup() at mi_startup+0x77
btext() at btext+0x2c
KDB: enter: panic
[thread pid 0 tid 100000 ]
Stopped at      kdb_enter+0x3d: movq    $0,0x6c7a90(%rip)
db> halt

>How-To-Repeat:

Try to boot i386 XEN kernel or amd64 XENHVM kernel in similar
environment. Obviously this does not happen with every Xen environment
as there is no prior reports about this.

>Fix:

If the "mac" node does not appear in the front-end vif directory,
look for it in the backend directory for the same vif.

Two alternative patches:

--- sys/dev/xen/netfront/netfront.c.orig	2010-12-21 17:09:25.000000000 +0000
+++ sys/dev/xen/netfront/netfront.c	2011-01-17 10:11:06.000000000 +0000
@@ -401,13 +401,14 @@
 xen_net_read_mac(device_t dev, uint8_t mac[])
 {
 	int error, i;
 	char *s, *e, *macstr;
 
-	error = xs_read(XST_NIL, xenbus_get_node(dev), "mac", NULL,
-	    (void **) &macstr);
-	if (error)
+	if (xs_read(XST_NIL, xenbus_get_node(dev), "mac", NULL,
+	    (void **) &macstr) == ENOENT &&
+	    (error = xs_read(XST_NIL, xenbus_get_otherend_path(dev), 
+	    "mac", NULL, (void **) &macstr)) != 0)
 		return (error);
 
 	s = macstr;
 	for (i = 0; i < ETHER_ADDR_LEN; i++) {
 		mac[i] = strtoul(s, &e, 16);



--- sys/dev/xen/netfront/netfront.c.orig	2010-12-21 17:09:25.000000000 +0000
+++ sys/dev/xen/netfront/netfront.c	2011-01-17 10:11:06.000000000 +0000
@@ -401,13 +401,14 @@
 xen_net_read_mac(device_t dev, uint8_t mac[])
 {
 	int error, i;
 	char *s, *e, *macstr;
 
-	error = xs_read(XST_NIL, xenbus_get_node(dev), "mac", NULL,
-	    (void **) &macstr);
-	if (error)
+	if ((error = xs_read(XST_NIL, xenbus_get_node(dev), "mac", NULL,
+	    (void **) &macstr)) != 0 &&
+	    (error = xs_read(XST_NIL, xenbus_get_otherend_path(dev), 
+	    "mac", NULL, (void **) &macstr)) != 0)
 		return (error);
 
 	s = macstr;
 	for (i = 0; i < ETHER_ADDR_LEN; i++) {
 		mac[i] = strtoul(s, &e, 16);
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list