From patchwork Fri Jul 21 20:00:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 9857607 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 9FFBE601C0 for ; Fri, 21 Jul 2017 20:02:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 925F128636 for ; Fri, 21 Jul 2017 20:02:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 877E42864A; Fri, 21 Jul 2017 20:02:27 +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, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3E98628636 for ; Fri, 21 Jul 2017 20:02:27 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dYe5u-0005Dw-Ty; Fri, 21 Jul 2017 20:00:14 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dYe5t-000579-Fg for xen-devel@lists.xenproject.org; Fri, 21 Jul 2017 20:00:13 +0000 Received: from [85.158.139.211] by server-2.bemta-5.messagelabs.com id 81/67-01996-D4D52795; Fri, 21 Jul 2017 20:00:13 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrELMWRWlGSWpSXmKPExsVysyfVTdcntij S4MQzdYvvWyYzOTB6HP5whSWAMYo1My8pvyKBNWPdx4NsBY85Kq7MX8/ewPiYrYuRi0NIYDOj xP6Xh9ghnOWMElc+zWPsYuTkYBPQldhx8zUziC0iECrxdMF3MJtZQEli/9lrYDXCAlESF89dB 4uzCKhKrPz6kAXE5hWwkVjx+h9YjYSAnETD+ftgNZwg8ctP2EBsIQFriebFU1kmMHIvYGRYxa henFpUllqka66XVJSZnlGSm5iZo2toYKqXm1pcnJiempOYVKyXnJ+7iRHoXwYg2MF4bLLzIUZ JDiYlUV5Nq6JIIb6k/JTKjMTijPii0pzU4kOMMhwcShK8S6KBcoJFqempFWmZOcBAg0lLcPAo ifCKxACleYsLEnOLM9MhUqcYdTleTfj/jUmIJS8/L1VKnPcdyAwBkKKM0jy4EbCgv8QoKyXMy wh0lBBPQWpRbmYJqvwrRnEORiVh3gaQKTyZeSVwm14BHcEEdMQjtwKQI0oSEVJSDYwS+9QFH9 fWJFQeZ70p+Wrno/OreB+dbt9p0MIstq3rqa2A4rtJHtmLF7wO2i72KM7zZ9gWaTkz5xv+Yr6 7fPV3enm/byur/l3wNjkgmKtn8c84xj+7Fxxw6Kqamdqj+n9i1CWXiM7fx8pc/m87sjSBz/nD 2RkLZv6p/Xxs1oKzf4Lnft57RK5RiaU4I9FQi7moOBEApgMYPnUCAAA= X-Env-Sender: andre.przywara@arm.com X-Msg-Ref: server-14.tower-206.messagelabs.com!1500667212!65151720!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 50469 invoked from network); 21 Jul 2017 20:00:12 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-14.tower-206.messagelabs.com with SMTP; 21 Jul 2017 20:00:12 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D6E091596; Fri, 21 Jul 2017 13:00:11 -0700 (PDT) Received: from e104803-lin.lan (unknown [10.1.207.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 195EC3F3E1; Fri, 21 Jul 2017 13:00:10 -0700 (PDT) From: Andre Przywara To: Julien Grall , Stefano Stabellini Date: Fri, 21 Jul 2017 21:00:00 +0100 Message-Id: <20170721200010.29010-13-andre.przywara@arm.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170721200010.29010-1-andre.przywara@arm.com> References: <20170721200010.29010-1-andre.przywara@arm.com> Cc: xen-devel@lists.xenproject.org Subject: [Xen-devel] [RFC PATCH v2 12/22] ARM: vGIC: protect gic_update_one_lr() with pending_irq lock X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP When we return from a domain with the active bit set in an LR, we update our pending_irq accordingly. This touches multiple status bits, so requires the pending_irq lock. Signed-off-by: Andre Przywara --- xen/arch/arm/gic.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index 9637682..84b282b 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -508,6 +508,7 @@ void gic_update_one_lr(struct vcpu *v, int i) if ( lr_val.state & GICH_LR_ACTIVE ) { + vgic_irq_lock(p, flags); set_bit(GIC_IRQ_GUEST_ACTIVE, &p->status); if ( test_bit(GIC_IRQ_GUEST_ENABLED, &p->status) && test_and_clear_bit(GIC_IRQ_GUEST_QUEUED, &p->status) ) @@ -521,6 +522,7 @@ void gic_update_one_lr(struct vcpu *v, int i) gdprintk(XENLOG_WARNING, "unable to inject hw irq=%d into d%dv%d: already active in LR%d\n", irq, v->domain->domain_id, v->vcpu_id, i); } + vgic_irq_unlock(p, flags); } else if ( lr_val.state & GICH_LR_PENDING ) {