From patchwork Mon Oct 24 10:23:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Wanpeng Li X-Patchwork-Id: 9391857 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5D7FE60762 for ; Mon, 24 Oct 2016 10:25:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F0A028F07 for ; Mon, 24 Oct 2016 10:25:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 41D7928F0E; Mon, 24 Oct 2016 10:25:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66B4828F07 for ; Mon, 24 Oct 2016 10:25:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757369AbcJXKYn (ORCPT ); Mon, 24 Oct 2016 06:24:43 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:36227 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757042AbcJXKYD (ORCPT ); Mon, 24 Oct 2016 06:24:03 -0400 Received: by mail-pf0-f196.google.com with SMTP id r16so16205998pfg.3; Mon, 24 Oct 2016 03:24:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9fx5CEkdSDGeVL39Poh7Nn0QaFplp2zynaxa3kW5EH4=; b=KCW4zbmemVmXhluF2c4/pB8F9MUBibn293fhosyc0n7shQwr1jal80RTnkka7iZ1On qdaRzZcPlbq8j3CCN914A5E/zThBIEqtC67EYDSMdiPpToAWNEYpd437Lo7CafEjPJvn hoRG4YfAd3PDWMV06XkOUCjWYAHhpTzICWdmJuixasFTZFtlsm+if+8AFrklUwkWunt8 4YNYPQycPRB5zlJIuxgne0RIamuqTTYaf02bRTTSorK0/F2PWh/TulMT6LQuxEAxYQ/v jo39+sQBM+fvDFUlR9DKDmrU9iQW/0L5krMhKyEPeBZEaZbOun6tF7STVpA6imZGHy0r b1HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9fx5CEkdSDGeVL39Poh7Nn0QaFplp2zynaxa3kW5EH4=; b=a7haImvyMS7NTK40WOhO+RuQ17l7iXgf65lFQqJOgiB1+v8rHtoTS2iONEHCQbCc6Y uPil1vPjyBW7cI0gRjcX/VRTP85ZaWXayQ/GZAU5V52wnGNQLe35WZ+ca2Fc5F2OjNcr GB5yWaz3suWR3ftuYHEaj9c1ThClvErU2dGB3Df1Rnpn/LvGSBtePBVpxUVaGnox/wQ3 McsFUp/2WS8dww9nMuEwQrpuM3hhVH7uOVNM631hPNtoQ0iA4OV+0iSndSy4wCwDmULN PvwEnN3Y6a62s8Aq9Ll/9qfxV5tGF9vDx53l0Xmsde50KDE4xwHG4NdzsZjQpYQsg3mt +u1Q== X-Gm-Message-State: ABUngvcJgksJobNBFEfpugcC7Ya0iJrHHsCN6WL0UctIZld6WYQCvkeYksRILfyNtQUQ3Q== X-Received: by 10.98.201.207 with SMTP id l76mr27349325pfk.137.1477304642215; Mon, 24 Oct 2016 03:24:02 -0700 (PDT) Received: from kernel.kingsoft.cn ([114.255.44.132]) by smtp.gmail.com with ESMTPSA id h5sm24146322pfg.86.2016.10.24.03.23.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Oct 2016 03:24:01 -0700 (PDT) From: Wanpeng Li X-Google-Original-From: Wanpeng Li To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Yunhong Jiang , Wanpeng Li Subject: [PATCH v3 4/5] KVM: LAPIC: rename start/cancel_hv_tscdeadline to start/cancel_hv_timer Date: Mon, 24 Oct 2016 18:23:12 +0800 Message-Id: <1477304593-3453-5-git-send-email-wanpeng.li@hotmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1477304593-3453-1-git-send-email-wanpeng.li@hotmail.com> References: <1477304593-3453-1-git-send-email-wanpeng.li@hotmail.com> MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Wanpeng Li Rename start/cancel_hv_tscdeadline to start/cancel_hv_timer since they will handle both APIC Timer periodic/oneshot mode and tsc-deadline mode. Cc: Paolo Bonzini Cc: Radim Krčmář Cc: Yunhong Jiang Signed-off-by: Wanpeng Li --- arch/x86/kvm/lapic.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 531fc28..0354a79 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -1400,7 +1400,7 @@ bool kvm_lapic_hv_timer_in_use(struct kvm_vcpu *vcpu) } EXPORT_SYMBOL_GPL(kvm_lapic_hv_timer_in_use); -static void cancel_hv_tscdeadline(struct kvm_lapic *apic) +static void cancel_hv_timer(struct kvm_lapic *apic) { kvm_x86_ops->cancel_hv_timer(apic->vcpu); apic->lapic_timer.hv_timer_in_use = false; @@ -1412,26 +1412,26 @@ void kvm_lapic_expired_hv_timer(struct kvm_vcpu *vcpu) WARN_ON(!apic->lapic_timer.hv_timer_in_use); WARN_ON(swait_active(&vcpu->wq)); - cancel_hv_tscdeadline(apic); + cancel_hv_timer(apic); apic_timer_expired(apic); } EXPORT_SYMBOL_GPL(kvm_lapic_expired_hv_timer); -static bool start_hv_tscdeadline(struct kvm_lapic *apic) +static bool start_hv_timer(struct kvm_lapic *apic) { u64 tscdeadline = apic->lapic_timer.tscdeadline; if (atomic_read(&apic->lapic_timer.pending) || kvm_x86_ops->set_hv_timer(apic->vcpu, tscdeadline)) { if (apic->lapic_timer.hv_timer_in_use) - cancel_hv_tscdeadline(apic); + cancel_hv_timer(apic); } else { apic->lapic_timer.hv_timer_in_use = true; hrtimer_cancel(&apic->lapic_timer.timer); /* In case the sw timer triggered in the window */ if (atomic_read(&apic->lapic_timer.pending)) - cancel_hv_tscdeadline(apic); + cancel_hv_timer(apic); } trace_kvm_hv_timer_state(apic->vcpu->vcpu_id, apic->lapic_timer.hv_timer_in_use); @@ -1445,7 +1445,7 @@ void kvm_lapic_switch_to_hv_timer(struct kvm_vcpu *vcpu) WARN_ON(apic->lapic_timer.hv_timer_in_use); if (apic_lvtt_tscdeadline(apic)) - start_hv_tscdeadline(apic); + start_hv_timer(apic); } EXPORT_SYMBOL_GPL(kvm_lapic_switch_to_hv_timer); @@ -1457,7 +1457,7 @@ void kvm_lapic_switch_to_sw_timer(struct kvm_vcpu *vcpu) if (!apic->lapic_timer.hv_timer_in_use) return; - cancel_hv_tscdeadline(apic); + cancel_hv_timer(apic); if (atomic_read(&apic->lapic_timer.pending)) return; @@ -1473,7 +1473,7 @@ static void start_apic_timer(struct kvm_lapic *apic) if (apic_lvtt_period(apic) || apic_lvtt_oneshot(apic)) start_sw_period(apic); else if (apic_lvtt_tscdeadline(apic)) { - if (!(kvm_x86_ops->set_hv_timer && start_hv_tscdeadline(apic))) + if (!(kvm_x86_ops->set_hv_timer && start_hv_timer(apic))) start_sw_tscdeadline(apic); } }