From patchwork Sat Sep 23 00:41:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 9967339 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 6D4EE600C5 for ; Sat, 23 Sep 2017 00:47:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5BB8127F92 for ; Sat, 23 Sep 2017 00:47:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D75928579; Sat, 23 Sep 2017 00:47:11 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3CBA027F92 for ; Sat, 23 Sep 2017 00:47:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Bb1KW0Apk/PZPSjp9tCyuCiXibe5SQHnQPThn14ZQ5Q=; b=flKhSzJuOyoi92w12moHLOpqv8 hILKcOV6khAuZFP5M1aI0E5ytCawnl1d6ywDkgN15a6j5DhAU4LnRLGpk51c+llpcEc46uVcodg4g q+Qc4506c89vw+WFbrTWVK7oCgAsX6pKtb4t/hAtsGqAE2EfGLMfYWmHnETlVWYscZlemrcpSna/k JrTjJqT8IeYJBSeqUGcHcWo1xjYS8Yk+IAR/p4V0g4fp1Z0Bsr7thBFE9QWAMi8UNkfWXt5sEt/Zy IetPL9z3AvzCW2BGI2HfzbdX72P9H+0DEeNtHUbK0EYXmNBRNPRpuitL2gkNzUR6g3R4kXNHfVAFb MXvo8o+A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dvYa9-0007LX-3c; Sat, 23 Sep 2017 00:46:09 +0000 Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dvYWk-0003ms-Nw for linux-arm-kernel@lists.infradead.org; Sat, 23 Sep 2017 00:42:49 +0000 Received: by mail-wm0-x236.google.com with SMTP id m127so3844305wmm.1 for ; Fri, 22 Sep 2017 17:42:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4L8aGWDQgZ6zv4YbjeOOTPMy4xroEftTbpacQlflBYw=; b=PF9HVOTALv9xQSVtagbgyKL4huqGjwsm+K0WklATKyIdQ70ytx7tRjowWe6pvnVkLW 08i1IHLGfSJp53FwoNC7I50jawJYcWbSjhIeuSMPzhUnmJo13CcKUg7d9J+MDHmlkOFX GK6FrS0ZWZWF2W4HQRo/SVCt2JoFxXKQFDLKw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4L8aGWDQgZ6zv4YbjeOOTPMy4xroEftTbpacQlflBYw=; b=bttvhvLRmxACCeS6EOylv3ksotkIwZIWeLjN+z0chSbC1Se8wLmzmL8nCYHY5mpPwW RYOgwkaKyuAynDnUCmJGQwsYpcCYZrSCHdPNk9dIEC8x+mBSwNzfMbDPXhSIgBijSXyK E3vD5l8pNekLNXkIfkvN6d7GdcTrdGh+gdR2cSluxNQs7JSgWooAmS/Q1vJClbzylxwJ Vl7k8Sp+ysmh8E6HZTSoJBJGlc+Z36x2ki8Pk5+t50mEJBu0sTWIpSKx6JGTDnPU6Umm PY145+kmmFdXSh6u1kM634bAxnK4CQvjXj+fCdz1rW47b2sEpRg3QAg3IdH/3myekHcP IAPQ== X-Gm-Message-State: AHPjjUiim/0QtFeyiBDrn8uFW/Pg8qe+2Ytzv6C4v/CLPEd56B4GXZmW tzQqJRR04Ccmb6vSaNjmXb6HUA== X-Google-Smtp-Source: AOwi7QA0wcmCpJkjqd97yFwDSq61vffogbpyh5TO4o3q/zOrLHDItklAmIr3G5hRfx4DWGJAdN1tuQ== X-Received: by 10.80.240.67 with SMTP id u3mr2691748edl.35.1506127336196; Fri, 22 Sep 2017 17:42:16 -0700 (PDT) Received: from localhost.localdomain (xd93dd96b.cust.hiper.dk. [217.61.217.107]) by smtp.gmail.com with ESMTPSA id c25sm646085edb.57.2017.09.22.17.42.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 17:42:15 -0700 (PDT) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 08/20] KVM: arm/arm64: Rename soft timer to bg_timer Date: Sat, 23 Sep 2017 02:41:55 +0200 Message-Id: <20170923004207.22356-9-cdall@linaro.org> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170923004207.22356-1-cdall@linaro.org> References: <20170923004207.22356-1-cdall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170922_174241_350517_86E2BE1B X-CRM114-Status: GOOD ( 14.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , Catalin Marinas , Will Deacon , kvm@vger.kernel.org, Christoffer Dall MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP As we are about to introduce a separate hrtimer for the physical timer, call this timer bg_timer, because we refer to this timer as the background timer in the code and comments elsewhere. Signed-off-by: Christoffer Dall Acked-by: Marc Zyngier --- include/kvm/arm_arch_timer.h | 3 +-- virt/kvm/arm/arch_timer.c | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/include/kvm/arm_arch_timer.h b/include/kvm/arm_arch_timer.h index f0053f8..dcbb2e1 100644 --- a/include/kvm/arm_arch_timer.h +++ b/include/kvm/arm_arch_timer.h @@ -43,8 +43,7 @@ struct arch_timer_cpu { struct arch_timer_context ptimer; /* Background timer used when the guest is not running */ - struct hrtimer timer; - + struct hrtimer bg_timer; /* Work queued with the above timer expires */ struct work_struct expired; diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c index 871d8ae..c2e8326 100644 --- a/virt/kvm/arm/arch_timer.c +++ b/virt/kvm/arm/arch_timer.c @@ -56,7 +56,7 @@ u64 kvm_phys_timer_read(void) return timecounter->cc->read(timecounter->cc); } -static bool soft_timer_is_armed(struct arch_timer_cpu *timer) +static bool bg_timer_is_armed(struct arch_timer_cpu *timer) { return timer->armed; } @@ -154,13 +154,13 @@ static u64 kvm_timer_earliest_exp(struct kvm_vcpu *vcpu) return min(min_virt, min_phys); } -static enum hrtimer_restart kvm_timer_expire(struct hrtimer *hrt) +static enum hrtimer_restart kvm_bg_timer_expire(struct hrtimer *hrt) { struct arch_timer_cpu *timer; struct kvm_vcpu *vcpu; u64 ns; - timer = container_of(hrt, struct arch_timer_cpu, timer); + timer = container_of(hrt, struct arch_timer_cpu, bg_timer); vcpu = container_of(timer, struct kvm_vcpu, arch.timer_cpu); /* @@ -267,7 +267,7 @@ static void kvm_timer_emulate(struct kvm_vcpu *vcpu, return; /* The timer has not yet expired, schedule a background timer */ - soft_timer_start(&timer->timer, kvm_timer_compute_delta(timer_ctx)); + soft_timer_start(&timer->bg_timer, kvm_timer_compute_delta(timer_ctx)); } /* @@ -281,7 +281,7 @@ void kvm_timer_schedule(struct kvm_vcpu *vcpu) struct arch_timer_context *vtimer = vcpu_vtimer(vcpu); struct arch_timer_context *ptimer = vcpu_ptimer(vcpu); - BUG_ON(soft_timer_is_armed(timer)); + BUG_ON(bg_timer_is_armed(timer)); /* * No need to schedule a background timer if any guest timer has @@ -303,14 +303,14 @@ void kvm_timer_schedule(struct kvm_vcpu *vcpu) * Set the earliest expiration time among the guest timers. */ timer->armed = true; - soft_timer_start(&timer->timer, kvm_timer_earliest_exp(vcpu)); + soft_timer_start(&timer->bg_timer, kvm_timer_earliest_exp(vcpu)); } void kvm_timer_unschedule(struct kvm_vcpu *vcpu) { struct arch_timer_cpu *timer = &vcpu->arch.timer_cpu; - soft_timer_cancel(&timer->timer, &timer->expired); + soft_timer_cancel(&timer->bg_timer, &timer->expired); timer->armed = false; } @@ -447,7 +447,7 @@ void kvm_timer_sync_hwstate(struct kvm_vcpu *vcpu) * This is to cancel the background timer for the physical timer * emulation if it is set. */ - soft_timer_cancel(&timer->timer, &timer->expired); + soft_timer_cancel(&timer->bg_timer, &timer->expired); /* * The guest could have modified the timer registers or the timer @@ -504,8 +504,8 @@ void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu) vcpu_ptimer(vcpu)->cntvoff = 0; INIT_WORK(&timer->expired, kvm_timer_inject_irq_work); - hrtimer_init(&timer->timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); - timer->timer.function = kvm_timer_expire; + hrtimer_init(&timer->bg_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); + timer->bg_timer.function = kvm_bg_timer_expire; vtimer->irq.irq = default_vtimer_irq.irq; ptimer->irq.irq = default_ptimer_irq.irq; @@ -614,7 +614,7 @@ void kvm_timer_vcpu_terminate(struct kvm_vcpu *vcpu) struct arch_timer_cpu *timer = &vcpu->arch.timer_cpu; struct arch_timer_context *vtimer = vcpu_vtimer(vcpu); - soft_timer_cancel(&timer->timer, &timer->expired); + soft_timer_cancel(&timer->bg_timer, &timer->expired); kvm_vgic_unmap_phys_irq(vcpu, vtimer->irq.irq); }