File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -446,34 +446,45 @@ bts_buffer_reset(struct bts_buffer *buf, struct perf_output_handle *handle)
446
446
447
447
int intel_bts_interrupt (void )
448
448
{
449
+ struct debug_store * ds = this_cpu_ptr (& cpu_hw_events )-> ds ;
449
450
struct bts_ctx * bts = this_cpu_ptr (& bts_ctx );
450
451
struct perf_event * event = bts -> handle .event ;
451
452
struct bts_buffer * buf ;
452
453
s64 old_head ;
453
- int err = - ENOSPC ;
454
+ int err = - ENOSPC , handled = 0 ;
455
+
456
+ /*
457
+ * The only surefire way of knowing if this NMI is ours is by checking
458
+ * the write ptr against the PMI threshold.
459
+ */
460
+ if (ds -> bts_index >= ds -> bts_interrupt_threshold )
461
+ handled = 1 ;
454
462
455
463
/*
456
464
* this is wrapped in intel_bts_enable_local/intel_bts_disable_local,
457
465
* so we can only be INACTIVE or STOPPED
458
466
*/
459
467
if (READ_ONCE (bts -> state ) == BTS_STATE_STOPPED )
460
- return 0 ;
468
+ return handled ;
461
469
462
470
buf = perf_get_aux (& bts -> handle );
471
+ if (!buf )
472
+ return handled ;
473
+
463
474
/*
464
475
* Skip snapshot counters: they don't use the interrupt, but
465
476
* there's no other way of telling, because the pointer will
466
477
* keep moving
467
478
*/
468
- if (! buf || buf -> snapshot )
479
+ if (buf -> snapshot )
469
480
return 0 ;
470
481
471
482
old_head = local_read (& buf -> head );
472
483
bts_update (bts );
473
484
474
485
/* no new data */
475
486
if (old_head == local_read (& buf -> head ))
476
- return 0 ;
487
+ return handled ;
477
488
478
489
perf_aux_output_end (& bts -> handle , local_xchg (& buf -> data_size , 0 ),
479
490
!!local_xchg (& buf -> lost , 0 ));
You can’t perform that action at this time.
0 commit comments