xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Meng Xu <xumengpanda@gmail.com>
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	Dario Faggioli <dario.faggioli@citrix.com>
Subject: Re: Question about xentrace to trace s_time_t type of data
Date: Mon, 25 Aug 2014 11:20:29 -0400	[thread overview]
Message-ID: <20140825152029.GB28304@laptop.dumpdata.com> (raw)
In-Reply-To: <CAENZ-+mQVHkxn0gSV=dRs96rm7+_DYOzCCQV6k4ymSo7pof7eQ@mail.gmail.com>

On Mon, Aug 25, 2014 at 11:14:52AM -0400, Meng Xu wrote:
> Hi Konrad,
> 
> Thank you very much for answering my question!
> 
> ​I actually have a question regarding to your answer.
> 
> Briefly speaking, I'm thinking what you suggests is doing the same (or
> similar) thing as I did? Below is my reason.
> 
> 
> > >
> > > I'm trying to trace the scheduler-specific events for debug purpose by
> > > using xentrace (instead of using printk). I read the trace code in credit
> > > and credit2 scheduler (sched_credit.c and sched_credit2.c) and "followed"
> > > the way credit2 wrote.
> > >
> > > I added the following code into the burn_budget() in my scheduler file,
> > > sched_rt.c:
> > >
> > >         /* TRACE */
> > >
> > >         {
> > >
> > >             struct {
> > >
> > >                 unsigned dom:16,vcpu:16;
> > >
> > >                 s_time_t cur_budget;
> > >
> > >             } d;
> > >
> > >             d.dom = svc->vcpu->domain->domain_id;
> > >
> > >             d.vcpu = svc->vcpu->vcpu_id;
> > >
> > >             d.cur_budget = svc->cur_budget;
> > >
> > >             trace_var(TRC_RT_BUDGET_REPLENISH, 1,
> > >
> > >                       sizeof(d),
> > >
> > >                       (unsigned char *) &d);
> >
> > You put the virtual address addresss of your 'd' structure
> > that is on the stack in the trace file. That does not contain any
> > data except an address.
> >
> > What you need to do is to put the data as such:
> >
> >         uint32_t dom_vcpu;
> >
> >         dom_vcpu = srv->vcpu->domain->domain_id;
> >         dom_vcpu |= (svc->vcpu->vcpu_id << 16);
> >         TRACE_2D(TRC_RT_BUDGET_REPLENISH, dom_vcpu, svc->cur_budget);
> >
> 
> ​In file xen/include/xen/trace.h, TRACE_2D is defined as follows:
> 
> #define TRACE_2D(_e,d1,d2)                                      \
> 
>     do {                                                        \
> 
>         if ( unlikely(tb_init_done) )                           \
> 
>         {                                                       \
> 
>             u32 _d[2];                                          \
> 
>             _d[0] = d1;                                         \
> 
>             _d[1] = d2;                                         \
> 
>             __trace_var(_e, 1, sizeof(_d), _d);                 \
> 
>         }                                                       \
>     } while ( 0 )​
> 
> 
> 
> ​In the same file, the trace_var() is defined as follows:
> 
> static inline void trace_var(u32 event, int cycles, int extra,
> 
>                              const void *extra_data)
> 
> {
> 
>     if ( unlikely(tb_init_done) )
> 
>         __trace_var(event, cycles, extra, extra_data);
> }   ​
> 
> ​
> The description of the function __trace_var(u32 event, bool_t cycles,
> unsigned int extra,const void *extra_data) is in xen/common/trace.c:
> 
> /**
> 
>  * __trace_var - Enters a trace tuple into the trace buffer for the current
> CPU.
> 
>  * @event: the event type being logged
> 
>  * @cycles: include tsc timestamp into trace record
> 
>  * @extra: size of additional trace data in bytes
> 
>  * @extra_data: pointer to additional trace data
> 
>  *
> 
>  * Logs a trace record into the appropriate buffer.
>  */​
> 
> 
> So I'm thinking what you suggests is doing the same (or similar) thing as I
> did? In addition, from the description of the function __trace_var() , it
> seems I should parse the pointer of the struct d to this function.
> 
> ​Maybe I misunderstood your suggestion?
> 
> Thank you very much for your time!

I have to be honest I hadn't actually dug in what was underneath
the macro. Just been using the macro and it had worked for me.


> 
> Best,
> 
> Meng​
> 
> 
> 
> 
> -----------
> Meng Xu
> PhD Student in Computer and Information Science
> University of Pennsylvania

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2014-08-25 15:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-24  3:24 Question about xentrace to trace s_time_t type of data Meng Xu
2014-08-25 13:31 ` Konrad Rzeszutek Wilk
2014-08-25 15:14   ` Meng Xu
2014-08-25 15:20     ` Konrad Rzeszutek Wilk [this message]
2014-08-25 16:22       ` Meng Xu
2014-08-25 16:39         ` Konrad Rzeszutek Wilk
2014-08-25 19:34           ` Meng Xu
2014-09-01 15:23   ` George Dunlap

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=20140825152029.GB28304@laptop.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=dario.faggioli@citrix.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    --cc=xumengpanda@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).