Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp750661ybz; Wed, 15 Apr 2020 18:08:52 -0700 (PDT) X-Google-Smtp-Source: APiQypLIbK34SVenPXj/YM3ukxuXqBhPOvAKxF4G9/K62cDoBZ54BxCOWsGr5hBTHLvIMtQEnhGj X-Received: by 2002:aa7:d894:: with SMTP id u20mr14532682edq.205.1586999332578; Wed, 15 Apr 2020 18:08:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586999332; cv=none; d=google.com; s=arc-20160816; b=C0Jo+J4yL+lU43WTjNmtzL1vWdJcTJjrEAtLI4mYIxDp8ntjXEEgd27F/9ygWuJKD+ 4VeUmyEfVfhXDWTj383z+O7OC3esEwLad/78nU2uqOCn7REMUWIO7v2GW2/i4qYHf1PZ XJjk6K+KIV2qeKz9laH0ukN6br7p8VbnZtCeaHTQppjZxpWDFjg1/50Jvy/9t8OCawIh 9y72vS/OxwSpr2JBc7fcVyOZ7T5qhGn7IRssf4kuIRh5Qu/61of00jP+cbC1PGl3yGl0 sCB4c+Kr0b1OK9d8HjsY/xgW07sisp84nn05pJ4d5km9f6uwQ/3CXwhhsUlErqXEq05l lFUA== 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=t9yLBrWSfM1IsysUX8xJz+k1ZYJslcHVE8h+azTbiuM=; b=GZ3cKVf6GiPr+bNq2U7nqisrfaPLQWqvRbeGiBOOns+F+F3IH1MC2RWm3rlUlS4lGY c2vxG9ZrguLPeq+57hjP7Pl6NQByKIc977yea0C84w/TnOklZcm+g3FCTiQCoLBYif8F tSWiAHwHIdCcEH1RnebNKThBZtr8KGJlsuNS+WUShMTNi/AaXlsqEikXgg5ZmfR+OjxQ kb1jgPicH0c4qo7Z44W3Ungq8pw348ApWUHO6SHxoVFbNoxg1uCaaBs+GNxCiVJrtAzX hOo8vE5nTVUuJ69ey3Syuz221PFTFIUmpDsGrWhMGQWYMGm8mnVk+uwG+KFwz2rpgBeJ e3Rg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c20si8337958ejb.236.2020.04.15.18.08.27; Wed, 15 Apr 2020 18:08:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2442317AbgDOVKI (ORCPT + 99 others); Wed, 15 Apr 2020 17:10:08 -0400 Received: from foss.arm.com ([217.140.110.172]:52514 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2442222AbgDOVFb (ORCPT ); Wed, 15 Apr 2020 17:05:31 -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 CEA0E113E; Wed, 15 Apr 2020 14:05:26 -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 E99283F6C4; Wed, 15 Apr 2020 14:05:25 -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 v3 2/9] sched/debug: Make sd->flags sysctl read-only Date: Wed, 15 Apr 2020 22:05:05 +0100 Message-Id: <20200415210512.805-3-valentin.schneider@arm.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200415210512.805-1-valentin.schneider@arm.com> References: <20200415210512.805-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 a562df57a86e..00796b0a2723 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