History log of /linux-master/tools/power/x86/intel-speed-select/isst-daemon.c
Revision Date Author Comments
# 3bc0f20a 03-Oct-2023 Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>

tools/power/x86/intel-speed-select: Use cgroup isolate for CPU 0

From kernel version 6.5, CPU 0 hotplug capability is deprecated.
If some SST profile doesn't have CPU 0, then it is no longer possible to
offline CPU 0. This means that user space threads will still run on
CPU 0.

To workaround this issue, use cgroup v2 isolation feature. Whenever there
/sys/devices/system/cpu/cpu0/online file is absent or open fails, isolate
CPU 0 via CPU cgroup v2 isolation. Also add a command line option to
force even if the /sys/devices/system/cpu/cpu0/online is present.

The previous commit "01bcb56f059e ("tools/power/x86/intel-speed-select:
Prevent CPU 0 offline") was just warning about this issue based on the
kernel version 6.5 and above. With this new approach, instead of warning
take action to mitigate the issue.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>


# 997074df 22-Feb-2023 Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>

tools/power/x86/intel-speed-select: Use cgroup v2 isolation

On supported systems, it is possiible to isolate CPUs instead of
CPU online/offline. This is optional and can be specified using
-g option when running as daemon or in combination with -o option
for SST-PP level change.

CPU isolation doesn't isolate IRQs. So IRQs needs to be moved away
from isoolated CPUs. This can be done via IRQ sysfs or irqbalance daemon.

The IRQ balance daemon is also capable to parse thermal HFI messages to
move IRQs away from CPUS, which are supposed be isolated. But this
requires version released after July 2022.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>


# c77a8d4a 17-Aug-2022 Zhang Rui <rui.zhang@intel.com>

tools/power/x86/intel-speed-select: Rename for_each_online_package_in_set

for_each_online_package_in_set is actually used to invoke callback for
each power domain.
This is not a problem when there is a single power domain within a
package/die, but it does not reflect the truth in multi-punit case.

Rename for_each_online_package_in_set to
for_each_online_power_domain_in_set.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>


# b4edf385 17-Aug-2022 Zhang Rui <rui.zhang@intel.com>

tools/power/x86/intel-speed-select: Introduce support for multi-punit

New platforms may have more than 1 punit in a Package/Die, thus it can
have multiple power domains in a Package/Die. Package id and die id is not
sufficient to refer to a specific Power domain.

Introduce support for multi-punit per package/die.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
[srinivas.pandruvada@linux.intel.com: changelog edits]
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>


# 8a44d275 11-Jan-2023 Zhang Rui <rui.zhang@intel.com>

tools/power/x86/intel-speed-select: Remove duplicate dup()

Remove the duplicate dup() invocation.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>


# 364ba3b7 11-Jan-2023 Zhang Rui <rui.zhang@intel.com>

tools/power/x86/intel-speed-select: Handle open() failure case

Add handling for open() failure case to make sure a valid file
descriptor is passed to dup().

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>


# 3ba6a275 20-Aug-2022 Zhang Rui <rui.zhang@intel.com>

tools/power/x86/intel-speed-select: Enforce isst_id value

Enforce the pkg/die value in struct isst_id are either -1 or a valid
value.

This helps avoid inconsistent or redundant checks.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>


# 00bb07db 20-Aug-2022 Zhang Rui <rui.zhang@intel.com>

tools/power/x86/intel-speed-select: Introduce is_cpu_in_power_domain helper

struct isst_id contains cpu, package and die info, and it can represent
a specific SST power domain.

Introduce is_cpu_in_power_domain() helper to identify if a cpu is in a
specified power_domain.

And cleanup the code to use the new helper.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>


# 56d64692 20-Aug-2022 Zhang Rui <rui.zhang@intel.com>

tools/power/x86/intel-speed-select: Cleanup get_physical_id usage

struct isst_id already contains package and die id information, thus
there is no need to get the package and die id information, when struct
isst_id is already available.

Remove unneeded get_physical_package_id/get_physical_die_id usage.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>


# 850337ec 20-Aug-2022 Zhang Rui <rui.zhang@intel.com>

tools/power/x86/intel-speed-select: Introduce struct isst_id

SST control is power-domain based rather than cpu based, on all the
systems including Sapphire Rapids and ealier.

SST core APIs uses cpu id as parameter, and use the underlying pkg_id and
die_id information to find a power domain, this is not straight forward
and introduces obscure logics in the code.

Introduce struct isst_id to represent a SST Power Domain.

All core APIs are converted to use struct isst_id as parameter instead of
using cpu id.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>


# d9f74d98 18-Jul-2022 Dan Carpenter <dan.carpenter@oracle.com>

tools/power/x86/intel-speed-select: Fix off by one check

Change > MAX_DIE_PER_PACKAGE to >= MAX_DIE_PER_PACKAGE to prevent
accessing one element beyond the end of the array.

Fixes: 7fd786dfbd2c ("tools/power/x86/intel-speed-select: OOB daemon mode")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>


# 7d440da0 18-Jan-2022 Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>

tools/power/x86/intel-speed-select: HFI support

Read HFI (Hardware Feedback Interface) events to process config level
changes in oob mode. When HFI is supported there is no need for polling
to check config level change.

Subscribe to Linux thermal netlink messages and process message:
THERMAL_GENL_EVENT_CPU_CAPABILITY_CHANGE.
This message contains cpu number, performance and energy efficiency.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>


# 7fd786df 18-Jan-2022 Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>

tools/power/x86/intel-speed-select: OOB daemon mode

It is possible that some out of band agent changed config level. In this
case CPUs need to be online/offline to support this config change. Add
a command line option --oob, so that this tool can run as daemon and poll
for config level change and take action. The poll interval is configurable
in seconds using config option --poll-interval.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>