@@ -390,24 +390,6 @@ __context_engines_static(const struct i915_gem_context *ctx)
390
390
return rcu_dereference_protected (ctx -> engines , true);
391
391
}
392
392
393
- static bool __reset_engine (struct intel_engine_cs * engine )
394
- {
395
- struct intel_gt * gt = engine -> gt ;
396
- bool success = false;
397
-
398
- if (!intel_has_reset_engine (gt ))
399
- return false;
400
-
401
- if (!test_and_set_bit (I915_RESET_ENGINE + engine -> id ,
402
- & gt -> reset .flags )) {
403
- success = intel_engine_reset (engine , NULL ) == 0 ;
404
- clear_and_wake_up_bit (I915_RESET_ENGINE + engine -> id ,
405
- & gt -> reset .flags );
406
- }
407
-
408
- return success ;
409
- }
410
-
411
393
static void __reset_context (struct i915_gem_context * ctx ,
412
394
struct intel_engine_cs * engine )
413
395
{
@@ -431,12 +413,7 @@ static bool __cancel_engine(struct intel_engine_cs *engine)
431
413
* kill the banned context, we fallback to doing a local reset
432
414
* instead.
433
415
*/
434
- if (IS_ACTIVE (CONFIG_DRM_I915_PREEMPT_TIMEOUT ) &&
435
- !intel_engine_pulse (engine ))
436
- return true;
437
-
438
- /* If we are unable to send a pulse, try resetting this engine. */
439
- return __reset_engine (engine );
416
+ return intel_engine_pulse (engine ) == 0 ;
440
417
}
441
418
442
419
static bool
@@ -506,7 +483,7 @@ static struct intel_engine_cs *active_engine(struct intel_context *ce)
506
483
return engine ;
507
484
}
508
485
509
- static void kill_engines (struct i915_gem_engines * engines )
486
+ static void kill_engines (struct i915_gem_engines * engines , bool ban )
510
487
{
511
488
struct i915_gem_engines_iter it ;
512
489
struct intel_context * ce ;
@@ -521,7 +498,7 @@ static void kill_engines(struct i915_gem_engines *engines)
521
498
for_each_gem_engine (ce , engines , it ) {
522
499
struct intel_engine_cs * engine ;
523
500
524
- if (intel_context_set_banned (ce ))
501
+ if (ban && intel_context_set_banned (ce ))
525
502
continue ;
526
503
527
504
/*
@@ -534,7 +511,7 @@ static void kill_engines(struct i915_gem_engines *engines)
534
511
engine = active_engine (ce );
535
512
536
513
/* First attempt to gracefully cancel the context */
537
- if (engine && !__cancel_engine (engine ))
514
+ if (engine && !__cancel_engine (engine ) && ban )
538
515
/*
539
516
* If we are unable to send a preemptive pulse to bump
540
517
* the context from the GPU, we have to resort to a full
@@ -544,8 +521,10 @@ static void kill_engines(struct i915_gem_engines *engines)
544
521
}
545
522
}
546
523
547
- static void kill_stale_engines (struct i915_gem_context * ctx )
524
+ static void kill_context (struct i915_gem_context * ctx )
548
525
{
526
+ bool ban = (!i915_gem_context_is_persistent (ctx ) ||
527
+ !ctx -> i915 -> params .enable_hangcheck );
549
528
struct i915_gem_engines * pos , * next ;
550
529
551
530
spin_lock_irq (& ctx -> stale .lock );
@@ -558,7 +537,7 @@ static void kill_stale_engines(struct i915_gem_context *ctx)
558
537
559
538
spin_unlock_irq (& ctx -> stale .lock );
560
539
561
- kill_engines (pos );
540
+ kill_engines (pos , ban );
562
541
563
542
spin_lock_irq (& ctx -> stale .lock );
564
543
GEM_BUG_ON (i915_sw_fence_signaled (& pos -> fence ));
@@ -570,11 +549,6 @@ static void kill_stale_engines(struct i915_gem_context *ctx)
570
549
spin_unlock_irq (& ctx -> stale .lock );
571
550
}
572
551
573
- static void kill_context (struct i915_gem_context * ctx )
574
- {
575
- kill_stale_engines (ctx );
576
- }
577
-
578
552
static void engines_idle_release (struct i915_gem_context * ctx ,
579
553
struct i915_gem_engines * engines )
580
554
{
@@ -609,7 +583,7 @@ static void engines_idle_release(struct i915_gem_context *ctx,
609
583
610
584
kill :
611
585
if (list_empty (& engines -> link )) /* raced, already closed */
612
- kill_engines (engines );
586
+ kill_engines (engines , true );
613
587
614
588
i915_sw_fence_commit (& engines -> fence );
615
589
}
@@ -667,9 +641,7 @@ static void context_close(struct i915_gem_context *ctx)
667
641
* case we opt to forcibly kill off all remaining requests on
668
642
* context close.
669
643
*/
670
- if (!i915_gem_context_is_persistent (ctx ) ||
671
- !ctx -> i915 -> params .enable_hangcheck )
672
- kill_context (ctx );
644
+ kill_context (ctx );
673
645
674
646
i915_gem_context_put (ctx );
675
647
}
0 commit comments