Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3015254pxb; Mon, 18 Oct 2021 06:38:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwO1RUJwZi7GZLOsfzvvttCeEdycWBN+d0faLHNEjcYBDl5tgbdSqiiUwYw0W8rATOTH1ZQ X-Received: by 2002:a17:90b:3852:: with SMTP id nl18mr47568982pjb.9.1634564332071; Mon, 18 Oct 2021 06:38:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634564332; cv=none; d=google.com; s=arc-20160816; b=iU34FdFtHRzyDsjkLjo7ul2G6YkwHgNuA2vL79oMDS6ulXum5zIgQmehIf/zDTu+pL y+z1cFywQr6ImI9tmOJ6/VISKVL0nRAfgLRhtmxF4nuf8zfCv34UnPZkvaEDqvJC/ddv O4HFVQK79pDhndc8iy20oTDoA8f1fHXGkEzVZFu/HKG2Dxe4ttVQvXMiICBlJwpU1qaO Md8FR2eed05rxMc7x8HWpdNntnmFNsc05GVEPqLSHa/O2jRsH012KOeuQlhJE47Fnc7d mYwsKSuRoVkUKwcr3uf+emRuIWh4zvvCP/M8wfKTi1BxWRutI62kvdNkUOIMLKSeumeM zgXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KvT+93NXcMTP7PWXSE0cNdsbbIpKMvlxf5l57FlEhGY=; b=ZBeMljBjYExPueJ1TuLDAyyZkDTThZEy+OfIGELQg+zq1Gt9IAx2/nYjEg233WAf3z oNGoWubIPbcxCgIveHXSygPGMcHqAOdzdpLIdfjK4ULMn68mKKf998PCUglz3kKCpNjU fQE3TUBWzTxdWORE1wvvSLbWCyq0rfdAHbwYZiDlOfpM93giAm3nVgoMUNnGjZz6D1jw afrrqI/Tk6sDkcKJomI8dqKtpxEIx4CLgkhshdEbBpp+dkbv3L39GOiV9IdkxV1CW1tl HldSpdI7d6M01EPuKY/unHfob7/RNSHxF5q6g+q3hjYqiXTEvVFiShgTO8M0Ne5+BYN7 dEdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fdDToULN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w9si23249318pfu.292.2021.10.18.06.38.38; Mon, 18 Oct 2021 06:38:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fdDToULN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233178AbhJRNiB (ORCPT + 99 others); Mon, 18 Oct 2021 09:38:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:54250 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233181AbhJRNfo (ORCPT ); Mon, 18 Oct 2021 09:35:44 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6F6786135A; Mon, 18 Oct 2021 13:30:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634563846; bh=ZxcjFqWZXvFV9igIuOLE3hl8vv0O9cCZ+0IFLBuu5F4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fdDToULNl9Uon/egTa19xph5wtXxuE7nLUxTNcWIqtLi9YqmnJDmGUYmRSeGyNn87 lzwyBrQ8YJM4JvGfXlQ/cSCjFQ3/YYAgNALG7S96IDdXH+RTYwK+6bJyIqU3Jvg2VD 9UtTuGYDZFRbVxhJVLNCKh3VlEbc9YdNbFdmXV34= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , seeteena , Michael Ellerman Subject: [PATCH 5.4 37/69] powerpc/xive: Discard disabled interrupts in get_irqchip_state() Date: Mon, 18 Oct 2021 15:24:35 +0200 Message-Id: <20211018132330.707750916@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211018132329.453964125@linuxfoundation.org> References: <20211018132329.453964125@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Cédric Le Goater commit 6f779e1d359b8d5801f677c1d49dcfa10bf95674 upstream. When an interrupt is passed through, the KVM XIVE device calls the set_vcpu_affinity() handler which raises the P bit to mask the interrupt and to catch any in-flight interrupts while routing the interrupt to the guest. On the guest side, drivers (like some Intels) can request at probe time some MSIs and call synchronize_irq() to check that there are no in flight interrupts. This will call the XIVE get_irqchip_state() handler which will always return true as the interrupt P bit has been set on the host side and lock the CPU in an infinite loop. Fix that by discarding disabled interrupts in get_irqchip_state(). Fixes: da15c03b047d ("powerpc/xive: Implement get_irqchip_state method for XIVE to fix shutdown race") Cc: stable@vger.kernel.org #v5.4+ Signed-off-by: Cédric Le Goater Tested-by: seeteena Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20211011070203.99726-1-clg@kaod.org Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/sysdev/xive/common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/arch/powerpc/sysdev/xive/common.c +++ b/arch/powerpc/sysdev/xive/common.c @@ -990,7 +990,8 @@ static int xive_get_irqchip_state(struct * interrupt to be inactive in that case. */ *state = (pq != XIVE_ESB_INVALID) && !xd->stale_p && - (xd->saved_p || !!(pq & XIVE_ESB_VAL_P)); + (xd->saved_p || (!!(pq & XIVE_ESB_VAL_P) && + !irqd_irq_disabled(data))); return 0; default: return -EINVAL;