Hi,

Thank you for your answers.

1) I updated to the acme's "perf/core" branch, and it's still not solved. I still don't get any events for my recorded traces, except if
     i record "uname -r".

2) I'm trying to integrate directly with OpenCSD, and decode my own traces. I took the "perf.data" file from the HOWTO.md, 
    which contains a valid trace according to the HOWTO, and extracted the trace itself from the perf file. I have a raw trace file
    without any perf related data and structures. I'm trying to open my own decoder, and decode instructions, after taking examples
    from "tools/perf/util/cs-etm-decoder/cs-etm-decoder.c", "tools/perf/util/cs-etm.c". There is no documentation on how to use OpenCSD
    as a library, nothing(full, not partial like the docs in the repo) that i found at least.

    This is a very short example of what i do(same order that they appear in the code) to create a dcd tree, and create a decoder, ignore the error
    validation right now, they are there, i'm making sure this message is short as possible:
    
        /* Open a decoder tree */
        flags |= OCSD_DFRMTR_FRAME_MEM_ALIGN;
        flags |= OCSD_DFRMTR_RESET_ON_4X_FSYNC;
        decoder_tree = ocsd_create_dcd_tree(OCSD_TRC_SRC_FRAME_FORMATTED,
                                            OCSD_DFRMTR_RESET_ON_4X_FSYNC);

        /* Create a __full__  decoder */
        config.arch_ver = ARCH_V8;
        config.core_prof = profile_CortexA;
        config.reg_traceidr = 18; /* specific hard coded trace id to be indentical to perf, just to check if it works */
        ocsd_err = ocsd_dt_create_decoder(decoder_tree, OCSD_BUILTIN_DCD_ETMV4I,
                                                                  OCSD_CREATE_FLG_FULL_DECODER, &config, &csid);

         /* Register my element callback */ 
        ocsd_err = ocsd_dt_set_gen_elem_outfn(decoder_tree,
                                                                         decoder_callback, NULL);

    Now i mmap() my trace file.. and do the following:

   
    /* Reset the decoder */ 
val = ocsd_dt_process_data(dcd_tree, OCSD_OP_RESET, 0, 0, NULL, NULL);
    if (OCSD_DATA_RESP_IS_FATAL(val)) {
            return -1;
    }


From here now, i call ocsd_dt_process_data() to fully decode the trace, just like the code in cs_etm_decoder__process_data_block() in "tools/perf/util/cs-etm-decoder/cs-etm-decoder.c:518".
The problem is, the resetting of the decoder fails fatally in the "OCSD_DATA_RESP_IS_FATAL" macro with the error: "OCSD_RESP_FATAL_NOT_INIT". Not sure what i did wrong, as i followed
the exact code like in perf.

Any suggestions?
Thank you!

Cheers,
Mike.

 







On Thu, Mar 22, 2018 at 4:21 PM, Leo Yan <leo.yan@linaro.org> wrote:
On Thu, Mar 22, 2018 at 05:03:48PM +0800, Kim Phillips wrote:
> On Thu, 22 Mar 2018 07:52:15 +0000
> Mike Leach <mike.leach@linaro.org> wrote:
>
> Hi, sorry, just jumping in with a couple of extra recommendations...
>
> > On 20 March 2018 at 15:34, Mike Bazov <mike@perception-point.io> wrote:
> > >
> > > Thank you for your answers.
> > > I fixed the issue by applying the patches in the pull-request. I'm not
>
> If this means you cherry-picked them without rebasing them onto a very
> late version of perf, then please do that, too.  Preferably this one:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git
>
> because it's perf/core branch contains some recent fixes in the area.

+1.  Before I encountered quite similiar issue with you [1]; after I
used acme branch, then kernel symbol issue can be fixed.

[1] https://patchwork.kernel.org/patch/10115523/

Thanks,
Leo Yan