9pnet_virtio missing dependency

From: Andreas Bauer
Date: Fri Sep 10 2021 - 08:14:20 EST


Dear all,

While compiling a minimal qemu kernel 5.14.2 with 9p root fs, I encountered a
problem with the 9pnet_virtio code:

| [ 0.553249] 9pnet: Installing 9P2000 support
[...]
| [ 0.561547] 9pnet: -- v9fs_mount (1):
| [ 0.562156] 9pnet_virtio: no channels available for device /dev/root

9p_virtio_create() is called and the list of channels in this loop

| list_for_each_entry(chan, &virtio_chan_list, chan_list) {

turns out to be empty. After instrumenting the code with a few more
debug outputs, it turns out p9_virtio_probe() is not called. I am
not familiar enough with the code flow to see exactly where the
problem lies.

I think all relevant kernel options are enabled:

| $ cat .config | grep -Ei '9P|VIRTIO' | grep -v "^#" | sort
| CONFIG_9P_FS_POSIX_ACL=y
| CONFIG_9P_FS_SECURITY=y
| CONFIG_9P_FS=y
| CONFIG_ARCH_HAS_RESTRICTED_VIRTIO_MEMORY_ACCESS=y
| CONFIG_BLK_MQ_VIRTIO=y
| CONFIG_HW_RANDOM_VIRTIO=y
| CONFIG_NET_9P_DEBUG=y
| CONFIG_NET_9P_VIRTIO=y
| CONFIG_NET_9P=y
| CONFIG_VIRTIO_BLK=y
| CONFIG_VIRTIO_CONSOLE=y
| CONFIG_VIRTIO_FS=y
| CONFIG_VIRTIO_INPUT=y
| CONFIG_VIRTIO_MEM=y
| CONFIG_VIRTIO_MENU=y
| CONFIG_VIRTIO_NET=y
| CONFIG_VIRTIO_PCI_LEGACY=y
| CONFIG_VIRTIO_PCI_LIB=y
| CONFIG_VIRTIO_PCI=y
| CONFIG_VIRTIO=y

It seems that there is a dependecy on some other kernel code that is neither
documented nor instrumented in config-logic.

When I compile a distribution kernel (i.e. almost everything compiled in)
with "localyesconfig" the 9p root fs is found and mounted properly.

What code is missing?

Thanks,

Andreas