mbox series

[0/2] KernelShark2.0: Use libtracefs APIs to access tracefs

Message ID 20200306092902.48786-1-tz.stoyanov@gmail.com (mailing list archive)
Headers show
Series KernelShark2.0: Use libtracefs APIs to access tracefs | expand

Message

Tzvetomir Stoyanov (VMware) March 6, 2020, 9:29 a.m. UTC
From: "Tzvetomir (VMware)  Stoyanov" <tz.stoyanov@gmail.com>

The tracefs library provides APIs for accessing files from tracefs.
The library is part of trace-cmd, it is installed as part of trace-cmd
installation. KernelShark uses some of those APIs and must be linked with
the library

Tzvetomir (VMware)  Stoyanov (2):
  KernelShark2.0: Link KernelShark to libtracefs
  KernelShark2.0: Use libtracefs APIs to access tracefs

 CMakeLists.txt           |  3 ++-
 build/FindTraceCmd.cmake | 28 ++++++++++++++++++++++++++++
 src/CMakeLists.txt       |  2 ++
 src/libkshark-tepdata.c  |  5 +++--
 4 files changed, 35 insertions(+), 3 deletions(-)

Comments

Steven Rostedt March 6, 2020, 8:13 p.m. UTC | #1
On Fri,  6 Mar 2020 11:29:00 +0200
"Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com> wrote:

> From: "Tzvetomir (VMware)  Stoyanov" <tz.stoyanov@gmail.com>
> 
> The tracefs library provides APIs for accessing files from tracefs.
> The library is part of trace-cmd, it is installed as part of trace-cmd
> installation. KernelShark uses some of those APIs and must be linked with
> the library
> 
> Tzvetomir (VMware)  Stoyanov (2):
>   KernelShark2.0: Link KernelShark to libtracefs
>   KernelShark2.0: Use libtracefs APIs to access tracefs
> 

I added these patches to the latest kernelshark-2.0 and it still doesn't
work for me. I did a little debugging, and noticed that it fails while
reading the guest trace.dat file with:

plugin "kvm_combo" failed to initialize on stream /tmp/trace-host-Fedora21.

It seems to require that the guest trace.dat file has kvm events?

