Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1194941

[RFC PATCH v2 2/3] genirq: Add a function to set irq affinity of candidate IRQs

From Taichi Kageyama <t-kageyama@cp.jp.nec.com>
Newsgroups linux.kernel
Subject [RFC PATCH v2 2/3] genirq: Add a function to set irq affinity of candidate IRQs
Date 2015-07-29 10:30 +0200
Message-ID <pRuUr-2EV-33@gated-at.bofh.it> (permalink)
References <pRuUp-2EV-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


This new function can specify which CPU is used for interrupt probing.

An interrupt probing code expects a CPU detects an interrupt from the
target device, but it doesn't work when the CPU has interrupts disabled
during the waiting time.
The probing code can use this function to specify which CPU detects the
interrupt and reduce the risk of the failure as far as possible.

Signed-off-by: Taichi Kageyama <t-kageyama@cp.jp.nec.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Peter Hurley <peter@hurleysoftware.com>
---
 include/linux/interrupt.h |  4 ++++
 kernel/irq/autoprobe.c    | 31 +++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)

diff --git v4.2-rc4.org/include/linux/interrupt.h v4.2-rc4.work/include/linux/interrupt.h
index be7e75c..4f08f6d 100644
--- v4.2-rc4.org/include/linux/interrupt.h
+++ v4.2-rc4.work/include/linux/interrupt.h
@@ -647,10 +647,14 @@ static inline unsigned int probe_irq_mask(unsigned long val)
 {
 	return 0;
 }
+static inline void probe_irq_set_affinity(unsigned long val, cpumask_t *mask)
+{
+}
 #else
 extern unsigned long probe_irq_on(void);	/* returns 0 on failure */
 extern int probe_irq_off(unsigned long);	/* returns 0 or negative on failure */
 extern unsigned int probe_irq_mask(unsigned long);	/* returns mask of ISA interrupts */
+extern void probe_irq_set_affinity(unsigned long, cpumask_t *);
 #endif
 
 #ifdef CONFIG_PROC_FS
diff --git v4.2-rc4.org/kernel/irq/autoprobe.c v4.2-rc4.work/kernel/irq/autoprobe.c
index 0119b9d..24e7647 100644
--- v4.2-rc4.org/kernel/irq/autoprobe.c
+++ v4.2-rc4.work/kernel/irq/autoprobe.c
@@ -183,3 +183,34 @@ int probe_irq_off(unsigned long val)
 }
 EXPORT_SYMBOL(probe_irq_off);
 
+/**
+ *	probe_irq_set_affinity	- change smp_affinity during autodetect
+ *	@val: mask of potential interrupts (unused)
+ *
+ *	Sets smp_affinity of candidate irq lines if possible.
+ *
+ *	An interrupt probing code expects a CPU detects an interrupt
+ *	from the target device, but it doesn't work when the CPU has
+ *	interrupts disabled during the waiting time.
+ *	The code can use this function to specify which CPU detects
+ *	the interrupt and reduce the risk of the failure.
+ */
+void probe_irq_set_affinity(unsigned long val, cpumask_t *mask)
+{
+	int i;
+	struct irq_desc *desc;
+
+	for_each_irq_desc(i, desc) {
+		raw_spin_lock_irq(&desc->lock);
+
+		if (desc->istate & IRQS_AUTODETECT) {
+			struct irq_data *data = &desc->irq_data;
+
+			if (data->chip && data->chip->irq_set_affinity)
+				irq_do_set_affinity(data, mask, false);
+		}
+		raw_spin_unlock_irq(&desc->lock);
+	}
+}
+EXPORT_SYMBOL(probe_irq_set_affinity);
+
-- 
2.4.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC PATCH v2 0/3] genirq, serial: 8250: Workaround to avoid irq=0  for console Taichi Kageyama <t-kageyama@cp.jp.nec.com> - 2015-07-29 10:30 +0200
  [RFC PATCH v2 3/3] serial: 8250: Fix autoconfig_irq() to reduce the  risk of failure Taichi Kageyama <t-kageyama@cp.jp.nec.com> - 2015-07-29 10:30 +0200
  [RFC PATCH v2 2/3] genirq: Add a function to set irq affinity of  candidate IRQs Taichi Kageyama <t-kageyama@cp.jp.nec.com> - 2015-07-29 10:30 +0200
  Re: [RFC PATCH v2 0/3] genirq, serial: 8250: Workaround to avoid  irq=0 for console Peter Hurley <peter@hurleysoftware.com> - 2015-07-29 15:20 +0200
    Re: [RFC PATCH v2 0/3] genirq, serial: 8250: Workaround to avoid  irq=0 for console Thomas Gleixner <tglx@linutronix.de> - 2015-07-29 15:40 +0200
      Re: [RFC PATCH v2 0/3] genirq, serial: 8250: Workaround to avoid  irq=0 for console Taichi Kageyama <t-kageyama@cp.jp.nec.com> - 2015-07-30 03:50 +0200
        Re: [RFC PATCH v2 0/3] genirq, serial: 8250: Workaround to avoid  irq=0 for console Thomas Gleixner <tglx@linutronix.de> - 2015-07-30 12:20 +0200
          Re: [RFC PATCH v2 0/3] genirq, serial: 8250: Workaround to avoid  irq=0 for console Thomas Gleixner <tglx@linutronix.de> - 2015-08-02 12:00 +0200

csiph-web