Skip to contentSkip to conversation

drm/amdgpu/benchmark: use dev_info rather than DRM macros for logging

PATCH In review Alex Deucher 5 participants 12 messages Feb 18, 2022 – Feb 22, 2022

Subsystems (2)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

PATCH 1/7 drm/amdgpu/benchmark: use dev_info rather than DRM macros for logging

So we can tell which output goes to which device when multiple GPUs are present. Also while we are here, convert DRM_ERROR to dev_info. The error cases are not critical.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c +7 -5
index 313517f7cf10..b38783278a99 100644
@@ -56,13 +56,15 @@ static int amdgpu_benchmark_do_move(struct amdgpu_device *adev, unsigned size,
 }
 
 
-static void amdgpu_benchmark_log_results(int n, unsigned size,
+static void amdgpu_benchmark_log_results(struct amdgpu_device *adev,
+					 int n, unsigned size,
 					 unsigned int time,
 					 unsigned sdomain, unsigned ddomain,
 					 char *kind)
 {
 	unsigned int throughput = (n * (size >> 10)) / time;
-	DRM_INFO("amdgpu: %s %u bo moves of %u kB from"
+
+	dev_info(adev->dev, "amdgpu: %s %u bo moves of %u kB from"
 		 " %d to %d in %u ms, throughput: %u Mb/s or %u MB/s\n",
 		 kind, n, size >> 10, sdomain, ddomain, time,
 		 throughput * 8, throughput);
@@ -131,14 +133,14 @@ static void amdgpu_benchmark_move(struct amdgpu_device *adev, unsigned size,
 		if (time < 0)
 			goto out_cleanup;
 		if (time > 0)
-			amdgpu_benchmark_log_results(n, size, time,
+			amdgpu_benchmark_log_results(adev, n, size, time,
 						     sdomain, ddomain, "dma");
 	}
 
 out_cleanup:
 	/* Check error value now. The value can be overwritten when clean up.*/
 	if (r) {
-		DRM_ERROR("Error while benchmarking BO move.\n");
+		dev_info(adev->dev, "Error while benchmarking BO move.\n");
 	}
 
 	if (sobj) {
@@ -239,6 +241,6 @@ void amdgpu_benchmark(struct amdgpu_device *adev, int test_number)
 		break;
 
 	default:
-		DRM_ERROR("Unknown benchmark\n");
+		dev_info(adev->dev, "Unknown benchmark\n");
 	}
 }
Signature · 1 line
2.35.1
author maintainer
#1 lore raw

PATCH 2/7 drm/amdgpu: plumb error handling though amdgpu_benchmark()

So we can tell when this function fails.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h           |   2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c | 100 +++++++++++-------
 2 files changed, 64 insertions(+), 38 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -1
index 566303c9942f..66d556fc17ef 100644
@@ -586,7 +586,7 @@ void amdgpu_device_wb_free(struct amdgpu_device *adev, u32 wb);
 /*
  * Benchmarking
  */
-void amdgpu_benchmark(struct amdgpu_device *adev, int test_number);
+int amdgpu_benchmark(struct amdgpu_device *adev, int test_number);
 
 
 /*
drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c +63 -37

168 lines not on this page · raw message

Signature · 1 line
2.35.1
author maintainer
#2 lore raw

PATCH 3/7 drm/amdgpu: print the selected benchmark test in the log

In reply to Alex Deucher

So you can tell which benchmark was run.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c +8 -0
index 7709f48e25a1..62422c395789 100644
@@ -185,6 +185,7 @@ int amdgpu_benchmark(struct amdgpu_device *adev, int test_number)
 
 	switch (test_number) {
 	case 1:
+		dev_info(adev->dev, "benchmark test: %d\n", test_number);
 		/* simple test, VRAM to GTT and GTT to VRAM */
 		r = amdgpu_benchmark_move(adev, 1024*1024, AMDGPU_GEM_DOMAIN_GTT,
 					  AMDGPU_GEM_DOMAIN_VRAM);
@@ -196,6 +197,7 @@ int amdgpu_benchmark(struct amdgpu_device *adev, int test_number)
 			return r;
 		break;
 	case 2:
+		dev_info(adev->dev, "benchmark test: %d\n", test_number);
 		/* simple test, VRAM to VRAM */
 		amdgpu_benchmark_move(adev, 1024*1024, AMDGPU_GEM_DOMAIN_VRAM,
 				      AMDGPU_GEM_DOMAIN_VRAM);
@@ -203,6 +205,7 @@ int amdgpu_benchmark(struct amdgpu_device *adev, int test_number)
 			return r;
 		break;
 	case 3:
+		dev_info(adev->dev, "benchmark test: %d\n", test_number);
 		/* GTT to VRAM, buffer size sweep, powers of 2 */
 		for (i = 1; i <= 16384; i <<= 1) {
 			r = amdgpu_benchmark_move(adev, i * AMDGPU_GPU_PAGE_SIZE,
@@ -213,6 +216,7 @@ int amdgpu_benchmark(struct amdgpu_device *adev, int test_number)
 		}
 		break;
 	case 4:
+		dev_info(adev->dev, "benchmark test: %d\n", test_number);
 		/* VRAM to GTT, buffer size sweep, powers of 2 */
 		for (i = 1; i <= 16384; i <<= 1) {
 			r = amdgpu_benchmark_move(adev, i * AMDGPU_GPU_PAGE_SIZE,
@@ -223,6 +227,7 @@ int amdgpu_benchmark(struct amdgpu_device *adev, int test_number)
 		}
 		break;
 	case 5:
+		dev_info(adev->dev, "benchmark test: %d\n", test_number);
 		/* VRAM to VRAM, buffer size sweep, powers of 2 */
 		for (i = 1; i <= 16384; i <<= 1) {
 			r = amdgpu_benchmark_move(adev, i * AMDGPU_GPU_PAGE_SIZE,
@@ -233,6 +238,7 @@ int amdgpu_benchmark(struct amdgpu_device *adev, int test_number)
 		}
 		break;
 	case 6:
+		dev_info(adev->dev, "benchmark test: %d\n", test_number);
 		/* GTT to VRAM, buffer size sweep, common modes */
 		for (i = 0; i < AMDGPU_BENCHMARK_COMMON_MODES_N; i++) {
 			r = amdgpu_benchmark_move(adev, common_modes[i],
@@ -243,6 +249,7 @@ int amdgpu_benchmark(struct amdgpu_device *adev, int test_number)
 		}
 		break;
 	case 7:
+		dev_info(adev->dev, "benchmark test: %d\n", test_number);
 		/* VRAM to GTT, buffer size sweep, common modes */
 		for (i = 0; i < AMDGPU_BENCHMARK_COMMON_MODES_N; i++) {
 			r = amdgpu_benchmark_move(adev, common_modes[i],
@@ -253,6 +260,7 @@ int amdgpu_benchmark(struct amdgpu_device *adev, int test_number)
 		}
 		break;
 	case 8:
+		dev_info(adev->dev, "benchmark test: %d\n", test_number);
 		/* VRAM to VRAM, buffer size sweep, common modes */
 		for (i = 0; i < AMDGPU_BENCHMARK_COMMON_MODES_N; i++) {
 			r = amdgpu_benchmark_move(adev, common_modes[i],
Signature · 1 line
2.35.1
author maintainer
#3 lore raw

PATCH 4/7 drm/amdgpu: add a benchmark mutex

In reply to Alex Deucher

To avoid multiple runs in parallel to avoid mixing results.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h           |  2 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c | 23 +++++++++++--------
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c    |  1 +
 3 files changed, 17 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
index 66d556fc17ef..c736c30e0a0a 100644
@@ -1100,6 +1100,8 @@ struct amdgpu_device {
 	struct list_head                ras_list;
 
 	struct ip_discovery_top         *ip_top;
+
+	struct mutex			benchmark_mutex;
 };
 
 static inline struct amdgpu_device *drm_to_adev(struct drm_device *ddev)
drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c +14 -9
index 62422c395789..8e4997983124 100644
@@ -183,6 +183,7 @@ int amdgpu_benchmark(struct amdgpu_device *adev, int test_number)
 		1920 * 1200 * 4
 	};
 
+	mutex_lock(&adev->benchmark_mutex);
 	switch (test_number) {
 	case 1:
 		dev_info(adev->dev, "benchmark test: %d\n", test_number);
@@ -190,11 +191,11 @@ int amdgpu_benchmark(struct amdgpu_device *adev, int test_number)
 		r = amdgpu_benchmark_move(adev, 1024*1024, AMDGPU_GEM_DOMAIN_GTT,
 					  AMDGPU_GEM_DOMAIN_VRAM);
 		if (r)
-			return r;
+			goto done;
 		r = amdgpu_benchmark_move(adev, 1024*1024, AMDGPU_GEM_DOMAIN_VRAM,
 					  AMDGPU_GEM_DOMAIN_GTT);
 		if (r)
-			return r;
+			goto done;
 		break;
 	case 2:
 		dev_info(adev->dev, "benchmark test: %d\n", test_number);
@@ -202,7 +203,7 @@ int amdgpu_benchmark(struct amdgpu_device *adev, int test_number)
 		amdgpu_benchmark_move(adev, 1024*1024, AMDGPU_GEM_DOMAIN_VRAM,
 				      AMDGPU_GEM_DOMAIN_VRAM);
 		if (r)
-			return r;
+			goto done;
 		break;
 	case 3:
 		dev_info(adev->dev, "benchmark test: %d\n", test_number);
@@ -212,7 +213,7 @@ int amdgpu_benchmark(struct amdgpu_device *adev, int test_number)
 						  AMDGPU_GEM_DOMAIN_GTT,
 						  AMDGPU_GEM_DOMAIN_VRAM);
 			if (r)
-				return r;
+				goto done;
 		}
 		break;
 	case 4:
@@ -223,7 +224,7 @@ int amdgpu_benchmark(struct amdgpu_device *adev, int test_number)
 						  AMDGPU_GEM_DOMAIN_VRAM,
 						  AMDGPU_GEM_DOMAIN_GTT);
 			if (r)
-				return r;
+				goto done;
 		}
 		break;
 	case 5:
@@ -234,7 +235,7 @@ int amdgpu_benchmark(struct amdgpu_device *adev, int test_number)
 						  AMDGPU_GEM_DOMAIN_VRAM,
 						  AMDGPU_GEM_DOMAIN_VRAM);
 			if (r)
-				return r;
+				goto done;
 		}
 		break;
 	case 6:
@@ -245,7 +246,7 @@ int amdgpu_benchmark(struct amdgpu_device *adev, int test_number)
 						  AMDGPU_GEM_DOMAIN_GTT,
 						  AMDGPU_GEM_DOMAIN_VRAM);
 			if (r)
-				return r;
+				goto done;
 		}
 		break;
 	case 7:
@@ -256,7 +257,7 @@ int amdgpu_benchmark(struct amdgpu_device *adev, int test_number)
 						  AMDGPU_GEM_DOMAIN_VRAM,
 						  AMDGPU_GEM_DOMAIN_GTT);
 			if (r)
-				return r;
+				goto done;
 		}
 		break;
 	case 8:
@@ -267,7 +268,7 @@ int amdgpu_benchmark(struct amdgpu_device *adev, int test_number)
 					      AMDGPU_GEM_DOMAIN_VRAM,
 					      AMDGPU_GEM_DOMAIN_VRAM);
 			if (r)
-				return r;
+				goto done;
 		}
 		break;
 
@@ -276,5 +277,9 @@ int amdgpu_benchmark(struct amdgpu_device *adev, int test_number)
 		r = -EINVAL;
 		break;
 	}
+
+done:
+	mutex_unlock(&adev->benchmark_mutex);
+
 	return r;
 }
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
index 31834d2d4d55..63b4876e13c1 100644
@@ -3550,6 +3550,7 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 	mutex_init(&adev->psp.mutex);
 	mutex_init(&adev->notifier_lock);
 	mutex_init(&adev->pm.stable_pstate_ctx_lock);
+	mutex_init(&adev->benchmark_mutex);
 
 	amdgpu_device_init_apu_flags(adev);
 
Signature · 1 line
2.35.1
author maintainer
#4 lore raw

PATCH 5/7 drm/amdgpu: expose benchmarks via debugfs

In reply to Alex Deucher

They provide a nice smoke test of transfer performance using SDMA. Allow the user to run these at runtime rather than only at init time.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 23 +++++++++++++++++++++
 1 file changed, 23 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +23 -0