Note, as I build my guest kernel with a make localmodconfig, which disables
all modules that are not necessary to boot the box, there is no kvm events
there. I can see why the host may need them, but not the guest. I'll
rebuild my guest kernel with kvm events and see if that solves this (but
that shouldn't be the case).

-- Steve
Steven Rostedt March 6, 2020, 10:34 p.m. UTC | #2
On Fri, 6 Mar 2020 15:13:56 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Fri,  6 Mar 2020 11:29:00 +0200
> "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com> wrote:
> 
> > From: "Tzvetomir (VMware)  Stoyanov" <tz.stoyanov@gmail.com>
> > 
> > The tracefs library provides APIs for accessing files from tracefs.
> > The library is part of trace-cmd, it is installed as part of trace-cmd
> > installation. KernelShark uses some of those APIs and must be linked with
> > the library
> > 
> > Tzvetomir (VMware)  Stoyanov (2):
> >   KernelShark2.0: Link KernelShark to libtracefs
> >   KernelShark2.0: Use libtracefs APIs to access tracefs
> >   
> 
> I added these patches to the latest kernelshark-2.0 and it still doesn't
> work for me. I did a little debugging, and noticed that it fails while
> reading the guest trace.dat file with:
> 
> plugin "kvm_combo" failed to initialize on stream /tmp/trace-host-Fedora21.
> 
> It seems to require that the guest trace.dat file has kvm events?
> 
> Note, as I build my guest kernel with a make localmodconfig, which disables
> all modules that are not necessary to boot the box, there is no kvm events
> there. I can see why the host may need them, but not the guest. I'll
> rebuild my guest kernel with kvm events and see if that solves this (but
> that shouldn't be the case).
> 

Just confirmed it. If I add kvm events to the guest, it synchronizes
automatically. Thus, it's a bug to expect the guest to have kvm events, as
there's no reason for them to do so.

-- Steve
Yordan Karadzhov March 9, 2020, 9:10 a.m. UTC | #3
On 6.03.20 г. 22:13 ч., Steven Rostedt wrote:
> On Fri,  6 Mar 2020 11:29:00 +0200
> "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com> wrote:
> 
>> From: "Tzvetomir (VMware)  Stoyanov" <tz.stoyanov@gmail.com>
>>
>> The tracefs library provides APIs for accessing files from tracefs.
>> The library is part of trace-cmd, it is installed as part of trace-cmd
>> installation. KernelShark uses some of those APIs and must be linked with
>> the library
>>
>> Tzvetomir (VMware)  Stoyanov (2):
>>    KernelShark2.0: Link KernelShark to libtracefs
>>    KernelShark2.0: Use libtracefs APIs to access tracefs
>>
> 
> I added these patches to the latest kernelshark-2.0 and it still doesn't
> work for me. I did a little debugging, and noticed that it fails while
> reading the guest trace.dat file with:
> 
> plugin "kvm_combo" failed to initialize on stream /tmp/trace-host-Fedora21.
> 
> It seems to require that the guest trace.dat file has kvm events?

Hi Steven,

Yes it will fail to initialize in the guest's file if it does not 
contain kvm events and this is normal. The plugin only draws the 
additional graphical elements associated with kvm_entry and kvm_exit 
events. So nothing will be plotted on top of the guest data.

The plugin itself has nothing to do with the synchronization of the 
timestamps.

Thanks!
Yordan

> 
> Note, as I build my guest kernel with a make localmodconfig, which disables
> all modules that are not necessary to boot the box, there is no kvm events
> there. I can see why the host may need them, but not the guest. I'll
> rebuild my guest kernel with kvm events and see if that solves this (but
> that shouldn't be the case).
> 
> -- Steve
>
Yordan Karadzhov March 9, 2020, 9:17 a.m. UTC | #4
On 7.03.20 г. 0:34 ч., Steven Rostedt wrote:
> On Fri, 6 Mar 2020 15:13:56 -0500
> Steven Rostedt <rostedt@goodmis.org> wrote:
> 
>> On Fri,  6 Mar 2020 11:29:00 +0200
>> "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com> wrote:
>>
>>> From: "Tzvetomir (VMware)  Stoyanov" <tz.stoyanov@gmail.com>
>>>
>>> The tracefs library provides APIs for accessing files from tracefs.
>>> The library is part of trace-cmd, it is installed as part of trace-cmd
>>> installation. KernelShark uses some of those APIs and must be linked with
>>> the library
>>>
>>> Tzvetomir (VMware)  Stoyanov (2):
>>>    KernelShark2.0: Link KernelShark to libtracefs
>>>    KernelShark2.0: Use libtracefs APIs to access tracefs
>>>    
>>
>> I added these patches to the latest kernelshark-2.0 and it still doesn't
>> work for me. I did a little debugging, and noticed that it fails while
>> reading the guest trace.dat file with:
>>
>> plugin "kvm_combo" failed to initialize on stream /tmp/trace-host-Fedora21.
>>
>> It seems to require that the guest trace.dat file has kvm events?
>>
>> Note, as I build my guest kernel with a make localmodconfig, which disables
>> all modules that are not necessary to boot the box, there is no kvm events
>> there. I can see why the host may need them, but not the guest. I'll
>> rebuild my guest kernel with kvm events and see if that solves this (but
>> that shouldn't be the case).
>>
> 
> Just confirmed it. If I add kvm events to the guest, it synchronizes
> automatically. Thus, it's a bug to expect the guest to have kvm events, as
> there's no reason for them to do so.

Is it possible that something else gets enabled during the recording of 
the data, that actually makes the difference?
Y.

> 
> -- Steve
>
Steven Rostedt March 9, 2020, 3:44 p.m. UTC | #5
On Mon, 9 Mar 2020 11:17:44 +0200
"Yordan Karadzhov (VMware)" <y.karadz@gmail.com> wrote:

> > Just confirmed it. If I add kvm events to the guest, it synchronizes
> > automatically. Thus, it's a bug to expect the guest to have kvm events, as
> > there's no reason for them to do so.  
> 
> Is it possible that something else gets enabled during the recording of 
> the data, that actually makes the difference?
> Y.

Unfortunately, I blew away the files with the issue and tried to reproduce
it, and I can't :-/

Now even without the kvm events it appears to work. I may try one more
thing (which is to rebuild the guest without KVM at all), and see if I can
bring back the issue. But for now, I guess it's a "WORKS FOR ME" :-/

-- Steve
Steven Rostedt March 9, 2020, 4:30 p.m. UTC | #6
On Mon, 9 Mar 2020 11:44:08 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> Now even without the kvm events it appears to work. I may try one more
> thing (which is to rebuild the guest without KVM at all), and see if I can
> bring back the issue. But for now, I guess it's a "WORKS FOR ME" :-/

I still can't reproduce my original issue. Perhaps I did something wrong.
So I guess we can ignore this.

One thing I did notice when testing this, the "all" selection of the KVM
combo plots doesn't seem to work. I have to select each VCPU individually.
Do you see that too?

-- Steve