DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] eal: Fixes VFIO/sysfs race condition
@ 2020-03-31 16:56 Michael Haeuptle
  2020-04-01  8:50 ` Stojaczyk, Dariusz
  2020-04-02 10:10 ` Burakov, Anatoly
  0 siblings, 2 replies; 10+ messages in thread
From: Michael Haeuptle @ 2020-03-31 16:56 UTC (permalink / raw)
  To: dev

This fix treats a 0 return value from vfio_open_group_fd
in vfio_get_group_fd as the intended error condition instead
of putting an incorrect 0 file descriptor in the vfio_group table.

Sometimes, the creation of device files in sysfs is not
instantaneously causing vfio_open_groupfd to return 0.
This has been observed when hot removing/adding multiple
NVMe devices (>=4).

Signed-off-by: Michael Haeuptle <michael.haeuptle@hpe.com>
---
 lib/librte_eal/linux/eal_vfio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_eal/linux/eal_vfio.c b/lib/librte_eal/linux/eal_vfio.c
index 4502aefed..1979f6fdd 100644
--- a/lib/librte_eal/linux/eal_vfio.c
+++ b/lib/librte_eal/linux/eal_vfio.c
@@ -379,7 +379,7 @@ vfio_get_group_fd(struct vfio_config *vfio_cfg,
 	}
 
 	vfio_group_fd = vfio_open_group_fd(iommu_group_num);
-	if (vfio_group_fd < 0) {
+	if (vfio_group_fd <= 0) {
 		RTE_LOG(ERR, EAL, "Failed to open group %d\n", iommu_group_num);
 		return -1;
 	}
-- 
2.18.2


^ permalink raw reply	[flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH] eal: Fixes VFIO/sysfs race condition
@ 2020-04-06 22:23 Michael Haeuptle
  2020-04-21 16:19 ` David Marchand
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Haeuptle @ 2020-04-06 22:23 UTC (permalink / raw)
  To: dev; +Cc: xiao.w.wang, stable

This fix treats a 0 return value from vfio_open_group_fd
in vfio_get_group_fd as the intended error condition instead
of putting an incorrect 0 file descriptor in the vfio_group table.

Sometimes, the creation of device files in sysfs is not
instantaneously causing vfio_open_groupfd to return 0.
This has been observed when hot removing/adding multiple
NVMe devices (>=4).

Fixes: 340b7bb8d583 ("vfio: extend data structure for multi container")
Cc: xiao.w.wang@intel.com
Cc: stable@dpdk.org

Signed-off-by: Michael Haeuptle <michael.haeuptle@hpe.com>
---
 lib/librte_eal/linux/eal_vfio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_eal/linux/eal_vfio.c b/lib/librte_eal/linux/eal_vfio.c
index 4502aefed..1979f6fdd 100644
--- a/lib/librte_eal/linux/eal_vfio.c
+++ b/lib/librte_eal/linux/eal_vfio.c
@@ -379,7 +379,7 @@ vfio_get_group_fd(struct vfio_config *vfio_cfg,
 	}
 
 	vfio_group_fd = vfio_open_group_fd(iommu_group_num);
-	if (vfio_group_fd < 0) {
+	if (vfio_group_fd <= 0) {
 		RTE_LOG(ERR, EAL, "Failed to open group %d\n", iommu_group_num);
 		return -1;
 	}
-- 
2.18.2


^ permalink raw reply	[flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH] eal: Fixes VFIO/sysfs race condition
@ 2020-04-06 22:16 Michael Haeuptle
  0 siblings, 0 replies; 10+ messages in thread
From: Michael Haeuptle @ 2020-04-06 22:16 UTC (permalink / raw)
  To: dev; +Cc: stable

This fix treats a 0 return value from vfio_open_group_fd
in vfio_get_group_fd as the intended error condition instead
of putting an incorrect 0 file descriptor in the vfio_group table.

Sometimes, the creation of device files in sysfs is not
instantaneously causing vfio_open_groupfd to return 0.
This has been observed when hot removing/adding multiple
NVMe devices (>=4).

Fixes: 340b7bb8d583 ("vfio: extend data structure for multi container")
Cc: stable@dpdk.org

Signed-off-by: Michael Haeuptle <michael.haeuptle@hpe.com>
---
 lib/librte_eal/linux/eal_vfio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_eal/linux/eal_vfio.c b/lib/librte_eal/linux/eal_vfio.c
index 4502aefed..1979f6fdd 100644
--- a/lib/librte_eal/linux/eal_vfio.c
+++ b/lib/librte_eal/linux/eal_vfio.c
@@ -379,7 +379,7 @@ vfio_get_group_fd(struct vfio_config *vfio_cfg,
 	}
 
 	vfio_group_fd = vfio_open_group_fd(iommu_group_num);
-	if (vfio_group_fd < 0) {
+	if (vfio_group_fd <= 0) {
 		RTE_LOG(ERR, EAL, "Failed to open group %d\n", iommu_group_num);
 		return -1;
 	}
-- 
2.18.2


^ permalink raw reply	[flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH] eal: Fixes VFIO/sysfs race condition
@ 2020-03-31 16:51 Michael Haeuptle
  0 siblings, 0 replies; 10+ messages in thread
From: Michael Haeuptle @ 2020-03-31 16:51 UTC (permalink / raw)
  To: dev

This fix treats a 0 return value from vfio_open_group_fd
in vfio_get_group_fd as the intended error condition instead
of putting an incorrect 0 file descriptor in the vfio_group table.

Sometimes, the creation of device files in sysfs is not
instantaneously causing vfio_open_groupfd to return 0.
This has been observed when hot removing/adding multiple
NVMe devices (>=4).

Signed-off-by: Michael Haeuptle <michael.haeuptle@hpe.com>
---
 lib/librte_eal/linux/eal_vfio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_eal/linux/eal_vfio.c b/lib/librte_eal/linux/eal_vfio.c
index 4502aefed..1979f6fdd 100644
--- a/lib/librte_eal/linux/eal_vfio.c
+++ b/lib/librte_eal/linux/eal_vfio.c
@@ -379,7 +379,7 @@ vfio_get_group_fd(struct vfio_config *vfio_cfg,
 	}
 
 	vfio_group_fd = vfio_open_group_fd(iommu_group_num);
-	if (vfio_group_fd < 0) {
+	if (vfio_group_fd <= 0) {
 		RTE_LOG(ERR, EAL, "Failed to open group %d\n", iommu_group_num);
 		return -1;
 	}
-- 
2.18.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-04-21 16:19 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-31 16:56 [dpdk-dev] [PATCH] eal: Fixes VFIO/sysfs race condition Michael Haeuptle
2020-04-01  8:50 ` Stojaczyk, Dariusz
2020-04-02 10:10 ` Burakov, Anatoly
2020-04-06 13:25   ` David Marchand
2020-04-06 19:15     ` Haeuptle, Michael
2020-04-06 20:08       ` David Marchand
  -- strict thread matches above, loose matches on Subject: below --
2020-04-06 22:23 Michael Haeuptle
2020-04-21 16:19 ` David Marchand
2020-04-06 22:16 Michael Haeuptle
2020-03-31 16:51 Michael Haeuptle

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).