Subject: [PATCH v1] perf: cs-etm: Fix ETMv4 CONFIGR entry in perf.data file

From: [email-masked] (Arnaldo Carvalho de Melo)
Date: Tue, 1 Aug 2017 13:44:46 -0300

Em Tue, Aug 01, 2017 at 10:17:56AM -0600, Mathieu Poirier escreveu:
> On 24 July 2017 at 13:37, Mathieu Poirier <[email-masked]> wrote:
> > On 21 July 2017 at 13:11, Arnaldo Carvalho de Melo <[email-masked]> wrote:
> >> Em Fri, Jul 21, 2017 at 03:37:40PM -0300, Arnaldo Carvalho de Melo escreveu:
> >>> Em Fri, Jul 21, 2017 at 03:35:33PM -0300, Arnaldo Carvalho de Melo escreveu:
> >>> > Em Fri, Jul 21, 2017 at 01:19:16PM -0300, Arnaldo Carvalho de Melo escreveu:
> >>> > > Em Fri, Jul 21, 2017 at 08:50:09AM -0600, Mathieu Poirier escreveu:
> >>> > > > On 12 July 2017 at 11:01, Mike Leach <[email-masked]> wrote:
> >>> > > > > The value passed into the perf.data file for the CONFIGR register in ETMv4
> >>> > > > > was incorrectly being set to the command line options/ETMv3 value.
> >>> > > > >
> >>> > > > >                 info->priv[*offset + CS_ETMV4_TRCTRACEIDR] =
> >>> > > > >                                                 coresight_get_trace_id(cpu);
> >>> > > >
> >>> > > > I have tested this patch on my side and things work as advertised now.
> >>> > > >
> >>> > > > Arnaldo, if you want to pick this up through your tree then:
> >>> > > >
> >>> > > > Acked-by: Mathieu Poirier <[email-masked]>
> >>> > > >
> >>> > > > Otherwise I'll get this, whatever you prefer.
> >>> > >
> >>> > > I'll get it, thanks for the ping,
> >>> >
> >>> > It is breaking the build in one of my containers, one with fedora 24 and
> >>> > a android toolchain from http://dl.google.com/android/repository/android-ndk-r12b-linux-x86_64.zip
> >>> >
> >>> > arch/arm/util/cs-etm.c: In function 'cs_etmv4_get_config':^M
> >>> > arch/arm/util/cs-etm.c:289:24: error: 'ETM_OPT_RETSTK' undeclared (first use in this function)^M
> >>> >   if (config_opts & BIT(ETM_OPT_RETSTK))
> >>> >
> >>> > It builds as
> >>> >
> >>> > NDK=/opt/android-ndk-r12b/
> >>> > NDK_TOOLCHAIN=${NDK}/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-
> >>> > NDK_SYSROOT=${NDK}/platforms/android-24/arch-arm
> >>> > make -C /git/linux/tools/perf O=/tmp/build/perf WERROR=0 CFLAGS=${CFLAGS} ARCH=arm CROSS_COMPILE=${NDK_TOOLCHAIN} EXTRA_CFLAGS="-pie --sysroot=${NDK_SYSROOT}"
> >>> > Ideas?
> >>>
> >>> Ok, it also fails on:
> >>>
> >>>   14 debian:experimental-x-arm64: FAIL
> >>
> >> Ok, we need a definition for ETM_OPT_RETSTK, just like we have for the
> >> other two...
> >>
> >> Nuked it from my perf/core branch, please resubmit.
> >
> > Symbol ETM_OPT_RETSTK was added as part of another patch [1] that is
> > already in my CoreSight tree.  Do you mind if we make this one go
> > through my tree then?
> 
> I haven't heard back from this so I'll assume you want me to take the patch.

Yeah, I should've replied to you, but since this depends on stuff only
in your tree, going thru that is sensible :-)

Ack.

- Arnaldo