All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chao Peng <chao.p.peng@linux.intel.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: wei.liu2@citrix.com, Ian.Campbell@citrix.com,
	stefano.stabellini@eu.citrix.com, andrew.cooper3@citrix.com,
	Ian.Jackson@eu.citrix.com, xen-devel@lists.xen.org,
	will.auld@intel.com, keir@xen.org
Subject: Re: [PATCH v6 1/5] x86: allow reading MSR_IA32_TSC with XENPF_resource_op
Date: Mon, 26 Jan 2015 17:57:31 +0800	[thread overview]
Message-ID: <20150126095731.GG28428@pengc-linux.bj.intel.com> (raw)
In-Reply-To: <54C6194A020000780005950E@mail.emea.novell.com>

On Mon, Jan 26, 2015 at 09:39:06AM +0000, Jan Beulich wrote:
> >>> On 26.01.15 at 03:41, <chao.p.peng@linux.intel.com> wrote:
> > On Fri, Jan 23, 2015 at 02:28:04PM +0000, Jan Beulich wrote:
> >> >>> On 23.01.15 at 14:40, <chao.p.peng@linux.intel.com> wrote:
> >> > @@ -133,10 +135,39 @@ static void resource_access(void *info)
> >> >          switch ( entry->u.cmd )
> >> >          {
> >> >          case XEN_RESOURCE_OP_MSR_READ:
> >> > -            ret = rdmsr_safe(entry->idx, entry->val);
> >> > +            if ( unlikely(entry->idx == MSR_IA32_TSC) ) {
> >> > +                /* Return scaled time instead of raw timestamp */
> >> > +                entry->val = get_s_time_fixed(tsc);
> >> 
> >> This is going to be bogus when happening on the first entry.
> >> Either disallow it, or rdtscll() here if tsc == 0.
> > 
> > No, get_s_time_fixed() will take care of this. It calls rdtscll() when
> > tsc == 0. This is the way how NOW() works.
> 
> Oh, yes of course; sorry for the noise.
> 
> >> > +                ret = 0;
> >> > +            }
> >> > +            else
> >> > +            {
> >> > +                unsigned long irqflags;
> >> > +                /*
> >> > +                 * If next entry is MSR_IA32_TSC read, then the actual rdtscll
> >> > +                 * is performed together with current entry, with IRQ disabled.
> >> > +                 */
> >> > +                bool_t read_tsc = (i < ra->nr_done - 1 &&
> >> > +                                   unlikely(entry[1].idx == MSR_IA32_TSC &&
> >> > +                                   entry[1].u.cmd == XEN_RESOURCE_OP_MSR_READ));
> >> 
> >> Just like you do the rdtscll() without regard to rc (which is fine),
> >> I don't think you need that last part of the condition.
> > 
> > How about if the next entry is MSR_IA32_TSC write?  I don’t want to
> > introduce unnecessary IRQ locking and a useless rdtscll().
> 
> If you care about this then you also shouldn't rdtscll() when having
> received an error. I.e. all I really ask for here is consistency, not
> which specific behavior you select.
> 
Clear, thanks.
Chao

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

  reply	other threads:[~2015-01-26  9:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-23 13:40 [PATCH v6 0/5] enable Memory Bandwidth Monitoring (MBM) for VMs Chao Peng
2015-01-23 13:40 ` [PATCH v6 1/5] x86: allow reading MSR_IA32_TSC with XENPF_resource_op Chao Peng
2015-01-23 14:28   ` Jan Beulich
2015-01-23 14:57     ` Andrew Cooper
2015-01-26  2:41     ` Chao Peng
2015-01-26  9:39       ` Jan Beulich
2015-01-26  9:57         ` Chao Peng [this message]
2015-01-26 10:10     ` Chao Peng
2015-01-26 10:23       ` Jan Beulich
2015-01-23 14:28   ` Jan Beulich
2015-01-23 13:40 ` [PATCH v6 2/5] tools: add routine to get CMT L3 event mask Chao Peng
2015-01-23 13:40 ` [PATCH v6 3/5] tools: correct coding style for psr Chao Peng
2015-01-23 13:40 ` [PATCH v6 4/5] tools: code refactoring for MBM Chao Peng
2015-01-23 13:40 ` [PATCH v6 5/5] tools, docs: add total/local memory bandwith monitoring Chao Peng

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=20150126095731.GG28428@pengc-linux.bj.intel.com \
    --to=chao.p.peng@linux.intel.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=keir@xen.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=will.auld@intel.com \
    --cc=xen-devel@lists.xen.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.