Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/xe: Do not dereference NULL job->fence in trace points
@ 2024-06-05  5:50 Matthew Brost
  2024-06-05  7:26 ` ✓ CI.Patch_applied: success for " Patchwork
                   ` (8 more replies)
  0 siblings, 9 replies; 13+ messages in thread
From: Matthew Brost @ 2024-06-05  5:50 UTC (permalink / raw)
  To: intel-xe; +Cc: Matthew Brost, Thomas Hellström

job->fence is not assigned until xe_sched_job_arm(), check for
job->fence in xe_sched_job_seqno() so any usage of this function (trace
points) do not result in NULL ptr dereference. Also check job->fence
before assigning error in job trace points.

Fixes: 0ac7a2c745e8 drm/xe: ("Don't initialize fences at xe_sched_job_create()")
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
---
 drivers/gpu/drm/xe/xe_sched_job.h | 2 +-
 drivers/gpu/drm/xe/xe_trace.h     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_sched_job.h b/drivers/gpu/drm/xe/xe_sched_job.h
index 002c3b5c0a5c..f362e28455db 100644
--- a/drivers/gpu/drm/xe/xe_sched_job.h
+++ b/drivers/gpu/drm/xe/xe_sched_job.h
@@ -70,7 +70,7 @@ to_xe_sched_job(struct drm_sched_job *drm)
 
 static inline u32 xe_sched_job_seqno(struct xe_sched_job *job)
 {
-	return job->fence->seqno;
+	return job->fence ? job->fence->seqno : 0;
 }
 
 static inline u32 xe_sched_job_lrc_seqno(struct xe_sched_job *job)
diff --git a/drivers/gpu/drm/xe/xe_trace.h b/drivers/gpu/drm/xe/xe_trace.h
index 450f407c66e8..e4cba64474e6 100644
--- a/drivers/gpu/drm/xe/xe_trace.h
+++ b/drivers/gpu/drm/xe/xe_trace.h
@@ -270,7 +270,7 @@ DECLARE_EVENT_CLASS(xe_sched_job,
 			   __entry->guc_state =
 			   atomic_read(&job->q->guc->state);
 			   __entry->flags = job->q->flags;
-			   __entry->error = job->fence->error;
+			   __entry->error = job->fence ? job->fence->error : 0;
 			   __entry->fence = job->fence;
 			   __entry->batch_addr = (u64)job->ptrs[0].batch_addr;
 			   ),
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-06-06 16:24 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-05  5:50 [PATCH] drm/xe: Do not dereference NULL job->fence in trace points Matthew Brost
2024-06-05  7:26 ` ✓ CI.Patch_applied: success for " Patchwork
2024-06-05  7:26 ` ✗ CI.checkpatch: warning " Patchwork
2024-06-05  7:27 ` ✓ CI.KUnit: success " Patchwork
2024-06-05  7:39 ` ✓ CI.Build: " Patchwork
2024-06-05  7:39 ` ✗ CI.Hooks: failure " Patchwork
2024-06-05  7:40 ` ✓ CI.checksparse: success " Patchwork
2024-06-05  8:12 ` ✓ CI.BAT: " Patchwork
2024-06-05 18:38 ` ✗ CI.FULL: failure " Patchwork
2024-06-05 23:13 ` [PATCH] " Lucas De Marchi
2024-06-06  2:55   ` Matthew Brost
2024-06-06  5:21     ` Lucas De Marchi
2024-06-06 16:23       ` Matthew Brost

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox