Re: [PATCH v15 11/18] trace-cmd: Exchange tracing IDs between host and guest

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 28, 2019 at 4:58 PM Tzvetomir Stoyanov
<tz.stoyanov@xxxxxxxxx> wrote:
>
> On Thu, Nov 28, 2019 at 4:34 PM Slavomir Kaslev
> <slavomir.kaslev@xxxxxxxxx> wrote:
> >
>  ...
> > > -       ret = tracecmd_msg_recv_trace_req(msg_handle, &argc, &argv, &use_fifos);
> > > +       ret = tracecmd_msg_recv_trace_req(msg_handle, &argc, &argv,
> > > +                                         &use_fifos, &trace_id);
> >
> > Why is `tracecmd_msg_recv_trace_req` receiving trace_id if it's
> > getting generated by the agent below?
> >
> Each peer generates its own trace id and stores it in its trace.dat
> file. tracecmd_msg_recv_trace_req() receives the trace ID of the host
> and tracecmd_msg_send_trace_resp() replies its own trace ID.
> May be it is a good idea in case of guest to not generate trace ID,
> but to use the one generated by the host ?

Actually each peer in a tracing session must have its own, unique trace ID.
These IDs are used to distinguish guests (in case there is more than one) in
the host context. In the host's trace.dat file a TRACECMD_OPTION_GUEST
option is written for each guest, describing guest VCPU - host PID mapping
and guest's trace ID is used to identify guests.
The host's trace ID is sent to the guest using tracecmd_msg_recv_trace_req()
and indeed it is not used anywhere, but I prefer to keep this exchange
part of the
trace request / reply negotiation, it could be useful in the future.

>
> > >         if (ret < 0)
> > >                 die("Failed to receive trace request");
> > >
> > > @@ -153,13 +155,13 @@ static void agent_handle(int sd, int nr_cpus, int page_size)
> > >
> > >         if (!use_fifos)
> > >                 make_vsocks(nr_cpus, fds, ports);
> > > -
> > > +       trace_id = tracecmd_generate_traceid();
> > >         ret = tracecmd_msg_send_trace_resp(msg_handle, nr_cpus, page_size,
> > > -                                          ports, use_fifos);
> > > +                                          ports, use_fifos, trace_id);
> > >         if (ret < 0)
> > >                 die("Failed to send trace response");
> > > -
> > > -       trace_record_agent(msg_handle, nr_cpus, fds, argc, argv, use_fifos);
> > > +       trace_record_agent(msg_handle, nr_cpus, fds, argc, argv,
> > > +                          use_fifos, trace_id);
> > >
> > >         free(argv[0]);
> > >         free(argv);
> >
> > Cheers,
> >
> > -- Slavi
>
>
>
> --
> Tzvetomir (Ceco) Stoyanov
> VMware Open Source Technology Center



-- 
Tzvetomir (Ceco) Stoyanov
VMware Open Source Technology Center



[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux