Port-xen archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: NetBSD (5.1) with Xen 4-1-unstable, w/ xl. [patch included]



On 04/11/11 16:34, Konrad Rzeszutek Wilk wrote:
Hey,

So I was trying to test some changes I did to 'xl' to see how they affect 
NetBSD, and
found out that under Xen 4.1 with xl (I am running Linux 2.6.39 Dom0), the 
NetBSD
guest would not load all drivers:

NetBSD 5.1 (INSTALL_XEN3PAE_DOMU) #1: Mon Apr 11 10:20:32 EDT 2011
         
konrad@phenom:/home/konrad/netbsd/5.1/NetBSD-domU/obj/sys/arch/i386/compile/INSTALL_XEN3PAE_DOMU
total memory = 512 MB
avail memory = 492 MB
timecounter: Timecounters tick every 10.000 msec
mainbus0 (root)
hypervisor0 at mainbus0: Xen version 4.2
vcpu0 at hypervisor0: AMD 686-class, 3000MHz, id 0x100fa0
debug virtual interrupt using event channel 3
xenbus0 at hypervisor0: Xen Virtual Bus Interface
xencons0 at hypervisor0: Xen Virtual Console Driver
xencons0: console major 143, unit 0
xencons0: using event channel 2
npx0 at hypervisor0: using exception 16
timecounter: Timecounter "clockinterrupt" frequency 100 Hz quality 0
Xen clock: using event channel 4
timecounter: Timecounter "xen_system_time" frequency 1000000000 Hz quality 10000
xenbus0: using event channel 1
xenbus: can't get state for device/suspend/event-channel (2)
raidattach: Asked for 8 units
.. snip..

When I ran it using 'xm', it worked. When looking at the xenstore-ls for
the frontend I noticed this:

'xm' creation:
     2 = ""
    vm = "/vm/9f6b8647-99f8-2727-c44f-47c8fcf9a1d2"
    device = ""
     vbd = ""
      2048 = ""
       virtual-device = "2048"
       device-type = "disk"
       protocol = "x86_32-abi"
       backend-id = "0"
       state = "1"
       backend = "/local/domain/0/backend/vbd/2/2048"
     vif = ""
      0 = ""
       mac = "00:0F:4B:00:00:76"
       handle = "0"
       protocol = "x86_32-abi"
       backend-id = "0"
       state = "1"
       backend = "/local/domain/0/backend/vif/2/0"
     console = ""
      0 = ""
       protocol = "x86_32-abi"
       state = "1"
       backend-id = "0"
       backend = "/local/domain/0/backend/console/2/0"
    control = ""
     platform-feature-multiprocessor-suspend = "1"

'xl' creation:
   58 = ""
    vm = "/vm/85b95de4-1f91-41cf-aa7b-21333f0664d1"
    name = "NetBSD"
    control = ""
     shutdown = ""
     platform-feature-multiprocessor-suspend = "1"
    device = ""
     suspend = ""
      event-channel = ""
     vbd = ""
      2048 = ""
       backend = "/local/domain/0/backend/vbd/58/2048"
       backend-id = "0"
       state = "1"
       virtual-device = "2048"
       device-type = "disk"
     vif = ""
      0 = ""
       backend = "/local/domain/0/backend/vif/58/0"
       backend-id = "0"
       state = "1"
       handle = "0"
       mac = "00:0f:4b:00:00:76"
     vfb = ""
      0 = ""
       backend = "/local/domain/0/backend/vfb/58/0"
       backend-id = "0"
       state = "1"
     vkbd = ""
      0 = ""
       backend = "/local/domain/0/backend/vkbd/58/0"
       backend-id = "0"
       state = "1"


The difference is that when using the Python stack, the frontend
devices are first populated (vbd, vif, vkbd,..), while on 'xl' the 'suspend' 
entry
shows up first. This ends with 'xenbus_probe_device_type' hitting

303                 err = xenbus_read_ul(NULL, xbusd->xbusd_path, "state",
304&state, 10);
305                 if (err) {
306                         printf("xenbus: can't get state "
307                             "for %s (%d)\n", xbusd->xbusd_path, err);
308                         free(xbusd, M_DEVBUF);
309                         continue;
310                 }

And the function returns 'err' (-2), which means that the loop in
'xenbus_probe_frontends' exits out:

407                 err = xenbus_probe_device_type(path, dir[i], NULL);
408                 if (err)
409                         break;

And we don't parse the other frontends.

This little patch fixes this by setting the 'err' value to zero on the
xenbus_read_ul.

Index: xenbus_probe.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/xenbus/xenbus_probe.c,v
retrieving revision 1.26.2.1
diff -u -p -r1.26.2.1 xenbus_probe.c
--- xenbus_probe.c      16 Jan 2009 01:17:49 -0000      1.26.2.1
+++ xenbus_probe.c      11 Apr 2011 14:32:21 -0000
@@ -306,6 +306,7 @@ xenbus_probe_device_type(const char *pat
                        printf("xenbus: can't get state "
                            "for %s (%d)\n", xbusd->xbusd_path, err);
                        free(xbusd, M_DEVBUF);
+                       err = 0;
                        continue;
                }
                if (state != XenbusStateInitialising) {


And makes the bootup look like this:
NetBSD 5.1 (INSTALL_XEN3PAE_DOMU) #0: Fri Apr  8 17:17:08 EDT 2011
         
konrad@phenom:/home/konrad/netbsd/5.1/NetBSD-domU/obj/sys/arch/i386/compile/INSTALL_XEN3PAE_DOMU
total memory = 1024 MB
avail memory = 994 MB
timecounter: Timecounters tick every 10.000 msec
mainbus0 (root)
hypervisor0 at mainbus0: Xen version 4.2
vcpu0 at hypervisor0: AMD 686-class, 3000MHz, id 0x100fa0
debug virtual interrupt using event channel 3
xenbus0 at hypervisor0: Xen Virtual Bus Interface
xencons0 at hypervisor0: Xen Virtual Console Driver
xencons0: console major 143, unit 0
xencons0: using event channel 2
npx0 at hypervisor0: using exception 16
timecounter: Timecounter "clockinterrupt" frequency 100 Hz quality 0
Xen clock: using event channel 4
timecounter: Timecounter "xen_system_time" frequency 1000000000 Hz quality 10000
xenbus0: using event channel 1
xenbus: can't get state for device/suspend/event-channel (2)
xbd0 at xenbus0 id 2048: Xen Virtual Block Device Interface
xbd0: using event channel 5
xbd1 at xenbus0 id 5632: Xen Virtual Block Device Interface
xbd1: using event channel 6
xennet0 at xenbus0 id 0: Xen Virtual Network Interface
xennet0: MAC address 00:0f:4b:00:00:76
xennet0: using event channel 7
unknown type vfb at xenbus0 id 0 not configured
unknown type vkbd at xenbus0 id 0 not configured
xbd0: 20480 MB, 512 bytes/sect x 41943040 sectors
xbd1: 168 MB, 512 bytes/sect x 345272 sectors
raidattach: Asked for 8 units
.. snip..


Hi Konrad,

Thank you for reporting and issue. I have committed the fix to -current which slightly differs from your version.

I initialize err to 0 right after the for () loop to catch all error
pathes with 'continue' in it:
http://mail-index.netbsd.org/source-changes/2011/04/11/msg020938.html

Christoph


Home | Main Index | Thread Index | Old Index