mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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>,
	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 17:25:17 +0100	[thread overview]
Message-ID: <20261119162517.GD2300348@ragnatech.se> (raw)
In-Reply-To: <179508711555.3615492.10674834361832600268@gmail.com>

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

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

Thread overview: 6+ 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 [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=20261119162517.GD2300348@ragnatech.se \
    --to=niklas.soderlund@ragnatech.se \
    --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=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 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®