From nobody Sun Feb 8 14:15:08 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0CD071A7F8E for ; Wed, 31 Jul 2024 08:38:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722415129; cv=none; b=plmjsK3RLEwBeB3bjlC1Hef8yET7HAGFjz0QH2h2OHdv+Q5AOJRnFi2u6utwbkoi1anAwBqpPpUnhNmHtXocOyAXP8Dxr3JjW3kQcVy1X6x0yBUPBAXXlDpP4dlX6bft5XgR4HzWvdCmel/xWcKWQQ9xb4Lz9MiIF6Avr5wZSXw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722415129; c=relaxed/simple; bh=a0cdYEUD5oq5HcwAOKRBad0IN2/8nMfvuKyFag1tFvc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fk03V3JUmIDd6KOihYS0fA7tFS9FPn2dZgmp7YeNFg517Fe8NtNHo4uOrMklzlPE9JVTPUGEAnl+KXudgAMiw9O9M4Hy9a0xyi0DX+T1/PPqzve1Vgrrfu88wBmsxd7ho4DiT6ssNJcgdlOYHTywbSSNFM93pdKFC574FMlGC0E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=BSAMpE2T; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="BSAMpE2T" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722415126; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OIStciBh0Hb4EArNcfK9qlAuqUz7MQEBahYgq8BR7mM=; b=BSAMpE2TJUBcQKifcNQcN08pni7nxlWDnKnvyNvr5/25wDGH6fsrzmwwm0G5kYyY3oIfsW 7kf5e6pnAtjHUyCDZ1K5ag1O0Tj9zwwVh7vCaI74v9hjJF7TbyPgMFIK9ZJIuNskjqyuPt Xc6baqRJYOvZRLOIavy8NAProOfBjFg= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-134-urKv-3ifMD-FXKRfskTbAQ-1; Wed, 31 Jul 2024 04:38:45 -0400 X-MC-Unique: urKv-3ifMD-FXKRfskTbAQ-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 435611955D52; Wed, 31 Jul 2024 08:38:44 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.224.159]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B3354300018D; Wed, 31 Jul 2024 08:38:41 +0000 (UTC) From: tglozar@redhat.com To: rostedt@goodmis.org Cc: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, jwyatt@redhat.com, jkacur@redhat.com, Tomas Glozar Subject: [PATCH v2 1/6] tools/build: Add libcpupower dependency detection Date: Wed, 31 Jul 2024 10:36:50 +0200 Message-ID: <20240731083655.375293-2-tglozar@redhat.com> In-Reply-To: <20240731083655.375293-1-tglozar@redhat.com> References: <20240731083655.375293-1-tglozar@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Content-Type: text/plain; charset="utf-8" From: Tomas Glozar Add the ability to detect the presence of libcpupower on a system to the Makefiles in tools/build. Signed-off-by: Tomas Glozar --- tools/build/Makefile.feature | 1 + tools/build/feature/Makefile | 4 ++++ 2 files changed, 5 insertions(+) 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 :=3D \ 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 489cbed7e82a..c4a78333660b 100644 --- a/tools/build/feature/Makefile +++ b/tools/build/feature/Makefile @@ -38,6 +38,7 @@ FILES=3D \ 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 =20 +$(OUTPUT)test-libcpupower.bin: + $(BUILD) -lcpupower + $(OUTPUT)test-libtracefs.bin: $(BUILD) $(shell $(PKG_CONFIG) --cflags libtracefs 2>/dev/null) -ltracefs =20 --=20 2.45.2 From nobody Sun Feb 8 14:15:08 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E972C1AAE09 for ; Wed, 31 Jul 2024 08:38:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722415134; cv=none; b=u6MzuVWWUWTAP/S448aUBawe+P2IoyzQ4ix5yjRE3dhfu3Ropsz0YELrlAoNufrbZxEEZoY1VKkoCHF4SKqjeSzEkk1JRymkENcjQmzSmzdpTKQOgfZ88q9hCEKQgp4BH9lT0vSPFiFffQNdPuxAmg8KaKoDTY7xAKk32LuCcX0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722415134; c=relaxed/simple; bh=SNnmaZWZSesD1HHdjWhBfQ/u18uVuUHZSVM/CftU7NI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qmsLmuPJnQK6Z+O0ZNoQtpdzQxqO8hHQ6cBnu4ARSEoBE9+w4pmVxwHjhf4bISL4NcV9JpohlDcVS1mWCToRA00Y5T95ZvKI3Yxf4T0A7U89s4y1mEfrwDZiBKdBvNuPqfhaFzH2DoyI07zAXadTwHhLj+Vpw8dRQPmeGSh2JGw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=NKQSaJdP; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="NKQSaJdP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722415132; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=euVPAeiK79HRHlEijQ4/F/EhIOg5KZghP8qBWTpkszQ=; b=NKQSaJdP4DKy4Xeq4YlcpcxQgX+LPlkGh+kHcqPKfZzEKdVKcErxDeti9E/384Tqos1SNP 41/Nrdl8+vZMvRYogHgVbx+nyglm9tzGakydC89fD44Ft48fPzRnbTFeNemqMccoLo+QSX 9rbfp0K5YJCY39fbT33B1poKSUhA5Xc= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-194-O_vUZZ3QPIiH_xEg5oTzIQ-1; Wed, 31 Jul 2024 04:38:47 -0400 X-MC-Unique: O_vUZZ3QPIiH_xEg5oTzIQ-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D4EB81955D4E; Wed, 31 Jul 2024 08:38:46 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.224.159]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 96F15300018D; Wed, 31 Jul 2024 08:38:44 +0000 (UTC) From: tglozar@redhat.com To: rostedt@goodmis.org Cc: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, jwyatt@redhat.com, jkacur@redhat.com, Tomas Glozar Subject: [PATCH v2 2/6] rtla: Add optional dependency on libcpupower Date: Wed, 31 Jul 2024 10:36:51 +0200 Message-ID: <20240731083655.375293-3-tglozar@redhat.com> In-Reply-To: <20240731083655.375293-1-tglozar@redhat.com> References: <20240731083655.375293-1-tglozar@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Content-Type: text/plain; charset="utf-8" From: Tomas Glozar If libcpupower is present, set HAVE_LIBCPUPOWER_SUPPORT macro to allow features depending on libcpupower in rtla. Signed-off-by: Tomas Glozar --- tools/tracing/rtla/Makefile | 2 ++ tools/tracing/rtla/Makefile.config | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/tools/tracing/rtla/Makefile b/tools/tracing/rtla/Makefile index b5878be36125..a6a7dee16622 100644 --- a/tools/tracing/rtla/Makefile +++ b/tools/tracing/rtla/Makefile @@ -32,8 +32,10 @@ DOCSRC :=3D ../../../Documentation/tools/rtla/ =20 FEATURE_TESTS :=3D libtraceevent FEATURE_TESTS +=3D libtracefs +FEATURE_TESTS +=3D libcpupower FEATURE_DISPLAY :=3D libtraceevent FEATURE_DISPLAY +=3D libtracefs +FEATURE_DISPLAY +=3D libcpupower =20 ifeq ($(V),1) Q =3D diff --git a/tools/tracing/rtla/Makefile.config b/tools/tracing/rtla/Makefi= le.config index 0b7ecfb30d19..5f6f537c9728 100644 --- a/tools/tracing/rtla/Makefile.config +++ b/tools/tracing/rtla/Makefile.config @@ -42,6 +42,16 @@ else $(info libtracefs is missing. Please install libtracefs-dev/libtracefs-d= evel) endif =20 +$(call feature_check,libcpupower) +ifeq ($(feature-libcpupower), 1) + $(call detected,CONFIG_LIBCPUPOWER) + $(call lib_setup,cpupower) + CFLAGS +=3D -DHAVE_LIBCPUPOWER_SUPPORT +else + $(info libcpupower is missing, building without --deepest-idle-state sup= port.) + $(info Please install libcpupower-dev/kernel-tools-libs-devel) +endif + ifeq ($(STOP_ERROR),1) $(error Please, check the errors above.) endif --=20 2.45.2 From nobody Sun Feb 8 14:15:08 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A37F31AAE1C for ; Wed, 31 Jul 2024 08:38:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722415138; cv=none; b=N1UC6aupyPaX4EqtfUUoEeta8ZiGIQmNIzEQn1ZrcZ8O3LriUfzaNFrg+rkyge2T80mrj7KtZTv1ZzSwQt6FOeaHiMAZK22/A0bT3i+CCHhT0X7tGVpOT8z/p4QyBiwQ07sB9hNceJ35cpcOgrGgeQWSAnWVFnqlkfSfQXnIs2g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722415138; c=relaxed/simple; bh=13bOdv7scmfFCaUBtenmb+HF0x94sj9x9FW4ztglD9o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=T8jsHNIeqcS+TPuFRPm4xyjRiT6ulM4G7uawka681UCftMicKbsivoA3VvYCihhFBEJchI7MQIMAt5BkVZVDv8zC7gW9w7BaK27RBVodsegyxyz4/ab6EGZ1Oz4m+A2+3p8k/I2pvXeaF0FyI6LOzWgsBrj9eGAfiwKF30QK610= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=VBIWaWmy; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="VBIWaWmy" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722415135; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ns3mAFHi4DBzVE9smck0+0QW9qVWnxn0yJIN53GD66w=; b=VBIWaWmyOsbcLseMw0BlXqhxgcaDvEnhrthLHKGll4O0bMTCHT5G7xQKfbtqJfTEnBdg+n 6qQz9PT2/w3ZmA9UXef+JotPeLFeAKD+2QprkHvdl86iXAHXjKVSTmjX1DYKkoP6hsgItA l0NYiODm+YAqSj6geBEvXOLE64lGYcY= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-344-EHq9BLPRO4WTYFJmVWr96w-1; Wed, 31 Jul 2024 04:38:50 -0400 X-MC-Unique: EHq9BLPRO4WTYFJmVWr96w-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 73C421955D48; Wed, 31 Jul 2024 08:38:49 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.224.159]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3D451300018D; Wed, 31 Jul 2024 08:38:46 +0000 (UTC) From: tglozar@redhat.com To: rostedt@goodmis.org Cc: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, jwyatt@redhat.com, jkacur@redhat.com, Tomas Glozar Subject: [PATCH v2 3/6] rtla/utils: Add idle state disabling via libcpupower Date: Wed, 31 Jul 2024 10:36:52 +0200 Message-ID: <20240731083655.375293-4-tglozar@redhat.com> In-Reply-To: <20240731083655.375293-1-tglozar@redhat.com> References: <20240731083655.375293-1-tglozar@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Content-Type: text/plain; charset="utf-8" From: Tomas Glozar Add functions to utils.c to disable idle states through functions of libcpupower. This will serve as the basis for disabling idle states per cpu when running timerlat. Signed-off-by: Tomas Glozar --- tools/tracing/rtla/src/utils.c | 140 +++++++++++++++++++++++++++++++++ tools/tracing/rtla/src/utils.h | 6 ++ 2 files changed, 146 insertions(+) diff --git a/tools/tracing/rtla/src/utils.c b/tools/tracing/rtla/src/utils.c index 9ac71a66840c..9279b8ce08c3 100644 --- a/tools/tracing/rtla/src/utils.c +++ b/tools/tracing/rtla/src/utils.c @@ -4,6 +4,9 @@ */ =20 #define _GNU_SOURCE +#ifdef HAVE_LIBCPUPOWER_SUPPORT +#include +#endif /* HAVE_LIBCPUPOWER_SUPPORT */ #include #include #include @@ -519,6 +522,143 @@ int set_cpu_dma_latency(int32_t latency) return fd; } =20 +#ifdef HAVE_LIBCPUPOWER_SUPPORT +static unsigned int **saved_cpu_idle_disable_state; +static size_t saved_cpu_idle_disable_state_alloc_ctr; + +/* + * save_cpu_idle_state_disable - save disable for all idle states of a cpu + * + * Saves the current disable of all idle states of a cpu, to be subsequent= ly + * restored via restore_cpu_idle_disable_state. + * + * Return: idle state count on success, negative on error + */ +int save_cpu_idle_disable_state(unsigned int cpu) +{ + unsigned int nr_states; + unsigned int state; + int disabled; + int nr_cpus; + + nr_states =3D cpuidle_state_count(cpu); + + if (nr_states =3D=3D 0) + return 0; + + if (saved_cpu_idle_disable_state =3D=3D NULL) { + nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); + saved_cpu_idle_disable_state =3D calloc(nr_cpus, sizeof(unsigned int *)); + } + + saved_cpu_idle_disable_state[cpu] =3D calloc(nr_states, sizeof(unsigned i= nt)); + saved_cpu_idle_disable_state_alloc_ctr++; + + for (state =3D 0; state < nr_states; state++) { + disabled =3D cpuidle_is_state_disabled(cpu, state); + if (disabled < 0) + return disabled; + saved_cpu_idle_disable_state[cpu][state] =3D disabled; + } + + return nr_states; +} + +/* + * restore_cpu_idle_disable_state - restore disable for all idle states of= a cpu + * + * Restores the current disable state of all idle states of a cpu that was + * previously saved by save_cpu_idle_disable_state. + * + * Return: idle state count on success, negative on error + */ +int restore_cpu_idle_disable_state(unsigned int cpu) +{ + unsigned int nr_states; + unsigned int state; + int disabled; + int result; + + nr_states =3D cpuidle_state_count(cpu); + + if (nr_states =3D=3D 0) + return 0; + + for (state =3D 0; state < nr_states; state++) { + disabled =3D saved_cpu_idle_disable_state[cpu][state]; + result =3D cpuidle_state_disable(cpu, state, disabled); + if (result < 0) + return result; + } + + free(saved_cpu_idle_disable_state[cpu]); + saved_cpu_idle_disable_state[cpu] =3D NULL; + saved_cpu_idle_disable_state_alloc_ctr--; + if (saved_cpu_idle_disable_state_alloc_ctr =3D=3D 0) { + free(saved_cpu_idle_disable_state); + saved_cpu_idle_disable_state =3D NULL; + } + + return nr_states; +} + +/* + * free_cpu_idle_disable_states - free saved idle state disable for all cp= us + * + * Frees the memory used for storing cpu idle state disable for all cpus + * and states. + * + * Normally, the memory is freed automatically in + * restore_cpu_idle_disable_state; this is mostly for cleaning up after an + * error. + */ +void free_cpu_idle_disable_states(void) +{ + int cpu; + + if (!saved_cpu_idle_disable_state) + return; + + for (cpu =3D 0; cpu < sysconf(_SC_NPROCESSORS_CONF); cpu++) { + if (!saved_cpu_idle_disable_state[cpu]) + continue; + free(saved_cpu_idle_disable_state[cpu]); + saved_cpu_idle_disable_state[cpu] =3D NULL; + } + + free(saved_cpu_idle_disable_state); + saved_cpu_idle_disable_state =3D NULL; +} + +/* + * set_deepest_cpu_idle_state - limit idle state of cpu + * + * Disables all idle states deeper than the one given in + * deepest_state (assuming states with higher number are deeper). + * + * This is used to reduce the exit from idle latency. Unlike + * set_cpu_dma_latency, it can disable idle states per cpu. + * + * Return: idle state count on success, negative on error + */ +int set_deepest_cpu_idle_state(unsigned int cpu, unsigned int deepest_stat= e) +{ + unsigned int nr_states; + unsigned int state; + int result; + + nr_states =3D cpuidle_state_count(cpu); + + for (state =3D deepest_state + 1; state < nr_states; state++) { + result =3D cpuidle_state_disable(cpu, state, 1); + if (result < 0) + return result; + } + + return nr_states; +} +#endif /* HAVE_LIBCPUPOWER_SUPPORT */ + #define _STR(x) #x #define STR(x) _STR(x) =20 diff --git a/tools/tracing/rtla/src/utils.h b/tools/tracing/rtla/src/utils.h index d44513e6c66a..51b6054c2679 100644 --- a/tools/tracing/rtla/src/utils.h +++ b/tools/tracing/rtla/src/utils.h @@ -64,6 +64,12 @@ int set_comm_sched_attr(const char *comm_prefix, struct = sched_attr *attr); int set_comm_cgroup(const char *comm_prefix, const char *cgroup); int set_pid_cgroup(pid_t pid, const char *cgroup); int set_cpu_dma_latency(int32_t latency); +#ifdef HAVE_LIBCPUPOWER_SUPPORT +int save_cpu_idle_disable_state(unsigned int cpu); +int restore_cpu_idle_disable_state(unsigned int cpu); +void free_cpu_idle_disable_states(void); +int set_deepest_cpu_idle_state(unsigned int cpu, unsigned int state); +#endif /* HAVE_LIBCPUPOWER_SUPPORT */ int auto_house_keeping(cpu_set_t *monitored_cpus); =20 #define ns_to_usf(x) (((double)x/1000)) --=20 2.45.2 From nobody Sun Feb 8 14:15:08 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE2601AAE25 for ; Wed, 31 Jul 2024 08:38:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722415140; cv=none; b=J10e+s2Bh7AMyenzgtIAfCX1xg4RlLKGLvqK0T397SiUaOzXZZlDTzmkXyJmnEnAgdYdLgUDpViPOIuai8xRryd/y8q5WAVD3z9LSkiIYYZFkm7kF7uOKWaPxAuAXRy/plGrUIR/KljSY7Q7eo7wt8gnSb6B/MgKQN9tsDvi0gQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722415140; c=relaxed/simple; bh=fLXW4Wct0dcL9aOm+SZXnSo9KScxuH1pW4H6PL2cp/o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FXnI4dyeTK/1aREACrVOdw+Q6/UvgZrqWQINUPD1icmK65FWl2iXAI9pVp17BoRlFldGuGaMacLn8J6xSvFmy/MFQWRLO7Mn+vi7Mhgp5N5TeYtni5SVgiYbiczpktktlLf5BfZMgUktgfwObqy+4/auJOUfQ76xNWVT5BU9aFs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=iTkXvtDv; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="iTkXvtDv" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722415137; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YhGaw8eluweuHpNLgd8gjzmoXfgrditfZVeQN54loWA=; b=iTkXvtDvjNTovNGRvUoyPQHebd3UzbVfzHy8osibE2W8rOpP1JN/qa6m+y6QIHA7pGA5Gm dU03LCNzTZCz39foag63w7/HldpT16LUorh1/KR9E+c+dRdeKIal8ETVFtJKK1wPn6DAzy E6tJSjQqp3XcwUfVeOEQ6BGrrAIQKEE= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-661-Um5rLiLvOVSGQAvq9yuYgA-1; Wed, 31 Jul 2024 04:38:53 -0400 X-MC-Unique: Um5rLiLvOVSGQAvq9yuYgA-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 03FA61956080; Wed, 31 Jul 2024 08:38:52 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.224.159]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D33553000197; Wed, 31 Jul 2024 08:38:49 +0000 (UTC) From: tglozar@redhat.com To: rostedt@goodmis.org Cc: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, jwyatt@redhat.com, jkacur@redhat.com, Tomas Glozar Subject: [PATCH v2 4/6] rtla/timerlat: Add --deepest-idle-state for top Date: Wed, 31 Jul 2024 10:36:53 +0200 Message-ID: <20240731083655.375293-5-tglozar@redhat.com> In-Reply-To: <20240731083655.375293-1-tglozar@redhat.com> References: <20240731083655.375293-1-tglozar@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Content-Type: text/plain; charset="utf-8" From: Tomas Glozar Add option to limit deepest idle state on CPUs where timerlat is running for the duration of the workload. Signed-off-by: Tomas Glozar --- tools/tracing/rtla/src/timerlat_top.c | 46 ++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src= /timerlat_top.c index 8c16419fe22a..ef1d3affef95 100644 --- a/tools/tracing/rtla/src/timerlat_top.c +++ b/tools/tracing/rtla/src/timerlat_top.c @@ -48,6 +48,7 @@ struct timerlat_top_params { int pretty_output; int warmup; int buffer_size; + int deepest_idle_state; cpu_set_t hk_cpu_set; struct sched_attr sched_param; struct trace_events *events; @@ -447,7 +448,7 @@ static void timerlat_top_usage(char *usage) "", " usage: rtla timerlat [top] [-h] [-q] [-a us] [-d s] [-D] [-n] [-p us]= [-i us] [-T us] [-s us] \\", " [[-t[file]] [-e sys[:event]] [--filter ] [--trigger ] [-c cpu-list] [-H cpu-list]\\", - " [-P priority] [--dma-latency us] [--aa-only us] [-C[=3Dcgroup_name]]= [-u|-k] [--warm-up s]", + " [-P priority] [--dma-latency us] [--aa-only us] [-C[=3Dcgroup_name]]= [-u|-k] [--warm-up s] [--deepest-idle-state n]", "", " -h/--help: print this menu", " -a/--auto: set automatic trace mode, stopping the session if argumen= t in us latency is hit", @@ -481,6 +482,7 @@ static void timerlat_top_usage(char *usage) " -U/--user-load: enable timerlat for user-defined user-space workload= ", " --warm-up s: let the workload run for s seconds before collecting= data", " --trace-buffer-size kB: set the per-cpu trace buffer size in kB", + " --deepest-idle-state n: only go down to idle state n on cpus used= by timerlat to reduce exit from idle latency", NULL, }; =20 @@ -518,6 +520,9 @@ static struct timerlat_top_params /* disabled by default */ params->dma_latency =3D -1; =20 + /* disabled by default */ + params->deepest_idle_state =3D -2; + /* display data in microseconds */ params->output_divisor =3D 1000; =20 @@ -550,6 +555,7 @@ static struct timerlat_top_params {"aa-only", required_argument, 0, '5'}, {"warm-up", required_argument, 0, '6'}, {"trace-buffer-size", required_argument, 0, '7'}, + {"deepest-idle-state", required_argument, 0, '8'}, {0, 0, 0, 0} }; =20 @@ -726,6 +732,9 @@ static struct timerlat_top_params case '7': params->buffer_size =3D get_llong_from_str(optarg); break; + case '8': + params->deepest_idle_state =3D get_llong_from_str(optarg); + break; default: timerlat_top_usage("Invalid option"); } @@ -922,6 +931,9 @@ int timerlat_top_main(int argc, char *argv[]) int return_value =3D 1; char *max_lat; int retval; +#ifdef HAVE_LIBCPUPOWER_SUPPORT + int i; +#endif /* HAVE_LIBCPUPOWER_SUPPORT */ =20 params =3D timerlat_top_parse_args(argc, argv); if (!params) @@ -971,6 +983,26 @@ int timerlat_top_main(int argc, char *argv[]) } } =20 + if (params->deepest_idle_state >=3D -1) { +#ifdef HAVE_LIBCPUPOWER_SUPPORT + for (i =3D 0; i < sysconf(_SC_NPROCESSORS_CONF); i++) { + if (params->cpus && !CPU_ISSET(i, ¶ms->monitored_cpus)) + continue; + if (save_cpu_idle_disable_state(i) < 0) { + err_msg("Could not save cpu idle state.\n"); + goto out_free; + } + if (set_deepest_cpu_idle_state(i, params->deepest_idle_state) < 0) { + err_msg("Could not set deepest cpu idle state.\n"); + goto out_free; + } + } +#else + err_msg("rtla built without libcpupower, --deepest-idle-state is not sup= ported\n"); + goto out_free; +#endif /* HAVE_LIBCPUPOWER_SUPPORT */ + } + if (params->trace_output) { record =3D osnoise_init_trace_tool("timerlat"); if (!record) { @@ -1125,6 +1157,15 @@ int timerlat_top_main(int argc, char *argv[]) timerlat_aa_destroy(); if (dma_latency_fd >=3D 0) close(dma_latency_fd); +#ifdef HAVE_LIBCPUPOWER_SUPPORT + if (params->deepest_idle_state >=3D -1) { + for (i =3D 0; i < sysconf(_SC_NPROCESSORS_CONF); i++) { + if (params->cpus && !CPU_ISSET(i, ¶ms->monitored_cpus)) + continue; + restore_cpu_idle_disable_state(i); + } + } +#endif /* HAVE_LIBCPUPOWER_SUPPORT */ trace_events_destroy(&record->trace, params->events); params->events =3D NULL; out_free: @@ -1134,6 +1175,9 @@ int timerlat_top_main(int argc, char *argv[]) osnoise_destroy_tool(record); osnoise_destroy_tool(top); free(params); +#ifdef HAVE_LIBCPUPOWER_SUPPORT + free_cpu_idle_disable_states(); +#endif /* HAVE_LIBCPUPOWER_SUPPORT */ out_exit: exit(return_value); } --=20 2.45.2 From nobody Sun Feb 8 14:15:08 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 03E621AB514 for ; Wed, 31 Jul 2024 08:39:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722415147; cv=none; b=E+u/NMuOrL66lerJN9Wbgi6fo/kRf+2YKslqL7iJmAl9Q/GPXzBG27GVSQyAlI/pwWu0m/m8Cf/5iv6v4DAN++8rhA57xmy3KBYBq3269VDIRci7uwScSTlHvAyqO08vzW9EKrTfoG8d0KxyJfPhFSb6GMqybk/2flo7w156oDg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722415147; c=relaxed/simple; bh=H2g2piUjymztI+zJAzp4FxlkP6G0s8qCAn3CbGkzlz4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GHpM8ZewD/BW2zc8kj2qseefzz913CWf2BBhbWP9ekZaSXMMAu6feyysFmhkbG1hZCmj/E6etxI20l2PYsfI89Cfy2ZDYdIcvRFDuSnfv2fIeO5+SP0H4dMXsdhOb2BUVZ9j0SsL+ZssZ0+yC3Wh1HSWrN9KaSB5JhVASXaVDrw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=dmEmtsar; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="dmEmtsar" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722415145; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gLZ1FcdpM0yfEx21dYtJ0QoefqhZWfvbIyg8r+8+3Lc=; b=dmEmtsarfubJpio1sFXxr5VK5dMECMBrkdIzdJM6+wTO1CryxLkr7URkDrKIrjHEBGDq3e 9dyzLc8It3rWdBCvLKweQbM+n7Qpn0I1MbtzLdfGVovF3nfBRK6Jo6pu7YS87EKQF7GnAj moGrpXXuM+Uu1QWOZC+FUkZvSTymZkA= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-203-g2sa1bNyMcqC5HrIapRXcQ-1; Wed, 31 Jul 2024 04:38:56 -0400 X-MC-Unique: g2sa1bNyMcqC5HrIapRXcQ-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3D5091956088; Wed, 31 Jul 2024 08:38:55 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.224.159]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 93D973000197; Wed, 31 Jul 2024 08:38:52 +0000 (UTC) From: tglozar@redhat.com To: rostedt@goodmis.org Cc: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, jwyatt@redhat.com, jkacur@redhat.com, Tomas Glozar Subject: [PATCH v2 5/6] rtla/timerlat: Add --deepest-idle-state for hist Date: Wed, 31 Jul 2024 10:36:54 +0200 Message-ID: <20240731083655.375293-6-tglozar@redhat.com> In-Reply-To: <20240731083655.375293-1-tglozar@redhat.com> References: <20240731083655.375293-1-tglozar@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Content-Type: text/plain; charset="utf-8" From: Tomas Glozar Support limiting deepest idle state also for timerlat-hist. Signed-off-by: Tomas Glozar --- tools/tracing/rtla/src/timerlat_hist.c | 46 +++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/sr= c/timerlat_hist.c index a3907c390d67..41cf6a0535b4 100644 --- a/tools/tracing/rtla/src/timerlat_hist.c +++ b/tools/tracing/rtla/src/timerlat_hist.c @@ -55,6 +55,7 @@ struct timerlat_hist_params { int entries; int warmup; int buffer_size; + int deepest_idle_state; }; =20 struct timerlat_hist_cpu { @@ -655,7 +656,7 @@ static void timerlat_hist_usage(char *usage) " [-t[file]] [-e sys[:event]] [--filter ] [--trigger ] [-c cpu-list] [-H cpu-list]\\", " [-P priority] [-E N] [-b N] [--no-irq] [--no-thread] [--no-header] [= --no-summary] \\", " [--no-index] [--with-zeros] [--dma-latency us] [-C[=3Dcgroup_name]] = [--no-aa] [--dump-task] [-u|-k]", - " [--warm-up s]", + " [--warm-up s] [--deepest-idle-state n]", "", " -h/--help: print this menu", " -a/--auto: set automatic trace mode, stopping the session if argumen= t in us latency is hit", @@ -695,6 +696,7 @@ static void timerlat_hist_usage(char *usage) " -U/--user-load: enable timerlat for user-defined user-space workload= ", " --warm-up s: let the workload run for s seconds before collecting= data", " --trace-buffer-size kB: set the per-cpu trace buffer size in kB", + " --deepest-idle-state n: only go down to idle state n on cpus used= by timerlat to reduce exit from idle latency", NULL, }; =20 @@ -732,6 +734,9 @@ static struct timerlat_hist_params /* disabled by default */ params->dma_latency =3D -1; =20 + /* disabled by default */ + params->deepest_idle_state =3D -2; + /* display data in microseconds */ params->output_divisor =3D 1000; params->bucket_size =3D 1; @@ -772,6 +777,7 @@ static struct timerlat_hist_params {"dump-task", no_argument, 0, '\1'}, {"warm-up", required_argument, 0, '\2'}, {"trace-buffer-size", required_argument, 0, '\3'}, + {"deepest-idle-state", required_argument, 0, '\4'}, {0, 0, 0, 0} }; =20 @@ -960,6 +966,9 @@ static struct timerlat_hist_params case '\3': params->buffer_size =3D get_llong_from_str(optarg); break; + case '\4': + params->deepest_idle_state =3D get_llong_from_str(optarg); + break; default: timerlat_hist_usage("Invalid option"); } @@ -1152,6 +1161,9 @@ int timerlat_hist_main(int argc, char *argv[]) int return_value =3D 1; pthread_t timerlat_u; int retval; +#ifdef HAVE_LIBCPUPOWER_SUPPORT + int i; +#endif /* HAVE_LIBCPUPOWER_SUPPORT */ =20 params =3D timerlat_hist_parse_args(argc, argv); if (!params) @@ -1201,6 +1213,26 @@ int timerlat_hist_main(int argc, char *argv[]) } } =20 + if (params->deepest_idle_state >=3D -1) { +#ifdef HAVE_LIBCPUPOWER_SUPPORT + for (i =3D 0; i < sysconf(_SC_NPROCESSORS_CONF); i++) { + if (params->cpus && !CPU_ISSET(i, ¶ms->monitored_cpus)) + continue; + if (save_cpu_idle_disable_state(i) < 0) { + err_msg("Could not save cpu idle state.\n"); + goto out_free; + } + if (set_deepest_cpu_idle_state(i, params->deepest_idle_state) < 0) { + err_msg("Could not set deepest cpu idle state.\n"); + goto out_free; + } + } +#else + err_msg("rtla built without libcpupower, --deepest-idle-state is not sup= ported\n"); + goto out_free; +#endif /* HAVE_LIBCPUPOWER_SUPPORT */ + } + if (params->trace_output) { record =3D osnoise_init_trace_tool("timerlat"); if (!record) { @@ -1332,6 +1364,15 @@ int timerlat_hist_main(int argc, char *argv[]) timerlat_aa_destroy(); if (dma_latency_fd >=3D 0) close(dma_latency_fd); +#ifdef HAVE_LIBCPUPOWER_SUPPORT + if (params->deepest_idle_state >=3D -1) { + for (i =3D 0; i < sysconf(_SC_NPROCESSORS_CONF); i++) { + if (params->cpus && !CPU_ISSET(i, ¶ms->monitored_cpus)) + continue; + restore_cpu_idle_disable_state(i); + } + } +#endif /* HAVE_LIBCPUPOWER_SUPPORT */ trace_events_destroy(&record->trace, params->events); params->events =3D NULL; out_free: @@ -1340,6 +1381,9 @@ int timerlat_hist_main(int argc, char *argv[]) osnoise_destroy_tool(record); osnoise_destroy_tool(tool); free(params); +#ifdef HAVE_LIBCPUPOWER_SUPPORT + free_cpu_idle_disable_states(); +#endif /* HAVE_LIBCPUPOWER_SUPPORT */ out_exit: exit(return_value); } --=20 2.45.2 From nobody Sun Feb 8 14:15:08 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6BA321AB507 for ; Wed, 31 Jul 2024 08:39:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722415144; cv=none; b=Xhw3EIR6d4HD3ED+eO5OsI3Iv8C6VvwB5FVhzzC7Ik+yK0AxeUU8XT+JRejCU0KLyIcqzLjfLSmLPry9n2xLQSy9v8WvtNzQQbFDlCJ3D2v+C6hwoOClWxf099oYDIbKGIuJekUgllJU7Y1SfB/pZgMVh/KyVqjuxEC/1pGBfZs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722415144; c=relaxed/simple; bh=GNp4KhZ3KD5qJo7h5W+Qs5sFdu/0kTvhWIvEgdRa97U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=s4y8NJF+u4dCV4IvH8Mo6OphmF23GwJM9nek/a/odqu9rA8czIS53RidR//AfbaNJCh360XAFA/EtokqN7NjthOmdHeUA2h0uag/LCvFa7m55Hk9XjGZ/CeZtVRcPh0Ul+cBjMfTbOwjUZMH7WD11qBpjzoZYbyBB56oz+nx1ZI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=K6SkM0CI; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="K6SkM0CI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722415142; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sHBEjJP0Fw2TqNNryvFolQU0aiFEitvWX6GJ3CXCZWM=; b=K6SkM0CIh3JBkSCzdn14hcBR5uClYIyxU+UT8IhzgnytpY/y9oyRdOA2vgo/GxoWj7jbV3 yqXkBMXgm7lOjsCH7+w979vksw9UHBsePtgNPtD14bBREavF/9EC3OW3KO4ye1LMABD5lE +bt64UCEq7nn76a8Dkkg8Kysvf9A7vs= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-170-2gT7LWvbNYOZf4RBsXMawg-1; Wed, 31 Jul 2024 04:38:58 -0400 X-MC-Unique: 2gT7LWvbNYOZf4RBsXMawg-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E8C661955D4A; Wed, 31 Jul 2024 08:38:57 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.224.159]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A573D300018D; Wed, 31 Jul 2024 08:38:55 +0000 (UTC) From: tglozar@redhat.com To: rostedt@goodmis.org Cc: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, jwyatt@redhat.com, jkacur@redhat.com, Tomas Glozar Subject: [PATCH v2 6/6] rtla: Documentation: Mention --deepest-idle-state Date: Wed, 31 Jul 2024 10:36:55 +0200 Message-ID: <20240731083655.375293-7-tglozar@redhat.com> In-Reply-To: <20240731083655.375293-1-tglozar@redhat.com> References: <20240731083655.375293-1-tglozar@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Content-Type: text/plain; charset="utf-8" From: Tomas Glozar Add --deepest-idle-state to manpage and mention libcpupower dependency in README.txt. Signed-off-by: Tomas Glozar --- Documentation/tools/rtla/common_timerlat_options.rst | 8 ++++++++ tools/tracing/rtla/README.txt | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/Documentation/tools/rtla/common_timerlat_options.rst b/Documen= tation/tools/rtla/common_timerlat_options.rst index cef6651f1435..10dc802f8d65 100644 --- a/Documentation/tools/rtla/common_timerlat_options.rst +++ b/Documentation/tools/rtla/common_timerlat_options.rst @@ -31,6 +31,14 @@ *cyclictest* sets this value to *0* by default, use **--dma-latenc= y** *0* to have similar results. =20 +**--deepest-idle-state** *n* + Disable idle states higher than *n* for cpus that are running time= rlat threads to + reduce exit from idle latencies. If *n* is -1, all idle states are= disabled. + On exit from timerlat, the idle state setting is restored to its o= riginal state + before running timerlat. + + Requires rtla to be built with libcpupower. + **-k**, **--kernel-threads** =20 Use timerlat kernel-space threads, in contrast of **-u**. diff --git a/tools/tracing/rtla/README.txt b/tools/tracing/rtla/README.txt index 4af3fd40f171..dd5621038c55 100644 --- a/tools/tracing/rtla/README.txt +++ b/tools/tracing/rtla/README.txt @@ -11,6 +11,7 @@ RTLA depends on the following libraries and tools: =20 - libtracefs - libtraceevent + - libcpupower (optional, for --deepest-idle-state) =20 It also depends on python3-docutils to compile man pages. =20 @@ -26,6 +27,9 @@ For development, we suggest the following steps for compi= ling rtla: $ make $ sudo make install $ cd .. + $ cd $libcpupower_src + $ make + $ sudo make install $ cd $rtla_src $ make $ sudo make install --=20 2.45.2