xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: David Vrabel <david.vrabel@citrix.com>
To: George Dunlap <George.Dunlap@eu.citrix.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: [PATCH 1 of 2] xenalyze: decode PV_HYPERCALL_V2 records
Date: Thu, 4 Oct 2012 13:19:11 +0100	[thread overview]
Message-ID: <506D7EBF.9000908@citrix.com> (raw)
In-Reply-To: <CAFLBxZbQqFDV9Bgyt4GMV5g9D4hTHBmKBPsdRawshX_FphTnBA@mail.gmail.com>

On 03/10/12 11:33, George Dunlap wrote:
> On Mon, Oct 1, 2012 at 6:52 PM, David Vrabel <david.vrabel@citrix.com> wrote:
>> Newer version of Xen produce TRC_PV_HYPERCALL_V2 records instead of
>> the older TRC_PV_HYPERCALL format.  This updated format doesn't
>> included the IP but it does include select hypercall arguments.
>>
>> Signed-off-by: David Vrabel <david.vrabel@citrix.com>
> 
> Thanks -- I did a bunch of optimization work on xenalyze late last
> year, so I'm afraid I'm going to be pretty picky about some things to
> avoid losing that effort. :-)

>> +static inline int pv_hypercall_arg_present(const struct record_info *ri, int arg)
>> +{
>> +    return (ri->d[0] >> (20 + 2*arg)) & 0x3;
>> +}
> 
> Try to avoid an integer multiply here; (arg<<1) or (arg+arg) please.

The compiler does this for me.

>> @@ -6523,6 +6537,168 @@ void pv_summary(struct pv_data *pv) {
>>      }
>>  }
>>
>> +uint64_t pv_hypercall_arg(const struct record_info *ri, int arg)
>> +{
>> +    int i, word;
>> +
>> +    for (i = 0, word = 1; i < 6 && word < ri->extra_words; i++) {
>> +        int present = pv_hypercall_arg_present(ri, i);
>> +
>> +        /* Is this the argument we're looking for? */
>> +        if (i == arg) {
>> +            switch (present) {
>> +            case ARG_MISSING:
>> +                return 0;
>> +            case ARG_32BIT:
>> +                return ri->d[word];
>> +            case ARG_64BIT:
>> +                return ((uint64_t)ri->d[word + 1] << 32) | ri->d[word];
>> +            }
>> +        }
>> +
>> +        /* Skip over any words for this argument. */
>> +        word += present;
>> +    }
> 
> 
> Alternately, since pv_hypercall_arg() returns 0 for a non-existent arg
> anyway, couldn't you have an array, initialized to 0, and filled in as
> appropriate?

I've done this.

David

  reply	other threads:[~2012-10-04 12:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-01 17:52 [PATCH 0 of 2] xenalyze: decode new hypercall trace records David Vrabel
2012-10-01 17:52 ` [PATCH 1 of 2] xenalyze: decode PV_HYPERCALL_V2 records David Vrabel
2012-10-03 10:33   ` George Dunlap
2012-10-04 12:19     ` David Vrabel [this message]
2012-10-01 17:52 ` [PATCH 2 of 2] xenalyze: decode PV_HYPERCALL_SUBCALL events David Vrabel
2012-10-03 10:35   ` George Dunlap
  -- strict thread matches above, loose matches on Subject: below --
2012-10-04 12:28 [PATCH 0 of 2] xenalyze: decode new hypercall trace records (v2) David Vrabel
2012-10-04 12:28 ` [PATCH 1 of 2] xenalyze: decode PV_HYPERCALL_V2 records David Vrabel
2012-10-10 13:26   ` 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=506D7EBF.9000908@citrix.com \
    --to=david.vrabel@citrix.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=xen-devel@lists.xensource.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).