From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CFC2C33985 for ; Fri, 15 Aug 2025 08:35:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755246960; cv=none; b=sw6eK+pmuRoImSgMG3xQ62TvJGyXcbAjyWR3IxgxRZPdDVKnAcYH1lR5VIMYIJL2uU/zp3l/GBIpMmeXmH0liVe9NBqyKJ4G479XsH+/RYRGe7BaYGtoYPBFytaowh1Cq+U8A2h9rWggAWqPz3TpWtbuBRcjHLSk+3GVtNSdIpk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755246960; c=relaxed/simple; bh=XoVe1RLRT8svagRFA0wZOaTJ07lg6RFROafla3dVhgM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=e0B5UWDS2t4jbxBe3u37XtzvziVec+tf1N95F9FffPULQ5T19jLuvBL+8AuoJHXkcG/WXbuYNgT3626iTySaGJn/My4Ai+MVG+MNzXaR1MINLskHwrOXTzeXOtTwwxapGl1uLbSU2O8AkRZ8Pco6tLC2tyuL0uTuxN/mtXUJJuI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=IUMs3DaS; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="IUMs3DaS" Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 57ENfstl011922; Fri, 15 Aug 2025 08:35:52 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=+aQ8lvs/IXg4oAyf7 yZma++uklamV/92suGgyNy0g50=; b=IUMs3DaSZtCVwpWlKCmgu8LcZPIBouT+5 +Fbbfp+HzH1MfH7txcKAc3R7kxXMtwBdjx4EUc2NYfv025LM5hGdoS8tz1/1EkpX L+IFTeHOWzkhs2Jcwx8N6j4A0nPBMMq4M3FAcHxGvUE64Sm64N2xkL7JJP0IY3Xo xFpE50wLZW542TQekVrSYI5BO8gnf9BIGHOiUGGXY+w81R53PtjZKtrUwOmS0bEb aqqUrp43ELhBueIHFtWRHDe0vaMCd7yyVDUDVBfwz19pIDDuY6mFrI69cOQWpSDt 2DcxmJhh5tVzGSvR9lWijKegwHcQTfIjkcQLMGvtRvBaJZJP0qxLQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 48durupfay-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Aug 2025 08:35:52 +0000 (GMT) Received: from m0356516.ppops.net (m0356516.ppops.net [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.0.8) with ESMTP id 57F8WUOI019683; Fri, 15 Aug 2025 08:35:51 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 48durupfax-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Aug 2025 08:35:51 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 57F6AEOL026345; Fri, 15 Aug 2025 08:35:51 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 48eh21g9ys-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Aug 2025 08:35:51 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 57F8Zlud52166964 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Aug 2025 08:35:47 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1725E20040; Fri, 15 Aug 2025 08:35:47 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6DA882004B; Fri, 15 Aug 2025 08:35:39 +0000 (GMT) Received: from localhost.localdomain (unknown [9.61.240.145]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 15 Aug 2025 08:35:39 +0000 (GMT) From: Athira Rajeev To: acme@kernel.org, jolsa@kernel.org, adrian.hunter@intel.com, maddy@linux.ibm.com, irogers@google.com, namhyung@kernel.org Cc: linux-perf-users@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, aboorvad@linux.ibm.com, sshegde@linux.ibm.com, atrajeev@linux.ibm.com, kjain@linux.ibm.com, hbathini@linux.vnet.ibm.com, Aditya.Bodkhe1@ibm.com, venkat88@linux.ibm.com Subject: [PATCH 09/14] tools/perf: Add event name as vpa-dtl of PERF_TYPE_SYNTH type to present DTL samples Date: Fri, 15 Aug 2025 14:04:02 +0530 Message-Id: <20250815083407.27953-10-atrajeev@linux.ibm.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250815083407.27953-1-atrajeev@linux.ibm.com> References: <20250815083407.27953-1-atrajeev@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-perf-users@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: slh3oAJXOkuSCDtRMhXdDXsYMPkNy3oS X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwODEyMDIyNCBTYWx0ZWRfX9W9rU5oNUFHR 6s5P5VA0I/kwtvhx95Xo5ro5RMaeMmEcl99bxKCUryf3xdykJf8Rg9Kr2D6DjncZ5AWi61gbc8b a48XNw+OpFqn7zpXLbHge6bJMShxzDLEe+mbP4OJVoDlwYcRB7cNJwB8sSyqU/WpO4ka9L+3A4M 3dcCVxBklXXqOwa4sTh1r1izBi7Sevo9z7nLg4MGIOKXTsEUcxv6tyjg7EILofPvpwarTeE1uq2 MNjmyFt8lH32HJFUovfftdSKe0kdRooRWg3Cl1q0WjeHYaj/h9K8MPRLZrYg2Il8bHKZNj3hb/j 9tWPq56CD0/NblFZLD6kprT7ofPU77Iht8LSFdzfuJSr2nrv4x1bE+PKk7Wlb/7o1jsBVyBs1Fx SS3xgkey X-Authority-Analysis: v=2.4 cv=QtNe3Uyd c=1 sm=1 tr=0 ts=689ef168 cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=2OwXVqhp2XgA:10 a=VnNF1IyMAAAA:8 a=gFY-KEiRM8imJIGC6w4A:9 X-Proofpoint-ORIG-GUID: YEqyt2J9aoJ5OWz20iCzwcYEUznL9yMa X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-08-15_02,2025-08-14_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 priorityscore=1501 phishscore=0 clxscore=1015 malwarescore=0 spamscore=0 suspectscore=0 impostorscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2507300000 definitions=main-2508120224 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(). Signed-off-by: Athira Rajeev --- tools/perf/util/event.h | 1 + tools/perf/util/powerpc-vpadtl.c | 75 ++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h index e40d16d3246c..eea21a542b22 100644 --- a/tools/perf/util/event.h +++ b/tools/perf/util/event.h @@ -117,6 +117,7 @@ enum perf_synth_id { PERF_SYNTH_INTEL_PSB, PERF_SYNTH_INTEL_EVT, PERF_SYNTH_INTEL_IFLAG_CHG, + PERF_SYNTH_POWERPC_VPA_DTL, }; /* diff --git a/tools/perf/util/powerpc-vpadtl.c b/tools/perf/util/powerpc-vpadtl.c index ea7b59c45f4a..36c02821cf0a 100644 --- a/tools/perf/util/powerpc-vpadtl.c +++ b/tools/perf/util/powerpc-vpadtl.c @@ -56,6 +56,7 @@ struct powerpc_vpadtl { struct perf_session *session; struct machine *machine; u32 pmu_type; + u64 sample_id; }; struct boottb_freq { @@ -250,6 +251,65 @@ static void powerpc_vpadtl_print_info(__u64 *arr) fprintf(stdout, powerpc_vpadtl_info_fmts[POWERPC_VPADTL_TYPE], arr[POWERPC_VPADTL_TYPE]); } +static void set_event_name(struct evlist *evlist, u64 id, + const char *name) +{ + struct evsel *evsel; + + evlist__for_each_entry(evlist, evsel) { + if (evsel->core.id && evsel->core.id[0] == id) { + if (evsel->name) + zfree(&evsel->name); + evsel->name = strdup(name); + break; + } + } +} + +static int +powerpc_vpadtl_synth_events(struct powerpc_vpadtl *vpa, struct perf_session *session) +{ + struct evlist *evlist = session->evlist; + struct evsel *evsel; + struct perf_event_attr attr; + bool found = false; + u64 id; + int err; + + evlist__for_each_entry(evlist, evsel) { + if (evsel->core.attr.type == vpa->pmu_type) { + found = true; + break; + } + } + + if (!found) { + pr_debug("No selected events with VPA trace data\n"); + return 0; + } + + memset(&attr, 0, sizeof(struct perf_event_attr)); + attr.size = sizeof(struct perf_event_attr); + attr.sample_type = evsel->core.attr.sample_type; + attr.sample_id_all = evsel->core.attr.sample_id_all; + attr.type = PERF_TYPE_SYNTH; + attr.config = PERF_SYNTH_POWERPC_VPA_DTL; + + /* create new id val to be a fixed offset from evsel id */ + id = evsel->core.id[0] + 1000000000; + if (!id) + id = 1; + + err = perf_session__deliver_synth_attr_event(session, &attr, id); + if (err) + return err; + + vpa->sample_id = id; + set_event_name(evlist, id, "vpa-dtl"); + + return 0; +} + /* * Process the PERF_RECORD_AUXTRACE_INFO records and setup * the infrastructure to process auxtrace events. PERF_RECORD_AUXTRACE_INFO @@ -291,8 +351,23 @@ int powerpc_vpadtl_process_auxtrace_info(union perf_event *event, powerpc_vpadtl_print_info(&auxtrace_info->priv[0]); + if (dump_trace) + return 0; + + err = powerpc_vpadtl_synth_events(vpa, session); + if (err) + goto err_free_queues; + + err = auxtrace_queues__process_index(&vpa->queues, session); + if (err) + goto err_free_queues; + return 0; +err_free_queues: + auxtrace_queues__free(&vpa->queues); + session->auxtrace = NULL; + err_free: free(vpa); return err; -- 2.47.1