{"id":842655,"url":"http://patchwork.ozlabs.org/api/patches/842655/?format=json","web_url":"http://patchwork.ozlabs.org/project/kvm-ppc/patch/20171129164116.16167-17-christoffer.dall@linaro.org/","project":{"id":23,"url":"http://patchwork.ozlabs.org/api/projects/23/?format=json","name":"KVM PowerPC development","link_name":"kvm-ppc","list_id":"kvm-ppc.vger.kernel.org","list_email":"kvm-ppc@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20171129164116.16167-17-christoffer.dall@linaro.org>","list_archive_url":null,"date":"2017-11-29T16:41:16","name":"[v2,16/16] KVM: arm/arm64: Move vcpu_load call after kvm_vcpu_first_run_init","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"88ce3e17403cbdef3a38b223812b09f20abbd31b","submitter":{"id":26352,"url":"http://patchwork.ozlabs.org/api/people/26352/?format=json","name":"Christoffer Dall","email":"christoffer.dall@linaro.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/kvm-ppc/patch/20171129164116.16167-17-christoffer.dall@linaro.org/mbox/","series":[{"id":15778,"url":"http://patchwork.ozlabs.org/api/series/15778/?format=json","web_url":"http://patchwork.ozlabs.org/project/kvm-ppc/list/?series=15778","date":"2017-11-29T16:41:00","name":"Move vcpu_load and vcpu_put calls to arch code","version":2,"mbox":"http://patchwork.ozlabs.org/series/15778/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/842655/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/842655/checks/","tags":{},"related":[],"headers":{"Return-Path":"<kvm-ppc-owner@vger.kernel.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=kvm-ppc-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"a46of1KF\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3yn5sc4tsgz9t3l\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 30 Nov 2017 03:41:56 +1100 (AEDT)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S933808AbdK2Qlz (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tWed, 29 Nov 2017 11:41:55 -0500","from mail-wr0-f194.google.com ([209.85.128.194]:43659 \"EHLO\n\tmail-wr0-f194.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S933802AbdK2Qlr (ORCPT\n\t<rfc822;kvm-ppc@vger.kernel.org>); Wed, 29 Nov 2017 11:41:47 -0500","by mail-wr0-f194.google.com with SMTP id z34so3970784wrz.10\n\tfor <kvm-ppc@vger.kernel.org>; Wed, 29 Nov 2017 08:41:47 -0800 (PST)","from localhost.localdomain (x50d2404e.cust.hiper.dk.\n\t[80.210.64.78]) by smtp.gmail.com with ESMTPSA id\n\te71sm2080765wma.13.2017.11.29.08.41.44\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tWed, 29 Nov 2017 08:41:45 -0800 (PST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=ywQGXelM8cu9WcC20/xaCoB0QEIpo4uOC6enEQqIrU0=;\n\tb=a46of1KFRDfoN3tKWCkfzVWqob4qwyDPBDZMQ0V6qsJ+duLP2hjxH9qJYltIiFVKJx\n\tVCX3ca0rP3RuXcJh4kWRqwNTZoQ5rX/jt8nupGtwrwIHPwEmLVIkh5w6GaYCJfq0EZeg\n\tw1rFQkRT7C8dKatXmv0kLbhE3IrhAxZ1is9Rs=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=ywQGXelM8cu9WcC20/xaCoB0QEIpo4uOC6enEQqIrU0=;\n\tb=syuTg+i8YwOvOOaHEYYyOui3IliaU+OU+SCHNC8Op3FmruGhQ05qz+sTd41Rr8FI8Y\n\tYanXjbx9oPnW0dHVGLBmXZRUsK1HxitG13hgIqWDlYTEEhO3DIbWP5oRZCdMqCEMnQTl\n\t+lBe+EQNb40BwDg8Gp1ndRHb5DiO783vyfkT/Xs2k/+9tC5hs19+R163G8zLSlgq+3mo\n\tXfGxWCPKjL5pZ1k0qsa2/sPJcPWxCs9nocft4irrSY10k7Zzcxv+wi3IBt0YHUsiYL/R\n\tDJZiQKvp7pGBSQKv63r93LA2uzVpuu5zQbYgFVIx+sFmPYXCYFBeykHrwX+ihwpYfhrM\n\t6icA==","X-Gm-Message-State":"AJaThX4SJ1sJ6BapoXc1xbTU1qHN9tx7+NaMWysRBzXX7hWWIoL3vKNV\n\tafDadkNJsAJt/eel6ZYaPLJDyg==","X-Google-Smtp-Source":"AGs4zMbgzH+o10zXeL/u60y+96rKQY/kNlgPwPnfc03K9+M9GKzprVWFjViGTeJHZTf0jJSvj52d3g==","X-Received":"by 10.223.138.182 with SMTP id y51mr3255350wry.273.1511973706566;\n\tWed, 29 Nov 2017 08:41:46 -0800 (PST)","From":"Christoffer Dall <christoffer.dall@linaro.org>","To":"kvm@vger.kernel.org","Cc":"Andrew Jones <drjones@redhat.com>, Christoffer Dall\n\t<christoffer.dall@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>,\n\t=?utf-8?b?UmFkaW0gS3LEjW3DocWZ?= <rkrcmar@redhat.com>,\n\tMarc Zyngier <marc.zyngier@arm.com>, kvmarm@lists.cs.columbia.edu,\n\tlinux-arm-kernel@lists.infradead.org, James Hogan <jhogan@kernel.org>,\n\tlinux-mips@linux-mips.org, Alexander Graf <agraf@suse.com>,\n\tkvm-ppc@vger.kernel.org, \n\tChristian Borntraeger <borntraeger@de.ibm.com>, Cornelia Huck\n\t<cohuck@redhat.com>, linux-s390@vger.kernel.org","Subject":"[PATCH v2 16/16] KVM: arm/arm64: Move vcpu_load call after\n\tkvm_vcpu_first_run_init","Date":"Wed, 29 Nov 2017 17:41:16 +0100","Message-Id":"<20171129164116.16167-17-christoffer.dall@linaro.org>","X-Mailer":"git-send-email 2.14.2","In-Reply-To":"<20171129164116.16167-1-christoffer.dall@linaro.org>","References":"<20171129164116.16167-1-christoffer.dall@linaro.org>","Sender":"kvm-ppc-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<kvm-ppc.vger.kernel.org>","X-Mailing-List":"kvm-ppc@vger.kernel.org"},"content":"Moving the call to vcpu_load() in kvm_arch_vcpu_ioctl_run() to after\nwe've called kvm_vcpu_first_run_init() simplifies some of the vgic and\nthere is also no need to do vcpu_load() for things such as handling the\nimmediate_exit flag.\n\nSigned-off-by: Christoffer Dall <christoffer.dall@linaro.org>\n---\n virt/kvm/arm/arch_timer.c     |  4 ----\n virt/kvm/arm/arm.c            | 12 +++++-------\n virt/kvm/arm/vgic/vgic-init.c | 11 -----------\n 3 files changed, 5 insertions(+), 22 deletions(-)","diff":"diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c\nindex 4151250..801fecf 100644\n--- a/virt/kvm/arm/arch_timer.c\n+++ b/virt/kvm/arm/arch_timer.c\n@@ -839,11 +839,7 @@ int kvm_timer_enable(struct kvm_vcpu *vcpu)\n \t\treturn ret;\n \n no_vgic:\n-\tpreempt_disable();\n \ttimer->enabled = 1;\n-\tkvm_timer_vcpu_load_vgic(vcpu);\n-\tpreempt_enable();\n-\n \treturn 0;\n }\n \ndiff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c\nindex a760ef1..991f1aa 100644\n--- a/virt/kvm/arm/arm.c\n+++ b/virt/kvm/arm/arm.c\n@@ -622,8 +622,6 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)\n \tif (unlikely(!kvm_vcpu_initialized(vcpu)))\n \t\treturn -ENOEXEC;\n \n-\tvcpu_load(vcpu);\n-\n \tret = kvm_vcpu_first_run_init(vcpu);\n \tif (ret)\n \t\tgoto out;\n@@ -631,13 +629,13 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)\n \tif (run->exit_reason == KVM_EXIT_MMIO) {\n \t\tret = kvm_handle_mmio_return(vcpu, vcpu->run);\n \t\tif (ret)\n-\t\t\tgoto out;\n+\t\t\treturn ret;\n \t}\n \n-\tif (run->immediate_exit) {\n-\t\tret = -EINTR;\n-\t\tgoto out;\n-\t}\n+\tif (run->immediate_exit)\n+\t\treturn -EINTR;\n+\n+\tvcpu_load(vcpu);\n \n \tif (vcpu->sigset_active)\n \t\tsigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved);\ndiff --git a/virt/kvm/arm/vgic/vgic-init.c b/virt/kvm/arm/vgic/vgic-init.c\nindex 6231012..a0688ef 100644\n--- a/virt/kvm/arm/vgic/vgic-init.c\n+++ b/virt/kvm/arm/vgic/vgic-init.c\n@@ -300,17 +300,6 @@ int vgic_init(struct kvm *kvm)\n \n \tdist->initialized = true;\n \n-\t/*\n-\t * If we're initializing GICv2 on-demand when first running the VCPU\n-\t * then we need to load the VGIC state onto the CPU.  We can detect\n-\t * this easily by checking if we are in between vcpu_load and vcpu_put\n-\t * when we just initialized the VGIC.\n-\t */\n-\tpreempt_disable();\n-\tvcpu = kvm_arm_get_running_vcpu();\n-\tif (vcpu)\n-\t\tkvm_vgic_load(vcpu);\n-\tpreempt_enable();\n out:\n \treturn ret;\n }\n","prefixes":["v2","16/16"]}