Xen-Devel Archive on lore.kernel.org
 help / color / Atom feed
From: Alexandru Stefan ISAILA <aisaila@bitdefender.com>
To: Paul Durrant <paul.durrant@citrix.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 Monné" <roger.pau@citrix.com>
Subject: Re: [Xen-devel] [PATCH v2] viridian: unify time sources
Date: Fri, 21 Jun 2019 13:49:25 +0000
Message-ID: <a517fc98-cdd7-4bc4-e096-08826399ddf7@bitdefender.com> (raw)
In-Reply-To: <20190617082358.2734-1-paul.durrant@citrix.com>

>   /*
> @@ -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.

> -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

  parent 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 [this message]
2019-06-21 13:58   ` Paul Durrant
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=a517fc98-cdd7-4bc4-e096-08826399ddf7@bitdefender.com \
    --to=aisaila@bitdefender.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=paul.durrant@citrix.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