From: Daniel Bristot de Oliveira <bristot@kernel.org>
To: tglozar@redhat.com, rostedt@goodmis.org
Cc: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org,
jkacur@redhat.com, jwyatt@redhat.com,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: Re: [PATCH 1/5] rtla: Add dependency on libcpupower
Date: Fri, 21 Jun 2024 10:46:12 +0200 [thread overview]
Message-ID: <4eca8d31-780b-46b5-a8ea-5ccc34370656@kernel.org> (raw)
In-Reply-To: <20240612145439.206990-2-tglozar@redhat.com>
Hi Thomas
On 6/12/24 16:54, tglozar@redhat.com wrote:
> From: Tomas Glozar <tglozar@redhat.com>
I think we can split this into two patches, this first part on tools/Build:
> Add a test for libcpupower into feature tests and use it to add a
> dependency on libcpupower to rtla.
>
> Signed-off-by: Tomas Glozar <tglozar@redhat.com>
> ---
> tools/build/Makefile.feature | 1 +
> tools/build/feature/Makefile | 4 ++++
> tools/build/feature/test-libcpupower.c | 8 ++++++++
> tools/tracing/rtla/Makefile | 2 ++
> tools/tracing/rtla/Makefile.config | 9 +++++++++
> 5 files changed, 24 insertions(+)
> create mode 100644 tools/build/feature/test-libcpupower.c
>
> diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
> index 1e2ab148d5db..e4fb0a1fbddf 100644
> --- a/tools/build/Makefile.feature
> +++ b/tools/build/Makefile.feature
> @@ -53,6 +53,7 @@ FEATURE_TESTS_BASIC := \
> libslang-include-subdir \
> libtraceevent \
> libtracefs \
> + libcpupower \
> libcrypto \
> libunwind \
> pthread-attr-setaffinity-np \
> diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> index ed54cef450f5..c93d62afc1e8 100644
> --- a/tools/build/feature/Makefile
> +++ b/tools/build/feature/Makefile
> @@ -38,6 +38,7 @@ FILES= \
> test-libslang.bin \
> test-libslang-include-subdir.bin \
> test-libtraceevent.bin \
> + test-libcpupower.bin \
> test-libtracefs.bin \
> test-libcrypto.bin \
> test-libunwind.bin \
> @@ -212,6 +213,9 @@ $(OUTPUT)test-libslang-include-subdir.bin:
> $(OUTPUT)test-libtraceevent.bin:
> $(BUILD) -ltraceevent
>
> +$(OUTPUT)test-libcpupower.bin:
> + $(BUILD) -lcpupower
> +
> $(OUTPUT)test-libtracefs.bin:
> $(BUILD) $(shell $(PKG_CONFIG) --cflags libtraceevent 2>/dev/null) -ltracefs
>
> diff --git a/tools/build/feature/test-libcpupower.c b/tools/build/feature/test-libcpupower.c
> new file mode 100644
> index 000000000000..a346aa332a71
> --- /dev/null
> +++ b/tools/build/feature/test-libcpupower.c
> @@ -0,0 +1,8 @@
> +// SPDX-License-Identifier: GPL-2.0
> +#include <cpuidle.h>
> +
> +int main(void)
> +{
> + int rv = cpuidle_state_count(0);
> + return rv;
> +}
> diff --git a/tools/tracing/rtla/Makefile b/tools/tracing/rtla/Makefile
> index b5878be36125..a6a7dee16622 100644
And this part for rtla:
> --- a/tools/tracing/rtla/Makefile
> +++ b/tools/tracing/rtla/Makefile
> @@ -32,8 +32,10 @@ DOCSRC := ../../../Documentation/tools/rtla/
>
> FEATURE_TESTS := libtraceevent
> FEATURE_TESTS += libtracefs
> +FEATURE_TESTS += libcpupower
> FEATURE_DISPLAY := libtraceevent
> FEATURE_DISPLAY += libtracefs
> +FEATURE_DISPLAY += libcpupower
>
> ifeq ($(V),1)
> Q =
> diff --git a/tools/tracing/rtla/Makefile.config b/tools/tracing/rtla/Makefile.config
> index 0b7ecfb30d19..8b6bc91e5dff 100644
> --- a/tools/tracing/rtla/Makefile.config
> +++ b/tools/tracing/rtla/Makefile.config
> @@ -42,6 +42,15 @@ else
> $(info libtracefs is missing. Please install libtracefs-dev/libtracefs-devel)
> endif
>
> +$(call feature_check,libcpupower)
> +ifeq ($(feature-libcpupower), 1)
> + $(call detected,CONFIG_LIBCPUPOWER)
> + $(call lib_setup,cpupower)
> +else
Also, it is better to make it optional: if the system has this library,
set a CONFIG_HAS_LIBCPUPOWER, otherwise no..
> + STOP_ERROR := 1
> + $(info libcpupower is missing. Please install libcpupower-dev/kernel-tools-libs-devel)
> +endif
Then, place your code inside this option. If the option is called
but the tool was not compiled with CONFIG_HAS_LIBCPUPOWER, just
complain saying that the option is not supported because it was
compiled without it. Then put this info there, to compile
with these options enabled.
> ifeq ($(STOP_ERROR),1)
> $(error Please, check the errors above.)
> endif
next prev parent reply other threads:[~2024-06-21 8:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-12 14:54 [PATCH 0/5] rtla: Support idle state disabling via libcpupower in timerlat tglozar
2024-06-12 14:54 ` [PATCH 1/5] rtla: Add dependency on libcpupower tglozar
2024-06-21 8:46 ` Daniel Bristot de Oliveira [this message]
2024-06-12 14:54 ` [PATCH 2/5] rtla/utils: Add idle state disabling via libcpupower tglozar
2024-06-21 8:46 ` Daniel Bristot de Oliveira
2024-06-12 14:54 ` [PATCH 3/5] rtla/timerlat: Add --disable-idle-states for top tglozar
2024-06-21 8:45 ` Daniel Bristot de Oliveira
2024-06-12 14:54 ` [PATCH 4/5] rtla/timerlat: Add --disable-idle-states for hist tglozar
2024-06-12 14:54 ` [PATCH 5/5] rtla: Documentation: Add --disable-idle-states tglozar
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=4eca8d31-780b-46b5-a8ea-5ccc34370656@kernel.org \
--to=bristot@kernel.org \
--cc=acme@redhat.com \
--cc=jkacur@redhat.com \
--cc=jwyatt@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglozar@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).