diff mbox

[V2,1/2] tty/hvc: Use IRQF_SHARED for OPAL hvc consoles

Message ID 20160711033858.16172-1-sam@mendozajonas.com (mailing list archive)
State Accepted
Headers show

Commit Message

Sam Mendoza-Jonas July 11, 2016, 3:38 a.m. UTC
Commit 2def86a7200c
("hvc: Convert to using interrupts instead of opal events")
enabled the use of interrupts in the hvc_driver for OPAL platforms.
However on machines with more than one hvc console, any console after
the first will fail to register an interrupt handler in
notifier_add_irq() since all consoles share the same IRQ number but do
not set the IRQF_SHARED flag:

[   51.179907] genirq: Flags mismatch irq 31. 00000000 (hvc_console) vs.
00000000 (hvc_console)
[   51.180010] hvc_open: request_irq failed with rc -16.

This error propagates up to hvc_open() and the console is closed, but
OPAL will still generate interrupts that are not handled, leading to
rcu_sched stall warnings.

Set IRQF_SHARED when calling request_irq, allowing additional consoles
to start properly. This is only set for consoles handled by
hvc_opal_probe(), leaving other types unaffected.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Cc: <stable@vger.kernel.org> # 4.1.x-
---
 drivers/tty/hvc/hvc_console.h | 1 +
 drivers/tty/hvc/hvc_irq.c     | 7 +++++--
 drivers/tty/hvc/hvc_opal.c    | 3 +++
 3 files changed, 9 insertions(+), 2 deletions(-)

Comments

Michael Ellerman July 11, 2016, 6:29 a.m. UTC | #1
Samuel Mendoza-Jonas <sam@mendozajonas.com> writes:

> Commit 2def86a7200c
> ("hvc: Convert to using interrupts instead of opal events")
> enabled the use of interrupts in the hvc_driver for OPAL platforms.
> However on machines with more than one hvc console, any console after
> the first will fail to register an interrupt handler in
> notifier_add_irq() since all consoles share the same IRQ number but do
> not set the IRQF_SHARED flag:
>
> [   51.179907] genirq: Flags mismatch irq 31. 00000000 (hvc_console) vs.
> 00000000 (hvc_console)
> [   51.180010] hvc_open: request_irq failed with rc -16.
>
> This error propagates up to hvc_open() and the console is closed, but
> OPAL will still generate interrupts that are not handled, leading to
> rcu_sched stall warnings.
>
> Set IRQF_SHARED when calling request_irq, allowing additional consoles
> to start properly. This is only set for consoles handled by
> hvc_opal_probe(), leaving other types unaffected.
>
> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
> Cc: <stable@vger.kernel.org> # 4.1.x-
> ---
>  drivers/tty/hvc/hvc_console.h | 1 +
>  drivers/tty/hvc/hvc_irq.c     | 7 +++++--
>  drivers/tty/hvc/hvc_opal.c    | 3 +++
>  3 files changed, 9 insertions(+), 2 deletions(-)

Acked-by: Michael Ellerman <mpe@ellerman.id.au>

Greg are you happy to take these two?

cheers
Michael Ellerman July 26, 2016, 4:11 a.m. UTC | #2
Quoting Michael Ellerman (2016-07-11 16:29:20)
> Samuel Mendoza-Jonas <sam@mendozajonas.com> writes:
> 
> > Commit 2def86a7200c
> > ("hvc: Convert to using interrupts instead of opal events")
> > enabled the use of interrupts in the hvc_driver for OPAL platforms.
> > However on machines with more than one hvc console, any console after
> > the first will fail to register an interrupt handler in
> > notifier_add_irq() since all consoles share the same IRQ number but do
> > not set the IRQF_SHARED flag:
> >
> > [   51.179907] genirq: Flags mismatch irq 31. 00000000 (hvc_console) vs.
> > 00000000 (hvc_console)
> > [   51.180010] hvc_open: request_irq failed with rc -16.
> >
> > This error propagates up to hvc_open() and the console is closed, but
> > OPAL will still generate interrupts that are not handled, leading to
> > rcu_sched stall warnings.
> >
> > Set IRQF_SHARED when calling request_irq, allowing additional consoles
> > to start properly. This is only set for consoles handled by
> > hvc_opal_probe(), leaving other types unaffected.
> >
> > Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
> > Cc: <stable@vger.kernel.org> # 4.1.x-
> > ---
> >  drivers/tty/hvc/hvc_console.h | 1 +
> >  drivers/tty/hvc/hvc_irq.c     | 7 +++++--
> >  drivers/tty/hvc/hvc_opal.c    | 3 +++
> >  3 files changed, 9 insertions(+), 2 deletions(-)
> 
> Acked-by: Michael Ellerman <mpe@ellerman.id.au>
> 
> Greg are you happy to take these two?

Hi Greg,

I don't see this series anywhere, do you mind if I take them via the
powerpc tree for 4.8 ? Or do you want to pick them up.

