Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp3558328ima; Mon, 4 Feb 2019 01:03:21 -0800 (PST) X-Google-Smtp-Source: AHgI3IYhtgK1Piqr7L3PVXMgQw4LTd95e2AlWRqCX6xCNAJ2D8G9hjsRtRfU7kmLQCIXmLdIhaOH X-Received: by 2002:a63:920a:: with SMTP id o10mr11797043pgd.141.1549271001883; Mon, 04 Feb 2019 01:03:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549271001; cv=none; d=google.com; s=arc-20160816; b=He8pgHikkiabuT6+iouCE8G1I7qEI3PdtFFYmbXAAbM41KL7PA0AaYwc79zmWeFkKl JF/MivTqIltQOVDA3VVb7uqxQXCABQHK3xHGYw1LHAXtX/o60TPiXdhmYb6Wa4BnORWp 4/USmJt4LBpPozvix2sWk/TD6ozt2PihAWrqFm8EhNQZ8K+4TZdiZSrNS18mezLqOp12 F6YM9qadFH+iATN5go3u8jECQE74/Vk8VAFvMZ/Ea/u/Q3MNSr0QOBWyx8u9USsy6OJL RZfO8+IXko3OOc2oJI0ZFCbVXfFhlWxNjvDBmH0df/MkNgOQ1IPnmqlDwGUw73b39sWT spcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date; bh=nAC+cXdUqNxVWc+J4ElchMcPwHUULsnOrZeqIPh1x4Q=; b=zLsN9T1rKlf1Po4/pD6bgtMdbxlyw2xUJbvLHGYzPvyXbvV41rQdCnfggojTzPqru+ BtKsuggK4ZdsqdZ4hONSvFlj7gTLqlAd7Z3iYlcEMXr2vNKxADg4Wnh7DB3dreuWwu1u MPwUTpg9I4XPbxTxCs1usRtRRlBOsb+pH3YPWYAa+aYyzYLJfVcZQNMywZO+cRmgD8br u2yw8J9HaMkp//HPh7yLIFV/Jp1h8V99BC/OhdCzELNvy91IoWknUi5/Alea7zJYC18b omFHGw125s4h4EIRO+RuficS41kN0rFoD4mD8qllkxniEJdCkcCla0naRMjkxG9ZlD3d 6U1A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f62si3187482pgc.99.2019.02.04.01.03.05; Mon, 04 Feb 2019 01:03:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728882AbfBDJC1 (ORCPT + 99 others); Mon, 4 Feb 2019 04:02:27 -0500 Received: from terminus.zytor.com ([198.137.202.136]:33543 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726320AbfBDJC0 (ORCPT ); Mon, 4 Feb 2019 04:02:26 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id x149211S358913 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 4 Feb 2019 01:02:01 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id x14921fw358910; Mon, 4 Feb 2019 01:02:01 -0800 Date: Mon, 4 Feb 2019 01:02:01 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Hidetoshi Seto Message-ID: Cc: ishii.shuuichir@jp.fujitsu.com, torvalds@linux-foundation.org, seto.hidetoshi@jp.fujitsu.com, tglx@linutronix.de, joe.lawrence@redhat.com, peterz@infradead.org, tarumizu.kohei@jp.fujitsu.com, mingo@kernel.org, m.mizuma@jp.fujitsu.com, efault@gmx.de, linux-kernel@vger.kernel.org, msys.mizuma@gmail.com, hpa@zytor.com Reply-To: ishii.shuuichir@jp.fujitsu.com, torvalds@linux-foundation.org, seto.hidetoshi@jp.fujitsu.com, tglx@linutronix.de, joe.lawrence@redhat.com, peterz@infradead.org, tarumizu.kohei@jp.fujitsu.com, mingo@kernel.org, m.mizuma@jp.fujitsu.com, msys.mizuma@gmail.com, hpa@zytor.com, efault@gmx.de, linux-kernel@vger.kernel.org In-Reply-To: <20190129151245.5073-1-msys.mizuma@gmail.com> References: <20190129151245.5073-1-msys.mizuma@gmail.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/core] sched/debug: Initialize sd_sysctl_cpus if !CONFIG_CPUMASK_OFFSTACK Git-Commit-ID: 1ca4fa3ab604734e38e2a3000c9abf788512ffa7 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-0.8 required=5.0 tests=ALL_TRUSTED,BAYES_00, FREEMAIL_FORGED_REPLYTO,T_DATE_IN_FUTURE_96_Q autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 1ca4fa3ab604734e38e2a3000c9abf788512ffa7 Gitweb: https://git.kernel.org/tip/1ca4fa3ab604734e38e2a3000c9abf788512ffa7 Author: Hidetoshi Seto AuthorDate: Tue, 29 Jan 2019 10:12:45 -0500 Committer: Ingo Molnar CommitDate: Mon, 4 Feb 2019 09:13:21 +0100 sched/debug: Initialize sd_sysctl_cpus if !CONFIG_CPUMASK_OFFSTACK register_sched_domain_sysctl() copies the cpu_possible_mask into sd_sysctl_cpus, but only if sd_sysctl_cpus hasn't already been allocated (ie, CONFIG_CPUMASK_OFFSTACK is set). However, when CONFIG_CPUMASK_OFFSTACK is not set, sd_sysctl_cpus is left uninitialized (all zeroes) and the kernel may fail to initialize sched_domain sysctl entries for all possible CPUs. This is visible to the user if the kernel is booted with maxcpus=n, or if ACPI tables have been modified to leave CPUs offline, and then checking for missing /proc/sys/kernel/sched_domain/cpu* entries. Fix this by separating the allocation and initialization, and adding a flag to initialize the possible CPU entries while system booting only. Tested-by: Syuuichirou Ishii Tested-by: Tarumizu, Kohei Signed-off-by: Hidetoshi Seto Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Masayoshi Mizuma Acked-by: Joe Lawrence Cc: Linus Torvalds Cc: Masayoshi Mizuma Cc: Mike Galbraith Cc: Peter Zijlstra Cc: Thomas Gleixner Link: https://lkml.kernel.org/r/20190129151245.5073-1-msys.mizuma@gmail.com Signed-off-by: Ingo Molnar --- kernel/sched/debug.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index de3de997e245..8039d62ae36e 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -315,6 +315,7 @@ void register_sched_domain_sysctl(void) { static struct ctl_table *cpu_entries; static struct ctl_table **cpu_idx; + static bool init_done = false; char buf[32]; int i; @@ -344,7 +345,10 @@ void register_sched_domain_sysctl(void) if (!cpumask_available(sd_sysctl_cpus)) { if (!alloc_cpumask_var(&sd_sysctl_cpus, GFP_KERNEL)) return; + } + if (!init_done) { + init_done = true; /* init to possible to not have holes in @cpu_entries */ cpumask_copy(sd_sysctl_cpus, cpu_possible_mask); }