From patchwork Mon Jan 28 16:00:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 156764 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3589365jaa; Mon, 28 Jan 2019 08:02:19 -0800 (PST) X-Google-Smtp-Source: AHgI3IaUfbDXMNA8PQUkkMjMMEjYEaiRds7Hsi/kGr6VnHf7soUYMPKcknyHZ5/tzd+UE0LMaboR X-Received: by 2002:a25:4151:: with SMTP id o78mr7705490yba.458.1548691339076; Mon, 28 Jan 2019 08:02:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548691339; cv=none; d=google.com; s=arc-20160816; b=maOLJhcpGoSKN4Xz+BbHgxUwWX0zPm2f7M0nXga1VM0FR8e2twYipL+am3yik62IWM ojkvC0WlMbnoqKJ7yiMN5/CeH3jbXHcg7666RvZkvE+Cbca+WdJvXE1EctqZ2iOG2v+w pXBQR4+m3kge9KCIRltx05dG7Pv8F8r3c3QZkIwk54smTCGm3Hdh5s7L8omJirFk5Pdk hF1HQdQY+xGORk5arvrPjct4cC/Kd9OFaOTdFogfOYxyt2MHTpYaFq2CtMS4Hn7P79zM GNgTQClp9NdCrcAK3thI5yeJ3LNZ/TP2t4l7CZuKxJKDLG2YJXClwfZMT/fEXk17eA1U 0ppA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:message-id:date:to:from; bh=LFgEp0mh4NlxF858Ym3suotr5y0bNIe/sSchmwoMAMM=; b=1HUyY0DRSv2Tq//XzaVtrBL599emvOZMk42zPeOhXgabexAmhpkqNioUiCOMyROk3N DdrtAu5/CKB43cKLXd/CHGRLA09plFyMMiwbtOw+/SUNOAyZTu7R7wqeBkzCXtuPb2IV B/sLvgFLwqf+cZK0UKo2HRQXynsXHxyjj1sWmqQJo2Eehc3D3ZTzvK/3+UyoWIk6m9gk cudbD1cAwo6v0VcaKHdGnQK9P2gAvPduzAlKrPVRi20SaW+GyJGnLuRqnsWRcHxhJwYP pyxdQPJbQb4gMtReY783C3fe1kH0GM/RjWgbjc1t3NMHbgrS0Je7e01ViyjUlLkIyPUv Pdcw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id 127si10419238ybs.257.2019.01.28.08.02.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Jan 2019 08:02:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1go9Kp-0004Kj-B4; Mon, 28 Jan 2019 16:00:31 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1go9Ko-0004Ke-DX for xen-devel@lists.xenproject.org; Mon, 28 Jan 2019 16:00:30 +0000 X-Inumbo-ID: d5a52fe6-2315-11e9-8869-77f86d417f88 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id d5a52fe6-2315-11e9-8869-77f86d417f88; Mon, 28 Jan 2019 16:00:29 +0000 (UTC) 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 7D1E180D; Mon, 28 Jan 2019 08:00:29 -0800 (PST) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6D8533F589; Mon, 28 Jan 2019 08:00:28 -0800 (PST) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 28 Jan 2019 16:00:23 +0000 Message-Id: <20190128160023.14388-1-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 Subject: [Xen-devel] [PATCH for-4.12] xen/arm: irq: End cleanly spurious interrupt X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org, andrii.anisov@gmail.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" no_irq_type handlers are used when an IRQ does not have action attached. This is useful to detect misconfiguration between the interrupt controller and the software. Currently, all the handlers will do nothing on spurious interrupt. This means if such interrupt is received, the priority of the interrupt will not be dropped and the processor will lose the ability to receive any interrupt lower or equal to the priority. Spurious interrupt can happen while releasing interrupt assigned to guest (happen during domain destruction). The interaction is roughly CPU0 CPU1 release_guest_irq(A) spin_lock(&desc->lock) gic_remove_irq_from_guest receive IRQ A spin_lock(&desc->lock) desc->handler->shutdown() set_bit(IRQ_DISABLED) desc->handler = &no_irq_type spin_unlock(&desc->lock) desc->handler->end(); spin_unlock(&desc->lock) Because the no_irq_type.end callback is implemented as a NOP, CPU1 will not drop the priority of the interrupt. So the CPU will not be able to receive any interrupt route to any guest afterwards. The problem can be prevented by dropping the priority and deactivating the interrupt via gic_hw_ops->gic_host_irq->end(). Note that, for now, interrupt used by Xen are safe because it is not using no_irq_type on release. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- xen/arch/arm/irq.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c index 4a02cc1eba..c51cf333ce 100644 --- a/xen/arch/arm/irq.c +++ b/xen/arch/arm/irq.c @@ -44,7 +44,14 @@ static void ack_none(struct irq_desc *irq) printk("unexpected IRQ trap at irq %02x\n", irq->irq); } -static void end_none(struct irq_desc *irq) { } +static void end_none(struct irq_desc *irq) +{ + /* + * Still allow a CPU to end an interrupt if we receive a spurious + * interrupt. This will prevent the CPU to lose interrupt forever. + */ + gic_hw_ops->gic_host_irq_type->end(irq); +} hw_irq_controller no_irq_type = { .typename = "none",