drm/msm: add param to retrieve # of GPU faults (global)
authorRob Clark <robdclark@chromium.org>
Tue, 16 Apr 2019 23:13:28 +0000 (16:13 -0700)
committerRob Clark <robdclark@chromium.org>
Fri, 19 Apr 2019 18:50:00 +0000 (11:50 -0700)
For KHR_robustness, userspace wants to know two things, the count of GPU
faults globally, and the count of faults attributed to a given context.
This patch providees the former, and the next patch provides the latter.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Jordan Crouse <jcrouse@codeaurora.org>
drivers/gpu/drm/msm/adreno/adreno_gpu.c
drivers/gpu/drm/msm/msm_gpu.c
drivers/gpu/drm/msm/msm_gpu.h
include/uapi/drm/msm_drm.h

index 7727917806cea492fe572c9ac3a35608174ccfe8..6de08cfc38aa892c3b5c71b6bbd3d48dbfde247b 100644 (file)
@@ -66,6 +66,9 @@ int adreno_get_param(struct msm_gpu *gpu, uint32_t param, uint64_t *value)
        case MSM_PARAM_PP_PGTABLE:
                *value = 0;
                return 0;
+       case MSM_PARAM_FAULTS:
+               *value = gpu->global_faults;
+               return 0;
        default:
                DBG("%s: invalid param: %u", gpu->name, param);
                return -EINVAL;
index 10babd18e28605b1c76faf55c51748c5e85504f1..194847a220b61b9dec0b23d4449574516866e1cd 100644 (file)
@@ -443,6 +443,9 @@ static void recover_worker(struct work_struct *work)
        if (submit) {
                struct task_struct *task;
 
+               /* Increment the fault count */
+               gpu->global_faults++;
+
                task = get_pid_task(submit->pid, PIDTYPE_PID);
                if (task) {
                        comm = kstrdup(task->comm, GFP_KERNEL);
index 6241986bab51691af622d147ce6cb5773e057b74..f2739cd97cea944991ba7af41fb95e2b8a016887 100644 (file)
@@ -104,6 +104,9 @@ struct msm_gpu {
        /* does gpu need hw_init? */
        bool needs_hw_init;
 
+       /* number of GPU hangs (for all contexts) */
+       int global_faults;
+
        /* worker for handling active-list retiring: */
        struct work_struct retire_work;
 
index a9fdcf1689ce6ceb3677be18db5d13e416ae85f6..178d7b407f3a37a5a3ccc2e7fa6abd88b4f0d1fe 100644 (file)
@@ -75,6 +75,7 @@ struct drm_msm_timespec {
 #define MSM_PARAM_GMEM_BASE  0x06
 #define MSM_PARAM_NR_RINGS   0x07
 #define MSM_PARAM_PP_PGTABLE 0x08  /* => 1 for per-process pagetables, else 0 */
+#define MSM_PARAM_FAULTS     0x09
 
 struct drm_msm_param {
        __u32 pipe;           /* in, MSM_PIPE_x */