[igt-dev] [PATCH i-g-t] lib: Fix gem_measure_ring_inflight
Chris Wilson
chris at chris-wilson.co.uk
Sat Aug 31 19:17:19 UTC 2019
Any use of __for_each_physical_engine breaks library use of
for_each_physical_ring and in this case (e.g. gem_busy/close-race) leads
to GPU hangs.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Andi Shyti <andi.shyti at intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
lib/i915/gem_ring.c | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/lib/i915/gem_ring.c b/lib/i915/gem_ring.c
index bf7f439e1..272264659 100644
--- a/lib/i915/gem_ring.c
+++ b/lib/i915/gem_ring.c
@@ -21,12 +21,13 @@
* IN THE SOFTWARE.
*/
-#include "gem_ring.h"
-
#include <signal.h>
#include <sys/ioctl.h>
#include <sys/time.h>
+#include "gem_ring.h"
+#include "gem_submission.h"
+
#include "intel_reg.h"
#include "drmtest.h"
#include "ioctl_wrappers.h"
@@ -140,18 +141,23 @@ __gem_measure_ring_inflight(int fd, unsigned int engine, enum measure_ring_flags
unsigned int
gem_measure_ring_inflight(int fd, unsigned int engine, enum measure_ring_flags flags)
{
- if (engine == ALL_ENGINES) {
- unsigned int global_min = ~0u;
+ unsigned int min = ~0u;
+ fd = gem_reopen_driver(fd);
+
+ if (engine == ALL_ENGINES) {
for_each_physical_engine(fd, engine) {
- unsigned int engine_min = __gem_measure_ring_inflight(fd, engine, flags);
+ unsigned int count =
+ __gem_measure_ring_inflight(fd, engine, flags);
- if (engine_min < global_min)
- global_min = engine_min;
+ if (count < min)
+ min = count;
}
-
- return global_min;
+ } else {
+ min = __gem_measure_ring_inflight(fd, engine, flags);
}
- return __gem_measure_ring_inflight(fd, engine, flags);
+ close(fd);
+
+ return min;
}
--
2.23.0
More information about the igt-dev
mailing list