Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:

Pre-existing issues:
- [Critical] The clock event timer interrupt (HVMSG_TIMER_EXPIRED) is 
incorrectly processed in a kthread on PREEMPT_RT, violating the architectural 
requirement that the system tick must run in hardirq context.
--

--- Patch [1]: [PATCH v2 1/2] Drivers: hv: vmbus: Replace 
lockdep_hardirq_threaded() with lockdep annotation ---
commit f939a4b9727e456e689d5d7488e6095b1358e5b5
Author: Sebastian Andrzej Siewior <[email protected]>

Drivers: hv: vmbus: Replace lockdep_hardirq_threaded() with lockdep annotation

This commit replaces the use of lockdep_hardirq_threaded() with a lockdep
annotation. This limits the threaded context on PREEMPT_RT to __vmbus_isr()
and clarifies that the ISR is not a shared handler.

> 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();

[Severity: Critical]
This isn't a bug introduced by this patch, but is it safe to defer all
VMbus interrupt processing to the vmbus_irqd kthread on PREEMPT_RT?

When booting a PREEMPT_RT kernel on a Hyper-V host using legacy timer mode,
the kthread handles the hypervisor timer message and invokes the timer ISR:

vmbus_message_sched()
    if (msg->header.message_type == HVMSG_TIMER_EXPIRED) {
        hv_stimer0_isr();

This executes the clock event handler in thread context, which breaks the
requirement that the system tick must run in hardirq context:

hv_stimer0_isr()
    ce = this_cpu_ptr(hv_clock_event);
    ce->event_handler(ce);

Because get_irq_regs() returns NULL when called from a kthread, calling
tick_handle_periodic() and then
update_process_times(user_mode(get_irq_regs())) will dereference a NULL
pointer and panic the kernel.

Alternatively, if high-resolution timers are used, tick_nohz_handler() sees
a NULL regs pointer and skips tick_sched_handle(), completely stalling the
scheduler tick and RCU updates, freezing the system.

>       } 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

[ ... ]

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=1

Reply via email to