@@ -404,15 +404,16 @@ static const char *bannable(const struct drm_i915_error_context *ctx)
404
404
405
405
static void error_print_request (struct drm_i915_error_state_buf * m ,
406
406
const char * prefix ,
407
- const struct drm_i915_error_request * erq )
407
+ const struct drm_i915_error_request * erq ,
408
+ const unsigned long epoch )
408
409
{
409
410
if (!erq -> seqno )
410
411
return ;
411
412
412
- err_printf (m , "%s pid %d, ban score %d, seqno %8x:%08x, prio %d, emitted %dms ago , head %08x, tail %08x\n" ,
413
+ err_printf (m , "%s pid %d, ban score %d, seqno %8x:%08x, prio %d, emitted %dms, head %08x, tail %08x\n" ,
413
414
prefix , erq -> pid , erq -> ban_score ,
414
415
erq -> context , erq -> seqno , erq -> sched_attr .priority ,
415
- jiffies_to_msecs (jiffies - erq -> jiffies ),
416
+ jiffies_to_msecs (erq -> jiffies - epoch ),
416
417
erq -> head , erq -> tail );
417
418
}
418
419
@@ -427,7 +428,8 @@ static void error_print_context(struct drm_i915_error_state_buf *m,
427
428
}
428
429
429
430
static void error_print_engine (struct drm_i915_error_state_buf * m ,
430
- const struct drm_i915_error_engine * ee )
431
+ const struct drm_i915_error_engine * ee ,
432
+ const unsigned long epoch )
431
433
{
432
434
int n ;
433
435
@@ -497,14 +499,15 @@ static void error_print_engine(struct drm_i915_error_state_buf *m,
497
499
err_printf (m , " hangcheck stall: %s\n" , yesno (ee -> hangcheck_stalled ));
498
500
err_printf (m , " hangcheck action: %s\n" ,
499
501
hangcheck_action_to_str (ee -> hangcheck_action ));
500
- err_printf (m , " hangcheck action timestamp: %lu, %u ms ago\n" ,
502
+ err_printf (m , " hangcheck action timestamp: %dms (%lu%s)\n" ,
503
+ jiffies_to_msecs (ee -> hangcheck_timestamp - epoch ),
501
504
ee -> hangcheck_timestamp ,
502
- jiffies_to_msecs ( jiffies - ee -> hangcheck_timestamp ) );
505
+ ee -> hangcheck_timestamp == epoch ? "; epoch" : "" );
503
506
err_printf (m , " engine reset count: %u\n" , ee -> reset_count );
504
507
505
508
for (n = 0 ; n < ee -> num_ports ; n ++ ) {
506
509
err_printf (m , " ELSP[%d]:" , n );
507
- error_print_request (m , " " , & ee -> execlist [n ]);
510
+ error_print_request (m , " " , & ee -> execlist [n ], epoch );
508
511
}
509
512
510
513
error_print_context (m , " Active context: " , & ee -> context );
@@ -650,6 +653,11 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
650
653
ts = ktime_to_timespec64 (error -> uptime );
651
654
err_printf (m , "Uptime: %lld s %ld us\n" ,
652
655
(s64 )ts .tv_sec , ts .tv_nsec / NSEC_PER_USEC );
656
+ err_printf (m , "Epoch: %lu jiffies (%u HZ)\n" , error -> epoch , HZ );
657
+ err_printf (m , "Capture: %lu jiffies; %d ms ago, %d ms after epoch\n" ,
658
+ error -> capture ,
659
+ jiffies_to_msecs (jiffies - error -> capture ),
660
+ jiffies_to_msecs (error -> capture - error -> epoch ));
653
661
654
662
for (i = 0 ; i < ARRAY_SIZE (error -> engine ); i ++ ) {
655
663
if (error -> engine [i ].hangcheck_stalled &&
@@ -710,7 +718,7 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
710
718
711
719
for (i = 0 ; i < ARRAY_SIZE (error -> engine ); i ++ ) {
712
720
if (error -> engine [i ].engine_id != -1 )
713
- error_print_engine (m , & error -> engine [i ]);
721
+ error_print_engine (m , & error -> engine [i ], error -> epoch );
714
722
}
715
723
716
724
for (i = 0 ; i < ARRAY_SIZE (error -> active_vm ); i ++ ) {
@@ -769,7 +777,9 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
769
777
dev_priv -> engine [i ]-> name ,
770
778
ee -> num_requests );
771
779
for (j = 0 ; j < ee -> num_requests ; j ++ )
772
- error_print_request (m , " " , & ee -> requests [j ]);
780
+ error_print_request (m , " " ,
781
+ & ee -> requests [j ],
782
+ error -> epoch );
773
783
}
774
784
775
785
if (IS_ERR (ee -> waiters )) {
@@ -1736,6 +1746,22 @@ static void capture_params(struct i915_gpu_state *error)
1736
1746
#undef DUP
1737
1747
}
1738
1748
1749
+ static unsigned long capture_find_epoch (const struct i915_gpu_state * error )
1750
+ {
1751
+ unsigned long epoch = error -> capture ;
1752
+ int i ;
1753
+
1754
+ for (i = 0 ; i < ARRAY_SIZE (error -> engine ); i ++ ) {
1755
+ const struct drm_i915_error_engine * ee = & error -> engine [i ];
1756
+
1757
+ if (ee -> hangcheck_stalled &&
1758
+ time_before (ee -> hangcheck_timestamp , epoch ))
1759
+ epoch = ee -> hangcheck_timestamp ;
1760
+ }
1761
+
1762
+ return epoch ;
1763
+ }
1764
+
1739
1765
static int capture (void * data )
1740
1766
{
1741
1767
struct i915_gpu_state * error = data ;
@@ -1744,6 +1770,7 @@ static int capture(void *data)
1744
1770
error -> boottime = ktime_get_boottime ();
1745
1771
error -> uptime = ktime_sub (ktime_get (),
1746
1772
error -> i915 -> gt .last_init_time );
1773
+ error -> capture = jiffies ;
1747
1774
1748
1775
capture_params (error );
1749
1776
capture_gen_state (error );
@@ -1757,6 +1784,8 @@ static int capture(void *data)
1757
1784
error -> overlay = intel_overlay_capture_error_state (error -> i915 );
1758
1785
error -> display = intel_display_capture_error_state (error -> i915 );
1759
1786
1787
+ error -> epoch = capture_find_epoch (error );
1788
+
1760
1789
return 0 ;
1761
1790
}
1762
1791
0 commit comments