From patchwork Tue Dec 9 11:26:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 42046 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 25813244AC for ; Tue, 9 Dec 2014 11:44:17 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id bs8sf614367wib.6 for ; Tue, 09 Dec 2014 03:44:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list; bh=sIWjw7lcOjYOTtC0GOuKEGy+xv7Avl3M6bisU/r6JYU=; b=WhiYJQQJ7EePZ5xZYG0Y+4F8exrZfAYCk3hWhheBHdd/fWr4NRTHRArMj+K3jJ98lg grYH3x+lN5rDF2UMv2IgxVYzsgl7+4cvDfvn+oROjj35jwv/lxkAVB3MSuib5fyfkjs8 lCXtq63/axd3ky0Qw03Pk8WdAG2AeSvX4P0HiMabEdVfGzw1PkxSRLJ5ukqwIT/DIpZO O1QdyLVTJ0H8Enn52uKWns7aUGLsy/yfM4DxOzO4NOLHYnwwaNUS29DnVxv4Ad5VKlzU Rz8SXzRmApuPGOVuNOOAqawgEr1eVbnhGxa0ZFR36bN+L67kL2wvGAtJOkEIouYWnFvc W1Ww== X-Gm-Message-State: ALoCoQnEsX0GdccmYB1niJbtjFi0anZkn/Jt2mcgg/q5ykkg7UQW2QchcWEh/+LGk1qLkj/bvEbE X-Received: by 10.112.130.8 with SMTP id oa8mr329243lbb.11.1418125456408; Tue, 09 Dec 2014 03:44:16 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.1.136 with SMTP id 8ls24322lam.55.gmail; Tue, 09 Dec 2014 03:44:15 -0800 (PST) X-Received: by 10.152.21.227 with SMTP id y3mr21611059lae.50.1418125455877; Tue, 09 Dec 2014 03:44:15 -0800 (PST) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id h10si1011671lbs.121.2014.12.09.03.44.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 09 Dec 2014 03:44:15 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by mail-la0-f54.google.com with SMTP id pv20so345818lab.13 for ; Tue, 09 Dec 2014 03:44:15 -0800 (PST) X-Received: by 10.153.7.170 with SMTP id dd10mr21142108lad.44.1418125455763; Tue, 09 Dec 2014 03:44:15 -0800 (PST) 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.112.184.201 with SMTP id ew9csp739772lbc; Tue, 9 Dec 2014 03:44:14 -0800 (PST) X-Received: by 10.70.35.207 with SMTP id k15mr29501838pdj.166.1418125454170; Tue, 09 Dec 2014 03:44:14 -0800 (PST) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id ee16si1295090pad.228.2014.12.09.03.44.13 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Dec 2014 03:44:14 -0800 (PST) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XyJ7R-0007HD-R7; Tue, 09 Dec 2014 11:38:17 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XyIvW-00057D-CR for linux-arm-kernel@bombadil.infradead.org; Tue, 09 Dec 2014 11:25:58 +0000 Received: from mail-lb0-f177.google.com ([209.85.217.177]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XyIvU-0003xz-Uu for linux-arm-kernel@lists.infradead.org; Tue, 09 Dec 2014 11:25:57 +0000 Received: by mail-lb0-f177.google.com with SMTP id b6so299816lbj.36 for ; Tue, 09 Dec 2014 03:25:34 -0800 (PST) X-Received: by 10.152.37.38 with SMTP id v6mr21695402laj.10.1418124334143; Tue, 09 Dec 2014 03:25:34 -0800 (PST) Received: from localhost.localdomain (188-178-240-98-static.dk.customer.tdc.net. [188.178.240.98]) by mx.google.com with ESMTPSA id w3sm279709law.36.2014.12.09.03.25.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 Dec 2014 03:25:33 -0800 (PST) From: Christoffer Dall To: Paolo Bonzini , kvm@vger.kernel.org Subject: [GIT PULL 9/9] arm/arm64: KVM: vgic: kick the specific vcpu instead of iterating through all Date: Tue, 9 Dec 2014 12:26:08 +0100 Message-Id: <1418124368-28418-10-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.1.2.330.g565301e.dirty In-Reply-To: <1418124368-28418-1-git-send-email-christoffer.dall@linaro.org> References: <1418124368-28418-1-git-send-email-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141209_062557_144226_30BA5C18 X-CRM114-Status: GOOD ( 13.08 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.0 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.217.177 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.217.177 listed in wl.mailspike.net] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: Marc Zyngier , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, Shannon Zhao X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: christoffer.dall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 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 From: Shannon Zhao When call kvm_vgic_inject_irq to inject interrupt, we can known which vcpu the interrupt for by the irq_num and the cpuid. So we should just kick this vcpu to avoid iterating through all. Reviewed-by: Christoffer Dall Signed-off-by: Shannon Zhao Signed-off-by: Marc Zyngier --- virt/kvm/arm/vgic.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c index 631a472..21e035c 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c @@ -1607,7 +1607,7 @@ static int vgic_validate_injection(struct kvm_vcpu *vcpu, int irq, int level) } } -static bool vgic_update_irq_pending(struct kvm *kvm, int cpuid, +static int vgic_update_irq_pending(struct kvm *kvm, int cpuid, unsigned int irq_num, bool level) { struct vgic_dist *dist = &kvm->arch.vgic; @@ -1673,7 +1673,7 @@ static bool vgic_update_irq_pending(struct kvm *kvm, int cpuid, out: spin_unlock(&dist->lock); - return ret; + return ret ? cpuid : -EINVAL; } /** @@ -1693,9 +1693,14 @@ out: int kvm_vgic_inject_irq(struct kvm *kvm, int cpuid, unsigned int irq_num, bool level) { - if (likely(vgic_initialized(kvm)) && - vgic_update_irq_pending(kvm, cpuid, irq_num, level)) - vgic_kick_vcpus(kvm); + int vcpu_id; + + if (likely(vgic_initialized(kvm))) { + vcpu_id = vgic_update_irq_pending(kvm, cpuid, irq_num, level); + if (vcpu_id >= 0) + /* kick the specified vcpu */ + kvm_vcpu_kick(kvm_get_vcpu(kvm, vcpu_id)); + } return 0; }