mirror of https://lore.kernel.org/lkml/
 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>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Magnus Damm <magnus.damm@gmail.com>,
	linux-renesas-soc@vger.kernel.org, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Eduardo Valentin <edubezval@gmail.com>
Subject: Re: [PATCH v2] thermal/drivers/rcar_thermal: disable the work before masking the interrupt
Date: Thu, 19 Nov 2026 19:18:35 +0800	[thread overview]
Message-ID: <179508711555.3615492.10674834361832600268@gmail.com> (raw)
In-Reply-To: <20261119062203.GC2300348@ragnatech.se>

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

      reply	other threads:[~2026-11-19 11:18 UTC|newest]

Thread overview: 5+ 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 [this message]

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=179508711555.3615492.10674834361832600268@gmail.com \
    --to=shunsheng1218@gmail.com \
    --cc=daniel.lezcano@kernel.org \
    --cc=edubezval@gmail.com \
    --cc=geert+renesas@glider.be \
    --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

all inboxes | Powered by JetHome®