index db8a8710333e..c7190d02897e 100644
@@ -1362,6 +1362,25 @@ static int amdgpu_debugfs_evict_gtt(void *data, u64 *val)
 	return 0;
 }
 
+static int amdgpu_debugfs_benchmark(void *data, u64 val)
+{
+	struct amdgpu_device *adev = (struct amdgpu_device *)data;
+	struct drm_device *dev = adev_to_drm(adev);
+	int r;
+
+	r = pm_runtime_get_sync(dev->dev);
+	if (r < 0) {
+		pm_runtime_put_autosuspend(dev->dev);
+		return r;
+	}
+
+	r = amdgpu_benchmark(adev, val);
+
+	pm_runtime_mark_last_busy(dev->dev);
+	pm_runtime_put_autosuspend(dev->dev);
+
+	return r;
+}
 
 static int amdgpu_debugfs_vm_info_show(struct seq_file *m, void *unused)
 {
@@ -1398,6 +1417,8 @@ DEFINE_DEBUGFS_ATTRIBUTE(amdgpu_evict_vram_fops, amdgpu_debugfs_evict_vram,
 			 NULL, "%lld\n");
 DEFINE_DEBUGFS_ATTRIBUTE(amdgpu_evict_gtt_fops, amdgpu_debugfs_evict_gtt,
 			 NULL, "%lld\n");
+DEFINE_DEBUGFS_ATTRIBUTE(amdgpu_benchmark_fops, NULL, amdgpu_debugfs_benchmark,
+			 "%lld\n");
 
 static void amdgpu_ib_preempt_fences_swap(struct amdgpu_ring *ring,
 					  struct dma_fence **fences)
@@ -1683,6 +1704,8 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
 			    &amdgpu_debugfs_test_ib_fops);
 	debugfs_create_file("amdgpu_vm_info", 0444, root, adev,
 			    &amdgpu_debugfs_vm_info_fops);
+	debugfs_create_file("amdgpu_benchmark", 0222, root, adev,
+			    &amdgpu_benchmark_fops);
 
 	adev->debugfs_vbios_blob.data = adev->bios;
 	adev->debugfs_vbios_blob.size = adev->bios_size;
Signature · 1 line
2.35.1
author maintainer
#5 lore raw

PATCH 6/7 drm/amdgpu: drop benchmark module parameter

In reply to Alex Deucher

Now that we expose the benchmarks via debugfs, there is no longer a need for the module parameter.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h        | 1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 ------
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c    | 8 --------
 3 files changed, 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -1
index c736c30e0a0a..d6cf2e343a43 100644
@@ -155,7 +155,6 @@ extern int amdgpu_vis_vram_limit;
 extern int amdgpu_gart_size;
 extern int amdgpu_gtt_size;
 extern int amdgpu_moverate;
-extern int amdgpu_benchmarking;
 extern int amdgpu_testing;
 extern int amdgpu_audio;
 extern int amdgpu_disp_priority;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -6
index 63b4876e13c1..02863e2ea3c4 100644
@@ -3811,12 +3811,6 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 		else
 			DRM_INFO("amdgpu: acceleration disabled, skipping move tests\n");
 	}
-	if (amdgpu_benchmarking) {
-		if (adev->accel_working)
-			amdgpu_benchmark(adev, amdgpu_benchmarking);
-		else
-			DRM_INFO("amdgpu: acceleration disabled, skipping benchmarks\n");
-	}
 
 	/*
 	 * Register gpu instance before amdgpu_device_enable_mgpu_fan_boost.
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -8
index a0b5cf9a41cc..a76d78a6dc54 100644
@@ -110,7 +110,6 @@ int amdgpu_vis_vram_limit;
 int amdgpu_gart_size = -1; /* auto */
 int amdgpu_gtt_size = -1; /* auto */
 int amdgpu_moverate = -1; /* auto */
-int amdgpu_benchmarking;
 int amdgpu_testing;
 int amdgpu_audio = -1;
 int amdgpu_disp_priority;
@@ -231,13 +230,6 @@ module_param_named(gttsize, amdgpu_gtt_size, int, 0600);
 MODULE_PARM_DESC(moverate, "Maximum buffer migration rate in MB/s. (32, 64, etc., -1=auto, 0=1=disabled)");
 module_param_named(moverate, amdgpu_moverate, int, 0600);
 
-/**
- * DOC: benchmark (int)
- * Run benchmarks. The default is 0 (Skip benchmarks).
- */
-MODULE_PARM_DESC(benchmark, "Run benchmark");
-module_param_named(benchmark, amdgpu_benchmarking, int, 0444);
-
 /**
  * DOC: test (int)
  * Test BO GTT->VRAM and VRAM->GTT GPU copies. The default is 0 (Skip test, only set 1 to run test).
Signature · 1 line
2.35.1
author maintainer
#6 lore raw

PATCH 7/7 drm/amdgpu: drop testing module parameter

In reply to Alex Deucher

This was always duplicate functionality with the benchmark tests. Drop it.

---
 drivers/gpu/drm/amd/amdgpu/Makefile        |   2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu.h        |   7 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |   7 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c    |   8 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_test.c   | 250 ---------------------
 5 files changed, 1 insertion(+), 273 deletions(-)
 delete mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
drivers/gpu/drm/amd/amdgpu/Makefile +1 -1
index 7fedbb725e17..5dfe08cb045e 100644
@@ -46,7 +46,7 @@ amdgpu-y += amdgpu_device.o amdgpu_kms.o \
 	atom.o amdgpu_fence.o amdgpu_ttm.o amdgpu_object.o amdgpu_gart.o \
 	amdgpu_encoders.o amdgpu_display.o amdgpu_i2c.o \
 	amdgpu_gem.o amdgpu_ring.o \
-	amdgpu_cs.o amdgpu_bios.o amdgpu_benchmark.o amdgpu_test.o \
+	amdgpu_cs.o amdgpu_bios.o amdgpu_benchmark.o \
 	atombios_dp.o amdgpu_afmt.o amdgpu_trace_points.o \
 	atombios_encoders.o amdgpu_sa.o atombios_i2c.o \
 	amdgpu_dma_buf.o amdgpu_vm.o amdgpu_ib.o amdgpu_pll.o \
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -7
index d6cf2e343a43..a117b40f03a0 100644
@@ -155,7 +155,6 @@ extern int amdgpu_vis_vram_limit;
 extern int amdgpu_gart_size;
 extern int amdgpu_gtt_size;
 extern int amdgpu_moverate;
-extern int amdgpu_testing;
 extern int amdgpu_audio;
 extern int amdgpu_disp_priority;
 extern int amdgpu_hw_i2c;
@@ -587,12 +586,6 @@ void amdgpu_device_wb_free(struct amdgpu_device *adev, u32 wb);
  */
 int amdgpu_benchmark(struct amdgpu_device *adev, int test_number);
 
