Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2648280rda; Wed, 25 Oct 2023 08:32:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHFEj2V2c+HzErKY3wPvKrse3G9NVZ8VLPD7Hz8SK9fa2e7ZvoFI4ynKiqRbg3fDcIM3wCB X-Received: by 2002:a0d:d6c9:0:b0:59b:f8da:ffdb with SMTP id y192-20020a0dd6c9000000b0059bf8daffdbmr16169518ywd.29.1698247941787; Wed, 25 Oct 2023 08:32:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698247941; cv=none; d=google.com; s=arc-20160816; b=I7S43H3XPrqQqthmxN6OmmlZnZenL/5OVxblsoXnQ3g9cyWXcGxH2a9499cD3X3XyK LsJUTkoTe4lGbL7zoMkPmv1J6LeFfZPSn63KLDlbR68SaBdHjMqU8Y4DwsG1pecRDNzN 93/dgCelnkL9IAGuacaCHD8Uab2kY6ZbNJYsBoplnpc8mG5kjWaywBbiO46rG39d3B3s 7ClDHZoHian4/Pg5Pt7BJFEv8WGKe4ekR4CxZIHXY+0ul/wmSCunPuUDrrZiScUsDacM kIwE1F/X92k4fyVZOibkyn+fvLjJiQXLyROWrmBQM+ZyTrtBrbYP6yUQ8eYq51FyDwi0 FZBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=L4nRcGgUwjIYKtu/Bjz9TtAnlQT8ejqV4enG5LqQq+k=; fh=FOWla2FZmlcOdsqAS+xAQKKi5eqBw6jlgzunkfZ+Y2U=; b=JYQNii/npAXn+JnkNwIUPrucGjIxKP2bvXn+G29+oXIJijlRNtYSgzPjIICWmskxJw u/PvwceLxVLt80l02rMjCsLsNkpxJ5CB8f6uEN6YqcyP8OJn45MV7EneHlv4gB2SUv0T qhGWxkIbk1xw+dQIgVMKFZT0tZSk5UDfkHxRD5lzspxIeB1kSckhxdbW0yvjoodcTKkO dHuyVL1sNwc4GprTEuIAyQRjFS/GLPXLY+2GABFaIBCHaDcBTiBN9+FSSXTpPEG7AwTx 0jFMMbeNxa2CxuqozeuiaG5DU3TODCwczBH63GiNFxP+/2RAQmK8vNswmxASvb2bQknk s83g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Nhbeb3Ue; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=Vl0bFDRb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id m63-20020a0dfc42000000b005928be73eb7si11427468ywf.358.2023.10.25.08.32.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 08:32:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Nhbeb3Ue; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=Vl0bFDRb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 24C568023EC8; Wed, 25 Oct 2023 08:32:10 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235048AbjJYPcF (ORCPT + 99 others); Wed, 25 Oct 2023 11:32:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233846AbjJYPcD (ORCPT ); Wed, 25 Oct 2023 11:32:03 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D137182; Wed, 25 Oct 2023 08:32:01 -0700 (PDT) Date: Wed, 25 Oct 2023 15:31:58 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1698247919; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=L4nRcGgUwjIYKtu/Bjz9TtAnlQT8ejqV4enG5LqQq+k=; b=Nhbeb3UeZBoTSRhqElJSp/QR5lTI8kzrbXEySS1DuqHeuipT82hjbblFXafkP5lBUb4pi2 rYiVrPlz52FaDoAgjewJVNSo3rncHm/GlmUdNpdUdFk6tEdETArtfSlJ074iWAGmmD1/OG PwOMFOaemC8ulfsr3XXBGIaTjdY4RDYUBMMXqJxukVnyij4Gjw0TYN1Vebi0RiD94GsFpm ldd8z35QpmvOtgZVJy/PALv7pSEkOB6eM+OUrj5TYkYDRwLH+ERTbLYhfMeQkMUzI7AGd5 I9qT7bLsI1cGifK9SbfpRm28IFV/7u6RihJwEeIfkZ8any4OWQOHYD+zCrXIvg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1698247919; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=L4nRcGgUwjIYKtu/Bjz9TtAnlQT8ejqV4enG5LqQq+k=; b=Vl0bFDRbM3n8b2K5tUh88hgA7Gl/2HLtgq71jqkanHxK0dmwZ3e0wioj0/ZBbzQj24+OCz 1663HznkGyRb/tAg== From: "tip-bot2 for Chen Yu" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: irq/core] genirq/matrix: Exclude managed interrupts in irq_matrix_allocated() Cc: Wendy Wang , Chen Yu , Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org, maz@kernel.org In-Reply-To: <20231020072522.557846-1-yu.c.chen@intel.com> References: <20231020072522.557846-1-yu.c.chen@intel.com> MIME-Version: 1.0 Message-ID: <169824791888.3135.11708569136306564605.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 25 Oct 2023 08:32:10 -0700 (PDT) The following commit has been merged into the irq/core branch of tip: Commit-ID: a0b0bad10587ae2948a7c36ca4ffc206007fbcf3 Gitweb: https://git.kernel.org/tip/a0b0bad10587ae2948a7c36ca4ffc206007fbcf3 Author: Chen Yu AuthorDate: Fri, 20 Oct 2023 15:25:22 +08:00 Committer: Thomas Gleixner CommitterDate: Wed, 25 Oct 2023 17:25:57 +02:00 genirq/matrix: Exclude managed interrupts in irq_matrix_allocated() When a CPU is about to be offlined, x86 validates that all active interrupts which are targeted to this CPU can be migrated to the remaining online CPUs. If not, the offline operation is aborted. The validation uses irq_matrix_allocated() to retrieve the number of vectors which are allocated on the outgoing CPU. The returned number of allocated vectors includes also vectors which are associated to managed interrupts. That's overaccounting because managed interrupts are: - not migrated when the affinity mask of the interrupt targets only the outgoing CPU - migrated to another CPU, but in that case the vector is already pre-allocated on the potential target CPUs and must not be taken into account. As a consequence the check whether the remaining online CPUs have enough capacity for migrating the allocated vectors from the outgoing CPU might fail incorrectly. Let irq_matrix_allocated() return only the number of allocated non-managed interrupts to make this validation check correct. [ tglx: Amend changelog and fixup kernel-doc comment ] Fixes: 2f75d9e1c905 ("genirq: Implement bitmap matrix allocator") Reported-by: Wendy Wang Signed-off-by: Chen Yu Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/20231020072522.557846-1-yu.c.chen@intel.com --- kernel/irq/matrix.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/irq/matrix.c b/kernel/irq/matrix.c index 1698e77..75d0ae4 100644 --- a/kernel/irq/matrix.c +++ b/kernel/irq/matrix.c @@ -466,16 +466,16 @@ unsigned int irq_matrix_reserved(struct irq_matrix *m) } /** - * irq_matrix_allocated - Get the number of allocated irqs on the local cpu + * irq_matrix_allocated - Get the number of allocated non-managed irqs on the local CPU * @m: Pointer to the matrix to search * - * This returns number of allocated irqs + * This returns number of allocated non-managed interrupts. */ unsigned int irq_matrix_allocated(struct irq_matrix *m) { struct cpumap *cm = this_cpu_ptr(m->maps); - return cm->allocated; + return cm->allocated - cm->managed_allocated; } #ifdef CONFIG_GENERIC_IRQ_DEBUGFS