From patchwork Wed Oct 25 15:31:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 158173 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6359:6b8b:b0:164:83eb:24d7 with SMTP id ta11csp2742441rwb; Wed, 25 Oct 2023 08:32:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFy+yfG5nkuC2rVPUUp9SdNXepkU/JFCun4WkjhYKTUQj0nxr1B+MKFEmFMUHNnkLM2tSPg X-Received: by 2002:a0d:d7c6:0:b0:598:9df6:1a4f with SMTP id z189-20020a0dd7c6000000b005989df61a4fmr15613252ywd.39.1698247972961; Wed, 25 Oct 2023 08:32:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698247972; cv=none; d=google.com; s=arc-20160816; b=moXDoDLTZN1IDqDHGCsshfpDgA19smQ+UWKP2x/26/IT/sQ8lihYPtRQ6wuko3ivXh UxV25XmrJoO7hIymyhTGLiRZNnRKWmwM+ABD9i/jwRUPyb4hRmjwt8n3r4f/zAvQ9PyD VaURw0zSWaE1isoLTCfLQM7vrkw7pc9cRT43W0TK4MpMoE3jktKBA/+w+7JU3ZGfoRKn +RLEET6HiLgjzgICDRg6dYFCeCIBzEp1pLsrRRW2CAfMNxIhtVF2B49kWRkTM8Bgfq7u VhdPpBWpiJMHNyfj3t5KVsPdUDQEm3KnYMUkCC1db9qKu2DBjswlAGw9TxlXoIWChiO5 jUnw== 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; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id y65-20020a0dd644000000b00585e261fcc9si10396996ywd.2.2023.10.25.08.32.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 08:32:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; 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; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id 6595580C9A4C; Wed, 25 Oct 2023 08:32:20 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235076AbjJYPcF (ORCPT + 26 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 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 pete.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 (pete.vger.email [0.0.0.0]); Wed, 25 Oct 2023 08:32:20 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780742066744390119 X-GMAIL-MSGID: 1780742066744390119 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