Re: [PATCH v4 11/32] drm/xe/log: Index all SIGID printk messages
Michal Wajdeczko <[email protected]>
| Newsgroups | org.freedesktop.lists.intel-xe |
|---|---|
| Message-ID | <[email protected]> |
On 8/13/2026 2:31 PM, Mallesh, Koujalagi wrote: > > On 13-08-2026 12:44 am, Michal Wajdeczko wrote: >> When CONFIG_PRINTK_INDEX is enabled, it is expected that all device >> level printk messages are indexed for audit. While usually this is >> done automatically behind the scenes when code is using regular >> dev_printk macros, since we are generating different dmesg messages >> inside xe_log_emit() based on the severity, component and location, >> we only get those entries in /sys/kernel/debug/printk/index/xe: >> >> <3> drivers/gpu/drm/xe/xe_log.c:142 log_dmesg_vprintk "%s %s: [drm] *ERROR* %pV" >> <6> drivers/gpu/drm/xe/xe_log.c:140 log_dmesg_vprintk "%s %s: [drm] %pV" >> >> Explicitly generate printk index using dev_printk_index_emit() with >> some generic prefix that includes the SIGID tag. >> >> Suggested-by: Jani Nikula <[email protected]> >> Signed-off-by: Michal Wajdeczko <[email protected]> >> Cc: Jani Nikula <[email protected]> >> Cc: Rodrigo Vivi <[email protected]> >> --- >> drivers/gpu/drm/xe/xe_log.c | 8 ++++---- >> drivers/gpu/drm/xe/xe_log.h | 14 +++++++++++--- >> 2 files changed, 15 insertions(+), 7 deletions(-) >> >> diff --git a/drivers/gpu/drm/xe/xe_log.c b/drivers/gpu/drm/xe/xe_log.c >> index 0b423ed121cd..50a9b35e5b3e 100644 >> --- a/drivers/gpu/drm/xe/xe_log.c >> +++ b/drivers/gpu/drm/xe/xe_log.c >> @@ -177,7 +177,7 @@ static void log_emit_dmesg(struct pci_dev *pdev, int cper_sev, enum xe_sigid sig >> } >> /** >> - * xe_log_emit() - Emit a structured SIGID log entry >> + * __xe_log_emit() - Emit a structured SIGID log entry >> * @pdev: the &pci_dev device >> * @cper_sev: CPER severity (CPER_SEV_FATAL, CPER_SEV_RECOVERABLE, ...) >> * @sigid: signature identifier, see &enum xe_sigid >> @@ -206,9 +206,9 @@ static void log_emit_dmesg(struct pci_dev *pdev, int cper_sev, enum xe_sigid sig >> * <3> xe 0000:03:00.0: [drm] *ERROR* SIGID=106 (-ETIMEDOUT) Engine 'rcs0' hung >> * <6> xe 0000:03:00.0: [drm] SIGID=103 In survivability mode >> */ >> -void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid, >> - u32 component, u32 location, const void *data, size_t len, >> - const char *fmt, ...) >> +void __xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid, >> + u32 component, u32 location, const void *data, size_t len, >> + const char *fmt, ...) >> { >> struct va_format vaf; >> va_list args; >> diff --git a/drivers/gpu/drm/xe/xe_log.h b/drivers/gpu/drm/xe/xe_log.h >> index 0928b0866617..53fe2bb7ddd3 100644 >> --- a/drivers/gpu/drm/xe/xe_log.h >> +++ b/drivers/gpu/drm/xe/xe_log.h >> @@ -16,9 +16,17 @@ >> struct pci_dev; >> __printf(8, 9) >> -void xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid, >> - u32 component, u32 location, const void *data, size_t len, >> - const char *fmt, ...); >> +void __xe_log_emit(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid, >> + u32 component, u32 location, const void *data, size_t len, >> + const char *fmt, ...); >> + >> +#define __xe_log_emit_printk_index(fmt) \ >> + dev_printk_index_emit(NULL, "[drm]%s SIGID=%u %s(%s)%s%s%s: " fmt); > We need to change format for a. error path b. blob path c. plain or info path right? well, that's not doable as final format/output depends on the severity and data value, which could be non-const at compile time, while printk-index requires this to emit right entry I can change that to a something more generic (and unfriendly), like: dev_printk_index_emit(NULL, "%sSIGID=%u %s" fmt); but that will catch and match all our outputs. @Jani, are you OK with that? >> + >> +#define xe_log_emit(pdev, sev, sig, comp, loc, data, len, fmt, args...) ({ \ >> + __xe_log_emit_printk_index(fmt); \ >> + __xe_log_emit((pdev), (sev), (sig), (comp), (loc), (data), (len), fmt, ##args); \ >> +}) > > nit: use do{} while (0) > > Reviewed-by: Mallesh Koujalagi <[email protected]> > >> #define xe_log_emit_fatal(pdev, sig, comp, loc, data, len, fmt, args...) \ >> xe_log_emit((pdev), CPER_SEV_FATAL, (sig), (comp), (loc), \