Re: [PATCH v2] thermal/drivers/rcar_thermal: disable the work before masking the interrupt

From: Niklas Söderlund

Date: Thu Nov 19 2026 - 11:26:54 EST


Hi Yaohan,

Thanks for your explanation.

On 2026-11-19 19:18:35 +0800, Yaohan Li wrote:
> Hi Niklas,
>
> thanks for the review. The code changes you asked for are in my tree, and I
> would like to check the testing question with you before posting a v3.
>
> The delayed work is now disabled before the interrupt source is masked, so
> the handler cannot queue new work after the cancellation, and a work that is
> already running cannot re-enable the source behind the mask. The shared
> interrupt is unregistered with devm_free_irq() rather than waited for with
> synchronize_irq(): the line stays registered for its other users, and they
> can raise it again after synchronize_irq() returns. The RCAR_THERMAL_MAX_IRQ
> comment, the loop variable and the two comments in rcar_thermal_remove() are
> as you suggested, and the shutdown flag is gone.
>
> On testing: there is no R-Car hardware here, so what I have is a controlled
> ordering test on a KASAN kernel, 17 checks, all passing.

Is it possible to share the test-cases? And are they relatively simple
to run? I do have hardware to test on, and I would be happy to run some
test and see stuff fail without this patch and that this work solves it.

> It uses the real
> delayed work, workqueue, wait and signal machinery and a simulated interrupt
> line shared by two handlers. It shows that a work queued after
> cancel_delayed_work_sync() still runs while the same queue attempt after
> disable_delayed_work_sync() is rejected, that a running work undoes a mask
> written before the cancellation, and that after synchronize_irq() another
> user of the line can invoke our handler again while devm_free_irq() ends
> that.
>
> What the test does not do is run rcar_thermal's own ->remove(). It
> re-implements the removal ordering, because exercising the driver would need
> a real platform device, MMIO and a thermal zone, so the behaviour of the
> interrupt status registers on real hardware remains unverified.
>
> I can send the v3 with these changes if that is useful; if you would rather
> see a different shape for the removal sequence, I will rework that first.
>
> Thanks,
> Yaohan

--
Kind Regards,
Niklas Söderlund