From: Marco Pagani <marco.pagani@linux.dev>
To: Tvrtko Ursulin <tursulin@ursulin.net>, phasta@kernel.org
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
"Matthew Brost" <matthew.brost@intel.com>,
"Danilo Krummrich" <dakr@kernel.org>,
"Christian König" <ckoenig.leichtzumerken@gmail.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>
Subject: Re: [PATCH] drm/sched: Add new KUnit test suite for concurrent job submission
Date: Tue, 17 Mar 2026 18:27:26 +0100 [thread overview]
Message-ID: <8075c105-c7a1-4223-bf67-aa7f0c1b6f76@linux.dev> (raw)
In-Reply-To: <62024790-d792-4789-9452-f5b294969a9a@ursulin.net>
On 25/02/2026 10:03, Tvrtko Ursulin wrote:
>
> On 25/02/2026 07:47, Philipp Stanner wrote:
>> On Mon, 2026-02-23 at 16:25 +0000, Tvrtko Ursulin wrote:
>>>
>>> On 19/02/2026 14:07, Marco Pagani wrote:
>>>> Add a new test suite to simulate concurrent job submissions to the DRM
>>>> scheduler. The suite includes two initial test cases: (i) a primary test
>>>> case for parallel job submission and (ii) a secondary test case for
>>>> interleaved job submission and completion. In the first test case, worker
>>>> threads concurrently submit jobs to the scheduler and then the timeline is
>>>> manually advanced. In the second test case, worker threads periodically
>>>> submit a sequence of jobs to the mock scheduler. Periods are chosen as
>>>> harmonic, starting from a base period, to allow interleaving between
>>>> submission and completion. To avoid impractically large execution times,
>>>> periods are cycled. The timeline is advanced automatically when the jobs
>>>> completes. This models how job submission from userspace (in process
>>>> context) may interleave with job completion (hrtimer callback interrupt
>>>> context, in the test case) by a physical device.
>>
>> I still maintain the opinion expressed the last time: that the commit
>> message should make explicit why the patch / test is added. Which this
>> doesn't do. It just says: "We add X", but not "Currently, the problem
>> is that YZ, thus we need X".
>> (also breaking longer commit messages into paragraphs is nice)
>>
>> Also see my comments about interleaved submits below.
>
> I'll address the ones addressed to me.
>
> 8><
>
>>>> +struct drm_sched_parallel_params {
>>>> + const char *description;
>>>> + unsigned int num_jobs;
>>>> + unsigned int num_workers;
>>>> +};
>>>> +
>>>> +static const struct drm_sched_parallel_params drm_sched_parallel_cases[] = {
>>>> + {
>>>> + .description = "Workers submitting multiple jobs against a single entity",
>>>
>>> Each worker has own entity so the description is a bit confusing.
>>
>> Do you have a suggestion for a better one?
>
> Along the lines of:
>
> "Multiple workers submitting multiple jobs from their entity"
>
> 8><
>
>>>> + }
>>>> +
>>>> + for (i = 0; i < params->num_workers; i++) {
>>>> + INIT_WORK(&workers[i].work, drm_sched_parallel_worker);
>>>> + queue_work(ctx->sub_wq, &workers[i].work);
>>>> + }
>>>> +
>>>> + complete_all(&ctx->wait_go);
>>>> + flush_workqueue(ctx->sub_wq);
>>>> +
>>>> + for (i = 0; i < params->num_workers; i++) {
>>>> + for (j = 0; j < params->num_jobs; j++) {
>>>> + done = drm_mock_sched_job_wait_scheduled(workers[i].jobs[j],
>>>> + HZ);
>>
>> same
>>
>>>> + KUNIT_ASSERT_TRUE(test, done);
>>>> +
>>>> + done = drm_mock_sched_job_is_finished(workers[i].jobs[j]);
>>>> + KUNIT_ASSERT_FALSE(test, done);
>>>
>>> This second assert does not seem to be bringing much value, but instead
>>> makes the reader ask themselves why it is there. Remove it?
>>>
>>> Hmm in fact this whole loop could be removed. All that it is needed
>>> below is to wait for the last job to be completed.
>>
>> I suppose it's being tested whether all jobs are finished. That sounds
>> clean and not harmful to me.
>
> No, it is assert false. It is testing the jobs have been scheduled but
> not completed before the timeline is manually advanced. Both those
> behaviours are already covered by the existing basic test cases.
>
> In my view the general best practice is to focus on the thing being
> tested, which in this case is the submission side of things. The rest
> can just distract the reader. And in this case that is parallel
> submission, which is all done and dusted by the time flush_workqueue
> above finishes. Everything after that point is just test cleanup.
I see what you mean. By that point, concurrent submission is complete, so it
may be considered outside the scope of this test. However, my intent was to
check that the basic behaviour of the scheduler also holds after the concurrent
submissions of multiple jobs, which is not covered by the basic test case.
That said, I'm open to removing those asserts if you and Philipp believe
they are redundant.
Thanks,
Marco
next prev parent reply other threads:[~2026-03-17 17:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260219140711.3296237-1-marco.pagani@linux.dev>
[not found] ` <e215efdd-c547-4ce4-affe-7198ed37c2a6@ursulin.net>
2026-03-17 17:04 ` [PATCH] drm/sched: Add new KUnit test suite for concurrent job submission Marco Pagani
2026-03-18 10:51 ` Tvrtko Ursulin
2026-03-18 17:23 ` Marco Pagani
2026-03-19 8:50 ` Tvrtko Ursulin
2026-03-20 11:25 ` Marco Pagani
[not found] ` <f5c76fe9d70f106f58b9f06f644534c2cead96fd.camel@mailbox.org>
[not found] ` <62024790-d792-4789-9452-f5b294969a9a@ursulin.net>
2026-03-17 17:27 ` Marco Pagani [this message]
2026-03-18 10:44 ` Tvrtko Ursulin
2026-03-18 18:15 ` Marco Pagani
2026-03-18 12:43 ` Marco Pagani
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=8075c105-c7a1-4223-bf67-aa7f0c1b6f76@linux.dev \
--to=marco.pagani@linux.dev \
--cc=airlied@gmail.com \
--cc=ckoenig.leichtzumerken@gmail.com \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=matthew.brost@intel.com \
--cc=mripard@kernel.org \
--cc=phasta@kernel.org \
--cc=simona@ffwll.ch \
--cc=tursulin@ursulin.net \
--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