All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
	Aravind Iddamsetty <aravind.iddamsetty@intel.com>,
	Mallesh Koujalagi <mallesh.koujalagi@intel.com>
Subject: Re: [PATCH v2 04/22] drm/xe/log: Add component/location decorations to dmesg
Date: Tue, 28 Jul 2026 15:16:31 -0400	[thread overview]
Message-ID: <amkAD0VZVBTLWxLq@intel.com> (raw)
In-Reply-To: <20260728161039.579-5-michal.wajdeczko@intel.com>

On Tue, Jul 28, 2026 at 06:10:19PM +0200, Michal Wajdeczko wrote:
> While we can't directly use our xe_tile|gt_err|info helpers to get
> nice Tile/GT decorations, we can still add them manually based on
> the structured location parameter. Similarly, we can add component
> name prefix based on the component identifier.

Okay, perhaps I was wrong and these levels are indeed useful info there.

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> 
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> ---
> Cc: Aravind Iddamsetty <aravind.iddamsetty@intel.com>
> Cc: Mallesh Koujalagi <mallesh.koujalagi@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_log.c | 82 +++++++++++++++++++++++++++++++++----
>  1 file changed, 74 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_log.c b/drivers/gpu/drm/xe/xe_log.c
> index 70a41bdf1a01..a4f4f2d4e250 100644
> --- a/drivers/gpu/drm/xe/xe_log.c
> +++ b/drivers/gpu/drm/xe/xe_log.c
> @@ -3,6 +3,9 @@
>   * Copyright © 2026 Intel Corporation
>   */
>  
> +#include "abi/xe_log_abi.h"
> +
> +#include "xe_device.h"
>  #include "xe_log.h"
>  #include "xe_printk.h"
>  
> @@ -13,6 +16,65 @@ static void log_emit_cper(struct pci_dev *pdev, int cper_sev, enum xe_sigid sigi
>  	/* TODO */
>  }
>  
> +static const char *log_component_prefix(u32 component)
> +{
> +	switch (component) {
> +#define MAKE_XE_LOG_COMPONENT_CASE_PREFIX(_CLASS, _ID, _TAG, _SIG, _NAME) \
> +	case XE_LOG_COMPONENT_##_TAG: return #_TAG ": ";
> +	DEFINE_XE_LOG_COMPONENTS(MAKE_XE_LOG_COMPONENT_CASE_PREFIX)
> +#undef MAKE_XE_LOG_COMPONENT_CASE_PREFIX
> +	}
> +	return "";
> +}
> +
> +static struct xe_gt *get_gt_safe(struct pci_dev *pdev, u8 id)
> +{
> +	struct xe_device *xe = pdev_to_xe_device(pdev);
> +
> +	return xe ? xe_device_get_gt(xe, id) : NULL;
> +}
> +
> +static struct xe_tile *get_tile_safe(struct pci_dev *pdev, u8 id)
> +{
> +	struct xe_device *xe = pdev_to_xe_device(pdev);
> +
> +	return xe && id < XE_MAX_TILES_PER_DEVICE ? &xe->tiles[id] : NULL;
> +}
> +
> +static const char *log_location_prefix(struct pci_dev *pdev, u32 location, char *buf, size_t size)
> +{
> +	u32 type = FIELD_GET(XE_LOG_LOCATION_TYPE_MASK, location);
> +	u32 id = FIELD_GET(XE_LOG_LOCATION_ID_MASK, location);
> +
> +	if (!location || type == XE_LOG_LOCATION_TYPE_DEVICE) {
> +		if (id)
> +			goto unrecognized;
> +		strscpy(buf, "", size);
> +	} else if (type == XE_LOG_LOCATION_TYPE_TILE) {
> +		struct xe_tile *tile = get_tile_safe(pdev, id);
> +
> +		if (!tile)
> +			goto unrecognized;
> +		snprintf(buf, size, "Tile%u: ", id);
> +	} 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);
> +	} else {
> +		goto unrecognized;
> +	}
> +
> +	return buf;
> +
> +unrecognized:
> +	pci_WARN(pdev, IS_ENABLED(CONFIG_DRM_XE_DEBUG),
> +		 "LOG: malformed location %#x\n", location);
> +	snprintf(buf, size, "LOC%u? ID%u? ", type, id);
> +	return buf;
> +}
> +
>  static bool is_hw_sigid(enum xe_sigid sigid)
>  {
>  	return (int)sigid >= INTEL_SIGID_GPU_XE_HARDWARE_START;
> @@ -71,20 +133,24 @@ static void log_emit_dmesg(struct pci_dev *pdev, int cper_sev, enum xe_sigid sig
>  			   u32 component, u32 location, const void *data, size_t len,
>  			   struct va_format *vaf)
>  {
> +	char buf[32];
> +	const char *loc_prefix = log_location_prefix(pdev, location, buf, sizeof(buf));
> +	const char *comp_prefix = log_component_prefix(component);
>  	const char *hwe_prefix = log_hwe_prefix(cper_sev, sigid);
>  	const char *sev_prefix = log_sev_prefix(cper_sev);
>  
> -	/* TODO: add component/location details */
> -
>  	if (IS_ERR(data))
> -		log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s(%pe) %s%pV",
> -				 sigid, sev_prefix, data, hwe_prefix, vaf);
> +		log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s(%pe) %s%s%s%pV",
> +				 sigid, sev_prefix, data, hwe_prefix,
> +				 loc_prefix, comp_prefix, vaf);
>  	else if (data && len)
> -		log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s(%*phN) %s%pV",
> -				 sigid, sev_prefix, (int)len, data, hwe_prefix, vaf);
> +		log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s(%*phN) %s%s%s%pV",
> +				 sigid, sev_prefix, (int)len, data, hwe_prefix,
> +				 loc_prefix, comp_prefix, vaf);
>  	else
> -		log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s%s%pV",
> -				 sigid, sev_prefix, hwe_prefix, vaf);
> +		log_dmesg_printf(pdev, cper_sev, "SIGID=%u %s%s%s%s%pV",
> +				 sigid, sev_prefix, hwe_prefix,
> +				 loc_prefix, comp_prefix, vaf);
>  }
>  
>  /**
> -- 
> 2.47.1
> 

  reply	other threads:[~2026-07-28 19:16 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-28 16:10 [PATCH v2 00/22] drm/xe: Add structured SIGID error logging infrastructure Michal Wajdeczko
2026-07-28 16:10 ` [PATCH v2 01/22] drm/xe: Introduce xe_any helpers Michal Wajdeczko
2026-07-28 19:11   ` Rodrigo Vivi
2026-07-28 16:10 ` [PATCH v2 02/22] drm/xe/log: Add structured SIGID error logging infrastructure Michal Wajdeczko
2026-07-28 16:10 ` [PATCH v2 03/22] drm/xe/log: Introduce structured component/location identifiers Michal Wajdeczko
2026-07-28 19:13   ` Rodrigo Vivi
2026-07-28 16:10 ` [PATCH v2 04/22] drm/xe/log: Add component/location decorations to dmesg Michal Wajdeczko
2026-07-28 19:16   ` Rodrigo Vivi [this message]
2026-07-28 16:10 ` [PATCH v2 05/22] drm/xe/log: Add SIGID log helpers for severity Michal Wajdeczko
2026-07-28 16:10 ` [PATCH v2 06/22] drm/xe/log: Add SIGID log helpers for location Michal Wajdeczko
2026-07-28 16:10 ` [PATCH v2 07/22] drm/xe/log: Add SIGID log helpers for location & severity Michal Wajdeczko
2026-07-28 16:10 ` [PATCH v2 08/22] drm/xe/log: Add SIGID log helpers for components Michal Wajdeczko
2026-07-28 16:10 ` [PATCH v2 09/22] drm/xe/log: Add SIGID log helpers for errno-only Michal Wajdeczko
2026-07-28 16:10 ` [PATCH v2 10/22] drm/xe/log: Add hardware error signatures Michal Wajdeczko
2026-07-28 16:10 ` [PATCH v2 11/22] drm/xe/log: Extend components list with hardware items Michal Wajdeczko
2026-07-28 16:10 ` [PATCH v2 12/22] drm/xe/ras: Check RAS and LOG component definitions Michal Wajdeczko
2026-07-28 16:10 ` [PATCH v2 13/22] drm/xe/kunit: Setup driver data in the test device Michal Wajdeczko
2026-07-28 16:10 ` [PATCH v2 14/22] drm/xe/tests: Add Kunit tests for xe_log Michal Wajdeczko
2026-07-28 16:10 ` [PATCH v2 15/22] drm/xe: Report 'probe blocked' error using SIGID Michal Wajdeczko
2026-07-28 16:10 ` [PATCH v2 16/22] drm/xe: Report 'device wedged' errors " Michal Wajdeczko
2026-07-28 16:10 ` [PATCH v2 17/22] drm/xe: Report 'Survivability Mode' " Michal Wajdeczko
2026-07-28 16:10 ` [PATCH v2 18/22] drm/xe/guc: Report 'GuC mmio' " Michal Wajdeczko
2026-07-28 16:10 ` [PATCH v2 19/22] drm/xe/pcode: Report 'Mailbox failed' error " Michal Wajdeczko
2026-07-28 16:10 ` [PATCH v2 20/22] drm/xe/gt: Report 'reset failed' errors " Michal Wajdeczko
2026-07-28 16:10 ` [PATCH v2 21/22] drm/xe/gt: Report 'pagefault' " Michal Wajdeczko
2026-07-28 16:10 ` [PATCH v2 22/22] drm/xe/pci: Report 'cannot re-enable' error " Michal Wajdeczko
2026-07-28 16:17 ` ✗ CI.checkpatch: warning for drm/xe: Add structured SIGID error logging infrastructure (rev2) Patchwork
2026-07-28 16:18 ` ✓ CI.KUnit: success " Patchwork
2026-07-28 17:01 ` ✗ Xe.CI.BAT: failure " Patchwork
2026-07-28 20:57 ` ✗ Xe.CI.FULL: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=amkAD0VZVBTLWxLq@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=aravind.iddamsetty@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=mallesh.koujalagi@intel.com \
    --cc=michal.wajdeczko@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.