Re: [PATCH 3/8] x86/itmt: Move the "sched_itmt_enabled" sysctl to debugfs

From: K Prateek Nayak
Date: Thu Dec 12 2024 - 23:02:30 EST


Hello Tim,

Thank you for reviewing the series.

On 12/13/2024 12:45 AM, Tim Chen wrote:
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".

Turns out you can still use "1" and "0". Running:

echo Y > /sys/kernel/debug/sched/verbose
echo "sched_itmt_enabled: $(cat /sys/kernel/debug/x86/sched_itmt_enabled)";
for i in 0 1 N Y;
do
echo "Writing $i to /sys/kernel/debug/x86/sched_itmt_enabled";
echo $i > /sys/kernel/debug/x86/sched_itmt_enabled;
echo "sched_itmt_enabled: $(cat /sys/kernel/debug/x86/sched_itmt_enabled)";
echo "sched domain flags:";
cat /sys/kernel/debug/sched/domains/cpu0/domain*/flags;
echo;
done

Yields the following output on my system:

sched_itmt_enabled: Y

Writing 0 to /sys/kernel/debug/x86/sched_itmt_enabled
sched_itmt_enabled: N
sched domain flags:
SD_BALANCE_NEWIDLE SD_BALANCE_EXEC SD_BALANCE_FORK SD_WAKE_AFFINE SD_SHARE_CPUCAPACITY SD_SHARE_LLC SD_PREFER_SIBLING
SD_BALANCE_NEWIDLE SD_BALANCE_EXEC SD_BALANCE_FORK SD_WAKE_AFFINE SD_SHARE_LLC SD_PREFER_SIBLING
SD_BALANCE_NEWIDLE SD_BALANCE_EXEC SD_BALANCE_FORK SD_WAKE_AFFINE SD_PREFER_SIBLING

Writing 1 to /sys/kernel/debug/x86/sched_itmt_enabled
sched_itmt_enabled: Y
sched domain flags:
SD_BALANCE_NEWIDLE SD_BALANCE_EXEC SD_BALANCE_FORK SD_WAKE_AFFINE SD_SHARE_CPUCAPACITY SD_SHARE_LLC SD_PREFER_SIBLING
SD_BALANCE_NEWIDLE SD_BALANCE_EXEC SD_BALANCE_FORK SD_WAKE_AFFINE SD_SHARE_LLC SD_ASYM_PACKING SD_PREFER_SIBLING
SD_BALANCE_NEWIDLE SD_BALANCE_EXEC SD_BALANCE_FORK SD_WAKE_AFFINE SD_ASYM_PACKING SD_PREFER_SIBLING

Writing N to /sys/kernel/debug/x86/sched_itmt_enabled
sched_itmt_enabled: N
sched domain flags:
SD_BALANCE_NEWIDLE SD_BALANCE_EXEC SD_BALANCE_FORK SD_WAKE_AFFINE SD_SHARE_CPUCAPACITY SD_SHARE_LLC SD_PREFER_SIBLING
SD_BALANCE_NEWIDLE SD_BALANCE_EXEC SD_BALANCE_FORK SD_WAKE_AFFINE SD_SHARE_LLC SD_PREFER_SIBLING
SD_BALANCE_NEWIDLE SD_BALANCE_EXEC SD_BALANCE_FORK SD_WAKE_AFFINE SD_PREFER_SIBLING

Writing Y to /sys/kernel/debug/x86/sched_itmt_enabled
sched_itmt_enabled: Y
sched domain flags:
SD_BALANCE_NEWIDLE SD_BALANCE_EXEC SD_BALANCE_FORK SD_WAKE_AFFINE SD_SHARE_CPUCAPACITY SD_SHARE_LLC SD_PREFER_SIBLING
SD_BALANCE_NEWIDLE SD_BALANCE_EXEC SD_BALANCE_FORK SD_WAKE_AFFINE SD_SHARE_LLC SD_ASYM_PACKING SD_PREFER_SIBLING
SD_BALANCE_NEWIDLE SD_BALANCE_EXEC SD_BALANCE_FORK SD_WAKE_AFFINE SD_ASYM_PACKING SD_PREFER_SIBLING

Would you like me to extend that note as:

... 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. User can
either write "0" or "1" to toggle the feature off when enabled, or
"1" or "Y" to toggle the feature on when disabled.

for the record?


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@xxxxxxxxxxxxx>
Signed-off-by: K Prateek Nayak <kprateek.nayak@xxxxxxx>

Reviewed-by: Tim Chen <tim.c.chen@xxxxxxxxxxxxxxx>

Thank you.

--
Thanks and Regards,
Prateek


Tim

[..snip..]