Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2308613pxp; Mon, 21 Mar 2022 16:32:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/AJDg144Kfby5JsEzUyPXbWakGeeVz4JOeTpQQOe69TB3S/TSFBQcYy/ljZypB9ndY98p X-Received: by 2002:a17:902:d4c1:b0:154:1273:6ec9 with SMTP id o1-20020a170902d4c100b0015412736ec9mr15367132plg.148.1647905524576; Mon, 21 Mar 2022 16:32:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647905524; cv=none; d=google.com; s=arc-20160816; b=StJMdIo57ngDvu+xcB04wTG8rb+o1vk09LuhdAa50kg2RHyaZ3fxk2Rw6nmKYhrfxh 6aQGQ+G0M55XzG2iv3K8O+fliOl/yY2jxI7wYlvSrP0WULzczmC143K1aTS03qM5XknC N+NJqJeIgCfPJIl3aZsCd0CwjpxmHJaGGMQrNbfNo+bf9dh+RoGm0x4NqU04niuQqbkJ 4UITHMTjxhcbrS7N1N075j4Av8nR6sa+Aalct9/ra67ACkjpa2Sqnv64bg2ZkiM5Irhc R8fjFvY/7bihRovnU97rFyuIX7WXKsIzeFrGxGPA9ns1Wa+wk7M0nobzpfW9vHa3rlKv L5Nw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4bCCuXyAfBgLnSf/q9y/Nwzo3EYGRXUo5H7gZ5uJs2I=; b=Qo/tbhkAxPzd8mcS7IgQaSXLhsK1h5xfA8z1HIgUzd4W0FYEzdeD1DPX0XB8u7PPyv Chj1Hn/OSM0rY7Aa71DyxEG0h9PAtoLYloosPqfyrsDwrIf9qAfMmxWTgWARR9LLLCzN fRpNrDgMYSjdE3PjmOme6zUZ0E2qQG8hmCk88w9/iBpX2Aft8Orz5ha82QYU2RKiPqIy j6kCcAtGq4o/BZj0h/8UBNUkVcv5MuUYCaSLXyvEeeDId/AWupuOMYkEGoe7FKyNddJE 2xuVBT3JI9CTXeruUcFE65pHVXR+JmbOmwbu9LIYzJcXh7K6LLZh0/R1FQni4MgzO0fu y8lA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jWijfcPr; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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. [23.128.96.19]) by mx.google.com with ESMTPS id t6-20020a634606000000b003816043ee89si14053822pga.126.2022.03.21.16.32.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 16:32:04 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jWijfcPr; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 C81024759E8; Mon, 21 Mar 2022 15:23:00 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352799AbiCUTim (ORCPT + 99 others); Mon, 21 Mar 2022 15:38:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237280AbiCUTif (ORCPT ); Mon, 21 Mar 2022 15:38:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFBA45F8FD for ; Mon, 21 Mar 2022 12:37:09 -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 ams.source.kernel.org (Postfix) with ESMTPS id 7BB45B819C1 for ; Mon, 21 Mar 2022 19:37:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFC19C340F0; Mon, 21 Mar 2022 19:37:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1647891427; bh=9v4RqTFBMhIkEMkcdqjBprzzsU8Kal+EmgXjHs9Hfvg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jWijfcPrBCtWz/eUo1xQ7mM+aDLRzUz/CywDMooDoGyfjquZnvUcs6qkqTH7BMYBr mWg7FhqodPCPJssDrcY+D+qiS+zeHYZd+onORcGLS/Fpw0VMxa9YV4iHQI7SZ3LEm7 fiSX+Ajs3ewReMRV1Du/RLMkc53cej1ehLW6WZIDX6UlP3rmc5pT1LgVssUPvQ9OUZ ab+meUhtXutFUNqZQiqBjia3Wx3IuPi3I4u5sNFRnNC1tQs0t4jzT2RYb4A1F/RLMH GNEtsFkW5jQwXNygSh3EFGPhIzp5PPz2tZe1M0pLyiugJILoAR/M0QbuVUl72pxWbT azllA4QFpWUnQ== Received: from sofa.misterjones.org ([185.219.108.64] helo=why.lan) 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 1nWNpw-00G5T9-ID; Mon, 21 Mar 2022 19:37:04 +0000 From: Marc Zyngier To: linux-kernel Cc: Thomas Gleixner , John Garry , Xiongfeng Wang , David Decotigny Subject: [PATCH v2 1/3] genirq/msi: Shutdown managed interrupts with unsatifiable affinities Date: Mon, 21 Mar 2022 19:36:06 +0000 Message-Id: <20220321193608.975495-2-maz@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220321193608.975495-1-maz@kernel.org> References: <20220321193608.975495-1-maz@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: linux-kernel@vger.kernel.org, tglx@linutronix.de, john.garry@huawei.com, wangxiongfeng2@huawei.com, ddecotig@google.com 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=-3.5 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 When booting with maxcpus=, interrupt controllers such as the GICv3 ITS may not be able to satisfy the affinity of some managed interrupts, as some of the HW resources are simply not available. The same thing happens when loading a driver using managed interrupts while CPUs are offline. In order to deal with this, do not try to activate such interrupt if there is no online CPU capable of handling it. Instead, place it in shutdown state. Once a capable CPU shows up, it will be activated. Reported-by: John Garry Tested-by: John Garry Reported-by: David Decotigny Signed-off-by: Marc Zyngier --- kernel/irq/msi.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c index 2bdfce5edafd..a9ee535293eb 100644 --- a/kernel/irq/msi.c +++ b/kernel/irq/msi.c @@ -818,6 +818,21 @@ static int msi_init_virq(struct irq_domain *domain, int virq, unsigned int vflag irqd_clr_can_reserve(irqd); if (vflags & VIRQ_NOMASK_QUIRK) irqd_set_msi_nomask_quirk(irqd); + + /* + * If the interrupt is managed but no CPU is available to + * service it, shut it down until better times. Note that + * we only do this on the !RESERVE path as x86 (the only + * architecture using this flag) deals with this in a + * different way by using a catch-all vector. + */ + if ((vflags & VIRQ_ACTIVATE) && + irqd_affinity_is_managed(irqd) && + !cpumask_intersects(irq_data_get_affinity_mask(irqd), + cpu_online_mask)) { + irqd_set_managed_shutdown(irqd); + return 0; + } } if (!(vflags & VIRQ_ACTIVATE)) -- 2.34.1