From patchwork Wed Mar 22 15:28:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 9639231 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 3CF56601E9 for ; Wed, 22 Mar 2017 15:31:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F11B2521E for ; Wed, 22 Mar 2017 15:31:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 23EDC2845C; Wed, 22 Mar 2017 15:31:26 +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 BC91E2521E for ; Wed, 22 Mar 2017 15:31:25 +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 1cqiC6-0004nN-8v; Wed, 22 Mar 2017 15:29:02 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cqiC4-0004mk-T8 for xen-devel@lists.xenproject.org; Wed, 22 Mar 2017 15:29:00 +0000 Received: from [85.158.143.35] by server-5.bemta-6.messagelabs.com id 2E/AA-27545-C3892D85; Wed, 22 Mar 2017 15:29:00 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuphkeJIrShJLcpLzFFi42JxWrrBXtd6xqU Ig23vtSy+b5nM5MDocfjDFZYAxijWzLyk/IoE1ozmFWUFjaIV29ceYmlg7BLsYuTkkBDwl1g2 sY0dxGYT0JGY+vQSaxcjB4eIgIrE7b0GIGFmgTCJ1QsuMoKEhQUiJT498AQJswioShzte8YGE uYVcJd495gJYqCcxPnjP5lBbE4BD4kvL5+ygthCQCXff1xggrBVJNZPncUGYvMKCEqcnPmEBW KThMTBFy+YJzDyzkKSmoUktYCRaRWjenFqUVlqka6xXlJRZnpGSW5iZo6uoYGZXm5qcXFiemp OYlKxXnJ+7iZGYMgwAMEOxo5/TocYJTmYlER5y3+ciBDiS8pPqcxILM6ILyrNSS0+xCjDwaEk wftU4WSEkGBRanpqRVpmDjB4YdISHDxKIrxHQNK8xQWJucWZ6RCpU4y6HPNeHHjDJMSSl5+XK iXOexKkSACkKKM0D24ELJIuMcpKCfMyAh0lxFOQWpSbWYIq/4pRnINRSZj3KsgUnsy8ErhNr4 COYAI64u2HEyBHlCQipKQaGCc/tvuvHP3rXYLueoFyaZ4XNm96F0w9zrQnXFR68753h86/Xxz nb105m9nf4Ynacx9P6cjQQMFppe6cC31ET4oZn8l7fKrRorrEmZ+59qaftItzyGy/R/Ny2pJd zE/H/kuW6c8v01zd/z66dw7ftC/6pWr32ovsth3gle/RcPqg1L7qzh1eJZbijERDLeai4kQAB /fx0J8CAAA= X-Env-Sender: prvs=2479a8bc7=Paul.Durrant@citrix.com X-Msg-Ref: server-7.tower-21.messagelabs.com!1490196537!63707145!1 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 55649 invoked from network); 22 Mar 2017 15:28:59 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-7.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 22 Mar 2017 15:28:59 -0000 X-IronPort-AV: E=Sophos;i="5.36,205,1486425600"; d="scan'208";a="424212419" From: Paul Durrant To: Date: Wed, 22 Mar 2017 15:28:08 +0000 Message-ID: <1490196489-16021-3-git-send-email-paul.durrant@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1490196489-16021-1-git-send-email-paul.durrant@citrix.com> References: <1490196489-16021-1-git-send-email-paul.durrant@citrix.com> MIME-Version: 1.0 Cc: Andrew Cooper , Paul Durrant Subject: [Xen-devel] [PATCH v5 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 d59294f..4c65ddc 100644 --- a/xen/arch/x86/hvm/viridian.c +++ b/xen/arch/x86/hvm/viridian.c @@ -174,6 +174,14 @@ static uint16_t __read_mostly viridian_major = 6; static uint16_t __read_mostly viridian_minor = 0; static uint32_t __read_mostly 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: