tech-kern archive

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

XEN3_DOM0 cpu_bootconf() and bootdev=xxx failure



I have a Xen server with two disk, gpt partitioned, raidframe mirrors on the
dk(4) devices.  That system boots off an USB flash key.

With "raidctl -A softroot raid0" the XEN3_DOM0 kernel does not detect
raid0 as root device. 

It also doesn't detect raid0 as root device when
the dom0 kernel is loaded with "bootdev=raid0".

I see the following:

boot> load /netbsd-XEN3_DOM0.gz; multiboot /xen.gz dom0_mem=1024M
...
[   6.1100463] boot device: dk0
[   6.1100463] root on dk0
[   6.1100463] vfs_mountroot: can't open root device
[   6.1100463] cannot mount root, error = 16
[   6.1100463] root device (default dk0): 

Note dk0 is open as a component of raid0 here.

BTW, if any dk(4) attaches, the xen kernel's cpu_bootconf() will select
dk0 as boot device candidate because dk(4) attaches to the root of the
device tree, causing them to be returned first with DEVITER_F_ROOT_FIRST,
and the xen cpu_bootconf() will simply return the first configured disk
device.

boot> load /netbsd-XEN3_DOM0.gz bootdev=raid0; multiboot /xen.gz dom0_mem=1024M
...
[   6.1100510] boot device: raid0
[   6.1500519] unknown device major 0xffffffffffffffff
[   6.1500519] root device (default raid0a): 

We get "unknown device major" because raid0 uses partitons and
DEV_USES_PARTITIONS(dv) evaluates to true at line 436 in kern_subr.c r1.220.

With the obvious change
Index: kern_subr.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_subr.c,v
retrieving revision 1.220
diff -u -r1.220 kern_subr.c
--- kern_subr.c	7 Oct 2018 11:24:16 -0000	1.220
+++ kern_subr.c	8 Jan 2019 16:17:01 -0000
@@ -433,7 +433,7 @@
 		}
 
 		if (dv != NULL && device_class(dv) == DV_DISK &&
-		    !DEV_USES_PARTITIONS(dv) &&
+		    DEV_USES_PARTITIONS(dv) &&
 		    (majdev = devsw_name2blk(device_xname(dv), NULL, 0)) >= 0) {
 			rootdv = dv;
 			rootdev = makedev(majdev, device_unit(dv));

I see the following:

boot> load /netbsd-XEN3_DOM0.gz; multiboot /xen.gz dom0_mem=1024M
...
[   6.1100509] boot device: dk0
[   6.1100509] root on dk0
[   6.1100509] vfs_mountroot: can't open root device
[   6.1100509] cannot mount root, error = 16
[   6.1100509] root device (default dk0): 

boot> load /netbsd-XEN3_DOM0.gz bootdev=raid0; multiboot /xen.gz dom0_mem=1024M
...
[   6.1300540] boot device: raid0
[   6.1500545] root on raid0a dumps on raid0b
[   6.1600524] Your machine does not initialize mem_clusters; sparse_dumps
disabled
[   6.1700547] root file system type: ffs
[   6.1700547] kern.module.path=/stand/amd64-xen/8.99.29/modules

And it boots normally.

I've tested with -current as of 2018-12-26 and netbsd-8 as of 2018-12-12.
I didn't bother with the netbsd-7 branch.

I don't think the above change is the right fix.  There are probably where
the old code should match.  But what is the right fix?

--chris


Home | Main Index | Thread Index | Old Index