@@ -33,6 +33,7 @@ long intel_gt_retire_requests_timeout(struct intel_gt *gt, long timeout)
33
33
{
34
34
struct intel_gt_timelines * timelines = & gt -> timelines ;
35
35
struct intel_timeline * tl , * tn ;
36
+ unsigned long active_count = 0 ;
36
37
unsigned long flags ;
37
38
bool interruptible ;
38
39
LIST_HEAD (free );
@@ -45,8 +46,10 @@ long intel_gt_retire_requests_timeout(struct intel_gt *gt, long timeout)
45
46
46
47
spin_lock_irqsave (& timelines -> lock , flags );
47
48
list_for_each_entry_safe (tl , tn , & timelines -> active_list , link ) {
48
- if (!mutex_trylock (& tl -> mutex ))
49
+ if (!mutex_trylock (& tl -> mutex )) {
50
+ active_count ++ ; /* report busy to caller, try again? */
49
51
continue ;
52
+ }
50
53
51
54
intel_timeline_get (tl );
52
55
GEM_BUG_ON (!tl -> active_count );
@@ -73,6 +76,8 @@ long intel_gt_retire_requests_timeout(struct intel_gt *gt, long timeout)
73
76
list_safe_reset_next (tl , tn , link );
74
77
if (!-- tl -> active_count )
75
78
list_del (& tl -> link );
79
+ else
80
+ active_count += !!rcu_access_pointer (tl -> last_request .fence );
76
81
77
82
mutex_unlock (& tl -> mutex );
78
83
@@ -87,7 +92,7 @@ long intel_gt_retire_requests_timeout(struct intel_gt *gt, long timeout)
87
92
list_for_each_entry_safe (tl , tn , & free , link )
88
93
__intel_timeline_free (& tl -> kref );
89
94
90
- return list_empty ( & timelines -> active_list ) ? 0 : timeout ;
95
+ return active_count ? timeout : 0 ;
91
96
}
92
97
93
98
int intel_gt_wait_for_idle (struct intel_gt * gt , long timeout )
0 commit comments