mirror of
https://github.com/torvalds/linux.git
synced 2026-05-05 23:05:25 -04:00
drm/amdgpu: optimize the printing order of error data
sort error data list to optimize the printing order. Signed-off-by: Yang Wang <kevinyang.wang@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include <linux/reboot.h>
|
||||
#include <linux/syscalls.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/list_sort.h>
|
||||
|
||||
#include "amdgpu.h"
|
||||
#include "amdgpu_ras.h"
|
||||
@@ -3674,6 +3675,21 @@ static struct ras_err_node *amdgpu_ras_error_node_new(void)
|
||||
return err_node;
|
||||
}
|
||||
|
||||
static int ras_err_info_cmp(void *priv, const struct list_head *a, const struct list_head *b)
|
||||
{
|
||||
struct ras_err_node *nodea = container_of(a, struct ras_err_node, node);
|
||||
struct ras_err_node *nodeb = container_of(b, struct ras_err_node, node);
|
||||
struct amdgpu_smuio_mcm_config_info *infoa = &nodea->err_info.mcm_info;
|
||||
struct amdgpu_smuio_mcm_config_info *infob = &nodeb->err_info.mcm_info;
|
||||
|
||||
if (unlikely(infoa->socket_id != infob->socket_id))
|
||||
return infoa->socket_id - infob->socket_id;
|
||||
else
|
||||
return infoa->die_id - infob->die_id;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct ras_err_info *amdgpu_ras_error_get_info(struct ras_err_data *err_data,
|
||||
struct amdgpu_smuio_mcm_config_info *mcm_info)
|
||||
{
|
||||
@@ -3691,6 +3707,7 @@ static struct ras_err_info *amdgpu_ras_error_get_info(struct ras_err_data *err_d
|
||||
|
||||
err_data->err_list_count++;
|
||||
list_add_tail(&err_node->node, &err_data->err_node_list);
|
||||
list_sort(NULL, &err_data->err_node_list, ras_err_info_cmp);
|
||||
|
||||
return &err_node->err_info;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user