From: leo.yan@linaro.org
To: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Al Grant <Al.Grant@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Coresight ML <coresight@lists.linaro.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Robert Walker <robert.walker@arm.com>,
Jiri Olsa <jolsa@redhat.com>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
Mike Leach <mike.leach@linaro.org>
Subject: Re: [PATCH v2 2/2] perf cs-etm: Add support sample flags
Date: Wed, 5 Dec 2018 14:38:32 +0800 [thread overview]
Message-ID: <20181205063832.GD15964@leoy-ThinkPad-X240s> (raw)
In-Reply-To: <CANLsYkxQVpSP1D2M_bCni=nkZyo4qC=d33bWC1Xy0_vDfX9Agg@mail.gmail.com>
On Tue, Nov 20, 2018 at 09:53:41AM -0700, Mathieu Poirier wrote:
[...]
> > > +static void cs_etm__fixup_flags(struct cs_etm_queue *etmq)
> > > +{
> > > + /*
> > > + * Decoding stream might insert one TRACE_OFF packet in the
> > > + * middle of instruction packets, this means it doesn't
> > > + * contain the pair packets with TRACE_OFF and TRACE_ON.
> > > + * For this case, the instruction packet follows with
> > > + * TRACE_OFF packet so we need to fixup prev_packet with flag
> > > + * PERF_IP_FLAG_TRACE_BEGIN, this flag finally is used by the
> > > + * instruction packet to generate samples.
> > > + */
> > > + if (etmq->prev_packet->sample_type == CS_ETM_TRACE_OFF &&
> > > + etmq->packet->sample_type == CS_ETM_RANGE)
> > > + etmq->prev_packet->flags = PERF_IP_FLAG_BRANCH |
> > > + PERF_IP_FLAG_TRACE_BEGIN;
> > > +
> > > + if (etmq->prev_packet->sample_type == CS_ETM_RANGE) {
> > > + /*
> > > + * When the exception packet is inserted, update flags
> > > + * so tell perf it is exception related branches.
> > > + */
> > > + if (etmq->packet->sample_type == CS_ETM_EXCEPTION ||
> > > + etmq->packet->sample_type == CS_ETM_EXCEPTION_RET)
> > > + etmq->prev_packet->flags = etmq->packet->flags;
> > > +
> > > + /*
> > > + * The trace is discontinuous, weather this is caused by
> > > + * TRACE_ON packet or TRACE_OFF packet is coming, if the
> > > + * previous packet is instruction packet, simply set flag
> > > + * PERF_IP_FLAG_TRACE_END for previous packet.
> > > + */
> > > + if (etmq->packet->sample_type == CS_ETM_TRACE_ON ||
> > > + etmq->packet->sample_type == CS_ETM_TRACE_OFF)
> > > + etmq->prev_packet->flags |= PERF_IP_FLAG_TRACE_END;
> > > + }
> > > +}
> > > +
> >
> > I think it would be better to keep all the flag related processing in
> > cs-etm-decoder.c so that things in cs-etm.c are only concered with dealing with
> > perf.
> >
> > Look at function cs_etm__alloc_queue(), there you'll find "d_params.data = etmq".
> >
> > In function cs_etm_decoder__new(), decoder->data = d_params->data;
> >
> > This means that anywhere you have a decoder, decoder->data is an etmq. I've
> > used this profusely in my work on CPU-wide trace scenarios. Because you're
> > getting there ahead of me you'll need to fix the declaration of struct
> > cs_etm_queue but that's easy.
>
> I've been thinking further about this and manipulating the etmq packet
> and prev_packet from the cs-etm-decoder.c won't work because all we
> have at that time is the decoder's packet queue. My goal is to
> manipulate the flags in only one place - either in cs-etm.c or
> cs-etm-decoder.c but not in both. It might be worth trying to do the
> implementation in cs-etm.c since there is already a lot of packet flow
> intelligence happening there.
Agree. cs-etm.c has more context info than cs-etm-decoder.c, will
try to refactor in single place in cs-etm.c.
[...]
Thanks,
Leo Yan
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2018-12-05 6:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-11 5:07 [PATCH v2 0/2] perf cs-etm: Add support for sample flags Leo Yan
2018-11-11 5:07 ` [PATCH v2 1/2] perf cs-etm: Set branch instruction flags in packet Leo Yan
2018-11-19 22:26 ` Mathieu Poirier
2018-12-05 6:25 ` leo.yan
2018-12-05 17:40 ` Mathieu Poirier
2018-12-06 5:33 ` leo.yan
2018-11-11 5:07 ` [PATCH v2 2/2] perf cs-etm: Add support sample flags Leo Yan
2018-11-19 23:22 ` Mathieu Poirier
2018-11-20 16:53 ` Mathieu Poirier
2018-12-05 6:38 ` leo.yan [this message]
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=20181205063832.GD15964@leoy-ThinkPad-X240s \
--to=leo.yan@linaro.org \
--cc=Al.Grant@arm.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=coresight@lists.linaro.org \
--cc=jolsa@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=mike.leach@linaro.org \
--cc=namhyung@kernel.org \
--cc=robert.walker@arm.com \
/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