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 <tmricht@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
This commit is contained in:
Thomas Richter 2019-12-17 15:07:35 +01:00 committed by Vasily Gorbik
parent 576c75e36c
commit ee5c4ccfd5

View file

@ -1383,7 +1383,8 @@ static void aux_output_end(struct perf_output_handle *handle)
te = aux_sdb_trailer(aux, aux->alert_mark); te = aux_sdb_trailer(aux, aux->alert_mark);
te->flags &= ~SDB_TE_ALERT_REQ_MASK; te->flags &= ~SDB_TE_ALERT_REQ_MASK;
debug_sprintf_event(sfdbg, 6, "%s: collect %#lx SDBs\n", __func__, i); debug_sprintf_event(sfdbg, 6, "%s: SDBs %ld range %ld head %ld\n",
__func__, i, range_scan, aux->head);
} }
/* /*
@ -1416,6 +1417,10 @@ static int aux_output_begin(struct perf_output_handle *handle,
* SDBs between aux->head and aux->empty_mark are already ready * SDBs between aux->head and aux->empty_mark are already ready
* for new data. range_scan is num of SDBs not within them. * for new data. range_scan is num of SDBs not within them.
*/ */
debug_sprintf_event(sfdbg, 6,
"%s: range %ld head %ld alert %ld empty %ld\n",
__func__, range, aux->head, aux->alert_mark,
aux->empty_mark);
if (range > AUX_SDB_NUM_EMPTY(aux)) { if (range > AUX_SDB_NUM_EMPTY(aux)) {
range_scan = range - AUX_SDB_NUM_EMPTY(aux); range_scan = range - AUX_SDB_NUM_EMPTY(aux);
idx = aux->empty_mark + 1; idx = aux->empty_mark + 1;
@ -1441,15 +1446,11 @@ static int aux_output_begin(struct perf_output_handle *handle,
cpuhw->lsctl.tear = base + offset * sizeof(unsigned long); cpuhw->lsctl.tear = base + offset * sizeof(unsigned long);
cpuhw->lsctl.dear = aux->sdb_index[head]; cpuhw->lsctl.dear = aux->sdb_index[head];
debug_sprintf_event(sfdbg, 6, "%s: " debug_sprintf_event(sfdbg, 6, "%s: head %ld alert %ld empty %ld "
"head->alert_mark->empty_mark (num_alert, range)" "index %ld tear %#lx dear %#lx\n", __func__,
"[%#lx -> %#lx -> %#lx] (%#lx, %#lx) "
"tear index %#lx, tear %#lx dear %#lx\n", __func__,
aux->head, aux->alert_mark, aux->empty_mark, aux->head, aux->alert_mark, aux->empty_mark,
AUX_SDB_NUM_ALERT(aux), range,
head / CPUM_SF_SDB_PER_TABLE, head / CPUM_SF_SDB_PER_TABLE,
cpuhw->lsctl.tear, cpuhw->lsctl.tear, cpuhw->lsctl.dear);
cpuhw->lsctl.dear);
return 0; return 0;
} }
@ -1512,9 +1513,12 @@ static bool aux_reset_buffer(struct aux_buffer *aux, unsigned long range,
unsigned long long *overflow) unsigned long long *overflow)
{ {
unsigned long long orig_overflow, orig_flags, new_flags; unsigned long long orig_overflow, orig_flags, new_flags;
unsigned long i, range_scan, idx; unsigned long i, range_scan, idx, idx_old;
struct hws_trailer_entry *te; struct hws_trailer_entry *te;
debug_sprintf_event(sfdbg, 6, "%s: range %ld head %ld alert %ld "
"empty %ld\n", __func__, range, aux->head,
aux->alert_mark, aux->empty_mark);
if (range <= AUX_SDB_NUM_EMPTY(aux)) if (range <= AUX_SDB_NUM_EMPTY(aux))
/* /*
* No need to scan. All SDBs in range are marked as empty. * 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,
* indicator fall into this range, set it. * indicator fall into this range, set it.
*/ */
range_scan = range - AUX_SDB_NUM_EMPTY(aux); range_scan = range - AUX_SDB_NUM_EMPTY(aux);
idx = aux->empty_mark + 1; idx_old = idx = aux->empty_mark + 1;
for (i = 0; i < range_scan; i++, idx++) { for (i = 0; i < range_scan; i++, idx++) {
te = aux_sdb_trailer(aux, idx); te = aux_sdb_trailer(aux, idx);
do { do {
@ -1557,6 +1561,9 @@ static bool aux_reset_buffer(struct aux_buffer *aux, unsigned long range,
/* Update empty_mark to new position */ /* Update empty_mark to new position */
aux->empty_mark = aux->head + range - 1; aux->empty_mark = aux->head + range - 1;
debug_sprintf_event(sfdbg, 6, "%s: range_scan %ld idx %ld..%ld "
"empty %ld\n", __func__, range_scan, idx_old,
idx - 1, aux->empty_mark);
return true; return true;
} }
@ -1570,7 +1577,6 @@ static void hw_collect_aux(struct cpu_hw_sf *cpuhw)
unsigned long range = 0, size; unsigned long range = 0, size;
unsigned long long overflow = 0; unsigned long long overflow = 0;
struct perf_output_handle *handle = &cpuhw->handle; struct perf_output_handle *handle = &cpuhw->handle;
unsigned long num_sdb;
aux = perf_get_aux(handle); aux = perf_get_aux(handle);
if (WARN_ON_ONCE(!aux)) if (WARN_ON_ONCE(!aux))
@ -1578,8 +1584,9 @@ static void hw_collect_aux(struct cpu_hw_sf *cpuhw)
/* Inform user space new data arrived */ /* Inform user space new data arrived */
size = AUX_SDB_NUM_ALERT(aux) << PAGE_SHIFT; size = AUX_SDB_NUM_ALERT(aux) << PAGE_SHIFT;
debug_sprintf_event(sfdbg, 6, "%s: #alert %ld\n", __func__,
size >> PAGE_SHIFT);
perf_aux_output_end(handle, size); perf_aux_output_end(handle, size);
num_sdb = aux->sfb.num_sdb;
while (!done) { while (!done) {
/* Get an output handle */ /* Get an output handle */
@ -1587,7 +1594,7 @@ static void hw_collect_aux(struct cpu_hw_sf *cpuhw)
if (handle->size == 0) { if (handle->size == 0) {
pr_err("The AUX buffer with %lu pages for the " pr_err("The AUX buffer with %lu pages for the "
"diagnostic-sampling mode is full\n", "diagnostic-sampling mode is full\n",
num_sdb); aux->sfb.num_sdb);
debug_sprintf_event(sfdbg, 1, debug_sprintf_event(sfdbg, 1,
"%s: AUX buffer used up\n", "%s: AUX buffer used up\n",
__func__); __func__);
@ -1612,14 +1619,14 @@ static void hw_collect_aux(struct cpu_hw_sf *cpuhw)
size = range << PAGE_SHIFT; size = range << PAGE_SHIFT;
perf_aux_output_end(&cpuhw->handle, size); perf_aux_output_end(&cpuhw->handle, size);
pr_err("Sample data caused the AUX buffer with %lu " pr_err("Sample data caused the AUX buffer with %lu "
"pages to overflow\n", num_sdb); "pages to overflow\n", aux->sfb.num_sdb);
debug_sprintf_event(sfdbg, 1, "%s: head %#lx range %#lx " debug_sprintf_event(sfdbg, 1, "%s: head %ld range %ld "
"overflow %#llx\n", __func__, "overflow %lld\n", __func__,
aux->head, range, overflow); aux->head, range, overflow);
} else { } else {
size = AUX_SDB_NUM_ALERT(aux) << PAGE_SHIFT; size = AUX_SDB_NUM_ALERT(aux) << PAGE_SHIFT;
perf_aux_output_end(&cpuhw->handle, size); perf_aux_output_end(&cpuhw->handle, size);
debug_sprintf_event(sfdbg, 6, "%s: head %#lx alert %#lx " debug_sprintf_event(sfdbg, 6, "%s: head %ld alert %ld "
"already full, try another\n", "already full, try another\n",
__func__, __func__,
aux->head, aux->alert_mark); aux->head, aux->alert_mark);
@ -1627,11 +1634,9 @@ static void hw_collect_aux(struct cpu_hw_sf *cpuhw)
} }
if (done) if (done)
debug_sprintf_event(sfdbg, 6, "%s: aux_reset_buffer " debug_sprintf_event(sfdbg, 6, "%s: head %ld alert %ld "
"[%#lx -> %#lx -> %#lx] (%#lx, %#lx)\n", "empty %ld\n", __func__, aux->head,
__func__, aux->head, aux->alert_mark, aux->alert_mark, aux->empty_mark);
aux->empty_mark, AUX_SDB_NUM_ALERT(aux),
range);
} }
/* /*
@ -1654,8 +1659,7 @@ static void aux_buffer_free(void *data)
kfree(aux->sdb_index); kfree(aux->sdb_index);
kfree(aux); kfree(aux);
debug_sprintf_event(sfdbg, 4, "%s: free " debug_sprintf_event(sfdbg, 4, "%s: SDBTs %lu\n", __func__, num_sdbt);
"%lu SDBTs\n", __func__, num_sdbt);
} }
static void aux_sdb_init(unsigned long sdb) static void aux_sdb_init(unsigned long sdb)
@ -1763,8 +1767,8 @@ static void *aux_buffer_setup(struct perf_event *event, void **pages,
*/ */
aux->empty_mark = sfb->num_sdb - 1; aux->empty_mark = sfb->num_sdb - 1;
debug_sprintf_event(sfdbg, 4, "%s: setup %lu SDBTs and %lu SDBs\n", debug_sprintf_event(sfdbg, 4, "%s: SDBTs %lu SDBs %lu\n", __func__,
__func__, sfb->num_sdbt, sfb->num_sdb); sfb->num_sdbt, sfb->num_sdb);
return aux; return aux;