* [PATCH v2 0/2] vfio: export and make use of pci_dev_trylock()
@ 2021-06-23 2:28 Luis Chamberlain
2021-06-23 2:28 ` [PATCH v2 1/2] PCI: Export pci_dev_trylock() and pci_dev_unlock() Luis Chamberlain
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Luis Chamberlain @ 2021-06-23 2:28 UTC (permalink / raw)
To: bhelgaas, alex.williamson, cohuck, jgg, kevin.tian, eric.auger,
giovanni.cabiddu, mjrosato, jannh, kvm, linux-pci, schnelle
Cc: minchan, gregkh, rafael, jeyu, ngupta, sergey.senozhatsky.work,
mcgrof, axboe, mbenes, jpoimboe, tglx, keescook, jikos, rostedt,
peterz, linux-kernel
This v2 series addreses the changes requested by Bjorn, namely:
- moved the new forward declarations next to pci_cfg_access_lock()
as requested
- modify the subject patch for the first PCI patch
Luis Chamberlain (2):
PCI: Export pci_dev_trylock() and pci_dev_unlock()
vfio: use the new pci_dev_trylock() helper to simplify try lock
drivers/pci/pci.c | 6 ++++--
drivers/vfio/pci/vfio_pci.c | 11 ++++-------
include/linux/pci.h | 3 +++
3 files changed, 11 insertions(+), 9 deletions(-)
--
2.30.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 1/2] PCI: Export pci_dev_trylock() and pci_dev_unlock()
2021-06-23 2:28 [PATCH v2 0/2] vfio: export and make use of pci_dev_trylock() Luis Chamberlain
@ 2021-06-23 2:28 ` Luis Chamberlain
2021-06-23 9:30 ` Cornelia Huck
2021-06-23 2:28 ` [PATCH v2 2/2] vfio: use the new pci_dev_trylock() helper to simplify try lock Luis Chamberlain
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Luis Chamberlain @ 2021-06-23 2:28 UTC (permalink / raw)
To: bhelgaas, alex.williamson, cohuck, jgg, kevin.tian, eric.auger,
giovanni.cabiddu, mjrosato, jannh, kvm, linux-pci, schnelle
Cc: minchan, gregkh, rafael, jeyu, ngupta, sergey.senozhatsky.work,
mcgrof, axboe, mbenes, jpoimboe, tglx, keescook, jikos, rostedt,
peterz, linux-kernel
Other places in the kernel use this form, and so just
provide a common path for it.
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
drivers/pci/pci.c | 6 ++++--
include/linux/pci.h | 3 +++
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index f09821af1d2e..b1d9bb3f5ae2 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -5027,7 +5027,7 @@ static void pci_dev_lock(struct pci_dev *dev)
}
/* Return 1 on successful lock, 0 on contention */
-static int pci_dev_trylock(struct pci_dev *dev)
+int pci_dev_trylock(struct pci_dev *dev)
{
if (pci_cfg_access_trylock(dev)) {
if (device_trylock(&dev->dev))
@@ -5037,12 +5037,14 @@ static int pci_dev_trylock(struct pci_dev *dev)
return 0;
}
+EXPORT_SYMBOL_GPL(pci_dev_trylock);
-static void pci_dev_unlock(struct pci_dev *dev)
+void pci_dev_unlock(struct pci_dev *dev)
{
device_unlock(&dev->dev);
pci_cfg_access_unlock(dev);
}
+EXPORT_SYMBOL_GPL(pci_dev_unlock);
static void pci_dev_save_and_disable(struct pci_dev *dev)
{
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 6248e044dd29..d8f056f3a2e3 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1622,6 +1622,9 @@ void pci_cfg_access_lock(struct pci_dev *dev);
bool pci_cfg_access_trylock(struct pci_dev *dev);
void pci_cfg_access_unlock(struct pci_dev *dev);
+int pci_dev_trylock(struct pci_dev *dev);
+void pci_dev_unlock(struct pci_dev *dev);
+
/*
* PCI domain support. Sometimes called PCI segment (eg by ACPI),
* a PCI domain is defined to be a set of PCI buses which share
--
2.30.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 2/2] vfio: use the new pci_dev_trylock() helper to simplify try lock
2021-06-23 2:28 [PATCH v2 0/2] vfio: export and make use of pci_dev_trylock() Luis Chamberlain
2021-06-23 2:28 ` [PATCH v2 1/2] PCI: Export pci_dev_trylock() and pci_dev_unlock() Luis Chamberlain
@ 2021-06-23 2:28 ` Luis Chamberlain
2021-06-23 9:31 ` Cornelia Huck
2021-06-23 18:20 ` Jason Gunthorpe
2021-06-23 18:17 ` [PATCH v2 0/2] vfio: export and make use of pci_dev_trylock() Alex Williamson
2021-06-25 15:04 ` Alex Williamson
3 siblings, 2 replies; 9+ messages in thread
From: Luis Chamberlain @ 2021-06-23 2:28 UTC (permalink / raw)
To: bhelgaas, alex.williamson, cohuck, jgg, kevin.tian, eric.auger,
giovanni.cabiddu, mjrosato, jannh, kvm, linux-pci, schnelle
Cc: minchan, gregkh, rafael, jeyu, ngupta, sergey.senozhatsky.work,
mcgrof, axboe, mbenes, jpoimboe, tglx, keescook, jikos, rostedt,
peterz, linux-kernel
Use the new pci_dev_trylock() helper to simplify our locking.
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
drivers/vfio/pci/vfio_pci.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
index bd7c482c948a..02b05f7b9a91 100644
--- a/drivers/vfio/pci/vfio_pci.c
+++ b/drivers/vfio/pci/vfio_pci.c
@@ -477,13 +477,10 @@ static void vfio_pci_disable(struct vfio_pci_device *vdev)
* We can not use the "try" reset interface here, which will
* overwrite the previously restored configuration information.
*/
- if (vdev->reset_works && pci_cfg_access_trylock(pdev)) {
- if (device_trylock(&pdev->dev)) {
- if (!__pci_reset_function_locked(pdev))
- vdev->needs_reset = false;
- device_unlock(&pdev->dev);
- }
- pci_cfg_access_unlock(pdev);
+ if (vdev->reset_works && pci_dev_trylock(pdev)) {
+ if (!__pci_reset_function_locked(pdev))
+ vdev->needs_reset = false;
+ pci_dev_unlock(pdev);
}
pci_restore_state(pdev);
--
2.30.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2 1/2] PCI: Export pci_dev_trylock() and pci_dev_unlock()
2021-06-23 2:28 ` [PATCH v2 1/2] PCI: Export pci_dev_trylock() and pci_dev_unlock() Luis Chamberlain
@ 2021-06-23 9:30 ` Cornelia Huck
0 siblings, 0 replies; 9+ messages in thread
From: Cornelia Huck @ 2021-06-23 9:30 UTC (permalink / raw)
To: Luis Chamberlain, bhelgaas, alex.williamson, jgg, kevin.tian,
eric.auger, giovanni.cabiddu, mjrosato, jannh, kvm, linux-pci,
schnelle
Cc: minchan, gregkh, rafael, jeyu, ngupta, sergey.senozhatsky.work,
mcgrof, axboe, mbenes, jpoimboe, tglx, keescook, jikos, rostedt,
peterz, linux-kernel
On Tue, Jun 22 2021, Luis Chamberlain <mcgrof@kernel.org> wrote:
> Other places in the kernel use this form, and so just
> provide a common path for it.
>
> Acked-by: Bjorn Helgaas <bhelgaas@google.com>
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
> ---
> drivers/pci/pci.c | 6 ++++--
> include/linux/pci.h | 3 +++
> 2 files changed, 7 insertions(+), 2 deletions(-)
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 2/2] vfio: use the new pci_dev_trylock() helper to simplify try lock
2021-06-23 2:28 ` [PATCH v2 2/2] vfio: use the new pci_dev_trylock() helper to simplify try lock Luis Chamberlain
@ 2021-06-23 9:31 ` Cornelia Huck
2021-06-23 18:20 ` Jason Gunthorpe
1 sibling, 0 replies; 9+ messages in thread
From: Cornelia Huck @ 2021-06-23 9:31 UTC (permalink / raw)
To: Luis Chamberlain, bhelgaas, alex.williamson, jgg, kevin.tian,
eric.auger, giovanni.cabiddu, mjrosato, jannh, kvm, linux-pci,
schnelle
Cc: minchan, gregkh, rafael, jeyu, ngupta, sergey.senozhatsky.work,
mcgrof, axboe, mbenes, jpoimboe, tglx, keescook, jikos, rostedt,
peterz, linux-kernel
On Tue, Jun 22 2021, Luis Chamberlain <mcgrof@kernel.org> wrote:
> Use the new pci_dev_trylock() helper to simplify our locking.
>
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
> ---
> drivers/vfio/pci/vfio_pci.c | 11 ++++-------
> 1 file changed, 4 insertions(+), 7 deletions(-)
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 0/2] vfio: export and make use of pci_dev_trylock()
2021-06-23 2:28 [PATCH v2 0/2] vfio: export and make use of pci_dev_trylock() Luis Chamberlain
2021-06-23 2:28 ` [PATCH v2 1/2] PCI: Export pci_dev_trylock() and pci_dev_unlock() Luis Chamberlain
2021-06-23 2:28 ` [PATCH v2 2/2] vfio: use the new pci_dev_trylock() helper to simplify try lock Luis Chamberlain
@ 2021-06-23 18:17 ` Alex Williamson
2021-06-25 15:04 ` Alex Williamson
3 siblings, 0 replies; 9+ messages in thread
From: Alex Williamson @ 2021-06-23 18:17 UTC (permalink / raw)
To: Luis Chamberlain, bhelgaas
Cc: cohuck, jgg, kevin.tian, eric.auger, giovanni.cabiddu, mjrosato,
jannh, kvm, linux-pci, schnelle, minchan, gregkh, rafael, jeyu,
ngupta, sergey.senozhatsky.work, axboe, mbenes, jpoimboe, tglx,
keescook, jikos, rostedt, peterz, linux-kernel
On Tue, 22 Jun 2021 19:28:22 -0700
Luis Chamberlain <mcgrof@kernel.org> wrote:
> This v2 series addreses the changes requested by Bjorn, namely:
>
> - moved the new forward declarations next to pci_cfg_access_lock()
> as requested
> - modify the subject patch for the first PCI patch
Looks ok to me and I assume by Bjorn's Ack that he's expecting it to go
through my tree. I'll give a bit of time to note otherwise if that's
not the case. Thanks,
Alex
> Luis Chamberlain (2):
> PCI: Export pci_dev_trylock() and pci_dev_unlock()
> vfio: use the new pci_dev_trylock() helper to simplify try lock
>
> drivers/pci/pci.c | 6 ++++--
> drivers/vfio/pci/vfio_pci.c | 11 ++++-------
> include/linux/pci.h | 3 +++
> 3 files changed, 11 insertions(+), 9 deletions(-)
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 2/2] vfio: use the new pci_dev_trylock() helper to simplify try lock
2021-06-23 2:28 ` [PATCH v2 2/2] vfio: use the new pci_dev_trylock() helper to simplify try lock Luis Chamberlain
2021-06-23 9:31 ` Cornelia Huck
@ 2021-06-23 18:20 ` Jason Gunthorpe
1 sibling, 0 replies; 9+ messages in thread
From: Jason Gunthorpe @ 2021-06-23 18:20 UTC (permalink / raw)
To: Luis Chamberlain
Cc: bhelgaas, alex.williamson, cohuck, kevin.tian, eric.auger,
giovanni.cabiddu, mjrosato, jannh, kvm, linux-pci, schnelle,
minchan, gregkh, rafael, jeyu, ngupta, sergey.senozhatsky.work,
axboe, mbenes, jpoimboe, tglx, keescook, jikos, rostedt, peterz,
linux-kernel
On Tue, Jun 22, 2021 at 07:28:24PM -0700, Luis Chamberlain wrote:
> Use the new pci_dev_trylock() helper to simplify our locking.
>
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
> ---
> drivers/vfio/pci/vfio_pci.c | 11 ++++-------
> 1 file changed, 4 insertions(+), 7 deletions(-)
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Jason
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 0/2] vfio: export and make use of pci_dev_trylock()
2021-06-23 2:28 [PATCH v2 0/2] vfio: export and make use of pci_dev_trylock() Luis Chamberlain
` (2 preceding siblings ...)
2021-06-23 18:17 ` [PATCH v2 0/2] vfio: export and make use of pci_dev_trylock() Alex Williamson
@ 2021-06-25 15:04 ` Alex Williamson
2021-06-25 15:07 ` Alex Williamson
3 siblings, 1 reply; 9+ messages in thread
From: Alex Williamson @ 2021-06-25 15:04 UTC (permalink / raw)
To: Luis Chamberlain
Cc: bhelgaas, cohuck, jgg, kevin.tian, eric.auger, giovanni.cabiddu,
mjrosato, jannh, kvm, linux-pci, schnelle, minchan, gregkh,
rafael, jeyu, ngupta, sergey.senozhatsky.work, axboe, mbenes,
jpoimboe, tglx, keescook, jikos, rostedt, peterz, linux-kernel
On Tue, 22 Jun 2021 19:28:22 -0700
Luis Chamberlain <mcgrof@kernel.org> wrote:
> This v2 series addreses the changes requested by Bjorn, namely:
>
> - moved the new forward declarations next to pci_cfg_access_lock()
> as requested
> - modify the subject patch for the first PCI patch
>
> Luis Chamberlain (2):
> PCI: Export pci_dev_trylock() and pci_dev_unlock()
> vfio: use the new pci_dev_trylock() helper to simplify try lock
>
> drivers/pci/pci.c | 6 ++++--
> drivers/vfio/pci/vfio_pci.c | 11 ++++-------
> include/linux/pci.h | 3 +++
> 3 files changed, 11 insertions(+), 9 deletions(-)
>
Applied to vfio next branch for v5.14 with Bjorn's Ack, thanks!
Alex
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 0/2] vfio: export and make use of pci_dev_trylock()
2021-06-25 15:04 ` Alex Williamson
@ 2021-06-25 15:07 ` Alex Williamson
0 siblings, 0 replies; 9+ messages in thread
From: Alex Williamson @ 2021-06-25 15:07 UTC (permalink / raw)
To: Luis Chamberlain
Cc: bhelgaas, cohuck, jgg, kevin.tian, eric.auger, giovanni.cabiddu,
mjrosato, jannh, kvm, linux-pci, schnelle, minchan, gregkh,
rafael, jeyu, ngupta, sergey.senozhatsky.work, axboe, mbenes,
jpoimboe, tglx, keescook, jikos, rostedt, peterz, linux-kernel
On Fri, 25 Jun 2021 09:04:51 -0600
Alex Williamson <alex.williamson@redhat.com> wrote:
> On Tue, 22 Jun 2021 19:28:22 -0700
> Luis Chamberlain <mcgrof@kernel.org> wrote:
>
> > This v2 series addreses the changes requested by Bjorn, namely:
> >
> > - moved the new forward declarations next to pci_cfg_access_lock()
> > as requested
> > - modify the subject patch for the first PCI patch
> >
> > Luis Chamberlain (2):
> > PCI: Export pci_dev_trylock() and pci_dev_unlock()
> > vfio: use the new pci_dev_trylock() helper to simplify try lock
> >
> > drivers/pci/pci.c | 6 ++++--
> > drivers/vfio/pci/vfio_pci.c | 11 ++++-------
> > include/linux/pci.h | 3 +++
> > 3 files changed, 11 insertions(+), 9 deletions(-)
> >
>
> Applied to vfio next branch for v5.14 with Bjorn's Ack, thanks!
(and Jason & Conny's R-b)
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-06-25 15:07 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-23 2:28 [PATCH v2 0/2] vfio: export and make use of pci_dev_trylock() Luis Chamberlain
2021-06-23 2:28 ` [PATCH v2 1/2] PCI: Export pci_dev_trylock() and pci_dev_unlock() Luis Chamberlain
2021-06-23 9:30 ` Cornelia Huck
2021-06-23 2:28 ` [PATCH v2 2/2] vfio: use the new pci_dev_trylock() helper to simplify try lock Luis Chamberlain
2021-06-23 9:31 ` Cornelia Huck
2021-06-23 18:20 ` Jason Gunthorpe
2021-06-23 18:17 ` [PATCH v2 0/2] vfio: export and make use of pci_dev_trylock() Alex Williamson
2021-06-25 15:04 ` Alex Williamson
2021-06-25 15:07 ` Alex Williamson
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).