From: Tim Chen <tim.c.chen@linux.intel.com>
To: K Prateek Nayak <kprateek.nayak@amd.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
x86@kernel.org, linux-kernel@vger.kernel.org
Cc: "H. Peter Anvin" <hpa@zytor.com>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
Ricardo Neri <ricardo.neri-calderon@linux.intel.com>,
Mario Limonciello <mario.limonciello@amd.com>,
Meng Li <li.meng@amd.com>, Huang Rui <ray.huang@amd.com>,
"Gautham R. Shenoy" <gautham.shenoy@amd.com>
Subject: Re: [PATCH 3/8] x86/itmt: Move the "sched_itmt_enabled" sysctl to debugfs
Date: Thu, 12 Dec 2024 11:15:43 -0800 [thread overview]
Message-ID: <527d53cded892aea8f36b498ccd42f1bed0a347b.camel@linux.intel.com> (raw)
In-Reply-To: <20241211185552.4553-4-kprateek.nayak@amd.com>
On Wed, 2024-12-11 at 18:55 +0000, K Prateek Nayak wrote:
> "sched_itmt_enabled" was only introduced as a debug toggle for any funky
> ITMT behavior. Move the sysctl controlled from
> "/proc/sys/kernel/sched_itmt_enabled" to debugfs at
> "/sys/kernel/debug/x86/sched_itmt_enabled" with a notable change that a
> cat on the file will return "Y" or "N" instead of "1" or "0" to
> indicate that feature is enabled or disabled respectively.
>
Valid values of setting "sched_itmt_enabled" likewise change from "1" or "0"
to "Y" or "N".
> Since ITMT is x86 specific (and PowerPC uses SD_ASYM_PACKING too), the
> toggle was moved to "/sys/kernel/debug/x86/" as opposed to
> "/sys/kernel/debug/sched/"
>
> Suggested-by: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: K Prateek Nayak <kprateek.nayak@amd.com>
Reviewed-by: Tim Chen <tim.c.chen@linux.intel.com>
Tim
> ---
> arch/x86/kernel/itmt.c | 56 ++++++++++++++++++++----------------------
> 1 file changed, 27 insertions(+), 29 deletions(-)
>
> diff --git a/arch/x86/kernel/itmt.c b/arch/x86/kernel/itmt.c
> index ee43d1bd41d0..9cea1fc36c18 100644
> --- a/arch/x86/kernel/itmt.c
> +++ b/arch/x86/kernel/itmt.c
> @@ -19,6 +19,7 @@
> #include <linux/sched.h>
> #include <linux/cpumask.h>
> #include <linux/cpuset.h>
> +#include <linux/debugfs.h>
> #include <linux/mutex.h>
> #include <linux/sysctl.h>
> #include <linux/nodemask.h>
> @@ -34,45 +35,38 @@ static bool __read_mostly sched_itmt_capable;
> * of higher turbo frequency for cpus supporting Intel Turbo Boost Max
> * Technology 3.0.
> *
> - * It can be set via /proc/sys/kernel/sched_itmt_enabled
> + * It can be set via /sys/kernel/debug/x86/sched_itmt_enabled
> */
> bool __read_mostly sysctl_sched_itmt_enabled;
>
> -static int sched_itmt_update_handler(const struct ctl_table *table, int write,
> - void *buffer, size_t *lenp, loff_t *ppos)
> +static ssize_t sched_itmt_enabled_write(struct file *filp,
> + const char __user *ubuf,
> + size_t cnt, loff_t *ppos)
> {
> - unsigned int old_sysctl;
> - int ret;
> + ssize_t result;
> + bool orig;
>
> guard(mutex)(&itmt_update_mutex);
>
> - if (!sched_itmt_capable)
> - return -EINVAL;
> -
> - old_sysctl = sysctl_sched_itmt_enabled;
> - ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
> + orig = sysctl_sched_itmt_enabled;
> + result = debugfs_write_file_bool(filp, ubuf, cnt, ppos);
>
> - if (!ret && write && old_sysctl != sysctl_sched_itmt_enabled) {
> + if (sysctl_sched_itmt_enabled != orig) {
> x86_topology_update = true;
> rebuild_sched_domains();
> }
>
> - return ret;
> + return result;
> }
>
> -static struct ctl_table itmt_kern_table[] = {
> - {
> - .procname = "sched_itmt_enabled",
> - .data = &sysctl_sched_itmt_enabled,
> - .maxlen = sizeof(unsigned int),
> - .mode = 0644,
> - .proc_handler = sched_itmt_update_handler,
> - .extra1 = SYSCTL_ZERO,
> - .extra2 = SYSCTL_ONE,
> - },
> +static const struct file_operations dfs_sched_itmt_fops = {
> + .read = debugfs_read_file_bool,
> + .write = sched_itmt_enabled_write,
> + .open = simple_open,
> + .llseek = default_llseek,
> };
>
> -static struct ctl_table_header *itmt_sysctl_header;
> +static struct dentry *dfs_sched_itmt;
>
> /**
> * sched_set_itmt_support() - Indicate platform supports ITMT
> @@ -98,9 +92,15 @@ int sched_set_itmt_support(void)
> if (sched_itmt_capable)
> return 0;
>
> - itmt_sysctl_header = register_sysctl("kernel", itmt_kern_table);
> - if (!itmt_sysctl_header)
> + dfs_sched_itmt = debugfs_create_file_unsafe("sched_itmt_enabled",
> + 0644,
> + arch_debugfs_dir,
> + &sysctl_sched_itmt_enabled,
> + &dfs_sched_itmt_fops);
> + if (IS_ERR_OR_NULL(dfs_sched_itmt)) {
> + dfs_sched_itmt = NULL;
> return -ENOMEM;
> + }
>
> sched_itmt_capable = true;
>
> @@ -131,10 +131,8 @@ void sched_clear_itmt_support(void)
>
> sched_itmt_capable = false;
>
> - if (itmt_sysctl_header) {
> - unregister_sysctl_table(itmt_sysctl_header);
> - itmt_sysctl_header = NULL;
> - }
> + debugfs_remove(dfs_sched_itmt);
> + dfs_sched_itmt = NULL;
>
> if (sysctl_sched_itmt_enabled) {
> /* disable sched_itmt if we are no longer ITMT capable */
next prev parent reply other threads:[~2024-12-12 19:15 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-11 18:55 [PATCH 0/8] x86, sched: Dynamic ITMT core ranking support and some yak shaving K Prateek Nayak
2024-12-11 18:55 ` [PATCH 1/8] x86/itmt: Convert "sysctl_sched_itmt_enabled" to boolean K Prateek Nayak
2024-12-12 18:09 ` Tim Chen
2024-12-11 18:55 ` [PATCH 2/8] x86/itmt: Use guard() for itmt_update_mutex K Prateek Nayak
2024-12-12 18:22 ` Tim Chen
2024-12-11 18:55 ` [PATCH 3/8] x86/itmt: Move the "sched_itmt_enabled" sysctl to debugfs K Prateek Nayak
2024-12-12 19:15 ` Tim Chen [this message]
2024-12-13 4:01 ` K Prateek Nayak
2024-12-13 17:19 ` Tim Chen
2024-12-13 9:16 ` Peter Zijlstra
2024-12-11 18:55 ` [PATCH 4/8] x86/topology: Remove x86_smt_flags and use cpu_smt_flags directly K Prateek Nayak
2024-12-12 21:05 ` Tim Chen
2024-12-11 18:55 ` [PATCH 5/8] x86/topology: Use x86_sched_itmt_flags for PKG domain unconditionally K Prateek Nayak
2024-12-13 21:07 ` Tim Chen
2024-12-11 18:55 ` [PATCH 6/8] sched/fair: Do not compute NUMA Balancing stats unnecessarily during lb K Prateek Nayak
2024-12-12 11:05 ` Vincent Guittot
2024-12-12 11:43 ` K Prateek Nayak
2024-12-12 13:28 ` Vincent Guittot
2024-12-13 14:55 ` Shrikanth Hegde
2024-12-11 18:55 ` [PATCH 7/8] sched/fair: Do not compute overloaded status " K Prateek Nayak
2024-12-12 9:56 ` Vincent Guittot
2024-12-12 11:01 ` K Prateek Nayak
2024-12-12 11:18 ` Vincent Guittot
2024-12-12 11:30 ` K Prateek Nayak
2024-12-13 14:57 ` Shrikanth Hegde
2024-12-13 19:51 ` K Prateek Nayak
2024-12-11 18:55 ` [RFC PATCH 8/8] sched/fair: Uncache asym_prefer_cpu and find it during update_sd_lb_stats() K Prateek Nayak
2024-12-13 15:02 ` Shrikanth Hegde
2024-12-13 20:00 ` K Prateek Nayak
2024-12-13 0:33 ` [PATCH 0/8] x86, sched: Dynamic ITMT core ranking support and some yak shaving Tim Chen
2024-12-13 4:12 ` K Prateek Nayak
2024-12-13 21:11 ` Tim Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=527d53cded892aea8f36b498ccd42f1bed0a347b.camel@linux.intel.com \
--to=tim.c.chen@linux.intel.com \
--cc=bp@alien8.de \
--cc=bsegall@google.com \
--cc=dave.hansen@linux.intel.com \
--cc=dietmar.eggemann@arm.com \
--cc=gautham.shenoy@amd.com \
--cc=hpa@zytor.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=li.meng@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rafael.j.wysocki@intel.com \
--cc=ray.huang@amd.com \
--cc=ricardo.neri-calderon@linux.intel.com \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.