cheers
Greg Kroah-Hartman July 26, 2016, 4:28 a.m. UTC | #3
On Tue, Jul 26, 2016 at 02:11:11PM +1000, Michael Ellerman wrote:
> Quoting Michael Ellerman (2016-07-11 16:29:20)
> > Samuel Mendoza-Jonas <sam@mendozajonas.com> writes:
> > 
> > > Commit 2def86a7200c
> > > ("hvc: Convert to using interrupts instead of opal events")
> > > enabled the use of interrupts in the hvc_driver for OPAL platforms.
> > > However on machines with more than one hvc console, any console after
> > > the first will fail to register an interrupt handler in
> > > notifier_add_irq() since all consoles share the same IRQ number but do
> > > not set the IRQF_SHARED flag:
> > >
> > > [   51.179907] genirq: Flags mismatch irq 31. 00000000 (hvc_console) vs.
> > > 00000000 (hvc_console)
> > > [   51.180010] hvc_open: request_irq failed with rc -16.
> > >
> > > This error propagates up to hvc_open() and the console is closed, but
> > > OPAL will still generate interrupts that are not handled, leading to
> > > rcu_sched stall warnings.
> > >
> > > Set IRQF_SHARED when calling request_irq, allowing additional consoles
> > > to start properly. This is only set for consoles handled by
> > > hvc_opal_probe(), leaving other types unaffected.
> > >
> > > Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
> > > Cc: <stable@vger.kernel.org> # 4.1.x-
> > > ---
> > >  drivers/tty/hvc/hvc_console.h | 1 +
> > >  drivers/tty/hvc/hvc_irq.c     | 7 +++++--
> > >  drivers/tty/hvc/hvc_opal.c    | 3 +++
> > >  3 files changed, 9 insertions(+), 2 deletions(-)
> > 
> > Acked-by: Michael Ellerman <mpe@ellerman.id.au>
> > 
> > Greg are you happy to take these two?
> 
> Hi Greg,
> 
> I don't see this series anywhere, do you mind if I take them via the
> powerpc tree for 4.8 ? Or do you want to pick them up.

You can take them, I'm not touching patches now until 4.8-rc1 is out,
sorry.

thanks,

greg k-h
Michael Ellerman July 26, 2016, 9:49 a.m. UTC | #4
Greg KH <gregkh@linuxfoundation.org> writes:

> On Tue, Jul 26, 2016 at 02:11:11PM +1000, Michael Ellerman wrote:
>> Quoting Michael Ellerman (2016-07-11 16:29:20)
>> > Greg are you happy to take these two?
>> 
>> I don't see this series anywhere, do you mind if I take them via the
>> powerpc tree for 4.8 ? Or do you want to pick them up.
>
> You can take them, I'm not touching patches now until 4.8-rc1 is out,
> sorry.

No worries, I'll grab them.

cheers
Michael Ellerman July 27, 2016, 2:32 p.m. UTC | #5
On Mon, 2016-11-07 at 03:38:57 UTC, Sam Mendoza-Jonas wrote:
> Commit 2def86a7200c
> ("hvc: Convert to using interrupts instead of opal events")
> enabled the use of interrupts in the hvc_driver for OPAL platforms.
> However on machines with more than one hvc console, any console after
> the first will fail to register an interrupt handler in
> notifier_add_irq() since all consoles share the same IRQ number but do
> not set the IRQF_SHARED flag:
> 
> [   51.179907] genirq: Flags mismatch irq 31. 00000000 (hvc_console) vs.
> 00000000 (hvc_console)
> [   51.180010] hvc_open: request_irq failed with rc -16.
> 
> This error propagates up to hvc_open() and the console is closed, but
> OPAL will still generate interrupts that are not handled, leading to
> rcu_sched stall warnings.
> 
> Set IRQF_SHARED when calling request_irq, allowing additional consoles
> to start properly. This is only set for consoles handled by
> hvc_opal_probe(), leaving other types unaffected.
> 
> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
> Acked-by: Michael Ellerman <mpe@ellerman.id.au>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/bbc3dfe8805de86874b1a1b142

cheers
diff mbox

Patch

diff --git a/drivers/tty/hvc/hvc_console.h b/drivers/tty/hvc/hvc_console.h
index 9131019..798c48d 100644
--- a/drivers/tty/hvc/hvc_console.h
+++ b/drivers/tty/hvc/hvc_console.h
@@ -60,6 +60,7 @@  struct hvc_struct {
 	struct winsize ws;
 	struct work_struct tty_resize;
 	struct list_head next;
+	unsigned long flags;
 };
 
 /* implemented by a low level driver */
diff --git a/drivers/tty/hvc/hvc_irq.c b/drivers/tty/hvc/hvc_irq.c
index c9adb05..57d9df7 100644
--- a/drivers/tty/hvc/hvc_irq.c
+++ b/drivers/tty/hvc/hvc_irq.c
@@ -14,6 +14,9 @@  static irqreturn_t hvc_handle_interrupt(int irq, void *dev_instance)
 	/* if hvc_poll request a repoll, then kick the hvcd thread */
 	if (hvc_poll(dev_instance))
 		hvc_kick();
+	/* We're safe to always return IRQ_HANDLED as the hvcd thread will
+	 * iterate through each hvc_struct
+	 */
 	return IRQ_HANDLED;
 }
 
@@ -28,8 +31,8 @@  int notifier_add_irq(struct hvc_struct *hp, int irq)
 		hp->irq_requested = 0;
 		return 0;
 	}
-	rc = request_irq(irq, hvc_handle_interrupt, 0,
-			   "hvc_console", hp);
+	rc = request_irq(irq, hvc_handle_interrupt, hp->flags,
+			"hvc_console", hp);
 	if (!rc)
 		hp->irq_requested = 1;
 	return rc;
diff --git a/drivers/tty/hvc/hvc_opal.c b/drivers/tty/hvc/hvc_opal.c
index 47b54c6..b7cd0ae 100644
--- a/drivers/tty/hvc/hvc_opal.c
+++ b/drivers/tty/hvc/hvc_opal.c
@@ -224,6 +224,9 @@  static int hvc_opal_probe(struct platform_device *dev)
 	hp = hvc_alloc(termno, irq, ops, MAX_VIO_PUT_CHARS);
 	if (IS_ERR(hp))
 		return PTR_ERR(hp);
+
+	/* hvc consoles on powernv may need to share a single irq */
+	hp->flags = IRQF_SHARED;
 	dev_set_drvdata(&dev->dev, hp);
 
 	return 0;