From patchwork Thu Oct 12 10:41:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10001519 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 EAB6A602BF for ; Thu, 12 Oct 2017 10:41:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD46528BEC for ; Thu, 12 Oct 2017 10:41:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D240028D6D; Thu, 12 Oct 2017 10:41:59 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham 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 C690328BEC for ; Thu, 12 Oct 2017 10:41:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755462AbdJLKl5 (ORCPT ); Thu, 12 Oct 2017 06:41:57 -0400 Received: from mail-wm0-f43.google.com ([74.125.82.43]:53950 "EHLO mail-wm0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756122AbdJLKlv (ORCPT ); Thu, 12 Oct 2017 06:41:51 -0400 Received: by mail-wm0-f43.google.com with SMTP id q132so12090088wmd.2 for ; Thu, 12 Oct 2017 03:41:50 -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=HpuCUVEts+N3igjcmeVekjifnu/VBmgFbmDRvZFHOCA=; b=LAAuQKJxEyMs4Rcywwxt54Ut9TI+thf/Sw7cKQ23qB+uMS2P3zEte7yUDMe0W1hOpw 35kgtkpVGyRB3L8TITGHXPTtzXWaB4+h+7VnuKPw1V67DtSGLmWg3OtiqC3B9zgjQ5Fi 9FgpM7xpbyiWyq8fmaYiGgvaLYeg0QtZpMBW0= 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=HpuCUVEts+N3igjcmeVekjifnu/VBmgFbmDRvZFHOCA=; b=cDxSABsNpxsmRgFo7SPnypP62iJoAmwBrCfAsDRNtg0upBdDC5VfVqHG3fv6MNTF/a keLWWHtsg+0wyxx7w0jWqzNsiqencmCFjGboeE6rxZqluLvS3kbtmZspgPgpVbs8NA9G T/zsP8b/OKgrrbK6rfdl9LjXpdfOWM38ryPwD+cM1BVnkZCQy1kf1Gov+W5L/M1KoF9J yC3yO0a6/wRD0mUZs7+H+SQUKSq18TBVfyr1bGv1NBKUW2Dx4/LxqEAmzTTVU/j2tEVB FraJNGQZT/4DQLMiurGXdfzh3pIcezj9L7qhdaW59bIRxWPz3knCQ23TeEq0Wa5s6zdi ck4A== X-Gm-Message-State: AMCzsaUIU0+LDj9F05iIelw/jw4W7gzSCDWQWZkSy+IgRkwyAeVN+vaH c65cl9JfcvMPEjfaS+99UYLZvw== X-Google-Smtp-Source: AOwi7QD1TBehi/XXkLvc+laOvy2l1YtZYocNCXGtviuIVW019/aB2l4Spsj3Wv/32DlBKaoTT+MpYA== X-Received: by 10.80.240.2 with SMTP id r2mr2336564edl.57.1507804910277; Thu, 12 Oct 2017 03:41:50 -0700 (PDT) Received: from localhost.localdomain (xd93dd96b.cust.hiper.dk. [217.61.217.107]) by smtp.gmail.com with ESMTPSA id g49sm4798603edc.31.2017.10.12.03.41.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Oct 2017 03:41:48 -0700 (PDT) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Cc: kvm@vger.kernel.org, Marc Zyngier , Shih-Wei Li , Christoffer Dall Subject: [PATCH 06/37] KVM: arm/arm64: Only load/put VCPU state for KVM_RUN Date: Thu, 12 Oct 2017 12:41:10 +0200 Message-Id: <20171012104141.26902-7-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20171012104141.26902-1-christoffer.dall@linaro.org> References: <20171012104141.26902-1-christoffer.dall@linaro.org> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We only want to do things like invalidating TLBs or load timer state onto the physical CPU if we really intend to run the VCPU, not if we are simply retrieving some in-kernel value from userspace, for example. Signed-off-by: Christoffer Dall --- virt/kvm/arm/arm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c index 6e9513e..d495453 100644 --- a/virt/kvm/arm/arm.c +++ b/virt/kvm/arm/arm.c @@ -338,6 +338,9 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) { int *last_ran; + if (vcpu->ioctl != KVM_RUN) + return; + last_ran = this_cpu_ptr(vcpu->kvm->arch.last_vcpu_ran); /* @@ -359,6 +362,9 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) { + if (vcpu->ioctl != KVM_RUN) + return; + kvm_timer_vcpu_put(vcpu); kvm_vgic_put(vcpu);