lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <11822824-7486-2333-f039-bfd801b86922@arm.com>
Date:   Thu, 27 May 2021 16:46:42 +0300
From:   James Clark <james.clark@....com>
To:     acme@...nel.org, mathieu.poirier@...aro.org,
        coresight@...ts.linaro.org, leo.yan@...aro.org
Cc:     al.grant@....com, branislav.rankov@....com, denik@...omium.org,
        suzuki.poulose@....com, anshuman.khandual@....com,
        Mike Leach <mike.leach@...aro.org>,
        John Garry <john.garry@...wei.com>,
        Will Deacon <will@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...hat.com>,
        Namhyung Kim <namhyung@...nel.org>,
        linux-arm-kernel@...ts.infradead.org,
        linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH v3] perf cs-etm: Split Coresight decode by aux records



On 27/05/2021 13:42, James Clark wrote:
> Populate the auxtrace queues using AUX records rather than whole
> auxtrace buffers.
> 
...
> Snapshot mode still needs to be tested.
> 

Snapshot mode is also working, but needs the following patch applied to reverse aux_offset
from the end of the buffer to the beginning:

diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
index 5d6c03488187..9db556e14dfa 100644
--- a/tools/perf/util/cs-etm.c
+++ b/tools/perf/util/cs-etm.c
@@ -2700,6 +2700,7 @@ static int cs_etm__queue_aux_fragment(struct perf_session *session,
 	struct perf_record_auxtrace *auxtrace_event;
 	union perf_event auxtrace_fragment;
 	bool matchesCpuPid;
+	__u64 aux_offset;
 	struct cs_etm_auxtrace *etm = container_of(session->auxtrace,
 						   struct cs_etm_auxtrace,
 						   auxtrace);
@@ -2730,19 +2731,26 @@ static int cs_etm__queue_aux_fragment(struct perf_session *session,
 	else
 		matchesCpuPid = auxtrace_event->cpu == sample->cpu;
 
+	/*
+	 * In snapshot/overwrite mode, the head points to the end of the buffer so aux_offset needs
+	 * to have the size subtracted so it points to the beginning as in normal mode.
+	 */
+	if (aux_event->flags && PERF_AUX_FLAG_OVERWRITE)
+		aux_offset = aux_event->aux_offset - aux_event->aux_size;
+	else
+		aux_offset = aux_event->aux_offset;
+
 	if (matchesCpuPid &&
-	    aux_event->aux_offset >= auxtrace_event->offset &&
-	    aux_event->aux_offset + aux_event->aux_size <=
-			auxtrace_event->offset + auxtrace_event->size) {
+	    aux_offset >= auxtrace_event->offset &&
+	    aux_offset + aux_event->aux_size <= auxtrace_event->offset + auxtrace_event->size) {
 		/*
 		 * If this AUX event was inside this buffer somewhere, create a new auxtrace event
 		 * based on the sizes of the aux event, and queue that fragment.
 		 */
 		auxtrace_fragment.auxtrace = *auxtrace_event;
 		auxtrace_fragment.auxtrace.size = aux_event->aux_size;
-		auxtrace_fragment.auxtrace.offset = aux_event->aux_offset;
-		file_offset += aux_event->aux_offset - auxtrace_event->offset +
-				auxtrace_event->header.size;
+		auxtrace_fragment.auxtrace.offset = aux_offset;
+		file_offset += aux_offset - auxtrace_event->offset + auxtrace_event->header.size;
 		return auxtrace_queues__add_event(&etm->queues,
 					       session,
 					       &auxtrace_fragment,


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