xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: "Pasi Kärkkäinen" <pasik@iki.fi>
Cc: xen-devel@lists.xensource.com
Subject: Re: xenstored unsafe lock order detected, xlate_proc_name, evtchn_ioctl, port_user_lock
Date: Sun, 06 Jun 2010 10:41:04 -0700	[thread overview]
Message-ID: <4C0BDDB0.3000501@goop.org> (raw)
In-Reply-To: <20100606173355.GS17817@reaktio.net>

On 06/06/2010 10:33 AM, Pasi Kärkkäinen wrote:
> Hello,
>
> I just tried the latest xen/stable-2.6.32.x kernel, ie. 2.6.32.15, with Xen 4.0.0,
> and I got this:
>
> http://pasik.reaktio.net/xen/pv_ops-dom0-debug/log-2.6.32.15-pvops-dom0-xen-stable-x86_64.txt
>   

Does this help?

>From 3f5e554f669098c84c82ce75e7577f7e0f3fccde Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Date: Fri, 28 May 2010 15:28:27 -0700
Subject: [PATCH] xen/evtchn: don't do unbind_from_irqhandler under spinlock

unbind_from_irqhandler can end up doing /proc operations, which can't
happen under a spinlock.  So before removing the IRQ handler,
disable the irq under the port_user lock (masking the underlying event
channel and making sure the irq handler isn't running concurrently and
won't start running), then remove the handler without the lock.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>

diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c
index f79ac5c..6a3a129 100644
--- a/drivers/xen/evtchn.c
+++ b/drivers/xen/evtchn.c
@@ -375,10 +375,12 @@ static long evtchn_ioctl(struct file *file,
 			break;
 		}
 
-		evtchn_unbind_from_user(u, unbind.port);
+		disable_irq(irq_from_evtchn(unbind.port));
 
 		spin_unlock_irq(&port_user_lock);
 
+		evtchn_unbind_from_user(u, unbind.port);
+
 		rc = 0;
 		break;
 	}
@@ -484,11 +486,18 @@ static int evtchn_release(struct inode *inode, struct file *filp)
 		if (get_port_user(i) != u)
 			continue;
 
-		evtchn_unbind_from_user(get_port_user(i), i);
+		disable_irq(irq_from_evtchn(i));
 	}
 
 	spin_unlock_irq(&port_user_lock);
 
+	for (i = 0; i < NR_EVENT_CHANNELS; i++) {
+		if (get_port_user(i) != u)
+			continue;
+
+		evtchn_unbind_from_user(get_port_user(i), i);
+	}
+
 	kfree(u->name);
 	kfree(u);
 

  reply	other threads:[~2010-06-06 17:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-06 17:33 xenstored unsafe lock order detected, xlate_proc_name, evtchn_ioctl, port_user_lock Pasi Kärkkäinen
2010-06-06 17:41 ` Jeremy Fitzhardinge [this message]
2010-06-06 18:54   ` Pasi Kärkkäinen
2010-06-07 12:58     ` Pasi Kärkkäinen
2010-06-07 16:50       ` Jeremy Fitzhardinge
2010-07-20 11:53         ` Pasi Kärkkäinen
2010-07-20 16:17           ` Jeremy Fitzhardinge
2010-07-20 17:17             ` Pasi Kärkkäinen
2010-08-26 18:05               ` Bruce Edge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C0BDDB0.3000501@goop.org \
    --to=jeremy@goop.org \
    --cc=pasik@iki.fi \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).