Re: [PATCH v7 2/9] x86/startup_64: Defer assignment of 5-level paging global variables

From: Borislav Petkov
Date: Sun Mar 03 2024 - 17:10:48 EST


On Sun, Mar 03, 2024 at 10:56:49PM +0100, Ard Biesheuvel wrote:
> How are you passing the root device to the kernel? Via root= on the
> command line?

Yeah:

qemu
..
-kernel arch/x86/boot/bzImage
-append "root=/dev/sda2 resume=/dev/sda3 ...

> and this is OVMF.

Yap.

> I have tried both of these, with i440fx as well as q35, and they all
> work happily with my Debian guest image passed via -hda to QEMU, and
> with root=/dev/sda2 on the kernel command line.

Interesting. I'm not passing any machine type. Maybe I should even
thought I've never done it before.

/me goes and tries machine type.

Well, I'll be damned!

-machine type=pc-i440fx-2.8 - no workie BUT

-machine type=pc-q35-2.8

booted.

Now on to figure out what's different with q35 and why it is magical and
it finds the root device just fine:

[ 2.732908] mount_root_generic: i: 2, fs_name: ext4
[ 2.734275] do_mount_root: name: /dev/root
[ 2.735093] kern_path: filename: ffff88800d4de000 of name: /root
[ 2.736954] kern_path: ret: 0
[ 2.737727] init_mount: kern_path(/root), ret: 0
[ 2.738964] path_mount: will do_new_mount
[ 2.739784] do_new_mount: 1, fc source: (null)
[ 2.740961] do_new_mount: 2, err: 0
[ 2.741722] do_new_mount: 3, err: 0
[ 2.742448] do_new_mount: 4, err: 0
[ 2.743164] vfs_get_tree: fc->root: 0000000000000000
[ 2.744095] kern_path: filename: ffff88800d4de000 of name: /dev/root
[ 2.745352] kern_path: ret: 0
[ 2.745994] lookup_bdev: kern_path(/dev/root, , path: ffff88800cf163c0), error: 0
[ 2.747288] lookup_bdev: inode->i_rdev: 0x800002
[ 2.748163] get_tree_bdev: lookup_bdev(/dev/root, dev: 0x800002), error: 0
^^^^^^^^^

> How did you get this output? Are these debug printk()s you added yourself?

Yeah, the good old "sprinkle printks" debugging method. Figured I should
look at the VFS code out of interest. :-)

Thanks a lot for the suggestions, especially about q35!

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette