Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1071173yba; Thu, 4 Apr 2019 03:44:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqyFlFuKjMpC48L9xDTBAqlcSINlQVGX0qiHQfWtnBJY+E4NSnlETm4LGSPwrw9Q9RtmAUkX X-Received: by 2002:a63:cc0d:: with SMTP id x13mr5211736pgf.280.1554374692379; Thu, 04 Apr 2019 03:44:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554374692; cv=none; d=google.com; s=arc-20160816; b=Y9UNlvUDRcsWNbULtGl7UCiCCWa1dFo8zljue11ymvpodu+0Vw2IlpZ9SLEY4dqmmQ 2CfUFRQRAk78bLhh0+x/hnx+MJKN5KTfmPBpVYXjcleCCS9ql4m0FQ6QDLURxRAHkCaR Ng8E6vu6akJY5sp7fP7hcx2d/VGlgc0jcqLCwxMzA4KMnm7hLiTnNCuyDHUqq03/XbBI aC9Pzf8mZ1uiF3a/wF74hOkVkejmaTiWso5/qI7xCkrlIcdIU/Hu5PRousbxhWssLEOb 6YT+nab/x2CtLTELnU+ZH5RTBJKtRpXVC8QMopRowv7hy/lfR32c5P90QR+L8kl6geau aQxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=V7g9wKJTMU0+0zX+amw46hB2BoPmhr31E5ZmNITM9HA=; b=jPs/ToheIen9Ab82zGfmuU6AALmIQDLtVbpcal/fmZtJ6qiiHVL65W1Lsiq/wIQaIG DK2gor/kDI76MhywIhqBjnO/6K1gURSfepVo4YvCLb4TJaW7ACQgu9gmEuG9NYVfhMu4 e+nrhLZmRdAGx4nenCcqxCr3hx4QgViErbEdTkCWHCUJgGcdPA5zq2Ery9B+ygmBwzxU OTO6n3Am136FsGDTKrdHRv80Uy/8XIS3vG633etjtHQNC1IvpJQ9JIqYRoB+IjP9faBw W1sRbgi+8zzYJ3GM5v5MjUK1sNRjOUET3HVClATqMt7AARK1ynDmIHBaQR+whq3shciL dOnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QEWbjZOo; 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 d2si15881013pgh.499.2019.04.04.03.44.37; Thu, 04 Apr 2019 03:44:52 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=QEWbjZOo; 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 S1729466AbfDDKn6 (ORCPT + 99 others); Thu, 4 Apr 2019 06:43:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:42972 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729056AbfDDKn5 (ORCPT ); Thu, 4 Apr 2019 06:43:57 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4D0FA20855; Thu, 4 Apr 2019 10:43:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554374635; bh=y+Voz5plUCdx3gjXyllVYNI1ZIMQgB5r+yBPul3w/7M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QEWbjZOoDxx3XXkhdBJTwcjPv/nWZN7P5HZoWl5i0dvger0n9ern+ykBw29byNEVV Tmq3xOsww/57WLBvvKeW29GLHW5Gc82VepzjSVMMnCBfKmdngNYMhP3qzvh6g7J/1g pVt14/y1MWEbG62TzMsWnCQRtms49rrcT6v7/920= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Syuuichirou Ishii , "Tarumizu, Kohei" , Hidetoshi Seto , "Peter Zijlstra (Intel)" , Masayoshi Mizuma , Joe Lawrence , Linus Torvalds , Masayoshi Mizuma , Mike Galbraith , Thomas Gleixner , Ingo Molnar , Sasha Levin Subject: [PATCH 5.0 174/246] sched/debug: Initialize sd_sysctl_cpus if !CONFIG_CPUMASK_OFFSTACK Date: Thu, 4 Apr 2019 10:47:54 +0200 Message-Id: <20190404084625.269984231@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190404084619.236418459@linuxfoundation.org> References: <20190404084619.236418459@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 5.0-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 1ca4fa3ab604734e38e2a3000c9abf788512ffa7 ] 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 Signed-off-by: Sasha Levin --- 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); } -- 2.19.1