From: Nirmoy Das <nirmoy.das@linux.intel.com>
To: Matthew Brost <matthew.brost@intel.com>,
Nirmoy Das <nirmoy.das@intel.com>
Cc: intel-xe@lists.freedesktop.org, Matthew Auld <matthew.auld@intel.com>
Subject: Re: [PATCH v2] drm/xe/ufence: Kick ufence immediately when possible
Date: Fri, 18 Oct 2024 15:32:13 +0200 [thread overview]
Message-ID: <5a331e93-1d0f-4245-aa45-5f2eb08605b6@linux.intel.com> (raw)
In-Reply-To: <ZxGjg+DwLbDhiNOX@DUT025-TGLU.fm.intel.com>
On 10/18/2024 1:53 AM, Matthew Brost wrote:
> On Thu, Oct 17, 2024 at 11:42:37AM +0200, Nirmoy Das wrote:
>> If the backing fence is signaled then signal ufence soon with
>> system_wq. This should reduce load from the xe ordered_wq and also
>> won't block signaling a ufence which doesn't require any serialization.
>>
>> v2: fix system_wq typo
>>
>> Link: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/1630
>> Cc: Matthew Auld <matthew.auld@intel.com>
>> gc: Matthew Brost <matthew.brost@intel.com>
>> Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
>> ---
>> drivers/gpu/drm/xe/xe_sync.c | 12 ++++++++----
>> 1 file changed, 8 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_sync.c b/drivers/gpu/drm/xe/xe_sync.c
>> index c6cf227ead40..1a7907293088 100644
>> --- a/drivers/gpu/drm/xe/xe_sync.c
>> +++ b/drivers/gpu/drm/xe/xe_sync.c
>> @@ -89,10 +89,14 @@ static void user_fence_worker(struct work_struct *w)
>> user_fence_put(ufence);
>> }
>>
>> -static void kick_ufence(struct xe_user_fence *ufence, struct dma_fence *fence)
>> +static void kick_ufence(struct xe_user_fence *ufence, struct dma_fence *fence,
>> + bool signaled)
> Predantic but maybe replace 'bool signaled' which a flag. We really want
> to avoid bools if possible.
>
> e.g.
>
> #define UFENCE_FLAG_SIGNALED BIT(0)
>
> static void kick_ufence(struct xe_user_fence *ufence, struct dma_fence *fence,
> unsigned int flags)
> {
> ...
> if (flags & UFENCE_FLAG_SIGNALED)
> ...
> else
> ...
> ...
> }
>
>> {
>> INIT_WORK(&ufence->worker, user_fence_worker);
>> - queue_work(ufence->xe->ordered_wq, &ufence->worker);
>> + if (signaled)
>> + queue_work(system_wq, &ufence->worker);
> I don't think you need the work queue here, just call the work func directly.
Ok, then I think we don't need flag either. Send a v3, let me know how that looks :)
Thanks,
Nirmoy
>
> s/queue_work(system_wq, &ufence->worker)/user_fence_worker(&ufence->worker)
>
> Matt
>
>> + else
>> + queue_work(ufence->xe->ordered_wq, &ufence->worker);
>> dma_fence_put(fence);
>> }
>>
>> @@ -100,7 +104,7 @@ static void user_fence_cb(struct dma_fence *fence, struct dma_fence_cb *cb)
>> {
>> struct xe_user_fence *ufence = container_of(cb, struct xe_user_fence, cb);
>>
>> - kick_ufence(ufence, fence);
>> + kick_ufence(ufence, fence, false);
>> }
>>
>> int xe_sync_entry_parse(struct xe_device *xe, struct xe_file *xef,
>> @@ -236,7 +240,7 @@ void xe_sync_entry_signal(struct xe_sync_entry *sync, struct dma_fence *fence)
>> err = dma_fence_add_callback(fence, &sync->ufence->cb,
>> user_fence_cb);
>> if (err == -ENOENT) {
>> - kick_ufence(sync->ufence, fence);
>> + kick_ufence(sync->ufence, fence, true);
>> } else if (err) {
>> XE_WARN_ON("failed to add user fence");
>> user_fence_put(sync->ufence);
>> --
>> 2.46.0
>>
next prev parent reply other threads:[~2024-10-18 13:32 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-17 9:42 [PATCH v2] drm/xe/ufence: Kick ufence immediately when possible Nirmoy Das
2024-10-17 10:29 ` ✓ CI.Patch_applied: success for drm/xe/ufence: Kick ufence immediately when possible (rev2) Patchwork
2024-10-17 10:29 ` ✓ CI.checkpatch: " Patchwork
2024-10-17 10:30 ` ✓ CI.KUnit: " Patchwork
2024-10-17 10:42 ` ✓ CI.Build: " Patchwork
2024-10-17 10:44 ` ✓ CI.Hooks: " Patchwork
2024-10-17 10:45 ` ✓ CI.checksparse: " Patchwork
2024-10-17 11:09 ` ✓ CI.BAT: " Patchwork
2024-10-17 20:55 ` ✗ CI.FULL: failure " Patchwork
2024-10-17 23:53 ` [PATCH v2] drm/xe/ufence: Kick ufence immediately when possible Matthew Brost
2024-10-17 23:58 ` Matthew Brost
2024-10-18 13:32 ` Nirmoy Das [this message]
2024-10-21 12:32 ` Jani Nikula
2024-10-21 14:08 ` Nirmoy Das
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=5a331e93-1d0f-4245-aa45-5f2eb08605b6@linux.intel.com \
--to=nirmoy.das@linux.intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.auld@intel.com \
--cc=matthew.brost@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