Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3125229pxb; Fri, 12 Feb 2021 09:46:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJx9FYyOsGz/RoDU81JrYsCrUmINBR0uB2laHbjrVwNXek2Z/2X9JnZDcQY2rI4bhrnrJyYt X-Received: by 2002:a17:906:f259:: with SMTP id gy25mr4207568ejb.330.1613151963391; Fri, 12 Feb 2021 09:46:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613151963; cv=none; d=google.com; s=arc-20160816; b=1G2Ajd2EgNy7sJEd6X2hrcWuZECIUdrWMNWerfpaOklPC1XaQ0wOyKOcV3G1S8WVPi W7zxmRVF/B9FX3iXzt+Sa4Q5BMZR2eJGzgwe4yIZw2GwxB+KgQrhXMJVNfwt6cqUa/7i QJ2NwbSgZOm9nqSiXqx4LB3/YUxXbnrfsl7sC/Wf4a7bsVHTXwuJlEOlC+akyjtQ/h3v wpc0o1cRziF3yyHJW6z+WcpEvg1KXXBQojhOKHO8IO1PRvIFsO04n/72pgHIKlbEOK91 b3SLyLJnrmgEWa+eFWHKCHejrwz6utn24GcKbpS2gvNbT4BtqeSSku6cfPTVFvQI3dml s03w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=ZIs/19ySTa/aizk8SRl/ljbA64VnBQulHBv7kEuZSkc=; b=Bk2p9r5Mvru+5MF5jiuAd6M6hIb4EaOmjYQfcYCB18bZSdVCMmXMaW1fnqIG6lkxWb bNfReANm8O99T0Fj1ekfbrP97eogHicbWc6g51ruio3Ak13HJ7//r6sSDT2SQRhwlbbr 5etrJ/88rRfTrnVIVyWlOqHHhhq+1ORredFINiNrOijeMyog9kd6eh79z2rwFrUKxD85 YsCruOjVSUvOjvm5MAEAXV7b2K8MfjBGE1XrFOR6U7u0kwDAX+lQYcsl2MKAhShl0UCr And97+PLjOblLSYwhtd4vpAXtRqqiQGIdyOre2kW1OhKENrK6pds5JHbZFgohoSBULq2 OA7w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bw26si6534096ejb.644.2021.02.12.09.45.37; Fri, 12 Feb 2021 09:46:03 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231524AbhBLRpG (ORCPT + 99 others); Fri, 12 Feb 2021 12:45:06 -0500 Received: from 6.mo52.mail-out.ovh.net ([188.165.49.222]:53797 "EHLO 6.mo52.mail-out.ovh.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231735AbhBLRox (ORCPT ); Fri, 12 Feb 2021 12:44:53 -0500 Received: from mxplan5.mail.ovh.net (unknown [10.108.20.2]) by mo52.mail-out.ovh.net (Postfix) with ESMTPS id 88BEB2417B3; Fri, 12 Feb 2021 18:27:10 +0100 (CET) Received: from kaod.org (37.59.142.99) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Fri, 12 Feb 2021 18:27:09 +0100 Authentication-Results: garm.ovh; auth=pass (GARM-99G003458b0af4-a908-4155-a8a5-638fe7ab923e, 924A9ABFE736D7433D2D31E3EEE0F14BF3EF610E) smtp.auth=clg@kaod.org X-OVh-ClientIp: 90.55.29.191 Subject: Re: [PATCH] powerpc/pseries: Don't enforce MSI affinity with kdump To: Greg Kurz , Michael Ellerman CC: , , , References: <20210212164132.821332-1-groug@kaod.org> From: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= Message-ID: Date: Fri, 12 Feb 2021 18:27:08 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20210212164132.821332-1-groug@kaod.org> Content-Type: text/plain; charset="windows-1252" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [37.59.142.99] X-ClientProxiedBy: DAG7EX2.mxp5.local (172.16.2.62) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: b152fbe0-3c72-4360-bb9e-8bb5cbdf721d X-Ovh-Tracer-Id: 13433674741941046054 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduledriedugddutdefucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefuvfhfhffkffgfgggjtgfgihesthekredttdefheenucfhrhhomhepveorughrihgtpgfnvggpifhorghtvghruceotghlgheskhgrohgurdhorhhgqeenucggtffrrghtthgvrhhnpeeglefgjeevheeifeffudeuhedvveeftdeliedukeejgeeviefgieefhfdtffeftdenucfkpheptddrtddrtddrtddpfeejrdehledrudegvddrleelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhpqdhouhhtpdhhvghlohepmhigphhlrghnhedrmhgrihhlrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopehgrhhouhhgsehkrghougdrohhrgh Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/12/21 5:41 PM, Greg Kurz wrote: > 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: lvivier@redhat.com > Cc: stable@vger.kernel.org > Signed-off-by: Greg Kurz Reviewed-by: C?dric Le Goater Thanks for tracking this issue. This layer needs a rework. Patches adding a MSI domain should be ready in a couple of releases. Hopefully. C. > --- > arch/powerpc/platforms/pseries/msi.c | 24 ++++++++++++++++++++++-- > 1 file changed, 22 insertions(+), 2 deletions(-) > > diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c > index b3ac2455faad..29d04b83288d 100644 > --- a/arch/powerpc/platforms/pseries/msi.c > +++ b/arch/powerpc/platforms/pseries/msi.c > @@ -458,8 +458,28 @@ static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec_in, int type) > 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); >