Skip to content

Commit 043fc9e

Browse files
sanirban-999mattrope
authored andcommitted
drm/i915/selftest: Add throttle reason diagnostics to RPS selftests
Report GPU throttle reasons when RPS tests fail to reach expected frequencies or power levels. v2: Read the throttle value before the spinner ends (Raag) Add a condition before printing throttle value (Krzysztof) v3: Extend throttle reasons debug support (Raag) v4: Cosmetic changes (Raag) Signed-off-by: Sk Anirban <sk.anirban@intel.com> Reviewed-by: Raag Jadav <raag.jadav@intel.com> Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com> Link: https://patch.msgid.link/20251223101605.3304379-2-sk.anirban@intel.com Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
1 parent 78df43b commit 043fc9e

1 file changed

Lines changed: 29 additions & 5 deletions

File tree

drivers/gpu/drm/i915/gt/selftest_rps.c

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ int live_rps_control(void *arg)
378378
enum intel_engine_id id;
379379
struct igt_spinner spin;
380380
intel_wakeref_t wakeref;
381+
u32 throttle;
381382
int err = 0;
382383

383384
/*
@@ -463,6 +464,9 @@ int live_rps_control(void *arg)
463464
max = rps_set_check(rps, limit);
464465
max_dt = ktime_sub(ktime_get(), max_dt);
465466

467+
throttle = intel_uncore_read(gt->uncore, intel_gt_perf_limit_reasons_reg(gt));
468+
throttle &= GT0_PERF_LIMIT_REASONS_MASK;
469+
466470
min_dt = ktime_get();
467471
min = rps_set_check(rps, rps->min_freq);
468472
min_dt = ktime_sub(ktime_get(), min_dt);
@@ -478,11 +482,9 @@ int live_rps_control(void *arg)
478482
min, max, ktime_to_ns(min_dt), ktime_to_ns(max_dt));
479483

480484
if (limit != rps->max_freq) {
481-
u32 throttle = intel_uncore_read(gt->uncore,
482-
intel_gt_perf_limit_reasons_reg(gt));
483-
484-
pr_warn("%s: GPU throttled with reasons 0x%08x\n",
485-
engine->name, throttle & GT0_PERF_LIMIT_REASONS_MASK);
485+
if (throttle)
486+
pr_warn("%s: GPU throttled with reasons 0x%08x\n",
487+
engine->name, throttle);
486488
show_pstate_limits(rps);
487489
}
488490

@@ -1138,6 +1140,7 @@ int live_rps_power(void *arg)
11381140
struct intel_engine_cs *engine;
11391141
enum intel_engine_id id;
11401142
struct igt_spinner spin;
1143+
u32 throttle;
11411144
int err = 0;
11421145

11431146
/*
@@ -1195,6 +1198,9 @@ int live_rps_power(void *arg)
11951198
max.freq = rps->max_freq;
11961199
max.power = measure_power_at(rps, &max.freq);
11971200

1201+
throttle = intel_uncore_read(gt->uncore, intel_gt_perf_limit_reasons_reg(gt));
1202+
throttle &= GT0_PERF_LIMIT_REASONS_MASK;
1203+
11981204
min.freq = rps->min_freq;
11991205
min.power = measure_power_at(rps, &min.freq);
12001206

@@ -1210,12 +1216,21 @@ int live_rps_power(void *arg)
12101216
pr_notice("Could not control frequency, ran at [%d:%uMHz, %d:%uMhz]\n",
12111217
min.freq, intel_gpu_freq(rps, min.freq),
12121218
max.freq, intel_gpu_freq(rps, max.freq));
1219+
1220+
if (throttle)
1221+
pr_warn("%s: GPU throttled with reasons 0x%08x\n",
1222+
engine->name, throttle);
12131223
continue;
12141224
}
12151225

12161226
if (11 * min.power > 10 * max.power) {
12171227
pr_err("%s: did not conserve power when setting lower frequency!\n",
12181228
engine->name);
1229+
1230+
if (throttle)
1231+
pr_warn("%s: GPU throttled with reasons 0x%08x\n",
1232+
engine->name, throttle);
1233+
12191234
err = -EINVAL;
12201235
break;
12211236
}
@@ -1241,6 +1256,7 @@ int live_rps_dynamic(void *arg)
12411256
struct intel_engine_cs *engine;
12421257
enum intel_engine_id id;
12431258
struct igt_spinner spin;
1259+
u32 throttle;
12441260
int err = 0;
12451261

12461262
/*
@@ -1293,6 +1309,9 @@ int live_rps_dynamic(void *arg)
12931309
max.freq = wait_for_freq(rps, rps->max_freq, 500);
12941310
max.dt = ktime_sub(ktime_get(), max.dt);
12951311

1312+
throttle = intel_uncore_read(gt->uncore, intel_gt_perf_limit_reasons_reg(gt));
1313+
throttle &= GT0_PERF_LIMIT_REASONS_MASK;
1314+
12961315
igt_spinner_end(&spin);
12971316

12981317
min.dt = ktime_get();
@@ -1308,6 +1327,11 @@ int live_rps_dynamic(void *arg)
13081327
if (min.freq >= max.freq) {
13091328
pr_err("%s: dynamic reclocking of spinner failed\n!",
13101329
engine->name);
1330+
1331+
if (throttle)
1332+
pr_warn("%s: GPU throttled with reasons 0x%08x\n",
1333+
engine->name, throttle);
1334+
13111335
err = -EINVAL;
13121336
}
13131337

0 commit comments

Comments
 (0)