Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Dong, Zhanjun" <zhanjun.dong@intel.com>
To: John Harrison <john.c.harrison@intel.com>,
	<intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH v2 2/2] drm/xe/guc: Only add GuC crash dump if available
Date: Tue, 8 Apr 2025 10:51:26 -0400	[thread overview]
Message-ID: <1f1c8b7b-b42f-41b7-9b4b-117d46f31eaa@intel.com> (raw)
In-Reply-To: <e95240b8-78f5-43d7-a114-cae1270ea9b5@intel.com>

Thanks for review, please see my comments inline below.

Regards,
Zhanjun Dong

On 2025-04-03 5:46 p.m., John Harrison wrote:
> On 3/27/2025 4:40 PM, Zhanjun Dong wrote:
>> Add flag of GuC crash dump received. LFD only include crash dump
>> section when crash dump is available.
>>
>> Signed-off-by: Zhanjun Dong <zhanjun.dong@intel.com>
>> ---
>>   drivers/gpu/drm/xe/xe_guc_ct.c        | 13 +++++++-----
>>   drivers/gpu/drm/xe/xe_guc_log.c       | 30 +++++++++++++++++++++++++++
>>   drivers/gpu/drm/xe/xe_guc_log_types.h |  2 ++
>>   3 files changed, 40 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_guc_ct.c b/drivers/gpu/drm/xe/ 
>> xe_guc_ct.c
>> index 72ad576fc18e..44c11ec662e5 100644
>> --- a/drivers/gpu/drm/xe/xe_guc_ct.c
>> +++ b/drivers/gpu/drm/xe/xe_guc_ct.c
>> @@ -1127,12 +1127,15 @@ static int guc_crash_process_msg(struct 
>> xe_guc_ct *ct, u32 action)
>>   {
>>       struct xe_gt *gt = ct_to_gt(ct);
>> -    if (action == XE_GUC_ACTION_NOTIFY_CRASH_DUMP_POSTED)
>> +    if (action == XE_GUC_ACTION_NOTIFY_CRASH_DUMP_POSTED) {
>>           xe_gt_err(gt, "GuC Crash dump notification\n");
>> -    else if (action == XE_GUC_ACTION_NOTIFY_EXCEPTION)
>> -        xe_gt_err(gt, "GuC Exception notification\n");
>> -    else
>> -        xe_gt_err(gt, "Unknown GuC crash notification: 0x%04X\n", 
>> action);
>> +        ct_to_guc(ct)->log.crash_dumped = true;
> This will also need to be cleared in the GuC reset path. There is no 
> guarantee that the log will be saved via the LFD system before a reset 
> wipes it out. And then a subsequent save will see a stale crash dump.
Good point, meanwhile, I wonder if this "crash_dumped" could be removed.
If there is no crash, then crash dump is always all zero, as I already 
has code to check this all zero, then this "crash_dumped" could be 
removed.>
>> +    } else {
>> +        if (action == XE_GUC_ACTION_NOTIFY_EXCEPTION)
> You can use "} else if( ..." to avoid the unnecessary extra level of 
> indentation.
Sure, will do

> 
>> +            xe_gt_err(gt, "GuC Exception notification\n");
>> +        else
>> +            xe_gt_err(gt, "Unknown GuC crash notification: 0x%04X\n", 
>> action);
>> +    }
>>       CT_DEAD(ct, NULL, CRASH);
>> diff --git a/drivers/gpu/drm/xe/xe_guc_log.c b/drivers/gpu/drm/xe/ 
>> xe_guc_log.c
>> index 5659d60e41ab..29684393a62d 100644
>> --- a/drivers/gpu/drm/xe/xe_guc_log.c
>> +++ b/drivers/gpu/drm/xe/xe_guc_log.c
>> @@ -536,6 +536,36 @@ static uint xe_guc_log_save_to_lfd_buf(char *buf, 
>> int size, u32 *guc_log_bin,
>>           return len;
>>       index += len;
>> +    /* For Crash dump, rd/wr ptr has no effect, only add if 
>> crash_dumped is true */
>> +    if (log->crash_dumped) {
>> +        struct guc_log_buffer_entry_list *entry;
>> +
>> +        entry = &entry_list[GUC_LOG_BUFFER_STATE_HEADER_ENTRY_CRASH];
>> +        if (entry->buf_size) {
>> +            int i;
>> +            u32 *buf32 = (u32 *)&bin[entry->offset];
>> +
>> +            /* Check if crash dump section are all zero */
>> +            for (i = 0; i < entry->buf_size / 4; i++)
>> +                if (buf32[i])
>> +                    break;
>> +
>> +            /* Buffer has non-zero data */
>> +            if (i < entry->buf_size / 4) {
>> +                len = xe_guc_log_add_typed_payload(&buf[index], size 
>> - index,
>> +                                   GUC_LFD_TYPE_FW_CRASH_DUMP,
>> +                                   entry->buf_size,
>> +                                   &bin[entry->offset]);
>> +                if (len < 0)
>> +                    return len;
>> +                index += len;
>> +
>> +                /* Clear flag */
>> +                log->crash_dumped = false;
>> +            }
>> +        }
>> +    }
>> +
>>       return index;
>>   }
>> diff --git a/drivers/gpu/drm/xe/xe_guc_log_types.h b/drivers/gpu/drm/ 
>> xe/xe_guc_log_types.h
>> index b3d5c72ac752..d351f639727b 100644
>> --- a/drivers/gpu/drm/xe/xe_guc_log_types.h
>> +++ b/drivers/gpu/drm/xe/xe_guc_log_types.h
>> @@ -46,6 +46,8 @@ struct xe_guc_log {
>>       u32 level;
>>       /** @bo: XE BO for GuC log */
>>       struct xe_bo *bo;
>> +    /** @crash_dumped: Indicate if crash dumped */
>> +    bool crash_dumped;
>>       /** @stats: logging related stats */
>>       struct {
>>           u32 sampled_overflow;
> 


  reply	other threads:[~2025-04-08 14:51 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-27 23:40 [PATCH v2 0/2] drm/xe/guc: Add LFD format output for guc log Zhanjun Dong
2025-03-27 23:40 ` [PATCH v2 1/2] " Zhanjun Dong
2025-03-28  3:39   ` Matthew Brost
2025-03-31 23:47     ` Dong, Zhanjun
2025-04-03 15:20     ` Dong, Zhanjun
2025-04-11 14:38       ` Michal Wajdeczko
2025-04-11 20:21         ` Dong, Zhanjun
2025-03-27 23:40 ` [PATCH v2 2/2] drm/xe/guc: Only add GuC crash dump if available Zhanjun Dong
2025-04-03 21:46   ` John Harrison
2025-04-08 14:51     ` Dong, Zhanjun [this message]
2025-03-27 23:45 ` ✓ CI.Patch_applied: success for drm/xe/guc: Add LFD format output for guc log (rev2) Patchwork
2025-03-27 23:45 ` ✗ CI.checkpatch: warning " Patchwork
2025-03-27 23:46 ` ✓ CI.KUnit: success " Patchwork
2025-03-28  0:03 ` ✓ CI.Build: " Patchwork
2025-03-28  0:05 ` ✓ CI.Hooks: " Patchwork
2025-03-28  0:07 ` ✓ CI.checksparse: " Patchwork
2025-03-28  0:28 ` ✓ Xe.CI.BAT: " Patchwork
2025-03-28 13:26 ` ✗ Xe.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=1f1c8b7b-b42f-41b7-9b4b-117d46f31eaa@intel.com \
    --to=zhanjun.dong@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=john.c.harrison@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