From patchwork Wed Mar 22 12:15:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 9638643 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5E91C602CB for ; Wed, 22 Mar 2017 12:18:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4E63B2846B for ; Wed, 22 Mar 2017 12:18:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 426E928472; Wed, 22 Mar 2017 12:18:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AF5302846D for ; Wed, 22 Mar 2017 12:18:40 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cqfBO-0003w7-Am; Wed, 22 Mar 2017 12:16:06 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cqfBM-0003vT-UK for xen-devel@lists.xenproject.org; Wed, 22 Mar 2017 12:16:05 +0000 Received: from [85.158.137.68] by server-11.bemta-3.messagelabs.com id 99/88-23940-40B62D85; Wed, 22 Mar 2017 12:16:04 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjkeJIrShJLcpLzFFi42JxWrrBXpc5+1K Ewc5nZhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8bHlafYC66LVGxbuZitgfGxQBcjB4eEgL/E 3hmCXYycHGwCOhJTn15iBQmLCKhI3N5rABJmFgiTWL3gIiOILSwQKbG2fy47iM0ioCpxa0oTM 4jNK+AucfPGFzYQW0JATuL88Z9gcU4BD4nbv6exgYwUAqrpWRoJEhYCmr5+6iw2iFZBiZMzn7 BArJKQOPjiBfMERt5ZSFKzkKQWMDKtYtQoTi0qSy3SNTTSSyrKTM8oyU3MzNE1NDDWy00tLk5 MT81JTCrWS87P3cQIDBsGINjB+Krb+RCjJAeTkihv+Y8TEUJ8SfkplRmJxRnxRaU5qcWHGGU4 OJQkeJVBcoJFqempFWmZOcAAhklLcPAoifBeBknzFhck5hZnpkOkTjHqcsx7ceANkxBLXn5eq pQ4rwxIkQBIUUZpHtwIWDRdYpSVEuZlBDpKiKcgtSg3swRV/hWjOAejkjBvKsgUnsy8ErhNr4 COYAI64u0HsCNKEhFSUg2MU/wy96QWr/04IXzNHb+V5Ucu3ZzytPrc1Hkz575Za7jMOuejrd1 /JY7P6Uzfjvdyztgawmur4XLc8dk2Q3vHKQ9SZe2bW1aHcGtv4vyqcjjosN60rIV2PRIeOVZv D/8Wfa9yq9h81taffY/aVZhC76n7n1x2cNfKzdvVuYsMDrl0LyiN/ci4W4mlOCPRUIu5qDgRA FrvjEGhAgAA X-Env-Sender: prvs=2479a8bc7=Paul.Durrant@citrix.com X-Msg-Ref: server-12.tower-31.messagelabs.com!1490184960!74709977!3 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 38252 invoked from network); 22 Mar 2017 12:16:03 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-12.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 22 Mar 2017 12:16:03 -0000 X-IronPort-AV: E=Sophos;i="5.36,205,1486425600"; d="scan'208";a="424179048" From: Paul Durrant To: Date: Wed, 22 Mar 2017 12:15:23 +0000 Message-ID: <1490184924-20156-3-git-send-email-paul.durrant@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1490184924-20156-1-git-send-email-paul.durrant@citrix.com> References: <1490184924-20156-1-git-send-email-paul.durrant@citrix.com> MIME-Version: 1.0 Cc: Andrew Cooper , Paul Durrant Subject: [Xen-devel] [PATCH v4 2/3] x86/viridian: make the threshold for HvNotifyLongSpinWait tunable X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Jan Beulich --- Cc: Andrew Cooper v3: - Use '-' in parameter name rather than '_' v2: - Significantly simplify patch by directly initializing the parameter --- docs/misc/xen-command-line.markdown | 8 ++++++++ xen/arch/x86/hvm/viridian.c | 16 +++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown index c81d693..bdbdb8a 100644 --- a/docs/misc/xen-command-line.markdown +++ b/docs/misc/xen-command-line.markdown @@ -1624,6 +1624,14 @@ relinquish control to dom0. , and must be integers. The values will be encoded in guest CPUID 0x40000002 if viridian enlightenments are enabled. +### viridian-spinlock-retry-count +> `= ` + +> 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) > `= ` diff --git a/xen/arch/x86/hvm/viridian.c b/xen/arch/x86/hvm/viridian.c index 3d58416..e18a453 100644 --- a/xen/arch/x86/hvm/viridian.c +++ b/xen/arch/x86/hvm/viridian.c @@ -174,6 +174,14 @@ static uint16_t viridian_major = 6; static uint16_t viridian_minor = 0; static uint32_t viridian_build = 0x1772; +/* + * Maximum number of retries before the guest will notify of failure + * to acquire a spinlock. + */ +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) { @@ -251,7 +259,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: