Hi Wojciech,
Are you still working on this patchset here? https://lists.linaro.org/pipermail/coresight/2019-June/002871.html
I'm asking because I was also looking to make a change related to timestamps, and I see there has been quite
a bit of discussion on your one over the revisions.
My change would be something like I've pasted below. This was suggested by Al Grant so that the synthesized samples
have kernel timestamps that can be correlated (at least roughly) with MMAP and COMM records.
The issue is that in your patchset, you are also setting the sample.time field, but with the decoded timestamp
rather than the kernel one. I suppose this email is to re-start the discussion with the whole mailing list about
what should be in that field.
Thanks
James
---
diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
index 7206c7f..7f7a68c 100644
--- a/tools/perf/util/cs-etm.c
+++ b/tools/perf/util/cs-etm.c
@@ -55,6 +55,7 @@ struct cs_etm_auxtrace {
u8 sample_instructions;
int num_cpu;
+ u64 latest_timestamp;
u32 auxtrace_type;
u64 branches_sample_type;
u64 branches_id;
@@ -1152,6 +1153,7 @@ static int cs_etm__synth_instruction_sample(struct cs_etm_queue *etmq,
event->sample.header.misc = cs_etm__cpu_mode(etmq, addr);
event->sample.header.size = sizeof(struct perf_event_header);
+ sample.time = etm->latest_timestamp;
sample.ip = addr;
sample.pid = tidq->pid;
sample.tid = tidq->tid;
@@ -1209,6 +1211,7 @@ static int cs_etm__synth_branch_sample(struct cs_etm_queue *etmq,
event->sample.header.misc = cs_etm__cpu_mode(etmq, ip);
event->sample.header.size = sizeof(struct perf_event_header);
+ sample.time = etm->latest_timestamp;
sample.ip = ip;
sample.pid = tidq->pid;
sample.tid = tidq->tid;
@@ -2367,8 +2370,10 @@ static int cs_etm__process_event(struct perf_session *session,
return cs_etm__process_switch_cpu_wide(etm, event);
if (!etm->timeless_decoding &&
- event->header.type == PERF_RECORD_AUX)
+ event->header.type == PERF_RECORD_AUX) {
+ etm->latest_timestamp = timestamp;
return cs_etm__process_queues(etm);
+ }
return 0;
}
This patchset introduces initial concepts in CoreSight system
configuration management support. to allow more detailed and complex
programming to be applied to CoreSight systems during trace capture.
Configurations consist of 2 elements:-
1) Features - programming combinations for devices, applied to a class of
device on the system (all ETMv4), or individual devices.
2) Configurations - a set of programmed features used when the named
configuration is selected.
Features and configurations are declared as a data table, a set of register,
resource and parameter requirements. Features and configurations are loaded
into the system by the virtual cs_syscfg device. This then matches features
to any registered devices and loads the feature into them.
Individual device classes that support feature and configuration register
with cs_syscfg.
Once loaded a configuration can be enabled for a specific trace run.
Configurations are registered with the perf cs_etm event as entries in
cs_etm/cs_config. These can be selected on the perf command line as follows:-
perf record -e cs_etm/<config_name>/ ...
This patch set has one pre-loaded configuration and feature.
A named "strobing" feature is provided for ETMv4.
A named "autofdo" configuration is provided. This configuration enables
strobing on any ETM in used.
Thus the command:
perf record -e cs_etm/autofdo/ ...
will trace the supplied application while enabling the "autofdo" configuation
on each ETM as it is enabled by perf. This in turn will enable strobing for
the ETM - with default parameters. Parameters can be adjusted using configfs.
The sink used in the trace run will be automatically selected.
A configuation can supply up to 15 of preset parameter values, which will
subsitute in parameter values for any feature used in the configuration.
Selection of preset values as follows
perf record -e cs_etm/autofdo,preset=1/ ...
(valid presets 1-N, where N is the number supplied in the configuration, not
exceeding 15. preset=0 is the same as not selecting a preset.)
Applies to coresight/next (5.11-rc2 base)
Changes since v3: (Primarily based on comments from Matthieu)
1) Locking mechanisms simplified.
2) Removed the possibility to enable features independently from
configurations.Only configurations can be enabled now. Simplifies programming
logic.
3) Configuration now uses an activate->enable mechanism. This means that perf
will activate a selected configuration at the start of a session (during
setup_aux), and disable at the end of a session (around free_aux)
The active configuration and associated features will be programmed into the
CoreSight device instances when they are enabled. This locks the configuration
into the system while in use. Parameters cannot be altered while this is
in place. This mechanism will be extended in future for dynamic load / unload
of configurations to prevent removal while in use.
4) Removed the custom bus / driver as un-necessary. A single device is
registered to own perf fs elements and configfs.
5) Various other minor issues addressed.
Changes since v2:
1) Added documentation file.
2) Altered cs_syscfg driver to no longer be coresight_device based, and moved
to its own custom bus to remove it from the main coresight bus. (Mathieu)
3) Added configfs support to inspect and control loaded configurations and
features. Allows listing of preset values (Yabin Cui)
4) Dropped sysfs support for adjusting feature parameters on the per device
basis, in favour of a single point adjustment in configfs that is pushed to all
device instances.
5) Altered how the config and preset command line options are handled in perf
and the drivers. (Mathieu and Suzuki).
6) Fixes for various issues and technical points (Mathieu, Yabin)
Changes since v1:
1) Moved preloaded configurations and features out of individual drivers.
2) Added cs_syscfg driver to manage configurations and features. Individual
drivers register with cs_syscfg indicating support for config, and provide
matching information that the system uses to load features into the drivers.
This allows individual drivers to be updated on an as needed basis - and
removes the need to consider devices that cannot benefit from configuration -
static replicators, funnels, tpiu.
3) Added perf selection of configuarations.
4) Rebased onto the coresight module loading set.
To follow in future revisions / sets:-
a) load of additional config and features by loadable module.
b) load of additional config and features by configfs
c) enhanced resource management for ETMv4 and checking features have sufficient
resources to be enabled.
d) ECT and CTI support for configuration and features.
Mike Leach (10):
coresight: syscfg: Initial coresight system configuration
coresight: syscfg: Add registration and feature loading for cs devices
coresight: config: Add configuration and feature generic functions
coresight: etm-perf: update to handle configuration selection
coresight: syscfg: Add API to activate and enable configurations
coresight: etm-perf: Update to activate selected configuration
coresight: etm4x: Add complex configuration handlers to etmv4
coresight: config: Add preloaded configurations
coresight: syscfg: Add initial configfs support
coresight: docs: Add documentation for CoreSight config
.../trace/coresight/coresight-config.rst | 244 ++++++
Documentation/trace/coresight/coresight.rst | 16 +
drivers/hwtracing/coresight/Makefile | 7 +-
.../hwtracing/coresight/coresight-cfg-afdo.c | 154 ++++
.../coresight/coresight-cfg-preload.c | 25 +
.../coresight/coresight-cfg-preload.h | 11 +
.../hwtracing/coresight/coresight-config.c | 246 ++++++
.../hwtracing/coresight/coresight-config.h | 282 +++++++
drivers/hwtracing/coresight/coresight-core.c | 18 +-
.../hwtracing/coresight/coresight-etm-perf.c | 180 ++++-
.../hwtracing/coresight/coresight-etm-perf.h | 12 +-
.../hwtracing/coresight/coresight-etm4x-cfg.c | 184 +++++
.../hwtracing/coresight/coresight-etm4x-cfg.h | 29 +
.../coresight/coresight-etm4x-core.c | 38 +-
.../coresight/coresight-etm4x-sysfs.c | 3 +
.../coresight/coresight-syscfg-configfs.c | 399 +++++++++
.../coresight/coresight-syscfg-configfs.h | 45 ++
.../hwtracing/coresight/coresight-syscfg.c | 761 ++++++++++++++++++
.../hwtracing/coresight/coresight-syscfg.h | 90 +++
include/linux/coresight.h | 7 +
20 files changed, 2721 insertions(+), 30 deletions(-)
create mode 100644 Documentation/trace/coresight/coresight-config.rst
create mode 100644 drivers/hwtracing/coresight/coresight-cfg-afdo.c
create mode 100644 drivers/hwtracing/coresight/coresight-cfg-preload.c
create mode 100644 drivers/hwtracing/coresight/coresight-cfg-preload.h
create mode 100644 drivers/hwtracing/coresight/coresight-config.c
create mode 100644 drivers/hwtracing/coresight/coresight-config.h
create mode 100644 drivers/hwtracing/coresight/coresight-etm4x-cfg.c
create mode 100644 drivers/hwtracing/coresight/coresight-etm4x-cfg.h
create mode 100644 drivers/hwtracing/coresight/coresight-syscfg-configfs.c
create mode 100644 drivers/hwtracing/coresight/coresight-syscfg-configfs.h
create mode 100644 drivers/hwtracing/coresight/coresight-syscfg.c
create mode 100644 drivers/hwtracing/coresight/coresight-syscfg.h
--
2.17.1
by "Interprètes & traductions professionnelles -toutes langues officielles"
Bonjour,
Je me permets de vous écrire afin de vous proposer nos services de traduction et d’interprétariat.
Disposez-vous déjà d'une agence partenaire ?
Notre agence, qui compte parmi les leaders du marché français de la traduction, peut intégralement prendre en charge vos projets multilingues.
Notre agence, basée en France, vous propose:
- Un gestionnaire de projet dédié à votre entreprise.
- La garantie du respect de la confidentialité de vos documents à traduire.
- Une qualité de traduction irréprochable dans tous les domaines.
- Une réactivité sans égale.
- La possibilité de profiter de la parité avantageuse Franc Suisse / Euro.
Voici quelques-unes de nos références: Disney nature, L'Oréal Luxe , Bourbon, La Méridionale, Dailymotion, Saint Gobain, Audemars PIGUET, Pierre Hermé, Airbusiness Academy, Blanchefontaine SA, C-discount, Gretz Communication, Luminox, Hugo Boss, Axa groupe, International Labour Office (BIT), CNRS, LA Recherche Magazine, Puy du Fou International, WWF…vous trouverez toutes les autres sur notre site internet.
N'hésitez surtout pas à me demander un devis gratuit via cette même adresse mail svp,
Bien cordialement,
Jean-Christophe Supot
Dear Sir or Madam,
I am writing to you to propose our translation services.
Do you already work with a partner agency?
Our agency, a leader in the French translation market, can deliver your multilingual projects or those of your clients. Our France-based agency offers you:
- A project manager dedicated to your account
- The complete confidentiality of your documents
- Irreproachable translation quality in all fields.
- Unequalled quick response time
- The possibility to take advantage of the exchange rate between the Euro and Swiss Franc.
Some of our references: Disney nature, L'Oréal Luxe , Bourbon, La Méridionale, Dailymotion, Saint Gobain, Audemars PIGUET, Pierre Hermé, Airbusiness Academy, Blanchefontaine SA, C-discount, Gretz Communication, Luminox, Hugo Boss, Axa groupe, International Labour Office (BIT), CNRS, LA Recherche Magazine, Puy du Fou International, WWF…amongst many others that you can find on our website.
Please feel free to request a free quotation by writing to this email address.
Best regards,
Jean-Christophe Supot
Hi Daniel,
The CoreSight mailing list is the best place to ask these questions -
I've added it to the to: section of this mail.
On Fri, 19 Feb 2021 at 13:43, Daniel Su <daniel.sun.su(a)gmail.com> wrote:
>
> Sorry I made a mistake, I need to switch those bits but those aren't in the ETM mode sysFS parameter.
>
> > On Feb 19, 2021, at 14:21, Daniel Su <daniel.sun.su(a)gmail.com> wrote:
> >
> > Thanks,
> >
> > To just give a bit of background I am doing an internship to improve tracing and debugging for secure world applications in TrustZone. Originally the idea was to come up with a software solution but I thought using the hardware tracing features might be very powerful as the secure world trusted execution environments typically have less debugging and tracing functionalities built into the trusted operating system.
> >
> > I have been doing further reading and I believe I need to configure the ETM mode sysFS parameter.
> >
> > To switch these bits:
> >
> > /* secure state access levels - TRCACATRn */
> > #define ETM_EXLEVEL_S_APP BIT(8)
> > #define ETM_EXLEVEL_S_OS BIT(9)
> > #define ETM_EXLEVEL_S_HYP BIT(10)
> > #define ETM_EXLEVEL_S_MON BIT(11)
> > /* non-secure state access levels - TRCACATRn */
> > #define ETM_EXLEVEL_NS_APP BIT(12)
> > #define ETM_EXLEVEL_NS_OS BIT(13)
> > #define ETM_EXLEVEL_NS_HYP BIT(14)
> > #define ETM_EXLEVEL_NS_NA BIT(15)
> >
ns_exlevel_vinst and s_exlevel_vinst control these bits in the TRCVICTLR.
addr_exlevel_s_ns sets both S and NS bits in the TRCACATRn register
currently addressed by addr_idx.
In the kernel tree -
Documentation/trace/coresight/coresight-etm4x-reference.rst - has lots
of information on programming these sysfs files.
I would advise setting mode first - which will set up some default
values for TRCVITLR, then make any further adjustments you want.
> > Right now I am able to capture the traces and read them out thanks to Leo Yan's command examples and presentation.
> >
> > I still need to figure out how to only trace branching instructions, and also how to best decode the traces. Right now even though I can read out /dev/ec036000.etf , I am unsure how to best go about interpreting the raw trace data.
> >
Hardware trace will trace everything - subject to certain filters -
such as address filtering, exception filtering etc.
It is not possible to trace only branch instructions. You will need to
capture trace, decode then run an analysis on that decode to determine
what branches have been taken.
ETMv4 is program flow trace - so all branches are marked as taken or not taken.
Consider the program:-
===============
0x1000 start: < some code >
...
0x1100 B func1
0x1200 func1: <some code>
....
0x1240 mov r0, &func2
B r0
0x2000 func2: <some code>
================
This will result in trace as follows:-
TRACE_ON
ADDR(0x1000)
ATOM(E)
> > I believe ptm2human and OpenCSD are two open source libraries that allow for decoding of the ETMv4 trace data. I understand there are paid solutions as well such as the DS-5 and Trace32 from Lauterbach to decode.
> >
> > Do you have any recommendations on other decoders or any tips in general as to how to decode the raw trace data into human readable format?
> >
> > Best,
> > Daniel
> >
> >> On Feb 18, 2021, at 18:38, Suzuki K Poulose <suzuki.poulose(a)arm.com> wrote:
> >>
> >> Hi Daniel
> >>
> >> On 2/18/21 4:12 PM, Daniel Su wrote:
> >>> Hello,
> >>> First of all I want to say thanks for your work on the Coresight support as well as the presentation slides. Currently I am working with the Hikey960 which I see is supported and has been used as a reference platform in your slides.
> >>> I believe it should be possible to setup self-hosted Coresight to trace only for branch instructions in the secure world. Currently I am investigating how to set this up on the Hikey960 without access to a hardware debugger.
> >>> I am wondering if any of you have done this before, if there is additional documentation, or if there are any good support groups/chats/channels to ask questions. I have some experience with Coresight mainly from reading the ARM reference manuals but it is still a lot to parse.
> >>
> >> I haven't done anything similar. You should be able to imitate how the
> >> CoreSight drivers program the components ( ETM, Funnels, Replicator and ETR).
> >>
> >> For ETM, you just need to make sure you don't filter out the Secure EL1/EL2/EL0.
> >> You would need to read the manuals for the components or user the kernel driver
> >> as the reference.
> >>
> >> Cheers
> >> Suzuki
> >>
> >>> I believe in Linux I should be using `ns_exlevel_vinst` to filter out Non-Secure instructions. Also since the Hikey960 is multicore, I guess I would need to configure the top level Coresight in order to trace all cores? Would this be the ETR then?
> >>> Best,
> >>> Daniel
> >>
> >
>
--
Mike Leach
Principal Engineer, ARM Ltd.
Manchester Design Centre. UK
From: Wei Yongjun <weiyongjun1(a)huawei.com>
The sparse tool complains as follows:
drivers/hwtracing/coresight/coresight-etm-perf.c:61:25: warning:
symbol 'format_attr_contextid' was not declared. Should it be static?
This symbol is not used outside of coresight-etm-perf.c, so this
commit marks it static.
Reported-by: Hulk Robot <hulkci(a)huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1(a)huawei.com>
---
drivers/hwtracing/coresight/coresight-etm-perf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c
index 0f603b4094f2..bdbb77334329 100644
--- a/drivers/hwtracing/coresight/coresight-etm-perf.c
+++ b/drivers/hwtracing/coresight/coresight-etm-perf.c
@@ -58,7 +58,7 @@ static ssize_t format_attr_contextid_show(struct device *dev,
return sprintf(page, "config:%d\n", pid_fmt);
}
-struct device_attribute format_attr_contextid =
+static struct device_attribute format_attr_contextid =
__ATTR(contextid, 0444, format_attr_contextid_show, NULL);
static struct attribute *etm_config_formats_attr[] = {