All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Mitchell Tasman <tasman@bbn.com>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai] A possible mis-interaction between CONFIG_PREEMPT and GPIO IRQ handling for ARM, leading to extreme latency
Date: Tue, 22 May 2012 10:07:45 +0200	[thread overview]
Message-ID: <4FBB4951.5070803@xenomai.org> (raw)
In-Reply-To: <4FBADE7D.5030609@bbn.com>

On 05/22/2012 02:31 AM, Mitchell Tasman wrote:
> Hi.  I'm running an OMAP DM3725-based board with a 2.6.38.8 kernel, a 
> mid-May 2012 git snapshot of xenomai-2.6, and a backport (really just 
> application) of the patch that Gilles referenced in the "IRQ latency" 
> thread last week:
> 
> http://git.xenomai.org/?p=ipipe-gch.git;a=commit;h=81bfc05c4716b76e79f5e486baf4c52015a3b92c

Please try the following patch instead:

diff --git a/arch/arm/include/asm/ipipe.h b/arch/arm/include/asm/ipipe.h
index 9b17c06..a510b09 100644
--- a/arch/arm/include/asm/ipipe.h
+++ b/arch/arm/include/asm/ipipe.h
@@ -285,14 +285,15 @@ void __ipipe_grab_irq(int irq, struct pt_regs *regs);
 
 void __ipipe_exit_irq(struct pt_regs *regs);
 
-void __ipipe_handle_irq(int irq, struct pt_regs *regs);
+#define IPIPE_IRQF_NOACK    0x1
+#define IPIPE_IRQF_NOSYNC   0x2
+
+void __ipipe_handle_irq(int irq, int flags);
 
 static inline void ipipe_handle_chained_irq(unsigned int irq)
 {
-	struct pt_regs regs;    /* dummy */
-
 	ipipe_trace_irq_entry(irq);
-	__ipipe_handle_irq(irq, &regs);
+	__ipipe_handle_irq(irq, IPIPE_IRQF_NOSYNC);
 	ipipe_trace_irq_exit(irq);
 }
 
diff --git a/arch/arm/include/asm/smp_twd.h b/arch/arm/include/asm/smp_twd.h
index b49c8ac..f655b27 100644
--- a/arch/arm/include/asm/smp_twd.h
+++ b/arch/arm/include/asm/smp_twd.h
@@ -55,7 +55,7 @@ extern void __iomem *twd_base;
 #define __ipipe_mach_relay_ipi(ipi, thiscpu)	\
 	({					\
 		(void)(thiscpu);		\
-		__ipipe_handle_irq(ipi, NULL);	\
+		__ipipe_handle_irq(ipi, IPIPE_IRQF_NOACK);	\
 	})
 
 struct irq_desc;
diff --git a/arch/arm/kernel/ipipe.c b/arch/arm/kernel/ipipe.c
index f2f618c..ff93fa9 100644
--- a/arch/arm/kernel/ipipe.c
+++ b/arch/arm/kernel/ipipe.c
@@ -254,7 +254,7 @@ int ipipe_trigger_irq(unsigned irq)
 		return -EINVAL;
 #endif
 	local_irq_save_hw(flags);
-	__ipipe_handle_irq(irq, NULL);
+	__ipipe_handle_irq(irq, IPIPE_IRQF_NOACK);
 	local_irq_restore_hw(flags);
 
 	return 1;
@@ -462,7 +462,7 @@ out:
  * interrupt protection log is maintained here for each domain. Hw
  * interrupts are off on entry.
  */
