Re: [PATCH 1/2] xen: privcmd: Switch from mutex to spinlock for irqfds
From: Viresh Kumar
Date: Tue Jul 02 2024 - 06:17:39 EST
On 02-07-24, 12:12, Juergen Gross wrote:
> On 18.06.24 11:42, Viresh Kumar wrote:
> > irqfd_wakeup() gets EPOLLHUP, when it is called by
> > eventfd_release() by way of wake_up_poll(&ctx->wqh, EPOLLHUP), which
> > gets called under spin_lock_irqsave(). We can't use a mutex here as it
> > will lead to a deadlock.
> >
> > Fix it by switching over to a spin lock.
> >
> > Reported-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
> > Signed-off-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
> > ---
> > drivers/xen/privcmd.c | 26 +++++++++++++++-----------
> > 1 file changed, 15 insertions(+), 11 deletions(-)
> >
> > diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c
> > index 67dfa4778864..5ceb6c56cf3e 100644
> > --- a/drivers/xen/privcmd.c
> > +++ b/drivers/xen/privcmd.c
> > @@ -13,7 +13,6 @@
> > #include <linux/file.h>
> > #include <linux/kernel.h>
> > #include <linux/module.h>
> > -#include <linux/mutex.h>
>
> I don't think you can drop that. There is still the ioreq_lock mutex.
You are right. The header got included from somewhere else I believe
since the build didn't fail for me.
> I can fix that up while committing, with that:
>
> Reviewed-by: Juergen Gross <jgross@xxxxxxxx>
Thanks.
--
viresh