linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tzvetomir Stoyanov <tz.stoyanov@gmail.com>
To: Dario Faggioli <dfaggioli@suse.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Joel Fernandes <joelaf@google.com>,
	"Yordan Karadzhov (VMware)" <y.karadz@gmail.com>,
	Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Subject: Re: Instructions for clock sync for tracing host/guest
Date: Mon, 26 Apr 2021 16:51:42 +0300	[thread overview]
Message-ID: <CAPpZLN6Rvh=zVx6O_QaZoU=1nuVWdW0jF_yiriSyZ10OWoQBtQ@mail.gmail.com> (raw)
In-Reply-To: <d19c679218fcb43179a711740186781f3c29265a.camel@suse.com>

On Mon, Apr 26, 2021 at 4:24 PM Dario Faggioli <dfaggioli@suse.com> wrote:
>
> On Mon, 2021-04-26 at 08:56 -0400, Steven Rostedt wrote:
> > On Mon, 26 Apr 2021 13:39:32 +0300
> > Tzvetomir Stoyanov <tz.stoyanov@gmail.com> wrote:
> > > >
> > > > There, I see the guest vcpu 0 is controlled by the host thread
> > > > with pid
> > > > 129042 and vcpu 1 is controlled by host thread pid 129043.
> > >
> > > It works only in case of one VM, if there are more than one -
> > > cannot
> > > map kvm_entry event to specific VM.
> >
> >  # trace-cmd record -e sched_wakeup -e kvm_entry
> >
> > And have this:
> >
> >     vsock-client-159876 [000]1346877108580652: sched_wakeup:
> > vhost-128994:129046 [120] success=1 CPU:006
> >
> >     vhost-128994-129046 [006]1346877108678708: sched_wakeup:
> > CPU 0/KVM:129042 [120] success=1 CPU:007
> >
> >        CPU 0/KVM-129042 [007]1346877109290044: kvm_entry:
> > vcpu 0
> >
> Mmm... This is quite interesting. But there's something I don't think
> I'm understanding.
>
>
> > Instead of looking at vsock-client, look at the current pid and see
> > what
> > "vhost" it wakes up, then see what what thread it wakes up, and then
> > see if
> > it calls kvm_entry. we don't even need to know if it is a vhost. Just
> > trace
> > everything that our current thread wakes up and what those wake up
> > until
> > something calls kvm_entry.
> >
> So, what's the mapping (like, mapping between what and what) that we
> are interested in here, and what kind of into trick with vsock-client
> is helping us gather, that we don't already have by "just" looking at
> the kvm_entry events?

trace-cmd uses guest name to find:
 <guest name> ->  vhost cid, port
 <guest name> ->  PID of the process, running the VM
PID of the process, running the VM -> PIDs of the threads, running each vCPU

the kvm_entry event has information about mapping <thread PID> to
vCPU, from that thread PID we could find the process which runs the
whole VM. The problem is to find the VM name, vhost cid and port using
that process ID, we couldn't find any generic and reliable way to get
that mapping. That's why the current implementation uses a qemu
specific hack - VM name, vhost cid and port are written in the qemu
command line, which we get from /proc/<qemu pid> and parse. This does
not work with non-qemu VMs.

