Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf powerpc: Add event name as vpa-dtl of PERF_TYPE_SYNTH type to present DTL samples

Dispatch Trace Log details are captured as-is in PERF_RECORD_AUXTRACE
records.

To present dtl entries as samples, create an event with name as
"vpa-dtl" and type PERF_TYPE_SYNTH.

Add perf_synth_id, "PERF_SYNTH_POWERPC_VPA_DTL" as config value for the
event.

Create a sample id to be a fixed offset from evsel id.

To present the relevant fields from the "struct dtl_entry", prepare the
entries as events of type PERF_TYPE_SYNTH.

By defining as PERF_TYPE_SYNTH type, samples can be printed as part of
perf_sample__fprintf_synth in builtin-script.c

From powerpc_vpadtl_process_auxtrace_info(), invoke
auxtrace_queues__process_index() function which will queue the auxtrace
buffers by invoke auxtrace_queues__add_event().

Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Athira Rajeev <atrajeev@linux.ibm.com>
Tested-by: Tejas Manhas <tejas05@linux.ibm.com>
Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Cc: Aboorva Devarajan <aboorvad@linux.ibm.com>
Cc: Aditya Bodkhe <Aditya.Bodkhe1@ibm.com>
Cc: Hari Bathini <hbathini@linux.vnet.ibm.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Shrikanth Hegde <sshegde@linux.ibm.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Athira Rajeev and committed by
Arnaldo Carvalho de Melo
71feffa9 c4bbd4ec

+77
+1
tools/perf/util/event.h
··· 117 117 PERF_SYNTH_INTEL_PSB, 118 118 PERF_SYNTH_INTEL_EVT, 119 119 PERF_SYNTH_INTEL_IFLAG_CHG, 120 + PERF_SYNTH_POWERPC_VPA_DTL, 120 121 }; 121 122 122 123 /*
+76
tools/perf/util/powerpc-vpadtl.c
··· 3 3 * VPA DTL PMU support 4 4 */ 5 5 6 + #include <linux/string.h> 6 7 #include <inttypes.h> 7 8 #include "color.h" 8 9 #include "evlist.h" ··· 25 24 struct perf_session *session; 26 25 struct machine *machine; 27 26 u32 pmu_type; 27 + u64 sample_id; 28 28 }; 29 29 30 30 struct boottb_freq { ··· 217 215 fprintf(stdout, powerpc_vpadtl_info_fmts[POWERPC_VPADTL_TYPE], arr[POWERPC_VPADTL_TYPE]); 218 216 } 219 217 218 + static void set_event_name(struct evlist *evlist, u64 id, 219 + const char *name) 220 + { 221 + struct evsel *evsel; 222 + 223 + evlist__for_each_entry(evlist, evsel) { 224 + if (evsel->core.id && evsel->core.id[0] == id) { 225 + if (evsel->name) 226 + zfree(&evsel->name); 227 + evsel->name = strdup(name); 228 + break; 229 + } 230 + } 231 + } 232 + 233 + static int 234 + powerpc_vpadtl_synth_events(struct powerpc_vpadtl *vpa, struct perf_session *session) 235 + { 236 + struct evlist *evlist = session->evlist; 237 + struct evsel *evsel; 238 + struct perf_event_attr attr; 239 + bool found = false; 240 + u64 id; 241 + int err; 242 + 243 + evlist__for_each_entry(evlist, evsel) { 244 + if (strstarts(evsel->name, "vpa_dtl")) { 245 + found = true; 246 + break; 247 + } 248 + } 249 + 250 + if (!found) { 251 + pr_debug("No selected events with VPA trace data\n"); 252 + return 0; 253 + } 254 + 255 + memset(&attr, 0, sizeof(struct perf_event_attr)); 256 + attr.size = sizeof(struct perf_event_attr); 257 + attr.sample_type = evsel->core.attr.sample_type; 258 + attr.sample_id_all = evsel->core.attr.sample_id_all; 259 + attr.type = PERF_TYPE_SYNTH; 260 + attr.config = PERF_SYNTH_POWERPC_VPA_DTL; 261 + 262 + /* create new id val to be a fixed offset from evsel id */ 263 + id = evsel->core.id[0] + 1000000000; 264 + if (!id) 265 + id = 1; 266 + 267 + err = perf_session__deliver_synth_attr_event(session, &attr, id); 268 + if (err) 269 + return err; 270 + 271 + vpa->sample_id = id; 272 + set_event_name(evlist, id, "vpa-dtl"); 273 + 274 + return 0; 275 + } 276 + 220 277 /* 221 278 * Process the PERF_RECORD_AUXTRACE_INFO records and setup 222 279 * the infrastructure to process auxtrace events. PERF_RECORD_AUXTRACE_INFO ··· 317 256 318 257 powerpc_vpadtl_print_info(&auxtrace_info->priv[0]); 319 258 259 + if (dump_trace) 260 + return 0; 261 + 262 + err = powerpc_vpadtl_synth_events(vpa, session); 263 + if (err) 264 + goto err_free_queues; 265 + 266 + err = auxtrace_queues__process_index(&vpa->queues, session); 267 + if (err) 268 + goto err_free_queues; 269 + 320 270 return 0; 271 + 272 + err_free_queues: 273 + auxtrace_queues__free(&vpa->queues); 274 + session->auxtrace = NULL; 321 275 322 276 err_free: 323 277 free(vpa);