[EXT] [PATCH v3 5/9] trace: fix dynamically enabling trace points

Jerin Jacob jerinjacobk at gmail.com
Fri Oct 14 10:37:16 CEST 2022


On Fri, Oct 14, 2022 at 1:49 PM David Marchand
<david.marchand at redhat.com> wrote:
>
> On Fri, Oct 14, 2022 at 6:27 AM Jerin Jacob <jerinjacobk at gmail.com> wrote:
> >
> > On Fri, Oct 14, 2022 at 12:41 AM David Marchand
> > <david.marchand at redhat.com> wrote:
> > >
> > > On Thu, Oct 13, 2022 at 7:07 PM Harman Kalra <hkalra at marvell.com> wrote:
> > > > >
> > > > > With the whole traces fixes series applied first, then the new "trace:
> > > > > take live traces via telemetry" patch applied, I can't reproduce your issue.
> > > > >
> > > > >
> > > >
> > > > Yes, you replicated the same scenario what I tried.
> > > > Sorry, I realized that actually it's not an issue, traces generated after /trace/save are getting
> > > > appended but in the same file (timestamped on /trace/save) on rte_eal_cleanup().
> > > >
> > > > I assumed that trace dir generated with a timestamp will include all the trace points emitted
> > > > before that timestamp. But in the above scenario same  trace dir includes trace points emitted
> > > > after this timestamp. I think this is bit confusing. Shall we add a logic where if already_done is
> > > > set, rename the original trace dir to latest timestamp?
> > >
> > > Afaiu, the behavior before this series was the same.
> > > An application calling rte_trace_save() would always save to a single directory.
> > > One thing that changed though is that the directory is timestamped
> > > with the time of the first call to rte_trace_save.
> > > Before the seriesn the timestamp was based on the time when the trace
> > > subsystem was initialised.
> > >
> > >
> > > We can go with what you describe (which makes sense to me).
> > > But I'd like to get a ack from traces maintainers before looking into it.
> >
> > IMO, We can remove "already_done" logic, whenever, rte_trace_save()
> > called, it creates
> > the directory of that timestamp and copies the trace buffers. Since we
> > have "overwrite" and "discard"
> > modes, it is better to not add "already_done" dogic in rte_trace_save().
>
> Well, it's a bit more difficult than just removing already_done.
>
> Before my changes, the timestamp was decided and the directory created
> once and for all at init.
> On the other hand, every trace_mkdir() call resulted in a
> trace_dir_update() call.
> --> /trace/save
> {"/trace/save": {"Status": "OK", "Path":
> "/home/dmarchan/dpdk-traces/rte-2022-10-14-AM-08-39-37"}}
> --> /trace/save
> {"/trace/save": {"Status": "OK", "Path":
> "/home/dmarchan/dpdk-traces/rte-2022-10-14-AM-08-39-37rte-2022-10-14-AM-08-39-38"}}
>
> I prototyped a change (which deserves a separate patch).
> Testing it, there is still one corner case when calling
> rte_trace_save() twice in the same minute:
> --> /trace/save
> {"/trace/save": {"Status": "OK", "Path":
> "/home/dmarchan/dpdk-traces/rte-2022-10-14-AM-10-11-19"}}
> --> /trace/save
> {"/trace/save": {"Status": "KO", "Path":
> "/home/dmarchan/dpdk-traces/rte-2022-10-14-AM-10-11-19"}}
>
> EAL: Trace dir: /home/dmarchan/dpdk-traces/rte-2022-10-14-AM-10-11-19
> EAL: trace_mkdir():321 mkdir
> /home/dmarchan/dpdk-traces/rte-2022-10-14-AM-10-11-19 failed [File
> exists]
>
> What do you suggest for this?

Top of the tree has "seconds" in trace director creation[1]. That will
make it unique in all practical cases.

To make future proof:

We could do either of
1)Even with the second, if a directory exists and wait for 1sec and do
from trace_session_name_generate()
2)Add 2 or 3 digits in the name. Have a counter to make it unique if
the directory exists.


[1]
      rc = strftime(trace_dir + rc, TRACE_DIR_STR_LEN - rc,
                        "%Y-%m-%d-%p-%I-%M-%S", tm_result);


>
>
> --
> David Marchand
>


More information about the stable mailing list