All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-gfx] [PATCH i-g-t] lib/igt_device: Add support for accessing unbound VF PCI devices
@ 2022-02-18 15:19 ` Janusz Krzysztofik
  0 siblings, 0 replies; 9+ messages in thread
From: Janusz Krzysztofik @ 2022-02-18 15:19 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx, Michał Winiarski

The library provides igt_device_get_pci_device() function that allows to
get access to a PCI device from an open DRM device file descriptor.  It
can be used on VF devices as long as a DRM driver is bound to them.
However, SR-IOV tests may want to exercise VF PCI devices created by a PF
without binding any DRM driver to them.

While keeping the API of igt_device_get_pci_device() untouched, extend API
of its underlying helper __igt_device_get_pci_device() with an extra
argument for specifying VF ID of the requested PCI device and expose this
function as public.

While being at it, fix pci_system_cleanup() not called on errors and
instruct users to call it for symmetry when the obtained struct pci_device
is no longer needed.

Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
---
 lib/igt_device.c | 44 ++++++++++++++++++++++++++++++++++++--------
 lib/igt_device.h |  1 +
 2 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/lib/igt_device.c b/lib/igt_device.c
index 07bb0a0d41..56f66afc6f 100644
--- a/lib/igt_device.c
+++ b/lib/igt_device.c
@@ -149,9 +149,9 @@ struct igt_pci_addr {
 	unsigned int function;
 };
 
-static int igt_device_get_pci_addr(int fd, struct igt_pci_addr *pci)
+static int igt_device_get_pci_addr(int fd, unsigned int vf_id, struct igt_pci_addr *pci)
 {
-	char path[IGT_DEV_PATH_LEN];
+	char link[20], path[IGT_DEV_PATH_LEN];
 	char *buf;
 	int sysfs;
 	int len;
@@ -159,11 +159,21 @@ static int igt_device_get_pci_addr(int fd, struct igt_pci_addr *pci)
 	if (!igt_device_is_pci(fd))
 		return -ENODEV;
 
+	if (vf_id)
+		len = snprintf(link, sizeof(link), "device/virtfn%u", vf_id - 1);
+	else
+		len = snprintf(link, sizeof(link), "device");
+	if (igt_warn_on_f(len > sizeof(link) || link[len -1],
+	    "IGT bug: insufficient buffer space for rendering PCI device link name\n"))
+		return -ENOSPC;
+	else if (igt_debug_on_f(len < 0, "unexpected failure from snprintf()\n"))
+		return len;
+
 	sysfs = igt_sysfs_open(fd);
 	if (sysfs == -1)
 		return -ENOENT;
 
-	len = readlinkat(sysfs, "device", path, sizeof(path) - 1);
+	len = readlinkat(sysfs, link, path, sizeof(path) - 1);
 	close(sysfs);
 	if (len == -1)
 		return -ENOENT;
@@ -183,12 +193,25 @@ static int igt_device_get_pci_addr(int fd, struct igt_pci_addr *pci)
 	return 0;
 }
 
-static struct pci_device *__igt_device_get_pci_device(int fd)
+/**
+ * __igt_device_get_pci_device:
+ *
+ * @fd: DRM device file descriptor
+ * @vf_id: virtual function number (0 if native or PF)
+ *
+ * Looks up the graphics pci device using libpciaccess.
+ * Since pci_system_init() is called, users are expected to call pci_sytem_clenup() after use
+ * unless an error occurs and NULL is returned.
+ *
+ * Returns:
+ * The pci_device, NULL on any failures.
+ */
+struct pci_device *__igt_device_get_pci_device(int fd, unsigned int vf_id)
 {
 	struct igt_pci_addr pci_addr;
 	struct pci_device *pci_dev;
 
-	if (igt_device_get_pci_addr(fd, &pci_addr)) {
+	if (igt_device_get_pci_addr(fd, vf_id, &pci_addr)) {
 		igt_warn("Unable to find device PCI address\n");
 		return NULL;
 	}
@@ -206,15 +229,19 @@ static struct pci_device *__igt_device_get_pci_device(int fd)
 		igt_warn("Couldn't find PCI device %04x:%02x:%02x:%02x\n",
 			 pci_addr.domain, pci_addr.bus,
 			 pci_addr.device, pci_addr.function);
-		return NULL;
+		goto cleanup;
 	}
 
 	if (pci_device_probe(pci_dev)) {
 		igt_warn("Couldn't probe PCI device\n");
-		return NULL;
+		goto cleanup;
 	}
 
 	return pci_dev;
+
+cleanup:
+	pci_system_cleanup();
+	return NULL;
 }
 
 /**
@@ -223,6 +250,7 @@ static struct pci_device *__igt_device_get_pci_device(int fd)
  * @fd: the device
  *
  * Looks up the main graphics pci device using libpciaccess.
+ * Since pci_system_init() is called, users are expected to call pci_sytem_clenup() after use.
  *
  * Returns:
  * The pci_device, skips the test on any failures.
@@ -231,7 +259,7 @@ struct pci_device *igt_device_get_pci_device(int fd)
 {
 	struct pci_device *pci_dev;
 
-	pci_dev = __igt_device_get_pci_device(fd);
+	pci_dev = __igt_device_get_pci_device(fd, 0);
 	igt_require(pci_dev);
 
 	return pci_dev;
diff --git a/lib/igt_device.h b/lib/igt_device.h
index 278ba7a9b3..1aaa840e25 100644
--- a/lib/igt_device.h
+++ b/lib/igt_device.h
@@ -33,5 +33,6 @@ void igt_device_drop_master(int fd);
 
 int igt_device_get_card_index(int fd);
 struct pci_device *igt_device_get_pci_device(int fd);
+struct pci_device *__igt_device_get_pci_device(int fd, unsigned int vf_id);
 
 #endif /* __IGT_DEVICE_H__ */
-- 
2.25.1


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

* [igt-dev] [PATCH i-g-t] lib/igt_device: Add support for accessing unbound VF PCI devices
@ 2022-02-18 15:19 ` Janusz Krzysztofik
  0 siblings, 0 replies; 9+ messages in thread
