From patchwork Fri Sep 23 10:42:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joao Martins X-Patchwork-Id: 9347877 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 0A1D8607D0 for ; Fri, 23 Sep 2016 10:43:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F02302AB0A for ; Fri, 23 Sep 2016 10:43:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4BE42AB34; Fri, 23 Sep 2016 10:43:33 +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, UNPARSEABLE_RELAY 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 C5B0C2AB0A for ; Fri, 23 Sep 2016 10:43:32 +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 1bnNvB-00083o-S7; Fri, 23 Sep 2016 10:41:33 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bnNvA-00082t-R0 for xen-devel@lists.xenproject.org; Fri, 23 Sep 2016 10:41:32 +0000 Received: from [85.158.139.211] by server-11.bemta-5.messagelabs.com id 16/C9-12614-CD605E75; Fri, 23 Sep 2016 10:41:32 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrHLMWRWlGSWpSXmKPExsXSO6nOVfcm29N wg9ePeC2+b5nM5MDocfjDFZYAxijWzLyk/IoE1ozmT19ZC+5KVTSdPsPYwNgk1sXIxSEkMJFJ 4tabBnYI5wujRPv5V2wQzkZGifsPDkBlGhklXjQsBXI4OdgE9CRaz39mBrFFBJQk7q2azARSx CzQwSjx5fwpJpCEsICnxPx3b8EaWARUJW5vXMMKYvMKeEh0LWxmAbElBOQkzh//CTaIE6j+Vd MnNhBbCKjm1YseJogaQ4nPG5cyT2DkW8DIsIpRozi1qCy1SNfIVC+pKDM9oyQ3MTNH19DAVC8 3tbg4MT01JzGpWC85P3cTIzBc6hkYGHcw7mr3O8QoycGkJMrbuO9JuBBfUn5KZUZicUZ8UWlO avEhRhkODiUJ3omsT8OFBItS01Mr0jJzgIELk5bg4FES4Z0CkuYtLkjMLc5Mh0idYlSUEuf1A 0kIgCQySvPg2mDRcolRVkqYl5GBgUGIpyC1KDezBFX+FaM4B6OSMG8ByBSezLwSuOmvgBYzAS 3+ducJyOKSRISUVANj4IsSfu/dAq939r2rXjVNgCshbaXIgcz3lq2PFz/a58DTZpa5nv/iR71 Fs94I5/d1ZIkL8fYWcF902fd5j/2DNAb50s88di2/pRfw2ebskWQSmXjsxucvfod3nuBIWWZY 53aAY6bY9pqlAW5ZH5bbrsyc+uH6lFUR57ZkGM2+seHJ11bGox5/lFiKMxINtZiLihMBGBIR5 ZECAAA= X-Env-Sender: joao.m.martins@oracle.com X-Msg-Ref: server-2.tower-206.messagelabs.com!1474627287!45104322!1 X-Originating-IP: [141.146.126.69] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTQxLjE0Ni4xMjYuNjkgPT4gMjc3MjE4\n X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 7081 invoked from network); 23 Sep 2016 10:41:28 -0000 Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by server-2.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 23 Sep 2016 10:41:28 -0000 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u8NAfPfj026861 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 23 Sep 2016 10:41:26 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.14.4/8.13.8) with ESMTP id u8NAfPXe012472 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 23 Sep 2016 10:41:25 GMT Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by userv0121.oracle.com (8.13.8/8.13.8) with ESMTP id u8NAfPp5029790; Fri, 23 Sep 2016 10:41:25 GMT Received: from paddy.lan (/89.114.92.174) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 23 Sep 2016 03:41:24 -0700 From: Joao Martins To: xen-devel@lists.xenproject.org Date: Fri, 23 Sep 2016 11:42:47 +0100 Message-Id: <1474627367-8185-6-git-send-email-joao.m.martins@oracle.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1474627367-8185-1-git-send-email-joao.m.martins@oracle.com> References: <1474627367-8185-1-git-send-email-joao.m.martins@oracle.com> X-Source-IP: userv0022.oracle.com [156.151.31.74] Cc: Andrew Cooper , Joao Martins , Jan Beulich Subject: [Xen-devel] [PATCH v5 5/5] x86/time: extend "tsc" param with "stable:socket" 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: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Extend the "tsc" boot parameter is to further relax TSC restrictions and allow it to be used on machines that guarantee reliable TSC across sockets. This is up to board manufacturers and there's no way for the OS to probe this property, therefore user needs to explicitly set this option. Also make one style adjustment that is to remove the unnecessary parenthesis around clearing TSC_RELIABLE. Signed-off-by: Joao Martins Reviewed-by: Jan Beulich --- Cc: Jan Beulich Cc: Andrew Cooper Changes since v4: - Fix documentation spelling mistakes namely repeated use of "parameter"; matching option name ("stable:socket"); s/running under/running under/g; and wording from require to adjustment suggestion. - Use __initdata instead of __read_mostly --- docs/misc/xen-command-line.markdown | 6 ++++-- xen/arch/x86/time.c | 11 ++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown index f92fb3f..962a18f 100644 --- a/docs/misc/xen-command-line.markdown +++ b/docs/misc/xen-command-line.markdown @@ -270,7 +270,9 @@ If set, override Xen's default choice for the platform timer. Having TSC as platform timer requires being explicitly set. This is because TSC can only be safely used if CPU hotplug isn't performed on the system. In some platforms, "maxcpus" parameter may require further adjustment to the -number of online cpus. +number of online cpus. When running on platforms that can guarantee a +monotonic TSC across sockets you may want to adjust the "tsc" command line +parameter to "stable:socket". ### cmci-threshold > `= ` @@ -1508,7 +1510,7 @@ pages) must also be specified via the tbuf\_size parameter. > `= ` ### tsc -> `= unstable | skewed` +> `= unstable | skewed | stable:socket` ### ucode > `= [ | scan]` diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index d307d93..dda89d8 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -477,6 +477,10 @@ uint64_t ns_to_acpi_pm_tick(uint64_t ns) /************************************************************ * PLATFORM TIMER 4: TSC */ +static unsigned int __initdata tsc_flags; + +/* TSC is reliable across sockets */ +#define TSC_RELIABLE_SOCKET (1 << 0) /* * Called in verify_tsc_reliability() under reliable TSC conditions @@ -492,7 +496,7 @@ static s64 __init init_tsc(struct platform_timesource *pts) ret = 0; } - if ( nr_sockets > 1 ) + if ( nr_sockets > 1 && !(tsc_flags & TSC_RELIABLE_SOCKET) ) { printk(XENLOG_WARNING "TSC: Not invariant across sockets\n"); ret = 0; @@ -1855,6 +1859,7 @@ int hwdom_pit_access(struct ioreq *ioreq) /* * tsc=unstable: Override all tests; assume TSC is unreliable. * tsc=skewed: Assume TSCs are individually reliable, but skewed across CPUs. + * tsc=stable:socket: Assume TSCs are reliable across sockets. */ static void __init tsc_parse(const char *s) { @@ -1865,9 +1870,9 @@ static void __init tsc_parse(const char *s) setup_clear_cpu_cap(X86_FEATURE_TSC_RELIABLE); } else if ( !strcmp(s, "skewed") ) - { setup_clear_cpu_cap(X86_FEATURE_TSC_RELIABLE); - } + else if ( !strcmp(s, "stable:socket") ) + tsc_flags |= TSC_RELIABLE_SOCKET; } custom_param("tsc", tsc_parse);