All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Igor Druzhinin <igor.druzhinin@citrix.com>
Cc: xen-devel@lists.xenproject.org, wl@xen.org, jbeulich@suse.com,
	andrew.cooper3@citrix.com
Subject: Re: [Xen-devel] [PATCH 2/2] x86/time: report correct frequency of Xen PV clocksource
Date: Tue, 4 Feb 2020 18:28:51 +0100	[thread overview]
Message-ID: <20200204172851.GN4679@Air-de-Roger> (raw)
In-Reply-To: <1580830825-18767-3-git-send-email-igor.druzhinin@citrix.com>

On Tue, Feb 04, 2020 at 03:40:25PM +0000, Igor Druzhinin wrote:
> The value of the counter represents the number of nanoseconds
> since host boot. That means the correct frequency is always 1GHz.
> 
> This inconsistency caused time to go slower in PV shim on most
> platforms.
> 
> Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>

Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

With one nit below.

> ---
>  xen/arch/x86/time.c | 17 +----------------
>  1 file changed, 1 insertion(+), 16 deletions(-)
> 
> diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
> index 7e7a62e..95840c4 100644
> --- a/xen/arch/x86/time.c
> +++ b/xen/arch/x86/time.c
> @@ -567,27 +567,12 @@ static struct platform_timesource __initdata plt_tsc =
>   */
>  static uint64_t xen_timer_last;
>  
> -static uint64_t xen_timer_cpu_frequency(void)
> -{
> -    struct vcpu_time_info *info = &this_cpu(vcpu_info)->time;
> -    uint64_t freq;
> -
> -    freq = 1000000000ULL << 32;
> -    do_div(freq, info->tsc_to_system_mul);
> -    if ( info->tsc_shift < 0 )
> -        freq <<= -info->tsc_shift;
> -    else
> -        freq >>= info->tsc_shift;
> -
> -    return freq;
> -}
> -
>  static int64_t __init init_xen_timer(struct platform_timesource *pts)
>  {
>      if ( !xen_guest )
>          return 0;
>  
> -    pts->frequency = xen_timer_cpu_frequency();
> +    pts->frequency = 1000000000ULL;

You can init this field below at declaration, since it's a static
value.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2020-02-04 17:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-04 15:40 [Xen-devel] [PATCH 0/2] PV shim timekeeping fixes Igor Druzhinin
2020-02-04 15:40 ` [Xen-devel] [PATCH 1/2] x86/shim: suspend and resume platform time correctly Igor Druzhinin
2020-02-04 17:17   ` Roger Pau Monné
2020-02-04 17:43     ` Igor Druzhinin
2020-02-04 21:43       ` Igor Druzhinin
2020-02-04 15:40 ` [Xen-devel] [PATCH 2/2] x86/time: report correct frequency of Xen PV clocksource Igor Druzhinin
2020-02-04 17:28   ` Roger Pau Monné [this message]
2020-02-04 21:27     ` Igor Druzhinin

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=20200204172851.GN4679@Air-de-Roger \
    --to=roger.pau@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=igor.druzhinin@citrix.com \
    --cc=jbeulich@suse.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
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.