From: Janusz Krzysztofik @ 2022-02-18 15:19 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx, Michał Winiarski

The library provides igt_device_get_pci_device() function that allows to
get access to a PCI device from an open DRM device file descriptor.  It
can be used on VF devices as long as a DRM driver is bound to them.
However, SR-IOV tests may want to exercise VF PCI devices created by a PF
without binding any DRM driver to them.

While keeping the API of igt_device_get_pci_device() untouched, extend API
of its underlying helper __igt_device_get_pci_device() with an extra
argument for specifying VF ID of the requested PCI device and expose this
function as public.

While being at it, fix pci_system_cleanup() not called on errors and
instruct users to call it for symmetry when the obtained struct pci_device
is no longer needed.

Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
---
 lib/igt_device.c | 44 ++++++++++++++++++++++++++++++++++++--------
 lib/igt_device.h |  1 +
 2 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/lib/igt_device.c b/lib/igt_device.c
index 07bb0a0d41..56f66afc6f 100644
--- a/lib/igt_device.c
+++ b/lib/igt_device.c
@@ -149,9 +149,9 @@ struct igt_pci_addr {
 	unsigned int function;
 };
 
-static int igt_device_get_pci_addr(int fd, struct igt_pci_addr *pci)
+static int igt_device_get_pci_addr(int fd, unsigned int vf_id, struct igt_pci_addr *pci)
 {
-	char path[IGT_DEV_PATH_LEN];
+	char link[20], path[IGT_DEV_PATH_LEN];
 	char *buf;
 	int sysfs;
 	int len;
@@ -159,11 +159,21 @@ static int igt_device_get_pci_addr(int fd, struct igt_pci_addr *pci)
 	if (!igt_device_is_pci(fd))
 		return -ENODEV;
 
+	if (vf_id)
+		len = snprintf(link, sizeof(link), "device/virtfn%u", vf_id - 1);
+	else
+		len = snprintf(link, sizeof(link), "device");
+	if (igt_warn_on_f(len > sizeof(link) || link[len -1],
+	    "IGT bug: insufficient buffer space for rendering PCI device link name\n"))
+		return -ENOSPC;
+	else if (igt_debug_on_f(len < 0, "unexpected failure from snprintf()\n"))
+		return len;
+
 	sysfs = igt_sysfs_open(fd);
 	if (sysfs == -1)
 		return -ENOENT;
 
-	len = readlinkat(sysfs, "device", path, sizeof(path) - 1);
+	len = readlinkat(sysfs, link, path, sizeof(path) - 1);
 	close(sysfs);
 	if (len == -1)
 		return -ENOENT;
@@ -183,12 +193,25 @@ static int igt_device_get_pci_addr(int fd, struct igt_pci_addr *pci)
 	return 0;
 }
 
-static struct pci_device *__igt_device_get_pci_device(int fd)
+/**
+ * __igt_device_get_pci_device:
+ *
+ * @fd: DRM device file descriptor
+ * @vf_id: virtual function number (0 if native or PF)
+ *
+ * Looks up the graphics pci device using libpciaccess.
+ * Since pci_system_init() is called, users are expected to call pci_sytem_clenup() after use
+ * unless an error occurs and NULL is returned.
+ *
+ * Returns:
+ * The pci_device, NULL on any failures.
+ */
+struct pci_device *__igt_device_get_pci_device(int fd, unsigned int vf_id)
 {
 	struct igt_pci_addr pci_addr;
 	struct pci_device *pci_dev;
 
-	if (igt_device_get_pci_addr(fd, &pci_addr)) {
+	if (igt_device_get_pci_addr(fd, vf_id, &pci_addr)) {
 		igt_warn("Unable to find device PCI address\n");
 		return NULL;
 	}
@@ -206,15 +229,19 @@ static struct pci_device *__igt_device_get_pci_device(int fd)
 		igt_warn("Couldn't find PCI device %04x:%02x:%02x:%02x\n",
 			 pci_addr.domain, pci_addr.bus,
 			 pci_addr.device, pci_addr.function);
-		return NULL;
+		goto cleanup;
 	}
 
 	if (pci_device_probe(pci_dev)) {
 		igt_warn("Couldn't probe PCI device\n");
-		return NULL;
+		goto cleanup;
 	}
 
 	return pci_dev;
+
+cleanup:
+	pci_system_cleanup();
+	return NULL;
 }
 
 /**
@@ -223,6 +250,7 @@ static struct pci_device *__igt_device_get_pci_device(int fd)
  * @fd: the device
  *
  * Looks up the main graphics pci device using libpciaccess.
+ * Since pci_system_init() is called, users are expected to call pci_sytem_clenup() after use.
  *
  * Returns:
  * The pci_device, skips the test on any failures.
@@ -231,7 +259,7 @@ struct pci_device *igt_device_get_pci_device(int fd)
 {
 	struct pci_device *pci_dev;
 
-	pci_dev = __igt_device_get_pci_device(fd);
+	pci_dev = __igt_device_get_pci_device(fd, 0);
 	igt_require(pci_dev);
 
 	return pci_dev;
diff --git a/lib/igt_device.h b/lib/igt_device.h
index 278ba7a9b3..1aaa840e25 100644
--- a/lib/igt_device.h
+++ b/lib/igt_device.h
@@ -33,5 +33,6 @@ void igt_device_drop_master(int fd);
 
 int igt_device_get_card_index(int fd);
 struct pci_device *igt_device_get_pci_device(int fd);
+struct pci_device *__igt_device_get_pci_device(int fd, unsigned int vf_id);
 
 #endif /* __IGT_DEVICE_H__ */
-- 
2.25.1

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

* Re: [Intel-gfx] [igt-dev] [PATCH i-g-t] lib/igt_device: Add support for accessing unbound VF PCI devices
  2022-02-18 15:19 ` [igt-dev] " Janusz Krzysztofik
@ 2022-02-18 16:03   ` Chris Wilson
  -1 siblings, 0 replies; 9+ messages in thread
From: Chris Wilson @ 2022-02-18 16:03 UTC (permalink / raw)
  To: Janusz Krzysztofik, igt-dev; +Cc: intel-gfx, Michał Winiarski

Quoting Janusz Krzysztofik (2022-02-18 15:19:35)
> @@ -206,15 +229,19 @@ static struct pci_device *__igt_device_get_pci_device(int fd)
>                 igt_warn("Couldn't find PCI device %04x:%02x:%02x:%02x\n",
>                          pci_addr.domain, pci_addr.bus,
>                          pci_addr.device, pci_addr.function);
> -               return NULL;
> +               goto cleanup;
>         }
>  
>         if (pci_device_probe(pci_dev)) {
>                 igt_warn("Couldn't probe PCI device\n");
> -               return NULL;
> +               goto cleanup;
>         }
>  
>         return pci_dev;
> +
> +cleanup:
> +       pci_system_cleanup();

This is a global cleanup of libpciaccess iirc, such that if anyone else
was using the library they would be affected.

> +       return NULL;
>  }

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

* Re: [igt-dev] [PATCH i-g-t] lib/igt_device: Add support for accessing unbound VF PCI devices
@ 2022-02-18 16:03   ` Chris Wilson
  0 siblings, 0 replies; 9+ messages in thread
From: Chris Wilson @ 2022-02-18 16:03 UTC (permalink / raw)
  To: Janusz Krzysztofik, igt-dev; +Cc: intel-gfx, Michał Winiarski

Quoting Janusz Krzysztofik (2022-02-18 15:19:35)
> @@ -206,15 +229,19 @@ static struct pci_device *__igt_device_get_pci_device(int fd)
>                 igt_warn("Couldn't find PCI device %04x:%02x:%02x:%02x\n",
>                          pci_addr.domain, pci_addr.bus,
>                          pci_addr.device, pci_addr.function);
> -               return NULL;
> +               goto cleanup;
>         }
>  
>         if (pci_device_probe(pci_dev)) {
>                 igt_warn("Couldn't probe PCI device\n");
> -               return NULL;
> +               goto cleanup;
>         }
>  
>         return pci_dev;
> +
> +cleanup:
> +       pci_system_cleanup();

This is a global cleanup of libpciaccess iirc, such that if anyone else
was using the library they would be affected.

> +       return NULL;
>  }

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

* Re: [Intel-gfx] [igt-dev] [PATCH i-g-t] lib/igt_device: Add support for accessing unbound VF PCI devices
  2022-02-18 16:03   ` Chris Wilson
@ 2022-02-18 17:08     ` Janusz Krzysztofik
  -1 siblings, 0 replies; 9+ messages in thread
From: Janusz Krzysztofik @ 2022-02-18 17:08 UTC (permalink / raw)
  To: igt-dev, Chris Wilson; +Cc: intel-gfx, Michał‚ Winiarski

Hi Chris,

On Friday, 18 February 2022 17:03:01 CET Chris Wilson wrote:
> Quoting Janusz Krzysztofik (2022-02-18 15:19:35)
> > @@ -206,15 +229,19 @@ static struct pci_device *__igt_device_get_pci_device(int fd)
> >                 igt_warn("Couldn't find PCI device %04x:%02x:%02x:%02x\n",
> >                          pci_addr.domain, pci_addr.bus,
> >                          pci_addr.device, pci_addr.function);
> > -               return NULL;
> > +               goto cleanup;
> >         }
> >  
> >         if (pci_device_probe(pci_dev)) {
> >                 igt_warn("Couldn't probe PCI device\n");
> > -               return NULL;
> > +               goto cleanup;
> >         }
> >  
> >         return pci_dev;
> > +
> > +cleanup:
> > +       pci_system_cleanup();
> 
> This is a global cleanup of libpciaccess iirc, such that if anyone else
> was using the library they would be affected.

Right, but shouldn't we also drop pci_system_init() from here and request 
users to manage initialization and cleanup of that data themselves?  On each 
call pci_system_init() abandons existing data and overwrites a pointer to it 
with that of newly allocated memory, then tests calling 
igt_device_get_pci_device() multiple times are going to suffer from 
significant memory leaking.

Thanks,
Janusz

> 
> > +       return NULL;
> >  }
> 





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

* Re: [igt-dev] [PATCH i-g-t] lib/igt_device: Add support for accessing unbound VF PCI devices
@ 2022-02-18 17:08     ` Janusz Krzysztofik
  0 siblings, 0 replies; 9+ messages in thread
From: Janusz Krzysztofik @ 2022-02-18 17:08 UTC (permalink / raw)
  To: igt-dev, Chris Wilson; +Cc: intel-gfx, Michał‚ Winiarski

Hi Chris,

On Friday, 18 February 2022 17:03:01 CET Chris Wilson wrote:
> Quoting Janusz Krzysztofik (2022-02-18 15:19:35)
> > @@ -206,15 +229,19 @@ static struct pci_device *__igt_device_get_pci_device(int fd)
> >                 igt_warn("Couldn't find PCI device %04x:%02x:%02x:%02x\n",
> >                          pci_addr.domain, pci_addr.bus,
> >                          pci_addr.device, pci_addr.function);
> > -               return NULL;
> > +               goto cleanup;
> >         }
> >  
> >         if (pci_device_probe(pci_dev)) {
> >                 igt_warn("Couldn't probe PCI device\n");
> > -               return NULL;
> > +               goto cleanup;
> >         }
> >  
> >         return pci_dev;
> > +
> > +cleanup:
> > +       pci_system_cleanup();
> 
> This is a global cleanup of libpciaccess iirc, such that if anyone else
> was using the library they would be affected.

Right, but shouldn't we also drop pci_system_init() from here and request 
users to manage initialization and cleanup of that data themselves?  On each 
call pci_system_init() abandons existing data and overwrites a pointer to it 
with that of newly allocated memory, then tests calling 
igt_device_get_pci_device() multiple times are going to suffer from 
significant memory leaking.

Thanks,
Janusz

> 
> > +       return NULL;
> >  }
> 




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

* [igt-dev] ✗ Fi.CI.BAT: failure for lib/igt_device: Add support for accessing unbound VF PCI devices
  2022-02-18 15:19 ` [igt-dev] " Janusz Krzysztofik
  (?)
  (?)
@ 2022-02-18 18:00 ` Patchwork
  -1 siblings, 0 replies; 9+ messages in thread
From: Patchwork @ 2022-02-18 18:00 UTC (permalink / raw)
  To: Janusz Krzysztofik; +Cc: igt-dev

