diff options
| author | Michal Wajdeczko <michal.wajdeczko@intel.com> | 2026-09-04 19:05:30 +0200 |
|---|---|---|
| committer | Michal Wajdeczko <michal.wajdeczko@intel.com> | 2026-09-11 19:52:14 +0200 |
| commit | 7dbd24e9d5311b6afdbdd875dd247ab5ff54edca (patch) | |
| tree | a3804edc30fc406affef46c6e4bc875d0a43a67f | |
| parent | a158eba2fb0d82b7a11f316c6b4065d5861ba0dd (diff) | |
| download | linux-next-7dbd24e9d5311b6afdbdd875dd247ab5ff54edca.tar.gz linux-next-7dbd24e9d5311b6afdbdd875dd247ab5ff54edca.zip | |
drm/xe/log: Relax location ID recognition
It turned out that during early probe phase, VFs use detached from
the xe_device, temporary xe_gt objects, which when used as location
in xe_log() macros, will be treated by the dmesg decoration code as
bogus, possibly triggering a WARN, and the output will look like:
[drm] *ERROR* SIGID=104 (-ETIMEDOUT) LOC3.0? GUC: MMIO request ...
instead of expected:
[drm] *ERROR* SIGID=104 (-ETIMEDOUT) Tile0: GT0: GUC: MMIO request ...
Relax the tile/GT id validation and instead of looking for the real
objects, only check if encoded id is within the range of possible
tiles or GTs on the current xe device, using data from the device
descriptor rather then the object list.
Fixes: 1151b9f6f465 ("drm/xe/log: Add component/location decorations to dmesg")
Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patch.msgid.link/20260904170531.516-7-michal.wajdeczko@intel.com
| -rw-r--r-- | drivers/gpu/drm/xe/xe_log.c | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/drivers/gpu/drm/xe/xe_log.c b/drivers/gpu/drm/xe/xe_log.c index 5549ef6966fd..29eb16db3320 100644 --- a/drivers/gpu/drm/xe/xe_log.c +++ b/drivers/gpu/drm/xe/xe_log.c @@ -10,6 +10,7 @@ #include "xe_device.h" #include "xe_log.h" +#include "xe_pci_types.h" #include "xe_printk.h" static void log_emit_cper(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigid, @@ -52,18 +53,24 @@ static const char *log_component_prefix(u32 component) return component ? log_unknown_component_prefix(component) : ""; } -static struct xe_gt *get_gt_safe(struct pci_dev *pdev, u8 id) +static bool allowed_tile_id(struct xe_device *xe, u8 tile_id) { - struct xe_device *xe = pdev_to_xe_device(pdev); + return tile_id < 1 + xe->desc->max_remote_tiles; +} - return xe ? xe_device_get_gt(xe, id) : NULL; +static bool allowed_gt_id(struct xe_device *xe, u8 gt_id) +{ + return gt_id < (1 + xe->desc->max_remote_tiles) * xe->desc->max_gt_per_tile; } -static struct xe_tile *get_tile_safe(struct pci_dev *pdev, u8 id) +static u8 gt_id_to_tile_id(struct xe_device *xe, u8 gt_id) { - struct xe_device *xe = pdev_to_xe_device(pdev); + return gt_id / xe->desc->max_gt_per_tile; +} - return xe && id < xe->info.tile_count ? &xe->tiles[id] : NULL; +static const char *location_suffix(bool valid) +{ + return valid ? ":" : "?"; } static const char *log_location_prefix(struct pci_dev *pdev, u32 location, char *buf, size_t size) @@ -76,17 +83,22 @@ static const char *log_location_prefix(struct pci_dev *pdev, u32 location, char goto unrecognized; strscpy(buf, "", size); } else if (type == XE_LOG_LOCATION_TYPE_TILE) { - struct xe_tile *tile = get_tile_safe(pdev, id); + struct xe_device *xe = xe_any_to_xe(pdev); + bool valid = xe ? allowed_tile_id(xe, id) : false; + const char *pad = location_suffix(valid); - if (!tile) - goto unrecognized; - snprintf(buf, size, "Tile%u: ", id); + pci_WARN(pdev, !valid && IS_ENABLED(CONFIG_DRM_XE_DEBUG), + "LOG: invalid tile identifier: %u\n", id); + snprintf(buf, size, "Tile%u%s ", id, pad); } else if (type == XE_LOG_LOCATION_TYPE_GT) { - struct xe_gt *gt = get_gt_safe(pdev, id); - - if (!gt) - goto unrecognized; - snprintf(buf, size, "Tile%u: GT%u: ", gt->tile->id, id); + struct xe_device *xe = xe_any_to_xe(pdev); + bool valid = xe ? allowed_gt_id(xe, id) : false; + const char *pad = location_suffix(valid); + u8 tile_id = xe ? gt_id_to_tile_id(xe, id) : 0; + + pci_WARN(pdev, !valid && IS_ENABLED(CONFIG_DRM_XE_DEBUG), + "LOG: invalid GT identifier: %u\n", id); + snprintf(buf, size, "Tile%u%s GT%u%s ", tile_id, pad, id, pad); } else { goto unrecognized; } |
