Closed solomonbstoner closed 5 years ago
On Tue, 19 Mar 2019 at 01:46, Solomon notifications@github.com wrote:
After installing the OpenCSD library, I tried to compile perf from perf-opencsd. I used the command make VF=1 -C tools/perf. However, I got the following error:
CC util/intel-pt-decoder/intel-pt-log.o
CC util/cs-etm-decoder/cs-etm-decoder.o
util/cs-etm-decoder/cs-etm-decoder.c: In function ‘cs_etm_decoder__buffer_range’:
util/cs-etm-decoder/cs-etm-decoder.c:370:2: error: enumeration value ‘OCSD_INSTR_WFI_WFE’ not handled in switch [-Werror=switch-enum]
switch (elem->last_i_type) {
^
~CC util/intel-pt-decoder/intel-pt-decoder.o
cc1: all warnings being treated as errors
Has anyone had the same issue before?
I have seen this yes. You probably have installed the Debian package which, unfortunately, takes a little time to update when a new version of the library gets released. To fix the problem get the openCSD library from the github repository. When you have compiled the code environment variable CSINCLUDES and CSLIBS need to be set to tell the perf build script to use local binaries rather than the system's. In my environment things look like this:
mpoirier@xps15:~/work/coresight/kernel-410c$ echo $CSINCLUDES /home/mpoirier/work/opencsd/decoder/include/ mpoirier@xps15:~/work/coresight/kernel-410c$ echo $CSLIBS /home/mpoirier/work/opencsd/decoder/lib/builddir/ mpoirier@xps15:~/work/coresight/kernel-410c$
When doing that LD_LIBRARY_PATH also needs to be set in the shell where you will be calling the 'perf' application. Otherwise the loader will be using the system's library. Note that starting with the 5.1-rc1 cycle the perf tools needs a new flag, i.e "CORESIGHT=1", to compile CoreSight:
mpoirier@xps15:~/work/coresight/kernel-410c$ make VF=1 CORESIGHT=1 -C tools/perf.
Now that 5.1-rc1 is out I will be updating the HOWTO.md on github to reflect the above. Let me know if you run into more issues.
Thanks, Mathieu
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Linaro/OpenCSD/issues/17, or mute the thread https://github.com/notifications/unsubscribe-auth/AAi323UaAYh_KTB-4hhXugyUgQ4tX1KAks5vYJXogaJpZM4b7ekW .
Thank you for the advice. However, it did not fix the problem. I git cloned this OpenCSD repository and compiled from source. I also set the environment variables as you advised, but the error still persists.
/home/solomonbstoner/Documents/Github_clones/perf-opencsd [git::master *] [solomonbstoner@solomonUbuntu]
> echo $LD_LIBRARY_PATH
/home/solomonbstoner/Documents/Github_clones/OpenCSD/decoder/lib/builddir
/home/solomonbstoner/Documents/Github_clones/perf-opencsd [git::master *] [solomonbstoner@solomonUbuntu]
> echo $CSLIBS
/home/solomonbstoner/Documents/Github_clones/OpenCSD/decoder/lib/builddir
/home/solomonbstoner/Documents/Github_clones/perf-opencsd [git::master *] [solomonbstoner@solomonUbuntu]
> echo $CSINCLUDES
/home/solomonbstoner/Documents/Github_clones/OpenCSD/decoder/include
/home/solomonbstoner/Documents/Github_clones/perf-opencsd [git::master *] [solomonbstoner@solomonUbuntu] [22:28]
> make VF=1 -C tools/perf
[...]
CC util/cs-etm-decoder/cs-etm-decoder.o
CC util/scripting-engines/trace-event-python.o
CC util/intel-pt.o
CC util/intel-bts.o
util/cs-etm-decoder/cs-etm-decoder.c: In function ‘cs_etm_decoder__buffer_range’:
util/cs-etm-decoder/cs-etm-decoder.c:370:2: error: enumeration value ‘OCSD_INSTR_WFI_WFE’ not handled in switch [-Werror=switch-enum]
switch (elem->last_i_type) {
^~~~~~
cc1: all warnings being treated as errors
mv: cannot stat 'util/cs-etm-decoder/.cs-etm-decoder.o.tmp': No such file or directory
I did, however, manage to get rid of the error by adding the line of code case OCSD_INSTR_WFI_WFE:
into perf-opencsd/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
:
switch (elem->last_i_type) {
case OCSD_INSTR_BR:
case OCSD_INSTR_BR_INDIRECT:
case OCSD_INSTR_WFI_WFE:
packet->last_instr_taken_branch = elem->last_instr_exec;
break;
case OCSD_INSTR_ISB:
case OCSD_INSTR_DSB_DMB:
case OCSD_INSTR_OTHER:
default:
packet->last_instr_taken_branch = false;
break;
}
I added it there as I saw OCSD_INSTR_WFI_WFE, /**< WFI or WFE traced as direct branch */
from OpenCSD/decoder/include/opencsd/ocsd_if_types.h
. I assume OCSD_INSTR_WFI_WFE
has got something to do with branching, so I added that case
in. Was I right to do that? Thank you.
Hi,
The OCSD_INSTR_WFI_WFE instruction sub-type is added to the library headers from version 0.11.0 of openCSD to support later ETMv4 versions. This does require an update to the perf code in cs-etm-decoder.c to add this value into the handling code in the default part of the case statement - e.g.:-
case OCSD_INSTR_ISB:
case OCSD_INSTR_DSB_DMB:
The perf-opencsd master branch has not had an update to cover this yet.
The present perf decode does not use this value. If you do not specifically need ETMv4.3 support for authenticated pointer trace then it is safe to use the latest v0.10.x decoder with the perf-opencsd. Otherwise you will need to patch locally till a patch is made available in the repository, or the upstream perf supports the later OpenCSD.
Regards
Mike
On Tue, 19 Mar 2019 at 07:46, Solomon notifications@github.com wrote:
After installing the OpenCSD library, I tried to compile perf from perf-opencsd. I used the command make VF=1 -C tools/perf. However, I got the following error:
CC util/intel-pt-decoder/intel-pt-log.o
CC util/cs-etm-decoder/cs-etm-decoder.o
util/cs-etm-decoder/cs-etm-decoder.c: In function ‘cs_etm_decoder__buffer_range’:
util/cs-etm-decoder/cs-etm-decoder.c:370:2: error: enumeration value ‘OCSD_INSTR_WFI_WFE’ not handled in switch [-Werror=switch-enum]
switch (elem->last_i_type) {
^
~CC util/intel-pt-decoder/intel-pt-decoder.o
cc1: all warnings being treated as errors
Has anyone had the same issue before?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
-- Mike Leach Principal Engineer, ARM Ltd. Manchester Design Centre. UK
On Tue, 19 Mar 2019 at 08:37, Solomon notifications@github.com wrote:
Thank you for the advice. However, it did not fix the problem. I git cloned this OpenCSD repository and compiled from source. I also set the environment variables as you advised, but the error still persists.
/home/solomonbstoner/Documents/Github_clones/perf-opencsd [git::master *] [solomonbstoner@solomonUbuntu]
echo $LD_LIBRARY_PATH
/home/solomonbstoner/Documents/Github_clones/OpenCSD/decoder/lib/builddir
/home/solomonbstoner/Documents/Github_clones/perf-opencsd [git::master *] [solomonbstoner@solomonUbuntu]
echo $CSLIBS
/home/solomonbstoner/Documents/Github_clones/OpenCSD/decoder/lib/builddir
/home/solomonbstoner/Documents/Github_clones/perf-opencsd [git::master *] [solomonbstoner@solomonUbuntu]
echo $CSINCLUDES
/home/solomonbstoner/Documents/Github_clones/OpenCSD/decoder/include
/home/solomonbstoner/Documents/Github_clones/perf-opencsd [git::master *] [solomonbstoner@solomonUbuntu] [22:28]
make VF=1 -C tools/perf
[...]
CC util/cs-etm-decoder/cs-etm-decoder.o
CC util/scripting-engines/trace-event-python.o
CC util/intel-pt.o
CC util/intel-bts.o
util/cs-etm-decoder/cs-etm-decoder.c: In function ‘cs_etm_decoder__buffer_range’:
util/cs-etm-decoder/cs-etm-decoder.c:370:2: error: enumeration value ‘OCSD_INSTR_WFI_WFE’ not handled in switch [-Werror=switch-enum]
switch (elem->last_i_type) {
^
~cc1: all warnings being treated as errors
mv: cannot stat 'util/cs-etm-decoder/.cs-etm-decoder.o.tmp': No such file or directory
I did, however, manage to get rid of the error by adding the line of code case OCSD_INSTR_WFI_WFE: into perf-opencsd/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c:
switch (elem->last_i_type) { case OCSD_INSTR_BR: case OCSD_INSTR_BR_INDIRECT: case OCSD_INSTR_WFI_WFE: packet->last_instr_taken_branch = elem->last_instr_exec; break; case OCSD_INSTR_ISB: case OCSD_INSTR_DSB_DMB: case OCSD_INSTR_OTHER: default: packet->last_instr_taken_branch = false; break; }
I added it there as I saw OCSD_INSTR_WFI_WFE, /*< WFI or WFE traced as direct branch / from OpenCSD/decoder/include/opencsd/ocsd_if_types.h. I assume OCSD_INSTR_WFI_WFE has got something to do with branching, so I added that case in. Was I right to do that? Thank you.
Ah yes, I understand. I fixed the problem in a patchset that was released to the coresight mailing list... But that set is still under review and hasn't been merged yet. Your fix is good. You can either send me a patch on the public mailing list or I'll simply fix it on my side - let me know what you want to do.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Linaro/OpenCSD/issues/17#issuecomment-474399403, or mute the thread https://github.com/notifications/unsubscribe-auth/AAi32-lhX9c3O3HyxGPKilkunDvm95z-ks5vYPY9gaJpZM4b7ekW .
Closing this issue as perf related - perf needs update to cope with updated library version. No change required to OpenCSD.
@mikel-armbb Thank you for the help! @mathieupoirier Thank you for the help! I've sent you a patch.
Per my last mail - OCSD_INSTR_WFI_WFE must appear in the second part of the switch statement.
i.e. switch (elem->last_i_type) { case OCSD_INSTR_BR: case OCSD_INSTR_BR_INDIRECT: packet->last_instr_taken_branch = elem->last_instr_exec; break; case OCSD_INSTR_ISB: case OCSD_INSTR_DSB_DMB: case OCSD_INSTR_WFI_WFE: case OCSD_INSTR_OTHER: default: packet->last_instr_taken_branch = false; break; }
The OCSD_INSTR_WFI_WFE: type will not be seen till using versions of ETMv4.3 onwards - and only then rarely and if explicitly programmed - but there is no need to lay a trap for unsuspecting future users!
Mike
On Tue, 19 Mar 2019 at 15:19, Solomon notifications@github.com wrote:
@mikel-armbb Thank you for the help! @mathieupoirier Thank you for the help! I've sent you a patch.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
-- Mike Leach Principal Engineer, ARM Ltd. Manchester Design Centre. UK
After installing the OpenCSD library, I tried to compile
perf
fromperf-opencsd
. I used the commandmake VF=1 -C tools/perf
. However, I got the following error:Has anyone had the same issue before?