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

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
Loading
Loading
Loading
Loading
+44 −47
Original line number Diff line number Diff line
@@ -157,7 +157,7 @@ static void free_sampling_buffer(struct sf_buffer *sfb)
	}

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

@@ -213,8 +213,8 @@ static int realloc_sampling_buffer(struct sf_buffer *sfb,
	 */
	if (sfb->sdbt != get_next_sdbt(tail)) {
		debug_sprintf_event(sfdbg, 3, "realloc_sampling_buffer: "
				    "sampling buffer is not linked: origin=%p"
				    "tail=%p\n",
				    "sampling buffer is not linked: origin %p"
				    " tail %p\n",
				    (void *)sfb->sdbt, (void *)tail);
		return -EINVAL;
	}
@@ -252,7 +252,7 @@ static int realloc_sampling_buffer(struct sf_buffer *sfb,
	sfb->tail = tail;

	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);
	return rc;
}
@@ -293,10 +293,10 @@ static int alloc_sampling_buffer(struct sf_buffer *sfb, unsigned long num_sdb)
	if (rc) {
		free_sampling_buffer(sfb);
		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
		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);
	return rc;
}
@@ -404,8 +404,8 @@ static int allocate_buffers(struct cpu_hw_sf *cpuhw, struct hw_perf_event *hwc)
		return 0;

	debug_sprintf_event(sfdbg, 3,
			    "allocate_buffers: rate=%lu f=%lu sdb=%lu/%lu"
			    " sample_size=%lu cpuhw=%p\n",
			    "allocate_buffers: rate %lu f %lu sdb %lu/%lu"
			    " sample_size %lu cpuhw %p\n",
			    SAMPL_RATE(hwc), freq, n_sdb, sfb_max_limit(hwc),
			    sample_size, cpuhw);

@@ -465,8 +465,8 @@ static void sfb_account_overflows(struct cpu_hw_sf *cpuhw,
	if (num)
		sfb_account_allocs(num, hwc);

	debug_sprintf_event(sfdbg, 5, "sfb: overflow: overflow=%llu ratio=%lu"
			    " num=%lu\n", OVERFLOW_REG(hwc), ratio, num);
	debug_sprintf_event(sfdbg, 5, "sfb: overflow: overflow %llu ratio %lu"
			    " num %lu\n", OVERFLOW_REG(hwc), ratio, num);
	OVERFLOW_REG(hwc) = 0;
}

@@ -505,11 +505,11 @@ static void extend_sampling_buffer(struct sf_buffer *sfb,
	rc = realloc_sampling_buffer(sfb, num, GFP_ATOMIC);
	if (rc)
		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))
		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,
				    sfb_pending_allocs(sfb, hwc));
}
@@ -538,20 +538,22 @@ static void setup_pmc_cpu(void *flags)
		err = sf_disable();
		if (err)
			pr_err("Switching off the sampling facility failed "
			       "with rc=%i\n", err);
			       "with rc %i\n", err);
		debug_sprintf_event(sfdbg, 5,
				    "setup_pmc_cpu: initialized: cpuhw=%p\n", cpusf);
				    "setup_pmc_cpu: initialized: cpuhw %p\n",
				    cpusf);
		break;
	case PMC_RELEASE:
		cpusf->flags &= ~PMU_F_RESERVED;
		err = sf_disable();
		if (err) {
			pr_err("Switching off the sampling facility failed "
			       "with rc=%i\n", err);
			       "with rc %i\n", err);
		} else
			deallocate_buffers(cpusf);
		debug_sprintf_event(sfdbg, 5,
				    "setup_pmc_cpu: released: cpuhw=%p\n", cpusf);
				    "setup_pmc_cpu: released: cpuhw %p\n",
				    cpusf);
		break;
	}
	if (err)
@@ -744,7 +746,7 @@ static int __hw_perf_event_init_rate(struct perf_event *event,
	SAMPL_RATE(hwc) = rate;
	hw_init_period(hwc, SAMPL_RATE(hwc));
	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,
			    SAMPLE_FREQ_MODE(hwc));
	return 0;
@@ -963,7 +965,7 @@ static void cpumsf_pmu_enable(struct pmu *pmu)
	err = lsctl(&cpuhw->lsctl);
	if (err) {
		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);
		return;
	}
