From patchwork Tue Mar 1 17:55:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 12764984 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 274E7C433EF for ; Tue, 1 Mar 2022 17:55:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236707AbiCAR4e (ORCPT ); Tue, 1 Mar 2022 12:56:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235921AbiCAR4d (ORCPT ); Tue, 1 Mar 2022 12:56:33 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83E6A41F8A for ; Tue, 1 Mar 2022 09:55:52 -0800 (PST) Date: Tue, 1 Mar 2022 18:55:49 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1646157351; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=jyUZX0TxdYWboAv1JRiIec9LSGMYbPj2AQm2aBVceRg=; b=VA7/xc6jVTH92MRS7EPnz7U+Z4oXxXgBGVYNrHE5rkcRAWuo2Nz+l6OOmNdAaXeNcItodx LaLvI+Fw4KUi0ZFzbERzCKrIqa5E97zUjTK25hp5vnOkUimArPADDKIRL2bdyWVZntR3mc eFHRtZW2OjMGQ3wa4ubz3z1s+A42QbNRwfBMXFAQeVDAS2/No6SS77MP2PZrgw+xZfl9UW IaSIwe6i2oJaKJIlchtFKtmcgMYHposFldTkkzACNNi5RynfhhslMCYy+DtIkKwRFv3KSf zTJHQLJobsSIQyLVKpjbMhkhQHF4me9CpQT1y+7y85aDaY3iIbTVVRMXqmPukg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1646157351; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=jyUZX0TxdYWboAv1JRiIec9LSGMYbPj2AQm2aBVceRg=; b=W8HTPH5qO7H/acugRD5kyXXkSZgTs5lXaKAFWfd5nUnDkpyvt7j6eIcaDgu8f3EtXqpf77 Vua/L6j78CIz9nBg== From: Sebastian Andrzej Siewior To: kvm@vger.kernel.org, x86@kernel.org Cc: Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Ingo Molnar , Jim Mattson , Joerg Roedel , Paolo Bonzini , Sean Christopherson , Thomas Gleixner , Vitaly Kuznetsov , Wanpeng Li Subject: [PATCH] x86: kvm Require const tsc for RT Message-ID: MIME-Version: 1.0 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Thomas Gleixner Date: Sun, 6 Nov 2011 12:26:18 +0100 Non constant TSC is a nightmare on bare metal already, but with virtualization it becomes a complete disaster because the workarounds are horrible latency wise. That's also a preliminary for running RT in a guest on top of a RT host. Signed-off-by: Thomas Gleixner Signed-off-by: Sebastian Andrzej Siewior Acked-by: Paolo Bonzini --- arch/x86/kvm/x86.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 82a9dcd8c67fe..54d2090d04e7a 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -8826,6 +8826,12 @@ int kvm_arch_init(void *opaque) goto out; } + if (IS_ENABLED(CONFIG_PREEMPT_RT) && !boot_cpu_has(X86_FEATURE_CONSTANT_TSC)) { + pr_err("RT requires X86_FEATURE_CONSTANT_TSC\n"); + r = -EOPNOTSUPP; + goto out; + } + r = -ENOMEM; x86_emulator_cache = kvm_alloc_emulator_cache();