Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp1409954imp; Fri, 22 Feb 2019 03:00:26 -0800 (PST) X-Google-Smtp-Source: AHgI3Ibcd2a3lU/ixwfPhbL2jkwYNZJLm9pbaL8O1+7A1zIM6LIjohPihjWZqriB15ng42ANWrYy X-Received: by 2002:a63:2a86:: with SMTP id q128mr3439624pgq.424.1550833226593; Fri, 22 Feb 2019 03:00:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550833226; cv=none; d=google.com; s=arc-20160816; b=q9DP/q2kSSiwAGtdDzLyqYVojDW47/6KFyhYkbtU1qWuIOkH8UpPMbhbFzP2loYUCn QUk0MugXQbNbCEZUW9o0KexNUuee/NXwtGcD/3xR6K0ni2SdXbBGWHw+AHZrepVHdZ/j vqHN3/R0hD44bIsI89wZWOE/E7X98T6MB5hCcUd6AVUw/7bXGkdX0lbhsn06wGSCKJLm v25TUYPy93SsyWRooQEo6DaoaoyujSRVuaDcPtM00vC9O/Jv6hnYmNhFPf0kzuEajq9L QRICJf0A64K9DGaskRDBGZoHsicox2j7Mt8Rz/AL7IcMOF9gPXAm8gfgE6EyQsC5SQVC ACfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=5SHITY41GPbEP8P9B/Ahl93k7CYPnvw/oHBJzInlIZs=; b=0MzwggQqrxKDWoJrDY463dADNT9J3dFq4SHDOVZIiatJ+SADokMNQonDFfXcbG3ess 1yDWubWIQH+OtyIXzRogmLqAq6BQqL0Np8FaztGfcxGxZqhSeyaLIMSyGKNSVx3XIgw1 mx0/gEzyFILF1N6IfzCbbUq5plTmQjFiSNtZDzI7+7HIXfLW4D7DbngbWA8kmzyv/prW RT2HFPUvN+GQfo/r/qreuASVpFZusW+KhHXHWzoclWOiBC1jm4/jf9kvin8eoyRRVaUx kX496XNoNCjJjllKgGcGLHzXVkvX1hlzaFhI8rYudeooKBvGTe1fZ7EEijfGshYYSL+H SxbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@aepfle.de header.s=strato-dkim-0002 header.b=rO7Rzy30; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u21si1052888pgn.404.2019.02.22.03.00.10; Fri, 22 Feb 2019 03:00:26 -0800 (PST) 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=fail header.i=@aepfle.de header.s=strato-dkim-0002 header.b=rO7Rzy30; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726413AbfBVK7V (ORCPT + 99 others); Fri, 22 Feb 2019 05:59:21 -0500 Received: from mo4-p00-ob.smtp.rzone.de ([81.169.146.162]:31994 "EHLO mo4-p00-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725915AbfBVK7U (ORCPT ); Fri, 22 Feb 2019 05:59:20 -0500 X-Greylist: delayed 369 seconds by postgrey-1.27 at vger.kernel.org; Fri, 22 Feb 2019 05:59:19 EST DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1550833158; s=strato-dkim-0002; d=aepfle.de; h=Message-ID:Subject:Cc:To:From:Date:X-RZG-CLASS-ID:X-RZG-AUTH:From: Subject:Sender; bh=5SHITY41GPbEP8P9B/Ahl93k7CYPnvw/oHBJzInlIZs=; b=rO7Rzy307UL6MTyTStemmBe+eUfZxwyz/3fW++KxbNC9pJ3krmh/ee2mGcbIz0UzOS MeCEeSiko0mzG2qGKsv3N/2X7tTGyw6Ez1LrJStWXnLZV2gylEWRRgEFgILDntDQbh+O 07+QDzbbLqc1zkjQQeBkFa4B58NsbdPj44CzQ= X-RZG-AUTH: ":P2EQZWCpfu+qG7CngxMFH1J+3q8wa/QXkBR9MXjAuzpIG0mv9coXAgc09FajRctxF8avNjL8BIaOzrboMVGNhg5iLfM=" X-RZG-CLASS-ID: mo00 Received: from aepfle.de by smtp.strato.de (RZmta 44.12 AUTH) with ESMTPSA id R08017v1MAr6jHt (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Fri, 22 Feb 2019 11:53:06 +0100 (CET) Date: Fri, 22 Feb 2019 11:53:02 +0100 From: Olaf Hering To: John Stultz , Thomas Gleixner , Stephen Boyd Cc: linux-kernel@vger.kernel.org Subject: recalibrating x86 TSC during suspend/resume Message-ID: <20190222105302.GA26398@aepfle.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="VbJkn9YxBvnuCH5J" Content-Disposition: inline User-Agent: Mutt/1.11.3 (20190207T234809.c483d3c3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --VbJkn9YxBvnuCH5J Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Is there a way to recalibrate the x86 TSC during a suspend/resume cycle? While the frequency will remain the same on a Laptop, it may (or rather: it definitly will) differ if a VM is migrated from one host to another. The hypervisor may choose to emulate the expected TSC frequency on the destination host, but this emulation comes with a significant performance cost. Therefore it would be good if the kernel evaluates the environment during resume. The specific usecase I have is a workload within VMs that makes heavy use of TSC. The kernel is booted with 'clocksource=tsc highres=off nohz=off' because only this clocksource gives enough granularity. The default paravirtualized clock will return the same values via clock_gettime(CLOCK_MONOTONIC) if the timespan between two calls is too short. This does not happen with 'clocksource=tsc'. Right now it is not possible to migrate VMs to hosts with different CPU speeds. This leads to "islands" of identical hardware, and makes maintenance of hosts harder than it needs to be. If the VM kernel would be able to cope with CPU/TSC frequency changes, the pool of potential destination hosts will become significant larger. The current result of a migration with non-emulated TSC between hosts of different speed is: [ 42.452258] clocksource: timekeeping watchdog on CPU1: Marking clocksource 'tsc' as unstable because the skew is too large: [ 42.452270] clocksource: 'xen' wd_now: 6d34a86adb wd_last: 6d1dc51793 mask: ffffffffffffffff [ 42.452272] clocksource: 'tsc' cs_now: 1fd2ce46bb cs_last: 1f95c4ca75 mask: ffffffffffffffff [ 42.452273] tsc: Marking TSC unstable due to clocksource watchdog Thanks, Olaf --VbJkn9YxBvnuCH5J Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQSkRyP6Rn//f03pRUBdQqD6ppg2fgUCXG/UigAKCRBdQqD6ppg2 fjYDAJ44u6MuRWhsXtF4PVDLElbIijREVwCgn5aRMuImqmD6dENxkObdTdBowqM= =0dEX -----END PGP SIGNATURE----- --VbJkn9YxBvnuCH5J--