panthor: print task pid and comm on gpu errors
Subsystems (3)
v2 cover panthor: print task pid and comm on gpu errors
This series saves task pid and comm in panthor_group and prints task pid and comm on gpu errors.
v2: save the task info in panthor_group on panthor_group_create, rather than
in panthor_file on panthor_open, because, when the two differ, we are more interested in the task that created the group.
Chia-I Wu (3):
panthor: set owner field for driver fops
panthor: save task pid and comm in panthor_group
panthor: dump task pid and comm on gpu errors
drivers/gpu/drm/panthor/panthor_drv.c | 14 ++------ drivers/gpu/drm/panthor/panthor_sched.c | 43 ++++++++++++++++++++++--- 2 files changed, 41 insertions(+), 16 deletions(-)
Signature · 1 line
2.50.0.727.gbf7dc18ff4-goog
PATCH v2 1/3 panthor: set owner field for driver fops
It allows us to get rid of manual try_module_get / module_put.
--- drivers/gpu/drm/panthor/panthor_drv.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/gpu/drm/panthor/panthor_drv.c +3 -11
@@ -1400,14 +1400,9 @@ panthor_open(struct drm_device *ddev, struct drm_file *file)struct panthor_file *pfile;int ret; -if (!try_module_get (THIS_MODULE )) -return -EINVAL ; - pfile =kzalloc (sizeof (*pfile),GFP_KERNEL ); -if (!pfile) { - ret = -ENOMEM ; - goto err_put_mod; - } +if (!pfile) +return -ENOMEM ; pfile->ptdev = ptdev; pfile->user_mmio.offset =DRM_PANTHOR_USER_MMIO_OFFSET ;
@@ -1439,9 +1434,6 @@ panthor_open(struct drm_device *ddev, struct drm_file *file) err_free_file:kfree (pfile); - -err_put_mod: -module_put (THIS_MODULE );return ret; }
@@ -1454,7 +1446,6 @@ panthor_postclose(struct drm_device *ddev, struct drm_file *file)panthor_vm_pool_destroy (pfile);kfree (pfile); -module_put (THIS_MODULE ); }static const struct drm_ioctl_desc panthor_drm_driver_ioctls[] = {
@@ -1555,6 +1546,7 @@ static void panthor_show_fdinfo(struct drm_printer *p, struct drm_file *file) }static const struct file_operations panthor_drm_driver_fops = { + .owner =THIS_MODULE , .open = drm_open, .release = drm_release, .unlocked_ioctl = drm_ioctl,
Signature · 1 line
2.50.0.727.gbf7dc18ff4-goog
PATCH v2 2/3 panthor: save task pid and comm in panthor_group
In reply to Chia-I WuWe would like to report them on gpu errors.
We choose to save the info on panthor_group_create rather than on panthor_open because, when the two differ, we are more interested in the task that created the group.
---
v2: save to panthor_group on panthor_group_create rather than to
panthor_file on panthor_open
--- drivers/gpu/drm/panthor/panthor_sched.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/gpu/drm/panthor/panthor_sched.c +19 -0
@@ -641,6 +641,15 @@ struct panthor_group {size_t kbo_sizes; } fdinfo; +/** @task_info: Info of current->group_leader that created the group. */ +struct { +/** @pid: pid of current->group_leader */ +pid_t pid; + +/** @comm: comm of current->group_leader */ +char comm[TASK_COMM_LEN ]; + } task_info; +/** @state: Group state. */ enum panthor_group_state state;
@@ -3389,6 +3398,14 @@ group_create_queue(struct panthor_group *group,return ERR_PTR (ret); } +static void group_init_task_info (struct panthor_group *group) +{ +struct task_struct *task = current->group_leader; + + group->task_info.pid = task->pid; +get_task_comm (group->task_info.comm, task); +} +static void add_group_kbo_sizes (struct panthor_device *ptdev,struct panthor_group *group) {
@@ -3540,6 +3557,8 @@ int panthor_group_create(struct panthor_file *pfile,add_group_kbo_sizes (group->ptdev, group);spin_lock_init (&group->fdinfo.lock); +group_init_task_info (group); +return gid; err_put_group:
Signature · 1 line
2.50.0.727.gbf7dc18ff4-goog
kernel test robot
build botRe: [PATCH v2 2/3] panthor: save task pid and comm in panthor_group
kernel test robot noticed the following build warnings:
Hi Chia-I,
kernel test robot noticed the following build warnings:
[auto build test WARNING on next-20250711]
[also build test WARNING on v6.16-rc5]
[cannot apply to linus/master v6.16-rc5 v6.16-rc4 v6.16-rc3] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Chia-I-Wu/panthor-set-owner-field-for-driver-fops/20250713-111248 base: next-20250711 patch link: https://lore.kernel.org/r/20250713030831.3227607-3-olvaffe%40gmail.com patch subject: [PATCH v2 2/3] panthor: save task pid and comm in panthor_group config: i386-buildonly-randconfig-003-20250713 (https://download.01.org/0day-ci/archive/20250713/[email protected]/config) compiler: gcc-12 (Debian 12.2.0-14+deb12u1) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250713/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
Warning: drivers/gpu/drm/panthor/panthor_sched.c:317 Excess struct member 'runnable' description in 'panthor_scheduler'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:317 Excess struct member 'idle' description in 'panthor_scheduler'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:317 Excess struct member 'waiting' description in 'panthor_scheduler'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:317 Excess struct member 'has_ref' description in 'panthor_scheduler'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:317 Excess struct member 'in_progress' description in 'panthor_scheduler'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:317 Excess struct member 'stopped_groups' description in 'panthor_scheduler'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:489 Excess struct member 'mem' description in 'panthor_queue'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:489 Excess struct member 'input' description in 'panthor_queue'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:489 Excess struct member 'output' description in 'panthor_queue'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:489 Excess struct member 'input_fw_va' description in 'panthor_queue'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:489 Excess struct member 'output_fw_va' description in 'panthor_queue'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:489 Excess struct member 'gpu_va' description in 'panthor_queue'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:489 Excess struct member 'ref' description in 'panthor_queue'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:489 Excess struct member 'gt' description in 'panthor_queue'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:489 Excess struct member 'sync64' description in 'panthor_queue'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:489 Excess struct member 'bo' description in 'panthor_queue'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:489 Excess struct member 'offset' description in 'panthor_queue'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:489 Excess struct member 'kmap' description in 'panthor_queue'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:489 Excess struct member 'lock' description in 'panthor_queue'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:489 Excess struct member 'id' description in 'panthor_queue'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:489 Excess struct member 'seqno' description in 'panthor_queue'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:489 Excess struct member 'last_fence' description in 'panthor_queue'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:489 Excess struct member 'in_flight_jobs' description in 'panthor_queue'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:489 Excess struct member 'slots' description in 'panthor_queue'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:489 Excess struct member 'slot_count' description in 'panthor_queue'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:489 Excess struct member 'seqno' description in 'panthor_queue'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:707 Excess struct member 'data' description in 'panthor_group'
>> Warning: drivers/gpu/drm/panthor/panthor_sched.c:707 Excess struct member 'pid' description in 'panthor_group' >> Warning: drivers/gpu/drm/panthor/panthor_sched.c:707 Excess struct member 'comm' description in 'panthor_group'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:843 Excess struct member 'start' description in 'panthor_job'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:843 Excess struct member 'size' description in 'panthor_job'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:843 Excess struct member 'latest_flush' description in 'panthor_job'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:843 Excess struct member 'start' description in 'panthor_job'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:843 Excess struct member 'end' description in 'panthor_job'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:843 Excess struct member 'mask' description in 'panthor_job'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:843 Excess struct member 'slot' description in 'panthor_job'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:1770 function parameter 'ptdev' not described in 'panthor_sched_report_fw_events'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:1770 function parameter 'events' not described in 'panthor_sched_report_fw_events'
Warning: drivers/gpu/drm/panthor/panthor_sched.c:2663 function parameter 'ptdev' not described in 'panthor_sched_report_mmu_fault'
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Re: [PATCH v2 2/3] panthor: save task pid and comm in panthor_group
In reply to Chia-I WuQuoted 7 lines · Chia-I Wu
We would like to report them on gpu errors.
We choose to save the info on
panthor_group_createrather than onpanthor_openbecause, when the two differ, we are more interested in the task that created the group.Signed-off-by Chia-I Wu <[email protected]>
One nit below, but with that fixed:
Quoted 13 lines
---
v2: save topanthor_grouponpanthor_group_createrather than to
panthor_fileonpanthor_open--- drivers/gpu/drm/panthor/panthor_sched.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)drivers/gpu/drm/panthor/panthor_sched.c +0
-0
drivers/gpu/drm/panthor/panthor_sched.c struct panthor_group { · line 650
Quoted 10 lines
drivers/gpu/drm/panthor/panthor_sched.c +7
-0@@ -641,6 +641,15 @@ struct panthor_group {size_t kbo_sizes; } fdinfo; +/** @task_info: Info of current->group_leader that created the group. */ +struct { +/** @pid: pid of current->group_leader */ +pid_t pid; + +/** @comm: comm of current->group_leader */ +char comm[TASK_COMM_LEN ];
As the kernel test robot reports, this kerneldoc isn't quite right. We've got other issues in this file but you need to specify the struct name as well, i.e.:
/** @task_info.pid: pid of current->group_leader */ pid_t pid; /** @task_info.comm: comm of current->group_leader */ char comm[TASK_COMM_LEN];
It's been on my TODO list for a while to fix the rest of the file...
Thanks,
Steve
Quoted 29 lines
drivers/gpu/drm/panthor/panthor_sched.c +12
-0+ } task_info; +/** @state: Group state. */ enum panthor_group_state state;@@ -3389,6 +3398,14 @@ group_create_queue(struct panthor_group *group,return ERR_PTR (ret); } +static void group_init_task_info (struct panthor_group *group) +{ +struct task_struct *task = current->group_leader; + + group->task_info.pid = task->pid; +get_task_comm (group->task_info.comm, task); +} +static void add_group_kbo_sizes (struct panthor_device *ptdev,struct panthor_group *group) {@@ -3540,6 +3557,8 @@ int panthor_group_create(struct panthor_file *pfile,add_group_kbo_sizes (group->ptdev, group);spin_lock_init (&group->fdinfo.lock); +group_init_task_info (group); +return gid; err_put_group:
PATCH v2 3/3 panthor: dump task pid and comm on gpu errors
In reply to Chia-I WuIt is useful to know which tasks cause gpu errors.
--- drivers/gpu/drm/panthor/panthor_sched.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-)
drivers/gpu/drm/panthor/panthor_sched.c +19 -5
@@ -1364,8 +1364,12 @@ cs_slot_process_fatal_event_locked(struct panthor_device *ptdev, fatal = cs_iface->output->fatal; info = cs_iface->output->fatal_info; -if (group) +if (group) { +drm_warn (&ptdev->base,"CS_FATAL: pid=%d, comm=%s\n" , + group->task_info.pid, group->task_info.comm); + group->fatal_queues |=BIT (cs_id); + }if (CS_EXCEPTION_TYPE (fatal) ==DRM_PANTHOR_EXCEPTION_CS_UNRECOVERABLE ) {/* If this exception is unrecoverable, queue a reset, and make
@@ -1425,6 +1429,11 @@ cs_slot_process_fault_event_locked(struct panthor_device *ptdev,spin_unlock (&queue->fence_ctx.lock); } +if (group) { +drm_warn (&ptdev->base,"CS_FAULT: pid=%d, comm=%s\n" , + group->task_info.pid, group->task_info.comm); + } +drm_warn (&ptdev->base,"CSG slot %d CS slot: %d\n" "CS_FAULT.EXCEPTION_TYPE: 0x%x (%s)\n"
@@ -1641,11 +1650,15 @@ csg_slot_process_progress_timer_event_locked(struct panthor_device *ptdev, u32 clockdep_assert_held (&sched->lock); -drm_warn (&ptdev->base,"CSG slot %d progress timeout\n" , csg_id); - group = csg_slot->group; -if (!drm_WARN_ON (&ptdev->base, !group)) +if (!drm_WARN_ON (&ptdev->base, !group)) { +drm_warn (&ptdev->base,"CSG_PROGRESS_TIMER_EVENT: pid=%d, comm=%s\n" , + group->task_info.pid, group->task_info.comm); + group->timedout = true; + } + +drm_warn (&ptdev->base,"CSG slot %d progress timeout\n" , csg_id);sched_queue_delayed_work (sched, tick,0 ); }
@@ -3227,7 +3240,8 @@ queue_timedout_job(struct drm_sched_job *sched_job)struct panthor_scheduler *sched = ptdev->scheduler;struct panthor_queue *queue = group->queues[job->queue_idx]; -drm_warn (&ptdev->base,"job timeout\n" ); +drm_warn (&ptdev->base,"job timeout: pid=%d, comm=%s, seqno=%llu\n" , + group->task_info.pid, group->task_info.comm, job->done_fence->seqno);drm_WARN_ON (&ptdev->base,atomic_read (&sched->reset.in_progress));
Signature · 1 line
2.50.0.727.gbf7dc18ff4-goog
Re: [PATCH v2 3/3] panthor: dump task pid and comm on gpu errors
Quoted 3 lines · Chia-I Wu
It is useful to know which tasks cause gpu errors.
Signed-off-by Chia-I Wu <[email protected]>
Quoted 63 lines
--- drivers/gpu/drm/panthor/panthor_sched.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-)drivers/gpu/drm/panthor/panthor_sched.c +19
-5@@ -1364,8 +1364,12 @@ cs_slot_process_fatal_event_locked(struct panthor_device *ptdev, fatal = cs_iface->output->fatal; info = cs_iface->output->fatal_info; -if (group) +if (group) { +drm_warn (&ptdev->base,"CS_FATAL: pid=%d, comm=%s\n" , + group->task_info.pid, group->task_info.comm); + group->fatal_queues |=BIT (cs_id); + }if (CS_EXCEPTION_TYPE (fatal) ==DRM_PANTHOR_EXCEPTION_CS_UNRECOVERABLE ) {/* If this exception is unrecoverable, queue a reset, and make @@ -1425,6 +1429,11 @@ cs_slot_process_fault_event_locked(struct panthor_device *ptdev,spin_unlock (&queue->fence_ctx.lock); } +if (group) { +drm_warn (&ptdev->base,"CS_FAULT: pid=%d, comm=%s\n" , + group->task_info.pid, group->task_info.comm); + } +drm_warn (&ptdev->base,"CSG slot %d CS slot: %d\n" "CS_FAULT.EXCEPTION_TYPE: 0x%x (%s)\n"@@ -1641,11 +1650,15 @@ csg_slot_process_progress_timer_event_locked(struct panthor_device *ptdev, u32 clockdep_assert_held (&sched->lock); -drm_warn (&ptdev->base,"CSG slot %d progress timeout\n" , csg_id); - group = csg_slot->group; -if (!drm_WARN_ON (&ptdev->base, !group)) +if (!drm_WARN_ON (&ptdev->base, !group)) { +drm_warn (&ptdev->base,"CSG_PROGRESS_TIMER_EVENT: pid=%d, comm=%s\n" , + group->task_info.pid, group->task_info.comm); + group->timedout = true; + } + +drm_warn (&ptdev->base,"CSG slot %d progress timeout\n" , csg_id);sched_queue_delayed_work (sched, tick,0 ); }@@ -3227,7 +3240,8 @@ queue_timedout_job(struct drm_sched_job *sched_job)struct panthor_scheduler *sched = ptdev->scheduler;struct panthor_queue *queue = group->queues[job->queue_idx]; -drm_warn (&ptdev->base,"job timeout\n" ); +drm_warn (&ptdev->base,"job timeout: pid=%d, comm=%s, seqno=%llu\n" , + group->task_info.pid, group->task_info.comm, job->done_fence->seqno);drm_WARN_ON (&ptdev->base,atomic_read (&sched->reset.in_progress));