Re: Spinlock recursion in hvc_poll

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Christian Borntraeger
Date: Thursday, August 7, 2008 - 12:18 am

Am Mittwoch, 6. August 2008 schrieb Alex Nixon:

Rusty,

can this patch go into 2.6.27-rc* via your queue?

---snip----

[PATCH] fix spinlock recursion in hvc_console

commit 611e097d7707741a336a0677d9d69bec40f29f3d
Author: Christian Borntraeger <borntraeger@de.ibm.com>
hvc_console: rework setup to replace irq functions with callbacks
introduced a spinlock recursion problem. 

request_irq tries to call the handler if the IRQ is shared.
The irq handler of hvc_console calls hvc_poll and hvc_kill
which might take the hvc_struct spinlock. Therefore, we have
to call request_irq outside the spinlock.

We can move the notifier_add safely outside the spinlock as ->data must
not be changed by the backend. Otherwise, tty_hangup would fail anyway.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 drivers/char/hvc_console.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Index: kvm/drivers/char/hvc_console.c
===================================================================
--- kvm.orig/drivers/char/hvc_console.c
+++ kvm/drivers/char/hvc_console.c
@@ -322,11 +322,10 @@ static int hvc_open(struct tty_struct *t
 
 	hp->tty = tty;
 
-	if (hp->ops->notifier_add)
-		rc = hp->ops->notifier_add(hp, hp->data);
-
 	spin_unlock_irqrestore(&hp->lock, flags);
 
+	if (hp->ops->notifier_add)
+		rc = hp->ops->notifier_add(hp, hp->data);
 
 	/*
 	 * If the notifier fails we return an error.  The tty layer
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Spinlock recursion in hvc_poll, Jeremy Fitzhardinge, (Tue Aug 5, 11:08 am)
Re: Spinlock recursion in hvc_poll, Christian Borntraeger, (Tue Aug 5, 1:53 pm)
Re: Spinlock recursion in hvc_poll, Alex Nixon, (Wed Aug 6, 2:12 am)
Re: Spinlock recursion in hvc_poll, Christian Borntraeger, (Thu Aug 7, 12:18 am)
Re: Spinlock recursion in hvc_poll, Rusty Russell, (Thu Aug 7, 11:50 pm)