Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753756AbbG2IVj (ORCPT ); Wed, 29 Jul 2015 04:21:39 -0400 Received: from TYO202.gate.nec.co.jp ([210.143.35.52]:50231 "EHLO tyo202.gate.nec.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753644AbbG2IVe convert rfc822-to-8bit (ORCPT ); Wed, 29 Jul 2015 04:21:34 -0400 From: Taichi Kageyama To: "gregkh@linuxfoundation.org" , "tglx@linutronix.de" , "peter@hurleysoftware.com" , "jiang.liu@linux.intel.com" CC: Taichi Kageyama , "linux-serial@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "jslaby@suse.cz" , "prarit@redhat.com" , Naoya Horiguchi Subject: [RFC PATCH v2 2/3] genirq: Add a function to set irq affinity of candidate IRQs Thread-Topic: [RFC PATCH v2 2/3] genirq: Add a function to set irq affinity of candidate IRQs Thread-Index: AQHQydZh/U3OXQcKxk2rZa1d12tbpA== Date: Wed, 29 Jul 2015 08:12:59 +0000 Message-ID: <1438157443-19447-3-git-send-email-t-kageyama@cp.jp.nec.com> References: <1438157443-19447-1-git-send-email-t-kageyama@cp.jp.nec.com> In-Reply-To: <1438157443-19447-1-git-send-email-t-kageyama@cp.jp.nec.com> Accept-Language: en-US, ja-JP Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.34.108.75] Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2885 Lines: 81 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 Cc: Naoya Horiguchi Cc: Peter Hurley --- 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/