drm/xe: Implement print vfunc for page fault info logging
Subsystems (2)
PATCH 1/1 drm/xe: Implement print vfunc for page fault info logging
Add a print vfunc to xe_pagefault_ops so different producer backends can log specific relevant debug info while keeping the consumer layer free of potential backend-specific formatting logic.
Consumer-specific prints are handled separately outside of the vfunc.
--- drivers/gpu/drm/xe/xe_guc_pagefault.c | 35 +++++++++++++++++++++++++ drivers/gpu/drm/xe/xe_pagefault.c | 33 +++-------------------- drivers/gpu/drm/xe/xe_pagefault_types.h | 8 ++++++ 3 files changed, 46 insertions(+), 30 deletions(-)
drivers/gpu/drm/xe/xe_guc_pagefault.c +35 -0
@@ -4,9 +4,11 @@*/ #include "abi/guc_actions_abi.h" +#include "xe_gt_printk.h" #include "xe_guc.h" #include "xe_guc_ct.h" #include "xe_guc_pagefault.h" +#include "xe_hw_engine.h" #include "xe_pagefault.h" #include "xe_pagefault_types.h"
@@ -68,10 +70,43 @@ static void guc_ack_fault_end(void *private)xe_guc_ct_unlock (&guc->ct); } +static void xe_guc_pagefault_print (struct xe_pagefault *pf) +{ +u8 engine_class =FIELD_GET (XE_PAGEFAULT_ENGINE_CLASS_MASK , + pf->consumer.engine_class_instance); +u64 addr =xe_pagefault_addr (pf); + +xe_gt_info (pf->gt,"\n\tASID: %lu\n" +"\tFaulted Address: 0x%08x%08x\n" +"\tFaultType: %lu\n" +"\tAccessType: %lu\n" +"\tFaultLevel: %lu\n" +"\tEngineClass: %d %s\n" +"\tEngineInstance: %lu\n" +"\tSRCID: 0x%02lx\n" , +FIELD_GET (XE_PAGEFAULT_ASID_MASK , + pf->consumer.id), +upper_32_bits (addr), +lower_32_bits (addr), +FIELD_GET (XE_PAGEFAULT_TYPE_MASK , + pf->consumer.fault_type_level), +FIELD_GET (XE_PAGEFAULT_ACCESS_TYPE_MASK , + pf->consumer.access_type), +FIELD_GET (XE_PAGEFAULT_LEVEL_MASK , + pf->consumer.fault_type_level), + engine_class, +xe_hw_engine_class_to_str (engine_class), +FIELD_GET (XE_PAGEFAULT_ENGINE_INSTANCE_MASK , + pf->consumer.engine_class_instance), +FIELD_GET (XE_PAGEFAULT_SRCID_MASK , + pf->consumer.id)); +} +static const struct xe_pagefault_ops guc_pagefault_ops = { .ack_fault_begin = guc_ack_fault_begin, .ack_fault = guc_ack_fault, .ack_fault_end = guc_ack_fault_end, + .print = xe_guc_pagefault_print, };/**
drivers/gpu/drm/xe/xe_pagefault.c +3 -30
@@ -13,7 +13,6 @@#include "xe_gt_printk.h" #include "xe_gt_types.h" #include "xe_gt_stats.h" -#include "xe_hw_engine.h" #include "xe_log.h" #include "xe_pagefault.h" #include "xe_pagefault_types.h"
@@ -607,35 +606,9 @@ static const char *xe_pagefault_error_to_str(enum xe_pagefault_error error)static void xe_pagefault_print (struct xe_pagefault *pf) { -u8 engine_class =FIELD_GET (XE_PAGEFAULT_ENGINE_CLASS_MASK , - pf->consumer.engine_class_instance); -u64 addr =xe_pagefault_addr (pf); - -xe_gt_info (pf->gt,"\n\tASID: %lu\n" -"\tFaulted Address: 0x%08x%08x\n" -"\tFaultType: %lu\n" -"\tAccessType: %lu\n" -"\tFaultLevel: %lu\n" -"\tEngineClass: %d %s\n" -"\tEngineInstance: %lu\n" -"\tSRCID: 0x%02lx\n" -"\tError: %s\n" , -FIELD_GET (XE_PAGEFAULT_ASID_MASK , - pf->consumer.id), -upper_32_bits (addr), -lower_32_bits (addr), -FIELD_GET (XE_PAGEFAULT_TYPE_MASK , - pf->consumer.fault_type_level), -FIELD_GET (XE_PAGEFAULT_ACCESS_TYPE_MASK , - pf->consumer.access_type), -FIELD_GET (XE_PAGEFAULT_LEVEL_MASK , - pf->consumer.fault_type_level), - engine_class, -xe_hw_engine_class_to_str (engine_class), -FIELD_GET (XE_PAGEFAULT_ENGINE_INSTANCE_MASK , - pf->consumer.engine_class_instance), -FIELD_GET (XE_PAGEFAULT_SRCID_MASK , - pf->consumer.id), +xe_gt_assert (pf->gt, pf->producer.ops->print); + pf->producer.ops->xe_gt_info (pf->gt,"\tError: %s\n" ,xe_pagefault_error_to_str (xe_pagefault_get_error (pf))); }
drivers/gpu/drm/xe/xe_pagefault_types.h +8 -0
@@ -139,6 +139,14 @@ struct xe_pagefault_ops {* Page fault producer ends acknowledgment from the consumer. */ void (*ack_fault_end)(void *private); +/** +* @print: Print pagefault info +* @pf: Page fault +* +* Print pagefault identification fields for the fault. +* Must be implemented by all producers. +*/ +void (*print)(struct xe_pagefault *pf); };/**
Signature · 1 line
2.43.0
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] xe: log interleaving and redundant prefixes due to split print calls --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] xe: log interleaving and redundant prefixes due to split print calls --
commit 114cd7fd731f9ee67d8c36081ae1b0f44d9be562
Author: Brian Nguyen <[email protected]>
drm/xe: Implement print vfunc for page fault info logging
This commit adds a print vfunc to xe_pagefault_ops to let producer backends log specific relevant debug info. This keeps the consumer layer free of backend-specific formatting logic, with consumer-specific prints handled separately.
Quoted 7 lines
drivers/gpu/drm/xe/xe_pagefault.c +0
-0@@ -607,35 +606,9 @@ static const char *xe_pagefault_error_to_str(enum xe_pagefault_error error)static void xe_pagefault_print (struct xe_pagefault *pf) {
[ ... ]
drivers/gpu/drm/xe/xe_pagefault.c static const char *xe_pagefault_error_to_str(enum xe_pagefault_error error) · line 613
Quoted 9 lines
drivers/gpu/drm/xe/xe_pagefault.c +3
-4-FIELD_GET (XE_PAGEFAULT_ENGINE_INSTANCE_MASK , - pf->consumer.engine_class_instance), -FIELD_GET (XE_PAGEFAULT_SRCID_MASK , - pf->consumer.id), +xe_gt_assert (pf->gt, pf->producer.ops->print); + pf->producer.ops->xe_gt_info (pf->gt,"\tError: %s\n" ,xe_pagefault_error_to_str (xe_pagefault_get_error (pf))); }
[Severity: Low]
Does this split print call cause log interleaving and redundant prefixes?
Because the error string is now logged with a separate call to xe_gt_info() in xe_pagefault_print(), it will be printed as an isolated log entry with its own prefix, rather than forming a continuous atomic block with the fault details from the producer print vfunc.
This disrupts the formatting of the page fault debug info, introducing redundant logging prefixes in the middle of what used to be a single continuous multiline log block. It also creates a risk of concurrent kernel messages interleaving with the output.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Matthew Brost
maintainerQuoted 42 lines · On Fri, Sep 25, 2026 at 11:38:52PM +0000, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] xe: log interleaving and redundant prefixes due to split print calls --commit
114cd7fd731f9ee67d8c36081ae1b0f44d9be562
Author: Brian Nguyen <[email protected]>drm/xe: Implement print vfunc for page fault info logging
This commit adds a print vfunc to
xe_pagefault_opsto let producer backends log specific relevant debug info. This keeps the consumer layer free of backend-specific formatting logic, with consumer-specific prints handled separately.Quoted 7 lines
drivers/gpu/drm/xe/xe_pagefault.c +0
-0@@ -607,35 +606,9 @@ static const char *xe_pagefault_error_to_str(enum xe_pagefault_error error)static void xe_pagefault_print (struct xe_pagefault *pf) {[ ... ]
drivers/gpu/drm/xe/xe_pagefault.c static const char *xe_pagefault_error_to_str(enum xe_pagefault_error error) · line 613
Quoted 9 lines
drivers/gpu/drm/xe/xe_pagefault.c +3
-4-FIELD_GET (XE_PAGEFAULT_ENGINE_INSTANCE_MASK , - pf->consumer.engine_class_instance), -FIELD_GET (XE_PAGEFAULT_SRCID_MASK , - pf->consumer.id), +xe_gt_assert (pf->gt, pf->producer.ops->print); + pf->producer.ops->xe_gt_info (pf->gt,"\tError: %s\n" ,xe_pagefault_error_to_str (xe_pagefault_get_error (pf))); }[Severity: Low]
Does this split print call cause log interleaving and redundant prefixes?Because the error string is now logged with a separate call to
xe_gt_info()inxe_pagefault_print(), it will be printed as an isolated log entry with its own prefix, rather than forming a continuous atomic block with the fault details from the producer print vfunc.
Quoted 5 lines
This disrupts the formatting of the page fault debug info, introducing redundant logging prefixes in the middle of what used to be a single continuous multiline log block. It also creates a risk of concurrent kernel messages interleaving with the output.
This is valid too. So either make print accept the output of xe_pagefault_error_to_str as an argument and print the entire thing in one shot.
Matt
Quoted 2 lines
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 49 lines · Matthew Brost
Quoted 42 lines · On Fri, Sep 25, 2026 at 11:38:52PM +0000, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] xe: log interleaving and redundant prefixes due to split print calls --commit
114cd7fd731f9ee67d8c36081ae1b0f44d9be562
Author: Brian Nguyen <[email protected]>drm/xe: Implement print vfunc for page fault info logging
This commit adds a print vfunc to
xe_pagefault_opsto let producer backends log specific relevant debug info. This keeps the consumer layer free of backend-specific formatting logic, with consumer-specific prints handled separately.Quoted 7 lines
drivers/gpu/drm/xe/xe_pagefault.c +0
-0@@ -607,35 +606,9 @@ static const char *xe_pagefault_error_to_str(enum xe_pagefault_error error)static void xe_pagefault_print (struct xe_pagefault *pf) {[ ... ]
drivers/gpu/drm/xe/xe_pagefault.c static const char *xe_pagefault_error_to_str(enum xe_pagefault_error error) · line 613
Quoted 9 lines
drivers/gpu/drm/xe/xe_pagefault.c +3
-4-FIELD_GET (XE_PAGEFAULT_ENGINE_INSTANCE_MASK , - pf->consumer.engine_class_instance), -FIELD_GET (XE_PAGEFAULT_SRCID_MASK , - pf->consumer.id), +xe_gt_assert (pf->gt, pf->producer.ops->print); + pf->producer.ops->xe_gt_info (pf->gt,"\tError: %s\n" ,xe_pagefault_error_to_str (xe_pagefault_get_error (pf))); }[Severity: Low]
Does this split print call cause log interleaving and redundant prefixes?Because the error string is now logged with a separate call to
xe_gt_info()inxe_pagefault_print(), it will be printed as an isolated log entry with its own prefix, rather than forming a continuous atomic block with the fault details from the producer print vfunc.Quoted 5 lines
This disrupts the formatting of the page fault debug info, introducing redundant logging prefixes in the middle of what used to be a single continuous multiline log block. It also creates a risk of concurrent kernel messages interleaving with the output.
Quoted 4 lines
This is valid too. So either make print accept the output of
xe_pagefault_error_to_stras an argument and print the entire thing in one shot.
Will do. I'll take a string as an additional input for the vfunc:
void (*print)(struct xe_pagefault *pf, const char *err_str);
Brian
Quoted 4 lines
Matt
Quoted 2 lines
--
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Matthew Brost
maintainerQuoted 31 lines · Brian Nguyen
Add a print vfunc to
xe_pagefault_opsso different producer backends can log specific relevant debug info while keeping the consumer layer free of potential backend-specific formatting logic.Consumer-specific prints are handled separately outside of the vfunc.
Suggested-by Stuart Summers <[email protected]>Signed-off-by Brian Nguyen <[email protected]>--- drivers/gpu/drm/xe/xe_guc_pagefault.c | 35 +++++++++++++++++++++++++ drivers/gpu/drm/xe/xe_pagefault.c | 33 +++-------------------- drivers/gpu/drm/xe/xe_pagefault_types.h | 8 ++++++ 3 files changed, 46 insertions(+), 30 deletions(-)drivers/gpu/drm/xe/xe_guc_pagefault.c +2
-0@@ -4,9 +4,11 @@*/ #include "abi/guc_actions_abi.h" +#include "xe_gt_printk.h" #include "xe_guc.h" #include "xe_guc_ct.h" #include "xe_guc_pagefault.h" +#include "xe_hw_engine.h" #include "xe_pagefault.h" #include "xe_pagefault_types.h"
drivers/gpu/drm/xe/xe_guc_pagefault.c static void guc_ack_fault_end(void *private) · line 78
Quoted 9 lines
drivers/gpu/drm/xe/xe_guc_pagefault.c +6
-0@@ -68,10 +70,43 @@ static void guc_ack_fault_end(void *private)xe_guc_ct_unlock (&guc->ct); } +static void xe_guc_pagefault_print (struct xe_pagefault *pf) +{ +u8 engine_class =FIELD_GET (XE_PAGEFAULT_ENGINE_CLASS_MASK , + pf->consumer.engine_class_instance); +u64 addr =xe_pagefault_addr (pf); +
In general if this vfunc is in the producer layer it should extract everything from producer part of the page fault otherwise the vfunc is a bit pointless. That said I do think a vfunc makes sense as it could have more information than the consumer.
Matt
Quoted 107 lines
drivers/gpu/drm/xe/xe_guc_pagefault.c +27
-0+xe_gt_info (pf->gt,"\n\tASID: %lu\n" +"\tFaulted Address: 0x%08x%08x\n" +"\tFaultType: %lu\n" +"\tAccessType: %lu\n" +"\tFaultLevel: %lu\n" +"\tEngineClass: %d %s\n" +"\tEngineInstance: %lu\n" +"\tSRCID: 0x%02lx\n" , +FIELD_GET (XE_PAGEFAULT_ASID_MASK , + pf->consumer.id), +upper_32_bits (addr), +lower_32_bits (addr), +FIELD_GET (XE_PAGEFAULT_TYPE_MASK , + pf->consumer.fault_type_level), +FIELD_GET (XE_PAGEFAULT_ACCESS_TYPE_MASK , + pf->consumer.access_type), +FIELD_GET (XE_PAGEFAULT_LEVEL_MASK , + pf->consumer.fault_type_level), + engine_class, +xe_hw_engine_class_to_str (engine_class), +FIELD_GET (XE_PAGEFAULT_ENGINE_INSTANCE_MASK , + pf->consumer.engine_class_instance), +FIELD_GET (XE_PAGEFAULT_SRCID_MASK , + pf->consumer.id)); +} +static const struct xe_pagefault_ops guc_pagefault_ops = { .ack_fault_begin = guc_ack_fault_begin, .ack_fault = guc_ack_fault, .ack_fault_end = guc_ack_fault_end, + .print = xe_guc_pagefault_print, };/** drivers/gpu/drm/xe/xe_pagefault.c +3
-30@@ -13,7 +13,6 @@#include "xe_gt_printk.h" #include "xe_gt_types.h" #include "xe_gt_stats.h" -#include "xe_hw_engine.h" #include "xe_log.h" #include "xe_pagefault.h" #include "xe_pagefault_types.h" @@ -607,35 +606,9 @@ static const char *xe_pagefault_error_to_str(enum xe_pagefault_error error)static void xe_pagefault_print (struct xe_pagefault *pf) { -u8 engine_class =FIELD_GET (XE_PAGEFAULT_ENGINE_CLASS_MASK , - pf->consumer.engine_class_instance); -u64 addr =xe_pagefault_addr (pf); - -xe_gt_info (pf->gt,"\n\tASID: %lu\n" -"\tFaulted Address: 0x%08x%08x\n" -"\tFaultType: %lu\n" -"\tAccessType: %lu\n" -"\tFaultLevel: %lu\n" -"\tEngineClass: %d %s\n" -"\tEngineInstance: %lu\n" -"\tSRCID: 0x%02lx\n" -"\tError: %s\n" , -FIELD_GET (XE_PAGEFAULT_ASID_MASK , - pf->consumer.id), -upper_32_bits (addr), -lower_32_bits (addr), -FIELD_GET (XE_PAGEFAULT_TYPE_MASK , - pf->consumer.fault_type_level), -FIELD_GET (XE_PAGEFAULT_ACCESS_TYPE_MASK , - pf->consumer.access_type), -FIELD_GET (XE_PAGEFAULT_LEVEL_MASK , - pf->consumer.fault_type_level), - engine_class, -xe_hw_engine_class_to_str (engine_class), -FIELD_GET (XE_PAGEFAULT_ENGINE_INSTANCE_MASK , - pf->consumer.engine_class_instance), -FIELD_GET (XE_PAGEFAULT_SRCID_MASK , - pf->consumer.id), +xe_gt_assert (pf->gt, pf->producer.ops->print); + pf->producer.ops->xe_gt_info (pf->gt,"\tError: %s\n" ,xe_pagefault_error_to_str (xe_pagefault_get_error (pf))); }drivers/gpu/drm/xe/xe_pagefault_types.h +8
-0@@ -139,6 +139,14 @@ struct xe_pagefault_ops {* Page fault producer ends acknowledgment from the consumer. */ void (*ack_fault_end)(void *private); +/** +* @print: Print pagefault info +* @pf: Page fault +* +* Print pagefault identification fields for the fault. +* Must be implemented by all producers. +*/ +void (*print)(struct xe_pagefault *pf); };/** Signature · 1 line
2.43.0