Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp86620yba; Mon, 20 May 2019 05:28:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqzMllluGKDzavTNt4Vyn2Vh6kM8lto51G8amAVx4Wucmsj/60oK8XfdfU2NZQEgFDJUrGHe X-Received: by 2002:aa7:9a95:: with SMTP id w21mr60327025pfi.248.1558355323823; Mon, 20 May 2019 05:28:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558355323; cv=none; d=google.com; s=arc-20160816; b=pl1TMOYcZugIf1lZQPLVs1i0TyAChqAX3YpOQR2Uqt4ReUnTYSiEFShgkZCFMCDrcK M5W3+WMdrovWQnXN+A0N/xJlOCvcDNTRMQtiPtehvhLY06p+zYsTCLO9V/QZwMCX+n0f HmEI+cTkKl6ymGp604+c52BrmMedIVYwn6RktzvZnD4OZIM3KzZARz5XoEs8aBeUti3D ZCu0FH7j/3cIQOPlZzPLWHPGfs8c6NfPXxNXtZ8mP4gQxk3YC3o6zrAYJoN5TVIr4Dvx s11vB3UB/u4VEtSgDaVHX1V9gEU8z3Se3nSyinkyjF8Gc0+IQmBYpK3TAaPdqYi2uRPa GPwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OEDhoWxAdwMBsL2WpHejcGk953FP4OoLbaWwjOY2W78=; b=odzZbi+CsUNY20RTA9fy5LzCR5NseFPIZpjL/659m2ufc2v0lGGBEvVWRva7D2tIlP Y8IZGS6IBU8hxE/nQNkO8+LjqdDRoXNM+2qhyWSHTCJ9q9norR9g1tM8fiJ1Cn/CWAPP 650u69jkA/7Rd1EVWoN/YrnA1rTk+JBGfnaFHm5RL781gcrCfE2VYcL0ZHTaJhqDtrIR nG1d1Iq1qkD+K0iI5VT6j931UJ9xebGoZAeC94EY9PRBYlk+68VGF9ulUi8Eu7fz1ZxM WTyhVfcL+OWBlYz38LVc2jS+kFg0I/g9XWChnwOPQR1M1H7F8tMbyasGJYWW3zkokk/0 ROPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Lk/D5ORT"; 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 w11si2378176plq.169.2019.05.20.05.28.29; Mon, 20 May 2019 05:28:43 -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=@kernel.org header.s=default header.b="Lk/D5ORT"; 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 S2389121AbfETMZi (ORCPT + 99 others); Mon, 20 May 2019 08:25:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:40758 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389115AbfETMZg (ORCPT ); Mon, 20 May 2019 08:25:36 -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 7841A20675; Mon, 20 May 2019 12:25:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558355136; bh=AKbEKwcOJ3m1dz7P1Ldurh2Qf2+9jI6jVxDWugo79ek=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lk/D5ORTVajCEGWEtwxPGrq8UtqBs5ITseb/hcjIpGbVY9tWiae8ndwodBfpGoznR /4fnpLyBYzT4/l6eJ5h1NLCF/KYZGAuirriI1TNujcuAQLUGBQVm4b2k5GGeE6WsBF gdylh6PXv7m7Z3hrJxdtUt/V8+fPy4YHmqXzS8X8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wanpeng Li , Liran Alon , Sean Christopherson , Paolo Bonzini Subject: [PATCH 4.19 094/105] KVM: lapic: Busy wait for timer to expire when using hv_timer Date: Mon, 20 May 2019 14:14:40 +0200 Message-Id: <20190520115253.743557788@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190520115247.060821231@linuxfoundation.org> References: <20190520115247.060821231@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sean Christopherson commit ee66e453db13d4837a0dcf9d43efa7a88603161b upstream. ...now that VMX's preemption timer, i.e. the hv_timer, also adjusts its programmed time based on lapic_timer_advance_ns. Without the delay, a guest can see a timer interrupt arrive before the requested time when KVM is using the hv_timer to emulate the guest's interrupt. Fixes: c5ce8235cffa0 ("KVM: VMX: Optimize tscdeadline timer latency") Cc: Cc: Wanpeng Li Reviewed-by: Liran Alon Signed-off-by: Sean Christopherson 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 @@ -1449,7 +1449,7 @@ static void apic_timer_expired(struct kv if (swait_active(q)) swake_up_one(q); - if (apic_lvtt_tscdeadline(apic)) + if (apic_lvtt_tscdeadline(apic) || ktimer->hv_timer_in_use) ktimer->expired_tscdeadline = ktimer->tscdeadline; }