* [PATCH] HVC: do not request the irq twice.
@ 2009-01-22 17:56 Ian Campbell
2009-01-22 19:09 ` Christian Borntraeger
0 siblings, 1 reply; 3+ messages in thread
From: Ian Campbell @ 2009-01-22 17:56 UTC (permalink / raw)
To: linux-kernel
Cc: Ian Campbell, Ian Campbell, Milton Miller, Christian Borntraeger,
Hendrik Brueckner, Benjamin Herrenschmidt, Rusty Russell
Otherwise:
root@bogga:~# tty
/dev/hvc0
root@bogga:~# reboot
Broadcast message from root@bogga (hvc0) (Thu Jan 22 17:51:20 2009):
The system is going down for reboot NOW!
INIT: Switching to runlevel: 6
INIT: Sending processes the TERM signal
hvc_open: request_irq failed with rc -16.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Milton Miller <miltonm@bga.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
---
drivers/char/hvc_irq.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/drivers/char/hvc_irq.c b/drivers/char/hvc_irq.c
index 2623e17..8152a13 100644
--- a/drivers/char/hvc_irq.c
+++ b/drivers/char/hvc_irq.c
@@ -28,6 +28,10 @@ int notifier_add_irq(struct hvc_struct *hp, int irq)
hp->irq_requested = 0;
return 0;
}
+
+ if (hp->irq_requested)
+ return 0;
+
rc = request_irq(irq, hvc_handle_interrupt, IRQF_DISABLED,
"hvc_console", hp);
if (!rc)
--
1.5.6.5
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] HVC: do not request the irq twice.
2009-01-22 17:56 [PATCH] HVC: do not request the irq twice Ian Campbell
@ 2009-01-22 19:09 ` Christian Borntraeger
2009-01-23 9:45 ` Ian Campbell
0 siblings, 1 reply; 3+ messages in thread
From: Christian Borntraeger @ 2009-01-22 19:09 UTC (permalink / raw)
To: Ian Campbell
Cc: linux-kernel, Milton Miller, Hendrik Brueckner,
Benjamin Herrenschmidt, Rusty Russell
Am Thursday 22 January 2009 18:56:08 schrieb Ian Campbell:
> --- a/drivers/char/hvc_irq.c
> +++ b/drivers/char/hvc_irq.c
> @@ -28,6 +28,10 @@ int notifier_add_irq(struct hvc_struct *hp, int irq)
> hp->irq_requested = 0;
> return 0;
> }
> +
> + if (hp->irq_requested)
> + return 0;
> +
> rc = request_irq(irq, hvc_handle_interrupt, IRQF_DISABLED,
> "hvc_console", hp);
> if (!rc)
Unfortunately I have no system with an irq based hvc console - I cannot test
this patch. Anyway, the patch looks sane:
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
If this really fixes a problem, I am asking myself, if notifier_del can be
called several times as well. If yes, it might be better to call free_irq at
the last notifier_del - which means we need proper refcounting. Otherwise the
console switches into polling mode....
Christian, blaming Rusty for using hvc_console in virtio_console which made me
somehow responsible for this code... ;-)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] HVC: do not request the irq twice.
2009-01-22 19:09 ` Christian Borntraeger
@ 2009-01-23 9:45 ` Ian Campbell
0 siblings, 0 replies; 3+ messages in thread
From: Ian Campbell @ 2009-01-23 9:45 UTC (permalink / raw)
To: Christian Borntraeger
Cc: linux-kernel, Milton Miller, Hendrik Brueckner,
Benjamin Herrenschmidt, Rusty Russell
On Thu, 2009-01-22 at 20:09 +0100, Christian Borntraeger wrote:
> Am Thursday 22 January 2009 18:56:08 schrieb Ian Campbell:
> > --- a/drivers/char/hvc_irq.c
> > +++ b/drivers/char/hvc_irq.c
> > @@ -28,6 +28,10 @@ int notifier_add_irq(struct hvc_struct *hp, int irq)
> > hp->irq_requested = 0;
> > return 0;
> > }
> > +
> > + if (hp->irq_requested)
> > + return 0;
> > +
> > rc = request_irq(irq, hvc_handle_interrupt, IRQF_DISABLED,
> > "hvc_console", hp);
> > if (!rc)
>
> Unfortunately I have no system with an irq based hvc console - I cannot test
> this patch. Anyway, the patch looks sane:
>
> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
>
> If this really fixes a problem, I am asking myself, if notifier_del can be
> called several times as well. If yes, it might be better to call free_irq at
> the last notifier_del - which means we need proper refcounting. Otherwise the
> console switches into polling mode....
Hmm, interesting question. It looks like the count field in struct
hvc_struct is being used to count opens and closes which should
reference count the IRQ usage too.
Oh, I see, hvc_hangup resets count but the Xen dom0 hv_ops was missing
the hangup hook to release the IRQ -- I'll fix this.
I think this patch can be ignored, real bug is on the Xen side.
Ian.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-01-23 9:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-22 17:56 [PATCH] HVC: do not request the irq twice Ian Campbell
2009-01-22 19:09 ` Christian Borntraeger
2009-01-23 9:45 ` Ian Campbell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®