From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933319AbZKFWrq (ORCPT ); Fri, 6 Nov 2009 17:47:46 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932382AbZKFWro (ORCPT ); Fri, 6 Nov 2009 17:47:44 -0500 Received: from kroah.org ([198.145.64.141]:56638 "EHLO coco.kroah.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760047AbZKFWWW (ORCPT ); Fri, 6 Nov 2009 17:22:22 -0500 X-Mailbox-Line: From gregkh@mini.kroah.org Fri Nov 6 14:15:39 2009 Message-Id: <20091106221539.652424942@mini.kroah.org> User-Agent: quilt/0.48-1 Date: Fri, 06 Nov 2009 14:14:05 -0800 From: Greg KH To: linux-kernel@vger.kernel.org, stable@kernel.org Cc: stable-review@kernel.org, torvalds@linux-foundation.org, akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk, Marcelo Tosatti , Avi Kivity Subject: [07/99] KVM: use proper hrtimer function to retrieve expiration time References: <20091106221358.309857998@mini.kroah.org> Content-Disposition: inline; filename=kvm-use-proper-hrtimer-function-to-retrieve-expiration-time.patch In-Reply-To: <20091106221850.GA15408@kroah.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2.6.31-stable review patch. If anyone has any objections, please let us know. ------------------ From: Marcelo Tosatti commit ace1546487a0fe4634e3251067f8a32cb2cdc099 upstream. hrtimer->base can be temporarily NULL due to racing hrtimer_start. See switch_hrtimer_base/lock_hrtimer_base. Use hrtimer_get_remaining which is robust against it. Signed-off-by: Marcelo Tosatti Signed-off-by: Avi Kivity Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/i8254.c | 2 +- arch/x86/kvm/lapic.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) --- a/arch/x86/kvm/i8254.c +++ b/arch/x86/kvm/i8254.c @@ -116,7 +116,7 @@ static s64 __kpit_elapsed(struct kvm *kv * itself with the initial count and continues counting * from there. */ - remaining = hrtimer_expires_remaining(&ps->pit_timer.timer); + remaining = hrtimer_get_remaining(&ps->pit_timer.timer); elapsed = ps->pit_timer.period - ktime_to_ns(remaining); elapsed = mod_64(elapsed, ps->pit_timer.period); --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -464,7 +464,7 @@ static u32 apic_get_tmcct(struct kvm_lap if (apic_get_reg(apic, APIC_TMICT) == 0) return 0; - remaining = hrtimer_expires_remaining(&apic->lapic_timer.timer); + remaining = hrtimer_get_remaining(&apic->lapic_timer.timer); if (ktime_to_ns(remaining) < 0) remaining = ktime_set(0, 0);