vfio/pci: Remove redundant declaration of vfio_pci_driver
Subsystems (2)
PATCH v2 1/2 vfio/pci: Remove redundant declaration of vfio_pci_driver
It was added by commit 137e5531351d ("vfio/pci: Add sriov_configure support") but duplicates a forward declaration earlier in the file.
Remove it.
---
* From v1:
- Clarify the commit message per Alex's suggestion.
- Add Cornelia's R-b tag.
drivers/vfio/pci/vfio_pci.c | 1 - 1 file changed, 1 deletion(-)
drivers/vfio/pci/vfio_pci.c +0 -1
@@ -1862,7 +1862,6 @@ static const struct vfio_device_ops vfio_pci_ops = {static int vfio_pci_reflck_attach (struct vfio_pci_device *vdev);static void vfio_pci_reflck_put (struct vfio_pci_reflck *reflck); -static struct pci_driver vfio_pci_driver;static int vfio_pci_bus_notifier (struct notifier_block *nb,unsigned long action,void *data)
Signature · 1 line
2.19.1
PATCH v2 2/2 vfio/pci: Don't regenerate vconfig for all BARs if !bardirty
Now we regenerate vconfig for all the BARs via vfio_bar_fixup(), every time any offset of any of them are read. Though BARs aren't re-read regularly, the regeneration can be avoid if no BARs had been written since they were last read, in which case the vdev->bardirty is false.
Let's predicate the vfio_bar_fixup() on the bardirty so that it can return immediately if !bardirty.
---
* From v1:
- Per Alex's suggestion, let vfio_bar_fixup() test vdev->bardirty to avoid doing work if bardirty is false, instead of removing it entirely.
- Rewrite the commit message.
drivers/vfio/pci/vfio_pci_config.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/vfio/pci/vfio_pci_config.c +3 -0
@@ -467,6 +467,9 @@ static void vfio_bar_fixup(struct vfio_pci_device *vdev)__le32 *vbar;u64 mask; +if (!vdev->bardirty) +return ; + vbar = (__le32 *)&vdev->vconfig[PCI_BASE_ADDRESS_0 ];for (i =0 ; i <PCI_STD_NUM_BARS ; i++, vbar++) {
Signature · 1 line
2.19.1
Re: [PATCH v2 2/2] vfio/pci: Don't regenerate vconfig for all BARs if !bardirty
Quoted 3 lines · On Mon, 21 Sep 2020 12:51:16 +0800 Zenghui Yu <[email protected]> wrote:
Now we regenerate vconfig for all the BARs via
vfio_bar_fixup(), every time any offset of any of them are read. Though BARs aren't re-read regularly, the regeneration can be avoid if no BARs had been written since they were
s/avoid/avoided/
Quoted 1 line
last read, in which case the
vdev->bardirtyis false.
s/the//
Quoted 3 lines
Let's predicate the
vfio_bar_fixup()on the bardirty so that it can return immediately if !bardirty.
Maybe
"Let's return immediately in vfio_bar_fixup() if bardirty is false." ?
Quoted 17 lines
Suggested-by Alex Williamson <[email protected]>Signed-off-by Zenghui Yu <[email protected]>---
* From v1:
- Per Alex's suggestion, letvfio_bar_fixup()testvdev->bardirtyto avoid doing work if bardirty is false, instead of removing it entirely.
- Rewrite the commit message.drivers/vfio/pci/vfio_pci_config.c | 3 +++ 1 file changed, 3 insertions(+)drivers/vfio/pci/vfio_pci_config.c +0
-0
drivers/vfio/pci/vfio_pci_config.c static void vfio_bar_fixup(struct vfio_pci_device *vdev) · line 470
Quoted 4 lines
drivers/vfio/pci/vfio_pci_config.c +1
-0@@ -467,6 +467,9 @@ static void vfio_bar_fixup(struct vfio_pci_device *vdev)__le32 *vbar;u64 mask; +if (!vdev->bardirty)
Finally, bardirty can actually affect something :)
drivers/vfio/pci/vfio_pci_config.c static void vfio_bar_fixup(struct vfio_pci_device *vdev) · line 475
Quoted 5 lines
drivers/vfio/pci/vfio_pci_config.c +2
-0+return ; + vbar = (__le32 *)&vdev->vconfig[PCI_BASE_ADDRESS_0 ];for (i =0 ; i <PCI_STD_NUM_BARS ; i++, vbar++) {
Re: [PATCH v2 2/2] vfio/pci: Don't regenerate vconfig for all BARs if !bardirty
Hi Cornelia,
Quoted 14 lines · Cornelia Huck
Quoted 3 lines · On Mon, 21 Sep 2020 12:51:16 +0800 Zenghui Yu <[email protected]> wrote:
Now we regenerate vconfig for all the BARs via
vfio_bar_fixup(), every time any offset of any of them are read. Though BARs aren't re-read regularly, the regeneration can be avoid if no BARs had been written since they weres/avoid/avoided/
Quoted 1 line
last read, in which case the
vdev->bardirtyis false.s/the//
Quoted 1 line
Quoted 6 lines
Quoted 2 lines
Let's predicate the
vfio_bar_fixup()on the bardirty so that it can return immediately if !bardirty.Maybe
"Let's return immediately in
vfio_bar_fixup()if bardirty is false." ?
Yes.
Quoted 24 lines
Quoted 17 lines
Suggested-by Alex Williamson <[email protected]>Signed-off-by Zenghui Yu <[email protected]>---
* From v1:
- Per Alex's suggestion, letvfio_bar_fixup()testvdev->bardirtyto avoid doing work if bardirty is false, instead of removing it entirely.
- Rewrite the commit message.drivers/vfio/pci/vfio_pci_config.c | 3 +++ 1 file changed, 3 insertions(+)drivers/vfio/pci/vfio_pci_config.c +0
-0drivers/vfio/pci/vfio_pci_config.c static void vfio_bar_fixup(struct vfio_pci_device *vdev) · line 470
Quoted 4 lines
drivers/vfio/pci/vfio_pci_config.c +1
-0@@ -467,6 +467,9 @@ static void vfio_bar_fixup(struct vfio_pci_device *vdev)__le32 *vbar;u64 mask; +if (!vdev->bardirty)Finally, bardirty can actually affect something :)
Quoted 7 lines
drivers/vfio/pci/vfio_pci_config.c static void vfio_bar_fixup(struct vfio_pci_device *vdev) · line 475
Quoted 5 lines
drivers/vfio/pci/vfio_pci_config.c +2
-0+return ; + vbar = (__le32 *)&vdev->vconfig[PCI_BASE_ADDRESS_0 ];for (i =0 ; i <PCI_STD_NUM_BARS ; i++, vbar++) {Reviewed-by Cornelia Huck <[email protected]>
Thanks for you review! I think Alex can help fix the commit message when applying? Otherwise I can send a v3.
Thanks,
Zenghui