Linux Power Management development
 help / color / mirror / Atom feed
From: Yaohan Li <shunsheng1218@gmail.com>
To: Niklas Söderlund <niklas.soderlund@ragnatech.se>
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 12:27:35 +0800	[thread overview]
Message-ID: <179514885544.420816.9397060314487706966@gmail.com> (raw)
In-Reply-To: <20261119162517.GD2300348@ragnatech.se>

[-- Attachment #1: Type: text/plain, Size: 2590 bytes --]

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.

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.

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.

Thanks,
Yaohan

[-- Attachment #2: rcar-thermal-test-20261120.tar.gz --]
[-- Type: application/x-tar, Size: 17879 bytes --]

  reply	other threads:[~2026-11-20  4:27 UTC|newest]

Thread overview: 8+ 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 [this message]
2026-11-20  7:30           ` Niklas Söderlund

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=179514885544.420816.9397060314487706966@gmail.com \
    --to=shunsheng1218@gmail.com \
    --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=niklas.soderlund@ragnatech.se \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox