From owner-freebsd-bugs@FreeBSD.ORG Wed Jan 26 09:00:27 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 53A2710656CE for ; Wed, 26 Jan 2011 09:00:27 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id C52458FC1B for ; Wed, 26 Jan 2011 09:00:23 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p0Q90NVL089894 for ; Wed, 26 Jan 2011 09:00:23 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p0Q90NH4089885; Wed, 26 Jan 2011 09:00:23 GMT (envelope-from gnats) Resent-Date: Wed, 26 Jan 2011 09:00:23 GMT Resent-Message-Id: <201101260900.p0Q90NH4089885@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Janne Snabb Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41A7D1065694 for ; Wed, 26 Jan 2011 08:59:17 +0000 (UTC) (envelope-from snabb@tiktik.epipe.com) Received: from tiktik.epipe.com (tiktik.epipe.com [IPv6:2001:1828:0:3::2]) by mx1.freebsd.org (Postfix) with ESMTP id C5F9C8FC08 for ; Wed, 26 Jan 2011 08:59:16 +0000 (UTC) Received: from tiktik.epipe.com (localhost [127.0.0.1]) by tiktik.epipe.com (8.14.4/8.14.4) with ESMTP id p0Q8xCcY024512 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 26 Jan 2011 08:59:15 GMT (envelope-from snabb@tiktik.epipe.com) Received: (from snabb@localhost) by tiktik.epipe.com (8.14.4/8.14.4/Submit) id p0Q8xCpk024330; Wed, 26 Jan 2011 08:59:12 GMT (envelope-from snabb) Message-Id: <201101260859.p0Q8xCpk024330@tiktik.epipe.com> Date: Wed, 26 Jan 2011 08:59:12 GMT From: Janne Snabb To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: snabb@epipe.com Subject: kern/154302: [xen] [panic] [patch] xn0: Error 2 parsing device/vif/0/mac X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Janne Snabb List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jan 2011 09:00:27 -0000 >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 >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: port 0xc000-0xc0ff mem 0xf2000000-0xf2ffffff irq 28 at device 3.0 on pci0 xs_probe: Probe retuns 0 xenstore0: on xenpci0 [..] xenbusb_front0: on xenstore0 xn0: at device/vif/0 on xenbusb_front0 xn0: Error 2 parsing device/vif/0/mac xn0: Fatal error. Transitioning to Closing State xbd0: 30720MB at device/vbd/768 on xenbusb_front0 xbd0: attaching as ad0 xbd1: 332MB 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@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 Features2=0x80982201> AMD Features=0x28100800 AMD Features2=0x1 TSC: P-state invariant real memory = 1073741824 (1024 MB) avail memory = 1016918016 (969 MB) ACPI APIC Table: 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 irqs 0-47 on motherboard kbd1 at kbdmux0 acpi0: 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: on acpi0 cpu1: on acpi0 cpu2: on acpi0 cpu3: on acpi0 cpu4: on acpi0 cpu5: on acpi0 cpu6: on acpi0 cpu7: on acpi0 pcib0: port 0xcf8-0xcff on acpi0 pci0: on pcib0 isab0: at device 1.0 on pci0 isa0: on isab0 atapci0: port 0x1f0-0x1f7,0x3f6,0x170-0x177,0x376,0xc200-0xc20f at device 1.1 on pci0 ata0: on atapci0 ata0: [ITHREAD] ata1: on atapci0 ata1: [ITHREAD] pci0: at device 1.3 (no driver attached) vgapci0: mem 0xf0000000-0xf1ffffff,0xf3000000-0xf3000fff at device 2.0 on pci0 xenpci0: port 0xc000-0xc0ff mem 0xf2000000-0xf2ffffff irq 28 at device 3.0 on pci0 xs_probe: Probe retuns 0 xenstore0: on xenpci0 atrtc0: port 0x70-0x71 irq 8 on acpi0 atkbdc0: port 0x60,0x64 irq 1 on acpi0 atkbd0: irq 1 on atkbdc0 kbd0 at atkbd0 atkbd0: [GIANT-LOCKED] atkbd0: [ITHREAD] psm0: irq 12 on atkbdc0 psm0: [GIANT-LOCKED] psm0: [ITHREAD] psm0: model IntelliMouse Explorer, device ID 4 fdc0: 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: port 0x378-0x37f irq 7 on acpi0 ppc0: Generic chipset (NIBBLE-only) in COMPATIBLE mode ppc0: [ITHREAD] ppbus0: on ppc0 plip0: on ppbus0 plip0: [ITHREAD] lpt0: on ppbus0 lpt0: [ITHREAD] lpt0: Interrupt-driven port ppi0: on ppbus0 orm0: at iomem 0xc9000-0xc97ff on isa0 sc0: at flags 0x100 on isa0 sc0: VGA <16 virtual consoles, flags=0x100> vga0: at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0 Timecounters tick every 10.000 msec acd0: CDROM at ata1-master WDMA2 xenbusb_front0: on xenstore0 xn0: at device/vif/0 on xenbusb_front0 xn0: Error 2 parsing device/vif/0/mac xn0: Fatal error. Transitioning to Closing State xbd0: 30720MB at device/vbd/768 on xenbusb_front0 xbd0: attaching as ad0 xbd1: 332MB 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: