From nobody Tue Nov 26 22:16:49 2024 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 DB02A14D2B9 for ; Tue, 15 Oct 2024 13:36:14 +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=1728999376; cv=none; b=PXOsNiuZQwmuGRejoOxkQ01j5+TzF6Bm7VWFdLEk0ADkhghrxMZ0AHxT1yLt+eYVT4mp6+M3IMX/4IILIkrVg2om+dwVbPeOVgEETjsEijL5PA0PnjcwYcEfSDSq12aQQaBaN+lFGd6YNF6XEJfVNxvk5BYGYGn9oc+jaWftzsE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728999376; c=relaxed/simple; bh=WJCEQMOAoY4332qR6uEjRNyhheW56HM+3+6KsYXw8A0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rQnYYlROfGp2r2lh0mgAg3AeRoqVECBX6wbd0i85fkJXlk20V6Pm6ADpsszYYHWbU3ZeDdluYuuOG3f9vnKm8hXBjzy6knvoy1qMJcKp/3GOr02QI72g2T8wqeUM8yUviFvIRAVB310IDnVAvkj88VOhnNeTHfgo9X06Xpz187M= 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=hZxEiHjt; 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="hZxEiHjt" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728999373; 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=3XNM8/scQMJ4T7XpJMlHqS/H8+k2VunSmH7Ji1tBrMc=; b=hZxEiHjtjcA42BxitjGaSoDfg0RH8rxb2OkR4gZG4GdcrxO464twa8fDZjYrGozOe1uDNF OL+n86SJ2O3siSWiarZiBrlUIylGvijsIhasdmF8D7qKjUyEdjWUvY38uD3/pJqxvwSj/o +4EYsYCE6kNUNZgwKWDSiHS/9p3UuwY= 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-557--os0K-AlPnq8phv0xdYvmw-1; Tue, 15 Oct 2024 09:36:10 -0400 X-MC-Unique: -os0K-AlPnq8phv0xdYvmw-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 886CC1955D5F; Tue, 15 Oct 2024 13:36:09 +0000 (UTC) Received: from fedora.brq.redhat.com (unknown [10.43.17.159]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7E9CE19560A3; Tue, 15 Oct 2024 13:36:07 +0000 (UTC) From: tglozar@redhat.com To: rostedt@goodmis.org Cc: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, jkacur@redhat.com, jwyatt@redhat.com, Tomas Glozar Subject: [PATCH v4 1/6] tools/build: Add libcpupower dependency detection Date: Tue, 15 Oct 2024 15:35:47 +0200 Message-ID: <20241015133552.3043040-2-tglozar@redhat.com> In-Reply-To: <20241015133552.3043040-1-tglozar@redhat.com> References: <20241015133552.3043040-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.0 on 10.30.177.12 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 ffd117135094..2ebfb826dcea 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 5938cf799dc6..6ef3e1ca583e 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 \ @@ -245,6 +246,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.47.0 From nobody Tue Nov 26 22:16:49 2024 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 EDBFC1AF0A3 for ; Tue, 15 Oct 2024 13:36:16 +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=1728999378; cv=none; b=U5964y96d6bkDhevwB/sEsjw+LVrbiOwTpMi/1Vc9QyjrCiu6UXO0qzENvlxFzCIlInqt1CPbcBHUPdQE1qxJ2Iid+xH3nuliWELh3YieA784P2u++uuugllPKNPX22j14w1aTDtnygwaocveTP/7VtdFXUeL3bMMgweeu97HOA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728999378; c=relaxed/simple; bh=ZffEOjIFLf6elKPZJwnRawB2g4HaEPHGJv/NviW4q0Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PXdIFq3qTHq96Bwm1KyxHO+DhwrBxid2alPlnDzmOPchIlZYpjDJjQPHXEK3fwtycseLkhNDEcGQXrJE8rrbc9noZmJCLW2Ip7KDJvcQwdiJonAVtcHVtdemZ15wzJxLb3Z3Luavc38oRNfsIK+fYLMkpxyorUBiEoHqEbXrFzQ= 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=BWGFBNvf; 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="BWGFBNvf" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728999376; 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=3iWpJmXXb2Ifv4l2T8pQRfmJ24RIoE36q9B2/qALvfM=; b=BWGFBNvfzw5o7d0rAJpgjyCBEtr5NkrzGYe6S+6piRpgPaQvlK8fUhBzmeM8po3vxXBnuI ROUlyzyhIfFYEbSzux6FvymCItZlb6VD8VaRbpVblQ9+ajYUB3zxBZytFJRMz188tEXrpI BWRsfQzJGynGyYKZv1gkxOo+0Gw9R0o= 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-678-9ARMGhT7OTmm-9j1Qbrfeg-1; Tue, 15 Oct 2024 09:36:13 -0400 X-MC-Unique: 9ARMGhT7OTmm-9j1Qbrfeg-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 DC54C1955BE5; Tue, 15 Oct 2024 13:36:11 +0000 (UTC) Received: from fedora.brq.redhat.com (unknown [10.43.17.159]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EF6B719560A2; Tue, 15 Oct 2024 13:36:09 +0000 (UTC) From: tglozar@redhat.com To: rostedt@goodmis.org Cc: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, jkacur@redhat.com, jwyatt@redhat.com, Tomas Glozar Subject: [PATCH v4 2/6] rtla: Add optional dependency on libcpupower Date: Tue, 15 Oct 2024 15:35:48 +0200 Message-ID: <20241015133552.3043040-3-tglozar@redhat.com> In-Reply-To: <20241015133552.3043040-1-tglozar@redhat.com> References: <20241015133552.3043040-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.0 on 10.30.177.12 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 5f8c286712d4..ccbb380e70d8 100644 --- a/tools/tracing/rtla/Makefile.config +++ b/tools/tracing/rtla/Makefile.config @@ -43,6 +43,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.47.0 From nobody Tue Nov 26 22:16:49 2024 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 001881B2185 for ; Tue, 15 Oct 2024 13:36:18 +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=1728999380; cv=none; b=dNtYOQTvzOYfP0dE0NQi+OWUN8x/iBbC/9WEQo+cS+G6JWmtUF66pI9CeLbvNn0+PS6gSl36rKU/8nitFn6EBLksxDm2QFK6hDAtOglUAweD5lOeCnq7VIR3Hi0Gg2Q8jbVbQxorBlCK4Le9m69DrP+GEYuiuIQNuOEl5/Ccdxo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728999380; c=relaxed/simple; bh=MhBDTxazwt2cNcdSnL5Jun1Kf6gOExQpboPbSe7nedI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ME/GNioMRTlMN7ZbRntMEZmR3x3ja2ftQI5UKHI+JF5yDt3b8QGb3DH1kKSxewJLisZ6SVul1gHc6p1fJaO2JyB1a3Pzmxm63WduKvcGxyDbhsA5p9Fh6LrCq6y5RvV1fheZivZO9McVpYJHXlTqUwN6RKlfTHbAjrgDT698qrY= 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=fDdlP36t; 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="fDdlP36t" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728999377; 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=U5FIMCM86rfTlYqSZohTnNcemhQ7Ru5jQf7S2rbByB0=; b=fDdlP36t+m5/oEbF+lbvS/wV2Jgx6EQvNFbqPNfDYVq6Egahp0kpsZteNO98O7lVdc/yYp mDtnrnPka7JlNXtNZD7YcDkr/Qnb9frnNyoIHLAFIPWFzb3oi8rrRna2BqiI5o2pbEWzw2 wMuQWhfoPXg5p3bZX29pWt6A+QKGuY8= 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-637-ky_uF4hOOlaD5orKRJGMxg-1; Tue, 15 Oct 2024 09:36:14 -0400 X-MC-Unique: ky_uF4hOOlaD5orKRJGMxg-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 001321955EEA; Tue, 15 Oct 2024 13:36:14 +0000 (UTC) Received: from fedora.brq.redhat.com (unknown [10.43.17.159]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 31D8019560A2; Tue, 15 Oct 2024 13:36:11 +0000 (UTC) From: tglozar@redhat.com To: rostedt@goodmis.org Cc: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, jkacur@redhat.com, jwyatt@redhat.com, Tomas Glozar Subject: [PATCH v4 3/6] rtla/utils: Add idle state disabling via libcpupower Date: Tue, 15 Oct 2024 15:35:49 +0200 Message-ID: <20241015133552.3043040-4-tglozar@redhat.com> In-Reply-To: <20241015133552.3043040-1-tglozar@redhat.com> References: <20241015133552.3043040-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.0 on 10.30.177.12 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 | 150 +++++++++++++++++++++++++++++++++ tools/tracing/rtla/src/utils.h | 13 +++ 2 files changed, 163 insertions(+) diff --git a/tools/tracing/rtla/src/utils.c b/tools/tracing/rtla/src/utils.c index 6fae234aaf36..4995d35cf3ec 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 @@ -515,6 +518,153 @@ 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 *)); + if (!saved_cpu_idle_disable_state) + return -1; + } + + saved_cpu_idle_disable_state[cpu] =3D calloc(nr_states, sizeof(unsigned i= nt)); + if (!saved_cpu_idle_disable_state[cpu]) + return -1; + 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; + + if (!saved_cpu_idle_disable_state) + return -1; + + for (state =3D 0; state < nr_states; state++) { + if (!saved_cpu_idle_disable_state[cpu]) + return -1; + 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; + int nr_cpus; + + if (!saved_cpu_idle_disable_state) + return; + + nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); + + for (cpu =3D 0; cpu < nr_cpus; cpu++) { + 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 99c9cf81bcd0..101d4799a009 100644 --- a/tools/tracing/rtla/src/utils.h +++ b/tools/tracing/rtla/src/utils.h @@ -66,6 +66,19 @@ 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); +static inline int have_libcpupower_support(void) { return 1; } +#else +static inline int save_cpu_idle_disable_state(unsigned int cpu) { return -= 1; } +static inline int restore_cpu_idle_disable_state(unsigned int cpu) { retur= n -1; } +static inline void free_cpu_idle_disable_states(void) { } +static inline int set_deepest_cpu_idle_state(unsigned int cpu, unsigned in= t state) { return -1; } +static inline int have_libcpupower_support(void) { return 0; } +#endif /* HAVE_LIBCPUPOWER_SUPPORT */ int auto_house_keeping(cpu_set_t *monitored_cpus); =20 #define ns_to_usf(x) (((double)x/1000)) --=20 2.47.0 From nobody Tue Nov 26 22:16:49 2024 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 5467E1B21AD for ; Tue, 15 Oct 2024 13:36:21 +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=1728999382; cv=none; b=QlwcQ9yethjXJPL29NTQ/hlXO769nL5LGe7Spa23yNXY+GTAFniwRhSF4Mc6VrGc1tPGmadQ7DnGsA992/V/L+dk2ptTdah6WnbYdA6Xf9X1ZbnICHWTNZMhfQXZ9dHeBMEkvwjAOjc2edZU/7QKiazZ1XXmcy/C4PipgGAZ8Bk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728999382; c=relaxed/simple; bh=xeLkTEKTNAT9sGDnDK9o2ilMhsBVyA9UijtR9xfjMfM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YG2tysWvza5fsCCuruZ4uKiXNzFhf+7L/dXrUCTIColImi2owxg4bL91k0otL//VLmbUEm4+7L4Gb8+wYOtEp529bqb7jB02rSToXaGFrQl7d0dyVwSwYa8pVc28Nuln4rwKm0NASZQcCj4t09ASa4Cg/x9wJnv1sIN1sQW7hf0= 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=VV1dJCxs; 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="VV1dJCxs" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728999380; 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=JwYhkpHghGKHLaekKCNgK0lS740JHddsBSXXuOkvWNI=; b=VV1dJCxsUCvuMJs/3Z2kG9VLDwFKraAkYRyFYe7LXuStY1/R+W5QM3TITg38T3dYpe8say p0chyUzjjPlwt1dfS2aKf3oicE5+mtr+vYlgEOClrsh8F1RqdjZn5PwWndjw18y0ER+EaH NnaeiLA1rwvYpFu6g8X1ugy35Z3+n0g= Received: from mx-prod-mc-01.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-498-EO0uGmp6OmOK-1ygPSlV2A-1; Tue, 15 Oct 2024 09:36:17 -0400 X-MC-Unique: EO0uGmp6OmOK-1ygPSlV2A-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 55F361955BC1; Tue, 15 Oct 2024 13:36:16 +0000 (UTC) Received: from fedora.brq.redhat.com (unknown [10.43.17.159]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 695D119560A7; Tue, 15 Oct 2024 13:36:14 +0000 (UTC) From: tglozar@redhat.com To: rostedt@goodmis.org Cc: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, jkacur@redhat.com, jwyatt@redhat.com, Tomas Glozar Subject: [PATCH v4 4/6] rtla/timerlat: Add --deepest-idle-state for top Date: Tue, 15 Oct 2024 15:35:50 +0200 Message-ID: <20241015133552.3043040-5-tglozar@redhat.com> In-Reply-To: <20241015133552.3043040-1-tglozar@redhat.com> References: <20241015133552.3043040-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.0 on 10.30.177.12 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 | 42 ++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src= /timerlat_top.c index 7fb85c8ee3bc..fca0da3caa87 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,7 @@ int timerlat_top_main(int argc, char *argv[]) int return_value =3D 1; char *max_lat; int retval; + int nr_cpus, i; =20 params =3D timerlat_top_parse_args(argc, argv); if (!params) @@ -971,6 +981,28 @@ int timerlat_top_main(int argc, char *argv[]) } } =20 + if (params->deepest_idle_state >=3D -1) { + if (!have_libcpupower_support()) { + err_msg("rtla built without libcpupower, --deepest-idle-state is not su= pported\n"); + goto out_free; + } + + nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); + + for (i =3D 0; i < nr_cpus; 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; + } + } + } + if (params->trace_output) { record =3D osnoise_init_trace_tool("timerlat"); if (!record) { @@ -1125,6 +1157,13 @@ int timerlat_top_main(int argc, char *argv[]) timerlat_aa_destroy(); if (dma_latency_fd >=3D 0) close(dma_latency_fd); + if (params->deepest_idle_state >=3D -1) { + for (i =3D 0; i < nr_cpus; i++) { + if (params->cpus && !CPU_ISSET(i, ¶ms->monitored_cpus)) + continue; + restore_cpu_idle_disable_state(i); + } + } trace_events_destroy(&record->trace, params->events); params->events =3D NULL; out_free: @@ -1134,6 +1173,7 @@ int timerlat_top_main(int argc, char *argv[]) osnoise_destroy_tool(record); osnoise_destroy_tool(top); free(params); + free_cpu_idle_disable_states(); out_exit: exit(return_value); } --=20 2.47.0 From nobody Tue Nov 26 22:16:49 2024 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 884E71514F8 for ; Tue, 15 Oct 2024 13:36:21 +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=1728999383; cv=none; b=Q1vWsmNmLAmyqi0eKsM0JBuvDoQNyIovpS3+KShF52tD8sjQ4WBO7nNvKVzh2IH7gd/eqcddBRfdP+OvfGyWN1csYRkxLs54cT9rSUC3CxZlJTPVw1om7ah9fzepzYsFGH7/fP3klTrrfxk3xK2/OxmiY0Hr9/vSgJ9kqmfZ2ug= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728999383; c=relaxed/simple; bh=mFXiqK3KfzjuuV7ca3Y11LL8SftOwK2eMizVPciOeTw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=k0nTb9fJYJYN/Dc6cTSMI+0+mOcajVntQowki7JqdX9l8jWfNOk/ClVOFww6ro1lTFxcfGuiYpjmFCsTxsAb5SxbPGP2Gx97wBydC9ndyBq+Po07+jt7nukc3VrsT9GbGDexRFoRL3lxP15WS21ldT3OG2PwCdj95tfk1tmqIxQ= 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=Lharttqv; 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="Lharttqv" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728999380; 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=bbffXuV/W2LJJxkF9vZjOFB2SKnvqHFB2UqKGcqsdjI=; b=LharttqvhM6G+EjB7tpGivH9wEEQsnHSKPj33/Le3k4T8LH9031vJAlugum0RTvDSk3yWc BgkyQHrrAlIbx/rjjeWGfk1zwdyy483XEzo9R0v1UeddcV4nVCcDCsGy6V5oIdQ/ogp44S IQoNcTQ7ZopqTv8l89a+vXtCgwaBJrI= 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-447-Bo8bhmqKPq-l0asBS4WYGw-1; Tue, 15 Oct 2024 09:36:19 -0400 X-MC-Unique: Bo8bhmqKPq-l0asBS4WYGw-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 807641954233; Tue, 15 Oct 2024 13:36:18 +0000 (UTC) Received: from fedora.brq.redhat.com (unknown [10.43.17.159]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B422719560A3; Tue, 15 Oct 2024 13:36:16 +0000 (UTC) From: tglozar@redhat.com To: rostedt@goodmis.org Cc: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, jkacur@redhat.com, jwyatt@redhat.com, Tomas Glozar Subject: [PATCH v4 5/6] rtla/timerlat: Add --deepest-idle-state for hist Date: Tue, 15 Oct 2024 15:35:51 +0200 Message-ID: <20241015133552.3043040-6-tglozar@redhat.com> In-Reply-To: <20241015133552.3043040-1-tglozar@redhat.com> References: <20241015133552.3043040-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.0 on 10.30.177.12 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 | 42 +++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/sr= c/timerlat_hist.c index d49c8f0855fe..01dd337da13a 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,7 @@ int timerlat_hist_main(int argc, char *argv[]) int return_value =3D 1; pthread_t timerlat_u; int retval; + int nr_cpus, i; =20 params =3D timerlat_hist_parse_args(argc, argv); if (!params) @@ -1201,6 +1211,28 @@ int timerlat_hist_main(int argc, char *argv[]) } } =20 + if (params->deepest_idle_state >=3D -1) { + if (!have_libcpupower_support()) { + err_msg("rtla built without libcpupower, --deepest-idle-state is not su= pported\n"); + goto out_free; + } + + nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); + + for (i =3D 0; i < nr_cpus; 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; + } + } + } + if (params->trace_output) { record =3D osnoise_init_trace_tool("timerlat"); if (!record) { @@ -1332,6 +1364,13 @@ int timerlat_hist_main(int argc, char *argv[]) timerlat_aa_destroy(); if (dma_latency_fd >=3D 0) close(dma_latency_fd); + if (params->deepest_idle_state >=3D -1) { + for (i =3D 0; i < nr_cpus; i++) { + if (params->cpus && !CPU_ISSET(i, ¶ms->monitored_cpus)) + continue; + restore_cpu_idle_disable_state(i); + } + } trace_events_destroy(&record->trace, params->events); params->events =3D NULL; out_free: @@ -1340,6 +1379,7 @@ int timerlat_hist_main(int argc, char *argv[]) osnoise_destroy_tool(record); osnoise_destroy_tool(tool); free(params); + free_cpu_idle_disable_states(); out_exit: exit(return_value); } --=20 2.47.0 From nobody Tue Nov 26 22:16:49 2024 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 CED871C07D0 for ; Tue, 15 Oct 2024 13:36:23 +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=1728999385; cv=none; b=Cm0lZXADqR6z6GFq6p9VU85shgx+eJ5TsRNS9osPm6MlT7aF3s4Nhu8HssxqmhPLoaVwzfReJRvc4k0pDvoQO+mSDVAWh796/N1mAgkJq87RyLESuQN6bcXTfrEG44nypL6VV4h8XqFrWdoV7eTHpLt12U0UbB80dscTIKpHi3w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728999385; c=relaxed/simple; bh=iY21IH3eF8iJdFXYvdZBPuYiIxe6V7mRo+rrMEF6eKI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CyK1ALMppzVw01Y5JjKtHHwhOVbZU7n4e0iG3qSfNm7Rr8FvWn9FURmQYRMac0qdZ3LAfAMAuFbgSSbN+taFS5zjSgITBe9jheomI9q4cY2O7na9fvMKh6LesE3PcD7rWcftFDfpKpc02yMgNcm2hDNyqxz0IjzTqLwh+DRMgKM= 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=L8Z5TeRx; 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="L8Z5TeRx" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728999383; 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=pPNyQIVmdnqt03qJYroky5p+HPi+skedO7eQPH1tSRI=; b=L8Z5TeRx/omZCtfXQzVKqu1/e9oD43+5Z0R8lbACzGEHnGAyT3zEevSqiPBDXUKrqKdCyG LfE9rdAo4aKxCxK1O9Dc8IZBrD4d1T18y7A+P65dAUG5pKuff8jNHpwWdEvkti30R2bDum hq50LjAVYMlPpBtF4dNOnITftQCsv08= 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-385-6GRVnCvLOn-rx6IgJXUCVA-1; Tue, 15 Oct 2024 09:36:21 -0400 X-MC-Unique: 6GRVnCvLOn-rx6IgJXUCVA-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 B75471955D5B; Tue, 15 Oct 2024 13:36:20 +0000 (UTC) Received: from fedora.brq.redhat.com (unknown [10.43.17.159]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E8BA119560A3; Tue, 15 Oct 2024 13:36:18 +0000 (UTC) From: tglozar@redhat.com To: rostedt@goodmis.org Cc: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, jkacur@redhat.com, jwyatt@redhat.com, Tomas Glozar Subject: [PATCH v4 6/6] rtla: Documentation: Mention --deepest-idle-state Date: Tue, 15 Oct 2024 15:35:52 +0200 Message-ID: <20241015133552.3043040-7-tglozar@redhat.com> In-Reply-To: <20241015133552.3043040-1-tglozar@redhat.com> References: <20241015133552.3043040-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.0 on 10.30.177.12 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.47.0