public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
From: Naman Jain <namjain@linux.microsoft.com>
To: Michael Kelley <mhklinux@outlook.com>,
	"K . Y . Srinivasan" <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Wei Liu <wei.liu@kernel.org>, Dexuan Cui <decui@microsoft.com>,
	Long Li <longli@microsoft.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>, Thomas Gleixner <tglx@kernel.org>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"H . Peter Anvin" <hpa@zytor.com>, Arnd Bergmann <arnd@arndb.de>,
	Paul Walmsley <pjw@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Alexandre Ghiti <alex@ghiti.fr>
Cc: Marc Zyngier <maz@kernel.org>,
	Timothy Hayes <timothy.hayes@arm.com>,
	Lorenzo Pieralisi <lpieralisi@kernel.org>,
	mrigendrachaubey <mrigendra.chaubey@gmail.com>,
	"ssengar@linux.microsoft.com" <ssengar@linux.microsoft.com>,
	"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
	"linux-riscv@lists.infradead.org"
	<linux-riscv@lists.infradead.org>
Subject: Re: [PATCH 06/11] Drivers: hv: Make sint vector architecture neutral in MSHV_VTL
Date: Mon, 13 Apr 2026 22:21:47 +0530	[thread overview]
Message-ID: <3264b2e6-f6fb-41b1-97da-22b5249c1839@linux.microsoft.com> (raw)
In-Reply-To: <SN6PR02MB4157DA00A31F0BA8585B9B69D4242@SN6PR02MB4157.namprd02.prod.outlook.com>



On 4/13/2026 9:19 PM, Michael Kelley wrote:
> From: Naman Jain <namjain@linux.microsoft.com> Sent: Monday, April 13, 2026 4:48 AM
>>
>> On 4/1/2026 10:27 PM, Michael Kelley wrote:
>>> From: Naman Jain <namjain@linux.microsoft.com> Sent: Monday, March 16, 2026 5:13 AM
>>>>
>>>> Generalize Synthetic interrupt source vector (sint) to use
>>>> vmbus_interrupt variable instead, which automatically takes care of
>>>> architectures where HYPERVISOR_CALLBACK_VECTOR is not present (arm64).
>>>
>>> Sashiko AI raised an interesting question about the startup timing --
>>> whether the vmbus_platform_driver_probe() is guaranteed to have
>>> set vmbus_interrupt before the VTL functions below run and use it.
>>> What causes the mshv_vtl.ko module to be loaded, and hence run
>>> mshv_vtl_init()?
>>
>> There is no race condition here. The init ordering guarantees that
>> vmbus_interrupt is always set before mshv_vtl_synic_enable_regs()
>> reads it.
>>
>> The call chain for setting vmbus_interrupt:
>>
>>     subsys_initcall(hv_acpi_init)                          [level 4]
>>       -> platform_driver_register(&vmbus_platform_driver) and so on.
>>
>>
>> The call chain for reading vmbus_interrupt:
>>
>>     module_init(mshv_vtl_init)                             [level 6]
>>       -> hv_vtl_setup_synic()
>>         -> cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, ..., mshv_vtl_alloc_context, ...)
>>           -> mshv_vtl_alloc_context()
>>             -> mshv_vtl_synic_enable_regs()
>>               -> sint.vector = vmbus_interrupt
>>
>> do_initcalls() processes sections in order 0 through 7, so
>> hv_acpi_init() (level 4) is guaranteed to complete before
>> mshv_vtl_init() (level 6) runs.
>>
> 
> I think the situation is more complex than what you describe, depending
> on whether the VMBus driver and/or MSHV_VTL are built as modules vs.
> being built-in to the kernel image. In include/linux/module.h, see the
> comment for module_init() and how subsys_initcall() is mapped
> to module_init() when built as a module.
> 
> If both are built-in, then what you describe is correct. But if either or
> both are modules, then the respective init functions (hv_acpi_init
> and mshv_vtl_init) get called at the time the module is loaded, and
> not by do_initcalls(). I think hv_vmbus.ko gets loaded when an attempt
> is first made to access a disk, but I would need to look more closely to
> be sure. I don't have any understanding of what causes mshv_vtl.ko
> to be loaded. And what is the ordering if MSHV_VTL is built-in while
> VMBus is built as a module, or vice versa?
> 
> Michael
> 

Based on this, I still feel that this race is not possible.

