From: Daniel Henrique Barboza <danielhb413@gmail.com>
To: qemu-devel@nongnu.org
Cc: gustavo.romero@linaro.org,
Daniel Henrique Barboza <danielhb413@gmail.com>,
groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org,
david@gibson.dropbear.id.au
Subject: [PATCH 00/19] PMU-EBB support for PPC64 TCG
Date: Mon, 9 Aug 2021 10:10:38 -0300 [thread overview]
Message-ID: <20210809131057.1694145-1-danielhb413@gmail.com> (raw)
Hi,
In this series we introduce Event-Based Branch (EBB) support for PPC64
TCG. EBB consists of a new instruction called 'rfebb' and interrupt/exception
logic that redirects the userspace next intruction pointer to another address,
and the rfebb instruction restores execution back afterwards.
One way to exercise EBB is the Linux kernel selftests, located in the
kernel tree tools/testing/selftests/powerpc/pmu/ebb). These tests uses
the PMU (Performance Monitor Unit). We don't have a PPC64 PMU implementation
available, so to validate the EBB implementation we also introduced a
rudimentary PPC64 PMU for TCG. The PMU will not count anything but instructions
and cycles. There is no support for sampled/random events that are enabled by MMCR2.
Not all MMCR0 bits are being used. The limitations and capabilities of
this PMU implementation is described in the docs in the last patch.
This work was started by Gustavo Romero in 2020. You can find Gustavo's
patches in his branch at [1]. Gustavo's current work email is CCed in
the patches so he can follow and participate in the review process if he
wants to.
These patches can be divided in 3 parts:
- Patches 1 to 8: basic PMU support for instructions/cycles counting
- Patches 9 to 11: EBB implementation
- Patches 12 to 18: implement counter negative PMU alerts to trigger EBB
exceptions
Both the PMU and EBB are based on the PowerISA 3.1 specification.
One notable limitation of the PMU implementation is the icount
precision. Using the PMU powerpc kernel tests, located in
tools/testing/selftests/powerpc/pmu, we will consistently fall short in
tests where 10M or more instructions are sampled, with an error rate of
around 0,07%. I am not certain whether this has to do with the logic
implemented here or with an icount precision limit, or both. Since our
objective here is to validate the EBB logic I am overlooking these
errors. All that said, any input/feedback related to how we can improve
the instruction count is welcome.
The benchmark for this implementation is the EBB powerpc kernel tests,
located in the kernel tree in tools/testing/selftests/powerpc/pmu/ebb.
Of the current 22 EBB tests presented in the kernel v5.13 we can pass 20
of those all the time. . 'instructions_count_test' suffers from the same
limitations of the PMU tests mentioned above. 'lost_exception_test' will
pass sometimes, although the most common scenario is a failure. Since
this is a heavy focused PMU test that happens to use EBB I am also
overlooking its failure.
[1] https://github.com/gromero/qemu/commits/ebb
Daniel Henrique Barboza (15):
target/ppc: add exclusive Book3S PMU reg read/write functions
target/ppc: PMU Book3s basic insns count for pseries TCG
target/ppc/pmu_book3s_helper.c: eliminate code repetition
target/ppc/pmu_book3s_helper: enable PMC1-PMC4 events
target/ppc/pmu_book3s_helper.c: icount fine tuning
target/ppc/pmu_book3s_helper.c: do an actual cycles calculation
target/ppc/excp_helper.c: POWERPC_EXCP_EBB adjustments
target/ppc/pmu_book3s_helper.c: enable PMC1 counter negative EBB
target/ppc/translate: PMU: handle setting of PMCs while running
target/ppc/pmu_book3s_helper.c: add generic timeout helpers
target/ppc/pmu_book3s_helper: enable counter negative for all PMCs
target/ppc/pmu_book3s_helper: adding 0xFA event
target/ppc/pmu_book3s_helper.c: add PMC14/PMC56 counter freeze bits
target/ppc/pmu_book3s_helper.c: add PM_CMPLU_STALL mock events
docs/specs: add PPC64 TCG PMU-EBB documentation
Gustavo Romero (4):
target/ppc: add exclusive user read function for PMU regs
target/ppc: add exclusive user write function for PMU regs
PPC64/TCG: Implement 'rfebb' instruction
target/ppc: PMU Event-Based exception support
docs/specs/index.rst | 1 +
docs/specs/ppc-tcg-pmu-ebb.rst | 71 +++++
hw/ppc/spapr_cpu_core.c | 6 +
target/ppc/cpu.h | 47 +++-
target/ppc/cpu_init.c | 54 ++--
target/ppc/excp_helper.c | 61 +++++
target/ppc/helper.h | 2 +
target/ppc/meson.build | 1 +
target/ppc/pmu_book3s_helper.c | 466 +++++++++++++++++++++++++++++++++
target/ppc/spr_tcg.h | 4 +
target/ppc/translate.c | 151 ++++++++++-
11 files changed, 834 insertions(+), 30 deletions(-)
create mode 100644 docs/specs/ppc-tcg-pmu-ebb.rst
create mode 100644 target/ppc/pmu_book3s_helper.c
--
2.31.1
next reply other threads:[~2021-08-09 13:13 UTC|newest]
Thread overview: 70+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-09 13:10 Daniel Henrique Barboza [this message]
2021-08-09 13:10 ` [PATCH 01/19] target/ppc: add exclusive Book3S PMU reg read/write functions Daniel Henrique Barboza
2021-08-10 3:19 ` David Gibson
2021-08-10 13:06 ` Daniel Henrique Barboza
2021-08-09 13:10 ` [PATCH 02/19] target/ppc: add exclusive user read function for PMU regs Daniel Henrique Barboza
2021-08-10 3:21 ` David Gibson
2021-08-09 13:10 ` [PATCH 03/19] target/ppc: add exclusive user write " Daniel Henrique Barboza
2021-08-10 3:29 ` David Gibson
2021-08-11 0:05 ` Richard Henderson
2021-08-09 13:10 ` [PATCH 04/19] target/ppc: PMU Book3s basic insns count for pseries TCG Daniel Henrique Barboza
2021-08-10 3:39 ` David Gibson
2021-08-10 13:24 ` Daniel Henrique Barboza
2021-08-16 17:53 ` Daniel Henrique Barboza
2021-08-17 2:59 ` David Gibson
2021-08-17 9:30 ` Daniel Henrique Barboza
2021-08-18 5:48 ` David Gibson
2021-08-11 0:26 ` Richard Henderson
2021-08-09 13:10 ` [PATCH 05/19] target/ppc/pmu_book3s_helper.c: eliminate code repetition Daniel Henrique Barboza
2021-08-10 3:40 ` David Gibson
2021-08-09 13:10 ` [PATCH 06/19] target/ppc/pmu_book3s_helper: enable PMC1-PMC4 events Daniel Henrique Barboza
2021-08-10 3:42 ` David Gibson
2021-08-10 15:03 ` Daniel Henrique Barboza
2021-08-10 23:08 ` Daniel Henrique Barboza
2021-08-11 23:27 ` Daniel Henrique Barboza
2021-08-12 1:52 ` David Gibson
2021-08-11 3:32 ` David Gibson
2021-08-09 13:10 ` [PATCH 07/19] target/ppc/pmu_book3s_helper.c: icount fine tuning Daniel Henrique Barboza
2021-08-09 13:10 ` [PATCH 08/19] target/ppc/pmu_book3s_helper.c: do an actual cycles calculation Daniel Henrique Barboza
2021-08-11 0:34 ` Richard Henderson
2021-08-09 13:10 ` [PATCH 09/19] PPC64/TCG: Implement 'rfebb' instruction Daniel Henrique Barboza
2021-08-10 3:50 ` David Gibson
2021-08-10 19:32 ` Daniel Henrique Barboza
2021-08-11 0:42 ` Richard Henderson
2021-08-11 3:36 ` David Gibson
2021-08-11 0:41 ` Richard Henderson
2021-08-09 13:10 ` [PATCH 10/19] target/ppc: PMU Event-Based exception support Daniel Henrique Barboza
2021-08-10 3:55 ` David Gibson
2021-08-11 0:50 ` Richard Henderson
2021-08-09 13:10 ` [PATCH 11/19] target/ppc/excp_helper.c: POWERPC_EXCP_EBB adjustments Daniel Henrique Barboza
2021-08-09 13:10 ` [PATCH 12/19] target/ppc/pmu_book3s_helper.c: enable PMC1 counter negative EBB Daniel Henrique Barboza
2021-08-10 4:01 ` David Gibson
2021-08-10 20:26 ` Daniel Henrique Barboza
2021-08-11 3:40 ` David Gibson
2021-08-11 11:18 ` Daniel Henrique Barboza
2021-08-12 3:39 ` David Gibson
2021-08-12 4:45 ` Richard Henderson
2021-08-12 4:56 ` Richard Henderson
2021-08-12 10:17 ` Daniel Henrique Barboza
2021-08-12 21:24 ` Daniel Henrique Barboza
2021-08-13 0:35 ` Richard Henderson
2021-08-14 19:13 ` Daniel Henrique Barboza
2021-08-15 19:24 ` Richard Henderson
2021-08-09 13:10 ` [PATCH 13/19] target/ppc/translate: PMU: handle setting of PMCs while running Daniel Henrique Barboza
2021-08-10 4:06 ` David Gibson
2021-08-10 20:44 ` Daniel Henrique Barboza
2021-08-11 3:46 ` David Gibson
2021-08-09 13:10 ` [PATCH 14/19] target/ppc/pmu_book3s_helper.c: add generic timeout helpers Daniel Henrique Barboza
2021-08-10 4:09 ` David Gibson
2021-08-09 13:10 ` [PATCH 15/19] target/ppc/pmu_book3s_helper: enable counter negative for all PMCs Daniel Henrique Barboza
2021-08-10 4:11 ` David Gibson
2021-08-10 21:02 ` Daniel Henrique Barboza
2021-08-12 1:44 ` David Gibson
2021-08-09 13:10 ` [PATCH 16/19] target/ppc/pmu_book3s_helper: adding 0xFA event Daniel Henrique Barboza
2021-08-10 4:13 ` David Gibson
2021-08-09 13:10 ` [PATCH 17/19] target/ppc/pmu_book3s_helper.c: add PMC14/PMC56 counter freeze bits Daniel Henrique Barboza
2021-08-09 13:10 ` [PATCH 18/19] target/ppc/pmu_book3s_helper.c: add PM_CMPLU_STALL mock events Daniel Henrique Barboza
2021-08-10 4:17 ` David Gibson
2021-08-10 19:48 ` Daniel Henrique Barboza
2021-08-11 3:37 ` David Gibson
2021-08-09 13:10 ` [PATCH 19/19] docs/specs: add PPC64 TCG PMU-EBB documentation Daniel Henrique Barboza
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=20210809131057.1694145-1-danielhb413@gmail.com \
--to=danielhb413@gmail.com \
--cc=clg@kaod.org \
--cc=david@gibson.dropbear.id.au \
--cc=groug@kaod.org \
--cc=gustavo.romero@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.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;
as well as URLs for NNTP newsgroup(s).