@@ -971,8 +973,8 @@ static void cpumsf_pmu_enable(struct pmu *pmu)
	/* Load current program parameter */
	lpp(&S390_lowcore.lpp);

	debug_sprintf_event(sfdbg, 6, "pmu_enable: es=%i cs=%i ed=%i cd=%i "
			    "interval:%lx tear=%p dear=%p\n",
	debug_sprintf_event(sfdbg, 6, "pmu_enable: es %i cs %i ed %i cd %i "
			    "interval %#lx tear %p dear %p\n",
			    cpuhw->lsctl.es, cpuhw->lsctl.cs, cpuhw->lsctl.ed,
			    cpuhw->lsctl.cd, cpuhw->lsctl.interval,
			    (void *) cpuhw->lsctl.tear,
@@ -999,7 +1001,7 @@ static void cpumsf_pmu_disable(struct pmu *pmu)

	err = lsctl(&inactive);
	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);
		return;
	}
@@ -1017,7 +1019,7 @@ static void cpumsf_pmu_disable(struct pmu *pmu)
		}
	} else
		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;
}
@@ -1130,15 +1132,6 @@ static void perf_event_count_update(struct perf_event *event, u64 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
 * @event:	The perf event
 * @sdbt:	Sample-data-block table
@@ -1192,7 +1185,11 @@ static void hw_collect_samples(struct perf_event *event, unsigned long *sdbt,
				/* Count discarded samples */
				*overflow += 1;
		} 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.
			 *
			 * 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)
			sampl_overflow += te->overflow;

		/* Timestamps are valid for full sample-data-blocks only */
		debug_sprintf_event(sfdbg, 6, "hw_perf_event_update: sdbt=%p "
				    "overflow=%llu timestamp=%#llx\n",
		debug_sprintf_event(sfdbg, 6, "hw_perf_event_update: sdbt %p "
				    "overflow %llu timestamp %#llx\n",
				    sdbt, te->overflow,
				    (te->f) ? trailer_timestamp(te) : 0ULL);

@@ -1314,7 +1311,7 @@ static void hw_perf_event_update(struct perf_event *event, int flush_all)
						 sampl_overflow, 1 + num_sdb);
	if (sampl_overflow || event_overflow)
		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);
}

@@ -1368,7 +1365,7 @@ static void aux_output_end(struct perf_output_handle *handle)
	te = aux_sdb_trailer(aux, aux->alert_mark);
	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,

	debug_sprintf_event(sfdbg, 6, "aux_output_begin: "
			    "head->alert_mark->empty_mark (num_alert, range)"
			    "[%lx -> %lx -> %lx] (%lx, %lx) "
			    "tear index %lx, tear %lx dear %lx\n",
			    "[%#lx -> %#lx -> %#lx] (%#lx, %#lx) "
			    "tear index %#lx, tear %#lx dear %#lx\n",
			    aux->head, aux->alert_mark, aux->empty_mark,
			    AUX_SDB_NUM_ALERT(aux), range,
			    head / CPUM_SF_SDB_PER_TABLE,
@@ -1596,13 +1593,13 @@ static void hw_collect_aux(struct cpu_hw_sf *cpuhw)
			perf_aux_output_end(&cpuhw->handle, size);
			pr_err("Sample data caused the AUX buffer with %lu "
			       "pages to overflow\n", num_sdb);
			debug_sprintf_event(sfdbg, 1, "head %lx range %lx "
					    "overflow %llx\n",
			debug_sprintf_event(sfdbg, 1, "head %#lx range %#lx "
					    "overflow %#llx\n",
					    aux->head, range, overflow);
		} else {
			size = AUX_SDB_NUM_ALERT(aux) << PAGE_SHIFT;
			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",
					    aux->head, aux->alert_mark);
		}
@@ -1610,7 +1607,7 @@ static void hw_collect_aux(struct cpu_hw_sf *cpuhw)

	if (done)
		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_SDB_NUM_ALERT(aux), range);
}
@@ -1800,7 +1797,7 @@ static int cpumsf_pmu_check_period(struct perf_event *event, u64 value)
	SAMPL_RATE(&event->hw) = rate;
	hw_init_period(&event->hw, SAMPL_RATE(&event->hw));
	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->attr.sample_period, do_freq);
	return 0;
@@ -2111,7 +2108,7 @@ static int param_set_sfb_size(const char *val, const struct kernel_param *kp)

	sfb_set_limits(min, max);
	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);
	return 0;
}
@@ -2129,7 +2126,7 @@ static const struct kernel_param_ops param_ops_sfb_size = {
static void __init pr_cpumsf_err(unsigned int reason)
{
	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)