Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Dong, Zhanjun" <zhanjun.dong@intel.com>
To: "Teres Alexis, Alan Previn" <alan.previn.teres.alexis@intel.com>,
	"intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH v18 5/6] drm/xe/guc: Plumb GuC-capture into dev coredump
Date: Wed, 11 Sep 2024 16:07:58 -0400	[thread overview]
Message-ID: <d48d695d-7cb6-4843-b163-d2ede3055048@intel.com> (raw)
In-Reply-To: <829abeada55176bdb07af5daab48de7ea1a9469d.camel@intel.com>

Please see my comments inline below:

Regards,
Zhanjun

On 2024-09-09 7:23 p.m., Teres Alexis, Alan Previn wrote:
> Thanks again for the diligence on those many recent the offline conversations + testing
> to make the code flow more readible and also tacking the all the race conditions related
> to the link list usage for both the kmd-manual and guc-captures.
> 
> I have 1 trivial issue that i believe needs to fixed and two nits.
> Thus, here is a conditional RB (need that fix or an explaination):
> 
> Reviewed-by: Alan Previn <alan.previn.teres.alexis@intel.com>
> (feel free to keep this on next rev if no additional changes were made).
> 
> 
Thanks Alan.

...
>> @@ -805,13 +834,14 @@ static void
>>   guc_capture_add_node_to_list(struct __guc_capture_parsed_output *node,
>>                               struct list_head *list)
>>   {
>> -       list_add_tail(&node->link, list);
>> +       list_add(&node->link, list);
>>   }
>>   
>>   static void
>>   guc_capture_add_node_to_outlist(struct xe_guc_state_capture *gc,
>>                                  struct __guc_capture_parsed_output *node)
>>   {
>> +       guc_capture_remove_stale_matches_from_list(gc, node);
>>          guc_capture_add_node_to_list(node, &gc->outlist);
>>   }
>>   
>> @@ -822,6 +852,31 @@ guc_capture_add_node_to_cachelist(struct xe_guc_state_capture *gc,
>>          guc_capture_add_node_to_list(node, &gc->cachelist);
>>   }
>>   
>> +static void
>> +guc_capture_free_outlist_node(struct xe_guc_state_capture *gc,
>> +                             struct __guc_capture_parsed_output *n)
>> +{
>> +       if (n) {
>> +               n->locked = 0;
> alan: This function is getting called from two places:
> 
> In case 1, this function is getting called by devcoredump to release
> the locked reference to a matching node that devcoredump requested
> previously when it called "xe_guc_capture_get_matching_and_lock".
> 
> In case 2, this function is called by guc_capture_add_node_to_outlist
> (after a fresh new node is extracted in response to G2H-Err-Capture-Notification)
> to remove any old node that happen to have the same guc-id and engine class. This
> is intentional because if its one form the past, it will never be used for a
> future devcoredump call to get a match.
> 
> 
> However, this function SHOULD check the lock so that:
> - if called from case 2, it should not free it since devcoredump is actually using it.
Yes, that is a bug, and will be fixed by add condition check of !locked 
in next rev.
> - if called from case 1, it should free it since this would happen at the time
> devcoredump is freed after user has retrieved it.
Right, it should be free in this case.

> 
>> +               list_del(&n->link);
>> +               /* put node back to cache list */
>> +               guc_capture_add_node_to_cachelist(gc, n);
>> +       }
>> +}
>> +
>> +static void
>> +guc_capture_remove_stale_matches_from_list(struct xe_guc_state_capture *gc,
>> +                                          struct __guc_capture_parsed_output *node)
>> +{
>> +       struct __guc_capture_parsed_output *n, *ntmp;
>> +       int guc_id = node->guc_id;
>> +
>> +       list_for_each_entry_safe(n, ntmp, &gc->outlist, link) {
>> +               if (n != node && n->guc_id == guc_id)
>> +                       guc_capture_free_outlist_node(gc, n);
>> +       }
>> +}
>> +
>>   static void
>>   guc_capture_init_node(struct xe_guc *guc, struct __guc_capture_parsed_output *node)
>>   {
...

  reply	other threads:[~2024-09-11 20:08 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-06 22:20 [PATCH v18 0/6] drm/xe/guc: Add GuC based register capture for error capture Zhanjun Dong
2024-09-06 22:20 ` [PATCH v18 1/6] drm/xe/guc: Prepare GuC register list and update ADS size " Zhanjun Dong
2024-09-09 18:23   ` Teres Alexis, Alan Previn
2024-09-06 22:20 ` [PATCH v18 2/6] drm/xe/guc: Add XE_LP steered register lists Zhanjun Dong
2024-09-09 18:27   ` Teres Alexis, Alan Previn
2024-09-06 22:20 ` [PATCH v18 3/6] drm/xe/guc: Add capture size check in GuC log buffer Zhanjun Dong
2024-09-06 22:20 ` [PATCH v18 4/6] drm/xe/guc: Extract GuC error capture lists Zhanjun Dong
2024-09-06 22:20 ` [PATCH v18 5/6] drm/xe/guc: Plumb GuC-capture into dev coredump Zhanjun Dong
2024-09-09 23:23   ` Teres Alexis, Alan Previn
2024-09-11 20:07     ` Dong, Zhanjun [this message]
2024-09-06 22:20 ` [PATCH v18 6/6] drm/xe/guc: Save manual engine capture into capture list Zhanjun Dong
2024-09-09 23:58   ` Teres Alexis, Alan Previn
2024-09-07  2:18 ` ✓ CI.Patch_applied: success for drm/xe/guc: Add GuC based register capture for error capture (rev18) Patchwork
2024-09-07  2:18 ` ✗ CI.checkpatch: warning " Patchwork
2024-09-07  2:19 ` ✓ CI.KUnit: success " Patchwork
2024-09-07  2:31 ` ✓ CI.Build: " Patchwork
2024-09-07  2:33 ` ✓ CI.Hooks: " Patchwork
2024-09-07  2:35 ` ✓ CI.checksparse: " Patchwork
2024-09-07  3:05 ` ✓ CI.BAT: " Patchwork
2024-09-09 16:37 ` ✗ 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=d48d695d-7cb6-4843-b163-d2ede3055048@intel.com \
    --to=zhanjun.dong@intel.com \
    --cc=alan.previn.teres.alexis@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    /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