Skip to contentSkip to conversation

drm/tests: Mark slow tests as slow

PATCH In review Maxime Ripard 6 participants 16 messages Feb 24 – Feb 27

Subsystems (3)
lore
Share & tools
lore

Maxime Ripard

author maintainer
#0 lore raw

PATCH 1/1 drm/tests: Mark slow tests as slow

Some DRM tests cross the 1s execution time threshold that defines a test as slow. Let's flag them as such.

---
 drivers/gpu/drm/scheduler/tests/tests_basic.c | 4 ++--
 drivers/gpu/drm/tests/drm_buddy_test.c        | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/scheduler/tests/tests_basic.c +2 -2
index 82a41a456b0a..a5a5a35a87b0 100644
@@ -419,11 +419,11 @@ static void drm_sched_change_priority(struct kunit *test)
 		drm_mock_sched_entity_free(entity[i]);
 }
 
 static struct kunit_case drm_sched_priority_tests[] = {
 	KUNIT_CASE(drm_sched_priorities),
-	KUNIT_CASE(drm_sched_change_priority),
+	KUNIT_CASE_SLOW(drm_sched_change_priority),
 	{}
 };
 
 static struct kunit_suite drm_sched_priority = {
 	.name = "drm_sched_basic_priority_tests",
@@ -544,11 +544,11 @@ static void drm_sched_test_credits(struct kunit *test)
 	drm_mock_sched_entity_free(entity);
 	drm_mock_sched_fini(sched);
 }
 
 static struct kunit_case drm_sched_credits_tests[] = {
-	KUNIT_CASE(drm_sched_test_credits),
+	KUNIT_CASE_SLOW(drm_sched_test_credits),
 	{}
 };
 
 static struct kunit_suite drm_sched_credits = {
 	.name = "drm_sched_basic_credits_tests",
drivers/gpu/drm/tests/drm_buddy_test.c +1 -1
index e6f8459c6c54..35ca79525f43 100644
@@ -908,11 +908,11 @@ static struct kunit_case drm_buddy_tests[] = {
 	KUNIT_CASE(drm_test_buddy_alloc_pessimistic),
 	KUNIT_CASE(drm_test_buddy_alloc_pathological),
 	KUNIT_CASE(drm_test_buddy_alloc_contiguous),
 	KUNIT_CASE(drm_test_buddy_alloc_clear),
 	KUNIT_CASE(drm_test_buddy_alloc_range_bias),
-	KUNIT_CASE(drm_test_buddy_fragmentation_performance),
+	KUNIT_CASE_SLOW(drm_test_buddy_fragmentation_performance),
 	KUNIT_CASE(drm_test_buddy_alloc_exceeds_max_order),
 	{}
 };
 
 static struct kunit_suite drm_buddy_test_suite = {
Signature · 1 line
2.52.0
maintainer Reviewed-by on v1 1/1
#1 lore raw

Am 24.02.26 um 12:03 schrieb Maxime Ripard:

Quoted 4 lines

Some DRM tests cross the 1s execution time threshold that defines a test as slow. Let's flag them as such.

Quoted 52 lines
---
  drivers/gpu/drm/scheduler/tests/tests_basic.c | 4 ++--
  drivers/gpu/drm/tests/drm_buddy_test.c        | 2 +-
  2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/scheduler/tests/tests_basic.c +2 -2
index 82a41a456b0a..a5a5a35a87b0 100644
@@ -419,11 +419,11 @@ static void drm_sched_change_priority(struct kunit *test)
  		drm_mock_sched_entity_free(entity[i]);
  }
 
  static struct kunit_case drm_sched_priority_tests[] = {
  	KUNIT_CASE(drm_sched_priorities),
-	KUNIT_CASE(drm_sched_change_priority),
+	KUNIT_CASE_SLOW(drm_sched_change_priority),
  	{}
  };
 
  static struct kunit_suite drm_sched_priority = {
  	.name = "drm_sched_basic_priority_tests",
@@ -544,11 +544,11 @@ static void drm_sched_test_credits(struct kunit *test)
  	drm_mock_sched_entity_free(entity);
  	drm_mock_sched_fini(sched);
  }
 
  static struct kunit_case drm_sched_credits_tests[] = {
-	KUNIT_CASE(drm_sched_test_credits),
+	KUNIT_CASE_SLOW(drm_sched_test_credits),
  	{}
  };
 
  static struct kunit_suite drm_sched_credits = {
  	.name = "drm_sched_basic_credits_tests",
drivers/gpu/drm/tests/drm_buddy_test.c +1 -1
index e6f8459c6c54..35ca79525f43 100644
@@ -908,11 +908,11 @@ static struct kunit_case drm_buddy_tests[] = {
  	KUNIT_CASE(drm_test_buddy_alloc_pessimistic),
  	KUNIT_CASE(drm_test_buddy_alloc_pathological),
  	KUNIT_CASE(drm_test_buddy_alloc_contiguous),
  	KUNIT_CASE(drm_test_buddy_alloc_clear),
  	KUNIT_CASE(drm_test_buddy_alloc_range_bias),
-	KUNIT_CASE(drm_test_buddy_fragmentation_performance),
+	KUNIT_CASE_SLOW(drm_test_buddy_fragmentation_performance),
  	KUNIT_CASE(drm_test_buddy_alloc_exceeds_max_order),
  	{}
  };
 
  static struct kunit_suite drm_buddy_test_suite = {
Signature · 6 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)
maintainer
#2 lore raw
In reply to Maxime Ripard

(Cc: Tvrtko)

Quoted 2 lines · Maxime Ripard

Some DRM tests cross the 1s execution time threshold that defines a test as slow. Let's flag them as such.

<snip>

drivers/gpu/drm/scheduler/tests/tests_basic.c static void drm_sched_test_credits(struct kunit *test) · line 549

Quoted 3 lines

static struct kunit_case drm_sched_credits_tests[] = {

drivers/gpu/drm/scheduler/tests/tests_basic.c +1 -1
-	KUNIT_CASE(drm_sched_test_credits),
+	KUNIT_CASE_SLOW(drm_sched_test_credits),

Hm..I don't think this test should be that slow.

Looking at the code, I see intentional timeouts through:

	done = drm_mock_sched_job_wait_scheduled(job[1], HZ);
	KUNIT_ASSERT_FALSE(test, done);

Since the timeout is in jiffies, this should be always 1s, which seems a bit overkill.

Maybe we should just change this to msecs_to_jiffies(200), which should still be plenty and keep the test below 500ms.

#3 lore raw
Quoted 16 lines · Danilo Krummrich

(Cc: Tvrtko)

Quoted 2 lines · Maxime Ripard

Some DRM tests cross the 1s execution time threshold that defines a test as slow. Let's flag them as such.

<snip>

drivers/gpu/drm/scheduler/tests/tests_basic.c static void drm_sched_test_credits(struct kunit *test) · line 549

Quoted 3 lines
  static struct kunit_case drm_sched_credits_tests[] = {
drivers/gpu/drm/scheduler/tests/tests_basic.c +1 -1
-	KUNIT_CASE(drm_sched_test_credits),
+	KUNIT_CASE_SLOW(drm_sched_test_credits),

Hm..I don't think this test should be that slow.

Looking at the code, I see intentional timeouts through:

Quoted 8 lines
	done = drm_mock_sched_job_wait_scheduled(job[1], HZ);
	KUNIT_ASSERT_FALSE(test, done);

Since the timeout is in jiffies, this should be always 1s, which seems a bit overkill.

Maybe we should just change this to msecs_to_jiffies(200), which should still be plenty and keep the test below 500ms.

Right, 200ms should be more than plenty. It is only making sure the scheduler is not oversubscribing the configured credits, and the delay needed to be sure about that is around two worker wake up to run cycles.

Regards,

Tvrtko

#4 lore raw
Quoted 21 lines · Tvrtko Ursulin
Quoted 19 lines · Danilo Krummrich

(Cc: Tvrtko)

Quoted 2 lines · Maxime Ripard

Some DRM tests cross the 1s execution time threshold that defines a test as slow. Let's flag them as such.

<snip>

drivers/gpu/drm/scheduler/tests/tests_basic.c static void drm_sched_test_credits(struct kunit *test) · line 549

Quoted 3 lines

  static struct kunit_case drm_sched_credits_tests[] = {

drivers/gpu/drm/scheduler/tests/tests_basic.c +1 -1
-	KUNIT_CASE(drm_sched_test_credits),
+	KUNIT_CASE_SLOW(drm_sched_test_credits),

Hm..I don't think this test should be that slow.

Looking at the code, I see intentional timeouts through:

	done = drm_mock_sched_job_wait_scheduled(job[1], HZ);
	KUNIT_ASSERT_FALSE(test, done);
Quoted 8 lines
Quoted 5 lines

Since the timeout is in jiffies, this should be always 1s, which seems a bit overkill.

Maybe we should just change this to msecs_to_jiffies(200), which should still be plenty and keep the test below 500ms.

Right, 200ms should be more than plenty.

Who volunteers for implementing that change? :)

P.

Reviewed-by on v1 1/1
#5 lore raw
In reply to Maxime Ripard
Quoted 2 lines · Maxime Ripard

Some DRM tests cross the 1s execution time threshold that defines a test as slow. Let's flag them as such.

Curious that both did not trigger for me and I even run them under nested qemu most of the time.

Quoted 11 lines
---
  drivers/gpu/drm/scheduler/tests/tests_basic.c | 4 ++--
  drivers/gpu/drm/tests/drm_buddy_test.c        | 2 +-
  2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/scheduler/tests/tests_basic.c +0 -0
index 82a41a456b0a..a5a5a35a87b0 100644

drivers/gpu/drm/scheduler/tests/tests_basic.c static void drm_sched_change_priority(struct kunit *test) · line 424

Quoted 7 lines
drivers/gpu/drm/scheduler/tests/tests_basic.c +1 -1
@@ -419,11 +419,11 @@ static void drm_sched_change_priority(struct kunit *test)
  		drm_mock_sched_entity_free(entity[i]);
  }
 
  static struct kunit_case drm_sched_priority_tests[] = {
  	KUNIT_CASE(drm_sched_priorities),
-	KUNIT_CASE(drm_sched_change_priority),
+	KUNIT_CASE_SLOW(drm_sched_change_priority),

This one deliberately aims to run for ~1s and I don't have an immediate idea how it would go over 2s.

drivers/gpu/drm/scheduler/tests/tests_basic.c static void drm_sched_test_credits(struct kunit *test) · line 549

Quoted 13 lines
drivers/gpu/drm/scheduler/tests/tests_basic.c +1 -1
  	{}
  };
 
  static struct kunit_suite drm_sched_priority = {
  	.name = "drm_sched_basic_priority_tests",
@@ -544,11 +544,11 @@ static void drm_sched_test_credits(struct kunit *test)
  	drm_mock_sched_entity_free(entity);
  	drm_mock_sched_fini(sched);
  }
 
  static struct kunit_case drm_sched_credits_tests[] = {
-	KUNIT_CASE(drm_sched_test_credits),
+	KUNIT_CASE_SLOW(drm_sched_test_credits),

Same really.

Anyway, the scheduler parts LGTM and I can follow up trying to optimise these two later.

For the scheduler:

Regards,

Tvrtko

Quoted 22 lines
drivers/gpu/drm/scheduler/tests/tests_basic.c +0 -0
  	{}
  };
 
  static struct kunit_suite drm_sched_credits = {
  	.name = "drm_sched_basic_credits_tests",
drivers/gpu/drm/tests/drm_buddy_test.c +1 -1
index e6f8459c6c54..35ca79525f43 100644
@@ -908,11 +908,11 @@ static struct kunit_case drm_buddy_tests[] = {
  	KUNIT_CASE(drm_test_buddy_alloc_pessimistic),
  	KUNIT_CASE(drm_test_buddy_alloc_pathological),
  	KUNIT_CASE(drm_test_buddy_alloc_contiguous),
  	KUNIT_CASE(drm_test_buddy_alloc_clear),
  	KUNIT_CASE(drm_test_buddy_alloc_range_bias),
-	KUNIT_CASE(drm_test_buddy_fragmentation_performance),
+	KUNIT_CASE_SLOW(drm_test_buddy_fragmentation_performance),
  	KUNIT_CASE(drm_test_buddy_alloc_exceeds_max_order),
  	{}
  };
 
  static struct kunit_suite drm_buddy_test_suite = {
author maintainer
#6 lore raw

Hi Tvrtko,

Quoted 14 lines · Tvrtko Ursulin
Quoted 2 lines · Maxime Ripard

Some DRM tests cross the 1s execution time threshold that defines a test as slow. Let's flag them as such.

Curious that both did not trigger for me and I even run them under nested qemu most of the time.

Quoted 6 lines
---
  drivers/gpu/drm/scheduler/tests/tests_basic.c | 4 ++--
  drivers/gpu/drm/tests/drm_buddy_test.c        | 2 +-
  2 files changed, 3 insertions(+), 3 deletions(-)
Quoted 14 lines

drivers/gpu/drm/scheduler/tests/tests_basic.c static void drm_sched_change_priority(struct kunit *test) · line 423

Quoted 11 lines
drivers/gpu/drm/scheduler/tests/tests_basic.c +1 -1
index 82a41a456b0a..a5a5a35a87b0 100644
@@ -419,11 +419,11 @@ static void drm_sched_change_priority(struct kunit *test)
  		drm_mock_sched_entity_free(entity[i]);
  }
  static struct kunit_case drm_sched_priority_tests[] = {
  	KUNIT_CASE(drm_sched_priorities),
-	KUNIT_CASE(drm_sched_change_priority),
+	KUNIT_CASE_SLOW(drm_sched_change_priority),

This one deliberately aims to run for ~1s and I don't have an immediate idea how it would go over 2s.

1s is the threshold for a slow test:
https://elixir.bootlin.com/linux/v6.19.3/source/lib/kunit/test.c#L365

It only warns about it if it crosses 2s, but if it's expected to take 1s, it should be flagged as such still.

Quoted 14 lines

drivers/gpu/drm/scheduler/tests/tests_basic.c static void drm_sched_test_credits(struct kunit *test) · line 548

Quoted 11 lines
drivers/gpu/drm/scheduler/tests/tests_basic.c +1 -1
  	{}
  };
  static struct kunit_suite drm_sched_priority = {
  	.name = "drm_sched_basic_priority_tests",
@@ -544,11 +544,11 @@ static void drm_sched_test_credits(struct kunit *test)
  	drm_mock_sched_entity_free(entity);
  	drm_mock_sched_fini(sched);
  }
  static struct kunit_case drm_sched_credits_tests[] = {
-	KUNIT_CASE(drm_sched_test_credits),
+	KUNIT_CASE_SLOW(drm_sched_test_credits),

Same really.

Quoted 6 lines

Anyway, the scheduler parts LGTM and I can follow up trying to optimise these two later.

For the scheduler:

Thanks!

#7 lore raw
Quoted 32 lines · Maxime Ripard

Hi Tvrtko,

Quoted 14 lines · Tvrtko Ursulin
Quoted 2 lines · Maxime Ripard

Some DRM tests cross the 1s execution time threshold that defines a test as slow. Let's flag them as such.

Curious that both did not trigger for me and I even run them under nested qemu most of the time.

Quoted 6 lines
---
   drivers/gpu/drm/scheduler/tests/tests_basic.c | 4 ++--
   drivers/gpu/drm/tests/drm_buddy_test.c        | 2 +-
   2 files changed, 3 insertions(+), 3 deletions(-)
Quoted 14 lines

drivers/gpu/drm/scheduler/tests/tests_basic.c static void drm_sched_change_priority(struct kunit *test) · line 423

Quoted 11 lines
drivers/gpu/drm/scheduler/tests/tests_basic.c +1 -1
index 82a41a456b0a..a5a5a35a87b0 100644
@@ -419,11 +419,11 @@ static void drm_sched_change_priority(struct kunit *test)
   		drm_mock_sched_entity_free(entity[i]);
   }
   static struct kunit_case drm_sched_priority_tests[] = {
   	KUNIT_CASE(drm_sched_priorities),
-	KUNIT_CASE(drm_sched_change_priority),
+	KUNIT_CASE_SLOW(drm_sched_change_priority),

This one deliberately aims to run for ~1s and I don't have an immediate idea how it would go over 2s.

Quoted 5 lines

1s is the threshold for a slow test:
https://elixir.bootlin.com/linux/v6.19.3/source/lib/kunit/test.c#L365

It only warns about it if it crosses 2s, but if it's expected to take 1s, it should be flagged as such still.

I know, just curious which environment managed to trigger the warning. Because I thought my test setup was the slowest one (nested virtualization - qemu-system inside vmware).

Quoted 14 lines
Quoted 14 lines

drivers/gpu/drm/scheduler/tests/tests_basic.c static void drm_sched_test_credits(struct kunit *test) · line 548

Quoted 11 lines
drivers/gpu/drm/scheduler/tests/tests_basic.c +1 -1
   	{}
   };
   static struct kunit_suite drm_sched_priority = {
   	.name = "drm_sched_basic_priority_tests",
@@ -544,11 +544,11 @@ static void drm_sched_test_credits(struct kunit *test)
   	drm_mock_sched_entity_free(entity);
   	drm_mock_sched_fini(sched);
   }
   static struct kunit_case drm_sched_credits_tests[] = {
-	KUNIT_CASE(drm_sched_test_credits),
+	KUNIT_CASE_SLOW(drm_sched_test_credits),

Same really.

Quoted 8 lines
Quoted 6 lines

Anyway, the scheduler parts LGTM and I can follow up trying to optimise these two later.

For the scheduler:

Thanks!

I have a patch already which makes those (and one more) test cases faster, but I will wait sending it until you merge this one.

Regards,

Tvrtko

#8 lore raw
Quoted 4 lines · Tvrtko Ursulin

On 26/02/2026 10:56, Maxime Ripard wrote:

[…]

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines

drivers/gpu/drm/scheduler/tests/tests_basic.c static void drm_sched_test_credits(struct kunit *test) · line 548

Quoted 11 lines

    {}
   };
   static struct kunit_suite drm_sched_priority = { .name = "drm_sched_basic_priority_tests",

drivers/gpu/drm/scheduler/tests/tests_basic.c +1 -1
@@ -544,11 +544,11 @@ static void drm_sched_test_credits(struct kunit *test)
    	drm_mock_sched_entity_free(entity);
    	drm_mock_sched_fini(sched);
    }
    static struct kunit_case drm_sched_credits_tests[] = {
-	KUNIT_CASE(drm_sched_test_credits),
+	KUNIT_CASE_SLOW(drm_sched_test_credits),

Same really.

Anyway, the scheduler parts LGTM and I can follow up trying to optimise these two later.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

For the scheduler:

Thanks!

I have a patch already which makes those (and one more) test cases faster, but I will wait sending it until you merge this one.

And why would we want to flag a test as slow just to immediately afterwards make it faster?

Would it not be wiser to drop Maxime's change?

P.

#9 lore raw
Quoted 31 lines · Philipp Stanner
Quoted 4 lines · Tvrtko Ursulin

On 26/02/2026 10:56, Maxime Ripard wrote:

[…]

Quoted 23 lines
Quoted 22 lines
Quoted 14 lines

drivers/gpu/drm/scheduler/tests/tests_basic.c static void drm_sched_test_credits(struct kunit *test) · line 548

Quoted 11 lines

    {}
   };
   static struct kunit_suite drm_sched_priority = { .name = "drm_sched_basic_priority_tests",

drivers/gpu/drm/scheduler/tests/tests_basic.c +1 -1
@@ -544,11 +544,11 @@ static void drm_sched_test_credits(struct kunit *test)
    	drm_mock_sched_entity_free(entity);
    	drm_mock_sched_fini(sched);
    }
    static struct kunit_case drm_sched_credits_tests[] = {
-	KUNIT_CASE(drm_sched_test_credits),
+	KUNIT_CASE_SLOW(drm_sched_test_credits),

Same really.

Quoted 6 lines

Anyway, the scheduler parts LGTM and I can follow up trying to optimise these two later.

For the scheduler:

Thanks!

Quoted 7 lines
Quoted 2 lines

I have a patch already which makes those (and one more) test cases faster, but I will wait sending it until you merge this one.

And why would we want to flag a test as slow just to immediately afterwards make it faster?

Would it not be wiser to drop Maxime's change?

Just so he doesn't have to respin, or that we don't end up merging my patch on top of the test already marked as slow. I am okay either way.

Regards,

Tvrtko

#10 lore raw
Quoted 36 lines · Tvrtko Ursulin
Quoted 34 lines · Philipp Stanner
Quoted 4 lines · Tvrtko Ursulin

On 26/02/2026 10:56, Maxime Ripard wrote:

[…]

Quoted 25 lines
Quoted 14 lines
Quoted 14 lines

drivers/gpu/drm/scheduler/tests/tests_basic.c static void drm_sched_test_credits(struct kunit *test) · line 548

Quoted 11 lines

     {}
    };
    static struct kunit_suite drm_sched_priority = { .name = "drm_sched_basic_priority_tests",

drivers/gpu/drm/scheduler/tests/tests_basic.c +1 -1
@@ -544,11 +544,11 @@ static void drm_sched_test_credits(struct kunit *test)
     	drm_mock_sched_entity_free(entity);
     	drm_mock_sched_fini(sched);
     }
     static struct kunit_case drm_sched_credits_tests[] = {
-	KUNIT_CASE(drm_sched_test_credits),
+	KUNIT_CASE_SLOW(drm_sched_test_credits),

Same really.

Quoted 8 lines
Quoted 6 lines

Anyway, the scheduler parts LGTM and I can follow up trying to optimise these two later.

For the scheduler:

Thanks!

I have a patch already which makes those (and one more) test cases faster, but I will wait sending it until you merge this one.

Quoted 7 lines
Quoted 4 lines

And why would we want to flag a test as slow just to immediately afterwards make it faster?

Would it not be wiser to drop Maxime's change?

Just so he doesn't have to respin, or that we don't end up merging my patch on top of the test already marked as slow. I am okay either way.

From my POV Maxime can decide that.

But if your speed-up patches go in after, they should probably remove the marker again, shouldn't they?

P.

#11 lore raw
Quoted 42 lines · Philipp Stanner
Quoted 41 lines · Tvrtko Ursulin
Quoted 38 lines · Philipp Stanner
Quoted 4 lines · Tvrtko Ursulin

On 26/02/2026 10:56, Maxime Ripard wrote:

[…]

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines

Review static void drm_sched_test_credits(struct kunit *test) · line 548

Quoted 11 lines

     {}
    };
    static struct kunit_suite drm_sched_priority = { .name = "drm_sched_basic_priority_tests",

(quoted diff) +1 -1
@@ -544,11 +544,11 @@ static void drm_sched_test_credits(struct kunit *test)
     	drm_mock_sched_entity_free(entity);
     	drm_mock_sched_fini(sched);
     }
     static struct kunit_case drm_sched_credits_tests[] = {
-	KUNIT_CASE(drm_sched_test_credits),
+	KUNIT_CASE_SLOW(drm_sched_test_credits),

Same really.

Anyway, the scheduler parts LGTM and I can follow up trying to optimise these two later.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

For the scheduler:

Thanks!

I have a patch already which makes those (and one more) test cases faster, but I will wait sending it until you merge this one.

And why would we want to flag a test as slow just to immediately afterwards make it faster?

Would it not be wiser to drop Maxime's change?

Quoted 7 lines
Quoted 2 lines

Just so he doesn't have to respin, or that we don't end up merging my patch on top of the test already marked as slow. I am okay either way.

From my POV Maxime can decide that.

But if your speed-up patches go in after, they should probably remove the marker again, shouldn't they?

Yes, that's why I said I was sitting on the patch.

Regards,

Tvrtko

author maintainer
#12 lore raw
Quoted 47 lines · Tvrtko Ursulin
Quoted 45 lines · Philipp Stanner
Quoted 43 lines · Tvrtko Ursulin
Quoted 31 lines · Philipp Stanner
Quoted 4 lines · Tvrtko Ursulin

On 26/02/2026 10:56, Maxime Ripard wrote:

[…]

Quoted 23 lines
Quoted 22 lines
Quoted 14 lines

Review static void drm_sched_test_credits(struct kunit *test) · line 548

Quoted 11 lines

     {}
    };
    static struct kunit_suite drm_sched_priority = { .name = "drm_sched_basic_priority_tests",

(quoted diff) +1 -1
@@ -544,11 +544,11 @@ static void drm_sched_test_credits(struct kunit *test)
     	drm_mock_sched_entity_free(entity);
     	drm_mock_sched_fini(sched);
     }
     static struct kunit_case drm_sched_credits_tests[] = {
-	KUNIT_CASE(drm_sched_test_credits),
+	KUNIT_CASE_SLOW(drm_sched_test_credits),

Same really.

Quoted 6 lines

Anyway, the scheduler parts LGTM and I can follow up trying to optimise these two later.

For the scheduler:

Thanks!

Quoted 7 lines
Quoted 2 lines

I have a patch already which makes those (and one more) test cases faster, but I will wait sending it until you merge this one.

And why would we want to flag a test as slow just to immediately afterwards make it faster?

Would it not be wiser to drop Maxime's change?

Just so he doesn't have to respin, or that we don't end up merging my patch on top of the test already marked as slow. I am okay either way.

Quoted 6 lines
Quoted 4 lines

From my POV Maxime can decide that.

But if your speed-up patches go in after, they should probably remove the marker again, shouldn't they?

Yes, that's why I said I was sitting on the patch.

I've just pushed it to drm-misc-next

Thanks!
Maxime

author maintainer
#13 lore raw
In reply to Tvrtko Ursulin
Quoted 37 lines · Tvrtko Ursulin
Quoted 35 lines · Maxime Ripard

Hi Tvrtko,

Quoted 14 lines · Tvrtko Ursulin
Quoted 2 lines · Maxime Ripard

Some DRM tests cross the 1s execution time threshold that defines a test as slow. Let's flag them as such.

Curious that both did not trigger for me and I even run them under nested qemu most of the time.

Quoted 6 lines
---
   drivers/gpu/drm/scheduler/tests/tests_basic.c | 4 ++--
   drivers/gpu/drm/tests/drm_buddy_test.c        | 2 +-
   2 files changed, 3 insertions(+), 3 deletions(-)
Quoted 14 lines

drivers/gpu/drm/scheduler/tests/tests_basic.c static void drm_sched_change_priority(struct kunit *test) · line 423

Quoted 11 lines
drivers/gpu/drm/scheduler/tests/tests_basic.c +1 -1
index 82a41a456b0a..a5a5a35a87b0 100644
@@ -419,11 +419,11 @@ static void drm_sched_change_priority(struct kunit *test)
   		drm_mock_sched_entity_free(entity[i]);
   }
   static struct kunit_case drm_sched_priority_tests[] = {
   	KUNIT_CASE(drm_sched_priorities),
-	KUNIT_CASE(drm_sched_change_priority),
+	KUNIT_CASE_SLOW(drm_sched_change_priority),

This one deliberately aims to run for ~1s and I don't have an immediate idea how it would go over 2s.

1s is the threshold for a slow test:
https://elixir.bootlin.com/linux/v6.19.3/source/lib/kunit/test.c#L365

Quoted 6 lines
Quoted 2 lines

It only warns about it if it crosses 2s, but if it's expected to take 1s, it should be flagged as such still.

I know, just curious which environment managed to trigger the warning. Because I thought my test setup was the slowest one (nested virtualization - qemu-system inside vmware).

I was running a cross-compiled arm64 system on my x86 machine, so emulated. That being said, that one didn't cross the 2s threshold either.

Other tests did, and I used the occasion to flag every test that was taking more than 1s.

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines

drivers/gpu/drm/scheduler/tests/tests_basic.c static void drm_sched_test_credits(struct kunit *test) · line 548

Quoted 11 lines
drivers/gpu/drm/scheduler/tests/tests_basic.c +1 -1
   	{}
   };
   static struct kunit_suite drm_sched_priority = {
   	.name = "drm_sched_basic_priority_tests",
@@ -544,11 +544,11 @@ static void drm_sched_test_credits(struct kunit *test)
   	drm_mock_sched_entity_free(entity);
   	drm_mock_sched_fini(sched);
   }
   static struct kunit_case drm_sched_credits_tests[] = {
-	KUNIT_CASE(drm_sched_test_credits),
+	KUNIT_CASE_SLOW(drm_sched_test_credits),

Same really.

Anyway, the scheduler parts LGTM and I can follow up trying to optimise these two later.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

For the scheduler:

Thanks!

I have a patch already which makes those (and one more) test cases faster, but I will wait sending it until you merge this one.

Ack, thanks!
Maxime

#14 lore raw
Quoted 41 lines · Maxime Ripard
Quoted 40 lines · Tvrtko Ursulin
Quoted 37 lines · Maxime Ripard

Hi Tvrtko,

Quoted 14 lines · Tvrtko Ursulin
Quoted 2 lines · Maxime Ripard

Some DRM tests cross the 1s execution time threshold that defines a test as slow. Let's flag them as such.

Curious that both did not trigger for me and I even run them under nested qemu most of the time.

Quoted 6 lines
---
    drivers/gpu/drm/scheduler/tests/tests_basic.c | 4 ++--
    drivers/gpu/drm/tests/drm_buddy_test.c        | 2 +-
    2 files changed, 3 insertions(+), 3 deletions(-)
Quoted 14 lines

drivers/gpu/drm/scheduler/tests/tests_basic.c static void drm_sched_change_priority(struct kunit *test) · line 423

Quoted 11 lines
drivers/gpu/drm/scheduler/tests/tests_basic.c +1 -1
index 82a41a456b0a..a5a5a35a87b0 100644
@@ -419,11 +419,11 @@ static void drm_sched_change_priority(struct kunit *test)
    		drm_mock_sched_entity_free(entity[i]);
    }
    static struct kunit_case drm_sched_priority_tests[] = {
    	KUNIT_CASE(drm_sched_priorities),
-	KUNIT_CASE(drm_sched_change_priority),
+	KUNIT_CASE_SLOW(drm_sched_change_priority),

This one deliberately aims to run for ~1s and I don't have an immediate idea how it would go over 2s.

1s is the threshold for a slow test:
https://elixir.bootlin.com/linux/v6.19.3/source/lib/kunit/test.c#L365

It only warns about it if it crosses 2s, but if it's expected to take 1s, it should be flagged as such still.

Quoted 7 lines
Quoted 3 lines

I know, just curious which environment managed to trigger the warning. Because I thought my test setup was the slowest one (nested virtualization - qemu-system inside vmware).

I was running a cross-compiled arm64 system on my x86 machine, so emulated. That being said, that one didn't cross the 2s threshold either.

Good to know I wasn't missing something obvious in the test logic.

The tweaks I just sent change some tests from emitting 1000 1ms jobs to only emitting 500 of them. Effectively targetting their runtime to 500ms, plus the hrtimer and worker item scheduling delays. Hopefully even under emulation that is enough of a margin to never get over 1s, let alone 2s of wall clock time.

Regards,

Tvrtko

Quoted 32 lines

Other tests did, and I used the occasion to flag every test that was taking more than 1s.

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines

drivers/gpu/drm/scheduler/tests/tests_basic.c static void drm_sched_test_credits(struct kunit *test) · line 548

Quoted 11 lines
drivers/gpu/drm/scheduler/tests/tests_basic.c +1 -1
    	{}
    };
    static struct kunit_suite drm_sched_priority = {
    	.name = "drm_sched_basic_priority_tests",
@@ -544,11 +544,11 @@ static void drm_sched_test_credits(struct kunit *test)
    	drm_mock_sched_entity_free(entity);
    	drm_mock_sched_fini(sched);
    }
    static struct kunit_case drm_sched_credits_tests[] = {
-	KUNIT_CASE(drm_sched_test_credits),
+	KUNIT_CASE_SLOW(drm_sched_test_credits),

Same really.

Anyway, the scheduler parts LGTM and I can follow up trying to optimise these two later.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

For the scheduler:

Thanks!

I have a patch already which makes those (and one more) test cases faster, but I will wait sending it until you merge this one.

Ack, thanks!
Maxime

Reviewed-by on v1 1/1
#15 lore raw
In reply to Maxime Ripard
Quoted 44 lines · Maxime Ripard

Some DRM tests cross the 1s execution time threshold that defines a test as slow. Let's flag them as such.

---
  drivers/gpu/drm/scheduler/tests/tests_basic.c | 4 ++--
  drivers/gpu/drm/tests/drm_buddy_test.c        | 2 +-
  2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/scheduler/tests/tests_basic.c +2 -2
index 82a41a456b0a..a5a5a35a87b0 100644
@@ -419,11 +419,11 @@ static void drm_sched_change_priority(struct kunit *test)
  		drm_mock_sched_entity_free(entity[i]);
  }
 
  static struct kunit_case drm_sched_priority_tests[] = {
  	KUNIT_CASE(drm_sched_priorities),
-	KUNIT_CASE(drm_sched_change_priority),
+	KUNIT_CASE_SLOW(drm_sched_change_priority),
  	{}
  };
 
  static struct kunit_suite drm_sched_priority = {
  	.name = "drm_sched_basic_priority_tests",
@@ -544,11 +544,11 @@ static void drm_sched_test_credits(struct kunit *test)
  	drm_mock_sched_entity_free(entity);
  	drm_mock_sched_fini(sched);
  }
 
  static struct kunit_case drm_sched_credits_tests[] = {
-	KUNIT_CASE(drm_sched_test_credits),
+	KUNIT_CASE_SLOW(drm_sched_test_credits),
  	{}
  };
 
  static struct kunit_suite drm_sched_credits = {
  	.name = "drm_sched_basic_credits_tests",
drivers/gpu/drm/tests/drm_buddy_test.c +0 -0
index e6f8459c6c54..35ca79525f43 100644

drivers/gpu/drm/tests/drm_buddy_test.c static struct kunit_case drm_buddy_tests[] = { · line 916

Quoted 10 lines
drivers/gpu/drm/tests/drm_buddy_test.c +1 -1
@@ -908,11 +908,11 @@ static struct kunit_case drm_buddy_tests[] = {
  	KUNIT_CASE(drm_test_buddy_alloc_pessimistic),
  	KUNIT_CASE(drm_test_buddy_alloc_pathological),
  	KUNIT_CASE(drm_test_buddy_alloc_contiguous),
  	KUNIT_CASE(drm_test_buddy_alloc_clear),
  	KUNIT_CASE(drm_test_buddy_alloc_range_bias),
-	KUNIT_CASE(drm_test_buddy_fragmentation_performance),
+	KUNIT_CASE_SLOW(drm_test_buddy_fragmentation_performance),
  	KUNIT_CASE(drm_test_buddy_alloc_exceeds_max_order),
  	{}
  };

For the buddy allocator part,

Quoted 2 lines
drivers/gpu/drm/tests/drm_buddy_test.c +0 -0
  static struct kunit_suite drm_buddy_test_suite = {