From: "Niklas Söderlund" <niklas.soderlund@ragnatech.se>
To: Yaohan Li <shunsheng1218@gmail.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
Daniel Lezcano <daniel.lezcano@kernel.org>,
Zhang Rui <rui.zhang@intel.com>,
Lukasz Luba <lukasz.luba@arm.com>,
Magnus Damm <magnus.damm@gmail.com>,
Eduardo Valentin <edubezval@gmail.com>,
linux-renesas-soc@vger.kernel.org, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] thermal/drivers/rcar_thermal: disable the work before masking the interrupt
Date: Fri, 20 Nov 2026 08:30:21 +0100 [thread overview]
Message-ID: <20261120073021.GA3126029@ragnatech.se> (raw)
In-Reply-To: <179514885544.420816.9397060314487706966@gmail.com>
Hi Yaohan,
Thanks for sharing your test.
On 2026-11-20 12:27:35 +0800, Yaohan Li wrote:
> Hi Niklas,
>
> yes, of course. It is one module, self-contained, and it needs no device
> tree or hardware setup - it builds against the tree you give it and runs on
> the board you load it on.
>
> The module exercises the three primitives the removal ordering depends on:
>
> - a work queued after cancel_delayed_work_sync() still runs, while the same
> queue attempt after disable_delayed_work_sync() is rejected and the work
> never runs;
> - a work that is already running re-enables the source behind a mask that
> was written before the cancellation, and cannot do that when the work is
> disabled first;
> - on a line shared with another handler, synchronize_irq() does not stop our
> handler from being invoked again (and from queueing the work), while
> devm_free_irq() does, without disturbing the other user.
>
> To run it:
>
> make KDIR=/path/to/linux
> insmod irq_semantics.ko
> dmesg | tail -n 25
>
> It needs CONFIG_MODULES and CONFIG_IRQ_SIM (the latter is a hidden symbol,
> selected by CONFIG_GPIOLIB plus CONFIG_GPIO_SIM; GPIO_MOCKUP works too but is
> deprecated). The last two lines of the log should be
>
> summary: 17 passed, 0 failed
> RESULT: PASS
>
> That result is 17 assertions about the workqueue and interrupt primitives,
> not about an R-Car unbind: a green run says the kernel behaves the way the
> patch assumes, it does not say that rcar_thermal_remove() was exercised on
> your board.
I agree your test-case is kewl and interesting but as you point out, it
test something else then the code this patch touches. But I learnt some
more about ktest reading it which was nice!
>
> The tarball is attached; the README in it has the same instructions and a
> reference log. If the list strips the attachment, tell me and I will send it
> to you directly.
>
> What the module does not do is run rcar_thermal's own ->remove(). That needs
> a real platform device, MMIO and a thermal zone, and the driver's removal
> would end up buried under the scaffolding. So it pins down the primitives,
> not what the interrupt status registers do on your board.
>
> For that, what I would suggest on your side is to unbind and rebind the
> platform device in a loop while the zone is being read, on a KASAN kernel,
> and check that no work runs after rcar_thermal_remove() returned and that the
> source is not enabled again afterwards. To get real interrupts during the
> unbind the overheat source has to fire at least once; on this driver that
> happens when the temperature crosses the trip point it has programmed.
Yes, I was wondering if you had something ready made for this test.
Having something push the trip interrupt often enough so that
bind/unbinding the driver from the device would provoke the condition
within reasonable amount of loops.
I will see if I can make something up.
>
> If you can tell me which SoC and board you have, and whether the thermal node
> in its DT has an interrupt and a critical trip point, I can work out what the
> smallest meaningful run is. I am also happy to reshape the module if you
> want it to reproduce something else.
I have access to a few boards. For this patch I intend to test on M2
(r8a7791-koelsch.dts) which have trip points. IIRC when adding interrupt
support i had a critical trip at a low temperature and then used cpuburn
to trigger it. Maybe a non-critical trip point around the running temp
and enough iterations can trigger it.
>
> Thanks,
> Yaohan
--
Kind Regards,
Niklas Söderlund
next prev parent reply other threads:[~2026-11-20 7:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 7:23 [PATCH] thermal/drivers/rcar_thermal: wait for IRQs before cancelling work Yaohan Li
2026-11-18 9:00 ` Niklas Söderlund
2026-11-19 2:29 ` [PATCH v2] thermal/drivers/rcar_thermal: disable the work before masking the interrupt Yaohan Li
2026-11-19 6:22 ` Niklas Söderlund
2026-11-19 11:18 ` Yaohan Li
2026-11-19 16:25 ` Niklas Söderlund
2026-11-20 4:27 ` Yaohan Li
2026-11-20 7:30 ` Niklas Söderlund [this message]
2026-11-20 9:43 ` Yaohan Li
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=20261120073021.GA3126029@ragnatech.se \
--to=niklas.soderlund@ragnatech.se \
--cc=daniel.lezcano@kernel.org \
--cc=edubezval@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=magnus.damm@gmail.com \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.com \
--cc=shunsheng1218@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.