lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e7c3a8a33d00409935f4d43b40aa19c2c146e996.camel@mailbox.org>
Date: Mon, 16 Jun 2025 14:56:13 +0200
From: Philipp Stanner <phasta@...lbox.org>
To: Maíra Canal <mcanal@...lia.com>, Danilo Krummrich
	 <dakr@...nel.org>, Tvrtko Ursulin <tvrtko.ursulin@...lia.com>
Cc: Philipp Stanner <phasta@...nel.org>, Matthew Brost
 <matthew.brost@...el.com>,  Christian König
 <ckoenig.leichtzumerken@...il.com>, Maarten Lankhorst
 <maarten.lankhorst@...ux.intel.com>, Maxime Ripard <mripard@...nel.org>, 
 Thomas Zimmermann <tzimmermann@...e.de>, David Airlie <airlied@...il.com>,
 Simona Vetter <simona@...ll.ch>,  Pierre-Eric Pelloux-Prayer
 <pierre-eric.pelloux-prayer@....com>, dri-devel@...ts.freedesktop.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drm/sched/tests: Make timedout_job callback a better
 role model

On Mon, 2025-06-16 at 09:49 -0300, Maíra Canal wrote:
> Hi Danilo,
> 
> On 16/06/25 08:14, Danilo Krummrich wrote:
> > On Mon, Jun 16, 2025 at 11:57:47AM +0100, Tvrtko Ursulin wrote:
> > > Code looks fine, but currently nothing is broken and I disagree
> > > with the
> > > goal that the _mock_^1 components should be role models. The idea
> > > is to
> > > implement as little in the mock components as it is required to
> > > exercise the
> > > tested functionality.
> > 
> > No, please consider the following.
> > 
> >    1) When we write tests for common infrastructure we should be
> > testing things
> >       as close as possible to how we intend real code to use this
> > infrastructure.
> >       Relying on internals in creative ways is likely to underrun
> > this testing.
> 
> Regarding unit testing (and KUnit is a unit testing framework), the
> core
> principle is that individual components of the code should be tested
> in
> isolation to validate that they perform as expected.
> 
> The "units" should be tested independently and we use those mocks to
> simulate dependencies, ensuring that the test focuses solely on the
> unit
> under scrutiny.
> 
> If we introduce more things into the mock, we end up losing the
> isolation.

That depends on what those "things" are.

In the presented case, the unit tests are just as isolated as before.
The particular test case itself is not even modified and it will still
do exactly one thing: See if the job actually timed out as expected.

The added overhead in the mock component is merely the guarantee that
the fence gets signaled and that the job is removed from the mock
component's list at the appropriate place.

0 downside, documentation upside.

Each unit test still tests exactly 1 functionality.


> The mock scheduler, from what I understand, is not suppose to
> be a reference design or even something close to a driver. 

We here in DRM define what it is supposed to be.

And since the scheduler has been infinitely abused and misused, at
least having one official, simple example "this is how you're supposed
to do it" is desirable, wouldn't you say so?


P.

>  It should
> remain just a mock, a minimal interface to test the scheduler's
> internals.
> 
> Best Regards,
> - Maíra
> 
> > 
> >    2) Being close to a reference design is a good thing, why
> > wouldn't we want
> >       that? The reality is that people *will* look at this code for
> > reference.
> > 
> > > Also, there are various ways drivers use the scheduler API.
> > > Trying to make
> > > the mock scheduler a reference driver implementation would only
> > > be able to
> > > make it a reference for one possible use.
> > 
> > Why? Nothing prevents us from covering all of them eventually.
> > 
> > If for now, we just implement one of them, that's better than none,
> > so why not?
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