Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1028230pxb; Fri, 15 Apr 2022 18:52:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzuXvLDtupQqWknLPyKlMra11EVbvC4QCKltMaSUDF/q62renObMj57AJKG/G9p0/odjTDN X-Received: by 2002:a17:902:7689:b0:157:3d:a5bc with SMTP id m9-20020a170902768900b00157003da5bcmr1478010pll.25.1650073928370; Fri, 15 Apr 2022 18:52:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650073928; cv=none; d=google.com; s=arc-20160816; b=tFzJt+3l4Jeec5+SCRkhmBlIrO7oLUYi9dE93N6rMAV9W374ARNuND4malbMBPztac JpQ7FIfYrgdvJx0w8EwCMHrecQ4bltsKurVdJSRYT5fLhBVsohU7TVj+ptgk60oT7fdD +ut7CbcNcHkGlLJcC88EgCuINJp7UiHAXkKYXExiQjWxAeJUWJhrPTZLUgkdyMNXD+hN Wl7wBFNBxQvrYXYT0nBTh6EXeiulRgS1CU3hvkl30f6briAZ7A2u8pqIRVEdBYcp8lul d/Qg76mErwifDjRf7iVIMMrpan7I+uiICeTjpFhG+hOSd4V/IvMSbgfSy7mf0sfCAJZo iAkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature; bh=uuGZToauDQ8R8qhyYwiY63tTM7nB23KT6FcI//xEk7E=; b=ed9DDR0S86363dDRf0G3Vm93mKIoOCAcrXqKgUurjesWiOrE+lqOaMarBjfp+1AOHx Rrwu/Kx6jYoT28Aw1lVtl4UgjaTIYgfvkMz41YCa73UVs95/ZppLpirVxAq/6M4BLZ7b E7Sas6vVRzA3yJ8mW00IWAKd1hUKgTwWAqP4QdO+D4qgQUp0lJpE25Y1hNS7L4pp1KCz eXx+X902en6WP79Jox3wQq7U4Jq5tJCgqmGjt+Zf+yU/KPmFm4jvb8HQjNnVu6usoaCB 2aASKY2c9QxrPdob4KEQ3iEjFDcArsaOJw4p5a3ykYD3MxFsGtLlM64sz7jLVaPuVHha 9/yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XNXPm7DZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id t22-20020a656096000000b003a0771d526esi2813936pgu.705.2022.04.15.18.52.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 18:52:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XNXPm7DZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 393B59D050; Fri, 15 Apr 2022 18:13:56 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242368AbiDNKiX (ORCPT + 99 others); Thu, 14 Apr 2022 06:38:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242360AbiDNKiV (ORCPT ); Thu, 14 Apr 2022 06:38:21 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A8BB76296; Thu, 14 Apr 2022 03:35:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id CA29DCE2948; Thu, 14 Apr 2022 10:35:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41B6EC385A5; Thu, 14 Apr 2022 10:35:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649932554; bh=5W4ekAUr89UTHNOB4HovZ00A3uTOMwCJgWbJl7Yls7k=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=XNXPm7DZH7smAccG+P0ruwVfhSikYxeGq3269qBVx91ogUqErfQf/AEOEt+WujIEH 1TcPojbQBXBpa4CY80D/qMJ3wubwwWokUUIYKUrK766ZNZNL89DTC6WZBufguesg6X GKdeFJbZBevPnwwtbgT4mpsANMoYPgBMQJeSB4LPONRT3EU+08NVlqkBCaO7rQltBv aXI9llNtHCridM8Viw5jIbfrtYAItgUcBZEbGgB7xM9zAOJPTO2z5HZcRPZ/eXXvRS OdvQ3btZAOo4KEVlZYtbfGd+GuY4OOz6EmxdEQlHTmHg5+A7jObz3nKKHMUsL7Nye3 nInqJhlqqwCsw== Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1newpL-004G2w-Pf; Thu, 14 Apr 2022 11:35:51 +0100 Date: Thu, 14 Apr 2022 11:35:51 +0100 Message-ID: <877d7sar5k.wl-maz@kernel.org> From: Marc Zyngier To: Marek Szyprowski Cc: linux-kernel , 'Linux Samsung SOC' , Thomas Gleixner , John Garry , Xiongfeng Wang , David Decotigny , Krzysztof Kozlowski Subject: Re: [PATCH v3 2/3] genirq: Always limit the affinity to online CPUs In-Reply-To: <5dcf8d22-e9b3-f306-4c5f-256707e08fbf@samsung.com> References: <20220405185040.206297-1-maz@kernel.org> <20220405185040.206297-3-maz@kernel.org> <4b7fc13c-887b-a664-26e8-45aed13f048a@samsung.com> <878rs8c2t2.wl-maz@kernel.org> <5dcf8d22-e9b3-f306-4c5f-256707e08fbf@samsung.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: m.szyprowski@samsung.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, tglx@linutronix.de, john.garry@huawei.com, wangxiongfeng2@huawei.com, ddecotig@google.com, krzk@kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Marek, On Thu, 14 Apr 2022 10:09:31 +0100, Marek Szyprowski wrote: > > Hi Marc, > > On 13.04.2022 19:26, Marc Zyngier wrote: > > Hi Marek, > > > > On Wed, 13 Apr 2022 15:59:21 +0100, > > Marek Szyprowski wrote: > >> Hi Marc, > >> > >> On 05.04.2022 20:50, Marc Zyngier wrote: > >>> When booting with maxcpus= (or even loading a driver > >>> while most CPUs are offline), it is pretty easy to observe managed > >>> affinities containing a mix of online and offline CPUs being passed > >>> to the irqchip driver. > >>> > >>> This means that the irqchip cannot trust the affinity passed down > >>> from the core code, which is a bit annoying and requires (at least > >>> in theory) all drivers to implement some sort of affinity narrowing. > >>> > >>> In order to address this, always limit the cpumask to the set of > >>> online CPUs. > >>> > >>> Signed-off-by: Marc Zyngier > >> This patch landed in linux next-20220413 as commit 33de0aa4bae9 > >> ("genirq: Always limit the affinity to online CPUs"). Unfortunately it > >> breaks booting of most ARM 32bit Samsung Exynos based boards. > >> > >> I don't see anything specific in the log, though. Booting just hangs at > >> some point. The only Samsung Exynos boards that boot properly are those > >> Exynos4412 based. > >> > >> I assume that this is related to the Multi Core Timer IRQ configuration > >> specific for that SoCs. Exynos4412 uses PPI interrupts, while all other > >> Exynos SoCs have separate IRQ lines for each CPU. > >> > >> Let me know how I can help debugging this issue. > > Thanks for the heads up. Can you pick the last working kernel, enable > > CONFIG_GENERIC_IRQ_DEBUGFS, and dump the /sys/kernel/debug/irq/irqs/ > > entries for the timer IRQs? > > Exynos4210, Trats board, next-20220411: Thanks for all of the debug, super helpful. The issue is that we don't handle the 'force' case, which a handful of drivers are using when bringing up CPUs (and doing so before the CPUs are marked online). Can you please give the below hack a go? Thanks, M. diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index f71ecc100545..f1d5a94c6c9f 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c @@ -266,10 +266,16 @@ int irq_do_set_affinity(struct irq_data *data, const struct cpumask *mask, prog_mask = mask; } - /* Make sure we only provide online CPUs to the irqchip */ + /* + * Make sure we only provide online CPUs to the irqchip, + * unless we are being asked to force the affinity (in which + * case we do as we are told). + */ cpumask_and(&tmp_mask, prog_mask, cpu_online_mask); - if (!cpumask_empty(&tmp_mask)) + if (!force && !cpumask_empty(&tmp_mask)) ret = chip->irq_set_affinity(data, &tmp_mask, force); + else if (force) + ret = chip->irq_set_affinity(data, mask, force); else ret = -EINVAL; -- Without deviation from the norm, progress is not possible.