From patchwork Mon Aug 3 12:19:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 266911 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A383C433E0 for ; Mon, 3 Aug 2020 12:26:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4248E207FC for ; Mon, 3 Aug 2020 12:26:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596457580; bh=6Bcql5MVpaJ1aPCHVFYp9K4kGhZ1iHGc4NWJiwBn1KM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=1qZvQb/2t46RMD067olE9UqYQWVIUIcTwYobrLI4edaQuLLBEUwZBvsrLg1krBzsQ RKNwes97natIVUQ6hd+QJbIHuhBhrfXEGei0tkh5YuT1ftXbWf8f9MjOtYSjZ8/TbC B25NzmzNb0SKbvNSfWjoDlKa/R/WtSGi19WfRdh8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728327AbgHCM0U (ORCPT ); Mon, 3 Aug 2020 08:26:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:51616 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728342AbgHCM0T (ORCPT ); Mon, 3 Aug 2020 08:26:19 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D4662204EC; Mon, 3 Aug 2020 12:26:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596457578; bh=6Bcql5MVpaJ1aPCHVFYp9K4kGhZ1iHGc4NWJiwBn1KM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zYSEg7rP84RKefzIG8hWkuWyiCtQVQI+es+7u4vgwEXd7IoSlJKyic0ojvjmvZqWg psYMIzhrQ/hddbJqniFa9Ls2G8k6EgJAW2vFh7jjxdp5uZw3YDq29PG8Aun1e1md0u /K0wCBv+r/mOlAv6pd/8deaCvZYYhZMItG4MQIi4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wanpeng Li , Paolo Bonzini Subject: [PATCH 5.7 118/120] KVM: LAPIC: Prevent setting the tscdeadline timer if the lapic is hw disabled Date: Mon, 3 Aug 2020 14:19:36 +0200 Message-Id: <20200803121908.636931947@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200803121902.860751811@linuxfoundation.org> References: <20200803121902.860751811@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Wanpeng Li commit d2286ba7d574ba3103a421a2f9ec17cb5b0d87a1 upstream. Prevent setting the tscdeadline timer if the lapic is hw disabled. Fixes: bce87cce88 (KVM: x86: consolidate different ways to test for in-kernel LAPIC) Cc: Signed-off-by: Wanpeng Li Message-Id: <1596165141-28874-1-git-send-email-wanpengli@tencent.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/lapic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -2136,7 +2136,7 @@ void kvm_set_lapic_tscdeadline_msr(struc { struct kvm_lapic *apic = vcpu->arch.apic; - if (!lapic_in_kernel(vcpu) || apic_lvtt_oneshot(apic) || + if (!kvm_apic_present(vcpu) || apic_lvtt_oneshot(apic) || apic_lvtt_period(apic)) return;