From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752798AbdGCIIc (ORCPT ); Mon, 3 Jul 2017 04:08:32 -0400 Received: from mail-oi0-f48.google.com ([209.85.218.48]:35694 "EHLO mail-oi0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752494AbdGCII1 (ORCPT ); Mon, 3 Jul 2017 04:08:27 -0400 MIME-Version: 1.0 In-Reply-To: <20be1e98-deec-ea00-32e1-251781a35f83@redhat.com> References: <1498755501-39602-1-git-send-email-pbonzini@redhat.com> <1498755501-39602-4-git-send-email-pbonzini@redhat.com> <20be1e98-deec-ea00-32e1-251781a35f83@redhat.com> From: Wanpeng Li Date: Mon, 3 Jul 2017 16:08:25 +0800 Message-ID: Subject: Re: [PATCH 3/3] KVM: LAPIC: Fix lapic timer injection delay To: Paolo Bonzini Cc: "linux-kernel@vger.kernel.org" , kvm , Radim Krcmar , Wanpeng Li Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2017-07-03 15:30 GMT+08:00 Paolo Bonzini : > > > On 02/07/2017 03:56, Wanpeng Li wrote: >>>> - if (!apic_lvtt_period(apic) && atomic_read(&ktimer->pending)) >>>> + if (!apic_lvtt_period(apic) && (r || atomic_read(&ktimer->pending))) { >>>> + if (r) >>>> + apic_timer_expired(apic); >>>> return false; >>>> + } >>> >>> This logic is not the same as in my v4 >>> http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1434040.html >>> . You return false for the expired timer and actually it will switch >>> to sw timer. >> >> Ah, I miss read it, the rebase is correct. > > Yeah, I'm not entirely satisfied with it but it's working: start_sw > timer will see ktimer->pending and do nothing. > > But thinking more about it, maybe the "if (r)" can be omitted > completely? We need to benchmark it but it can be done. "if (r)" makes codes more understandable, in addition, calling expired the pending timer here looks weird though ktimer->pending. Regards, Wanpeng Li