Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3320012pxf; Mon, 15 Mar 2021 07:05:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzoVL592B86o5BHp2Uw29DEUlwmMzyM+WrAkHhD/74+MdwNECb5SayKidxEz3GBHfUfNhHO X-Received: by 2002:a17:907:3d8d:: with SMTP id he13mr3603142ejc.530.1615817101066; Mon, 15 Mar 2021 07:05:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615817101; cv=none; d=google.com; s=arc-20160816; b=qrVgoC3nQjHnvciu7ZNnrXuZt3WZyQE3HApfBHBLeMnQyJPMbgt1gDZirkorMjJ4mE HEaAZnxgQARHGsOSfr7CuPFrVOm6kDhaOxOID4o5bEH5Qc2BfFkawBadFD89D++zux9g bbd7HCyHf7q87tLBbwTG5Br91/2+ZqOQ4E+GvmF/g5xH4MC40I1cxH53DfKU3KD+F8o2 /DfLVrxuTc8wtNrIJI1vjFuqK5lDBSuR2d6BCc+PZsrcr+zfIY28P23fS0RA/eX9rLTF sCGzYSIpLaII2il830MX1PY/EaToqL2IOqYJQi4HmLusNA0pyvfD56hJwL+9HgOkdhZx Yhmg== 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=ICujKriktaXZ4orzlJOb8gWXQ02G8GLJ5TA1wbmnVqA=; b=CHJEyFJEtsZBM9/fntSdl3q8wow9CF/bWq2yI1OaBL4rqudIcNDqEBTwdv2lLhUxbj WWMCYjN7ybarO0+CxxHm/80KTS+Z/YZj2HoBTtHscfuv1LS4fPUuk3PQJV0kz1xA9FRU y8V+WwQ1XMX6LFwBAG3DS3EMusCOysgT9Hf0y/vRhMxZ8mOaI6koEvRgYUeu1g7vFW43 3X/z96QwvHLanrw2Rqlzvi0F2i7ZeBHIhXBeL0AsR8MmX0lxlnhMKI/cbhku1tXxfLAf /27t+21n011LUFuGBI8BCDkEff7fJ9b/ym9kBdaMV6V6fiHwzfhYcB+iBrIFVqK67AbL ue5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="qJj/dget"; 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 de4si11183577ejc.539.2021.03.15.07.04.38; Mon, 15 Mar 2021 07:05:01 -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="qJj/dget"; 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 S233608AbhCOOCJ (ORCPT + 99 others); Mon, 15 Mar 2021 10:02:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:33286 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231489AbhCON4t (ORCPT ); Mon, 15 Mar 2021 09:56:49 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2633D64EED; Mon, 15 Mar 2021 13:56:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816608; bh=lQqZ31p/1FjojljzydhEX/AOh6vMwibdy62aoftNbNg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qJj/dgetBi+hYNmdRcXoLvgVS5ezIgd0+IuLr0H5wezQ09WBTxT/T3yxef2hDT7fL F4bPHF689BN4n0ee82LWCk8QZrgeleii2alC+Tl05QQ8yO+L8CG613JkdnQQ6AuDey wOPRGm/a26rOuutliJA0Kw5n6ZaLh76gkJDUDw3o= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Greg Kurz , Laurent Vivier , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Michael Ellerman Subject: [PATCH 5.4 002/168] powerpc/pseries: Dont enforce MSI affinity with kdump Date: Mon, 15 Mar 2021 14:53:54 +0100 Message-Id: <20210315135550.414757224@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135550.333963635@linuxfoundation.org> References: <20210315135550.333963635@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: Greg Kroah-Hartman From: Greg Kurz commit f9619d5e5174867536b7e558683bc4408eab833f upstream. Depending on the number of online CPUs in the original kernel, it is likely for CPU #0 to be offline in a kdump kernel. The associated IRQs in the affinity mappings provided by irq_create_affinity_masks() are thus not started by irq_startup(), as per-design with managed IRQs. This can be a problem with multi-queue block devices driven by blk-mq : such a non-started IRQ is very likely paired with the single queue enforced by blk-mq during kdump (see blk_mq_alloc_tag_set()). This causes the device to remain silent and likely hangs the guest at some point. This is a regression caused by commit 9ea69a55b3b9 ("powerpc/pseries: Pass MSI affinity to irq_create_mapping()"). Note that this only happens with the XIVE interrupt controller because XICS has a workaround to bypass affinity, which is activated during kdump with the "noirqdistrib" kernel parameter. The issue comes from a combination of factors: - discrepancy between the number of queues detected by the multi-queue block driver, that was used to create the MSI vectors, and the single queue mode enforced later on by blk-mq because of kdump (i.e. keeping all queues fixes the issue) - CPU#0 offline (i.e. kdump always succeed with CPU#0) Given that I couldn't reproduce on x86, which seems to always have CPU#0 online even during kdump, I'm not sure where this should be fixed. Hence going for another approach : fine-grained affinity is for performance and we don't really care about that during kdump. Simply revert to the previous working behavior of ignoring affinity masks in this case only. Fixes: 9ea69a55b3b9 ("powerpc/pseries: Pass MSI affinity to irq_create_mapping()") Cc: stable@vger.kernel.org # v5.10+ Signed-off-by: Greg Kurz Reviewed-by: Laurent Vivier Reviewed-by: Cédric Le Goater Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20210215094506.1196119-1-groug@kaod.org Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/platforms/pseries/msi.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) --- a/arch/powerpc/platforms/pseries/msi.c +++ b/arch/powerpc/platforms/pseries/msi.c @@ -4,6 +4,7 @@ * Copyright 2006-2007 Michael Ellerman, IBM Corp. */ +#include #include #include #include @@ -458,8 +459,28 @@ again: return hwirq; } - virq = irq_create_mapping_affinity(NULL, hwirq, - entry->affinity); + /* + * Depending on the number of online CPUs in the original + * kernel, it is likely for CPU #0 to be offline in a kdump + * kernel. The associated IRQs in the affinity mappings + * provided by irq_create_affinity_masks() are thus not + * started by irq_startup(), as per-design for managed IRQs. + * This can be a problem with multi-queue block devices driven + * by blk-mq : such a non-started IRQ is very likely paired + * with the single queue enforced by blk-mq during kdump (see + * blk_mq_alloc_tag_set()). This causes the device to remain + * silent and likely hangs the guest at some point. + * + * We don't really care for fine-grained affinity when doing + * kdump actually : simply ignore the pre-computed affinity + * masks in this case and let the default mask with all CPUs + * be used when creating the IRQ mappings. + */ + if (is_kdump_kernel()) + virq = irq_create_mapping(NULL, hwirq); + else + virq = irq_create_mapping_affinity(NULL, hwirq, + entry->affinity); if (!virq) { pr_debug("rtas_msi: Failed mapping hwirq %d\n", hwirq);