[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH linux-next] x86/xen/time: prefer tsc as clocksource when it is invariant
- To: Krister Johansen <kjlx@xxxxxxxxxxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>
- From: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
- Date: Fri, 9 Dec 2022 14:32:15 -0500
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PNzzHDIsSR6h5f631wSYuH8ciJzhQz+XG+bm67WnCgU=; b=EVsj7Zscvd+qUJfkqduCVJ91lIV9w5cok47NVdi5KQj/7eqLqFEUXasRk2M71Dl+G5N8ZIal0tmwNJRqARmFkRjvClPmaK/BJj9bz9wusIaw/6IEtg+/XTGM+ETlOeIV2Qr8ra7cEvGA0FpiJ7Ug4e1xNfJhjEmR+BAKcaKtkcT8rx79s6dTceD0moQT4S2AWK1wOTNzXbRiyzNBuwteFS2p04FS8D+e3+zJl0TGtLSX3viCahaBmoc4VJp3eAKsb6JFDg4cvP08NDz+5g6OB4e6LxtsfWY4L6QamzBgVpD3M5KqryzSF8lP+ZRtWpn1zCbcphZWtUO9O4qQak9bZA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TnRqRMVkWUkyrb/8L/F0gGr+vlyNssM3pSzeLCXl1yo3NWiHxySTrCYP1fEeqvORQrfFjdtIxGm3mpPHLFmkQ7/5yQeXZ5EoNlhUxXrXeg+aZb+PbKkhpXuakqoz/6AXAXU92b5DsAfWz/npvCw0265f6BqMWTogOOAXeVkHIiVpb/S5vg8lEuLBiR/HAyNRmdNrRXlxgh5levDICylb/y2IAngtJZf0rEHcxPgTLxmO77RYUM371fxFrzjuncR+T+6CDrpUH0xdj0erKBG1dVDx4Rdnru1eYPVZYXqumY4t/tLpHC9wQCvm/YckRnNAYjBORmSKGzcQvxzRpFazdw==
- Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, x86@xxxxxxxxxx, "H. Peter Anvin" <hpa@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, Marcelo Tosatti <mtosatti@xxxxxxxxxx>, Anthony Liguori <aliguori@xxxxxxxxxx>, David Reaver <me@xxxxxxxxxxxxxxx>, Brendan Gregg <brendan@xxxxxxxxx>
- Delivery-date: Fri, 09 Dec 2022 19:32:52 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 12/8/22 11:36 AM, Krister Johansen wrote:
+ /*
+ * As Dom0 is never moved, no penalty on using TSC there.
+ *
+ * If the guest has invariant tsc, then set xen_clocksource rating
+ * below that of the tsc so that the system prefers tsc instead. This
+ * check excludes PV domains, because PV is unable to guarantee that the
+ * guest's cpuid call has been intercepted by the hypervisor.
+ */
+ if (xen_initial_domain()) {
xen_clocksource.rating = 275;
+ } else if ((xen_hvm_domain() || xen_pvh_domain()) &&
+ boot_cpu_has(X86_FEATURE_CONSTANT_TSC) &&
+ boot_cpu_has(X86_FEATURE_NONSTOP_TSC) &&
+ !check_tsc_unstable()) {
+ xen_clocksource.rating = 299;
+ }
What if RDTSC is intercepted?
-boris
|