@@ -1383,7 +1383,8 @@ static void aux_output_end(struct perf_output_handle *handle)
1383
1383
te = aux_sdb_trailer (aux , aux -> alert_mark );
1384
1384
te -> flags &= ~SDB_TE_ALERT_REQ_MASK ;
1385
1385
1386
- debug_sprintf_event (sfdbg , 6 , "%s: collect %#lx SDBs\n" , __func__ , i );
1386
+ debug_sprintf_event (sfdbg , 6 , "%s: SDBs %ld range %ld head %ld\n" ,
1387
+ __func__ , i , range_scan , aux -> head );
1387
1388
}
1388
1389
1389
1390
/*
@@ -1416,6 +1417,10 @@ static int aux_output_begin(struct perf_output_handle *handle,
1416
1417
* SDBs between aux->head and aux->empty_mark are already ready
1417
1418
* for new data. range_scan is num of SDBs not within them.
1418
1419
*/
1420
+ debug_sprintf_event (sfdbg , 6 ,
1421
+ "%s: range %ld head %ld alert %ld empty %ld\n" ,
1422
+ __func__ , range , aux -> head , aux -> alert_mark ,
1423
+ aux -> empty_mark );
1419
1424
if (range > AUX_SDB_NUM_EMPTY (aux )) {
1420
1425
range_scan = range - AUX_SDB_NUM_EMPTY (aux );
1421
1426
idx = aux -> empty_mark + 1 ;
@@ -1441,15 +1446,11 @@ static int aux_output_begin(struct perf_output_handle *handle,
1441
1446
cpuhw -> lsctl .tear = base + offset * sizeof (unsigned long );
1442
1447
cpuhw -> lsctl .dear = aux -> sdb_index [head ];
1443
1448
1444
- debug_sprintf_event (sfdbg , 6 , "%s: "
1445
- "head->alert_mark->empty_mark (num_alert, range)"
1446
- "[%#lx -> %#lx -> %#lx] (%#lx, %#lx) "
1447
- "tear index %#lx, tear %#lx dear %#lx\n" , __func__ ,
1449
+ debug_sprintf_event (sfdbg , 6 , "%s: head %ld alert %ld empty %ld "
1450
+ "index %ld tear %#lx dear %#lx\n" , __func__ ,
1448
1451
aux -> head , aux -> alert_mark , aux -> empty_mark ,
1449
- AUX_SDB_NUM_ALERT (aux ), range ,
1450
1452
head / CPUM_SF_SDB_PER_TABLE ,
1451
- cpuhw -> lsctl .tear ,
1452
- cpuhw -> lsctl .dear );
1453
+ cpuhw -> lsctl .tear , cpuhw -> lsctl .dear );
1453
1454
1454
1455
return 0 ;
1455
1456
}
@@ -1512,9 +1513,12 @@ static bool aux_reset_buffer(struct aux_buffer *aux, unsigned long range,
1512
1513
unsigned long long * overflow )
1513
1514
{
1514
1515
unsigned long long orig_overflow , orig_flags , new_flags ;
1515
- unsigned long i , range_scan , idx ;
1516
+ unsigned long i , range_scan , idx , idx_old ;
1516
1517
struct hws_trailer_entry * te ;
1517
1518
1519
+ debug_sprintf_event (sfdbg , 6 , "%s: range %ld head %ld alert %ld "
1520
+ "empty %ld\n" , __func__ , range , aux -> head ,
1521
+ aux -> alert_mark , aux -> empty_mark );
1518
1522
if (range <= AUX_SDB_NUM_EMPTY (aux ))
1519
1523
/*
1520
1524
* No need to scan. All SDBs in range are marked as empty.
@@ -1537,7 +1541,7 @@ static bool aux_reset_buffer(struct aux_buffer *aux, unsigned long range,
1537
1541
* indicator fall into this range, set it.
1538
1542
*/
1539
1543
range_scan = range - AUX_SDB_NUM_EMPTY (aux );
1540
- idx = aux -> empty_mark + 1 ;
1544
+ idx_old = idx = aux -> empty_mark + 1 ;
1541
1545
for (i = 0 ; i < range_scan ; i ++ , idx ++ ) {
1542
1546
te = aux_sdb_trailer (aux , idx );
1543
1547
do {
@@ -1557,6 +1561,9 @@ static bool aux_reset_buffer(struct aux_buffer *aux, unsigned long range,
1557
1561
/* Update empty_mark to new position */
1558
1562
aux -> empty_mark = aux -> head + range - 1 ;
1559
1563
1564
+ debug_sprintf_event (sfdbg , 6 , "%s: range_scan %ld idx %ld..%ld "
1565
+ "empty %ld\n" , __func__ , range_scan , idx_old ,
1566
+ idx - 1 , aux -> empty_mark );
1560
1567
return true;
1561
1568
}
1562
1569
@@ -1570,24 +1577,24 @@ static void hw_collect_aux(struct cpu_hw_sf *cpuhw)
1570
1577
unsigned long range = 0 , size ;
1571
1578
unsigned long long overflow = 0 ;
1572
1579
struct perf_output_handle * handle = & cpuhw -> handle ;
1573
- unsigned long num_sdb ;
1574
1580
1575
1581
aux = perf_get_aux (handle );
1576
1582
if (WARN_ON_ONCE (!aux ))
1577
1583
return ;
1578
1584
1579
1585
/* Inform user space new data arrived */
1580
1586
size = AUX_SDB_NUM_ALERT (aux ) << PAGE_SHIFT ;
1587
+ debug_sprintf_event (sfdbg , 6 , "%s: #alert %ld\n" , __func__ ,
1588
+ size >> PAGE_SHIFT );
1581
1589
perf_aux_output_end (handle , size );
1582
- num_sdb = aux -> sfb .num_sdb ;
1583
1590
1584
1591
while (!done ) {
1585
1592
/* Get an output handle */
1586
1593
aux = perf_aux_output_begin (handle , cpuhw -> event );
1587
1594
if (handle -> size == 0 ) {
1588
1595
pr_err ("The AUX buffer with %lu pages for the "
1589
1596
"diagnostic-sampling mode is full\n" ,
1590
- num_sdb );
1597
+ aux -> sfb . num_sdb );
1591
1598
debug_sprintf_event (sfdbg , 1 ,
1592
1599
"%s: AUX buffer used up\n" ,
1593
1600
__func__ );
@@ -1612,26 +1619,24 @@ static void hw_collect_aux(struct cpu_hw_sf *cpuhw)
1612
1619
size = range << PAGE_SHIFT ;
1613
1620
perf_aux_output_end (& cpuhw -> handle , size );
1614
1621
pr_err ("Sample data caused the AUX buffer with %lu "
1615
- "pages to overflow\n" , num_sdb );
1616
- debug_sprintf_event (sfdbg , 1 , "%s: head %#lx range %#lx "
1617
- "overflow %#llx \n" , __func__ ,
1622
+ "pages to overflow\n" , aux -> sfb . num_sdb );
1623
+ debug_sprintf_event (sfdbg , 1 , "%s: head %ld range %ld "
1624
+ "overflow %lld \n" , __func__ ,
1618
1625
aux -> head , range , overflow );
1619
1626
} else {
1620
1627
size = AUX_SDB_NUM_ALERT (aux ) << PAGE_SHIFT ;
1621
1628
perf_aux_output_end (& cpuhw -> handle , size );
1622
- debug_sprintf_event (sfdbg , 6 , "%s: head %#lx alert %#lx "
1629
+ debug_sprintf_event (sfdbg , 6 , "%s: head %ld alert %ld "
1623
1630
"already full, try another\n" ,
1624
1631
__func__ ,
1625
1632
aux -> head , aux -> alert_mark );
1626
1633
}
1627
1634
}
1628
1635
1629
1636
if (done )
1630
- debug_sprintf_event (sfdbg , 6 , "%s: aux_reset_buffer "
1631
- "[%#lx -> %#lx -> %#lx] (%#lx, %#lx)\n" ,
1632
- __func__ , aux -> head , aux -> alert_mark ,
1633
- aux -> empty_mark , AUX_SDB_NUM_ALERT (aux ),
1634
- range );
1637
+ debug_sprintf_event (sfdbg , 6 , "%s: head %ld alert %ld "
1638
+ "empty %ld\n" , __func__ , aux -> head ,
1639
+ aux -> alert_mark , aux -> empty_mark );
1635
1640
}
1636
1641
1637
1642
/*
@@ -1654,8 +1659,7 @@ static void aux_buffer_free(void *data)
1654
1659
kfree (aux -> sdb_index );
1655
1660
kfree (aux );
1656
1661
1657
- debug_sprintf_event (sfdbg , 4 , "%s: free "
1658
- "%lu SDBTs\n" , __func__ , num_sdbt );
1662
+ debug_sprintf_event (sfdbg , 4 , "%s: SDBTs %lu\n" , __func__ , num_sdbt );
1659
1663
}
1660
1664
1661
1665
static void aux_sdb_init (unsigned long sdb )
@@ -1763,8 +1767,8 @@ static void *aux_buffer_setup(struct perf_event *event, void **pages,
1763
1767
*/
1764
1768
aux -> empty_mark = sfb -> num_sdb - 1 ;
1765
1769
1766
- debug_sprintf_event (sfdbg , 4 , "%s: setup %lu SDBTs and %lu SDBs \n" ,
1767
- __func__ , sfb -> num_sdbt , sfb -> num_sdb );
1770
+ debug_sprintf_event (sfdbg , 4 , "%s: SDBTs %lu SDBs %lu\n" , __func__ ,
1771
+ sfb -> num_sdbt , sfb -> num_sdb );
1768
1772
1769
1773
return aux ;
1770
1774
0 commit comments