mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Wei Gong <gongwei833x@gmail.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] genirq: avoid long loops in handle_edge_irq
Date: Thu, 19 Oct 2023 15:02:33 +0800	[thread overview]
Message-ID: <ZTDUiXnb_Sn-5bT2@MacBook-Pro-3.local> (raw)
In-Reply-To: <877cnqlxmz.ffs@tglx>

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

O Fri, Oct 13, 2023 at 10:44:36AM +0200, Thomas Gleixner wrote:
> On Thu, Oct 12 2023 at 21:39, Wei Gong wrote:
> > O Mon, Oct 09, 2023 at 04:32:10PM +0200, Thomas Gleixner wrote:
> >> Now $COND is not true due to the affinity change and the edge handler
> >> returns. As a consequence nothing acks the device and no further
> >> interrupts are sent by the device.
> >> 
> >> That might not be true for your case, but that's a generic function and the
> >> zoo of hardware which uses that is massive.
> >> 
> >> So no, we are not taking a risk here.
> >> 
> >> Thanks,
> >> 
> >>         tglx
> >> 
> >>     
> > By maintaining the original loop exit condition, if a mask mismatch is 
> > detected within the loop, we will not perform the unmask_irq operation. 
> > Instead, we will wait until the loop exits before executing unmask_irq.
> > Could this approach potentially solve the issue of lost interrupts?
> 
> How so exactly?
> 

[-- Attachment #2: p.diff.txt --]
[-- Type: text/plain, Size: 831 bytes --]

diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index 8f8f1d62f..b846659ce 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -823,7 +823,9 @@ void handle_edge_irq(struct irq_desc *desc)
 		 */
 		if (unlikely(desc->istate & IRQS_PENDING)) {
 			if (!irqd_irq_disabled(&desc->irq_data) &&
-			    irqd_irq_masked(&desc->irq_data))
+			    irqd_irq_masked(&desc->irq_data) &&
+			    cpumask_test_cpu(smp_processor_id(),
+				    irq_data_get_effective_affinity_mask(&desc->irq_data)))
 				unmask_irq(desc);
 		}
 
@@ -832,6 +834,10 @@ void handle_edge_irq(struct irq_desc *desc)
 	} while ((desc->istate & IRQS_PENDING) &&
 		 !irqd_irq_disabled(&desc->irq_data));
 
+if (!irqd_irq_disabled(&desc->irq_data) &&
+    irqd_irq_masked(&desc->irq_data))
+	unmask_irq(desc);
+
 out_unlock:
 	raw_spin_unlock(&desc->lock);
 }

  reply	other threads:[~2023-10-19  7:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-28 10:06 Wei Gong
2023-10-09 14:32 ` Thomas Gleixner
2023-10-12 13:39   ` Wei Gong
2023-10-13  8:44     ` Thomas Gleixner
2023-10-19  7:02       ` Wei Gong [this message]
2023-10-19  8:28         ` Thomas Gleixner
2023-10-19  9:37           ` Wei Gong

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=ZTDUiXnb_Sn-5bT2@MacBook-Pro-3.local \
    --to=gongwei833x@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.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

Powered by JetHome