From patchwork Tue Oct 20 16:19:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 55320 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by patches.linaro.org (Postfix) with ESMTPS id E152223024 for ; Tue, 20 Oct 2015 16:21:19 +0000 (UTC) Received: by wikv3 with SMTP id v3sf11354732wik.1 for ; Tue, 20 Oct 2015 09:21:19 -0700 (PDT) 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:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:cc:mime-version :content-type:content-transfer-encoding:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list; bh=DdKX0XVqBS/k/oA2aQR2TsgD3c1alpzeXRQ/soIcZCs=; b=eZ3q+eRtDWmNNTnngJH8ZaWr59xyToIkFX6h6704s1DdJb2oyNB4hFECrWMEKI4PsX Pd0W8C31t0l6/OmIHo5s127cPO4OfOeUCdF0G8OCmR60Or/v7koN+aCrbARIc6MplbW8 gmCg4xtb0K+J7j7gx+l2UN/ep1BIcqG2oVNyXI3UPv6+ucZufsc053pTTLI1bGsFGrhI nMRsu31rYUhPCs/ygBqlgNVJ+5/mZ9j80Uv+BygcBppvKXIiw3Y9sd5Mf8lSJJhMk9ov 8Yoe/0EHtNeCYnm2/IDZcvKMA9Wp3ygmBkH3cm3ZoJ5QkNJVghgu1Jaq4h3IM0bEpFt4 Lb1Q== X-Gm-Message-State: ALoCoQlqN22eVu5puNGfMtTy8bGh7O0Gz46xss7EQ9SPmYGL7LX/X7RGBUw4YJCEqcYlSpV110v7 X-Received: by 10.180.206.13 with SMTP id lk13mr172998wic.1.1445358079261; Tue, 20 Oct 2015 09:21:19 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.169.198 with SMTP id s189ls84852lfe.87.gmail; Tue, 20 Oct 2015 09:21:19 -0700 (PDT) X-Received: by 10.25.80.77 with SMTP id e74mr1542283lfb.11.1445358079113; Tue, 20 Oct 2015 09:21:19 -0700 (PDT) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPS id pt5si2856994lbb.128.2015.10.20.09.21.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Oct 2015 09:21:19 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by lbcao8 with SMTP id ao8so19208131lbc.3 for ; Tue, 20 Oct 2015 09:21:19 -0700 (PDT) X-Received: by 10.112.135.9 with SMTP id po9mr2502171lbb.56.1445358078954; Tue, 20 Oct 2015 09:21:18 -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.112.59.35 with SMTP id w3csp2179648lbq; Tue, 20 Oct 2015 09:21:18 -0700 (PDT) X-Received: by 10.182.29.99 with SMTP id j3mr2539020obh.1.1445358078004; Tue, 20 Oct 2015 09:21:18 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id t66si2377122oib.60.2015.10.20.09.21.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Oct 2015 09:21:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) 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 1ZoZcr-0000gn-PC; Tue, 20 Oct 2015 16:19:01 +0000 Received: from mail-lf0-f43.google.com ([209.85.215.43]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZoZcp-0000Vx-5O for linux-arm-kernel@lists.infradead.org; Tue, 20 Oct 2015 16:19:00 +0000 Received: by lffz202 with SMTP id z202so8459940lff.3 for ; Tue, 20 Oct 2015 09:18:38 -0700 (PDT) X-Received: by 10.25.155.71 with SMTP id d68mr1602482lfe.55.1445357918065; Tue, 20 Oct 2015 09:18:38 -0700 (PDT) Received: from localhost.localdomain (0187900153.0.fullrate.dk. [2.110.55.193]) by smtp.gmail.com with ESMTPSA id t188sm644170lfe.33.2015.10.20.09.18.36 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Oct 2015 09:18:37 -0700 (PDT) From: Christoffer Dall To: Paolo Bonzini , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [GIT PULL 1/6] KVM: arm/arm64: Do not inject spurious interrupts Date: Tue, 20 Oct 2015 18:19:02 +0200 Message-Id: <1445357947-6022-2-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.1.2.330.g565301e.dirty In-Reply-To: <1445357947-6022-1-git-send-email-christoffer.dall@linaro.org> References: <1445357947-6022-1-git-send-email-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151020_091859_441189_DD3EFB3A X-CRM114-Status: GOOD ( 14.55 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.215.43 listed in wl.mailspike.net] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.215.43 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Cc: Marc Zyngier , Pavel Fedin , Christoffer Dall 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.217.180 as permitted sender) smtp.mailfrom=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: Pavel Fedin When lowering a level-triggered line from userspace, we forgot to lower the pending bit on the emulated CPU interface and we also did not re-compute the pending_on_cpu bitmap for the CPU affected by the change. Update vgic_update_irq_pending() to fix the two issues above and also raise a warning in vgic_quue_irq_to_lr if we encounter an interrupt pending on a CPU which is neither marked active nor pending. [ Commit text reworked completely - Christoffer ] Signed-off-by: Pavel Fedin Signed-off-by: Christoffer Dall --- virt/kvm/arm/vgic.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c index 6bd1c9b..596455a 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c @@ -1132,7 +1132,8 @@ static void vgic_queue_irq_to_lr(struct kvm_vcpu *vcpu, int irq, kvm_debug("Set active, clear distributor: 0x%x\n", vlr.state); vgic_irq_clear_active(vcpu, irq); vgic_update_state(vcpu->kvm); - } else if (vgic_dist_irq_is_pending(vcpu, irq)) { + } else { + WARN_ON(!vgic_dist_irq_is_pending(vcpu, irq)); vlr.state |= LR_STATE_PENDING; kvm_debug("Set pending: 0x%x\n", vlr.state); } @@ -1607,8 +1608,12 @@ static int vgic_update_irq_pending(struct kvm *kvm, int cpuid, } else { if (level_triggered) { vgic_dist_irq_clear_level(vcpu, irq_num); - if (!vgic_dist_irq_soft_pend(vcpu, irq_num)) + if (!vgic_dist_irq_soft_pend(vcpu, irq_num)) { vgic_dist_irq_clear_pending(vcpu, irq_num); + vgic_cpu_irq_clear(vcpu, irq_num); + if (!compute_pending_for_cpu(vcpu)) + clear_bit(cpuid, dist->irq_pending_on_cpu); + } } ret = false;