public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Marco Pagani <marco.pagani@linux.dev>
To: Tvrtko Ursulin <tursulin@ursulin.net>,
	Philipp Stanner <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: Fri, 20 Mar 2026 12:25:31 +0100	[thread overview]
Message-ID: <0dd4b5ac-a9c4-4aff-a67a-ae43de10857e@linux.dev> (raw)
In-Reply-To: <a9213f65-6747-417c-9b7b-7b2ed0a5c3d9@ursulin.net>



On 19/03/2026 09:50, Tvrtko Ursulin wrote:
> 
> 
> On 18/03/2026 17:23, Marco Pagani wrote:
> 
> 8><
> 
>>>>> Alternative approach could be to set a per test time budget and just
>>>>> keep the workers submitting until over. It would be simpler to
>>>>> understand and there would be more submit/complete overlap.
>>>>
>>>> I agree. Using a test time budget and having workers continuously
>>>> submit jobs until it expires would make better use of the test time.
>>>> I'm thinking that the simplest and most straightforward approach would
>>>> be to cyclically distribute periods among workers until they reach the
>>>> the largest possibile value below test duration, which would coincide
>>>> with the hyperperiod. This would also solve the issue of selecting a
>>>> suitable periods_cycle parameter that you mentioned earlier.
>>>> In practice, something like this:
>>>>
>>>> drm_sched_interleaved_params [...]
>>>> {
>>>>           .num_workers = N
>>>>           .test_max_time = T
>>>>           .job_base_period_us = P         /* Small GPU job, 100 us */
>>>> }
>>>>
>>>> period_us = job_base_period_us;
>>>> for (i = 0; i < params->num_workers; i++) {
>>>>           workers[i].period_us = period_us;
>>>>           period_us *= 2;
>>>>           if (period_us > test_max_time)
>>>>                   period_us = job_base_period_us;
>>>> }
>>>>
>>>>
>>>> What do you think?
>>>
>>>
>>> Again some time has passed so rather than going to re-read your patch I
>>> will go from memory. IIRC I was thinking something really dumb and 100%
>>> time bound with no need to think when coding and reviewing. Each thread
>>> simply does:
>>>
>>> ktime_t start = ktime_get();
>>>
>>> do {
>>>    .. thread doing its submission pattern thing ..
>>> } while (ktime_to_ms(ktime_sub(ktime_get(), start)) < test->time_ms);
>>>
>>> May miss the time target by a job period_us but who cares.
>>
>> Sorry for the delay. I got pulled into other things. I left out the worker
>> execution part since we already agreed on that. Instead, I've replied with
>> some pseudocode describing a new strategy for period assignments from test
>> parameters that takes into account your comments.
> 
> Sorry I misread when I saw test_max_time clamping I thought it was about 
> runtime control. I guess it makes sense to clamp it to avoid 
> over-shooting by too much. You removed the cyclical nature so I guess in 
> practice this will not happen? I mean number of workers vs base period 
> you don't expect more than one of them to get clamped?

I haven't removed the cyclical nature of workers submitting jobs. I
omitted that part because I thought we already agreed on it.

Anyway, I realized that unfortunately the strategy of using harmonic
periods to overlap submissions makes no sense given how the mock
scheduler serializes jobs into a single "execution" line. I'm now
thinking that using a narrower range of (multiple) submission periods
would be more effective to stress concurrent submissions.

I'm also thinking that splitting the single execution time budget into
equal shares among workers, and then computing the number of jobs that
fit into that share, is simpler and better suited for a test case
compared to a time-based approach. Let me share some pseudocode for
this new approach:

/* Parameters (test_duration must be larger than base_period)  */
drm_sched_interleaved_params [...]
{
        .num_workers = ...       /* 8 to 32 */
        .test_duration = ...     /* Few seconds */
        .base_period = ...       /* 100 us, small GPU job */
}

/* Setup phase common for all workers. */
workers_share = params->test_duration / params->num_workers;

/* Worker */
drm_sched_interleaved_worker()
{       
        period = (worker->id + 1) * base_period; 
        num_jobs = workers_share / period;

        for (i = 0; i < num_jobs; i++) {
                drm_mock_sched_job_set_duration_us(period);
                /* submit and wait for the job to complete */
        }	
}

What do you think?

Thanks,
Marco




      reply	other threads:[~2026-03-20 11:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-19 14:07 [PATCH] drm/sched: Add new KUnit test suite for concurrent job submission Marco Pagani
2026-02-23 16:25 ` Tvrtko Ursulin
2026-02-25  7:47   ` Philipp Stanner
2026-02-25  9:03     ` Tvrtko Ursulin
2026-03-17 17:27       ` Marco Pagani
2026-03-18 10:44         ` Tvrtko Ursulin
2026-03-18 18:15           ` Marco Pagani
2026-03-18 12:43     ` Marco Pagani
2026-03-17 17:04   ` 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 [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=0dd4b5ac-a9c4-4aff-a67a-ae43de10857e@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