Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3028435pxb; Mon, 18 Oct 2021 06:55:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXYtn8+EX2IRndN49liKK0I7IB5FFen2sHT8oxM8e06BF6Rdwh/7K+wtAnVSpIPnh8dFtU X-Received: by 2002:a62:7bd5:0:b0:44c:72f5:5da4 with SMTP id w204-20020a627bd5000000b0044c72f55da4mr29084051pfc.48.1634565320805; Mon, 18 Oct 2021 06:55:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634565320; cv=none; d=google.com; s=arc-20160816; b=tihid/o+a4yDa902dbhtJ/ktc4UNcAWf+afMQcKBtYiGCrjNFOI4zD9WrC0CtYy9wv iMWV+JPfMTiyUh838F0Vbb2wD4TvQ6icLbSd4x/dYBxGHIXrw9HVKFcrDsS9uRiZjFj/ G6MFRX2Hc62CJ6DT6PLlJHm+5vXhEPXYWUPtha9Hz4CF/U5T9Rrd4ncQiclT0JKXBpNV xpvnZX0n7eGSJvKJtH115shduAeG5uXU5l8L2oqJy33/pMRgRLd+Dkz512tiP4GR7uUx HOrVcAdBkeZp5RIfP0S0Sj8D99awyNckq3lkdj+R5sl4hsqDpy/QZ9FDWyc+/0xwUYzw A+EA== 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=69VW+GFj0T//Ddt6VZYD/dgOVkwAffwNF1I5HvN7dWc=; b=VeOYQSouuIXYiXwEHGmfhFJHcUn9gy6NbhpEORUOueCdhEm9N1H9R9ZxFJ3gqdJZbK X4Hl1zhh/zRfG90nhyIkSchAZZILu2pgDwAfXbsPE7X8T6npaVLo+9Lw9GA1TfQIHoYS aRF5EFS/eXrZ1rJU+7RL2yuhUxgOoNtTJEZvIXfS3kwU4+wRqmnHcXceDVMgdwDTzIzt Sc0o4xxgfeV8V4tPfJgmpcMzCIKC6fSkI29j6YK0VZ7GSibNYx+YBzEl079ysKXPjEoO GhaOF33T157L4i5q+sODySWtnMzT55dLdhCKIXoJOT3plGplA2CDHqrAMn5gFTua7wYd XR8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qMKfN2BJ; 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 p23si21356001plr.150.2021.10.18.06.55.07; Mon, 18 Oct 2021 06:55:20 -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=qMKfN2BJ; 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 S233568AbhJRN4V (ORCPT + 99 others); Mon, 18 Oct 2021 09:56:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:59060 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233225AbhJRNyW (ORCPT ); Mon, 18 Oct 2021 09:54:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 78501619F7; Mon, 18 Oct 2021 13:39:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634564374; bh=WUToi0B3sSaWILZhtHmLE1G57ibSBLBDzki7Sb5bdRk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qMKfN2BJZO8aPEPPYNBDuVIcNzXV376g7Ytz9NL+4vDGVD/hwUw19RzphqWnozajU Iv996lltqtI1dnSUlYtsmJZJk7Q0GVCjP//urkG/FpVxmHxsZcclKcS/yLWejb8+3R CRWn1tMY6RtHl85LdKPGL4tfxv9OhHWE6/u4jFXo= 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.14 064/151] powerpc/xive: Discard disabled interrupts in get_irqchip_state() Date: Mon, 18 Oct 2021 15:24:03 +0200 Message-Id: <20211018132342.776100582@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211018132340.682786018@linuxfoundation.org> References: <20211018132340.682786018@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 @@ -961,7 +961,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;