Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Dong, Zhanjun" <zhanjun.dong@intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>,
	<intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH v9 4/4] drm/xe/guc: Extract GuC capture lists to register snapshot
Date: Wed, 19 Jun 2024 16:04:56 -0400	[thread overview]
Message-ID: <1ae38ea5-f95b-48b2-b7f9-a98b1e8be3b7@intel.com> (raw)
In-Reply-To: <16fc6a09-dc8f-49ff-a0a3-6abf49a81c94@intel.com>

Please see my comments inline below.

Zhanjun

On 2024-06-14 8:31 a.m., Michal Wajdeczko wrote:
...
>> diff --git a/drivers/gpu/drm/xe/xe_guc.h b/drivers/gpu/drm/xe/xe_guc.h
>> index ddfa855458ab..e1afda9070f4 100644
>> --- a/drivers/gpu/drm/xe/xe_guc.h
>> +++ b/drivers/gpu/drm/xe/xe_guc.h
>> @@ -59,6 +59,29 @@ static inline u16 xe_engine_class_to_guc_class(enum xe_engine_class class)
>>   	}
>>   }
>>   
>> +static inline u16 xe_guc_class_to_capture_class(uint class)
>> +{
>> +	switch (class) {
>> +	case GUC_RENDER_CLASS:
>> +	case GUC_COMPUTE_CLASS:
>> +		return GUC_CAPTURE_LIST_CLASS_RENDER_COMPUTE;
>> +	case GUC_GSC_OTHER_CLASS:
>> +		return GUC_CAPTURE_LIST_CLASS_GSC_OTHER;
>> +	case GUC_VIDEO_CLASS:
>> +	case GUC_VIDEOENHANCE_CLASS:
>> +	case GUC_BLITTER_CLASS:
>> +		return class;
>> +	default:
>> +		XE_WARN_ON(class);
>> +		return -1;
> 
> it doesn't look like a safe value nor that you handle it correctly

The converted class ID will be used to find the match class in the list 
and NOT be used as index of array, so the -1 for search is safe.

> 
>> +	}
>> +}
>> +
>> +static inline u16 xe_engine_class_to_guc_capture_class(enum xe_engine_class class)
>> +{
>> +	return xe_guc_class_to_capture_class(xe_guc_class_to_capture_class(class));
> 
> are you sure this is correct ?
Oops, that's a bug. Thanks for point out.

...

>> +	/* Update the state of log buffer err-cap state */
>> +	xe_map_wr(guc_to_xe(guc), &guc->log.bo->vmap,
>> +		  log_buf_state_offset + offsetof(struct guc_log_buffer_state, read_ptr), u32,
>> +		  write_offset);
>> +	/* Clear the flush_to_file from local first, the local was loaded by above
>> +	 * xe_map_memcpy_from.
>> +	 */
>> +	log_buf_state_local.flush_to_file = 0;
>> +	/* Then write out the "updated local" through xe_map_wr() */
>> +	xe_map_wr(guc_to_xe(guc), &guc->log.bo->vmap,
>> +		  log_buf_state_offset + offsetof(struct guc_log_buffer_state, flags), u32,
>> +		  log_buf_state_local.flags);
>> +	__guc_capture_flushlog_complete(guc);
>> +}
>> +
> 
> public functions require kernel-doc
> 
>> +void xe_guc_capture_process(struct xe_guc *guc)
>> +{
>> +	if (guc->capture)
>> +		__guc_capture_process_output(guc);
>> +}
Will add

...

>>   	trace_xe_exec_queue_reset(q);
>>   
>>   	/*
>> @@ -1715,6 +1728,24 @@ int xe_guc_exec_queue_reset_handler(struct xe_guc *guc, u32 *msg, u32 len)
>>   	return 0;
>>   }
>>   
> 
> missing kerne-doc
Will add

> 
>> +int xe_guc_error_capture_handler(struct xe_guc *guc, u32 *msg, u32 len)
> 
> maybe this should be defined as xe_guc_capture_msg_handler() and placed
> in xe_guc_capture.c as it doesn't look that it needs anything from
> xe_guc_submit.c code
> 
>> +{
>> +	u32 status;
>> +
>> +	if (unlikely(len != 1)) {
> 
> magic "1"
Will changed to a macro define
> 
>> +		xe_gt_dbg(guc_to_gt(guc), "Invalid length %u", len);
>> +		return -EPROTO;
>> +	}
>> +
>> +	status = msg[0] & XE_GUC_STATE_CAPTURE_EVENT_STATUS_MASK;
>> +	if (status == XE_GUC_STATE_CAPTURE_EVENT_STATUS_NOSPACE)
>> +		xe_gt_warn(guc_to_gt(guc), "G2H-Error capture no space");
> 
> btw, is there anything to capture if GuC reported 'NOSPACE' ?

We have the gt_warn to warn it in dmesg, let user know what happens.
The next guc_capture_process will try to process whatever received.

...

  reply	other threads:[~2024-06-19 20:05 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-07  0:07 [PATCH v9 0/4] drm/xe/guc: Add GuC based register capture for error capture Zhanjun Dong
2024-06-07  0:07 ` [PATCH v9 1/4] drm/xe/guc: Prepare GuC register list and update ADS size " Zhanjun Dong
2024-06-14 11:50   ` Michal Wajdeczko
2024-06-19 19:36     ` Dong, Zhanjun
2024-06-07  0:07 ` [PATCH v9 2/4] drm/xe/guc: Add XE_LP steered register lists Zhanjun Dong
2024-06-13 19:02   ` Teres Alexis, Alan Previn
2024-06-07  0:07 ` [PATCH v9 3/4] drm/xe/guc: Add capture size check in GuC log buffer Zhanjun Dong
2024-06-14 12:13   ` Michal Wajdeczko
2024-06-19 19:44     ` Dong, Zhanjun
2024-06-19 22:28       ` Michal Wajdeczko
2024-06-19 22:56         ` Dong, Zhanjun
2024-06-07  0:07 ` [PATCH v9 4/4] drm/xe/guc: Extract GuC capture lists to register snapshot Zhanjun Dong
2024-06-13 23:26   ` Teres Alexis, Alan Previn
2024-06-19 20:17     ` Dong, Zhanjun
2024-06-14 12:31   ` Michal Wajdeczko
2024-06-19 20:04     ` Dong, Zhanjun [this message]
2024-06-07  0:12 ` ✓ CI.Patch_applied: success for drm/xe/guc: Add GuC based register capture for error capture (rev9) Patchwork
2024-06-07  0:12 ` ✗ CI.checkpatch: warning " Patchwork
2024-06-07  0:13 ` ✓ CI.KUnit: success " Patchwork
2024-06-07  0:25 ` ✓ CI.Build: " Patchwork
2024-06-07  0:27 ` ✗ CI.Hooks: failure " Patchwork
2024-06-07  0:28 ` ✓ CI.checksparse: success " Patchwork
2024-06-07  1:11 ` ✓ CI.BAT: " Patchwork
2024-06-07 10:57 ` ✗ CI.FULL: failure " 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=1ae38ea5-f95b-48b2-b7f9-a98b1e8be3b7@intel.com \
    --to=zhanjun.dong@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox