NetBSD-Bugs archive

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

Re: port-xen/59451: XEN3_DOM0 kernel finds the wrong root device



The following reply was made to PR port-xen/59451; it has been noted by GNATS.

From: mlelstv%serpens.de@localhost (Michael van Elst)
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: port-xen/59451: XEN3_DOM0 kernel finds the wrong root device
Date: Tue, 3 Jun 2025 05:33:10 -0000 (UTC)

 gnats-admin%NetBSD.org@localhost ("Chuck Zmudzinski via gnats") writes:
 
 > >  Yes. I'm currently testing the following patch. The parsing is
 > >  still not perfect, e.g. it accepts a 'partition' for devices that
 > >  don't support partitions (like dk or dm).
 > 
 > I see your code accepts a 'partition' for dk, but I don't see why for dm.
 
 
 dk and dm are just examples for drivers that don't support partitions.
 
 Currently the dm driver couldn't be used for booting as the instances are
 created only by a userland program. But if someone adds code for LVM
 autoconfiguration, it could.
 
 
 To identify a boot device, the code needs to handle 3 different
 cases:
 
 - a disk (supports partitions via disklabel).
 - some storage (basically a single partition).
 - a network interface.
 
 The first two drivers have a class DV_DISK.
 The last driver has a class DV_IFNET.
 
 
 The distinction between the first two cases is difficult
 as the driver class is the same. A regular disk supports
 the DIOCGDINFO ioctl (to return a label), but a storage
 driver like 'dk' does not. The problem to distinguish
 both cases exists since wedges were invented and in the
 meantime some other added drivers behave similarly.
 
 
 There is some ad-hoc code in the kernel that tries to
 identify such drivers by name.
 
 E.g. from kern/kern_subr.c as part of the "MI" root filesystem
 handling that I did talk about:
 
 /*
  * Use partition letters if it's a disk class but not a wedge or flash.
  * XXX Check for wedge/flash is kinda gross.
  */
 #define DEV_USES_PARTITIONS(dv)                                         \
         (device_class((dv)) == DV_DISK &&                               \
          !device_is_a((dv), "dk") &&                                    \
          !device_is_a((dv), "flash"))
 
 


Home | Main Index | Thread Index | Old Index