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


Groups > linux.kernel > #1194937

[RFC PATCH v2 3/3] serial: 8250: Fix autoconfig_irq() to reduce the risk of failure

From Taichi Kageyama <t-kageyama@cp.jp.nec.com>
Newsgroups linux.kernel
Subject [RFC PATCH v2 3/3] serial: 8250: Fix autoconfig_irq() to reduce the risk of failure
Date 2015-07-29 10:30 +0200
Message-ID <pRuUq-2EV-23@gated-at.bofh.it> (permalink)
References <pRuUp-2EV-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


autoconfig_irq() expects a CPU detects an interrupt from a serial
port, but it doesn't work when the CPU has interrupts disabled
during the waiting time.
New one tries to specify own CPU to probe 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>
Suggested-by: Peter Hurley <peter@hurleysoftware.com>
---
 drivers/tty/serial/8250/8250_core.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git v4.2-rc4.org/drivers/tty/serial/8250/8250_core.c v4.2-rc4.work/drivers/tty/serial/8250/8250_core.c
index ed1e23e..85e8cdf 100644
--- v4.2-rc4.org/drivers/tty/serial/8250/8250_core.c
+++ v4.2-rc4.work/drivers/tty/serial/8250/8250_core.c
@@ -1295,6 +1295,7 @@ static void autoconfig_irq(struct uart_8250_port *up)
 	unsigned int ICP = 0;
 	unsigned long irqs;
 	int irq;
+	cpumask_t this_cpu;
 
 	if (port->flags & UPF_FOURPORT) {
 		ICP = (port->iobase & 0xfe0) | 0x1f;
@@ -1313,6 +1314,13 @@ static void autoconfig_irq(struct uart_8250_port *up)
 	serial_out(up, UART_MCR, UART_MCR_OUT1 | UART_MCR_OUT2);
 
 	irqs = probe_irq_on();
+
+	/* Try to detect irq on the current CPU */
+	cpumask_clear(&this_cpu);
+	preempt_disable();
+	cpumask_set_cpu(smp_processor_id(), &this_cpu);
+	probe_irq_set_affinity(irqs, &this_cpu);
+
 	serial_out(up, UART_MCR, 0);
 	udelay(10);
 	if (port->flags & UPF_FOURPORT) {
@@ -1330,6 +1338,7 @@ static void autoconfig_irq(struct uart_8250_port *up)
 	serial_out(up, UART_TX, 0xFF);
 	udelay(20);
 	irq = probe_irq_off(irqs);
+	preempt_enable();
 
 	serial_out(up, UART_MCR, save_mcr);
 	serial_out(up, UART_IER, save_ier);
-- 
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