From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH 1/3] xen/evtchn: avoid a deadlock when unbinding an event channel Date: Mon, 29 Jul 2013 10:07:27 -0400 Message-ID: <20130729140727.GA5848@phenom.dumpdata.com> References: <1374245520-19270-1-git-send-email-david.vrabel@citrix.com> <1374245520-19270-2-git-send-email-david.vrabel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1374245520-19270-2-git-send-email-david.vrabel@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: David Vrabel Cc: xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Fri, Jul 19, 2013 at 03:51:58PM +0100, David Vrabel wrote: > From: David Vrabel > > Unbinding an event channel (either with the ioctl or when the evtchn > device is closed) may deadlock because disable_irq() is called with > port_user_lock held which is also locked by the interrupt handler. So what you are saying is that if the ioctl IOCTL_EVTCHN_UNBIND is called (and takes an spinlock) and the evtchn_interrupt triggers it would deadlock? But isn't this the IRQ variant of spinlock? Which disables interrupts? Could you perhaps write this out a bit with CPU1 and CPU2 in seperate columns? I think I must missing something. Thanks! > > Using get_port_user() to check if a port's user is safe without the > spin lock (as it's protected by u->bind_mutex in the ioctl) so just > remove the unnesssary locking. What about in the interrupt handler? It does not use the mutex? How will it protect the get_port_user() from being stale?