-void __ipipe_handle_irq(int irq, struct pt_regs *regs)
+void __ipipe_handle_irq(int irq, int flags)
 {
 	struct ipipe_domain *this_domain, *next_domain;
 	struct list_head *head, *pos;
@@ -470,7 +470,7 @@ void __ipipe_handle_irq(int irq, struct pt_regs *regs)
 	int m_ack;
 
 	/* Software-triggered IRQs do not need any ack. */
-	m_ack = (regs == NULL);
+	m_ack = (flags & IPIPE_IRQF_NOACK) != 0;
 
 #ifdef CONFIG_IPIPE_DEBUG
 	if (unlikely(irq >= IPIPE_NR_IRQS) ||
@@ -490,7 +490,11 @@ void __ipipe_handle_irq(int irq, struct pt_regs *regs)
 				desc = ipipe_virtual_irq_p(irq) ? NULL : irq_to_desc(irq);
 				next_domain->irqs[irq].acknowledge(irq, desc);
 			}
-			__ipipe_dispatch_wired(next_domain, irq);
+			if ((flags & IPIPE_IRQF_NOSYNC) == 0)
+				__ipipe_dispatch_wired(next_domain, irq);
+			else
+				__ipipe_set_irq_pending(next_domain, irq);
+
 			return;
 		}
 	}
@@ -604,7 +608,7 @@ asmlinkage void __ipipe_grab_irq(int irq, struct pt_regs *regs)
 	ipipe_trace_begin(regs->ARM_ORIG_r0);
 #endif
 
-	__ipipe_handle_irq(irq, regs);
+	__ipipe_handle_irq(irq, 0);
 
 #ifdef CONFIG_IPIPE_TRACE_IRQSOFF
 	ipipe_trace_end(regs->ARM_ORIG_r0);
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 9ea207d..af02caa 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -527,7 +527,7 @@ __ipipe_grab_ipi(unsigned svc, struct pt_regs *regs) /* hw IRQs off */
 		__ipipe_do_vnmi(IPIPE_SERVICE_VNMI, NULL);
 	else if ((1 << svc) & IPI_IPIPE_ALL) {
 		virq = svc - IPI_IPIPE_CRITICAL + IPIPE_FIRST_IPI;
-		__ipipe_handle_irq(virq, NULL);
+		__ipipe_handle_irq(virq, IPIPE_IRQF_NOACK);
 	} else
 		__ipipe_mach_relay_ipi(svc, cpu);
 

-- 
                                                                Gilles.


  parent reply	other threads:[~2012-05-22  8:07 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-22  0:31 [Xenomai] A possible mis-interaction between CONFIG_PREEMPT and GPIO IRQ handling for ARM, leading to extreme latency Mitchell Tasman
2012-05-22  7:40 ` Gilles Chanteperdrix
2012-05-22  8:07 ` Gilles Chanteperdrix [this message]
2012-05-22  8:34   ` [Xenomai] RE : " Jean-Pascal JULIEN
2012-05-22  8:51     ` Gilles Chanteperdrix
2012-05-22 11:52       ` [Xenomai] RE : " Jean-Pascal JULIEN
2012-05-22 12:38         ` Gilles Chanteperdrix
2012-05-22 13:23           ` [Xenomai] RE : " Jean-Pascal JULIEN
2012-05-22 13:33             ` Gilles Chanteperdrix
2012-05-22 21:22   ` [Xenomai] " Mitchell Tasman
2012-05-22 21:30     ` Gilles Chanteperdrix
2012-05-25  9:18       ` Mitchell Tasman
2012-05-25 12:20         ` Gilles Chanteperdrix
2012-05-29  7:20           ` Mitchell Tasman
2012-05-29  8:06             ` Gilles Chanteperdrix
2012-05-29  8:52               ` Mitchell Tasman
2012-06-07  7:44           ` Eric Eric
2012-06-07  8:21             ` Gilles Chanteperdrix
2012-06-07  8:34             ` Gilles Chanteperdrix
  -- strict thread matches above, loose matches on Subject: below --
2012-05-22 15:50 Jean-Pascal JULIEN
2012-05-23  8:22 Jean-Pascal JULIEN
2012-05-23 17:05 ` Mitchell Tasman

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=4FBB4951.5070803@xenomai.org \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=tasman@bbn.com \
    --cc=xenomai@xenomai.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.