From patchwork Wed Jun 25 09:28:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 32467 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f71.google.com (mail-qa0-f71.google.com [209.85.216.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9513E20C88 for ; Wed, 25 Jun 2014 09:30:55 +0000 (UTC) Received: by mail-qa0-f71.google.com with SMTP id m5sf2689918qaj.2 for ; Wed, 25 Jun 2014 02:30:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=Seuw44UdYarrjR05dQxoC3m0sQFB2MAZg63rwtBVCJk=; b=lZfooDRAZ9IFVaymT9TEXiJfUuE2dGfCjo6IMzcTlGexmdE30ALUVBzgVsa1tPeASm VRE0hLBfaz1s5SeqM33gY9RGwuv9oVypeKRiF5y3uhJbNo7v8fbtgVhYR5X9oVBzu48J +ce3ZV/5C2wys1aIu61pRN59TQRv7WTdBjDZG0+N/VLg13TOxqH7hBYAl2DqyZRMomae 33pYdPxbs85/4db6mYQ8m+nnWDmL2cdKQgpQBGkmYj8WeedbUWsUYdTZXLFXbfSqkwoz edS5HZ4Pn4VeoAywsUTLpJONAxEWZqGdhCs24Wn72j5P0eO/Y3hMvh4FC7el9WlOyRwV ToZw== X-Gm-Message-State: ALoCoQl6jpOido4CYIvpaMz0nT3nhKmIxxRnCIkghGfjR3iOx6apgnjdiEKzU//SeGI/2a3RTny0 X-Received: by 10.58.187.44 with SMTP id fp12mr3823001vec.24.1403688655459; Wed, 25 Jun 2014 02:30:55 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.25.70 with SMTP id 64ls1176552qgs.14.gmail; Wed, 25 Jun 2014 02:30:55 -0700 (PDT) X-Received: by 10.52.138.14 with SMTP id qm14mr570370vdb.49.1403688655349; Wed, 25 Jun 2014 02:30:55 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id ls1si1884474vcb.99.2014.06.25.02.30.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 25 Jun 2014 02:30:55 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.182 as permitted sender) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id il7so1626353vcb.27 for ; Wed, 25 Jun 2014 02:30:55 -0700 (PDT) X-Received: by 10.220.15.8 with SMTP id i8mr44955vca.45.1403688655260; Wed, 25 Jun 2014 02:30:55 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp274483vcb; Wed, 25 Jun 2014 02:30:54 -0700 (PDT) X-Received: by 10.66.122.135 with SMTP id ls7mr9968492pab.84.1403688654558; Wed, 25 Jun 2014 02:30:54 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id kw5si2294733pbc.30.2014.06.25.02.30.53; Wed, 25 Jun 2014 02:30:53 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755947AbaFYJaU (ORCPT + 27 others); Wed, 25 Jun 2014 05:30:20 -0400 Received: from fw-tnat.austin.arm.com ([217.140.110.23]:51402 "EHLO collaborate-mta1.arm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755500AbaFYJ3D (ORCPT ); Wed, 25 Jun 2014 05:29:03 -0400 Received: from e102391-lin.cambridge.arm.com (e102391-lin.cambridge.arm.com [10.1.209.143]) by collaborate-mta1.arm.com (Postfix) with ESMTP id 0CAE213FB5A; Wed, 25 Jun 2014 04:29:01 -0500 (CDT) From: Marc Zyngier To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Will Deacon , Catalin Marinas , Thomas Gleixner , eric.auger@linaro.org, Christoffer Dall Subject: [RFC PATCH 8/9] arm: KVM: timer: move the timer switch into the non-preemptible section Date: Wed, 25 Jun 2014 10:28:49 +0100 Message-Id: <1403688530-23273-9-git-send-email-marc.zyngier@arm.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1403688530-23273-1-git-send-email-marc.zyngier@arm.com> References: <1403688530-23273-1-git-send-email-marc.zyngier@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: marc.zyngier@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.182 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , In order to convert the timer code to the new interrupt save/restore API, make sure the timer switch is done in a non-premtible section, so that we save/restore the state on the right CPU. Signed-off-by: Marc Zyngier --- arch/arm/kvm/arm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c index a291e63..92875b2 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c @@ -554,9 +554,9 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) vcpu_pause(vcpu); kvm_vgic_flush_hwstate(vcpu); - kvm_timer_flush_hwstate(vcpu); local_irq_disable(); + kvm_timer_flush_hwstate(vcpu); /* * Re-check atomic conditions @@ -567,8 +567,8 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) } if (ret <= 0 || need_new_vmid_gen(vcpu->kvm)) { - local_irq_enable(); kvm_timer_sync_hwstate(vcpu); + local_irq_enable(); kvm_vgic_sync_hwstate(vcpu); continue; } @@ -586,6 +586,8 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) vcpu->arch.last_pcpu = smp_processor_id(); kvm_guest_exit(); trace_kvm_exit(*vcpu_pc(vcpu)); + kvm_timer_sync_hwstate(vcpu); + /* * We may have taken a host interrupt in HYP mode (ie * while executing the guest). This interrupt is still @@ -602,7 +604,6 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) * Back from guest *************************************************************/ - kvm_timer_sync_hwstate(vcpu); kvm_vgic_sync_hwstate(vcpu); ret = handle_exit(vcpu, run, ret);