From patchwork Fri Oct 11 22:45:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 13833227 X-Patchwork-Delegate: rjw@sisk.pl Received: from mail-io1-f41.google.com (mail-io1-f41.google.com [209.85.166.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F02F019C57B for ; Fri, 11 Oct 2024 22:45:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728686735; cv=none; b=Z3q0MkLdn3xiQDT8IUri9dDymPiDAtQVLSBE102kDwnyXwHeygHXxlvZOSHdlnOtp01GlF2qFPINVPmTZeOywcpsgvLtV+WOBq8pWtQEKNJp8Zkw09dK2YR2xEgdeVikziVgP4vDsubPJp5RqO9VK+xAJ0Ie8l4B1L7zulT7/kI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728686735; c=relaxed/simple; bh=/FCMJGhOBfP132WERQgPWBap1EBlAXz7hyzXJiCYGis=; h=Content-Type:Message-ID:Date:MIME-Version:To:Cc:From:Subject; b=YoEulYdA8eF+IsDb+SSG6pNregNxPbK1GvNPDoYxsF5oG8ZWmr8pTk+0NSUxfN9RfIFLi31VGqYiPqK//QS+jnxvUZfLzfZiecJrAK77e4CdZqm/EUbG6P3j2eReVycTe6g/uxxRqfjzIasH5L8qS6VDHh/P1vZO5W37liM2yIo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=GSO5hoDQ; arc=none smtp.client-ip=209.85.166.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="GSO5hoDQ" Received: by mail-io1-f41.google.com with SMTP id ca18e2360f4ac-8354845c5dcso108407439f.0 for ; Fri, 11 Oct 2024 15:45:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1728686732; x=1729291532; darn=vger.kernel.org; h=subject:from:cc:to:content-language:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=paqn3xTVQkV0dR0d3F3PxlflGx0zg9ykGS3xLNtyB1w=; b=GSO5hoDQ8wVEBKSb2FNiKJcgiGfu6UKTLpsFfyXtbLL4sC/wvkGtbuyVz5tKaOyjwu XQV0j2dJPuUPnX7FI/9eirXzvGwta7hfwwha6wklA/juLkyCDLQFLL0Q1u08of0lLlPF 5zWJ4er53RX1n/zATNBgZgzFfDwpHjmnJ75cg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728686732; x=1729291532; h=subject:from:cc:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=paqn3xTVQkV0dR0d3F3PxlflGx0zg9ykGS3xLNtyB1w=; b=LAqEAYQ2KgLKMUMqAKJpoOzgthvWoDO2bCusqQCJ7GfVshLsLgO4EG2rq+SWZvrdPE 1FUH/mzFefISx1gLgT3kAobzdW62/ilSUrMtGBeIEAjqGaum/T8GkAA+Q+eT/rQ0lqSZ bWJNBtwRQU0X4S8f7GZL5gbgJ0QiUDO7NxxmGwFLcalgjRMnQBGcs0FjGM6qhvLGPy85 8gKsUkwpAcR/Dn19diuORS44BtNG8Mq+cTlL5Ly+FLLZzCY4ygcFLkuq1jY+n5t1twM7 Ddw9QnIaT5zhM7Bc2xWm2VTpNBhTqe9+47K0uUXhD8LVr9MtA0QcMck1vm0ILNkHGCYy HSnQ== X-Forwarded-Encrypted: i=1; AJvYcCV+dv6f19JVJ3/jvUHNy/k2qQbsjMUv/cY20ILFC8gz+gxbOdVPVA967pHlDLnsphQKxA2q5suEUQ==@vger.kernel.org X-Gm-Message-State: AOJu0YysfgnzSLDNfhmokkaPBTiRxqygNBmKB6HJ+YSzByYE7ycc0MpG MCfBQ0wSRhpWS8jWe/B4y59ihXjmi+kvOryKd7qDdROFlTIvS07mBzx4ObmpTr0= X-Google-Smtp-Source: AGHT+IF7PSfdpqbIiRfpxg6gV+wwdRwz/dWnWtMDLBn7hMhq8bKUWJh4Og56tdMNtLsFa7j2abtBOQ== X-Received: by 2002:a92:cda1:0:b0:3a3:a7bf:7f85 with SMTP id e9e14a558f8ab-3a3b5f1b9c5mr27561195ab.5.1728686731866; Fri, 11 Oct 2024 15:45:31 -0700 (PDT) Received: from [192.168.1.128] ([38.175.170.29]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a3afdae18esm9097875ab.6.2024.10.11.15.45.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 11 Oct 2024 15:45:31 -0700 (PDT) Message-ID: Date: Fri, 11 Oct 2024 16:45:30 -0600 Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: "Rafael J. Wysocki" Cc: Shuah Khan , shuah , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org From: Shuah Khan Subject: [GIT PULL] cpupower update for Linux 6.13-rc1 Hi Rafael, Please pull the following cpupower update for Linux 6.13-rc1. This cpupower update for Linux 6.13-rc1 consists of changes to: -- bindings: - add generated files to gitignore - improve disable c_state block - new test to confirm cpu state is disabled -- bench: - print config file path when open cpufreq-bench.conf fails -- Makefile - override cross-compiling env params to make it easier for builds in Yocto environment. -- add documentation for new EPP value change, amd_pstate mode change, and turbo-boost features. diff is attached. Sending it early to get the Yacto build available in next. thanks, -- Shuah ---------------------------------------------------------------- The following changes since commit 9852d85ec9d492ebef56dc5f229416c925758edc: Linux 6.12-rc1 (2024-09-29 15:06:19 -0700) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux tags/linux-cpupower-6.13-rc1 for you to fetch changes up to b6a2dbf88aa793a288f77e0eddb395f79594908f: pm: cpupower: bindings: Add test to confirm cpu state is disabled (2024-10-02 14:50:23 -0600) ---------------------------------------------------------------- linux-cpupower-6.13-rc1 This cpupower update for Linux 6.13-rc1 consists of changes to: -- bindings: - add generated files to gitignore - improve disable c_state block - new test to confirm cpu state is disabled -- bench: - print config file path when open cpufreq-bench.conf fails -- Makefile - override cross-compiling env params to make it easier for builds in Yocto environment. -- add documentation for new EPP value change, amd_pstate mode change, and turbo-boost features. ---------------------------------------------------------------- John B. Wyatt IV (3): pm: cpupower: gitignore: Add compile_commands.json pm: cpupower: bindings: Improve disable c_state block pm: cpupower: bindings: Add test to confirm cpu state is disabled Peng Fan (2): pm: cpupower: bench: print config file path when open cpufreq-bench.conf fails pm: cpupower: Makefile: Allow overriding cross-compiling env params Tor Vic (1): tools/power/cpupower: Add documentation for some recently introduced options tools/power/cpupower/.gitignore | 3 ++ tools/power/cpupower/Makefile | 12 +++---- tools/power/cpupower/bench/parse.c | 5 +-- .../bindings/python/test_raw_pylibcpupower.py | 28 ++++++++++++---- tools/power/cpupower/man/cpupower-set.1 | 38 ++++++++++++++++++++-- 5 files changed, 70 insertions(+), 16 deletions(-) ---------------------------------------------------------------- diff --git a/tools/power/cpupower/.gitignore b/tools/power/cpupower/.gitignore index 7677329c42a6..5113d5a7aee0 100644 --- a/tools/power/cpupower/.gitignore +++ b/tools/power/cpupower/.gitignore @@ -27,3 +27,6 @@ debug/i386/intel_gsic debug/i386/powernow-k8-decode debug/x86_64/centrino-decode debug/x86_64/powernow-k8-decode + +# Clang's compilation database file +compile_commands.json diff --git a/tools/power/cpupower/Makefile b/tools/power/cpupower/Makefile index 6c02f401069e..e2a48af6fa2a 100644 --- a/tools/power/cpupower/Makefile +++ b/tools/power/cpupower/Makefile @@ -86,12 +86,12 @@ INSTALL_SCRIPT = ${INSTALL} -m 644 # If you are running a cross compiler, you may want to set this # to something more interesting, like "arm-linux-". If you want # to compile vs uClibc, that can be done here as well. -CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc- -CC = $(CROSS)gcc -LD = $(CROSS)gcc -AR = $(CROSS)ar -STRIP = $(CROSS)strip -RANLIB = $(CROSS)ranlib +CROSS ?= #/usr/i386-linux-uclibc/usr/bin/i386-uclibc- +CC ?= $(CROSS)gcc +LD ?= $(CROSS)gcc +AR ?= $(CROSS)ar +STRIP ?= $(CROSS)strip +RANLIB ?= $(CROSS)ranlib HOSTCC = gcc MKDIR = mkdir diff --git a/tools/power/cpupower/bench/parse.c b/tools/power/cpupower/bench/parse.c index e63dc11fa3a5..080678d9d74e 100644 --- a/tools/power/cpupower/bench/parse.c +++ b/tools/power/cpupower/bench/parse.c @@ -4,6 +4,7 @@ * Copyright (C) 2008 Christian Kornacker */ +#include #include #include #include @@ -165,8 +166,8 @@ int prepare_config(const char *path, struct config *config) configfile = fopen(path, "r"); if (configfile == NULL) { - perror("fopen"); - fprintf(stderr, "error: unable to read configfile\n"); + fprintf(stderr, "error: unable to read configfile: %s, %s\n", + path, strerror(errno)); free(config); return 1; } diff --git a/tools/power/cpupower/bindings/python/test_raw_pylibcpupower.py b/tools/power/cpupower/bindings/python/test_raw_pylibcpupower.py index 3d6f62b9556a..ca5aa46c9b20 100755 --- a/tools/power/cpupower/bindings/python/test_raw_pylibcpupower.py +++ b/tools/power/cpupower/bindings/python/test_raw_pylibcpupower.py @@ -15,22 +15,38 @@ else: print(f"cstate count error: return code: {cpu_cstates_count}") """ -Disable cstate (will fail if the above is 0, ex: a virtual machine) +Disable cstate (will fail if the above returns is under 1, ex: a virtual machine) """ cstate_disabled = p.cpuidle_state_disable(0, 0, 1) -if cpu_cstates_count == 0: - print(f"CPU 0 has {cpu_cstates_count} c-states") -else: - print(f"cstate count error: return code: {cpu_cstates_count}") match cstate_disabled: case 0: print(f"CPU state disabled") case -1: print(f"Idlestate not available") + case -2: + print(f"Disabling is not supported by the kernel") + case -3: + print(f"No write access to disable/enable C-states: try using sudo") case _: - print(f"Not documented") + print(f"Not documented: {cstate_disabled}") + +""" +Test cstate is disabled +""" +is_cstate_disabled = p.cpuidle_is_state_disabled(0, 0) +match is_cstate_disabled: + case 1: + print(f"CPU is disabled") + case 0: + print(f"CPU is enabled") + case -1: + print(f"Idlestate not available") + case -2: + print(f"Disabling is not supported by kernel") + case _: + print(f"Not documented: {is_cstate_disabled}") # Pointer example diff --git a/tools/power/cpupower/man/cpupower-set.1 b/tools/power/cpupower/man/cpupower-set.1 index 2bcc696f4496..500653ef98c7 100644 --- a/tools/power/cpupower/man/cpupower-set.1 +++ b/tools/power/cpupower/man/cpupower-set.1 @@ -3,7 +3,7 @@ cpupower\-set \- Set processor power related kernel or hardware configurations .SH SYNOPSIS .ft B -.B cpupower set [ \-b VAL ] +.B cpupower set [ \-b VAL | \-e POLICY | \-m MODE | \-t BOOL ] .SH DESCRIPTION @@ -19,7 +19,7 @@ described in the Options sections. Use \fBcpupower info \fP to read out current settings and whether they are supported on the system at all. -.SH Options +.SH OPTIONS .PP \-\-perf-bias, \-b .RS 4 @@ -56,6 +56,40 @@ Use \fBcpupower -c all info -b\fP to verify. This options needs the msr kernel driver (CONFIG_X86_MSR) loaded. .RE +.PP +\-\-epp, \-e +.RS 4 +Sets the energy performance policy preference on supported Intel or AMD +processors which use the Intel or AMD P-State cpufreq driver respectively. + +Available policies can be found with +\fBcat /sys/devices/system/cpu/cpufreq/policy0/energy_performance_available_preferences\fP : +.RS 4 +default performance balance_performance balance_power power +.RE + +.RE + +.PP +\-\-amd\-pstate\-mode, \-m +.RS 4 +Sets the AMD P-State mode for supported AMD processors. +Available modes are "active", "guided" or "passive". + +Refer to the AMD P-State kernel documentation for further information. + +.RE + +.PP +\-\-turbo\-boost, \-t +.RS 4 +This option is used to enable or disable the turbo boost feature on +supported Intel and AMD processors. + +This option takes as parameter either \fB1\fP to enable, or \fB0\fP to disable the feature. + +.RE + .SH "SEE ALSO" cpupower-info(1), cpupower-monitor(1), powertop(1) .PP