From patchwork Tue Mar 21 18:17:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 9637263 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 654D960216 for ; Tue, 21 Mar 2017 18:19:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B08B2041F for ; Tue, 21 Mar 2017 18:19:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F73B2830A; Tue, 21 Mar 2017 18:19:38 +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 CE7F82041F for ; Tue, 21 Mar 2017 18:19:37 +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 1cqOLb-0000Wn-EG; Tue, 21 Mar 2017 18:17:31 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cqOLa-0000Ve-Qo for xen-devel@lists.xenproject.org; Tue, 21 Mar 2017 18:17:30 +0000 Received: from [85.158.137.68] by server-16.bemta-3.messagelabs.com id 50/87-06437-A3E61D85; Tue, 21 Mar 2017 18:17:30 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprAIsWRWlGSWpSXmKPExsXitHSDva5l3sU Ig8YJmhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8bOj2vYCz6IVGz+uJGxgfGnQBcjJ4eEgL/E 2r+PGUFsNgEdialPL7F2MXJwiAioSNzeawASZhYIk1i94CJYibBApMTmN4eYQWwWAVWJB3f/s oHYvAJuEte+XWWCGCkncf74T7AaTgF3iW+bNoH1CgHVdHceZIKwVSTWT50F1SsocXLmExaIXR ISB1+8YJ7AyDsLSWoWktQCRqZVjBrFqUVlqUW6RmZ6SUWZ6RkluYmZObqGBsZ6uanFxYnpqTm JScV6yfm5mxiBoVPPwMC4g7Fhr98hRkkOJiVR3uvnTkQI8SXlp1RmJBZnxBeV5qQWH2KU4eBQ kuA9cg8oJ1iUmp5akZaZAwximLQEB4+SCO8BkDRvcUFibnFmOkTqFKMux7wXB94wCbHk5eelS onz7gIpEgApyijNgxsBi6hLjLJSwryMDAwMQjwFqUW5mSWo8q8YxTkYlYR5/UGm8GTmlcBteg V0BBPQEYk/j4AcUZKIkJJqYLSbGii0XnSdFiPrzftlCyy4nLguyIYfXVFn4MO3cM8nQcOXjsn OTO2dOx5bLg0/1vrplWjf24w69uWSJ1avcEn0C378gbfv1f3o/Y/SC5K/aCfvvnTle19mtYC5 go/7D77A41v5sy27NmX9tH++Zp/Rj0OLzH6emDgxgmEuZ3RibOTJW33++kosxRmJhlrMRcWJA PPivpajAgAA X-Env-Sender: prvs=246d8669f=Paul.Durrant@citrix.com X-Msg-Ref: server-6.tower-31.messagelabs.com!1490120247!59242037!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 9422 invoked from network); 21 Mar 2017 18:17:29 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-6.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 21 Mar 2017 18:17:29 -0000 X-IronPort-AV: E=Sophos;i="5.36,200,1486425600"; d="scan'208";a="424078518" From: Paul Durrant To: Date: Tue, 21 Mar 2017 18:17:21 +0000 Message-ID: <1490120242-3587-6-git-send-email-paul.durrant@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1490120242-3587-1-git-send-email-paul.durrant@citrix.com> References: <1490120242-3587-1-git-send-email-paul.durrant@citrix.com> MIME-Version: 1.0 Cc: Andrew Cooper , Paul Durrant Subject: [Xen-devel] [PATCH v3 5/6] 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 f029e66..d42298c 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 specified in hexadecimal. 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 d6381c0..9d1272a 100644 --- a/xen/arch/x86/hvm/viridian.c +++ b/xen/arch/x86/hvm/viridian.c @@ -177,6 +177,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) { @@ -254,7 +262,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: