Skip to contentSkip to conversation

drm/amdgpu: cache the pasid in amdgpu_device_gpu_recover

PATCH In review Christian König 3 participants 6 messages Dec 10, 2025 – Dec 12, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: cache the pasid in amdgpu_device_gpu_recover

The job might already be freed up here. So cache the pasid for later use.

Fixes a72002cb181f ("drm/amdgpu: Make use of drm_wedge_task_info")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -2
index 654f4844b7ad..84bb89498e12 100644
@@ -6506,8 +6506,9 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
 	struct list_head device_list;
 	bool job_signaled = false;
 	struct amdgpu_hive_info *hive = NULL;
-	int r = 0;
 	bool need_emergency_restart = false;
+	unsigned int pasid = job->pasid;
+	int r = 0;
 
 	/*
 	 * If it reaches here because of hang/timeout and a RAS error is
@@ -6605,7 +6606,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
 		struct amdgpu_task_info *ti = NULL;
 
 		if (job)
-			ti = amdgpu_vm_get_task_info_pasid(adev, job->pasid);
+			ti = amdgpu_vm_get_task_info_pasid(adev, pasid);
 
 		drm_dev_wedged_event(adev_to_drm(adev), DRM_WEDGE_RECOVERY_NONE,
 				     ti ? &ti->task : NULL);
Signature · 1 line
2.43.0
#1 lore raw
Quoted 5 lines · Christian König

The job might already be freed up here. So cache the pasid for later use.

No! :D

You read the wrong quote.
Matthew found your issue (in the middle of my time zone's night, while I was peacefully asleep).

Quoted 1 line
Fixes a72002cb181f ("drm/amdgpu: Make use of drm_wedge_task_info")

I think there was a gitlab ticket about that a month ago? Could be added to Closes:

P.

Quoted 28 lines

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++--

 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -1
index 654f4844b7ad..84bb89498e12 100644
@@ -6506,8 +6506,9 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
  	struct list_head device_list;
  	bool job_signaled = false;
  	struct amdgpu_hive_info *hive = NULL;
-	int r = 0;
  	bool need_emergency_restart = false;
+	unsigned int pasid = job->pasid;
+	int r = 0;


  /*
  * If it reaches here because of hang/timeout and a RAS error is

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
@@ -6605,7 +6606,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
  		struct amdgpu_task_info *ti = NULL;


  if (job)

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
-			ti = amdgpu_vm_get_task_info_pasid(adev, job->pasid);
+			ti = amdgpu_vm_get_task_info_pasid(adev, pasid);


  drm_dev_wedged_event(adev_to_drm(adev), DRM_WEDGE_RECOVERY_NONE, ti ? &ti->task : NULL);

#2 lore raw
Quoted 26 lines · Philipp Stanner
Quoted 5 lines · Christian König

The job might already be freed up here. So cache the pasid for later use.

No! :D

You read the wrong quote.
Matthew found your issue (in the middle of my time zone's night, while I was peacefully asleep).

Quoted 1 line
Fixes a72002cb181f ("drm/amdgpu: Make use of drm_wedge_task_info")

I think there was a gitlab ticket about that a month ago? Could be added to Closes:

P.

Quoted 4 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Quoted 11 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_gpu_recover(struct amdgpu_device *adev, · line 6510

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
index 654f4844b7ad..84bb89498e12 100644
@@ -6506,8 +6506,9 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
      struct list_head device_list;
      bool job_signaled = false;
      struct amdgpu_hive_info *hive = NULL;
-     int r = 0;
      bool need_emergency_restart = false;
+     unsigned int pasid = job->pasid;

I think job can be NULL here.

Alex

Quoted 14 lines
Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -1
+     int r = 0;
 
      /*
       * If it reaches here because of hang/timeout and a RAS error is
@@ -6605,7 +6606,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
              struct amdgpu_task_info *ti = NULL;
 
              if (job)
-                     ti = amdgpu_vm_get_task_info_pasid(adev, job->pasid);
+                     ti = amdgpu_vm_get_task_info_pasid(adev, pasid);
 
              drm_dev_wedged_event(adev_to_drm(adev), DRM_WEDGE_RECOVERY_NONE,
                                   ti ? &ti->task : NULL);
#3 lore raw
In reply to Philipp Stanner
Quoted 4 lines · Philipp Stanner
Quoted 3 lines · Christian König

The job might already be freed up here. So cache the pasid for later use.

Quoted 8 lines
Quoted 2 lines

No! :D

You read the wrong quote.
Matthew found your issue (in the middle of my time zone's night, while I was peacefully asleep).

Oh, good point. Sorry the credits go to Matthew of course.

Quoted 5 lines
Quoted 2 lines
Fixes a72002cb181f ("drm/amdgpu: Make use of drm_wedge_task_info")

I think there was a gitlab ticket about that a month ago? Could be added to Closes:

Yeah, I remember that as well but I can't find it of hand.

Does anybody have the right link at hand?

Thanks,
Christian.

Quoted 33 lines

P.

Quoted 28 lines

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++--

 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -1
index 654f4844b7ad..84bb89498e12 100644
@@ -6506,8 +6506,9 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
  	struct list_head device_list;
  	bool job_signaled = false;
  	struct amdgpu_hive_info *hive = NULL;
-	int r = 0;
  	bool need_emergency_restart = false;
+	unsigned int pasid = job->pasid;
+	int r = 0;


  /*
  * If it reaches here because of hang/timeout and a RAS error is

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
@@ -6605,7 +6606,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
  		struct amdgpu_task_info *ti = NULL;


  if (job)

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
-			ti = amdgpu_vm_get_task_info_pasid(adev, job->pasid);
+			ti = amdgpu_vm_get_task_info_pasid(adev, pasid);


  drm_dev_wedged_event(adev_to_drm(adev), DRM_WEDGE_RECOVERY_NONE, ti ? &ti->task : NULL);

#4 lore raw
Quoted 18 lines · Christian König
Quoted 4 lines · Philipp Stanner
Quoted 3 lines · Christian König

The job might already be freed up here. So cache the pasid for later use.

Quoted 8 lines
Quoted 2 lines

No! :D

You read the wrong quote.
Matthew found your issue (in the middle of my time zone's night, while I was peacefully asleep).

Oh, good point. Sorry the credits go to Matthew of course.

Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Fixes a72002cb181f ("drm/amdgpu: Make use of drm_wedge_task_info")

I think there was a gitlab ticket about that a month ago? Could be added to Closes:

Yeah, I remember that as well but I can't find it of hand.

Does anybody have the right link at hand?

I looked for it yesterday, but couldn't find it.

Alex

Quoted 38 lines

Thanks,
Christian.

Quoted 33 lines

P.

Quoted 28 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -2
index 654f4844b7ad..84bb89498e12 100644
@@ -6506,8 +6506,9 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
     struct list_head device_list;
     bool job_signaled = false;
     struct amdgpu_hive_info *hive = NULL;
-    int r = 0;
     bool need_emergency_restart = false;
+    unsigned int pasid = job->pasid;
+    int r = 0;
 
     /*
      * If it reaches here because of hang/timeout and a RAS error is
@@ -6605,7 +6606,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
             struct amdgpu_task_info *ti = NULL;
 
             if (job)
-                    ti = amdgpu_vm_get_task_info_pasid(adev, job->pasid);
+                    ti = amdgpu_vm_get_task_info_pasid(adev, pasid);
 
             drm_dev_wedged_event(adev_to_drm(adev), DRM_WEDGE_RECOVERY_NONE,
                                  ti ? &ti->task : NULL);
#5 lore raw
Quoted 22 lines · Alex Deucher
Quoted 20 lines · Christian König
Quoted 4 lines · Philipp Stanner
Quoted 3 lines · Christian König

The job might already be freed up here. So cache the pasid for later use.

Quoted 8 lines
Quoted 2 lines

No! :D

You read the wrong quote.
Matthew found your issue (in the middle of my time zone's night, while I was peacefully asleep).

Oh, good point. Sorry the credits go to Matthew of course.

Quoted 3 lines
Quoted 2 lines
Fixes a72002cb181f ("drm/amdgpu: Make use of drm_wedge_task_info")
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

I think there was a gitlab ticket about that a month ago? Could be added to Closes:

Yeah, I remember that as well but I can't find it of hand.

Does anybody have the right link at hand?

I looked for it yesterday, but couldn't find it.

I think the original reporter was Hans-Kristian (+Cc).

The link I had seen floating around was

https://github.com/HansKristian-Work/vkd3d-proton/pull/2670

P.

Quoted 41 lines

Alex

Quoted 38 lines

Thanks,
Christian.

Quoted 33 lines

P.

Quoted 28 lines

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++--

 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -2
index 654f4844b7ad..84bb89498e12 100644
@@ -6506,8 +6506,9 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
      struct list_head device_list;
      bool job_signaled = false;
      struct amdgpu_hive_info *hive = NULL;
-    int r = 0;
      bool need_emergency_restart = false;
+    unsigned int pasid = job->pasid;
+    int r = 0;
 
      /*
       * If it reaches here because of hang/timeout and a RAS error is
@@ -6605,7 +6606,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
              struct amdgpu_task_info *ti = NULL;
 
              if (job)
-                    ti = amdgpu_vm_get_task_info_pasid(adev, job->pasid);
+                    ti = amdgpu_vm_get_task_info_pasid(adev, pasid);
 
              drm_dev_wedged_event(adev_to_drm(adev), DRM_WEDGE_RECOVERY_NONE,
                                   ti ? &ti->task : NULL);