From: Nirmoy Das <nirmoy.das@linux.intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>,
Nirmoy Das <nirmoy.das@intel.com>,
intel-xe@lists.freedesktop.org
Subject: Re: [PATCH] drm/xe: Use missing lock in relay_needs_worker
Date: Mon, 3 Jun 2024 21:51:20 +0200 [thread overview]
Message-ID: <c79480d4-7576-4b88-b5e1-e73db34d3c1c@linux.intel.com> (raw)
In-Reply-To: <452de901-f35e-49df-8e5f-c4ce676ece0b@intel.com>
[-- Attachment #1: Type: text/plain, Size: 1527 bytes --]
Hi Michal,
On 6/3/2024 4:19 PM, Michal Wajdeczko wrote:
>
> On 03.06.2024 10:17, Nirmoy Das wrote:
>> Add missing lock that is protecting relay->incoming_actions.
> good catch!
>
>> Cc: Michal Wajdeczko<michal.wajdeczko@intel.com>
>> Signed-off-by: Nirmoy Das<nirmoy.das@intel.com>
>> ---
>> drivers/gpu/drm/xe/xe_guc_relay.c | 9 ++++++++-
>> 1 file changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_guc_relay.c b/drivers/gpu/drm/xe/xe_guc_relay.c
>> index c3bbaf474f9a..ade6162dc259 100644
>> --- a/drivers/gpu/drm/xe/xe_guc_relay.c
>> +++ b/drivers/gpu/drm/xe/xe_guc_relay.c
>> @@ -761,7 +761,14 @@ static void relay_process_incoming_action(struct xe_guc_relay *relay)
>>
>> static bool relay_needs_worker(struct xe_guc_relay *relay)
>> {
>> - return !list_empty(&relay->incoming_actions);
>> + bool is_empty;
>> +
>> + spin_lock(&relay->lock);
>> + is_empty = list_empty(&relay->incoming_actions);
>> + spin_unlock(&relay->lock);
>> +
>> + return !is_empty;
>> +
>> }
> alternate solution could be to just rely on the new return value from
> relay_process_incoming_action() that could tell us if there was nothing
> to dequeue so then we wont start new worker (at potential cost of one
> extra worker cycle to see that), but this LGTM too, so
>
> Reviewed-by: Michal Wajdeczko<michal.wajdeczko@intel.com>
I did spent some time modifying relay_process_incoming_action() to
return a bool but I am not sure which one is better.
I will for now pick this one :)
Thanks,
Nirmoy
[-- Attachment #2: Type: text/html, Size: 2677 bytes --]
prev parent reply other threads:[~2024-06-03 19:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-03 8:17 [PATCH] drm/xe: Use missing lock in relay_needs_worker Nirmoy Das
2024-06-03 9:02 ` ✓ CI.Patch_applied: success for " Patchwork
2024-06-03 9:02 ` ✓ CI.checkpatch: " Patchwork
2024-06-03 9:03 ` ✓ CI.KUnit: " Patchwork
2024-06-03 9:14 ` ✓ CI.Build: " Patchwork
2024-06-03 9:15 ` ✗ CI.Hooks: failure " Patchwork
2024-06-03 9:16 ` ✓ CI.checksparse: success " Patchwork
2024-06-03 9:56 ` ✓ CI.BAT: " Patchwork
2024-06-03 11:47 ` ✗ CI.FULL: failure " Patchwork
2024-06-05 8:58 ` Nirmoy Das
2024-06-03 14:19 ` [PATCH] " Michal Wajdeczko
2024-06-03 19:51 ` Nirmoy Das [this message]
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=c79480d4-7576-4b88-b5e1-e73db34d3c1c@linux.intel.com \
--to=nirmoy.das@linux.intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=michal.wajdeczko@intel.com \
--cc=nirmoy.das@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