[-- Attachment #1: Type: text/plain, Size: 19283 bytes --]

== Series Details ==

Series: lib/igt_device: Add support for accessing unbound VF PCI devices
URL   : https://patchwork.freedesktop.org/series/100411/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_11250 -> IGTPW_6653
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with IGTPW_6653 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_6653, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/index.html

Participating hosts (43 -> 43)
------------------------------

  Additional (2): fi-apl-guc fi-kbl-8809g 
  Missing    (2): fi-bsw-cyan shard-tglu 

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in IGTPW_6653:

### IGT changes ###

#### Possible regressions ####

  * igt@gem_tiled_fence_blits@basic:
    - fi-tgl-1115g4:      [PASS][1] -> [SKIP][2] +2 similar issues
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-tgl-1115g4/igt@gem_tiled_fence_blits@basic.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-tgl-1115g4/igt@gem_tiled_fence_blits@basic.html
    - fi-rkl-guc:         [PASS][3] -> [SKIP][4] +2 similar issues
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-rkl-guc/igt@gem_tiled_fence_blits@basic.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-rkl-guc/igt@gem_tiled_fence_blits@basic.html

  * igt@i915_pm_rpm@module-reload:
    - bat-dg1-6:          [PASS][5] -> [SKIP][6]
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/bat-dg1-6/igt@i915_pm_rpm@module-reload.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/bat-dg1-6/igt@i915_pm_rpm@module-reload.html
    - fi-cml-u2:          [PASS][7] -> [SKIP][8] +2 similar issues
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-cml-u2/igt@i915_pm_rpm@module-reload.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-cml-u2/igt@i915_pm_rpm@module-reload.html
    - bat-dg1-5:          [PASS][9] -> [SKIP][10] +1 similar issue
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/bat-dg1-5/igt@i915_pm_rpm@module-reload.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/bat-dg1-5/igt@i915_pm_rpm@module-reload.html

  
#### Warnings ####

  * igt@i915_pm_rpm@basic-pci-d3-state:
    - bat-dg1-6:          [SKIP][11] ([i915#4078]) -> [SKIP][12]
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/bat-dg1-6/igt@i915_pm_rpm@basic-pci-d3-state.html
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/bat-dg1-6/igt@i915_pm_rpm@basic-pci-d3-state.html

  
#### Suppressed ####

  The following results come from untrusted machines, tests, or statuses.
  They do not affect the overall result.

  * igt@gem_tiled_fence_blits@basic:
    - {bat-adlp-6}:       [PASS][13] -> [SKIP][14] +2 similar issues
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/bat-adlp-6/igt@gem_tiled_fence_blits@basic.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/bat-adlp-6/igt@gem_tiled_fence_blits@basic.html
    - {fi-tgl-dsi}:       [PASS][15] -> [SKIP][16]
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-tgl-dsi/igt@gem_tiled_fence_blits@basic.html
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-tgl-dsi/igt@gem_tiled_fence_blits@basic.html

  * igt@i915_pm_rpm@basic-pci-d3-state:
    - {bat-jsl-1}:        [PASS][17] -> [SKIP][18] +2 similar issues
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/bat-jsl-1/igt@i915_pm_rpm@basic-pci-d3-state.html
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/bat-jsl-1/igt@i915_pm_rpm@basic-pci-d3-state.html

  * igt@i915_pm_rpm@module-reload:
    - {fi-ehl-2}:         [PASS][19] -> [SKIP][20] +2 similar issues
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-ehl-2/igt@i915_pm_rpm@module-reload.html
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-ehl-2/igt@i915_pm_rpm@module-reload.html
    - {fi-jsl-1}:         [PASS][21] -> [SKIP][22] +2 similar issues
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-jsl-1/igt@i915_pm_rpm@module-reload.html
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-jsl-1/igt@i915_pm_rpm@module-reload.html

  
Known issues
------------

  Here are the changes found in IGTPW_6653 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@amdgpu/amd_cs_nop@sync-fork-compute0:
    - fi-snb-2600:        NOTRUN -> [SKIP][23] ([fdo#109271]) +17 similar issues
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-snb-2600/igt@amdgpu/amd_cs_nop@sync-fork-compute0.html

  * igt@debugfs_test@read_all_entries:
    - fi-apl-guc:         NOTRUN -> [DMESG-WARN][24] ([i915#1610])
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-apl-guc/igt@debugfs_test@read_all_entries.html

  * igt@gem_exec_suspend@basic-s0@smem:
    - fi-kbl-8809g:       NOTRUN -> [DMESG-WARN][25] ([i915#4962]) +1 similar issue
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-kbl-8809g/igt@gem_exec_suspend@basic-s0@smem.html

  * igt@gem_flink_basic@bad-flink:
    - fi-skl-6600u:       [PASS][26] -> [INCOMPLETE][27] ([i915#4547])
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-skl-6600u/igt@gem_flink_basic@bad-flink.html
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-skl-6600u/igt@gem_flink_basic@bad-flink.html

  * igt@gem_huc_copy@huc-copy:
    - fi-kbl-8809g:       NOTRUN -> [SKIP][28] ([fdo#109271] / [i915#2190])
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-kbl-8809g/igt@gem_huc_copy@huc-copy.html

  * igt@gem_lmem_swapping@random-engines:
    - fi-kbl-8809g:       NOTRUN -> [SKIP][29] ([fdo#109271] / [i915#4613]) +3 similar issues
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-kbl-8809g/igt@gem_lmem_swapping@random-engines.html

  * igt@gem_tiled_fence_blits@basic:
    - fi-snb-2520m:       [PASS][30] -> [SKIP][31] ([fdo#109271])
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-snb-2520m/igt@gem_tiled_fence_blits@basic.html
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-snb-2520m/igt@gem_tiled_fence_blits@basic.html
    - fi-ivb-3770:        [PASS][32] -> [SKIP][33] ([fdo#109271])
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-ivb-3770/igt@gem_tiled_fence_blits@basic.html
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-ivb-3770/igt@gem_tiled_fence_blits@basic.html
    - fi-kbl-soraka:      [PASS][34] -> [SKIP][35] ([fdo#109271]) +2 similar issues
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-kbl-soraka/igt@gem_tiled_fence_blits@basic.html
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-kbl-soraka/igt@gem_tiled_fence_blits@basic.html
    - fi-elk-e7500:       [PASS][36] -> [SKIP][37] ([fdo#109271])
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-elk-e7500/igt@gem_tiled_fence_blits@basic.html
   [37]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-elk-e7500/igt@gem_tiled_fence_blits@basic.html
    - fi-skl-6700k2:      [PASS][38] -> [SKIP][39] ([fdo#109271]) +2 similar issues
   [38]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-skl-6700k2/igt@gem_tiled_fence_blits@basic.html
   [39]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-skl-6700k2/igt@gem_tiled_fence_blits@basic.html
    - fi-cfl-guc:         [PASS][40] -> [SKIP][41] ([fdo#109271]) +2 similar issues
   [40]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-cfl-guc/igt@gem_tiled_fence_blits@basic.html
   [41]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-cfl-guc/igt@gem_tiled_fence_blits@basic.html
    - fi-ilk-650:         [PASS][42] -> [SKIP][43] ([fdo#109271])
   [42]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-ilk-650/igt@gem_tiled_fence_blits@basic.html
   [43]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-ilk-650/igt@gem_tiled_fence_blits@basic.html
    - fi-snb-2600:        [PASS][44] -> [SKIP][45] ([fdo#109271])
   [44]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-snb-2600/igt@gem_tiled_fence_blits@basic.html
   [45]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-snb-2600/igt@gem_tiled_fence_blits@basic.html
    - fi-bsw-nick:        [PASS][46] -> [SKIP][47] ([fdo#109271]) +1 similar issue
   [46]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-bsw-nick/igt@gem_tiled_fence_blits@basic.html
   [47]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-bsw-nick/igt@gem_tiled_fence_blits@basic.html
    - fi-blb-e6850:       [PASS][48] -> [SKIP][49] ([fdo#109271])
   [48]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-blb-e6850/igt@gem_tiled_fence_blits@basic.html
   [49]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-blb-e6850/igt@gem_tiled_fence_blits@basic.html
    - fi-bwr-2160:        [PASS][50] -> [SKIP][51] ([fdo#109271])
   [50]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-bwr-2160/igt@gem_tiled_fence_blits@basic.html
   [51]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-bwr-2160/igt@gem_tiled_fence_blits@basic.html
    - fi-kbl-guc:         [PASS][52] -> [SKIP][53] ([fdo#109271])
   [52]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-kbl-guc/igt@gem_tiled_fence_blits@basic.html
   [53]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-kbl-guc/igt@gem_tiled_fence_blits@basic.html
    - fi-pnv-d510:        [PASS][54] -> [SKIP][55] ([fdo#109271])
   [54]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-pnv-d510/igt@gem_tiled_fence_blits@basic.html
   [55]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-pnv-d510/igt@gem_tiled_fence_blits@basic.html

  * igt@i915_module_load@reload:
    - fi-kbl-soraka:      [PASS][56] -> [DMESG-WARN][57] ([i915#1982])
   [56]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-kbl-soraka/igt@i915_module_load@reload.html
   [57]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-kbl-soraka/igt@i915_module_load@reload.html

  * igt@i915_pm_rpm@basic-pci-d3-state:
    - fi-glk-dsi:         [PASS][58] -> [SKIP][59] ([fdo#109271]) +2 similar issues
   [58]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-glk-dsi/igt@i915_pm_rpm@basic-pci-d3-state.html
   [59]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-glk-dsi/igt@i915_pm_rpm@basic-pci-d3-state.html
    - fi-kbl-7500u:       [PASS][60] -> [SKIP][61] ([fdo#109271]) +2 similar issues
   [60]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-kbl-7500u/igt@i915_pm_rpm@basic-pci-d3-state.html
   [61]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-kbl-7500u/igt@i915_pm_rpm@basic-pci-d3-state.html
    - fi-hsw-4770:        [PASS][62] -> [SKIP][63] ([fdo#109271]) +2 similar issues
   [62]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-hsw-4770/igt@i915_pm_rpm@basic-pci-d3-state.html
   [63]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-hsw-4770/igt@i915_pm_rpm@basic-pci-d3-state.html

  * igt@i915_pm_rpm@module-reload:
    - fi-cfl-8109u:       [PASS][64] -> [SKIP][65] ([fdo#109271]) +2 similar issues
   [64]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-cfl-8109u/igt@i915_pm_rpm@module-reload.html
   [65]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-cfl-8109u/igt@i915_pm_rpm@module-reload.html
    - fi-cfl-8700k:       [PASS][66] -> [SKIP][67] ([fdo#109271]) +2 similar issues
   [66]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-cfl-8700k/igt@i915_pm_rpm@module-reload.html
   [67]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-cfl-8700k/igt@i915_pm_rpm@module-reload.html
    - fi-bsw-kefka:       [PASS][68] -> [SKIP][69] ([fdo#109271]) +2 similar issues
   [68]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-bsw-kefka/igt@i915_pm_rpm@module-reload.html
   [69]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-bsw-kefka/igt@i915_pm_rpm@module-reload.html
    - fi-kbl-x1275:       [PASS][70] -> [SKIP][71] ([fdo#109271]) +2 similar issues
   [70]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-kbl-x1275/igt@i915_pm_rpm@module-reload.html
   [71]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-kbl-x1275/igt@i915_pm_rpm@module-reload.html
    - fi-skl-guc:         [PASS][72] -> [SKIP][73] ([fdo#109271]) +2 similar issues
   [72]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-skl-guc/igt@i915_pm_rpm@module-reload.html
   [73]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-skl-guc/igt@i915_pm_rpm@module-reload.html
    - fi-bsw-n3050:       [PASS][74] -> [SKIP][75] ([fdo#109271]) +2 similar issues
   [74]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-bsw-n3050/igt@i915_pm_rpm@module-reload.html
   [75]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-bsw-n3050/igt@i915_pm_rpm@module-reload.html
    - fi-kbl-7567u:       [PASS][76] -> [SKIP][77] ([fdo#109271]) +1 similar issue
   [76]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-kbl-7567u/igt@i915_pm_rpm@module-reload.html
   [77]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-kbl-7567u/igt@i915_pm_rpm@module-reload.html
    - fi-glk-j4005:       [PASS][78] -> [SKIP][79] ([fdo#109271]) +2 similar issues
   [78]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-glk-j4005/igt@i915_pm_rpm@module-reload.html
   [79]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-glk-j4005/igt@i915_pm_rpm@module-reload.html
    - fi-kbl-guc:         NOTRUN -> [SKIP][80] ([fdo#109271])
   [80]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-kbl-guc/igt@i915_pm_rpm@module-reload.html

  * igt@i915_selftest@live@execlists:
    - fi-bsw-kefka:       [PASS][81] -> [INCOMPLETE][82] ([i915#2940])
   [81]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-bsw-kefka/igt@i915_selftest@live@execlists.html
   [82]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-bsw-kefka/igt@i915_selftest@live@execlists.html

  * igt@i915_selftest@live@requests:
    - fi-blb-e6850:       [PASS][83] -> [DMESG-FAIL][84] ([i915#5026])
   [83]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-blb-e6850/igt@i915_selftest@live@requests.html
   [84]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-blb-e6850/igt@i915_selftest@live@requests.html

  * igt@kms_chamelium@hdmi-edid-read:
    - fi-kbl-8809g:       NOTRUN -> [SKIP][85] ([fdo#109271] / [fdo#111827]) +8 similar issues
   [85]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-kbl-8809g/igt@kms_chamelium@hdmi-edid-read.html

  * igt@kms_frontbuffer_tracking@basic:
    - fi-cml-u2:          [PASS][86] -> [DMESG-WARN][87] ([i915#4269])
   [86]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-cml-u2/igt@kms_frontbuffer_tracking@basic.html
   [87]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-cml-u2/igt@kms_frontbuffer_tracking@basic.html

  * igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d:
    - fi-kbl-8809g:       NOTRUN -> [SKIP][88] ([fdo#109271] / [i915#533])
   [88]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-kbl-8809g/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d.html

  * igt@kms_psr@cursor_plane_move:
    - fi-kbl-8809g:       NOTRUN -> [SKIP][89] ([fdo#109271]) +56 similar issues
   [89]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-kbl-8809g/igt@kms_psr@cursor_plane_move.html

  * igt@runner@aborted:
    - fi-bsw-kefka:       NOTRUN -> [FAIL][90] ([fdo#109271] / [i915#1436] / [i915#2722] / [i915#3428] / [i915#4312])
   [90]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-bsw-kefka/igt@runner@aborted.html
    - fi-apl-guc:         NOTRUN -> [FAIL][91] ([i915#2426] / [i915#4312])
   [91]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-apl-guc/igt@runner@aborted.html
    - fi-bdw-5557u:       NOTRUN -> [FAIL][92] ([i915#2426] / [i915#4312])
   [92]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-bdw-5557u/igt@runner@aborted.html
    - fi-blb-e6850:       NOTRUN -> [FAIL][93] ([fdo#109271] / [i915#2403] / [i915#2426] / [i915#4312])
   [93]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-blb-e6850/igt@runner@aborted.html

  
#### Possible fixes ####

  * igt@i915_selftest@live@hangcheck:
    - fi-snb-2600:        [INCOMPLETE][94] ([i915#3921]) -> [PASS][95]
   [94]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-snb-2600/igt@i915_selftest@live@hangcheck.html
   [95]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-snb-2600/igt@i915_selftest@live@hangcheck.html

  
#### Warnings ####

  * igt@runner@aborted:
    - fi-skl-6600u:       [FAIL][96] ([i915#4312]) -> [FAIL][97] ([i915#2722] / [i915#4312])
   [96]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11250/fi-skl-6600u/igt@runner@aborted.html
   [97]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/fi-skl-6600u/igt@runner@aborted.html

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
  [i915#1436]: https://gitlab.freedesktop.org/drm/intel/issues/1436
  [i915#1610]: https://gitlab.freedesktop.org/drm/intel/issues/1610
  [i915#1982]: https://gitlab.freedesktop.org/drm/intel/issues/1982
  [i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
  [i915#2403]: https://gitlab.freedesktop.org/drm/intel/issues/2403
  [i915#2411]: https://gitlab.freedesktop.org/drm/intel/issues/2411
  [i915#2426]: https://gitlab.freedesktop.org/drm/intel/issues/2426
  [i915#2722]: https://gitlab.freedesktop.org/drm/intel/issues/2722
  [i915#2940]: https://gitlab.freedesktop.org/drm/intel/issues/2940
  [i915#3428]: https://gitlab.freedesktop.org/drm/intel/issues/3428
  [i915#3921]: https://gitlab.freedesktop.org/drm/intel/issues/3921
  [i915#4078]: https://gitlab.freedesktop.org/drm/intel/issues/4078
  [i915#4269]: https://gitlab.freedesktop.org/drm/intel/issues/4269
  [i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
  [i915#4547]: https://gitlab.freedesktop.org/drm/intel/issues/4547
  [i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
  [i915#4962]: https://gitlab.freedesktop.org/drm/intel/issues/4962
  [i915#5026]: https://gitlab.freedesktop.org/drm/intel/issues/5026
  [i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533


Build changes
-------------

  * CI: CI-20190529 -> None
  * IGT: IGT_6348 -> IGTPW_6653

  CI-20190529: 20190529
  CI_DRM_11250: 29edaa3f0f50b56967b046309ab09e0b51c8bda3 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_6653: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/index.html
  IGT_6348: 9cb64a757d2ff1e180b1648e611439d94afd697d @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_6653/index.html

[-- Attachment #2: Type: text/html, Size: 23522 bytes --]

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

* Re: [Intel-gfx] [igt-dev] [PATCH i-g-t] lib/igt_device: Add support for accessing unbound VF PCI devices
  2022-02-18 17:08     ` Janusz Krzysztofik
@ 2022-02-18 20:53       ` Chris Wilson
  -1 siblings, 0 replies; 9+ messages in thread
From: Chris Wilson @ 2022-02-18 20:53 UTC (permalink / raw)
  To: Janusz Krzysztofik, igt-dev; +Cc: intel-gfx, Michał‚ Winiarski

Quoting Janusz Krzysztofik (2022-02-18 17:08:41)
> Hi Chris,
> 
> On Friday, 18 February 2022 17:03:01 CET Chris Wilson wrote:
> > Quoting Janusz Krzysztofik (2022-02-18 15:19:35)
> > > @@ -206,15 +229,19 @@ static struct pci_device *__igt_device_get_pci_device(int fd)
> > >                 igt_warn("Couldn't find PCI device %04x:%02x:%02x:%02x\n",
> > >                          pci_addr.domain, pci_addr.bus,
> > >                          pci_addr.device, pci_addr.function);
> > > -               return NULL;
> > > +               goto cleanup;
> > >         }
> > >  
> > >         if (pci_device_probe(pci_dev)) {
> > >                 igt_warn("Couldn't probe PCI device\n");
> > > -               return NULL;
> > > +               goto cleanup;
> > >         }
> > >  
> > >         return pci_dev;
> > > +
> > > +cleanup:
> > > +       pci_system_cleanup();
> > 
> > This is a global cleanup of libpciaccess iirc, such that if anyone else
> > was using the library they would be affected.
> 
> Right, but shouldn't we also drop pci_system_init() from here and request 
> users to manage initialization and cleanup of that data themselves?  On each 
> call pci_system_init() abandons existing data and overwrites a pointer to it 
> with that of newly allocated memory, then tests calling 
> igt_device_get_pci_device() multiple times are going to suffer from 
> significant memory leaking.

Right, I thought it only inited once -- I just remember the issue with
calling pci_system_cleanup() while others were still using it.

Stick the call to init in an __attribute__((constructor)) or pthread_once.
-Chris

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

* Re: [igt-dev] [PATCH i-g-t] lib/igt_device: Add support for accessing unbound VF PCI devices
@ 2022-02-18 20:53       ` Chris Wilson
  0 siblings, 0 replies; 9+ messages in thread
From: Chris Wilson @ 2022-02-18 20:53 UTC (permalink / raw)
  To: Janusz Krzysztofik, igt-dev; +Cc: intel-gfx, Michał‚ Winiarski

Quoting Janusz Krzysztofik (2022-02-18 17:08:41)
> Hi Chris,
> 
> On Friday, 18 February 2022 17:03:01 CET Chris Wilson wrote:
> > Quoting Janusz Krzysztofik (2022-02-18 15:19:35)
> > > @@ -206,15 +229,19 @@ static struct pci_device *__igt_device_get_pci_device(int fd)
> > >                 igt_warn("Couldn't find PCI device %04x:%02x:%02x:%02x\n",
> > >                          pci_addr.domain, pci_addr.bus,
> > >                          pci_addr.device, pci_addr.function);
> > > -               return NULL;
> > > +               goto cleanup;
> > >         }
> > >  
> > >         if (pci_device_probe(pci_dev)) {
> > >                 igt_warn("Couldn't probe PCI device\n");
> > > -               return NULL;
> > > +               goto cleanup;
> > >         }
> > >  
> > >         return pci_dev;
> > > +
> > > +cleanup:
> > > +       pci_system_cleanup();
> > 
> > This is a global cleanup of libpciaccess iirc, such that if anyone else
> > was using the library they would be affected.
> 
> Right, but shouldn't we also drop pci_system_init() from here and request 
> users to manage initialization and cleanup of that data themselves?  On each 
> call pci_system_init() abandons existing data and overwrites a pointer to it 
> with that of newly allocated memory, then tests calling 
> igt_device_get_pci_device() multiple times are going to suffer from 
> significant memory leaking.

Right, I thought it only inited once -- I just remember the issue with
calling pci_system_cleanup() while others were still using it.

Stick the call to init in an __attribute__((constructor)) or pthread_once.
-Chris

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

end of thread, other threads:[~2022-02-18 20:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-18 15:19 [Intel-gfx] [PATCH i-g-t] lib/igt_device: Add support for accessing unbound VF PCI devices Janusz Krzysztofik
2022-02-18 15:19 ` [igt-dev] " Janusz Krzysztofik
2022-02-18 16:03 ` [Intel-gfx] " Chris Wilson
2022-02-18 16:03   ` Chris Wilson
2022-02-18 17:08   ` [Intel-gfx] " Janusz Krzysztofik
2022-02-18 17:08     ` Janusz Krzysztofik
2022-02-18 20:53     ` [Intel-gfx] " Chris Wilson
2022-02-18 20:53       ` Chris Wilson
2022-02-18 18:00 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork

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.