Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp812555ybh; Wed, 11 Mar 2020 11:19:20 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsMicNDcDt8H+LsVc5bfmMBmLA30QGIQSr1CIUuP395btekbZCqPiLYkHoqeDNAYnFnrkc+ X-Received: by 2002:a05:6830:1193:: with SMTP id u19mr3421036otq.190.1583950759937; Wed, 11 Mar 2020 11:19:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583950759; cv=none; d=google.com; s=arc-20160816; b=pxdqxPnPH7cwpDueUYuLFw7zIlavtKYhUkLOXMG3t3NaHKQF+qCg6ew3JELB5cIFNl cDw5eqGsMNCIXq2vaay01Q6E0UdRdkLFJ+95/ro0PzBZ/bh5YjvBije4uKRAxeFDT6bU K3JpRyyVN4wo3ALJMfWvnTbVg+Yz4NjKx5UDcL29p+I+aMAgHJX3ZhDzBvQtpEge8+lb n6mXetrEp0tF6MEwnhl7eLVgNMH1r4LWUWgOpLl8IM8YwEbWtj6TdaQelCxxTs9m8ZTS Dk4gCx4TH/c/nfmIYIoyzkIkkS3L8myKRV/V8JiWrLG52YRwmkGIgA4Z5+4AbWJ7b18b IuJg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=jkasjibuWiHxpo3uihULuFpa1YG5Bahn8jdI8XMkU3Q=; b=tWAxmHo1PVSJ3CtWla8RZR32Szi2CUEemeFEBKPAOfchekwNsa6EPaVmghk3lgMFBr LgEQKkeViNVepo+47eZKZ0tQg+sclX7y+eRVG6TBHLSqq9gxmhls3FJVWrYVfTtk2ORg 3lzbd+SIdTRhhYpPA/6z/80wV06B8IbhNS+0vulZvdQgiDx/K6+tFtQfgnO1wCEUwBk5 XDYWFRR1OqRuFhU6hAqxrzOGZBa0KqJkIjsodb1n8fX92ExE/u4WUnHb43PZh634sAmc XlDuJzGxdjKTU8e1pBj5zEZxPfv8rcWH61bsoA7thz8/U6uGfetD+iwBcEKocMyYu1gU LxXg== 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 z14si1320858oih.89.2020.03.11.11.19.08; Wed, 11 Mar 2020 11:19:19 -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; 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 S1730799AbgCKSQy (ORCPT + 99 others); Wed, 11 Mar 2020 14:16:54 -0400 Received: from foss.arm.com ([217.140.110.172]:53198 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730626AbgCKSQx (ORCPT ); Wed, 11 Mar 2020 14:16:53 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7F9FFFEC; Wed, 11 Mar 2020 11:16:53 -0700 (PDT) Received: from e113632-lin.cambridge.arm.com (e113632-lin.cambridge.arm.com [10.1.194.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 9BDD23F6CF; Wed, 11 Mar 2020 11:16:52 -0700 (PDT) From: Valentin Schneider To: linux-kernel@vger.kernel.org Cc: mingo@kernel.org, peterz@infradead.org, vincent.guittot@linaro.org, dietmar.eggemann@arm.com Subject: [PATCH v2 2/9] sched/debug: Make sd->flags sysctl read-only Date: Wed, 11 Mar 2020 18:15:54 +0000 Message-Id: <20200311181601.18314-3-valentin.schneider@arm.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200311181601.18314-1-valentin.schneider@arm.com> References: <20200311181601.18314-1-valentin.schneider@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Writing to the sysctl of a sched_domain->flags directly updates the value of the field, and goes nowhere near update_top_cache_domain(). This means that the cached domain pointers can end up containing stale data (e.g. the domain pointed to doesn't have the relevant flag set anymore). Explicit domain walks that check for flags will be affected by the write, but this won't be in sync with the cached pointers which will still point to the domains that were cached at the last sched_domain build. In other words, writing to this interface is playing a dangerous game. It could be made to trigger an update of the cached sched_domain pointers when written to, but this does not seem to be worth the trouble. Make it read-only. Signed-off-by: Valentin Schneider --- kernel/sched/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index 8331bc04aea2..d86f7c21feff 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -258,7 +258,7 @@ sd_alloc_ctl_domain_table(struct sched_domain *sd) set_table_entry(&table[2], "busy_factor", &sd->busy_factor, sizeof(int), 0644, proc_dointvec_minmax); set_table_entry(&table[3], "imbalance_pct", &sd->imbalance_pct, sizeof(int), 0644, proc_dointvec_minmax); set_table_entry(&table[4], "cache_nice_tries", &sd->cache_nice_tries, sizeof(int), 0644, proc_dointvec_minmax); - set_table_entry(&table[5], "flags", &sd->flags, sizeof(int), 0644, proc_dointvec_minmax); + set_table_entry(&table[5], "flags", &sd->flags, sizeof(int), 0444, proc_dointvec_minmax); set_table_entry(&table[6], "max_newidle_lb_cost", &sd->max_newidle_lb_cost, sizeof(long), 0644, proc_doulongvec_minmax); set_table_entry(&table[7], "name", sd->name, CORENAME_MAX_SIZE, 0444, proc_dostring); /* &table[8] is terminator */ -- 2.24.0