mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 13:48:06 +02:00
radv: Add safety check for RGP traces on VanGogh.
To avoid accidental hangs. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5260 Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13730>
This commit is contained in:
parent
3077d96856
commit
860532c5a1
3 changed files with 32 additions and 0 deletions
|
|
@ -148,3 +148,25 @@ ac_sqtt_add_code_object_loader_event(struct ac_thread_trace_data *thread_trace_d
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* See https://gitlab.freedesktop.org/mesa/mesa/-/issues/5260
|
||||
* On some HW SQTT can hang if we're not in one of the profiling pstates. */
|
||||
bool
|
||||
ac_check_profile_state(const struct radeon_info *info)
|
||||
{
|
||||
char path[128];
|
||||
char data[128];
|
||||
int n;
|
||||
|
||||
snprintf(path, sizeof(path),
|
||||
"/sys/bus/pci/devices/%04x:%02x:%02x.%x/power_dpm_force_performance_level",
|
||||
info->pci_domain, info->pci_bus, info->pci_dev, info->pci_func);
|
||||
|
||||
FILE *f = fopen(path, "r");
|
||||
if (!f)
|
||||
return false; /* Unknown but optimistic. */
|
||||
n = fread(data, 1, sizeof(data) - 1, f);
|
||||
fclose(f);
|
||||
data[n] = 0;
|
||||
return strstr(data, "profile") == NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -498,4 +498,6 @@ bool ac_sqtt_add_code_object_loader_event(struct ac_thread_trace_data *thread_tr
|
|||
uint64_t pipeline_hash,
|
||||
uint64_t base_address);
|
||||
|
||||
bool ac_check_profile_state(const struct radeon_info *info);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -394,6 +394,14 @@ radv_handle_thread_trace(VkQueue _queue)
|
|||
#endif
|
||||
|
||||
if (frame_trigger || file_trigger || resize_trigger) {
|
||||
if (ac_check_profile_state(&queue->device->physical_device->rad_info)) {
|
||||
fprintf(stderr, "radv: Canceling RGP trace request as a hang condition has been "
|
||||
"detected. Force the GPU into a profiling mode with e.g. "
|
||||
"\"echo profile_peak > "
|
||||
"/sys/class/drm/card0/device/power_dpm_force_performance_level\"\n");
|
||||
return;
|
||||
}
|
||||
|
||||
radv_begin_thread_trace(queue);
|
||||
assert(!thread_trace_enabled);
|
||||
thread_trace_enabled = true;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue