From: "tip-bot2 for Alexander Shishkin" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: perf/core] perf intel-pt: Use aux_watermark
Date: Fri, 16 Apr 2021 15:01:52 -0000 [thread overview]
Message-ID: <161858531224.29796.4660387647259409979.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20210414154955.49603-3-alexander.shishkin@linux.intel.com>
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 874fc35cdd55e2d46161901de43ec58ca2efc5fe
Gitweb: https://git.kernel.org/tip/874fc35cdd55e2d46161901de43ec58ca2efc5fe
Author: Alexander Shishkin <alexander.shishkin@linux.intel.com>
AuthorDate: Wed, 14 Apr 2021 18:49:55 +03:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Fri, 16 Apr 2021 16:32:39 +02:00
perf intel-pt: Use aux_watermark
Turns out, the default setting of attr.aux_watermark to half of the total
buffer size is not very useful, especially with smaller buffers. The
problem is that, after half of the buffer is filled up, the kernel updates
->aux_head and sets up the next "transaction", while observing that
->aux_tail is still zero (as userspace haven't had the chance to update
it), meaning that the trace will have to stop at the end of this second
"transaction". This means, for example, that the second PERF_RECORD_AUX in
every trace comes with TRUNCATED flag set.
Setting attr.aux_watermark to quarter of the buffer gives enough space for
the ->aux_tail update to be observed and prevents the data loss.
The obligatory before/after showcase:
> # perf_before record -e intel_pt//u -m,8 uname
> Linux
> [ perf record: Woken up 6 times to write data ]
> Warning:
> AUX data lost 4 times out of 10!
>
> [ perf record: Captured and wrote 0.099 MB perf.data ]
> # perf record -e intel_pt//u -m,8 uname
> Linux
> [ perf record: Woken up 4 times to write data ]
> [ perf record: Captured and wrote 0.039 MB perf.data ]
The effect is still visible with large workloads and large buffers,
although less pronounced.
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20210414154955.49603-3-alexander.shishkin@linux.intel.com
---
tools/perf/arch/x86/util/intel-pt.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c
index a6420c6..6df0dc0 100644
--- a/tools/perf/arch/x86/util/intel-pt.c
+++ b/tools/perf/arch/x86/util/intel-pt.c
@@ -776,6 +776,12 @@ static int intel_pt_recording_options(struct auxtrace_record *itr,
}
}
+ if (!opts->auxtrace_snapshot_mode && !opts->auxtrace_sample_mode) {
+ u32 aux_watermark = opts->auxtrace_mmap_pages * page_size / 4;
+
+ intel_pt_evsel->core.attr.aux_watermark = aux_watermark;
+ }
+
intel_pt_parse_terms(intel_pt_pmu->name, &intel_pt_pmu->format,
"tsc", &tsc_bit);
next prev parent reply other threads:[~2021-04-16 15:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-14 15:49 [PATCH 0/2] perf, pt: Improve data loss Alexander Shishkin
2021-04-14 15:49 ` [PATCH v1 1/2] perf: Cap allocation order at aux_watermark Alexander Shishkin
2021-04-16 15:01 ` [tip: perf/core] " tip-bot2 for Alexander Shishkin
2021-04-14 15:49 ` [PATCH v1 2/2] perf intel-pt: Use aux_watermark Alexander Shishkin
2021-04-16 15:01 ` tip-bot2 for Alexander Shishkin [this message]
2021-04-26 6:28 ` Adrian Hunter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=161858531224.29796.4660387647259409979.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=alexander.shishkin@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®