>
> Regards
> --
> Dario Faggioli, Ph.D
> http://about.me/dario.faggioli
> Virtualization Software Engineer
> SUSE Labs, SUSE https://www.suse.com/
> -------------------------------------------------------------------
> <<This happens because _I_ choose it to happen!>> (Raistlin Majere)

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

      reply	other threads:[~2021-04-26 13:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAJWu+opJEtyXyhYnKL1iNzhfSCYRZN4PD50igckVvQV8416HEQ@mail.gmail.com>
     [not found] ` <CAPpZLN5pTxjnrQ=x0Kq7sGko+GSVv5gPTjSgETvO9kX1hgNCpQ@mail.gmail.com>
     [not found]   ` <20210418080435.3c3e2d24@oasis.local.home>
     [not found]     ` <CAJWu+oqG9T5v_2q+crsrsPe9GMcG0OSW7kcZ5ea=r1L07WKZJA@mail.gmail.com>
     [not found]       ` <CAPpZLN7MDoFYaJZG1+_4gUpYwt2RfAMfB=BDvGYch2eOfS342Q@mail.gmail.com>
     [not found]         ` <CAJWu+oosbOV=cigwfkNBLSpaMt3RExWLap3u+4G7pkYqQy_EXw@mail.gmail.com>
     [not found]           ` <CAPpZLN7=e+TL5WY7RKAo9Hm6AJGDygneqUWwoNnZexx+=KrxsQ@mail.gmail.com>
     [not found]             ` <CAJWu+op2bU+-z6W_+XB0v2g__oGXj8Be2WWDg36E9uaCjNp+HA@mail.gmail.com>
     [not found]               ` <CAJWu+orm+tm3C=MSF=p9eC1qgfE_pXzA2B0CiXgVXFemVRiVtA@mail.gmail.com>
     [not found]                 ` <CAJWu+opzT20OprG-8L_Lvv2DaJzF-ROaKnEWX8wjrbagPpwVzA@mail.gmail.com>
     [not found]                   ` <CAJWu+oqJk+BE2q=CjtAZJko-kJCS0Kyqwor_FVM3fu-X-rRRkg@mail.gmail.com>
     [not found]                     ` <20210422153845.3e6e9304@gandalf.local.home>
     [not found]                       ` <CAJWu+ooTVfprhd49__0H_61Fz_rSQA53n-VM6e1eEr8cTZ5aYQ@mail.gmail.com>
     [not found]                         ` <20210422154830.52f3e4f5@gandalf.local.home>
     [not found]                           ` <CAJWu+oqYWv5OHTLrC+oa7Y+LOe7AHumhtyVP8TC2LkK2=_JjPA@mail.gmail.com>
     [not found]                             ` <20210422160313.2eee1f77@gandalf.local.home>
     [not found]                               ` <CAJWu+ooZ9UptDBdii7dj=ui7dhiseOqZJE1CqMhP-Zy98QueXA@mail.gmail.com>
     [not found]                                 ` <CAJWu+opsWVBDA8R-wVhhn2G_6h1LsMwzRDE=gMruZpFG+AH5zQ@mail.gmail.com>
     [not found]                                   ` <CAJWu+oo8W9TVexZhhOs4P-DW1bH5DSjAzuV8QZMxvt9XHbRnJg@mail.gmail.com>
2021-04-23  8:16                                     ` Instructions for clock sync for tracing host/guest Tzvetomir Stoyanov
     [not found]                                       ` <CAJWu+orjdLAdcUJKWj6f8gUtXUzBcvJEPeKjtVZ7P+EpiptF0w@mail.gmail.com>
2021-04-23 11:33                                         ` Steven Rostedt
2021-04-23 15:49                                           ` Joel Fernandes
2021-04-26 10:58                                         ` Tzvetomir Stoyanov
2021-04-26 12:44                                           ` Steven Rostedt
2021-04-26 12:59                                             ` Tzvetomir Stoyanov
2021-04-26 14:11                                               ` Dario Faggioli
2021-04-26 14:51                                                 ` Steven Rostedt
2021-04-26 15:02                                                   ` Tzvetomir Stoyanov
2021-04-26 15:31                                                     ` Steven Rostedt
2021-04-26 15:37                                                       ` Steven Rostedt
2021-04-26 15:44                                                       ` Dario Faggioli
2021-04-26 15:38                                                     ` Dario Faggioli
2021-04-26 15:50                                                       ` Steven Rostedt
2021-04-26 16:10                                                         ` Dario Faggioli
2021-04-25 18:29                                       ` Steven Rostedt
2021-04-26 10:39                                         ` Tzvetomir Stoyanov
2021-04-26 12:56                                           ` Steven Rostedt
2021-04-26 13:24                                             ` Dario Faggioli
2021-04-26 13:51                                               ` Tzvetomir Stoyanov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPpZLN6Rvh=zVx6O_QaZoU=1nuVWdW0jF_yiriSyZ10OWoQBtQ@mail.gmail.com' \
    --to=tz.stoyanov@gmail.com \
    --cc=dfaggioli@suse.com \
    --cc=joelaf@google.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=y.karadz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).