Xen-Devel Archive on lore.kernel.org
 help / color / Atom feed
From: Paul Durrant <Paul.Durrant@citrix.com>
To: 'Alexandru Stefan ISAILA' <aisaila@bitdefender.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <Andrew.Cooper3@citrix.com>,
	Jan Beulich <jbeulich@suse.com>, Wei Liu <wl@xen.org>,
	Roger Pau Monne <roger.pau@citrix.com>
Subject: Re: [Xen-devel] [PATCH v2] viridian: unify time sources
Date: Fri, 21 Jun 2019 13:58:57 +0000
Message-ID: <e4ec7405ea9b4c9bb94f903a51561582@AMSPEX02CL03.citrite.net> (raw)
In-Reply-To: <a517fc98-cdd7-4bc4-e096-08826399ddf7@bitdefender.com>

> -----Original Message-----
> From: Alexandru Stefan ISAILA <aisaila@bitdefender.com>
> Sent: 21 June 2019 14:49
> To: Paul Durrant <Paul.Durrant@citrix.com>; xen-devel@lists.xenproject.org
> Cc: Andrew Cooper <Andrew.Cooper3@citrix.com>; Wei Liu <wl@xen.org>; Jan Beulich <jbeulich@suse.com>;
> Roger Pau Monne <roger.pau@citrix.com>
> Subject: Re: [Xen-devel] [PATCH v2] viridian: unify time sources
> 
> >   /*
> > @@ -136,7 +100,7 @@ static int64_t time_ref_count(const struct domain *d)
> >    * 128 bit number which is then shifted 64 times to the right to obtain
> >    * the high 64 bits."
> >    */
> 
> Is there a good reason for using signed offset here? If so then maybe
> you should change the return type or check for bounds.

The offset is actually negative most of the time but the resulting reference time should be unsigned so the return type of time_ref_count() does need fixing.

  Paul

>
> > -static uint64_t scale_tsc(uint64_t tsc, uint64_t scale, uint64_t offset)
> > +static uint64_t scale_tsc(uint64_t tsc, uint64_t scale, int64_t offset)
> >   {
> >       uint64_t result;
> >
> > @@ -153,22 +117,46 @@ static uint64_t scale_tsc(uint64_t tsc, uint64_t scale, uint64_t offset)
> >       return result + offset;
> >   }
> >
> > -static uint64_t time_now(struct domain *d)
> > +static uint64_t trc_val(const struct domain *d, int64_t offset)
> >   {
> >       uint64_t tsc, scale;
> >
> > -    /*
> > -     * If the reference TSC page is not enabled, or has been invalidated
> > -     * fall back to the partition reference counter.
> > -     */
> > -    if ( !d->arch.hvm.viridian->reference_tsc_valid )
> > -        return time_ref_count(d);
> > -
> > -    /* Otherwise compute reference time in the same way the guest would */
> >       tsc = hvm_get_guest_tsc(pt_global_vcpu_target(d));
> >       scale = ((10000ul << 32) / d->arch.tsc_khz) << 32;
> >
> > -    return scale_tsc(tsc, scale, 0);
> > +    return scale_tsc(tsc, scale, offset);
> > +}
> 
> Alex
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply index

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-17  8:23 Paul Durrant
2019-06-20  8:44 ` Paul Durrant
2019-06-21 13:49 ` Alexandru Stefan ISAILA
2019-06-21 13:58   ` Paul Durrant [this message]
2019-06-21 15:20     ` Jan Beulich
2019-06-21 15:21       ` Paul Durrant
2019-06-21 15:08 ` Jan Beulich

Reply instructions:

You may reply publically 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=e4ec7405ea9b4c9bb94f903a51561582@AMSPEX02CL03.citrite.net \
    --to=paul.durrant@citrix.com \
    --cc=Andrew.Cooper3@citrix.com \
    --cc=aisaila@bitdefender.com \
    --cc=jbeulich@suse.com \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.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

Xen-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/xen-devel/0 xen-devel/git/0.git
	git clone --mirror https://lore.kernel.org/xen-devel/1 xen-devel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 xen-devel xen-devel/ https://lore.kernel.org/xen-devel \
		xen-devel@lists.xenproject.org xen-devel@archiver.kernel.org
	public-inbox-index xen-devel


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.xenproject.lists.xen-devel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox