From patchwork Thu Oct 13 11:34:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Wanpeng Li X-Patchwork-Id: 9374857 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 DFAEB60487 for ; Thu, 13 Oct 2016 11:37:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D063729F29 for ; Thu, 13 Oct 2016 11:37:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C4BB429FF7; Thu, 13 Oct 2016 11:37:22 +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 459C929F29 for ; Thu, 13 Oct 2016 11:37:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754786AbcJMLgG (ORCPT ); Thu, 13 Oct 2016 07:36:06 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:36555 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754031AbcJMLfa (ORCPT ); Thu, 13 Oct 2016 07:35:30 -0400 Received: by mail-pf0-f194.google.com with SMTP id r16so4924590pfg.3; Thu, 13 Oct 2016 04:34:41 -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=s9WLkLAUgBOUZEo1tNcNHxAAmlQueBSGv3OCNWn4Ig4=; b=qv8PSYBusCZd02VIFycCjX6JzgNq2ODa9Yn8b7U7sY/wfMc45t8CruKULBLxLXAxYn B1/CTO9FvPNrLRTFWaWWSyz/uFshNsgHZdV5Yzw8z5K3hhTIU8ffPh38E3/FNbXn7gp/ 3czXFR7bPWHD4ovIuVY+51OK9fiNQAwYPAeWEBGTYoULs+XID+7n67GrkRVm0yvQAgPA JTBrs6oRFVNWUemmkCeSni/uC0GwGHrx+oKHMmlsQB61IRMnG7Ztg4Sn5DaVrFBmjJ4b whfmUYcQgZ6jGy2BGUBtblcztzkG1eFgL/55OA+Oom0xu0gm7ClrsUDreky9hoMSpALn BseA== 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=s9WLkLAUgBOUZEo1tNcNHxAAmlQueBSGv3OCNWn4Ig4=; b=MRQ2XyulQUO2l5weU8igOwxicrDXYthmMrhgqCrQ9PJAcUVy1DA/KcO/qvGdkfJQGQ b0sXQKOM2HXLQX4e2L/okDHWzmDIgIYOq0fv5bLSfliOdoH/EDivbO96CLH19Doxxj8y 390GFOeuVnFjbWxWZ8gOdA1KDIIqWkFFLFgNAwF4EhavNx6DLzF/SH3vzRbQ3Cbo7iNP z0XWMsQwzbyvHNIyaIjGcJr4O1FrlrToIsx1bV+BJJ5kUunXGyyiTx2NJqJko0b3KCBI eS7IyRwCA49e+8hg4ldfKj3jvvG0gNmBqVUM7BsexctjbPm65z2yEiYZ+eh594Vsvv6y NT0g== X-Gm-Message-State: AA6/9Rlm+y2q4mm0NCzA47dFSZ4Xv52lY+AG0zjZ0CKZwQN3+B00sbyFIGvwo2wepnZw0A== X-Received: by 10.99.119.205 with SMTP id s196mr7820145pgc.140.1476358481136; Thu, 13 Oct 2016 04:34:41 -0700 (PDT) Received: from kernel.kingsoft.cn ([114.255.44.132]) by smtp.gmail.com with ESMTPSA id af17sm19095088pac.14.2016.10.13.04.34.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 13 Oct 2016 04:34:40 -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 RFC V3 5/6] KVM: LAPIC: rename start/cancel_hv_tscdeadline to start/cancel_hv_timer Date: Thu, 13 Oct 2016 19:34:17 +0800 Message-Id: <1476358458-3525-6-git-send-email-wanpeng.li@hotmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1476358458-3525-1-git-send-email-wanpeng.li@hotmail.com> References: <1476358458-3525-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 5eb83c6..e93e549 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -1447,7 +1447,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; @@ -1459,26 +1459,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); @@ -1492,7 +1492,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); @@ -1504,7 +1504,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; @@ -1520,7 +1520,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); } }