From: Easwar Hariharan <easwar.hariharan@linux.microsoft.com>
To: Michael Kelley <mhklinux@outlook.com>
Cc: easwar.hariharan@linux.microsoft.com,
"kys@microsoft.com" <kys@microsoft.com>,
"haiyangz@microsoft.com" <haiyangz@microsoft.com>,
"wei.liu@kernel.org" <wei.liu@kernel.org>,
"decui@microsoft.com" <decui@microsoft.com>,
"longli@microsoft.com" <longli@microsoft.com>,
"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/1] Drivers: hv: vmbus: Fail VMBus module init for non-nested root partition
Date: Tue, 4 Aug 2026 15:47:07 -0700 [thread overview]
Message-ID: <ce1a513c-2eb6-449d-bfff-ce7a581d14f2@linux.microsoft.com> (raw)
In-Reply-To: <SN6PR02MB415758E1637A763B06911B8AD4D42@SN6PR02MB4157.namprd02.prod.outlook.com>
On 8/4/2026 15:17, Michael Kelley wrote:
> From: Easwar Hariharan <easwar.hariharan@linux.microsoft.com> Sent: Tuesday, August 4, 2026 12:40 PM
>>
>> On 8/4/2026 12:05, Michael Kelley wrote:
>>> The VMBus module should not be loaded when Linux is running directly
>>> in the root partition and root is not nested in another VM. Current
>>> code checks this condition and skips VMBus module initialization, which
>>> works. But it returns 0 as the result, so Linux thinks the module has
>>> successfully loaded. Later, if the module were to be unloaded, the
>>> VMBus module unload code tries to clean up things that were never
>>> initialized, resulting in memory faults and a panic.
>>>
>>> Fix this by having VMBus module initialization return -ENODEV for this
>>> case. The module is then not loaded, and the unload path can never run.
>>>
>>> Reported-by: Sashiko <sashiko-bot@kernel.org>
>>> Closes: https://lore.kernel.org/linux-
>> hyperv/20260721154943.A09BD1F00A3D@smtp.kernel.org/
>>> Fixes: 7e279d78664aa ("Drivers: hv: vmbus: skip VMBus initialization if Linux is root")
>>> Signed-off-by: Michael Kelley <mhklinux@outlook.com>
>>> ---
>>> drivers/hv/vmbus_drv.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
>>> index e19ec73b0187..849d7e1a7320 100644
>>> --- a/drivers/hv/vmbus_drv.c
>>> +++ b/drivers/hv/vmbus_drv.c
>>> @@ -2976,7 +2976,7 @@ static int __init hv_acpi_init(void)
>>> return -ENODEV;
>>>
>>> if (hv_root_partition() && !hv_nested)
>>> - return 0;
>>> + return -ENODEV;
>>>
>>> /*
>>> * Get ACPI resources first.
>>
>> This seems straightforward:
>
> Alas, it's not so straightforward, as Sashiko pointed out. I knew that
> the mshv module has a dependency on the vmbus module, but had
> forgotten. There's a reason for the dependency as described in the
> commit message for 840b740a35bf.
>
> There's another easy way to fix the VMBus module unload problem.
> I'll send a v2. :-)
>
> Michael
>
I may be missing something, but mshv_root is used in 3 cases:
1) Baremetal root partition, which requires no VMBus
2) L1VH aka Direct Virtualization, which is conditioned on hv_l1vh_partition(), which is not the check here in the vmbus driver
3) For the OpenHCL paravisor, where I honestly don't know what the dependency chain looks like, but based on a quick glance
at https://github.com/microsoft/OHCL-Linux-Kernel/ and a cursory grep, doesn't seem to rely on hv_root_partition() but does rely
on VMbus.
I feel like Sashiko's review falls into item 1, but then again, there may just be a mismatch
between reality and my mental model, or my mental model may becorrect, but the code doesn't match it.
Thanks,
Easwar (he/him)
next prev parent reply other threads:[~2026-08-04 22:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 19:05 [PATCH 1/1] Drivers: hv: vmbus: Fail VMBus module init for non-nested root partition Michael Kelley
2026-08-04 19:21 ` sashiko-bot
2026-08-04 19:39 ` Easwar Hariharan
2026-08-04 22:17 ` Michael Kelley
2026-08-04 22:47 ` Easwar Hariharan [this message]
2026-08-04 22:48 ` Easwar Hariharan
2026-08-05 4:13 ` Michael Kelley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ce1a513c-2eb6-449d-bfff-ce7a581d14f2@linux.microsoft.com \
--to=easwar.hariharan@linux.microsoft.com \
--cc=decui@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=kys@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=longli@microsoft.com \
--cc=mhklinux@outlook.com \
--cc=wei.liu@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox