All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Matthew Rosato <mjrosato@linux.ibm.com>
Cc: akrowiak@linux.ibm.com, jjherne@linux.ibm.com,
	farman@linux.ibm.com, imbrenda@linux.ibm.com,
	frankja@linux.ibm.com, pmorel@linux.ibm.com, david@redhat.com,
	seanjc@google.com, intel-gfx@lists.freedesktop.org,
	cohuck@redhat.com, linux-kernel@vger.kernel.org,
	pasic@linux.ibm.com, kvm@vger.kernel.org, pbonzini@redhat.com,
	linux-s390@vger.kernel.org, borntraeger@linux.ibm.com,
	intel-gvt-dev@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v2] vfio: fix potential deadlock on vfio group lock
Date: Fri, 13 Jan 2023 10:50:29 -0400	[thread overview]
Message-ID: <Y8FvtS3uOFUnSxss@nvidia.com> (raw)
In-Reply-To: <bce7912a-f904-b5a3-d234-c3e2c42d9e54@linux.ibm.com>

On Thu, Jan 12, 2023 at 04:51:36PM -0500, Matthew Rosato wrote:

> Yep, thanks.  I will surround this bit of code with
> 
> mutex_lock(&device->dev_set->lock);
> ..
> mutex_unlock(&device->dev_set->lock);

Don't do it like that, copy the kvm out of the struct device to the
stack and NULL it. Then do the put without holding any locks.

Jason

WARNING: multiple messages have this Message-ID (diff)
From: Jason Gunthorpe <jgg@nvidia.com>
To: Matthew Rosato <mjrosato@linux.ibm.com>
Cc: Alex Williamson <alex.williamson@redhat.com>,
	pbonzini@redhat.com, cohuck@redhat.com, farman@linux.ibm.com,
	pmorel@linux.ibm.com, borntraeger@linux.ibm.com,
	frankja@linux.ibm.com, imbrenda@linux.ibm.com, david@redhat.com,
	akrowiak@linux.ibm.com, jjherne@linux.ibm.com,
	pasic@linux.ibm.com, zhenyuw@linux.intel.com,
	zhi.a.wang@intel.com, seanjc@google.com,
	linux-s390@vger.kernel.org, kvm@vger.kernel.org,
	intel-gvt-dev@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] vfio: fix potential deadlock on vfio group lock
Date: Fri, 13 Jan 2023 10:50:29 -0400	[thread overview]
Message-ID: <Y8FvtS3uOFUnSxss@nvidia.com> (raw)
In-Reply-To: <bce7912a-f904-b5a3-d234-c3e2c42d9e54@linux.ibm.com>

On Thu, Jan 12, 2023 at 04:51:36PM -0500, Matthew Rosato wrote:

> Yep, thanks.  I will surround this bit of code with
> 
> mutex_lock(&device->dev_set->lock);
> ..
> mutex_unlock(&device->dev_set->lock);

Don't do it like that, copy the kvm out of the struct device to the
stack and NULL it. Then do the put without holding any locks.

Jason

  parent reply	other threads:[~2023-01-13 14:50 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-12 20:38 [Intel-gfx] [PATCH v2] vfio: fix potential deadlock on vfio group lock Matthew Rosato
2023-01-12 20:38 ` Matthew Rosato
2023-01-12 21:05 ` [Intel-gfx] " Alex Williamson
2023-01-12 21:05   ` Alex Williamson
2023-01-12 21:51   ` [Intel-gfx] " Matthew Rosato
2023-01-12 21:51     ` Matthew Rosato
2023-01-12 23:29     ` [Intel-gfx] " Sean Christopherson
2023-01-12 23:29       ` Sean Christopherson
2023-01-13  0:56       ` [Intel-gfx] " Alex Williamson
2023-01-13  0:56         ` Alex Williamson
2023-01-13  2:05         ` [Intel-gfx] " Sean Christopherson
2023-01-13  2:05           ` Sean Christopherson
2023-01-13 14:49           ` [Intel-gfx] " Jason Gunthorpe
2023-01-13 14:49             ` Jason Gunthorpe
2023-01-13 14:50     ` Jason Gunthorpe [this message]
2023-01-13 14:50       ` Jason Gunthorpe
2023-01-12 21:45 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2023-01-13  2:12 ` [Intel-gfx] [PATCH v2] " kernel test robot
2023-01-13  2:12   ` kernel test robot
2023-01-13 11:55 ` [Intel-gfx] ✓ Fi.CI.IGT: success for " Patchwork
2023-01-13 13:04 ` [Intel-gfx] [PATCH v2] " Matthew Rosato
2023-01-13 13:04   ` Matthew Rosato

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=Y8FvtS3uOFUnSxss@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=akrowiak@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=farman@linux.ibm.com \
    --cc=frankja@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-gvt-dev@lists.freedesktop.org \
    --cc=jjherne@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mjrosato@linux.ibm.com \
    --cc=pasic@linux.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=pmorel@linux.ibm.com \
    --cc=seanjc@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.