Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp8382imm; Tue, 17 Jul 2018 19:25:15 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfLUrnVy9Ss6YKQyfuY9e5W2sL5q4v8vR19PdnLI+sNBTbWpPDm5SWlsoXGkUlGWspZzYSN X-Received: by 2002:a63:ff21:: with SMTP id k33-v6mr3832247pgi.38.1531880715198; Tue, 17 Jul 2018 19:25:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531880715; cv=none; d=google.com; s=arc-20160816; b=h94k9MBxeIhPr8HPylijvOLc1NWXDs0F8zJLfxLzwqDTXWzBHbfwgbaS1BV5LFarMC ymNfa4lDV39y58xzxH/61MmyJTHog7sdP51ZJpIi/XwLWxGaxyaIpSgp3M6ntzoWcwnD /91kvMQCX4pNo4YK+J5AMmljQR2zykIQl5gEjIfWkMn+F3LwUuxttLCL3KA+X43H2KXM 6IAzEzcY62yCODC1tQTARr5bVrYUGZNwJCq+S2Y45G2058u6Swud5ve4Ftmx8/woXDqf NxDu1N2qbubYr8bgkpXfTF7KMV1wSBTcycDzNzxl3QSTwx0Qyy9PLFR4MVnYwBLcT1YV KgPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:arc-authentication-results; bh=qEzMkGYOo2aluoZMmKfDa8xeXGAO054vLLUV3JbMQRY=; b=Mjhf3hzsRH+xOXwR+ILCYqv+zT+ZiAE4ajbIdvYWl6VFEQs1E+5Z+E/9CbMd5EIOCl 34K3UiHkUBslAQtUJAtWS6BBThApFpWV2Xkt2XVMolZ2icDZkIztqnVCKhwMS+Z3Lkoy TxeRQwAZQm37slLbpTrpUnJZTCNLV0Pj7vubA3l3jq79Dx+IRkXLsLAui8GSeQqEc3uj CPwnmF7w9+VOC8IS11Gj/tqtbJvX6iAmj97Ui/oErPHNJnXdqkHwhJFf0LZlAUl8bwIb AfhGRh+HTXVGk1OLLB4xDgIjzJxuOxGradrU9OsDYIQcEMGlKY3fRD4NLsyud/yFxqhC 77OQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=R6A4Dj7T; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z11-v6si2165057pfd.357.2018.07.17.19.25.00; Tue, 17 Jul 2018 19:25:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=R6A4Dj7T; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731994AbeGRC7p (ORCPT + 99 others); Tue, 17 Jul 2018 22:59:45 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:47840 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731892AbeGRC7n (ORCPT ); Tue, 17 Jul 2018 22:59:43 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w6I2Jn6o169089; Wed, 18 Jul 2018 02:22:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=qEzMkGYOo2aluoZMmKfDa8xeXGAO054vLLUV3JbMQRY=; b=R6A4Dj7TmneJTHJUFOKtZ+zb7QriOFem5j30N2LTcWlrQqPLiaXqo7z/W0iTITh+7XJZ neu0i422pPSjKdHoBv+lshmHma/q5qey2da19Xm7s7Ox7U/Hf/MLpyWWsSKlRPo7tG1N KAmr4/BOTq0Wn8Ig2++L2tPkNWqusZK2YRBnda0SkfogQV+GVZP2ODN63YMY4Xz4eov+ N7VzYt3E1FOeOm97dfXmqRphy1mO8BBkHKDPOcCfzhQX5LcQldm4V3qoT6wIVs+++y/L sVsheQ2d+sH8pwQKRI4vijyIS5Bj/27zN4zZM4dRh3Scdd5MIYdV7JSaeGOlXVMbv+zi /g== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2k7a3tb43s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Jul 2018 02:22:40 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w6I2MeYV027794 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Jul 2018 02:22:40 GMT Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w6I2MdN3020578; Wed, 18 Jul 2018 02:22:39 GMT Received: from localhost.localdomain (/73.69.118.222) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 17 Jul 2018 19:22:38 -0700 From: Pavel Tatashin To: steven.sistare@oracle.com, daniel.m.jordan@oracle.com, linux@armlinux.org.uk, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, john.stultz@linaro.org, sboyd@codeaurora.org, x86@kernel.org, linux-kernel@vger.kernel.org, mingo@redhat.com, tglx@linutronix.de, hpa@zytor.com, douly.fnst@cn.fujitsu.com, peterz@infradead.org, prarit@redhat.com, feng.tang@intel.com, pmladek@suse.com, gnomes@lxorguk.ukuu.org.uk, linux-s390@vger.kernel.org, pasha.tatashin@oracle.com, boris.ostrovsky@oracle.com, jgross@suse.com, pbonzini@redhat.com Subject: [PATCH v14 08/25] x86/kvmclock: Avoid TSC recalibration Date: Tue, 17 Jul 2018 22:21:54 -0400 Message-Id: <20180718022211.6259-9-pasha.tatashin@oracle.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180718022211.6259-1-pasha.tatashin@oracle.com> References: <20180718022211.6259-1-pasha.tatashin@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8957 signatures=668706 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807180026 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peter Zijlstra If the host gives us a TSC rate, assume it is good and don't try and recalibrate things against virtual timer hardware. Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Pavel Tatashin --- arch/x86/kernel/kvmclock.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c index ed170171fe49..da0ede8ac8f6 100644 --- a/arch/x86/kernel/kvmclock.c +++ b/arch/x86/kernel/kvmclock.c @@ -141,7 +141,16 @@ static inline void kvm_sched_clock_init(bool stable) */ static unsigned long kvm_get_tsc_khz(void) { - return pvclock_tsc_khz(this_cpu_pvti()); + unsigned long tsc_khz = pvclock_tsc_khz(this_cpu_pvti()); + + /* + * TSC frequency is reported by the host; calibration against (virtual) + * HPET/PM-timer in a guest is dodgy and pointless since the host + * already did it for us where required. + */ + setup_force_cpu_cap(X86_FEATURE_TSC_KNOWN_FREQ); + + return tsc_khz; } static void kvm_get_preset_lpj(void) -- 2.18.0