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: 10001621 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 9DCDD60325 for ; Thu, 12 Oct 2017 10:48:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F2EF28D6C for ; Thu, 12 Oct 2017 10:48:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 80D6C28D70; Thu, 12 Oct 2017 10:48:29 +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=ham 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 1B59A28D6C for ; Thu, 12 Oct 2017 10:48:29 +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=zXjxeNIuY9uNqYdwRlf1Ah/5qDAqQXb8FqKDCDXDqHA=; b=nsXQcRABewYD46gD10h9VpOmC4 fa25uC5JdunBYPIstOLVYxwSy1JdZRJFOUFKYImpHmBZFT/CXUSz+PAhCDxECrS/kW9oYxtS438Up eAHInwRBtKY8wp5DHw9ZPnNysdYEn8ZYdSweL29hRhgQj91sBk0qIebEJ3zo9lMaxXu1VAziZxtGL 4vnPBUX9W/WwGMa3THjNtvehFYRgtp7y3k+Bog0s7YFCDSiSB6LmvITOsKwpwCoJx/0rY+iCJ1m4v JMBdlvJLWR5RGKieO8giOUe/iLJwMlIK57svB+LGCqxJodoSQH0s3smOM5ETZIFW++39YWjcayvW5 HOwjQZDg==; 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 1e2b2N-0005WV-RL; Thu, 12 Oct 2017 10:48:23 +0000 Received: from mail-wm0-x22a.google.com ([2a00:1450:400c:c09::22a]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e2awK-0007Uv-Vy for linux-arm-kernel@lists.infradead.org; Thu, 12 Oct 2017 10:42:13 +0000 Received: by mail-wm0-x22a.google.com with SMTP id f4so12123531wme.0 for ; Thu, 12 Oct 2017 03:41:51 -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=OBtBMF44cay43gA+DrWz+NCK2BiJzxgcnbRVQPDUIx/lZxvreIOEb1AfVG/pc1vHOz 2isUb+eSLMTgurAaw93HqlMnfSu6vqca9qDONWegBe5uLztLydowjXJQaRr/lJqO01Vw x0NWkGriPxltxS0Vj9h65UPKqu/fbmNaFrLy9SKrMLPOn6LBTqBY57aWnQEhIpIz3pZ+ uP+Mt/3oZ4lCF4xXN6OxjK/cUdpb2d6Tz1lkxsV1AcvaTBFw1jTSs4awWYKbCcOQxmBv QPBt/1n7pJXzbvFI7bAjr5vpq1xvQJG99DKuI8X9g3bO2rImuz7J0QbyqoGoJ5GW1gAE usfg== X-Gm-Message-State: AMCzsaXBI9VaiXYRbqj/4RoDEUQEW23KVg5rlVBUG8M6zHedNvxFQ1Gg PrT9F63WNsVw8lxliPVU/peL8Ysx+8U= 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171012_034209_360930_40AFE008 X-CRM114-Status: UNSURE ( 9.35 ) X-CRM114-Notice: Please train this message. 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 , Christoffer Dall , Shih-Wei Li , kvm@vger.kernel.org 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 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);