@@ -1491,6 +1491,25 @@ static void intel_pmu_drain_pebs_core(struct pt_regs *iregs)
1491
1491
__intel_pmu_pebs_event (event , iregs , at , top , 0 , n );
1492
1492
}
1493
1493
1494
+ static void intel_pmu_pebs_event_update_no_drain (struct cpu_hw_events * cpuc , int size )
1495
+ {
1496
+ struct perf_event * event ;
1497
+ int bit ;
1498
+
1499
+ /*
1500
+ * The drain_pebs() could be called twice in a short period
1501
+ * for auto-reload event in pmu::read(). There are no
1502
+ * overflows have happened in between.
1503
+ * It needs to call intel_pmu_save_and_restart_reload() to
1504
+ * update the event->count for this case.
1505
+ */
1506
+ for_each_set_bit (bit , (unsigned long * )& cpuc -> pebs_enabled , size ) {
1507
+ event = cpuc -> events [bit ];
1508
+ if (event -> hw .flags & PERF_X86_EVENT_AUTO_RELOAD )
1509
+ intel_pmu_save_and_restart_reload (event , 0 );
1510
+ }
1511
+ }
1512
+
1494
1513
static void intel_pmu_drain_pebs_nhm (struct pt_regs * iregs )
1495
1514
{
1496
1515
struct cpu_hw_events * cpuc = this_cpu_ptr (& cpu_hw_events );
@@ -1518,19 +1537,7 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)
1518
1537
}
1519
1538
1520
1539
if (unlikely (base >= top )) {
1521
- /*
1522
- * The drain_pebs() could be called twice in a short period
1523
- * for auto-reload event in pmu::read(). There are no
1524
- * overflows have happened in between.
1525
- * It needs to call intel_pmu_save_and_restart_reload() to
1526
- * update the event->count for this case.
1527
- */
1528
- for_each_set_bit (bit , (unsigned long * )& cpuc -> pebs_enabled ,
1529
- size ) {
1530
- event = cpuc -> events [bit ];
1531
- if (event -> hw .flags & PERF_X86_EVENT_AUTO_RELOAD )
1532
- intel_pmu_save_and_restart_reload (event , 0 );
1533
- }
1540
+ intel_pmu_pebs_event_update_no_drain (cpuc , size );
1534
1541
return ;
1535
1542
}
1536
1543
0 commit comments