From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 67419EB64D9 for ; Fri, 7 Jul 2023 15:51:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:References:Cc:To:From: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CLrk35zHO8lNWXqAFTtwOPt09vQnAExw6KXsihOMBdM=; b=Qo0pDINp3UuWxv rfZRzGfIbZZig+ANSkTA01jk9VPS+fHV6pyhDNNMYFZU9CKisGpZqY3tmA0jI8iuNUDxAsaulIhwl HLS5MsZX/2mmiJB7dIXYREVbr3x8WzyIoBwKoxnR3n2GIBuyLgMhwyVGXqjva15xCPjAbV6muQ2s5 +om/q7X9VYXUzwCwsla/RpeqUZMvtKmivRbJXu0TCYTEnqDdYck96Kga8a8JxeEp8vJnmHEbNItg1 cRlyWAMYZMHIJMAGZoVbXWNsprW7dBCMARS7QET8ikghzqk/I84F9hyoG6z+E29bIZUVWQt30Nzv8 P5+8YLUUSvsquv5xTEQQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qHnjg-00564a-1w; Fri, 07 Jul 2023 15:51:08 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qHnjc-00563e-2U for linux-arm-kernel@lists.infradead.org; Fri, 07 Jul 2023 15:51:07 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0EB28D75; Fri, 7 Jul 2023 08:51:44 -0700 (PDT) Received: from [192.168.1.3] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0B7863F740; Fri, 7 Jul 2023 08:51:00 -0700 (PDT) Message-ID: <78876bb6-826e-5b4e-b12f-cee5f6ba91b1@arm.com> Date: Fri, 7 Jul 2023 16:50:59 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: Linux coresight arm64 : Incorrect data in cstrace.bin Content-Language: en-US From: James Clark To: "Pandey, Radhey Shyam" Cc: "coresight@lists.linaro.org" , "linux-arm-kernel@lists.infradead.org" , "mathieu.poirier@linaro.org" , "mike.leach@linaro.org" , "alexander.shishkin@linux.intel.com" , "Sarangi, Anirudha" References: <5c265f56-0ada-b41b-d9c2-677f3c36b1c4@arm.com> <56905d7a-a91e-883a-b707-9d5f686ba5f1@arm.com> In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230707_085104_908978_D4F725BE X-CRM114-Status: GOOD ( 26.69 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 07/07/2023 09:49, James Clark wrote: > > > On 06/07/2023 13:47, Pandey, Radhey Shyam wrote: >>> -----Original Message----- >>> From: Pandey, Radhey Shyam >>> Sent: Thursday, July 6, 2023 5:40 PM >>> To: James Clark >>> Cc: coresight@lists.linaro.org; linux-arm-kernel@lists.infradead.org; Suzuki K >>> Poulose ; mathieu.poirier@linaro.org; >>> mike.leach@linaro.org; leo.yan@linaro.org; >>> alexander.shishkin@linux.intel.com; Sarangi, Anirudha >>> >>> Subject: RE: Linux coresight arm64 : Incorrect data in cstrace.bin >>> >>>> -----Original Message----- >>>> From: James Clark >>>> Sent: Wednesday, July 5, 2023 5:44 PM >>>> To: Pandey, Radhey Shyam >>>> Cc: coresight@lists.linaro.org; linux-arm-kernel@lists.infradead.org; >>>> Suzuki K Poulose ; mathieu.poirier@linaro.org; >>>> mike.leach@linaro.org; leo.yan@linaro.org; >>>> alexander.shishkin@linux.intel.com; Sarangi, Anirudha >>>> >>>> Subject: Re: Linux coresight arm64 : Incorrect data in cstrace.bin >>>> >>>> >>>> >>>> On 05/07/2023 12:48, Pandey, Radhey Shyam wrote: >>>>>> -----Original Message----- >>>>>> From: James Clark >>>>>> Sent: Wednesday, July 5, 2023 4:29 PM >>>>>> To: Pandey, Radhey Shyam >>>>>> Cc: coresight@lists.linaro.org; >>>>>> linux-arm-kernel@lists.infradead.org; >>>>>> Suzuki K Poulose ; >>>>>> mathieu.poirier@linaro.org; mike.leach@linaro.org; >>>>>> leo.yan@linaro.org; alexander.shishkin@linux.intel.com >>>>>> Subject: Re: Linux coresight arm64 : Incorrect data in cstrace.bin >>>>>> >>>>>> >>>>>> >>>>>> On 05/07/2023 10:56, Pandey, Radhey Shyam wrote: >>>>>>>> -----Original Message----- >>>>>>>> From: Suzuki K Poulose >>>>>>>> Sent: Wednesday, July 5, 2023 1:57 PM >>>>>>>> To: Pandey, Radhey Shyam ; >>>>>>>> mathieu.poirier@linaro.org; mike.leach@linaro.org; >>>>>>>> leo.yan@linaro.org; alexander.shishkin@linux.intel.com >>>>>>>> Cc: coresight@lists.linaro.org; >>>>>>>> linux-arm-kernel@lists.infradead.org >>>>>>>> Subject: Re: Linux coresight arm64 : Incorrect data in >>>>>>>> cstrace.bin >>>>>>>> >>>>>>>> Hi Radhe Shyam >>>>>>>> >>>>>>>> On 05/07/2023 05:38, Pandey, Radhey Shyam wrote: >>>>>>>>> Hi, >>>>>>>>> >>>>>>>>> I am using linux 6.1 kernel coresight framework to capture ETM >>> trace. >>>>>>>>> Enabled coresight driver and added coresight component device >>>>>>>>> node in DTS. With that, we could probe all coresight components. >>>>>>>>> >>>>>>>>> But when we do capture using sysfs and then read the trace.bin >>>>>>>>> using ptm2human we see invalid trace data. Trace content >>>>>>>>> changes on each capture. Any pointers to help narrow down the >>> issue? >>>>>>>>> >>>>>>>>> Tried: sysfs capture and perf (with OpenCSD enabled) >>>>>>>>> >>>>>>>>> Development board: VCK190 : >>>>>>>>> https://docs.xilinx.com/r/en-US/ug1366-vck190-eval-bd >>>>>>>>> https://www.xilinx.com/support/documents/architecture- >>>>>>>> manuals/am011-ve >>>>>>>>> rsal-acap-trm.pdf >>>>>>>>> >>>>>>>>> xilinx-vck190-20231:/home/petalinux# dmesg | grep -i amba >>>>>>>>> [ 0.301054] Serial: AMBA PL011 UART driver >>>>>>>>> [ 0.306226] amba f0c20000.funnel: Fixing up cyclic dependency >>> with >>>>>>>> f0d70000.etm >>>>>>>>> [ 0.313624] amba f0c20000.funnel: Fixing up cyclic dependency >>> with >>>>>>>> f0d30000.etm >>>>>>>>> [ 0.321110] amba f0c30000.etf: Fixing up cyclic dependency with >>>>>>>> f0c20000.funnel >>>>>>>>> [ 1.470247] Serial: AMBA driver >>>>>>>>> xilinx-vck190-20231:/home/petalinux# dmesg | grep -i coresight >>>>>>>>> [ 1.865006] cs_system_cfg: CoreSight Configuration manager >>>> initialised >>>>>>>>> [ 1.876858] coresight etm0: CPU0: etm v4.0 initialized >>>>>>>>> [ 1.885666] coresight etm1: CPU1: etm v4.0 initialized >>>>>>>>> [ 1.894435] coresight-cpu-debug f0d00000.debug1: Coresight >>> debug- >>>>>> CPU0 >>>>>>>> initialized >>>>>>>>> [ 1.902072] coresight-cpu-debug f0d40000.debug1: Coresight >>> debug- >>>>>> CPU1 >>>>>>>> initialized >>>>>>>>> >>>>>>>>> xilinx-vck190-20231:/home/petalinux# ls >>> /sys/bus/coresight/devices/ >>>>>>>>> etm0 etm1 funnel0 tmc_etf0 >>>>>>>>> >>>>>>>>> cd /sys/bus/coresight/devices/ echo 1 > tmc_etf0/enable_sink >>>>>>>>> echo 1 > etm0/enable_source echo 0 > etm0/enable_source echo 0 > >>>>>>>>> tmc_etf0/enable_sink cd /root/ dd if=/dev/tmc_etf0 >>>>>>>>> of=cstrace_28Jun.bin >>>>>>>>> >>>>>>>>> ./ptm2human/ptm2human -e -i cstrace.bin -d >>>>>>>> >>>>>>>> Please note that ptm2human is for PTM trace decoding and >>>>>>>> ETMv4 uses a different format and thus is not compatible. >>>>>>>> >>>>>>>>> >>>>>>>>> I also tried OpenCSD integration with PERF. >>>>>>>> >>>>>>>> Have you made sure the perf is "linked" to the opencsd ? >>>>>>> >>>>>>> Earlier I statically linked but after adding CORESIGHT=1. >>>>>>> >>>>>>> >>>>>>> linux-xlnx$ make ARCH=arm64 NO_LIBELF=1 NO_JVMTI=1 VF=1 >>>>>> CORESIGHT=1 -C >>>>>>> tools/perf/ >>>>>>> make: Entering directory 'linux-xlnx/tools/perf' >>>>>>> BUILD: Doing 'make -j24' parallel build >>>>>>> >>>>>>> Makefile.config:520: *** Error: No libopencsd library found or the >>>>>>> version >>>>>> is not up-to-date. >>>>>>> Please install recent libopencsd to build with CORESIGHT=1. Stop. >>>>>>> >>>>>>> >>>>>>> echo $CSINCLUDES >>>>>>> /scratch/development/coresight/my-opencsd/decoder/include >>>>>>> radheys@xhdradheys41:/scratch/development/linux-xlnx$ ls >>>>>>> /scratch/development/coresight/my-opencsd/decoder/include >>>>>>> common i_dec interfaces mem_acc opencsd opencsd.h >>>>>>> pkt_printers >>>>>>> >>>>>>> echo $CSLIBS >>>>>>> /scratch/development/coresight/my-opencsd/decoder/lib/builddir >>>>>>> radheys@xhdradheys41:/scratch/development/linux-xlnx$ ls >>>>>> /scratch/development/coresight/my-opencsd/decoder/lib/builddir >>>>>>> libopencsd.a libopencsd_c_api.so libopencsd_c_api.so.1.4.0 >>>>>> libopencsd.so.1 >>>>>>> libopencsd_c_api.a libopencsd_c_api.so.1 libopencsd.so >>>>>> libopencsd.so.1.4.0 >>>>>>> >>>>>>> Anything I am missing to fix this opencsd lib not found? >>>>>> >>>>>> There is a minimum version of 1.1.1 but it looks like you are using >>>>>> higher than that so that part should be fine. >>>>>> >>>>>> Personally I "make install" OpenCSD to the system path. I had a >>>>>> play around with $CSLIBS it and maybe there is also some stickyness >>>>>> to the feature detection so a make clean might help to make sure >>>>>> the errors you are seeing are real. >>>>>> >>>>>> Lastly you can print the output of why the feature test compilation >>>>>> failed which might help. I see some linking issues in there if I >>>>>> delete my system installed version of OpenCSD, so there might be a >>>>>> bug with just using CSINCLUDES and CSLIBS: >>>>>> >>>>>> $ cat tools/build/feature/test-libopencsd.make.output >>>>>> >>>>>> /usr/bin/ld: warning: libopencsd.so.1, needed by opencsd- >>>>>> local/decoder/lib/builddir//libopencsd_c_api.so, not found (try >>>>>> using -rpath or -rpath-link) >>>>>> /usr/bin/ld: opencsd-local/decoder/lib/builddir//libopencsd_c_api.so: >>>>>> undefined reference to `vtable for StmTrcPacket' >>>>>> /usr/bin/ld: opencsd-local/decoder/lib/builddir//libopencsd_c_api.so: >>>>>> undefined reference to `DecodeTree::getDecoderStats(unsigned char, >>>>>> _ocsd_decode_stats**)' >>>>>> /usr/bin/ld: opencsd-local/decoder/lib/builddir//libopencsd_c_api.so: >>>>>> undefined reference to >>>>>> `DecodeTree::addRawFramePrinter(RawFramePrinter**, unsigned int)' >>>>>> >>>>>> Can you try the make install and see if that works? If that works >>>>>> but the other way doesn't I can try looking into why its not and make a >>> fix. >>>>> >>>>> I tried make install but still it errors out. Looking at make.output >>>>> I am seeing multiple undefined references. >>>>> >>>>> NOTE I have to still set CSINCLUDES and CSLIBS as we are >>>>> cross-compiling Perf on a x86 host machine. >>>> >>>> This should still work if you make install them to the arch specific >>>> folder for example /usr/lib/aarch64-linux-gnu/. If do 'apt install >>> libopencsd-dev:arm64' >>>> I would get the arm ones in there. >>>> >>>> Then if I cross build like this I get openCSD linked: >>>> >>>> make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -C tools/perf >>>> CORESIGHT=1 >>>> >>>> So for now you should be able to work around the issue in this way. >>> >>> I tried copying opencsd libraries to /usr/lib/aarch64-linux-gnu but still I see >>> undefined reference. Is it because I am using cross-compiler from server >>> (toolchain path set to $PATH variable)? >>> >>> /proj//Vitis/2023.2/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux- >>> gnu-gcc >>> I assume CSLIBS and CSINCLUDES should be sufficient to cross compile perf >>> with coresight support? >> >> FYI, I tried with static linking and could proceed to perf compilation. >> > > Static compilation works because the link line is slightly different (it > includes -lopencsd rather than just -lopencsd_c_api: > > ifeq ($(findstring -static,${LDFLAGS}),-static) > OPENCSDLIBS += -lopencsd -lstdc++ > > I think that this is related to the issue and there have been some > recent changes around here. So yes I'll look into the fix for the non > static and $CSLIBS mode. There was an issue, thanks for the report. The fix should be here: https://lore.kernel.org/all/20230707154546.456720-1-james.clark@arm.com/T/#u Please give it a go and reply with the outcome on that thread. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel