Message ID | 169477940847.27769.15320684535553252937.tip-bot2@tip-bot2 |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp1041760vqi; Fri, 15 Sep 2023 06:21:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEonqBDKv2zdrLanAYuDohXK/VTgXg6sXMawPpiRGTzrW3YUmr/r/LMyH/sUDxy1Tl/wno8 X-Received: by 2002:a17:90a:9485:b0:263:9e9b:5586 with SMTP id s5-20020a17090a948500b002639e9b5586mr1352618pjo.44.1694784086578; Fri, 15 Sep 2023 06:21:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694784086; cv=none; d=google.com; s=arc-20160816; b=Cee3gzWav5PhQSFFtTuDFuF+GIQ5c2L4dA9nZ6SnQwMvwaiCrLuy+W7NiJ3KmD/AUR E9wXvJ9MEdRHMJxI9A371jleK5jqhvmvjaKFyMDy7s846NCL1jrqFAEHpyfOd8aY8Pvs wWwVs445taNGBAG9YjbG2KhrHC1Ns2ql3NiO6M9K/f/NVhDDo0GiSTQhAxJkGXpB++Io MC1/2BWzO8Bk+rik2zYu/wwdO21qVFzC6jNX0p6DedXLJKeU3mJmomWyEd0ClV4VZwMl D7Qtpdowf9vGw6u6sXjXB9y6uqxmJQm6kOZ+wagq7wWqr155arhWKXIYP0Y4acAdTDeq 0mAw== 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=GLBD5gHegkqpwAJ7rP50B51wP7vUAAVgVBjCLxzMmJo=; fh=oM17FQV97KUYdWPriZ+iGIbIdcgppbvxJsZV0OeiCC0=; b=OLl7eHZlQlHVjCyT0Ot7B+W6EOc1z2pUW6t89g0VD+oqOPRTyLAvfq4MxG140CM2VK Wc1IHgz+De09OM5rOVCDcLiQ+MxPsVb8EPo7ERTVpoRrKApqzcyQJthv//t8glUInVvm WWry02TaHS+fNZ7xG/ujOXFGSZDhn+WA++KBbrXW681yKtsjPpllyvF8ALrFZJd1v29d LCm/r8T/eUER02m+YjZs8HC/nnlKlY1Cmy4qnSRkwpqwEROM4ZfJ+TffUegB6+J4+25G FVHuuVfvB661KJfMQGMR++ZWTbZ4xveNJ0yaVlRrF646yzSR/nXkaF817NOTjs26etXK 9oEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=sgZwc2bF; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id in23-20020a17090b439700b002691d885301si3424336pjb.0.2023.09.15.06.21.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 06:21:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=sgZwc2bF; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id 7251A83C9F93; Fri, 15 Sep 2023 05:06:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234613AbjIOMGU (ORCPT <rfc822;ruipengqi7@gmail.com> + 32 others); Fri, 15 Sep 2023 08:06:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234630AbjIOMGO (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 15 Sep 2023 08:06:14 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B16BD2D6A; Fri, 15 Sep 2023 05:03:30 -0700 (PDT) Date: Fri, 15 Sep 2023 12:03:28 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1694779409; 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=GLBD5gHegkqpwAJ7rP50B51wP7vUAAVgVBjCLxzMmJo=; b=sgZwc2bFfSloZs4gzJcl/JUZN1YJPsM/MV6IrJ0kfSW94XJlIB4JPD6e1lrbjUutTK78nz SevHBwHaMa9FVvlJazukJN6wr547rLTJSuTJxxX9fHp9cTZX2otEUvKEEBSVqfoKw/nQR+ TGRnLFS2sOeiyc49daxs/8qw7Qm3bEY/SEg8ixn6VEc2AcH4QWPHI3vku5BJpyjtX4XACL 2eRVGPR4ifjscGaDaooaRQQNDwguNWMioWGvUykEcfzWgVoywJx5Y1UlUEgDkDI2OuJ0Kn siowSqSHkQlhkdLEMaImymLjba6ani0X95NnnHDiqPfaiw+37tAXeqN4isTX0A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1694779409; 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=GLBD5gHegkqpwAJ7rP50B51wP7vUAAVgVBjCLxzMmJo=; b=0C9QESB34lY/HC3w0wc9B6AiXKhmRaTrsXFY+CczPObmf8t+0sJYqRBarnEgbEfCOCVzhJ j3bEUv9ExYVPLaDA== From: "tip-bot2 for Yury Norov" <tip-bot2@linutronix.de> Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched/topology: Fix sched_numa_find_nth_cpu() in CPU-less case Cc: Yicong Yang <yangyicong@hisilicon.com>, Guenter Roeck <linux@roeck-us.net>, Yury Norov <yury.norov@gmail.com>, Ingo Molnar <mingo@kernel.org>, Mel Gorman <mgorman@suse.de>, x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230819141239.287290-4-yury.norov@gmail.com> References: <20230819141239.287290-4-yury.norov@gmail.com> MIME-Version: 1.0 Message-ID: <169477940847.27769.15320684535553252937.tip-bot2@tip-bot2> Robot-ID: <tip-bot2@linutronix.de> Robot-Unsubscribe: Contact <mailto:tglx@linutronix.de> to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 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 morse.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Fri, 15 Sep 2023 05:06:50 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777109918527520127 X-GMAIL-MSGID: 1777109918527520127 |
Series |
[tip:,sched/core] sched/topology: Fix sched_numa_find_nth_cpu() in CPU-less case
|
|
Commit Message
tip-bot2 for Thomas Gleixner
Sept. 15, 2023, 12:03 p.m. UTC
The following commit has been merged into the sched/core branch of tip: Commit-ID: 617f2c38cb5ce60226042081c09e2ee3a90d03f8 Gitweb: https://git.kernel.org/tip/617f2c38cb5ce60226042081c09e2ee3a90d03f8 Author: Yury Norov <yury.norov@gmail.com> AuthorDate: Sat, 19 Aug 2023 07:12:35 -07:00 Committer: Ingo Molnar <mingo@kernel.org> CommitterDate: Fri, 15 Sep 2023 13:48:10 +02:00 sched/topology: Fix sched_numa_find_nth_cpu() in CPU-less case When the node provided by user is CPU-less, corresponding record in sched_domains_numa_masks is not set. Trying to dereference it in the following code leads to kernel crash. To avoid it, start searching from the nearest node with CPUs. Fixes: cd7f55359c90 ("sched: add sched_numa_find_nth_cpu()") Reported-by: Yicong Yang <yangyicong@hisilicon.com> Reported-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Yury Norov <yury.norov@gmail.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Reviewed-by: Yicong Yang <yangyicong@hisilicon.com> Cc: Mel Gorman <mgorman@suse.de> Link: https://lore.kernel.org/r/20230819141239.287290-4-yury.norov@gmail.com Closes: https://lore.kernel.org/lkml/CAAH8bW8C5humYnfpW3y5ypwx0E-09A3QxFE1JFzR66v+mO4XfA@mail.gmail.com/T/ Closes: https://lore.kernel.org/lkml/ZMHSNQfv39HN068m@yury-ThinkPad/T/#mf6431cb0b7f6f05193c41adeee444bc95bf2b1c4 --- kernel/sched/topology.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c index 05a5bc6..423d089 100644 --- a/kernel/sched/topology.c +++ b/kernel/sched/topology.c @@ -2122,12 +2122,16 @@ static int hop_cmp(const void *a, const void *b) */ int sched_numa_find_nth_cpu(const struct cpumask *cpus, int cpu, int node) { - struct __cmp_key k = { .cpus = cpus, .node = node, .cpu = cpu }; + struct __cmp_key k = { .cpus = cpus, .cpu = cpu }; struct cpumask ***hop_masks; int hop, ret = nr_cpu_ids; rcu_read_lock(); + /* CPU-less node entries are uninitialized in sched_domains_numa_masks */ + node = numa_nearest_node(node, N_CPU); + k.node = node; + k.masks = rcu_dereference(sched_domains_numa_masks); if (!k.masks) goto unlock;