Patch "drm/xe/devcoredump: Update handling of xe_force_wake_get return" has been added to the 6.12-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    drm/xe/devcoredump: Update handling of xe_force_wake_get return

to the 6.12-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     drm-xe-devcoredump-update-handling-of-xe_force_wake_.patch
and it can be found in the queue-6.12 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit baeaf1cd62d92588c9aa541a2fcba4ded872a0ef
Author: Himal Prasad Ghimiray <himal.prasad.ghimiray@xxxxxxxxx>
Date:   Mon Oct 14 13:25:46 2024 +0530

    drm/xe/devcoredump: Update handling of xe_force_wake_get return
    
    [ Upstream commit 9ffd6ec2de08ef4ac5f17f6131d1db57613493f9 ]
    
    xe_force_wake_get() now returns the reference count-incremented domain
    mask. If it fails for individual domains, the return value will always
    be 0. However, for XE_FORCEWAKE_ALL, it may return a non-zero value even
    in the event of failure. Use helper xe_force_wake_ref_has_domain to
    verify all domains are initialized or not. Update the return handling of
    xe_force_wake_get() to reflect this behavior, and ensure that the return
    value is passed as input to xe_force_wake_put().
    
    v3
    - return xe_wakeref_t instead of int in xe_force_wake_get()
    
    v5
    - return unsigned int for xe_force_wake_get()
    
    v6
    - use helper xe_force_wake_ref_has_domain()
    
    v7
    - Fix commit message
    
    Cc: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>
    Cc: Lucas De Marchi <lucas.demarchi@xxxxxxxxx>
    Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@xxxxxxxxx>
    Reviewed-by: Nirmoy Das <nirmoy.das@xxxxxxxxx>
    Reviewed-by: Badal Nilawar <badal.nilawar@xxxxxxxxx>
    Link: https://patchwork.freedesktop.org/patch/msgid/20241014075601.2324382-12-himal.prasad.ghimiray@xxxxxxxxx
    Signed-off-by: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>
    Stable-dep-of: 5dce85fecb87 ("drm/xe: Move the coredump registration to the worker thread")
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/xe/xe_devcoredump.c b/drivers/gpu/drm/xe/xe_devcoredump.c
index 0884c49942fe6..5221ee3f12149 100644
--- a/drivers/gpu/drm/xe/xe_devcoredump.c
+++ b/drivers/gpu/drm/xe/xe_devcoredump.c
@@ -147,13 +147,15 @@ static void xe_devcoredump_deferred_snap_work(struct work_struct *work)
 {
 	struct xe_devcoredump_snapshot *ss = container_of(work, typeof(*ss), work);
 	struct xe_devcoredump *coredump = container_of(ss, typeof(*coredump), snapshot);
+	unsigned int fw_ref;
 
 	/* keep going if fw fails as we still want to save the memory and SW data */
-	if (xe_force_wake_get(gt_to_fw(ss->gt), XE_FORCEWAKE_ALL))
+	fw_ref = xe_force_wake_get(gt_to_fw(ss->gt), XE_FORCEWAKE_ALL);
+	if (!xe_force_wake_ref_has_domain(fw_ref, XE_FORCEWAKE_ALL))
 		xe_gt_info(ss->gt, "failed to get forcewake for coredump capture\n");
 	xe_vm_snapshot_capture_delayed(ss->vm);
 	xe_guc_exec_queue_snapshot_capture_delayed(ss->ge);
-	xe_force_wake_put(gt_to_fw(ss->gt), XE_FORCEWAKE_ALL);
+	xe_force_wake_put(gt_to_fw(ss->gt), fw_ref);
 
 	/* Calculate devcoredump size */
 	ss->read.size = __xe_devcoredump_read(NULL, INT_MAX, coredump);
@@ -226,8 +228,9 @@ static void devcoredump_snapshot(struct xe_devcoredump *coredump,
 	u32 width_mask = (0x1 << q->width) - 1;
 	const char *process_name = "no process";
 
-	int i;
+	unsigned int fw_ref;
 	bool cookie;
+	int i;
 
 	ss->snapshot_time = ktime_get_real();
 	ss->boot_time = ktime_get_boottime();
@@ -250,8 +253,7 @@ static void devcoredump_snapshot(struct xe_devcoredump *coredump,
 	}
 
 	/* keep going if fw fails as we still want to save the memory and SW data */
-	if (xe_force_wake_get(gt_to_fw(q->gt), XE_FORCEWAKE_ALL))
-		xe_gt_info(ss->gt, "failed to get forcewake for coredump capture\n");
+	fw_ref = xe_force_wake_get(gt_to_fw(q->gt), XE_FORCEWAKE_ALL);
 
 	ss->ct = xe_guc_ct_snapshot_capture(&guc->ct, true);
 	ss->ge = xe_guc_exec_queue_snapshot_capture(q);
@@ -269,7 +271,7 @@ static void devcoredump_snapshot(struct xe_devcoredump *coredump,
 
 	queue_work(system_unbound_wq, &ss->work);
 
-	xe_force_wake_put(gt_to_fw(q->gt), XE_FORCEWAKE_ALL);
+	xe_force_wake_put(gt_to_fw(q->gt), fw_ref);
 	dma_fence_end_signalling(cookie);
 }
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux