Move away from generic pr prints to GT aware gt_* versions, which tag each message with device and the tile it came from.
Assisted-by: GitHub-Copilot:claude-opus-5 Signed-off-by: Krzysztof Karas <[email protected]> --- v5: * No changes since v4; drivers/gpu/drm/i915/gt/selftest_rc6.c | 32 ++++--- drivers/gpu/drm/i915/gt/selftest_rps.c | 126 ++++++++++++++++--------- 2 files changed, 103 insertions(+), 55 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/selftest_rc6.c b/drivers/gpu/drm/i915/gt/selftest_rc6.c index 68fb1830d411..a88b39733364 100644 --- a/drivers/gpu/drm/i915/gt/selftest_rc6.c +++ b/drivers/gpu/drm/i915/gt/selftest_rc6.c @@ -6,6 +6,7 @@ #include "intel_context.h" #include "intel_engine_pm.h" #include "intel_gpu_commands.h" +#include "intel_gt_print.h" #include "intel_gt_requests.h" #include "intel_ring.h" #include "intel_rps.h" @@ -80,7 +81,8 @@ int live_rc6_manual(void *arg) res[1] = rc6_residency(rc6); rc0_freq = intel_rps_read_actual_frequency_fw(rps); if ((res[1] - res[0]) >> 10) { - pr_err("RC6 residency increased by %lldus while disabled for 1000ms!\n", + gt_err(gt, + "RC6 residency increased by %lldus while disabled for 1000ms!\n", (res[1] - res[0]) >> 10); err = -EINVAL; goto out_unlock; @@ -92,10 +94,12 @@ int live_rc6_manual(void *arg) if (!rc0_power) { if (rc0_freq) - pr_err("No power measured while in RC0! GPU Freq: %uMHz in RC0\n", + gt_err(gt, + "No power measured while in RC0! GPU Freq: %uMHz in RC0\n", rc0_freq); else - pr_err("No power and freq measured while in RC0\n"); + gt_err(gt, + "No power and freq measured while in RC0\n"); err = -EINVAL; goto out_unlock; } @@ -114,7 +118,8 @@ int live_rc6_manual(void *arg) dt = ktime_sub(ktime_get(), dt); res[1] = rc6_residency(rc6); if (res[1] == res[0]) { - pr_err("Did not enter RC6! RC6_STATE=%08x, RC6_CONTROL=%08x, residency=%lld\n", + gt_err(gt, + "Did not enter RC6! RC6_STATE=%08x, RC6_CONTROL=%08x, residency=%lld\n", intel_uncore_read_fw(gt->uncore, GEN6_RC_STATE), intel_uncore_read_fw(gt->uncore, GEN6_RC_CONTROL), res[0]); @@ -124,21 +129,25 @@ int live_rc6_manual(void *arg) if (has_power) { rc6_power = div64_u64(NSEC_PER_SEC * rc6_sample_energy[1], ktime_to_ns(dt)); - pr_info("GPU consumed %lluuW in RC0 and %lluuW in RC6\n", + gt_info(gt, + "GPU consumed %lluuW in RC0 and %lluuW in RC6\n", rc0_power, rc6_power); if (2 * rc6_power > rc0_power) { - pr_err("GPU leaked energy while in RC6!\n" + gt_err(gt, + "GPU leaked energy while in RC6!\n" "GPU Freq: %uMHz in RC6 and %uMHz in RC0\n" "RC0 energy before & after sleep respectively: %lluuJ %lluuJ\n" "RC6 energy before & after sleep respectively: %lluuJ %lluuJ\n", - rc6_freq, rc0_freq, rc0_sample_energy[0], rc0_sample_energy[1], + rc6_freq, rc0_freq, + rc0_sample_energy[0], rc0_sample_energy[1], rc6_sample_energy[0], rc6_sample_energy[1]); diff = res[1] - res[0]; threshold = (9 * NSEC_PER_MSEC * sleep_time) / 10; if (diff < threshold) - pr_err("Did not enter RC6 properly, RC6 start residency=%lluns, RC6 end residency=%lluns\n", + gt_err(gt, + "Did not enter RC6 properly, RC6 start residency=%lluns, RC6 end residency=%lluns\n", res[0], res[1]); err = -EINVAL; goto out_unlock; @@ -265,12 +274,13 @@ int live_rc6_ctx_wa(void *arg) } intel_gt_pm_wait_for_idle(gt); - pr_debug("%s: CTX_INFO=%0x\n", - engine->name, READ_ONCE(*res)); + gt_dbg(gt, "%s: CTX_INFO=%0x\n", + engine->name, READ_ONCE(*res)); if (resets != i915_reset_engine_count(error, engine)) { - pr_err("%s: GPU reset required\n", + gt_err(gt, + "%s: GPU reset required\n", engine->name); add_taint_for_CI(gt->i915, TAINT_WARN); err = -EIO; diff --git a/drivers/gpu/drm/i915/gt/selftest_rps.c b/drivers/gpu/drm/i915/gt/selftest_rps.c index be77fba2ec49..0c5bccfddd3a 100644 --- a/drivers/gpu/drm/i915/gt/selftest_rps.c +++ b/drivers/gpu/drm/i915/gt/selftest_rps.c @@ -15,6 +15,7 @@ #include "intel_gpu_commands.h" #include "intel_gt_clock_utils.h" #include "intel_gt_pm.h" +#include "intel_gt_print.h" #include "intel_rc6.h" #include "selftest_engine_heartbeat.h" #include "selftest_rps.h" @@ -204,12 +205,12 @@ static void show_pstate_limits(struct intel_rps *rps) struct drm_i915_private *i915 = rps_to_i915(rps); if (IS_BROXTON(i915)) { - pr_info("P_STATE_CAP[%x]: 0x%08x\n", + gt_info(rps_to_gt(rps), "P_STATE_CAP[%x]: 0x%08x\n", i915_mmio_reg_offset(BXT_RP_STATE_CAP), intel_uncore_read(rps_to_uncore(rps), BXT_RP_STATE_CAP)); } else if (GRAPHICS_VER(i915) == 9) { - pr_info("P_STATE_LIMITS[%x]: 0x%08x\n", + gt_info(rps_to_gt(rps), "P_STATE_LIMITS[%x]: 0x%08x\n", i915_mmio_reg_offset(GEN9_RP_STATE_LIMITS), intel_uncore_read(rps_to_uncore(rps), GEN9_RP_STATE_LIMITS)); @@ -264,7 +265,8 @@ int live_rps_clock_interval(void *arg) i915_request_add(rq); if (!igt_wait_for_spinner(&spin, rq)) { - pr_err("%s: RPS spinner did not start\n", + gt_err(gt, + "%s: RPS spinner did not start\n", engine->name); igt_spinner_end(&spin); st_engine_heartbeat_enable(engine); @@ -290,7 +292,8 @@ int live_rps_clock_interval(void *arg) GEN6_RP_CUR_UP_EI), 10)) { /* Just skip the test; assume lack of HW support */ - pr_notice("%s: rps evaluation interval not ticking\n", + gt_notice(gt, + "%s: rps evaluation interval not ticking\n", engine->name); err = -ENODEV; } else { @@ -330,20 +333,23 @@ int live_rps_clock_interval(void *arg) u32 expected = intel_gt_ns_to_pm_interval(gt, dt); - pr_info("%s: rps counted %d C0 cycles [%lldns] in %lldns [%d cycles], using GT clock frequency of %uKHz\n", + gt_info(gt, + "%s: rps counted %d C0 cycles [%lldns] in %lldns [%d cycles], using GT clock frequency of %uKHz\n", engine->name, cycles, time, dt, expected, gt->clock_frequency / 1000); if (10 * time < 8 * dt || 8 * time > 10 * dt) { - pr_err("%s: rps clock time does not match walltime!\n", + gt_err(gt, + "%s: rps clock time does not match walltime!\n", engine->name); err = -EINVAL; } if (10 * expected < 8 * cycles || 8 * expected > 10 * cycles) { - pr_err("%s: walltime does not match rps clock ticks!\n", + gt_err(gt, + "%s: walltime does not match rps clock ticks!\n", engine->name); err = -EINVAL; } @@ -424,7 +430,8 @@ int live_rps_control(void *arg) i915_request_add(rq); if (!igt_wait_for_spinner(&spin, rq)) { - pr_err("%s: RPS spinner did not start\n", + gt_err(gt, + "%s: RPS spinner did not start\n", engine->name); igt_spinner_end(&spin); st_engine_heartbeat_enable(engine); @@ -434,7 +441,8 @@ int live_rps_control(void *arg) } if (rps_set_check(rps, rps->min_freq) != rps->min_freq) { - pr_err("%s: could not set minimum frequency [%x], only %x!\n", + gt_err(gt, + "%s: could not set minimum frequency [%x], only %x!\n", engine->name, rps->min_freq, read_cagf(rps)); igt_spinner_end(&spin); st_engine_heartbeat_enable(engine); @@ -451,7 +459,8 @@ int live_rps_control(void *arg) limit = rps_set_check(rps, f); if (rps_set_check(rps, rps->min_freq) != rps->min_freq) { - pr_err("%s: could not restore minimum frequency [%x], only %x!\n", + gt_err(gt, + "%s: could not restore minimum frequency [%x], only %x!\n", engine->name, rps->min_freq, read_cagf(rps)); igt_spinner_end(&spin); st_engine_heartbeat_enable(engine); @@ -474,7 +483,8 @@ int live_rps_control(void *arg) igt_spinner_end(&spin); st_engine_heartbeat_enable(engine); - pr_info("%s: range:[%x:%uMHz, %x:%uMHz] limit:[%x:%uMHz], %x:%x response %lluns:%lluns\n", + gt_info(gt, + "%s: range:[%x:%uMHz, %x:%uMHz] limit:[%x:%uMHz], %x:%x response %lluns:%lluns\n", engine->name, rps->min_freq, intel_gpu_freq(rps, rps->min_freq), rps->max_freq, intel_gpu_freq(rps, rps->max_freq), @@ -483,7 +493,8 @@ int live_rps_control(void *arg) if (limit != rps->max_freq) { if (throttle) - pr_warn("%s: GPU throttled with reasons 0x%08x\n", + gt_warn(gt, + "%s: GPU throttled with reasons 0x%08x\n", engine->name, throttle); show_pstate_limits(rps); } @@ -523,14 +534,14 @@ static void show_pcu_config(struct intel_rps *rps) wakeref = intel_runtime_pm_get(rps_to_uncore(rps)->rpm); - pr_info("%5s %5s %5s\n", "GPU", "eCPU", "eRing"); + gt_info(rps_to_gt(rps), "%5s %5s %5s\n", "GPU", "eCPU", "eRing"); for (gpu_freq = min_gpu_freq; gpu_freq <= max_gpu_freq; gpu_freq++) { int ia_freq = gpu_freq; snb_pcode_read(rps_to_gt(rps)->uncore, GEN6_PCODE_READ_MIN_FREQ_TABLE, &ia_freq, NULL); - pr_info("%5d %5d %5d\n", + gt_info(rps_to_gt(rps), "%5d %5d %5d\n", gpu_freq * 50, ((ia_freq >> 0) & 0xff) * 100, ((ia_freq >> 8) & 0xff) * 100); @@ -669,7 +680,8 @@ int live_rps_frequency_cs(void *arg) if (wait_for(intel_uncore_read(engine->uncore, CS_GPR(0)), 10)) { - pr_err("%s: timed loop did not start\n", + gt_err(gt, + "%s: timed loop did not start\n", engine->name); goto err_vma; } @@ -680,7 +692,8 @@ int live_rps_frequency_cs(void *arg) max.freq = rps->max_freq; max.count = measure_cs_frequency_at(rps, engine, &max.freq); - pr_info("%s: min:%lluKHz @ %uMHz, max:%lluKHz @ %uMHz [%d%%]\n", + gt_info(gt, + "%s: min:%lluKHz @ %uMHz, max:%lluKHz @ %uMHz [%d%%]\n", engine->name, min.count, intel_gpu_freq(rps, min.freq), max.count, intel_gpu_freq(rps, max.freq), @@ -692,7 +705,8 @@ int live_rps_frequency_cs(void *arg) 2, 3)) { int f; - pr_err("%s: CS did not scale with frequency! scaled min:%llu, max:%llu\n", + gt_err(gt, + "%s: CS did not scale with frequency! scaled min:%llu, max:%llu\n", engine->name, max.freq * min.count, min.freq * max.count); @@ -706,7 +720,8 @@ int live_rps_frequency_cs(void *arg) if (act < f) break; - pr_info("%s: %x:%uMHz: %lluKHz [%d%%]\n", + gt_info(gt, + "%s: %x:%uMHz: %lluKHz [%d%%]\n", engine->name, act, intel_gpu_freq(rps, act), count, (int)DIV64_U64_ROUND_CLOSEST(100 * min.freq * count, @@ -807,7 +822,8 @@ int live_rps_frequency_srm(void *arg) goto err_vma; if (wait_for(READ_ONCE(*cntr), 10)) { - pr_err("%s: timed loop did not start\n", + gt_err(gt, + "%s: timed loop did not start\n", engine->name); goto err_vma; } @@ -818,7 +834,8 @@ int live_rps_frequency_srm(void *arg) max.freq = rps->max_freq; max.count = measure_frequency_at(rps, cntr, &max.freq); - pr_info("%s: min:%lluKHz @ %uMHz, max:%lluKHz @ %uMHz [%d%%]\n", + gt_info(gt, + "%s: min:%lluKHz @ %uMHz, max:%lluKHz @ %uMHz [%d%%]\n", engine->name, min.count, intel_gpu_freq(rps, min.freq), max.count, intel_gpu_freq(rps, max.freq), @@ -830,7 +847,8 @@ int live_rps_frequency_srm(void *arg) 1, 2)) { int f; - pr_err("%s: CS did not scale with frequency! scaled min:%llu, max:%llu\n", + gt_err(gt, + "%s: CS did not scale with frequency! scaled min:%llu, max:%llu\n", engine->name, max.freq * min.count, min.freq * max.count); @@ -844,7 +862,8 @@ int live_rps_frequency_srm(void *arg) if (act < f) break; - pr_info("%s: %x:%uMHz: %lluKHz [%d%%]\n", + gt_info(gt, + "%s: %x:%uMHz: %lluKHz [%d%%]\n", engine->name, act, intel_gpu_freq(rps, act), count, (int)DIV64_U64_ROUND_CLOSEST(100 * min.freq * count, @@ -915,7 +934,7 @@ static int __rps_up_interrupt(struct intel_rps *rps, i915_request_add(rq); if (!igt_wait_for_spinner(spin, rq)) { - pr_err("%s: RPS spinner did not start\n", + gt_err(engine->gt, "%s: RPS spinner did not start\n", engine->name); i915_request_put(rq); intel_gt_set_wedged(engine->gt); @@ -923,7 +942,8 @@ static int __rps_up_interrupt(struct intel_rps *rps, } if (!intel_rps_is_active(rps)) { - pr_err("%s: RPS not enabled on starting spinner\n", + gt_err(engine->gt, + "%s: RPS not enabled on starting spinner\n", engine->name); igt_spinner_end(spin); i915_request_put(rq); @@ -931,14 +951,16 @@ static int __rps_up_interrupt(struct intel_rps *rps, } if (!(rps->pm_events & GEN6_PM_RP_UP_THRESHOLD)) { - pr_err("%s: RPS did not register UP interrupt\n", + gt_err(engine->gt, + "%s: RPS did not register UP interrupt\n", engine->name); i915_request_put(rq); return -EINVAL; } if (rps->last_freq != rps->min_freq) { - pr_err("%s: RPS did not program min frequency\n", + gt_err(engine->gt, + "%s: RPS did not program min frequency\n", engine->name); i915_request_put(rq); return -EINVAL; @@ -955,13 +977,15 @@ static int __rps_up_interrupt(struct intel_rps *rps, i915_request_put(rq); if (rps->cur_freq != rps->min_freq) { - pr_err("%s: Frequency unexpectedly changed [up], now %d!\n", + gt_err(engine->gt, + "%s: Frequency unexpectedly changed [up], now %d!\n", engine->name, intel_rps_read_actual_frequency(rps)); return -EINVAL; } if (!(rps->pm_iir & GEN6_PM_RP_UP_THRESHOLD)) { - pr_err("%s: UP interrupt not recorded for spinner, pm_iir:%x, prev_up:%x, up_threshold:%x, up_ei:%x\n", + gt_err(engine->gt, + "%s: UP interrupt not recorded for spinner, pm_iir:%x, prev_up:%x, up_threshold:%x, up_ei:%x\n", engine->name, rps->pm_iir, intel_uncore_read(uncore, GEN6_RP_PREV_UP), intel_uncore_read(uncore, GEN6_RP_UP_THRESHOLD), @@ -981,13 +1005,15 @@ static int __rps_down_interrupt(struct intel_rps *rps, rps_set_check(rps, rps->max_freq); if (!(rps->pm_events & GEN6_PM_RP_DOWN_THRESHOLD)) { - pr_err("%s: RPS did not register DOWN interrupt\n", + gt_err(engine->gt, + "%s: RPS did not register DOWN interrupt\n", engine->name); return -EINVAL; } if (rps->last_freq != rps->max_freq) { - pr_err("%s: RPS did not program max frequency\n", + gt_err(engine->gt, + "%s: RPS did not program max frequency\n", engine->name); return -EINVAL; } @@ -999,14 +1025,16 @@ static int __rps_down_interrupt(struct intel_rps *rps, sleep_for_ei(rps, timeout); if (rps->cur_freq != rps->max_freq) { - pr_err("%s: Frequency unexpectedly changed [down], now %d!\n", + gt_err(engine->gt, + "%s: Frequency unexpectedly changed [down], now %d!\n", engine->name, intel_rps_read_actual_frequency(rps)); return -EINVAL; } if (!(rps->pm_iir & (GEN6_PM_RP_DOWN_THRESHOLD | GEN6_PM_RP_DOWN_TIMEOUT))) { - pr_err("%s: DOWN interrupt not recorded for idle, pm_iir:%x, prev_down:%x, down_threshold:%x, down_ei:%x [prev_up:%x, up_threshold:%x, up_ei:%x]\n", + gt_err(engine->gt, + "%s: DOWN interrupt not recorded for idle, pm_iir:%x, prev_down:%x, down_threshold:%x, down_ei:%x [prev_up:%x, up_threshold:%x, up_ei:%x]\n", engine->name, rps->pm_iir, intel_uncore_read(uncore, GEN6_RP_PREV_DOWN), intel_uncore_read(uncore, GEN6_RP_DOWN_THRESHOLD), @@ -1043,7 +1071,8 @@ int live_rps_interrupt(void *arg) with_intel_gt_pm(gt, wakeref) pm_events = rps->pm_events; if (!pm_events) { - pr_err("No RPS PM events registered, but RPS is enabled?\n"); + gt_err(gt, + "No RPS PM events registered, but RPS is enabled?\n"); return -ENODEV; } @@ -1186,7 +1215,8 @@ int live_rps_power(void *arg) i915_request_add(rq); if (!igt_wait_for_spinner(&spin, rq)) { - pr_err("%s: RPS spinner did not start\n", + gt_err(gt, + "%s: RPS spinner did not start\n", engine->name); igt_spinner_end(&spin); st_engine_heartbeat_enable(engine); @@ -1207,28 +1237,33 @@ int live_rps_power(void *arg) igt_spinner_end(&spin); st_engine_heartbeat_enable(engine); - pr_info("%s: min:%llumW @ %uMHz, max:%llumW @ %uMHz\n", + gt_info(gt, + "%s: min:%llumW @ %uMHz, max:%llumW @ %uMHz\n", engine->name, min.power, intel_gpu_freq(rps, min.freq), max.power, intel_gpu_freq(rps, max.freq)); if (10 * min.freq >= 9 * max.freq) { - pr_notice("Could not control frequency, ran at [%d:%uMHz, %d:%uMhz]\n", + gt_notice(gt, + "Could not control frequency, ran at [%d:%uMHz, %d:%uMhz]\n", min.freq, intel_gpu_freq(rps, min.freq), max.freq, intel_gpu_freq(rps, max.freq)); if (throttle) - pr_warn("%s: GPU throttled with reasons 0x%08x\n", + gt_warn(gt, + "%s: GPU throttled with reasons 0x%08x\n", engine->name, throttle); continue; } if (11 * min.power > 10 * max.power) { - pr_err("%s: did not conserve power when setting lower frequency!\n", + gt_err(gt, + "%s: did not conserve power when setting lower frequency!\n", engine->name); if (throttle) - pr_warn("%s: GPU throttled with reasons 0x%08x\n", + gt_warn(gt, + "%s: GPU throttled with reasons 0x%08x\n", engine->name, throttle); err = -EINVAL; @@ -1273,9 +1308,9 @@ int live_rps_dynamic(void *arg) return -ENOMEM; if (intel_rps_has_interrupts(rps)) - pr_info("RPS has interrupt support\n"); + gt_info(gt, "RPS has interrupt support\n"); if (intel_rps_uses_timer(rps)) - pr_info("RPS has timer support\n"); + gt_info(gt, "RPS has timer support\n"); for_each_engine(engine, gt, id) { struct i915_request *rq; @@ -1318,18 +1353,21 @@ int live_rps_dynamic(void *arg) min.freq = wait_for_freq(rps, rps->min_freq, 2000); min.dt = ktime_sub(ktime_get(), min.dt); - pr_info("%s: dynamically reclocked to %u:%uMHz while busy in %lluns, and %u:%uMHz while idle in %lluns\n", + gt_info(gt, + "%s: dynamically reclocked to %u:%uMHz while busy in %lluns, and %u:%uMHz while idle in %lluns\n", engine->name, max.freq, intel_gpu_freq(rps, max.freq), ktime_to_ns(max.dt), min.freq, intel_gpu_freq(rps, min.freq), ktime_to_ns(min.dt)); if (min.freq >= max.freq) { - pr_err("%s: dynamic reclocking of spinner failed\n!", + gt_err(gt, + "%s: dynamic reclocking of spinner failed\n!", engine->name); if (throttle) - pr_warn("%s: GPU throttled with reasons 0x%08x\n", + gt_warn(gt, + "%s: GPU throttled with reasons 0x%08x\n", engine->name, throttle); err = -EINVAL; -- 2.34.1
