xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Paul Durrant <paul.durrant@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Paul Durrant <paul.durrant@citrix.com>,
	Jan Beulich <jbeulich@suse.com>
Subject: [PATCH v2 5/6] x86/viridian: make the threshold for HvNotifyLongSpinWait tunable
Date: Mon, 20 Mar 2017 17:08:20 +0000	[thread overview]
Message-ID: <1490029701-4311-6-git-send-email-paul.durrant@citrix.com> (raw)
In-Reply-To: <1490029701-4311-1-git-send-email-paul.durrant@citrix.com>

The current threshold before the guest issues the hypercall is, and always
has been, hard-coded to 2047. It is not clear where this number came
from so, to at least allow for ease of experimentation, this patch makes
the threshold tunable via the Xen command line.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>

v2:
 - Significantly simplify patch by directly initializing the parameter
---
 docs/misc/xen-command-line.markdown |  8 ++++++++
 xen/arch/x86/hvm/viridian.c         | 12 +++++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
index 44da4bd..962e4d1 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -1637,6 +1637,14 @@ The hypervisor minor version number encoded in CPUID 0x40000002:EBX.
 
 The hypervisor build number encoded in CPUID 0x40000002:EAX.
 
+### viridian\_spinlock\_retry\_count
+> `= <integer>`
+
+> Default: `2047`
+
+Specify the maximum number of retries before an enlightened Windows
+guest will notify Xen that it has failed to acquire a spinlock.
+
 ### vpid (Intel)
 > `= <boolean>`
 
diff --git a/xen/arch/x86/hvm/viridian.c b/xen/arch/x86/hvm/viridian.c
index d241de2..5ca1167 100644
--- a/xen/arch/x86/hvm/viridian.c
+++ b/xen/arch/x86/hvm/viridian.c
@@ -179,6 +179,10 @@ integer_param("viridian_minor_version", viridian_minor_version);
 static uint32_t __read_mostly viridian_build_number = 0x1772;
 integer_param("viridian_build_number", viridian_build_number);
 
+static uint32_t __read_mostly viridian_spinlock_retry_count = 2047;
+integer_param("viridian_spinlock_retry_count",
+              viridian_spinlock_retry_count);
+
 void cpuid_viridian_leaves(const struct vcpu *v, uint32_t leaf,
                            uint32_t subleaf, struct cpuid_leaf *res)
 {
@@ -257,7 +261,13 @@ void cpuid_viridian_leaves(const struct vcpu *v, uint32_t leaf,
             res->a |= CPUID4A_HCALL_REMOTE_TLB_FLUSH;
         if ( !cpu_has_vmx_apic_reg_virt )
             res->a |= CPUID4A_MSR_BASED_APIC;
-        res->b = 2047; /* long spin count */
+
+        /*
+         * This value is the recommended number of attempts to try to
+         * acquire a spinlock before notifying the hypervisor via the
+         * HvNotifyLongSpinWait hypercall.
+         */
+        res->b = viridian_spinlock_retry_count;
         break;
 
     case 6:
-- 
2.1.4


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

  parent reply	other threads:[~2017-03-20 17:08 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-20 17:08 [PATCH v2 0/6] viridian updates Paul Durrant
2017-03-20 17:08 ` [PATCH v2 1/6] x86/viridian: fix xen-hvmcrash when vp_assist page is present Paul Durrant
2017-03-21 15:26   ` Jan Beulich
2017-03-21 15:28     ` Paul Durrant
2017-03-20 17:08 ` [PATCH v2 2/6] x86/viridian: don't put Xen version information in CPUID leaf 2 Paul Durrant
2017-03-21 15:29   ` Jan Beulich
2017-03-21 15:45     ` Paul Durrant
2017-03-21 16:18       ` Jan Beulich
2017-03-20 17:08 ` [PATCH v2 3/6] x86/viridian: get rid of the magic numbers in CPUID leaves 1 and 2 Paul Durrant
2017-03-21 15:30   ` Jan Beulich
2017-03-20 17:08 ` [PATCH v2 4/6] x86/viridian: add warnings for unimplemented hypercalls and MSRs Paul Durrant
2017-03-21 15:32   ` Jan Beulich
2017-03-21 15:48     ` Paul Durrant
2017-03-20 17:08 ` Paul Durrant [this message]
2017-03-21 15:35   ` [PATCH v2 5/6] x86/viridian: make the threshold for HvNotifyLongSpinWait tunable Jan Beulich
2017-03-21 15:46     ` Paul Durrant
2017-03-20 17:08 ` [PATCH v2 6/6] x86/viridian: implement the crash MSRs Paul Durrant
2017-03-21 15:41   ` Jan Beulich
2017-03-21 15:50     ` Paul Durrant
2017-03-21 17:05   ` Wei Liu

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=1490029701-4311-6-git-send-email-paul.durrant@citrix.com \
    --to=paul.durrant@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --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 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).