Commit d98b5d07 authored by Thomas Richter's avatar Thomas Richter Committed by Vasily Gorbik

s390/cpum_sf: Use consistant debug print format for sampling

Use consistant debug print format of the form variable
blank value. Also add leading 0x for all hex values.
Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
parent c2f2093e
...@@ -157,7 +157,7 @@ static void free_sampling_buffer(struct sf_buffer *sfb) ...@@ -157,7 +157,7 @@ static void free_sampling_buffer(struct sf_buffer *sfb)
} }
debug_sprintf_event(sfdbg, 5, debug_sprintf_event(sfdbg, 5,
"free_sampling_buffer: freed sdbt=%p\n", sfb->sdbt); "free_sampling_buffer: freed sdbt %p\n", sfb->sdbt);
memset(sfb, 0, sizeof(*sfb)); memset(sfb, 0, sizeof(*sfb));
} }
...@@ -213,9 +213,9 @@ static int realloc_sampling_buffer(struct sf_buffer *sfb, ...@@ -213,9 +213,9 @@ static int realloc_sampling_buffer(struct sf_buffer *sfb,
*/ */
if (sfb->sdbt != get_next_sdbt(tail)) { if (sfb->sdbt != get_next_sdbt(tail)) {
debug_sprintf_event(sfdbg, 3, "realloc_sampling_buffer: " debug_sprintf_event(sfdbg, 3, "realloc_sampling_buffer: "
"sampling buffer is not linked: origin=%p" "sampling buffer is not linked: origin %p"
"tail=%p\n", " tail %p\n",
(void *) sfb->sdbt, (void *) tail); (void *)sfb->sdbt, (void *)tail);
return -EINVAL; return -EINVAL;
} }
...@@ -252,7 +252,7 @@ static int realloc_sampling_buffer(struct sf_buffer *sfb, ...@@ -252,7 +252,7 @@ static int realloc_sampling_buffer(struct sf_buffer *sfb,
sfb->tail = tail; sfb->tail = tail;
debug_sprintf_event(sfdbg, 4, "realloc_sampling_buffer: new buffer" debug_sprintf_event(sfdbg, 4, "realloc_sampling_buffer: new buffer"
" settings: sdbt=%lu sdb=%lu\n", " settings: sdbt %lu sdb %lu\n",
sfb->num_sdbt, sfb->num_sdb); sfb->num_sdbt, sfb->num_sdb);
return rc; return rc;
} }
...@@ -293,11 +293,11 @@ static int alloc_sampling_buffer(struct sf_buffer *sfb, unsigned long num_sdb) ...@@ -293,11 +293,11 @@ static int alloc_sampling_buffer(struct sf_buffer *sfb, unsigned long num_sdb)
if (rc) { if (rc) {
free_sampling_buffer(sfb); free_sampling_buffer(sfb);
debug_sprintf_event(sfdbg, 4, "alloc_sampling_buffer: " debug_sprintf_event(sfdbg, 4, "alloc_sampling_buffer: "
"realloc_sampling_buffer failed with rc=%i\n", rc); "realloc_sampling_buffer failed with rc %i\n", rc);
} else } else
debug_sprintf_event(sfdbg, 4, debug_sprintf_event(sfdbg, 4,
"alloc_sampling_buffer: tear=%p dear=%p\n", "alloc_sampling_buffer: tear %p dear %p\n",
sfb->sdbt, (void *) *sfb->sdbt); sfb->sdbt, (void *)*sfb->sdbt);
return rc; return rc;
} }
...@@ -404,8 +404,8 @@ static int allocate_buffers(struct cpu_hw_sf *cpuhw, struct hw_perf_event *hwc) ...@@ -404,8 +404,8 @@ static int allocate_buffers(struct cpu_hw_sf *cpuhw, struct hw_perf_event *hwc)
return 0; return 0;
debug_sprintf_event(sfdbg, 3, debug_sprintf_event(sfdbg, 3,
"allocate_buffers: rate=%lu f=%lu sdb=%lu/%lu" "allocate_buffers: rate %lu f %lu sdb %lu/%lu"
" sample_size=%lu cpuhw=%p\n", " sample_size %lu cpuhw %p\n",
SAMPL_RATE(hwc), freq, n_sdb, sfb_max_limit(hwc), SAMPL_RATE(hwc), freq, n_sdb, sfb_max_limit(hwc),
sample_size, cpuhw); sample_size, cpuhw);
...@@ -465,8 +465,8 @@ static void sfb_account_overflows(struct cpu_hw_sf *cpuhw, ...@@ -465,8 +465,8 @@ static void sfb_account_overflows(struct cpu_hw_sf *cpuhw,
if (num) if (num)
sfb_account_allocs(num, hwc); sfb_account_allocs(num, hwc);
debug_sprintf_event(sfdbg, 5, "sfb: overflow: overflow=%llu ratio=%lu" debug_sprintf_event(sfdbg, 5, "sfb: overflow: overflow %llu ratio %lu"
" num=%lu\n", OVERFLOW_REG(hwc), ratio, num); " num %lu\n", OVERFLOW_REG(hwc), ratio, num);
OVERFLOW_REG(hwc) = 0; OVERFLOW_REG(hwc) = 0;
} }
...@@ -505,11 +505,11 @@ static void extend_sampling_buffer(struct sf_buffer *sfb, ...@@ -505,11 +505,11 @@ static void extend_sampling_buffer(struct sf_buffer *sfb,
rc = realloc_sampling_buffer(sfb, num, GFP_ATOMIC); rc = realloc_sampling_buffer(sfb, num, GFP_ATOMIC);
if (rc) if (rc)
debug_sprintf_event(sfdbg, 5, "sfb: extend: realloc " debug_sprintf_event(sfdbg, 5, "sfb: extend: realloc "
"failed with rc=%i\n", rc); "failed with rc %i\n", rc);
if (sfb_has_pending_allocs(sfb, hwc)) if (sfb_has_pending_allocs(sfb, hwc))
debug_sprintf_event(sfdbg, 5, "sfb: extend: " debug_sprintf_event(sfdbg, 5, "sfb: extend: "
"req=%lu alloc=%lu remaining=%lu\n", "req %lu alloc %lu remaining %lu\n",
num, sfb->num_sdb - num_old, num, sfb->num_sdb - num_old,
sfb_pending_allocs(sfb, hwc)); sfb_pending_allocs(sfb, hwc));
} }
...@@ -538,20 +538,22 @@ static void setup_pmc_cpu(void *flags) ...@@ -538,20 +538,22 @@ static void setup_pmc_cpu(void *flags)
err = sf_disable(); err = sf_disable();
if (err) if (err)
pr_err("Switching off the sampling facility failed " pr_err("Switching off the sampling facility failed "
"with rc=%i\n", err); "with rc %i\n", err);
debug_sprintf_event(sfdbg, 5, debug_sprintf_event(sfdbg, 5,
"setup_pmc_cpu: initialized: cpuhw=%p\n", cpusf); "setup_pmc_cpu: initialized: cpuhw %p\n",
cpusf);
break; break;
case PMC_RELEASE: case PMC_RELEASE:
cpusf->flags &= ~PMU_F_RESERVED; cpusf->flags &= ~PMU_F_RESERVED;
err = sf_disable(); err = sf_disable();
if (err) { if (err) {
pr_err("Switching off the sampling facility failed " pr_err("Switching off the sampling facility failed "
"with rc=%i\n", err); "with rc %i\n", err);
} else } else
deallocate_buffers(cpusf); deallocate_buffers(cpusf);
debug_sprintf_event(sfdbg, 5, debug_sprintf_event(sfdbg, 5,
"setup_pmc_cpu: released: cpuhw=%p\n", cpusf); "setup_pmc_cpu: released: cpuhw %p\n",
cpusf);
break; break;
} }
if (err) if (err)
...@@ -744,7 +746,7 @@ static int __hw_perf_event_init_rate(struct perf_event *event, ...@@ -744,7 +746,7 @@ static int __hw_perf_event_init_rate(struct perf_event *event,
SAMPL_RATE(hwc) = rate; SAMPL_RATE(hwc) = rate;
hw_init_period(hwc, SAMPL_RATE(hwc)); hw_init_period(hwc, SAMPL_RATE(hwc));
debug_sprintf_event(sfdbg, 4, "__hw_perf_event_init_rate:" debug_sprintf_event(sfdbg, 4, "__hw_perf_event_init_rate:"
"cpu:%d period:%llx freq:%d,%#lx\n", event->cpu, "cpu:%d period:%#llx freq:%d,%#lx\n", event->cpu,
event->attr.sample_period, event->attr.freq, event->attr.sample_period, event->attr.freq,
SAMPLE_FREQ_MODE(hwc)); SAMPLE_FREQ_MODE(hwc));
return 0; return 0;
...@@ -963,7 +965,7 @@ static void cpumsf_pmu_enable(struct pmu *pmu) ...@@ -963,7 +965,7 @@ static void cpumsf_pmu_enable(struct pmu *pmu)
err = lsctl(&cpuhw->lsctl); err = lsctl(&cpuhw->lsctl);
if (err) { if (err) {
cpuhw->flags &= ~PMU_F_ENABLED; cpuhw->flags &= ~PMU_F_ENABLED;
pr_err("Loading sampling controls failed: op=%i err=%i\n", pr_err("Loading sampling controls failed: op %i err %i\n",
1, err); 1, err);
return; return;
} }
...@@ -971,8 +973,8 @@ static void cpumsf_pmu_enable(struct pmu *pmu) ...@@ -971,8 +973,8 @@ static void cpumsf_pmu_enable(struct pmu *pmu)
/* Load current program parameter */ /* Load current program parameter */
lpp(&S390_lowcore.lpp); lpp(&S390_lowcore.lpp);
debug_sprintf_event(sfdbg, 6, "pmu_enable: es=%i cs=%i ed=%i cd=%i " debug_sprintf_event(sfdbg, 6, "pmu_enable: es %i cs %i ed %i cd %i "
"interval:%lx tear=%p dear=%p\n", "interval %#lx tear %p dear %p\n",
cpuhw->lsctl.es, cpuhw->lsctl.cs, cpuhw->lsctl.ed, cpuhw->lsctl.es, cpuhw->lsctl.cs, cpuhw->lsctl.ed,
cpuhw->lsctl.cd, cpuhw->lsctl.interval, cpuhw->lsctl.cd, cpuhw->lsctl.interval,
(void *) cpuhw->lsctl.tear, (void *) cpuhw->lsctl.tear,
...@@ -999,7 +1001,7 @@ static void cpumsf_pmu_disable(struct pmu *pmu) ...@@ -999,7 +1001,7 @@ static void cpumsf_pmu_disable(struct pmu *pmu)
err = lsctl(&inactive); err = lsctl(&inactive);
if (err) { if (err) {
pr_err("Loading sampling controls failed: op=%i err=%i\n", pr_err("Loading sampling controls failed: op %i err %i\n",
2, err); 2, err);
return; return;
} }
...@@ -1017,7 +1019,7 @@ static void cpumsf_pmu_disable(struct pmu *pmu) ...@@ -1017,7 +1019,7 @@ static void cpumsf_pmu_disable(struct pmu *pmu)
} }
} else } else
debug_sprintf_event(sfdbg, 3, "cpumsf_pmu_disable: " debug_sprintf_event(sfdbg, 3, "cpumsf_pmu_disable: "
"qsi() failed with err=%i\n", err); "qsi() failed with err %i\n", err);
cpuhw->flags &= ~PMU_F_ENABLED; cpuhw->flags &= ~PMU_F_ENABLED;
} }
...@@ -1130,15 +1132,6 @@ static void perf_event_count_update(struct perf_event *event, u64 count) ...@@ -1130,15 +1132,6 @@ static void perf_event_count_update(struct perf_event *event, u64 count)
local64_add(count, &event->count); local64_add(count, &event->count);
} }
static void debug_sample_entry(struct hws_basic_entry *sample,
struct hws_trailer_entry *te)
{
debug_sprintf_event(sfdbg, 4, "hw_collect_samples: Found unknown "
"sampling data entry: te->f=%i basic.def=%04x "
"(%p)\n",
te->f, sample->def, sample);
}
/* hw_collect_samples() - Walk through a sample-data-block and collect samples /* hw_collect_samples() - Walk through a sample-data-block and collect samples
* @event: The perf event * @event: The perf event
* @sdbt: Sample-data-block table * @sdbt: Sample-data-block table
...@@ -1192,7 +1185,11 @@ static void hw_collect_samples(struct perf_event *event, unsigned long *sdbt, ...@@ -1192,7 +1185,11 @@ static void hw_collect_samples(struct perf_event *event, unsigned long *sdbt,
/* Count discarded samples */ /* Count discarded samples */
*overflow += 1; *overflow += 1;
} else { } else {
debug_sample_entry(sample, te); debug_sprintf_event(sfdbg, 4,
"hw_collect_samples: Found unknown"
" sampling data entry: te->f %i"
" basic.def %#4x (%p)\n",
te->f, sample->def, sample);
/* Sample slot is not yet written or other record. /* Sample slot is not yet written or other record.
* *
* This condition can occur if the buffer was reused * This condition can occur if the buffer was reused
...@@ -1267,8 +1264,8 @@ static void hw_perf_event_update(struct perf_event *event, int flush_all) ...@@ -1267,8 +1264,8 @@ static void hw_perf_event_update(struct perf_event *event, int flush_all)
sampl_overflow += te->overflow; sampl_overflow += te->overflow;
/* Timestamps are valid for full sample-data-blocks only */ /* Timestamps are valid for full sample-data-blocks only */
debug_sprintf_event(sfdbg, 6, "hw_perf_event_update: sdbt=%p " debug_sprintf_event(sfdbg, 6, "hw_perf_event_update: sdbt %p "
"overflow=%llu timestamp=%#llx\n", "overflow %llu timestamp %#llx\n",
sdbt, te->overflow, sdbt, te->overflow,
(te->f) ? trailer_timestamp(te) : 0ULL); (te->f) ? trailer_timestamp(te) : 0ULL);
...@@ -1314,7 +1311,7 @@ static void hw_perf_event_update(struct perf_event *event, int flush_all) ...@@ -1314,7 +1311,7 @@ static void hw_perf_event_update(struct perf_event *event, int flush_all)
sampl_overflow, 1 + num_sdb); sampl_overflow, 1 + num_sdb);
if (sampl_overflow || event_overflow) if (sampl_overflow || event_overflow)
debug_sprintf_event(sfdbg, 4, "hw_perf_event_update: " debug_sprintf_event(sfdbg, 4, "hw_perf_event_update: "
"overflow stats: sample=%llu event=%llu\n", "overflow stats: sample %llu event %llu\n",
sampl_overflow, event_overflow); sampl_overflow, event_overflow);
} }
...@@ -1368,7 +1365,7 @@ static void aux_output_end(struct perf_output_handle *handle) ...@@ -1368,7 +1365,7 @@ 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, "aux_output_end: collect %lx SDBs\n", i); debug_sprintf_event(sfdbg, 6, "aux_output_end: collect %#lx SDBs\n", i);
} }
/* /*
...@@ -1428,8 +1425,8 @@ static int aux_output_begin(struct perf_output_handle *handle, ...@@ -1428,8 +1425,8 @@ static int aux_output_begin(struct perf_output_handle *handle,
debug_sprintf_event(sfdbg, 6, "aux_output_begin: " debug_sprintf_event(sfdbg, 6, "aux_output_begin: "
"head->alert_mark->empty_mark (num_alert, range)" "head->alert_mark->empty_mark (num_alert, range)"
"[%lx -> %lx -> %lx] (%lx, %lx) " "[%#lx -> %#lx -> %#lx] (%#lx, %#lx) "
"tear index %lx, tear %lx dear %lx\n", "tear index %#lx, tear %#lx dear %#lx\n",
aux->head, aux->alert_mark, aux->empty_mark, aux->head, aux->alert_mark, aux->empty_mark,
AUX_SDB_NUM_ALERT(aux), range, AUX_SDB_NUM_ALERT(aux), range,
head / CPUM_SF_SDB_PER_TABLE, head / CPUM_SF_SDB_PER_TABLE,
...@@ -1596,13 +1593,13 @@ static void hw_collect_aux(struct cpu_hw_sf *cpuhw) ...@@ -1596,13 +1593,13 @@ static void hw_collect_aux(struct cpu_hw_sf *cpuhw)
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", num_sdb);
debug_sprintf_event(sfdbg, 1, "head %lx range %lx " debug_sprintf_event(sfdbg, 1, "head %#lx range %#lx "
"overflow %llx\n", "overflow %#llx\n",
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, "head %lx alert %lx " debug_sprintf_event(sfdbg, 6, "head %#lx alert %#lx "
"already full, try another\n", "already full, try another\n",
aux->head, aux->alert_mark); aux->head, aux->alert_mark);
} }
...@@ -1610,7 +1607,7 @@ static void hw_collect_aux(struct cpu_hw_sf *cpuhw) ...@@ -1610,7 +1607,7 @@ static void hw_collect_aux(struct cpu_hw_sf *cpuhw)
if (done) if (done)
debug_sprintf_event(sfdbg, 6, "aux_reset_buffer: " debug_sprintf_event(sfdbg, 6, "aux_reset_buffer: "
"[%lx -> %lx -> %lx] (%lx, %lx)\n", "[%#lx -> %#lx -> %#lx] (%#lx, %#lx)\n",
aux->head, aux->alert_mark, aux->empty_mark, aux->head, aux->alert_mark, aux->empty_mark,
AUX_SDB_NUM_ALERT(aux), range); AUX_SDB_NUM_ALERT(aux), range);
} }
...@@ -1800,7 +1797,7 @@ static int cpumsf_pmu_check_period(struct perf_event *event, u64 value) ...@@ -1800,7 +1797,7 @@ static int cpumsf_pmu_check_period(struct perf_event *event, u64 value)
SAMPL_RATE(&event->hw) = rate; SAMPL_RATE(&event->hw) = rate;
hw_init_period(&event->hw, SAMPL_RATE(&event->hw)); hw_init_period(&event->hw, SAMPL_RATE(&event->hw));
debug_sprintf_event(sfdbg, 4, "cpumsf_pmu_check_period:" debug_sprintf_event(sfdbg, 4, "cpumsf_pmu_check_period:"
"cpu:%d value:%llx period:%llx freq:%d\n", "cpu:%d value:%#llx period:%#llx freq:%d\n",
event->cpu, value, event->cpu, value,
event->attr.sample_period, do_freq); event->attr.sample_period, do_freq);
return 0; return 0;
...@@ -2111,7 +2108,7 @@ static int param_set_sfb_size(const char *val, const struct kernel_param *kp) ...@@ -2111,7 +2108,7 @@ static int param_set_sfb_size(const char *val, const struct kernel_param *kp)
sfb_set_limits(min, max); sfb_set_limits(min, max);
pr_info("The sampling buffer limits have changed to: " pr_info("The sampling buffer limits have changed to: "
"min=%lu max=%lu (diag=x%lu)\n", "min %lu max %lu (diag %lu)\n",
CPUM_SF_MIN_SDB, CPUM_SF_MAX_SDB, CPUM_SF_SDB_DIAG_FACTOR); CPUM_SF_MIN_SDB, CPUM_SF_MAX_SDB, CPUM_SF_SDB_DIAG_FACTOR);
return 0; return 0;
} }
...@@ -2129,7 +2126,7 @@ static const struct kernel_param_ops param_ops_sfb_size = { ...@@ -2129,7 +2126,7 @@ static const struct kernel_param_ops param_ops_sfb_size = {
static void __init pr_cpumsf_err(unsigned int reason) static void __init pr_cpumsf_err(unsigned int reason)
{ {
pr_err("Sampling facility support for perf is not available: " pr_err("Sampling facility support for perf is not available: "
"reason=%04x\n", reason); "reason %#x\n", reason);
} }
static int __init init_cpum_sampling_pmu(void) static int __init init_cpum_sampling_pmu(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment