Skip to content

Commit ee5c4cc

Browse files
Thomas RichterVasily Gorbik
authored andcommitted
s390/cpum_sf: Convert debug trace to common layout
Convert debug traces to print the head/alert/empty marks consistently as decimal numbers. Add some trace statements to enable easier debugging during auxiliary tracing. Signed-off-by: Thomas Richter <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]>
1 parent 576c75e commit ee5c4cc

File tree

1 file changed

+30
-26
lines changed

1 file changed

+30
-26
lines changed

arch/s390/kernel/perf_cpum_sf.c

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,7 +1383,8 @@ static void aux_output_end(struct perf_output_handle *handle)
13831383
te = aux_sdb_trailer(aux, aux->alert_mark);
13841384
te->flags &= ~SDB_TE_ALERT_REQ_MASK;
13851385

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);
13871388
}
13881389

13891390
/*
@@ -1416,6 +1417,10 @@ static int aux_output_begin(struct perf_output_handle *handle,
14161417
* SDBs between aux->head and aux->empty_mark are already ready
14171418
* for new data. range_scan is num of SDBs not within them.
14181419
*/
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);
14191424
if (range > AUX_SDB_NUM_EMPTY(aux)) {
14201425
range_scan = range - AUX_SDB_NUM_EMPTY(aux);
14211426
idx = aux->empty_mark + 1;
@@ -1441,15 +1446,11 @@ static int aux_output_begin(struct perf_output_handle *handle,
14411446
cpuhw->lsctl.tear = base + offset * sizeof(unsigned long);
14421447
cpuhw->lsctl.dear = aux->sdb_index[head];
14431448

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__,
14481451
aux->head, aux->alert_mark, aux->empty_mark,
1449-
AUX_SDB_NUM_ALERT(aux), range,
14501452
head / CPUM_SF_SDB_PER_TABLE,
1451-
cpuhw->lsctl.tear,
1452-
cpuhw->lsctl.dear);
1453+
cpuhw->lsctl.tear, cpuhw->lsctl.dear);
14531454

14541455
return 0;
14551456
}
@@ -1512,9 +1513,12 @@ static bool aux_reset_buffer(struct aux_buffer *aux, unsigned long range,
15121513
unsigned long long *overflow)
15131514
{
15141515
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;
15161517
struct hws_trailer_entry *te;
15171518

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);
15181522
if (range <= AUX_SDB_NUM_EMPTY(aux))
15191523
/*
15201524
* 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,
15371541
* indicator fall into this range, set it.
15381542
*/
15391543
range_scan = range - AUX_SDB_NUM_EMPTY(aux);
1540-
idx = aux->empty_mark + 1;
1544+
idx_old = idx = aux->empty_mark + 1;
15411545
for (i = 0; i < range_scan; i++, idx++) {
15421546
te = aux_sdb_trailer(aux, idx);
15431547
do {
@@ -1557,6 +1561,9 @@ static bool aux_reset_buffer(struct aux_buffer *aux, unsigned long range,
15571561
/* Update empty_mark to new position */
15581562
aux->empty_mark = aux->head + range - 1;
15591563

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);
15601567
return true;
15611568
}
15621569

@@ -1570,24 +1577,24 @@ static void hw_collect_aux(struct cpu_hw_sf *cpuhw)
15701577
unsigned long range = 0, size;
15711578
unsigned long long overflow = 0;
15721579
struct perf_output_handle *handle = &cpuhw->handle;
1573-
unsigned long num_sdb;
15741580

15751581
aux = perf_get_aux(handle);
15761582
if (WARN_ON_ONCE(!aux))
15771583
return;
15781584

15791585
/* Inform user space new data arrived */
15801586
size = AUX_SDB_NUM_ALERT(aux) << PAGE_SHIFT;
1587+
debug_sprintf_event(sfdbg, 6, "%s: #alert %ld\n", __func__,
1588+
size >> PAGE_SHIFT);
15811589
perf_aux_output_end(handle, size);
1582-
num_sdb = aux->sfb.num_sdb;
15831590

15841591
while (!done) {
15851592
/* Get an output handle */
15861593
aux = perf_aux_output_begin(handle, cpuhw->event);
15871594
if (handle->size == 0) {
15881595
pr_err("The AUX buffer with %lu pages for the "
15891596
"diagnostic-sampling mode is full\n",
1590-
num_sdb);
1597+
aux->sfb.num_sdb);
15911598
debug_sprintf_event(sfdbg, 1,
15921599
"%s: AUX buffer used up\n",
15931600
__func__);
@@ -1612,26 +1619,24 @@ static void hw_collect_aux(struct cpu_hw_sf *cpuhw)
16121619
size = range << PAGE_SHIFT;
16131620
perf_aux_output_end(&cpuhw->handle, size);
16141621
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__,
16181625
aux->head, range, overflow);
16191626
} else {
16201627
size = AUX_SDB_NUM_ALERT(aux) << PAGE_SHIFT;
16211628
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 "
16231630
"already full, try another\n",
16241631
__func__,
16251632
aux->head, aux->alert_mark);
16261633
}
16271634
}
16281635

16291636
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);
16351640
}
16361641

16371642
/*
@@ -1654,8 +1659,7 @@ static void aux_buffer_free(void *data)
16541659
kfree(aux->sdb_index);
16551660
kfree(aux);
16561661

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);
16591663
}
16601664

16611665
static void aux_sdb_init(unsigned long sdb)
@@ -1763,8 +1767,8 @@ static void *aux_buffer_setup(struct perf_event *event, void **pages,
17631767
*/
17641768
aux->empty_mark = sfb->num_sdb - 1;
17651769

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);
17681772

17691773
return aux;
17701774

0 commit comments

Comments
 (0)