hv_vmbus   mshv_vtl
    y          y  -> different initcall levels, no issues
    y          m  -> use without initialization is not possible
    m          y  -> config dependencies take care of this, and mshv_vtl 
is forced to compile as a module in this case.
    m          m  -> config and symbol dependencies should take care of 
it. mshv_vtl has symbol and config dependencies on hv_vmbus, and it 
won't allow loading mshv_vtl if hv_vmbus module is not loaded.

Relevant code here: kernel/module/main.c

Regards,
Naman

  reply	other threads:[~2026-04-13 16:51 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-16 12:12 [PATCH 00/11] Drivers: hv: Add ARM64 support in mshv_vtl Naman Jain
2026-03-16 12:12 ` [PATCH 01/11] arch: arm64: Export arch_smp_send_reschedule for mshv_vtl module Naman Jain
2026-04-01 16:54   ` Michael Kelley
2026-04-13 11:44     ` Naman Jain
2026-03-16 12:12 ` [PATCH 02/11] Drivers: hv: Move hv_vp_assist_page to common files Naman Jain
2026-04-01 16:55   ` Michael Kelley
2026-03-16 12:12 ` [PATCH 03/11] Drivers: hv: Add support to setup percpu vmbus handler Naman Jain
2026-04-01 16:55   ` Michael Kelley
2026-04-13 11:45     ` Naman Jain
2026-03-16 12:12 ` [PATCH 04/11] Drivers: hv: Refactor mshv_vtl for ARM64 support to be added Naman Jain
2026-04-01 16:56   ` Michael Kelley
2026-04-13 11:46     ` Naman Jain
2026-04-13 15:19       ` Michael Kelley
2026-03-16 12:12 ` [PATCH 05/11] drivers: hv: Export vmbus_interrupt for mshv_vtl module Naman Jain
2026-04-01 16:56   ` Michael Kelley
2026-04-13 11:46     ` Naman Jain
2026-03-16 12:12 ` [PATCH 06/11] Drivers: hv: Make sint vector architecture neutral in MSHV_VTL Naman Jain
2026-04-01 16:57   ` Michael Kelley
2026-04-13 11:47     ` Naman Jain
2026-04-13 15:49       ` Michael Kelley
2026-04-13 16:51         ` Naman Jain [this message]
2026-03-16 12:12 ` [PATCH 07/11] arch: arm64: Add support for mshv_vtl_return_call Naman Jain
2026-04-01 16:57   ` Michael Kelley
2026-04-13 16:52     ` Naman Jain
2026-03-16 12:12 ` [PATCH 08/11] Drivers: hv: mshv_vtl: Move register page config to arch-specific files Naman Jain
2026-04-01 16:58   ` Michael Kelley
2026-03-16 12:12 ` [PATCH 09/11] Drivers: hv: mshv_vtl: Let userspace do VSM configuration Naman Jain
2026-04-01 16:58   ` Michael Kelley
2026-03-16 12:12 ` [PATCH 10/11] Drivers: hv: Add support for arm64 in MSHV_VTL Naman Jain
2026-04-01 16:58   ` Michael Kelley
2026-03-16 12:12 ` [PATCH 11/11] Drivers: hv: Kconfig: Add ARM64 support for MSHV_VTL Naman Jain
2026-04-01 16:58   ` Michael Kelley
2026-03-17  3:34 ` [PATCH 00/11] Drivers: hv: Add ARM64 support in mshv_vtl vdso
2026-03-17  9:51   ` Naman Jain
2026-03-17 22:03 ` Michael Kelley
2026-03-18  4:23   ` Naman Jain
2026-04-01 16:54     ` Michael Kelley
2026-04-02  4:01       ` Naman Jain

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=3264b2e6-f6fb-41b1-97da-22b5249c1839@linux.microsoft.com \
    --to=namjain@linux.microsoft.com \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=arnd@arndb.de \
    --cc=bp@alien8.de \
    --cc=catalin.marinas@arm.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=hpa@zytor.com \
    --cc=kys@microsoft.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=longli@microsoft.com \
    --cc=lpieralisi@kernel.org \
    --cc=maz@kernel.org \
    --cc=mhklinux@outlook.com \
    --cc=mingo@redhat.com \
    --cc=mrigendra.chaubey@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=ssengar@linux.microsoft.com \
    --cc=tglx@kernel.org \
    --cc=timothy.hayes@arm.com \
    --cc=wei.liu@kernel.org \
    --cc=will@kernel.org \
    --cc=x86@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