Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Maciej Patelczyk <maciej.patelczyk@intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: <intel-xe@lists.freedesktop.org>, <niranjana.vishwanathapura@intel.com>
Subject: Re: [PATCH 2/2] drm/xe: make change ccs_mode a synchronous action
Date: Mon, 9 Dec 2024 20:31:50 +0100	[thread overview]
Message-ID: <a20828a2-68f4-4904-8ff5-1d453ec069c8@intel.com> (raw)
In-Reply-To: <e53cytk6v57vw3xcuhwwc7nncseg33q73tmyox46r6zwhwvaev@guigup4rn5x5>

On 9.12.2024 17:26, Lucas De Marchi wrote:
> On Mon, Dec 09, 2024 at 03:12:10PM +0100, Maciej Patelczyk wrote:
>> If ccs_mode is being modified via
>>   /sys/class/drm/cardX/device/tileY/gtY/ccs_mode
>> the asynchronous reset is triggered and the write returns immediately.
>>
>> With that some test receive false information about number of CCS 
>> engines
>> or even fail if they proceed without delay after changing the ccs_mode.
>>
>> Changing the ccs_mode change from async to sync to prevent failures in
>> tests.
>>
>> Signed-off-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
>> ---
>> drivers/gpu/drm/xe/xe_gt_ccs_mode.c | 6 +++++-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_gt_ccs_mode.c 
>> b/drivers/gpu/drm/xe/xe_gt_ccs_mode.c
>> index b6adfb9f2030..8d02ec3f7d12 100644
>> --- a/drivers/gpu/drm/xe/xe_gt_ccs_mode.c
>> +++ b/drivers/gpu/drm/xe/xe_gt_ccs_mode.c
>> @@ -115,7 +115,7 @@ ccs_mode_store(struct device *kdev, struct 
>> device_attribute *attr,
>>     struct xe_gt *gt = kobj_to_gt(&kdev->kobj);
>>     struct xe_device *xe = gt_to_xe(gt);
>>     u32 num_engines, num_slices;
>> -    int ret;
>> +    int mode_changed = 0, ret;
>>
>>     if (IS_SRIOV(xe)) {
>>         xe_gt_dbg(gt, "Can't change compute mode when running as %s\n",
>> @@ -151,10 +151,14 @@ ccs_mode_store(struct device *kdev, struct 
>> device_attribute *attr,
>>         gt->ccs_mode = num_engines;
>>         xe_gt_record_user_engines(gt);
>>         xe_gt_reset_async(gt);
>> +        mode_changed = 1;
>
> I think this can simply be the sync version. We don't want to allow new
> clients being created while this reset is taking place, which is what
> the mutex below is protecting against.
> Lucas De Marchi 
Hi!

Does it mean that the xe_gt_reset_wait() shall be in the critical section?

The wait can be unconditional as flush_work won't block if there is no work,

but I haven't tested that.

Maciej

>>     }
>>
>>     mutex_unlock(&xe->drm.filelist_mutex);
>>
>> +    if (mode_changed)
>> +        xe_gt_reset_wait(gt);
>> +
>>     return count;
>> }
>>
>> -- 
>> 2.43.0
>>

  reply	other threads:[~2024-12-09 19:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-09 14:12 [PATCH 0/2] drm/xe: adding wait helper for gt async reset Maciej Patelczyk
2024-12-09 14:12 ` [PATCH 1/2] drm/xe: introduce xe_gt_reset_wait to wait for async gt reset Maciej Patelczyk
2024-12-09 14:42   ` Raag Jadav
2024-12-09 14:54     ` Raag Jadav
2024-12-09 16:22       ` Lucas De Marchi
2024-12-09 19:39         ` Maciej Patelczyk
2024-12-09 20:05           ` Lucas De Marchi
2024-12-09 14:12 ` [PATCH 2/2] drm/xe: make change ccs_mode a synchronous action Maciej Patelczyk
2024-12-09 16:26   ` Lucas De Marchi
2024-12-09 19:31     ` Maciej Patelczyk [this message]
2024-12-09 14:50 ` ✓ CI.Patch_applied: success for drm/xe: adding wait helper for gt async reset Patchwork
2024-12-09 14:50 ` ✓ CI.checkpatch: " Patchwork
2024-12-09 14:51 ` ✗ CI.KUnit: 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=a20828a2-68f4-4904-8ff5-1d453ec069c8@intel.com \
    --to=maciej.patelczyk@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    --cc=niranjana.vishwanathapura@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