-
-/*
- * Testing
- */
-void amdgpu_test_moves(struct amdgpu_device *adev);
-
 /*
  * ASIC specific register table accessible by UMD
  */
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -7
index 02863e2ea3c4..ae420a5c6407 100644
@@ -3805,13 +3805,6 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 	} else
 		adev->ucode_sysfs_en = true;
 
-	if ((amdgpu_testing & 1)) {
-		if (adev->accel_working)
-			amdgpu_test_moves(adev);
-		else
-			DRM_INFO("amdgpu: acceleration disabled, skipping move tests\n");
-	}
-
 	/*
 	 * Register gpu instance before amdgpu_device_enable_mgpu_fan_boost.
 	 * Otherwise the mgpu fan boost feature will be skipped due to the
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -8
index a76d78a6dc54..a0990f2e5562 100644
@@ -110,7 +110,6 @@ int amdgpu_vis_vram_limit;
 int amdgpu_gart_size = -1; /* auto */
 int amdgpu_gtt_size = -1; /* auto */
 int amdgpu_moverate = -1; /* auto */
-int amdgpu_testing;
 int amdgpu_audio = -1;
 int amdgpu_disp_priority;
 int amdgpu_hw_i2c;
@@ -230,13 +229,6 @@ module_param_named(gttsize, amdgpu_gtt_size, int, 0600);
 MODULE_PARM_DESC(moverate, "Maximum buffer migration rate in MB/s. (32, 64, etc., -1=auto, 0=1=disabled)");
 module_param_named(moverate, amdgpu_moverate, int, 0600);
 
