From patchwork Tue Jun 25 21:10:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 13712045 X-Patchwork-Delegate: rjw@sisk.pl Received: from mail-oa1-f43.google.com (mail-oa1-f43.google.com [209.85.160.43]) (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 05E7917C7D4 for ; Tue, 25 Jun 2024 21:10:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719349844; cv=none; b=r0xgrp3bd9xmFYBsdMfLCtD5SVx+KSxmUF7tQjm4w2y4rhT1wXthc+mb8JQJOPMdEUg9nCr6emxLTc+LBXARE614AuxB1PO8qohmfB+UleT2uhx5DbUEzhx34NmgwTzGWRQpfb5/hwlZaAZbBm2vAI/X8htwDNYtuV9KH8zslWU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719349844; c=relaxed/simple; bh=23euvhMpa7aIhAcnlu8ODx3P8PmL8xAx89c9wz5fC9g=; h=Content-Type:Message-ID:Date:MIME-Version:To:Cc:From:Subject; b=XDoQMBYalw+njPESiquYfsnZga154D5tb6u+zNs7XkKu6xDNc6mBsCzEglYOs70btqcH7h2Fviq/g3fw7XrvctvRW73AumQoPidOok9llL52fOxqDf/7QCPDL8Pxin2jWKgj7TyL2FoZga9py8nCuJs4KIq2RUSJ5mA3OO3rU1o= 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=LM0UjDcB; arc=none smtp.client-ip=209.85.160.43 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="LM0UjDcB" Received: by mail-oa1-f43.google.com with SMTP id 586e51a60fabf-25075f3f472so721596fac.2 for ; Tue, 25 Jun 2024 14:10:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1719349841; x=1719954641; 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=APsFziXzSz6SZbwCI6arhF2aYWamXlyA8hHZ4D9nlWw=; b=LM0UjDcBUc72hIGy1Su4hbDj0Z81L3CxzsF/lvLGS72E4kJHo+OEPyqcYhSbuH6i3E rWmctn2if4tUfi/9Pn1tZ1tWDAjCLLUgYlDAxe18OOBX6a+KYqHMq33L6DPLChtLyuZ5 w9CkQF9lBartYzzqmh6M+ZJSmQ5OxCaaTEMG8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719349841; x=1719954641; 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=APsFziXzSz6SZbwCI6arhF2aYWamXlyA8hHZ4D9nlWw=; b=RSfWAUm4x6uQlMybT/jdpCW6m51bi9ky50Vl3+wiSbadapsrtNRNS36I5l2OR6HmiE yoWcnFESFJnlt/vgFJhwzHIOctiK/qxoSwFHqogXFyrZzBv1IvtJro+J8wljEmbtJPHN mzCwhe2ZGqneQ/XctJuTwJrquwi9u3VfX+FMa2QFoVZAO58GoDzRZbH7raJ9TUPllPOa ymZG4KP0bMW4PT/Ms5QHgaE/OJBUKrgK114ygy1NDIDNooizmxNFxqtKWoFg0tFyZDkV AeJ2CtllZcBsIFwkjjjle9AuHXEreJ4XEHzyAFdSMK/MS0vpEyDgk0Z8ndGUWR7zqvTW vpRw== X-Forwarded-Encrypted: i=1; AJvYcCW8fuBZ645fwPECMpPLR2OzaDCk72eXgTJtHOmZtnRsEVjMhStJJfTwvsw3KKm8uqdnpQIiTbK+VPZmsODReJeeSmO582y10SA= X-Gm-Message-State: AOJu0YxVSytZqc8EuqoSsuOchwry5txryycPksugY1OAGLX4rMTiDQM0 T+OFz+XMpDw4yWHsYb0BT+HlkFNFcq5FtKnUQ1+i9JaRxvfWs7JJWePFJ5sh6Wg= X-Google-Smtp-Source: AGHT+IEtN1j9U0ioY9INzr3vfnyCjvG2Yo0vrFUPopN3Q+P+L6Rn65eXXyT9Fwq3em441BokpmIW4w== X-Received: by 2002:a05:6870:5587:b0:258:476d:a781 with SMTP id 586e51a60fabf-25cf02d87f7mr9973479fac.3.1719349841053; Tue, 25 Jun 2024 14:10:41 -0700 (PDT) Received: from [192.168.1.128] ([38.175.170.29]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-25cd49d18c1sm2658893fac.28.2024.06.25.14.10.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 25 Jun 2024 14:10:40 -0700 (PDT) Message-ID: Date: Tue, 25 Jun 2024 15:10:39 -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: trenn@suse.de, shuah , Shuah Khan , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org From: Shuah Khan Subject: [GIT PULL] cpupower update for Linux 6.11-rc1 Hi Rafael, Please pull the following cpupower update for Linux 6.11-rc1. This cpupower update for Linux 6.11-rc1 consists of cleanups to man pages, README files, and enhancements to add help to Makefile. diff is attached. thanks, -- Shuah ---------------------------------------------------------------- The following changes since commit 43cad521c6d228ea0c51e248f8e5b3a6295a2849: tools/power/cpupower: Fix Pstate frequency reporting on AMD Family 1Ah CPUs (2024-05-28 09:22:57 -0600) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux tags/linux-cpupower-6.11-rc1 for you to fetch changes up to 3e1f12c26646eb0ad67d3eaefd32f765997da6a8: cpupower: Change the var type of the 'monitor' subcommand display mode (2024-06-20 10:08:08 -0600) ---------------------------------------------------------------- linux-cpupower-6.11-rc1 This cpupower update for Linux 6.11-rc1 consists of cleanups to man pages, README files, and enhancements to add help to Makefile. ---------------------------------------------------------------- Roman Storozhenko (5): cpupower: Replace a dead reference link with working ones cpupower: Add 'help' target to the main Makefile cpupower: Improve cpupower build process description cpupower: Remove absent 'v' parameter from monitor man page cpupower: Change the var type of the 'monitor' subcommand display mode tools/power/cpupower/Makefile | 37 ++++- tools/power/cpupower/README | 160 +++++++++++++++++++-- tools/power/cpupower/man/cpupower-monitor.1 | 13 +- .../cpupower/utils/idle_monitor/cpupower-monitor.c | 2 +- 4 files changed, 192 insertions(+), 20 deletions(-) ---------------------------------------------------------------- diff --git a/tools/power/cpupower/Makefile b/tools/power/cpupower/Makefile index b53753dee02f..cd0225a312b4 100644 --- a/tools/power/cpupower/Makefile +++ b/tools/power/cpupower/Makefile @@ -332,4 +332,39 @@ uninstall: rm -f $(DESTDIR)${localedir}/$$HLANG/LC_MESSAGES/cpupower.mo; \ done; -.PHONY: all utils libcpupower update-po create-gmo install-lib install-tools install-man install-gmo install uninstall clean +help: + @echo 'Building targets:' + @echo ' all - Default target. Could be omitted. Put build artifacts' + @echo ' to "O" cmdline option dir (default: current dir)' + @echo ' install - Install previously built project files from the output' + @echo ' dir defined by "O" cmdline option (default: current dir)' + @echo ' to the install dir defined by "DESTDIR" cmdline or' + @echo ' Makefile config block option (default: "")' + @echo ' install-lib - Install previously built library binary from the output' + @echo ' dir defined by "O" cmdline option (default: current dir)' + @echo ' and library headers from "lib/" for userspace to the install' + @echo ' dir defined by "DESTDIR" cmdline (default: "")' + @echo ' install-tools - Install previously built "cpupower" util from the output' + @echo ' dir defined by "O" cmdline option (default: current dir) and' + @echo ' "cpupower-completion.sh" script from the src dir to the' + @echo ' install dir defined by "DESTDIR" cmdline or Makefile' + @echo ' config block option (default: "")' + @echo ' install-man - Install man pages from the "man" src subdir to the' + @echo ' install dir defined by "DESTDIR" cmdline or Makefile' + @echo ' config block option (default: "")' + @echo ' install-gmo - Install previously built language files from the output' + @echo ' dir defined by "O" cmdline option (default: current dir)' + @echo ' to the install dir defined by "DESTDIR" cmdline or Makefile' + @echo ' config block option (default: "")' + @echo ' install-bench - Install previously built "cpufreq-bench" util files from the' + @echo ' output dir defined by "O" cmdline option (default: current dir)' + @echo ' to the install dir defined by "DESTDIR" cmdline or Makefile' + @echo ' config block option (default: "")' + @echo '' + @echo 'Cleaning targets:' + @echo ' clean - Clean build artifacts from the dir defined by "O" cmdline' + @echo ' option (default: current dir)' + @echo ' uninstall - Remove previously installed files from the dir defined by "DESTDIR"' + @echo ' cmdline or Makefile config block option (default: "")' + +.PHONY: all utils libcpupower update-po create-gmo install-lib install-tools install-man install-gmo install uninstall clean help diff --git a/tools/power/cpupower/README b/tools/power/cpupower/README index 1c68f47663b2..2678ed81d311 100644 --- a/tools/power/cpupower/README +++ b/tools/power/cpupower/README @@ -22,16 +22,156 @@ interfaces [depending on configuration, see below]. compilation and installation ---------------------------- -make -su -make install - -should suffice on most systems. It builds libcpupower to put in -/usr/lib; cpupower, cpufreq-bench_plot.sh to put in /usr/bin; and -cpufreq-bench to put in /usr/sbin. If you want to set up the paths -differently and/or want to configure the package to your specific -needs, you need to open "Makefile" with an editor of your choice and -edit the block marked CONFIGURATION. +There are 2 output directories - one for the build output and another for +the installation of the build results, that is the utility, library, +man pages, etc... + +default directory +----------------- + +In the case of default directory, build and install process requires no +additional parameters: + +build +----- + +$ make + +The output directory for the 'make' command is the current directory and +its subdirs in the kernel tree: +tools/power/cpupower + +install +------- + +$ sudo make install + +'make install' command puts targets to default system dirs: + +----------------------------------------------------------------------- +| Installing file | System dir | +----------------------------------------------------------------------- +| libcpupower | /usr/lib | +----------------------------------------------------------------------- +| cpupower | /usr/bin | +----------------------------------------------------------------------- +| cpufreq-bench_plot.sh | /usr/bin | +----------------------------------------------------------------------- +| man pages | /usr/man | +----------------------------------------------------------------------- + +To put it in other words it makes build results available system-wide, +enabling any user to simply start using it without any additional steps + +custom directory +---------------- + +There are 2 make's command-line variables 'O' and 'DESTDIR' that setup +appropriate dirs: +'O' - build directory +'DESTDIR' - installation directory. This variable could also be setup in +the 'CONFIGURATION' block of the "Makefile" + +build +----- + +$ make O= + +Example: +$ make O=/home/hedin/prj/cpupower/build + +install +------- + +$ make O= DESTDIR= + +Example: +$ make O=/home/hedin/prj/cpupower/build DESTDIR=/home/hedin/prj/cpupower \ +> install + +Notice that both variables 'O' and 'DESTDIR' have been provided. The reason +is that the build results are saved in the custom output dir defined by 'O' +variable. So, this dir is the source for the installation step. If only +'DESTDIR' were provided then the 'install' target would assume that the +build directory is the current one, build everything there and install +from the current dir. + +The files will be installed to the following dirs: + +----------------------------------------------------------------------- +| Installing file | System dir | +----------------------------------------------------------------------- +| libcpupower | ${DESTDIR}/usr/lib | +----------------------------------------------------------------------- +| cpupower | ${DESTDIR}/usr/bin | +----------------------------------------------------------------------- +| cpufreq-bench_plot.sh | ${DESTDIR}/usr/bin | +----------------------------------------------------------------------- +| man pages | ${DESTDIR}/usr/man | +----------------------------------------------------------------------- + +If you look at the table for the default 'make' output dirs you will +notice that the only difference with the non-default case is the +${DESTDIR} prefix. So, the structure of the output dirs remains the same +regardles of the root output directory. + + +clean and uninstall +------------------- + +'clean' target is intended for cleanup the build catalog from build results +'uninstall' target is intended for removing installed files from the +installation directory + +default directory +----------------- + +This case is a straightforward one: +$ make clean +$ make uninstall + +custom directory +---------------- + +Use 'O' command line variable to remove previously built files from the +build dir: +$ make O= clean + +Example: +$ make O=/home/hedin/prj/cpupower/build clean + +Use 'DESTDIR' command line variable to uninstall previously installed files +from the given dir: +$ make DESTDIR= + +Example: +make DESTDIR=/home/hedin/prj/cpupower uninstall + + +running the tool +---------------- + +default directory +----------------- + +$ sudo cpupower + +custom directory +---------------- + +When it comes to run the utility from the custom build catalog things +become a little bit complicated as 'just run' approach doesn't work. +Assuming that the current dir is '/usr', +issuing the following command: + +$ sudo ./bin/cpupower +will produce the following error output: +./bin/cpupower: error while loading shared libraries: libcpupower.so.1: +cannot open shared object file: No such file or directory + +The issue is that binary cannot find the 'libcpupower' library. So, we +shall point to the lib dir: +sudo LD_LIBRARY_PATH=lib64/ ./bin/cpupower THANKS diff --git a/tools/power/cpupower/man/cpupower-monitor.1 b/tools/power/cpupower/man/cpupower-monitor.1 index 8ee737eefa5c..89af019f8dc4 100644 --- a/tools/power/cpupower/man/cpupower-monitor.1 +++ b/tools/power/cpupower/man/cpupower-monitor.1 @@ -81,11 +81,6 @@ Measure idle and frequency characteristics of an arbitrary command/workload. The executable \fBcommand\fP is forked and upon its exit, statistics gathered since it was forked are displayed. .RE -.PP -\-v -.RS 4 -Increase verbosity if the binary was compiled with the DEBUG option set. -.RE .SH MONITOR DESCRIPTIONS .SS "Idle_Stats" @@ -172,9 +167,11 @@ displayed. "BIOS and Kernel Developer’s Guide (BKDG) for AMD Family 14h Processors" https://support.amd.com/us/Processor_TechDocs/43170.pdf -"Intel® Turbo Boost Technology -in Intel® Core™ Microarchitecture (Nehalem) Based Processors" -http://download.intel.com/design/processor/applnots/320354.pdf +"What Is Intel® Turbo Boost Technology?" +https://www.intel.com/content/www/us/en/gaming/resources/turbo-boost.html + +"Power Management - Technology Overview" +https://cdrdv2.intel.com/v1/dl/getContent/637748 "Intel® 64 and IA-32 Architectures Software Developer's Manual Volume 3B: System Programming Guide" diff --git a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c index 075e766ff1f3..f746099b5dac 100644 --- a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c +++ b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c @@ -35,7 +35,7 @@ static unsigned int avail_monitors; static char *progname; enum operation_mode_e { list = 1, show, show_all }; -static int mode; +static enum operation_mode_e mode; static int interval = 1; static char *show_monitors_param; static struct cpupower_topology cpu_top;