xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Keir Fraser <keir@xen.org>
To: Tim Deegan <tim@xen.org>, "Zhang, Yang Z" <yang.z.zhang@intel.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: lock in vhpet
Date: Thu, 19 Apr 2012 09:47:27 +0100	[thread overview]
Message-ID: <CBB58FB0.3E7AC%keir@xen.org> (raw)
In-Reply-To: <20120419082717.GA23663@ocelot.phlegethon.org>

[-- Attachment #1: Type: text/plain, Size: 812 bytes --]

On 19/04/2012 09:27, "Tim Deegan" <tim@xen.org> wrote:

> At 05:19 +0000 on 19 Apr (1334812779), Zhang, Yang Z wrote:
>> There have no problem with this patch, it works well. But it cannot
>> fix the win8 issue. It seems there has some other issues with hpet. I
>> will look into it.  Thanks for your quick patch.
> 
> The lock in hvm_get_guest_time() will still be serializing the hpet
> reads.  But since it needs to update a shared variable, that will need to
> haul cachelines around anyway.

Yes, that's true. You could try the attached hacky patch out of interest, to
see what that lock is costing you in your scenario. But if we want
consistent monotonically-increasing guest time, I suspect we can't get rid
of the lock, so that's going to limit our scalability unavoidably. Shame.

 -- Keir

> Tim.
> 


[-- Attachment #2: 00-lockfree-hvm-time --]
[-- Type: application/octet-stream, Size: 634 bytes --]

diff -r 7c777cb8f705 xen/arch/x86/hvm/vpt.c
--- a/xen/arch/x86/hvm/vpt.c	Wed Apr 18 16:49:55 2012 +0100
+++ b/xen/arch/x86/hvm/vpt.c	Thu Apr 19 09:45:43 2012 +0100
@@ -43,14 +43,7 @@ u64 hvm_get_guest_time(struct vcpu *v)
     /* Called from device models shared with PV guests. Be careful. */
     ASSERT(is_hvm_vcpu(v));
 
-    spin_lock(&pl->pl_time_lock);
     now = get_s_time() + pl->stime_offset;
-    if ( (int64_t)(now - pl->last_guest_time) > 0 )
-        pl->last_guest_time = now;
-    else
-        now = ++pl->last_guest_time;
-    spin_unlock(&pl->pl_time_lock);
-
     return now + v->arch.hvm_vcpu.stime_offset;
 }
 

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

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

  reply	other threads:[~2012-04-19  8:47 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-17  3:26 lock in vhpet Zhang, Yang Z
2012-04-17  7:27 ` Keir Fraser
2012-04-18  0:52   ` Zhang, Yang Z
2012-04-18  7:13     ` Keir Fraser
2012-04-18  7:55       ` Zhang, Yang Z
2012-04-18  8:29         ` Keir Fraser
2012-04-18  9:14           ` Keir Fraser
2012-04-18  9:30             ` Keir Fraser
2012-04-19  5:19               ` Zhang, Yang Z
2012-04-19  8:27                 ` Tim Deegan
2012-04-19  8:47                   ` Keir Fraser [this message]
2012-04-23  7:36                     ` Zhang, Yang Z
2012-04-23  7:43                       ` Jan Beulich
2012-04-23  8:15                         ` Zhang, Yang Z
2012-04-23  8:22                           ` Keir Fraser
2012-04-23  9:14                       ` Tim Deegan
2012-04-23 15:26                         ` Andres Lagar-Cavilla
2012-04-24  9:15                           ` Tim Deegan
2012-04-24 13:28                             ` Andres Lagar-Cavilla
2012-04-23 17:18                         ` Andres Lagar-Cavilla
2012-04-24  8:58                           ` Zhang, Yang Z
2012-04-24  9:16                             ` Tim Deegan
2012-04-25  0:27                               ` Zhang, Yang Z
2012-04-25  1:40                                 ` Andres Lagar-Cavilla
2012-04-25  1:48                                   ` Zhang, Yang Z
2012-04-25  2:31                                     ` Andres Lagar-Cavilla
2012-04-25  2:36                                       ` Zhang, Yang Z
2012-04-25  2:42                                         ` Andres Lagar-Cavilla
2012-04-25  3:12                                           ` Zhang, Yang Z
2012-04-25  3:34                                             ` Andres Lagar-Cavilla
2012-04-25  5:18                                               ` Zhang, Yang Z
2012-04-25  8:07                                               ` Jan Beulich
2012-04-26 21:25                                         ` Tim Deegan
2012-04-27  0:46                                           ` Zhang, Yang Z
2012-04-27  0:51                                             ` Andres Lagar-Cavilla
2012-04-27  1:24                                               ` Zhang, Yang Z
2012-04-27  8:36                                               ` Zhang, Yang Z
2012-04-27  3:02                                           ` Andres Lagar-Cavilla
2012-04-27  9:26                                             ` Tim Deegan
2012-04-27 14:17                                               ` Andres Lagar-Cavilla
2012-04-27 21:08                                               ` Andres Lagar-Cavilla
2012-05-16 11:36                                           ` Zhang, Yang Z
2012-05-16 12:36                                             ` Tim Deegan
2012-05-17 10:57                                               ` Tim Deegan
2012-05-28  6:54                                                 ` Zhang, Yang Z

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=CBB58FB0.3E7AC%keir@xen.org \
    --to=keir@xen.org \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xensource.com \
    --cc=yang.z.zhang@intel.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).