RE: [PATCH v2 1/2] Drivers: hv: vmbus: Replace lockdep_hardirq_threaded() with lockdep annotation
Michael Kelley <[email protected]> Wed, 22 Jul 2026 20:18:27 +0000
| Newsgroups | dev.linux.lists.linux-rt-devel,org.kernel.vger.linux-hyperv,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <SN6PR02MB4157B7DEC27E78D31C6F218FD4C12@SN6PR02MB4157.namprd02.prod.outlook.com> |
From: Sebastian Andrzej Siewior <[email protected]> Sent: Tuesday, July 21, 2026 8:32 AM > > lockdep_hardirq_threaded() is supposed to be used within IRQ core code > and not within drivers. It is not obvious from within the driver, that > this is the only interrupt service routing and that it is not shared s/routing/routine/ > handler. > > Replace lockdep_hardirq_threaded() with a lockdep annotation limiting > threaded context on PREEMPT_RT to __vmbus_isr(). > > Fixes: f8e6343b7a89c ("Drivers: hv: vmbus: Use kthread for vmbus interrupts on PREEMPT_RT") > Signed-off-by: Sebastian Andrzej Siewior <[email protected]> > --- > drivers/hv/vmbus_drv.c | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) > > diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c > index 23206640c6139..44877664d9d08 100644 > --- a/drivers/hv/vmbus_drv.c > +++ b/drivers/hv/vmbus_drv.c > @@ -1384,8 +1384,19 @@ void vmbus_isr(void) > if (IS_ENABLED(CONFIG_PREEMPT_RT)) { > vmbus_irqd_wake(); > } else { > - lockdep_hardirq_threaded(); > + static DEFINE_WAIT_OVERRIDE_MAP(vmbus_map, LD_WAIT_CONFIG); > + > + /* > + * vmbus_isr is never force-threaded and always invoked at hard > + * IRQ level. __vmbus_isr() below can acquire a spinlock_t > + * which becomes a sleeping lock and must not be acquired in > + * this context. Therefore on PREEMPT_RT this will be threaded > + * via vmbus_irqd_wake(). On non-PREEMPT the annotation lets > + * lockdep know that acquiring a spinlock_t is not an issue. > + */ > + lock_map_acquire_try(&vmbus_map); > __vmbus_isr(); > + lock_map_release(&vmbus_map); > } > } > EXPORT_SYMBOL_FOR_MODULES(vmbus_isr, "mshv_vtl"); > -- > 2.53.0 > In my view, it's OK to ignore the Sashiko-reported issue about hv_stimer0_isr() running in a thread context when CONFIG_PREEMPT_RT is set. That scenario can only happen if the guest is running on Windows Server/Hyper-V 2012R2 or earlier, and that version went out of official Microsoft support in October 2023. I have an inquiry into the Microsoft team about removing support for that Hyper-V version from the Linux kernel code, which would resolve the issue. Reviewed-by: Michael Kelley <[email protected]>