Linux IIO development
 help / color / mirror / Atom feed
From: William Breathitt Gray <wbg@kernel.org>
To: "Sverdlin, Alexander" <alexander.sverdlin@siemens.com>
Cc: "linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"o.rempel@pengutronix.de" <o.rempel@pengutronix.de>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] counter: interrupt-cnt: Protect enable/disable OPs with mutex
Date: Fri, 2 May 2025 20:43:18 +0900	[thread overview]
Message-ID: <aBSv1pJ1mulT78gn@ishi> (raw)
In-Reply-To: <8394ef31a75fdf9122331ecb97dd6f986d5026f1.camel@siemens.com>

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

On Fri, May 02, 2025 at 09:24:20AM +0000, Sverdlin, Alexander wrote:
> Dear maintainers,
> 
> On Mon, 2025-03-31 at 18:36 +0200, A. Sverdlin wrote:
> > From: Alexander Sverdlin <alexander.sverdlin@siemens.com>
> >
> > Enable/disable seems to be racy on SMP, consider the following scenario:
> >
> > CPU0					CPU1
> >
> > interrupt_cnt_enable_write(true)
> > {
> > 	if (priv->enabled == enable)
> > 		return 0;
> >
> > 	if (enable) {
> > 		priv->enabled = true;
> > 					interrupt_cnt_enable_write(false)
> > 					{
> > 						if (priv->enabled == enable)
> > 							return 0;
> >
> > 						if (enable) {
> > 							priv->enabled = true;
> > 							enable_irq(priv->irq);
> > 						} else {
> > 							disable_irq(priv->irq)
> > 							priv->enabled = false;
> > 						}
> > 		enable_irq(priv->irq);
> > 	} else {
> > 		disable_irq(priv->irq);
> > 		priv->enabled = false;
> > 	}
> >
> > The above would result in priv->enabled == false, but IRQ left enabled.
> > Protect both write (above race) and read (to propagate the value on SMP)
> > callbacks with a mutex.
> >
> > Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
> 
> I've noticed that the patch has been marked as "Changes Requested" in
> the patchwork, could it be a mistake? Because I never received any
> change request.

Hi Alexander,

I can't comment on the patchwork status because I don't use that
service, but I apologize nonetheless for the delay in responding to your
patch submission. I'm hoping for an Ack from Oleksij, but this is a
pretty straight-forward fix that I'll be happy to pick it up regardless.

Would you provide a Fixes line so the stable trees can pick this up for
the necessary kernel versions?

Thanks,

William Breathitt Gray

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2025-05-02 11:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-31 16:36 [PATCH] counter: interrupt-cnt: Protect enable/disable OPs with mutex A. Sverdlin
2025-04-01  4:50 ` Ahmad Fatoum
2025-04-01  8:38   ` Sverdlin, Alexander
2025-04-01  8:42     ` Ahmad Fatoum
2025-05-02  9:24 ` Sverdlin, Alexander
2025-05-02 11:43   ` William Breathitt Gray [this message]
2025-05-02 11:50     ` Oleksij Rempel
2025-05-02 12:06       ` William Breathitt Gray
2025-05-02 16:32     ` Sverdlin, Alexander
2025-05-02 23:47       ` William Breathitt Gray
2025-05-02 23:49 ` William Breathitt Gray

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=aBSv1pJ1mulT78gn@ishi \
    --to=wbg@kernel.org \
    --cc=alexander.sverdlin@siemens.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    /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