dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Maíra Canal" <mcanal@igalia.com>
To: "Tvrtko Ursulin" <tvrtko.ursulin@igalia.com>,
	"Melissa Wen" <mwen@igalia.com>, "Iago Toral" <itoral@igalia.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Christian König" <ckoenig.leichtzumerken@gmail.com>
Cc: kernel-dev@igalia.com, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v3 08/14] drm/v3d: Introduce struct v3d_submit and convert CL/TFU/CSD ioctls
Date: Thu, 4 Jun 2026 08:52:29 -0300	[thread overview]
Message-ID: <7fecd592-38a1-46bb-8289-cb8599b2df4d@igalia.com> (raw)
In-Reply-To: <f015504f-ac09-4de3-9727-473108d6757f@igalia.com>

Hi Tvrtko,

On 04/06/26 05:58, Tvrtko Ursulin wrote:
> 
> On 03/06/2026 23:25, Maíra Canal wrote:
>> +static int
>> +v3d_submit_jobs(struct v3d_submit *submit)
>> +{
>> +    struct v3d_dev *v3d = submit->v3d;
>> +    int ret = 0;
>> +
>> +    mutex_lock(&v3d->sched_lock);
>> +
>> +    for (int i = 0; i < submit->job_count; i++) {
>> +        struct v3d_job *job = submit->jobs[i];
>> +
>> +        v3d_push_job(job);
>> +
>> +        if (i + 1 < submit->job_count) {
>> +            ret = drm_sched_job_add_dependency(&submit->jobs[i + 1]- 
>> >base,
>> +                               dma_fence_get(job->done_fence));
> 
> Is there a theoretical race where job->done_fence could be completed and 
> last reference dropped between push and here?

There is, but it'll be fixed in "[PATCH v3 14/14] drm/v3d: Ensure atomic
submissions in v3d_submit_jobs()".

> 
>> +            if (ret)
>> +                goto err;
>> +        }
>> +    }
>> +
>> +err:
>> +    mutex_unlock(&v3d->sched_lock);
>> +    return ret;
>> +}
>> +
>>   static int
>>   v3d_setup_csd_jobs_and_bos(struct drm_file *file_priv,
>>                  struct v3d_dev *v3d,
>> @@ -921,18 +1048,15 @@ int
>>   v3d_submit_cl_ioctl(struct drm_device *dev, void *data,
>>               struct drm_file *file_priv)
>>   {
>> -    struct v3d_dev *v3d = to_v3d_dev(dev);
>> -    struct v3d_file_priv *v3d_priv = file_priv->driver_priv;
>> +    struct v3d_submit submit = { .v3d = to_v3d_dev(dev), .file_priv = 
>> file_priv };
>>       struct drm_v3d_submit_cl *args = data;
>>       struct v3d_submit_ext se = {0};
>>       struct v3d_bin_job *bin = NULL;
>>       struct v3d_render_job *render = NULL;
>>       struct v3d_job *clean_job = NULL;
> 
> render and clean_job do not need to be initialised.

Ack.

>> +
>> +    ret = v3d_attach_perfmon_to_jobs(&submit, args->perfmon_id);
>> +    if (ret)
>> +        goto fail;
>> +
>> +    ret = v3d_lookup_bos(dev, file_priv,
>> +                 submit.jobs[submit.job_count - 1],
> 
> submit.jobs[submit.job_count - 1] is repeated four times in the function 
> so you could assign it to a last_job local for more readability. Up to you.

This will all disappear in the next few patches.

Considering this, would you consider R-b-ing this patch and I'll address
the initializations in the next version?

Best regards,
- Maíra


  reply	other threads:[~2026-06-04 11:52 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-03 22:25 [PATCH v3 00/14] drm/v3d: Scheduler and submission fixes and refactoring Maíra Canal
2026-06-03 22:25 ` [PATCH v3 01/14] drm/v3d: Drop unused drm_encoder.h include from v3d_drv.h Maíra Canal
2026-06-03 22:25 ` [PATCH v3 02/14] drm/v3d: Clear queue->active_job when v3d_fence_create() fails Maíra Canal
2026-06-04  2:50   ` sashiko-bot
2026-06-03 22:25 ` [PATCH v3 03/14] drm/v3d: Use inline lock for dma fence initialization Maíra Canal
2026-06-04  2:49   ` sashiko-bot
2026-06-03 22:25 ` [PATCH v3 04/14] drm/v3d: Replace spin_lock_irqsave() with spin_lock() Maíra Canal
2026-06-04  2:51   ` sashiko-bot
2026-06-03 22:25 ` [PATCH v3 05/14] drm/v3d: Extract v3d_job_add_syncobjs() helper Maíra Canal
2026-06-03 22:25 ` [PATCH v3 06/14] drm/v3d: Reject invalid syncobj handles in submit ioctls Maíra Canal
2026-06-04  2:51   ` sashiko-bot
2026-06-03 22:25 ` [PATCH v3 07/14] drm/v3d: Migrate BO reservation locking to DRM exec Maíra Canal
2026-06-03 22:25 ` [PATCH v3 08/14] drm/v3d: Introduce struct v3d_submit and convert CL/TFU/CSD ioctls Maíra Canal
2026-06-04  2:54   ` sashiko-bot
2026-06-04  8:58   ` Tvrtko Ursulin
2026-06-04 11:52     ` Maíra Canal [this message]
2026-06-04 12:05       ` Tvrtko Ursulin
2026-06-04 12:10         ` Maíra Canal
2026-06-03 22:25 ` [PATCH v3 09/14] drm/v3d: Make v3d_get_cpu_indirect_csd_params() a pure parser Maíra Canal
2026-06-04  2:53   ` sashiko-bot
2026-06-03 22:25 ` [PATCH v3 10/14] drm/v3d: Convert submit helpers to operate on struct v3d_submit Maíra Canal
2026-06-04  9:49   ` Tvrtko Ursulin
2026-06-03 22:25 ` [PATCH v3 11/14] drm/v3d: Refactor CPU ioctl into unified submission chain Maíra Canal
2026-06-04  2:58   ` sashiko-bot
2026-06-04  9:54   ` Tvrtko Ursulin
2026-06-03 22:25 ` [PATCH v3 12/14] drm/v3d: Split BO fence attach from syncobj output handling Maíra Canal
2026-06-04  9:59   ` Tvrtko Ursulin
2026-06-03 22:25 ` [PATCH v3 13/14] drm/v3d: Reject invalid out_sync handles in submit ioctls Maíra Canal
2026-06-04  2:59   ` sashiko-bot
2026-06-04 10:12   ` Tvrtko Ursulin
2026-06-03 22:25 ` [PATCH v3 14/14] drm/v3d: Ensure atomic submissions in v3d_submit_jobs() Maíra Canal
2026-06-04 10:25   ` Tvrtko Ursulin

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=7fecd592-38a1-46bb-8289-cb8599b2df4d@igalia.com \
    --to=mcanal@igalia.com \
    --cc=airlied@gmail.com \
    --cc=ckoenig.leichtzumerken@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=itoral@igalia.com \
    --cc=kernel-dev@igalia.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=mwen@igalia.com \
    --cc=simona@ffwll.ch \
    --cc=tvrtko.ursulin@igalia.com \
    --cc=tzimmermann@suse.de \
    /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