mshv: add vmbus dependency
Subsystems (2)
PATCH 1/1 mshv: add vmbus dependency
From: Arnd Bergmann <[email protected]>
When the vmbus driver is not part of the kernel, the mvhv_root driver now fails to link:
ERROR: modpost: "hv_vmbus_exists" [drivers/hv/mshv_root.ko] undefined!
Avoid this by adding an explicit Kconfig dependency. Note that stubbing out the hv_vmbus_exists() based on configuration would also work for some cases, but not with MSHV_ROOT=y and HYPERV_VMBUS=m.
--- drivers/hv/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/hv/Kconfig +1 -0
@@ -75,6 +75,7 @@ config MSHV_ROOT # e.g. When withdrawing memory, the hypervisor gives back 4k pages in # no particular order, making it impossible to reassemble larger pages depends on PAGE_SIZE_4KB + depends on HYPERV_VMBUS select EVENTFD select VIRT_XFER_TO_GUEST_WORK select HMM_MIRROR
Signature · 1 line
2.39.5
From: Arnd Bergmann <[email protected]> Sent: Wednesday, May 20, 2026 12:40 AM
Quoted 9 lines
When the vmbus driver is not part of the kernel, the
mvhv_rootdriver now fails to link:ERROR: modpost: "
hv_vmbus_exists" [drivers/hv/mshv_root.ko] undefined!Avoid this by adding an explicit
Kconfigdependency. Note that stubbing out thehv_vmbus_exists()based on configuration would also work for some cases, but not with MSHV_ROOT=y and HYPERV_VMBUS=m.
Conceptually, the MSHV root code should not have a dependency on VMBus. The "does VMBus exist?" question should handled differently by setting up a boolean in the core Hyper-V code that defaults to "false". If the VMBus driver loads, it would set the boolean to "true". MSHV root code would query the boolean.
Michael
Quoted 22 lines
Fixes f1a9e67c1138 ("mshv: limit SynIC management to MSHV-owned resources")Signed-off-by Arnd Bergmann <[email protected]>--- drivers/hv/Kconfig | 1 + 1 file changed, 1 insertion(+)drivers/hv/Kconfig +1
-1@@ -75,6 +75,7 @@ config MSHV_ROOT # e.g. When withdrawing memory, the hypervisor gives back 4k pages in # no particular order, making it impossible to reassemble larger pages depends on PAGE_SIZE_4KB + depends on HYPERV_VMBUS select EVENTFD select VIRT_XFER_TO_GUEST_WORK select HMM_MIRROR --2.39.5
Quoted 11 lines · Michael Kelley
From: Arnd Bergmann <[email protected]> Sent: Wednesday, May 20, 2026 12:40 AM
Quoted 9 lines
When the vmbus driver is not part of the kernel, the
mvhv_rootdriver now fails to link:ERROR: modpost: "
hv_vmbus_exists" [drivers/hv/mshv_root.ko] undefined!Avoid this by adding an explicit
Kconfigdependency. Note that stubbing out thehv_vmbus_exists()based on configuration would also work for some cases, but not with MSHV_ROOT=y and HYPERV_VMBUS=m.
Quoted 5 lines
Conceptually, the MSHV root code should not have a dependency on VMBus. The "does VMBus exist?" question should handled differently by setting up a boolean in the core Hyper-V code that defaults to "false". If the VMBus driver loads, it would set the boolean to "true". MSHV root code would query the boolean.
That makes sense to me, but it's outside of my area for a drive-by build fix. Please treat my patch as a 'Reported-by' then, I expect this can easily be addressed by Jork or someone else in the hyperv team.
Arnd
Quoted 18 lines · Arnd Bergmann
Quoted 11 lines · Michael Kelley
From: Arnd Bergmann <[email protected]> Sent: Wednesday, May 20, 2026 12:40 AM
Quoted 9 lines
When the vmbus driver is not part of the kernel, the
mvhv_rootdriver now fails to link:ERROR: modpost: "
hv_vmbus_exists" [drivers/hv/mshv_root.ko] undefined!Avoid this by adding an explicit
Kconfigdependency. Note that stubbing out thehv_vmbus_exists()based on configuration would also work for some cases, but not with MSHV_ROOT=y and HYPERV_VMBUS=m.Quoted 5 lines
Conceptually, the MSHV root code should not have a dependency on VMBus. The "does VMBus exist?" question should handled differently by setting up a boolean in the core Hyper-V code that defaults to "false". If the VMBus driver loads, it would set the boolean to "true". MSHV root code would query the boolean.
Quoted 4 lines
That makes sense to me, but it's outside of my area for a drive-by build fix. Please treat my patch as a 'Reported-by' then, I expect this can easily be addressed by Jork or someone else in the hyperv team.
Apologies for letting this linger - we were looking for the best fix internally. While Michael is correct that conceptually the dependency is not ideal, I think it's the right fix *for now*.
Yes, this would not allow MSHV root without VMBUS, which is relevant for MSHV root only, which misses a few other components. For L1VH it is the right fix that also enforces module load order.
Ultimately (and this is planned), we need a SYNIC driver, and the hv_vmbus_exists() will vanish for this usecase. It is a hack even now.
Best,
Jork
Quoted 32 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
When the vmbus driver is not part of the kernel, the
mvhv_rootdriver now fails to link:ERROR: modpost: "
hv_vmbus_exists" [drivers/hv/mshv_root.ko] undefined!Avoid this by adding an explicit
Kconfigdependency. Note that stubbing out thehv_vmbus_exists()based on configuration would also work for some cases, but not with MSHV_ROOT=y and HYPERV_VMBUS=m.Fixes f1a9e67c1138 ("mshv: limit SynIC management to MSHV-owned resources")Signed-off-by Arnd Bergmann <[email protected]>---
drivers/hv/Kconfig| 1 +1 file changed, 1 insertion(+)drivers/hv/Kconfig +1
-0@@ -75,6 +75,7 @@ config MSHV_ROOT # e.g. When withdrawing memory, the hypervisor gives back 4k pages in # no particular order, making it impossible to reassemble larger pages depends on PAGE_SIZE_4KB + depends on HYPERV_VMBUS select EVENTFD select VIRT_XFER_TO_GUEST_WORK select HMM_MIRRORSignature · 1 line
2.39.5
Yes, this is the right short-term fix. We will need to solve the root case (no VMBUS required) with a separate SYNIC driver abstraction.
Thank you!
Jork
From: Jork Loeser <[email protected]> Sent: Wednesday, May 20, 2026 10:16 AM
Quoted 39 lines · Arnd Bergmann
Quoted 31 lines
From: Arnd Bergmann <[email protected]>
When the vmbus driver is not part of the kernel, the
mvhv_rootdriver now fails to link:ERROR: modpost: "
hv_vmbus_exists" [drivers/hv/mshv_root.ko] undefined!Avoid this by adding an explicit
Kconfigdependency. Note that stubbing out thehv_vmbus_exists()based on configuration would also work for some cases, but not with MSHV_ROOT=y and HYPERV_VMBUS=m.Fixes f1a9e67c1138 ("mshv: limit SynIC management to MSHV-owned resources")Signed-off-by Arnd Bergmann <[email protected]>---
drivers/hv/Kconfig| 1 +1 file changed, 1 insertion(+)drivers/hv/Kconfig +1
-1@@ -75,6 +75,7 @@ config MSHV_ROOT # e.g. When withdrawing memory, the hypervisor gives back 4k pages in # no particular order, making it impossible to reassemble larger pages depends on PAGE_SIZE_4KB + depends on HYPERV_VMBUS select EVENTFD select VIRT_XFER_TO_GUEST_WORK select HMM_MIRROR --Quoted 2 lines
2.39.5
Yes, this is the right short-term fix. We will need to solve the root case (no VMBUS required) with a separate SYNIC driver abstraction.
Quoted 2 lines
Reviewed-by Jork Loeser <[email protected]>
I have what I think is a better way to fix this. It preserves the ability to build MSHV without VMBus, while also guaranteeing that VMBus loads first when present. And it is relatively simple -- hv_vmbus_exists() does not need to be moved out of the VMBus module. Later today I'll post a separate patch for consideration.
The separate SynIC driver abstraction can still come later and improve things further.
Michael