-/**
- * DOC: test (int)
- * Test BO GTT->VRAM and VRAM->GTT GPU copies. The default is 0 (Skip test, only set 1 to run test).
- */
-MODULE_PARM_DESC(test, "Run tests");
-module_param_named(test, amdgpu_testing, int, 0444);
-
 /**
  * DOC: audio (int)
  * Set HDMI/DPAudio. Only affects non-DC display handling. The default is -1 (Enabled), set 0 to disabled it.
drivers/gpu/drm/amd/amdgpu/amdgpu_test.c deleted +0 -250

250 lines not on this page · raw message

Signature · 1 line
2.35.1
#7 lore raw

Re: [PATCH 7/7] drm/amdgpu: drop testing module parameter

Quoted 1 line · Alex Deucher

This was always duplicate functionality with the benchmark tests.

Not really. The purpose of amdgpu_do_test_moves is testing that copies between GTT & VRAM work across the whole GTT aperture (when I originally wrote radeon_do_test_moves, they didn't on the PowerBook I was using at the time).

Signature · 2 lines
Earthling Michel Dänzer            |                  https://redhat.com
Libre software enthusiast          |         Mesa and Xwayland developer
#8 lore raw

Re: [PATCH 7/7] drm/amdgpu: drop testing module parameter

Quoted 6 lines · Michel Dänzer
Quoted 1 line · Alex Deucher

This was always duplicate functionality with the benchmark tests.

Not really. The purpose of amdgpu_do_test_moves is testing that copies between GTT & VRAM work across the whole GTT aperture (when I originally wrote radeon_do_test_moves, they didn't on the PowerBook I was using at the time).

Fair enough. I'll drop it for now. Might be useful to convert to debugfs at some point as well.

Alex

Quoted 4 lines

--
Earthling Michel Dänzer | https://redhat.com
Libre software enthusiast | Mesa and Xwayland developer

#9 lore raw

Re: [PATCH 7/7] drm/amdgpu: drop testing module parameter

Quoted 11 lines · Alex Deucher
Quoted 6 lines · Michel Dänzer
Quoted 1 line · Alex Deucher

This was always duplicate functionality with the benchmark tests.

Not really. The purpose of amdgpu_do_test_moves is testing that copies between GTT & VRAM work across the whole GTT aperture (when I originally wrote radeon_do_test_moves, they didn't on the PowerBook I was using at the time).

Fair enough. I'll drop it for now. Might be useful to convert to debugfs at some point as well.

To be clear, I'm not saying this needs to stay — maybe it's not useful anymore. I'm just pointing out that it's not redundant with the benchmarks.

Signature · 2 lines
Earthling Michel Dänzer            |                  https://redhat.com
Libre software enthusiast          |         Mesa and Xwayland developer
maintainer
#10 lore raw

Re: [PATCH 7/7] drm/amdgpu: drop testing module parameter

Am 22.02.22 um 10:07 schrieb Michel Dänzer:

Quoted 10 lines · Alex Deucher
Quoted 8 lines
Quoted 4 lines · Michel Dänzer
Quoted 1 line · Alex Deucher

This was always duplicate functionality with the benchmark tests.

Not really. The purpose of amdgpu_do_test_moves is testing that copies between GTT & VRAM work across the whole GTT aperture (when I originally wrote radeon_do_test_moves, they didn't on the PowerBook I was using at the time).

Fair enough. I'll drop it for now. Might be useful to convert to debugfs at some point as well.

To be clear, I'm not saying this needs to stay — maybe it's not useful anymore. I'm just pointing out that it's not redundant with the benchmarks.

Yeah, the test doesn't necessary work that well any more since we now have the GART table much smaller than the GTT size.

I think it's still the best to just remove that.

Regards,
Christian.

Reviewed-by on v1 1/7
#11 lore raw
In reply to Alex Deucher

Am 18.02.22 um 23:25 schrieb Alex Deucher:

Quoted 5 lines

So we can tell which output goes to which device when multiple GPUs are present. Also while we are here, convert DRM_ERROR to dev_info. The error cases are not critical.

As a follow up we should probably replace the create, reserve, pin, alloc_gart dance in amdgpu_benchmark_move() with a call to amdgpu_bo_create_kernel() and amdgpu_bo_free_kernel().

And using ktime() instead of jiffies would protect us against wrap arounds in amdgpu_benchmark_do_move().

Regards,
Christian.

Quoted 51 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c | 12 +++++++-----
  1 file changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c +7 -5
index 313517f7cf10..b38783278a99 100644
@@ -56,13 +56,15 @@ static int amdgpu_benchmark_do_move(struct amdgpu_device *adev, unsigned size,
  }
 
 
-static void amdgpu_benchmark_log_results(int n, unsigned size,
+static void amdgpu_benchmark_log_results(struct amdgpu_device *adev,
+					 int n, unsigned size,
  					 unsigned int time,
  					 unsigned sdomain, unsigned ddomain,
  					 char *kind)
  {
  	unsigned int throughput = (n * (size >> 10)) / time;
-	DRM_INFO("amdgpu: %s %u bo moves of %u kB from"
+
+	dev_info(adev->dev, "amdgpu: %s %u bo moves of %u kB from"
  		 " %d to %d in %u ms, throughput: %u Mb/s or %u MB/s\n",
  		 kind, n, size >> 10, sdomain, ddomain, time,
  		 throughput * 8, throughput);
@@ -131,14 +133,14 @@ static void amdgpu_benchmark_move(struct amdgpu_device *adev, unsigned size,
  		if (time < 0)
  			goto out_cleanup;
  		if (time > 0)
-			amdgpu_benchmark_log_results(n, size, time,
+			amdgpu_benchmark_log_results(adev, n, size, time,
  						     sdomain, ddomain, "dma");
  	}
 
  out_cleanup:
  	/* Check error value now. The value can be overwritten when clean up.*/
  	if (r) {
-		DRM_ERROR("Error while benchmarking BO move.\n");
+		dev_info(adev->dev, "Error while benchmarking BO move.\n");
  	}
 
  	if (sobj) {
@@ -239,6 +241,6 @@ void amdgpu_benchmark(struct amdgpu_device *adev, int test_number)
  		break;
 
  	default:
-		DRM_ERROR("Unknown benchmark\n");
+		dev_info(adev->dev, "Unknown benchmark\n");
  	}
  }