From patchwork Tue Feb 6 11:05:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Bristot de Oliveira X-Patchwork-Id: 13547023 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 2849612EBF1; Tue, 6 Feb 2024 11:05:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707217546; cv=none; b=ivkgRbgbmub5rKiVtyd4N5r5e6/C0zvKJTAygBFpAN28KFdrtEj6vRWCAL/1dK2j6BZRG9PIMQhBjzEr1aSd0qs8gcCJRsRSfPnCTyUNCcHA+CBX/MVUW0sW5YkcTiD4d+Q154Jgo/bSSXpdRB359kLTZxmOPcX/lPKugl7et48= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707217546; c=relaxed/simple; bh=H+Nq8LvP8FkxrlJRAmYgk8e/3dEvC0tbNoCGSHxyVo4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ioeBjY4eqEQcizuGJeyGsx4BCyHAWX0gHm8JmXfKAhaNwB+0Hh+Qz4qjtPDnAaRKlDW8/8t5Vn49DrXSQttF/Pce0P7GkyThfetclItYWMSC5GK2IQJpH9Tm/z3zGyBtTWM6khaac4s2W3KBfV9Qec7Uo/OjDFQHAMzqKDyUWGk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=X1YMZore; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="X1YMZore" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1E4EC43390; Tue, 6 Feb 2024 11:05:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707217545; bh=H+Nq8LvP8FkxrlJRAmYgk8e/3dEvC0tbNoCGSHxyVo4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X1YMZore3LK+hCmmjIJLFzaMEHTPS9Qer8HNeXEdoITlXgsKwybVTMlk7mMKDGKYL 5Lxx2Wcd39OParl2MLKcQlUctSN1L7TYfrEpzMGRxxDnLkyi3RRNvDUdsRudp0NqLo QUqF93n5ZJqy/MDPF6N6FUsR6f+taP3kDkJY1EmYfyHTfIsEFnVCePQSihf5/K2AqP 8d6ZuSA2UCudZedqbbxHF2K1EsMxyDiP7N1aT+vDWRgr27TV8/37pIX7c/9hojch1y pWeOAEQuegm7z7CXj2SDZEdxh7aTj7lE4QW1m/TSaWluNkgizRgdaqyuW5JbIZ68oy wB+HVVlTBS9Yg== From: Daniel Bristot de Oliveira To: Steven Rostedt Cc: Daniel Bristot de Oliveira , Masami Hiramatsu , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Donald Zickus , stable@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 1/6] tools/rtla: Fix Makefile compiler options for clang Date: Tue, 6 Feb 2024 12:05:29 +0100 Message-ID: <567ac1b94effc228ce9a0225b9df7232a9b35b55.1707217097.git.bristot@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The following errors are showing up when compiling rtla with clang: $ make HOSTCC=clang CC=clang LLVM_IAS=1 [...] clang -O -g -DVERSION=\"6.8.0-rc1\" -flto=auto -ffat-lto-objects -fexceptions -fstack-protector-strong -fasynchronous-unwind-tables -fstack-clash-protection -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -Wno-maybe-uninitialized $(pkg-config --cflags libtracefs) -c -o src/utils.o src/utils.c clang: warning: optimization flag '-ffat-lto-objects' is not supported [-Wignored-optimization-argument] warning: unknown warning option '-Wno-maybe-uninitialized'; did you mean '-Wno-uninitialized'? [-Wunknown-warning-option] 1 warning generated. clang -o rtla -ggdb src/osnoise.o src/osnoise_hist.o src/osnoise_top.o src/rtla.o src/timerlat_aa.o src/timerlat.o src/timerlat_hist.o src/timerlat_top.o src/timerlat_u.o src/trace.o src/utils.o $(pkg-config --libs libtracefs) src/osnoise.o: file not recognized: file format not recognized clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [Makefile:110: rtla] Error 1 Solve these issues by: - removing -ffat-lto-objects and -Wno-maybe-uninitialized if using clang - informing the linker about -flto=auto Cc: stable@vger.kernel.org Fixes: 1a7b22ab15eb ("tools/rtla: Build with EXTRA_{C,LD}FLAGS") Suggested-by: Donald Zickus Signed-off-by: Daniel Bristot de Oliveira --- tools/tracing/rtla/Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/tracing/rtla/Makefile b/tools/tracing/rtla/Makefile index 2456a399eb9a..afd18c678ff5 100644 --- a/tools/tracing/rtla/Makefile +++ b/tools/tracing/rtla/Makefile @@ -28,10 +28,15 @@ FOPTS := -flto=auto -ffat-lto-objects -fexceptions -fstack-protector-strong \ -fasynchronous-unwind-tables -fstack-clash-protection WOPTS := -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -Wno-maybe-uninitialized +ifeq ($(CC),clang) + FOPTS := $(filter-out -ffat-lto-objects, $(FOPTS)) + WOPTS := $(filter-out -Wno-maybe-uninitialized, $(WOPTS)) +endif + TRACEFS_HEADERS := $$($(PKG_CONFIG) --cflags libtracefs) CFLAGS := -O -g -DVERSION=\"$(VERSION)\" $(FOPTS) $(MOPTS) $(WOPTS) $(TRACEFS_HEADERS) $(EXTRA_CFLAGS) -LDFLAGS := -ggdb $(EXTRA_LDFLAGS) +LDFLAGS := -flto=auto -ggdb $(EXTRA_LDFLAGS) LIBS := $$($(PKG_CONFIG) --libs libtracefs) SRC := $(wildcard src/*.c) From patchwork Tue Feb 6 11:05:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Bristot de Oliveira X-Patchwork-Id: 13547024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A27C512F592; Tue, 6 Feb 2024 11:05:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707217548; cv=none; b=fFHd3qwfhaoapvWWQ72aegCbAI9Cw5zRhJ3nmagWpsdPBfhYSaT4dp93ea04Nh4JHcqZXsNdyJR/YKVu5UKZ1kS6thtcjyslTWFU+9S6q8/1lDGGi4pouL1TjwzdfvwRcnQxw4lCYr6p8YbctuSY1RUWngGJHsD7F/tUEMIuMrU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707217548; c=relaxed/simple; bh=hJBcq6G53sR+Sok4UfO9asd3HIeiHC7fn0zZDIFhFKw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=goiCOaVPIJfKQlEwb9Hty2TfDYqq/nmN3n2PVfWZoftZQtSkMRJhiAWeNPoP+vMFG6DfIGmDLCSFGO7cyffn04nfl+UuWuJtuTK647nTXV+u54EU1omxVX+3N/cN2THk3c6GqwOJMBlQo/gLN4LUQ5zNs7thvPBdu97bH64vFtk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bcwBOYz1; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bcwBOYz1" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF0A1C433F1; Tue, 6 Feb 2024 11:05:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707217548; bh=hJBcq6G53sR+Sok4UfO9asd3HIeiHC7fn0zZDIFhFKw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bcwBOYz1BMGlcZEu4c59TB4CPKUsT2QK1ewkFW+0mBdhO4CM8hRvndL7AHm4wI+Q4 g9WJvsh4FAsHgR3mUJFsLDAkrD7p4n+kzbdf+5wbUMjZarqCPtjb1TlgedNm7bjVvS 9/hjcRzqqIi9TdAsjXOu+0PvqlpTS5FIvuY71mRr0AYi0xIk9nZZg/bzZtWDqzbf+M p4Ed8JBdvVlr1/kONzexSsLh0xcXtXCkLN3jQnpJbiJhAq0enuqhLU/FXyTZN2S+eX JEdu0w1MgxQbzzpkkh99Ie291zgXpSTB2WB6m5nhauJKf+IXr5Dqj8OxYEisPgwId6 AUr3L3KgjEUtg== From: Daniel Bristot de Oliveira To: Steven Rostedt Cc: Daniel Bristot de Oliveira , Masami Hiramatsu , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Donald Zickus , stable@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 2/6] tools/rtla: Fix uninitialized bucket/data->bucket_size warning Date: Tue, 6 Feb 2024 12:05:30 +0100 Message-ID: <6e1b1665cd99042ae705b3e0fc410858c4c42346.1707217097.git.bristot@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 When compiling rtla with clang, I am getting the following warnings: $ make HOSTCC=clang CC=clang LLVM_IAS=1 [..] clang -O -g -DVERSION=\"6.8.0-rc3\" -flto=auto -fexceptions -fstack-protector-strong -fasynchronous-unwind-tables -fstack-clash-protection -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS $(pkg-config --cflags libtracefs) -c -o src/osnoise_hist.o src/osnoise_hist.c src/osnoise_hist.c:138:6: warning: variable 'bucket' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] 138 | if (data->bucket_size) | ^~~~~~~~~~~~~~~~~ src/osnoise_hist.c:149:6: note: uninitialized use occurs here 149 | if (bucket < entries) | ^~~~~~ src/osnoise_hist.c:138:2: note: remove the 'if' if its condition is always true 138 | if (data->bucket_size) | ^~~~~~~~~~~~~~~~~~~~~~ 139 | bucket = duration / data->bucket_size; src/osnoise_hist.c:132:12: note: initialize the variable 'bucket' to silence this warning 132 | int bucket; | ^ | = 0 1 warning generated. [...] clang -O -g -DVERSION=\"6.8.0-rc3\" -flto=auto -fexceptions -fstack-protector-strong -fasynchronous-unwind-tables -fstack-clash-protection -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS $(pkg-config --cflags libtracefs) -c -o src/timerlat_hist.o src/timerlat_hist.c src/timerlat_hist.c:181:6: warning: variable 'bucket' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] 181 | if (data->bucket_size) | ^~~~~~~~~~~~~~~~~ src/timerlat_hist.c:204:6: note: uninitialized use occurs here 204 | if (bucket < entries) | ^~~~~~ src/timerlat_hist.c:181:2: note: remove the 'if' if its condition is always true 181 | if (data->bucket_size) | ^~~~~~~~~~~~~~~~~~~~~~ 182 | bucket = latency / data->bucket_size; src/timerlat_hist.c:175:12: note: initialize the variable 'bucket' to silence this warning 175 | int bucket; | ^ | = 0 1 warning generated. This is a legit warning, but data->bucket_size is always > 0 (see timerlat_hist_parse_args()), so the if is not necessary. Remove the unneeded if (data->bucket_size) to avoid the warning. Cc: stable@vger.kernel.org Fixes: 1eeb6328e8b3 ("rtla/timerlat: Add timerlat hist mode") Fixes: 829a6c0b5698 ("rtla/osnoise: Add the hist mode") Signed-off-by: Daniel Bristot de Oliveira --- tools/tracing/rtla/src/osnoise_hist.c | 3 +-- tools/tracing/rtla/src/timerlat_hist.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src/osnoise_hist.c index 8f81fa007364..67128171c29d 100644 --- a/tools/tracing/rtla/src/osnoise_hist.c +++ b/tools/tracing/rtla/src/osnoise_hist.c @@ -135,8 +135,7 @@ static void osnoise_hist_update_multiple(struct osnoise_tool *tool, int cpu, if (params->output_divisor) duration = duration / params->output_divisor; - if (data->bucket_size) - bucket = duration / data->bucket_size; + bucket = duration / data->bucket_size; total_duration = duration * count; diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/src/timerlat_hist.c index 47d3d8b53cb2..3a5b8c409e7d 100644 --- a/tools/tracing/rtla/src/timerlat_hist.c +++ b/tools/tracing/rtla/src/timerlat_hist.c @@ -178,8 +178,7 @@ timerlat_hist_update(struct osnoise_tool *tool, int cpu, if (params->output_divisor) latency = latency / params->output_divisor; - if (data->bucket_size) - bucket = latency / data->bucket_size; + bucket = latency / data->bucket_size; if (!context) { hist = data->hist[cpu].irq; From patchwork Tue Feb 6 11:05:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Bristot de Oliveira X-Patchwork-Id: 13547025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 ED22112FF76; Tue, 6 Feb 2024 11:05:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707217552; cv=none; b=EPYKXp91RrvGyMwZY0DjL4rsaTh7X+FpZVveQz51rXe+93DWREGEmYTVsMJ1MmKqbd6c0kWOc9EXV02jCJzGlhEaB00YjgwCcLEM6RRRAsYM9KBR7R6opvn4C1aVN8zz4tM+xj9T2MbZWphYsOEKLChqh6aWIxoaO9FeNwW10wc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707217552; c=relaxed/simple; bh=HBpkihUOz+42qTZ8E70fvuC94UrnuMtLk3YD9XXg8zY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MO7a6/9IFYc0qHhdKGvORfTX0NK1WESqqTYPa9iiZnHGNHIboaO2hlQGjRhv6vWa76mu7S7wvi6oExTEIIdhZ/FwRHGxrK3d8RXRcUGvEyjE9/5wgcV85e3G4BoSr9muufk7G7v48bKNm6ehS73yhE5qSe5+XGW+zxId2UNqneo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MWvy0TH6; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MWvy0TH6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5F89C433C7; Tue, 6 Feb 2024 11:05:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707217551; bh=HBpkihUOz+42qTZ8E70fvuC94UrnuMtLk3YD9XXg8zY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MWvy0TH6y70WyLpUralBEy1uvKuZYhREElojJQhvCasstwIFVA6ZDTE3y2ZhvVnf3 Uvg/RBvyK7RRGTSI3dU1S5Mu9YS5yTRt7zy7P/kScj0CeSKOaduC4l+lQ2zqzzKBt7 EW5b10Br+lMZJ+yp9TDtxhlq64u+0ePeOWOxFfJq3k/LhKhvTaevgTzUKjdRb7nqCw fN7JdlbEDUcQm89rxay+oxj7kyKk9IB4z5MdrVmyWu91xVk33aEnPKTbQKCwi1gVKc mgyEPNSFKKjUJZg+AHkXW73VMoL9iuRGe+VOWkogskl4IOOLKKpLOp1RiEdwzccEZg ToL6obNvwEUXg== From: Daniel Bristot de Oliveira To: Steven Rostedt Cc: Daniel Bristot de Oliveira , Masami Hiramatsu , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Donald Zickus , stable@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 3/6] tools/rtla: Fix clang warning about mount_point var size Date: Tue, 6 Feb 2024 12:05:31 +0100 Message-ID: <1b46712e93a2f4153909514a36016959dcc4021c.1707217097.git.bristot@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 clang is reporting this warning: $ make HOSTCC=clang CC=clang LLVM_IAS=1 [...] clang -O -g -DVERSION=\"6.8.0-rc3\" -flto=auto -fexceptions -fstack-protector-strong -fasynchronous-unwind-tables -fstack-clash-protection -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS $(pkg-config --cflags libtracefs) -c -o src/utils.o src/utils.c src/utils.c:548:66: warning: 'fscanf' may overflow; destination buffer in argument 3 has size 1024, but the corresponding specifier may require size 1025 [-Wfortify-source] 548 | while (fscanf(fp, "%*s %" STR(MAX_PATH) "s %99s %*s %*d %*d\n", mount_point, type) == 2) { | ^ Increase mount_point variable size to MAX_PATH+1 to avoid the overflow. Cc: stable@vger.kernel.org Fixes: a957cbc02531 ("rtla: Add -C cgroup support") Signed-off-by: Daniel Bristot de Oliveira --- tools/tracing/rtla/src/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tracing/rtla/src/utils.c b/tools/tracing/rtla/src/utils.c index c769d7b3842c..b998b24edf1e 100644 --- a/tools/tracing/rtla/src/utils.c +++ b/tools/tracing/rtla/src/utils.c @@ -536,7 +536,7 @@ int set_cpu_dma_latency(int32_t latency) */ static const int find_mount(const char *fs, char *mp, int sizeof_mp) { - char mount_point[MAX_PATH]; + char mount_point[MAX_PATH+1]; char type[100]; int found = 0; FILE *fp; From patchwork Tue Feb 6 11:05:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Bristot de Oliveira X-Patchwork-Id: 13547026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E5A26130AD3; Tue, 6 Feb 2024 11:05:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707217555; cv=none; b=imfEcmbWovZkCAyHb88spnYbHFt4PoWi+Z0FOf8y0NfdNuc/ZLf0g42yCdXydzZOhiquRuHzvZtQ/OX9Mj3l4WOJhS2eODuuqnkfvzBxqnh9NT+E8SIUT2bW9RCqzXL3imBQeDiVqoG20s9bEO4msKViBCzmvEuFDfCX30tja10= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707217555; c=relaxed/simple; bh=rDmpciVOtng6F7rfQEs1JlIM6VsqeY8XNBiItpt3u0o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fOaut82lchQs/3UPZS4znraoxV/7XrqqXhEiqYXqQyETEFmF3fN1YwpSijDBg4/Iqn5CV6hUtpjFk3S5P9vKnZDGpe65uDqHfsFdl+2i1V8zte6DsGoogQCEvcx8PyXAt6H/ASguN5CBMthxXxHLGfc3HXMSzZtGW6NSH6qjxfw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UGTxcVLx; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UGTxcVLx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB4DBC433B1; Tue, 6 Feb 2024 11:05:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707217554; bh=rDmpciVOtng6F7rfQEs1JlIM6VsqeY8XNBiItpt3u0o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UGTxcVLx1FDdDingKcw57Mv7aaoCD1DBkey/KBRNxqwFqI5QwnsMNNwYez38KWT1R iGjKkGNQUJNL/0H0PC5LaijC5i3ai+UsENlOe8KWHw3JKg96rieo1KNV+6wAJWqXcF sQiHZXTr3horKlqnshJ8Eb+X/NizW/Do2rH7G1xpRsBK02xDSiA6tjSJgE5cb9G8Ib 9bd/jHhQOfvZl7cfBoq676uY8FKex0PjODw/MRHbfbkk9qTirD+f2FWGtWD7vdQcVa Lajc++Ir9dNnkvvN2q2vaYB/14qDS7BWOaB98fKvT67NgER85qbQr7xq2jWSyIJyn/ 7IyhHwftf8hOQ== From: Daniel Bristot de Oliveira To: Steven Rostedt Cc: Daniel Bristot de Oliveira , Masami Hiramatsu , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Donald Zickus , stable@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 4/6] tools/rtla: Remove unused sched_getattr() function Date: Tue, 6 Feb 2024 12:05:32 +0100 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Clang is reporting: $ make HOSTCC=clang CC=clang LLVM_IAS=1 [...] clang -O -g -DVERSION=\"6.8.0-rc3\" -flto=auto -fexceptions -fstack-protector-strong -fasynchronous-unwind-tables -fstack-clash-protection -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS $(pkg-config --cflags libtracefs) -c -o src/utils.o src/utils.c src/utils.c:241:19: warning: unused function 'sched_getattr' [-Wunused-function] 241 | static inline int sched_getattr(pid_t pid, struct sched_attr *attr, | ^~~~~~~~~~~~~ 1 warning generated. Which is correct, so remove the unused function. Cc: stable@vger.kernel.org Fixes: b1696371d865 ("rtla: Helper functions for rtla") Signed-off-by: Daniel Bristot de Oliveira --- tools/tracing/rtla/src/utils.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tools/tracing/rtla/src/utils.c b/tools/tracing/rtla/src/utils.c index b998b24edf1e..5fcd6495ff05 100644 --- a/tools/tracing/rtla/src/utils.c +++ b/tools/tracing/rtla/src/utils.c @@ -238,12 +238,6 @@ static inline int sched_setattr(pid_t pid, const struct sched_attr *attr, return syscall(__NR_sched_setattr, pid, attr, flags); } -static inline int sched_getattr(pid_t pid, struct sched_attr *attr, - unsigned int size, unsigned int flags) -{ - return syscall(__NR_sched_getattr, pid, attr, size, flags); -} - int __set_sched_attr(int pid, struct sched_attr *attr) { int flags = 0; From patchwork Tue Feb 6 11:05:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Bristot de Oliveira X-Patchwork-Id: 13547027 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D7850130AF2; Tue, 6 Feb 2024 11:05:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707217558; cv=none; b=hF+ek1yDNxbQryoDfwkH5coFcG2GxlrrGRCA1aVOfWbR2z54oUpbGxY8vVdL0AQ+QLHtwyIBnNZRLtboC79+LFOtSiTvc6afPYAMlf1vb65Spg0vciEZfLBlqqj/3OKq58iGtDljvNWQhzGB+xIL+lSza6oPfFGej+wdqzbWECs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707217558; c=relaxed/simple; bh=oBgtkf5GsR7oInvTgvXmuuezLk03GfOH/+6u6oZvCho=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kSabcQ/qDLBbaDuc42kcGdTo4SK7BFblGdz7Wvr4zxYiiOmyGiDEjUd+5QRrbUAWEJ9I7shaIxEHCJhYJ7vS8udnVAbcpYicVPIIQmi6b8wfmaR1ot+nx5GQ2+udwHkuocboekKCaiWm5X54oP4I5lembpuF4JkMhfSXttPFloc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XfNv2wNL; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XfNv2wNL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE566C433F1; Tue, 6 Feb 2024 11:05:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707217557; bh=oBgtkf5GsR7oInvTgvXmuuezLk03GfOH/+6u6oZvCho=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XfNv2wNLBieC8aH78hNfv/GOF8mA9hhZmEPpD6sAgcVmpsetChkXkZxAQjZA8W/qB vq3e7vtbYLs9eWyE75mfegnu/BIje/RaSfhfkG3Z1lop7paRAhULue7h6ecnY7Ixj0 4B4MIuqKYCqSdKbDx17zLMT+Q29oXRv6HpBrMnOMoeS+EipoolxR4oVoskghah3u3z zLPCI2iJO+c47fgM+nRJ2KETK5hbRdcunESQpSxzAgExHiEnoWLbj5WYUDYzhLxVf1 hG0SEV0+v1h4yPYRixQHCHsap/5qDGLSe9LdB8BBsvW3LydH85CwtgNTJHgKhF8D+t ly5UkWT4NfseA== From: Daniel Bristot de Oliveira To: Steven Rostedt Cc: Daniel Bristot de Oliveira , Masami Hiramatsu , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Donald Zickus , stable@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 5/6] tools/rv: Fix Makefile compiler options for clang Date: Tue, 6 Feb 2024 12:05:33 +0100 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The following errors are showing up when compiling rv with clang: $ make HOSTCC=clang CC=clang LLVM_IAS=1 [...] clang -O -g -DVERSION=\"6.8.0-rc1\" -flto=auto -ffat-lto-objects -fexceptions -fstack-protector-strong -fasynchronous-unwind-tables -fstack-clash-protection -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -Wno-maybe-uninitialized $(pkg-config --cflags libtracefs) -I include -c -o src/utils.o src/utils.c clang: warning: optimization flag '-ffat-lto-objects' is not supported [-Wignored-optimization-argument] warning: unknown warning option '-Wno-maybe-uninitialized'; did you mean '-Wno-uninitialized'? [-Wunknown-warning-option] 1 warning generated. clang -o rv -ggdb src/in_kernel.o src/rv.o src/trace.o src/utils.o $(pkg-config --libs libtracefs) src/in_kernel.o: file not recognized: file format not recognized clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [Makefile:110: rv] Error 1 Solve these issues by: - removing -ffat-lto-objects and -Wno-maybe-uninitialized if using clang - informing the linker about -flto=auto Cc: stable@vger.kernel.org Fixes: 4bc4b131d44c ("rv: Add rv tool") Suggested-by: Donald Zickus Signed-off-by: Daniel Bristot de Oliveira --- tools/verification/rv/Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/verification/rv/Makefile b/tools/verification/rv/Makefile index 3d0f3888a58c..485f8aeddbe0 100644 --- a/tools/verification/rv/Makefile +++ b/tools/verification/rv/Makefile @@ -28,10 +28,15 @@ FOPTS := -flto=auto -ffat-lto-objects -fexceptions -fstack-protector-strong \ -fasynchronous-unwind-tables -fstack-clash-protection WOPTS := -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -Wno-maybe-uninitialized +ifeq ($(CC),clang) + FOPTS := $(filter-out -ffat-lto-objects, $(FOPTS)) + WOPTS := $(filter-out -Wno-maybe-uninitialized, $(WOPTS)) +endif + TRACEFS_HEADERS := $$($(PKG_CONFIG) --cflags libtracefs) CFLAGS := -O -g -DVERSION=\"$(VERSION)\" $(FOPTS) $(MOPTS) $(WOPTS) $(TRACEFS_HEADERS) $(EXTRA_CFLAGS) -I include -LDFLAGS := -ggdb $(EXTRA_LDFLAGS) +LDFLAGS := -flto=auto -ggdb $(EXTRA_LDFLAGS) LIBS := $$($(PKG_CONFIG) --libs libtracefs) SRC := $(wildcard src/*.c) From patchwork Tue Feb 6 11:05:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Bristot de Oliveira X-Patchwork-Id: 13547028 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E658012FF81; Tue, 6 Feb 2024 11:06:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707217561; cv=none; b=aFvfGrrHIDiuprtLGP7Nv4ha/lz1TkLxdVxhFzL2sYzFeNQvHmXk+qG9GtQed4Vyl+eDnK8PRi2+a8NodyiZNFmTHyoT2iQY1Nczk0sYE+lJndn5075GhCMF0pBjmOHObNvadiMfBzu9ge2IvRZLhvzbcRyjmfIagv3w8Op8gtE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707217561; c=relaxed/simple; bh=cQILpcsc6/caTGhPuQvyIMhE5e7gEUIcuJuq7dS5DzU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uLYTYQYqMfBKZsz3gdhmpp9nnQY8JYPlMyyWI5eAGxC0aByAXmstW08eFMsMJ5w84+QBAIUVlJzXiLKxR7SmJGdwz1RrBiOXQ3HxFpu/J7fFB+vwuebZ7fzjQUUD0ry2RlHnQ/0hOm9T/Yy0WPbxk5yN1eJSW0pZbxsPgJXCPag= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qNAk/p1h; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qNAk/p1h" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5329C43601; Tue, 6 Feb 2024 11:05:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707217560; bh=cQILpcsc6/caTGhPuQvyIMhE5e7gEUIcuJuq7dS5DzU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qNAk/p1hqgs2qNxzkK+RBgTpAM/VFwbYgtnM1c9lb2Q0rHMldJ//ypQTGqDSsrpN7 LKIkesoHrymKbLwrTuySqv5SFslmDqjKFSxqAPjtj5yYwjb9+5OcPgASS+DzKrfUzz IiVFuT035jqlqg/ODAxaQz0L9qJsWNkb5zISWh5XD5MCTy0PF8IKAyA0GirkYmKTZj 5Tr5aOmH+/n6sf2CfSH971A+AI8VKXVon6ulwAiCiCh0xw5ID4XBOeSMHdCdR9b0Rq M/RGvSjW2/M6ZBybWKK9tYvmnM1BmqBHRcCKCc3sJt8uzO70UA02Dch37aIpTskk6b NGBxluCDET6/g== From: Daniel Bristot de Oliveira To: Steven Rostedt Cc: Daniel Bristot de Oliveira , Masami Hiramatsu , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Donald Zickus , stable@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 6/6] tools/rv: Fix curr_reactor uninitialized variable Date: Tue, 6 Feb 2024 12:05:34 +0100 Message-ID: <3a35551149e5ee0cb0950035afcb8082c3b5d05b.1707217097.git.bristot@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 clang is reporting: $ make HOSTCC=clang CC=clang LLVM_IAS=1 clang -O -g -DVERSION=\"6.8.0-rc3\" -flto=auto -fexceptions -fstack-protector-strong -fasynchronous-unwind-tables -fstack-clash-protection -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS $(pkg-config --cflags libtracefs) -I include -c -o src/in_kernel.o src/in_kernel.c [...] src/in_kernel.c:227:6: warning: variable 'curr_reactor' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] 227 | if (!end) | ^~~~ src/in_kernel.c:242:9: note: uninitialized use occurs here 242 | return curr_reactor; | ^~~~~~~~~~~~ src/in_kernel.c:227:2: note: remove the 'if' if its condition is always false 227 | if (!end) | ^~~~~~~~~ 228 | goto out_free; | ~~~~~~~~~~~~~ src/in_kernel.c:221:6: warning: variable 'curr_reactor' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] 221 | if (!start) | ^~~~~~ src/in_kernel.c:242:9: note: uninitialized use occurs here 242 | return curr_reactor; | ^~~~~~~~~~~~ src/in_kernel.c:221:2: note: remove the 'if' if its condition is always false 221 | if (!start) | ^~~~~~~~~~~ 222 | goto out_free; | ~~~~~~~~~~~~~ src/in_kernel.c:215:20: note: initialize the variable 'curr_reactor' to silence this warning 215 | char *curr_reactor; | ^ | = NULL 2 warnings generated. Which is correct. Setting curr_reactor to NULL avoids the problem. Cc: stable@vger.kernel.org Fixes: 6d60f89691fc ("tools/rv: Add in-kernel monitor interface") Signed-off-by: Daniel Bristot de Oliveira --- tools/verification/rv/src/in_kernel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/verification/rv/src/in_kernel.c b/tools/verification/rv/src/in_kernel.c index ad28582bcf2b..f04479ecc96c 100644 --- a/tools/verification/rv/src/in_kernel.c +++ b/tools/verification/rv/src/in_kernel.c @@ -210,9 +210,9 @@ static char *ikm_read_reactor(char *monitor_name) static char *ikm_get_current_reactor(char *monitor_name) { char *reactors = ikm_read_reactor(monitor_name); + char *curr_reactor = NULL; char *start; char *end; - char *curr_reactor; if (!reactors) return NULL;