mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Mark Rutland <mark.rutland@arm.com>
Subject: [for-next][PATCH 05/11] ftrace: sample: avoid open-coded 64-bit division
Date: Tue, 07 Feb 2023 20:56:38 -0500	[thread overview]
Message-ID: <20230208015731.258171441@goodmis.org> (raw)
In-Reply-To: <20230208015633.791198913@goodmis.org>

From: Arnd Bergmann <arnd@arndb.de>

Calculating the average period requires a 64-bit division that leads
to a link failure on 32-bit architectures:

x86_64-linux-ld: samples/ftrace/ftrace-ops.o: in function `ftrace_ops_sample_init':
ftrace-ops.c:(.init.text+0x23b): undefined reference to `__udivdi3'

Use the div_u64() helper to do this instead. Since this is an init function that
is not called frequently, the runtime overhead is going to be acceptable.

Link: https://lore.kernel.org/linux-trace-kernel/20230130130246.247537-1-arnd@kernel.org

Cc: Masami Hiramatsu <mhiramat@kernel.org>
Fixes: b56c68f705ca ("ftrace: Add sample with custom ops")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 samples/ftrace/ftrace-ops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/samples/ftrace/ftrace-ops.c b/samples/ftrace/ftrace-ops.c
index 24deb51c7261..0c8da87ff5c3 100644
--- a/samples/ftrace/ftrace-ops.c
+++ b/samples/ftrace/ftrace-ops.c
@@ -223,7 +223,7 @@ static int __init ftrace_ops_sample_init(void)
 
 	pr_info("Attempted %u calls to %ps in %lluns (%lluns / call)\n",
 		nr_function_calls, tracee_relevant,
-		period, period / nr_function_calls);
+		period, div_u64(period, nr_function_calls));
 
 	if (persist)
 		return 0;
-- 
2.39.1

  parent reply	other threads:[~2023-02-08  1:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-08  1:56 [for-next][PATCH 00/11] tracing: Updates for 6.3 Steven Rostedt
2023-02-08  1:56 ` [for-next][PATCH 01/11] tracing/osnoise: No need for schedule_hrtimeout range Steven Rostedt
2023-02-08  1:56 ` [for-next][PATCH 02/11] tracing/histogram: Wrap remaining shell snippets in code blocks Steven Rostedt
2023-02-08  1:56 ` [for-next][PATCH 03/11] tracing: Acquire buffer from temparary trace sequence Steven Rostedt
2023-02-08  1:56 ` [for-next][PATCH 04/11] samples: ftrace: Include the nospec-branch.h only for x86 Steven Rostedt
2023-02-08  1:56 ` Steven Rostedt [this message]
2023-02-08  1:56 ` [for-next][PATCH 06/11] samples: ftrace: Make some global variables static Steven Rostedt
2023-02-08  1:56 ` [for-next][PATCH 07/11] tracing: Fix trace_event_raw_event_synth() if else statement Steven Rostedt
2023-02-08  1:56 ` [for-next][PATCH 08/11] tracing: Add creation of instances at boot command line Steven Rostedt
2023-02-08  1:56 ` [for-next][PATCH 09/11] tracing: Add enabling of events to boot instances Steven Rostedt
2023-02-08  1:56 ` [for-next][PATCH 10/11] tracing: Add trace_array_puts() to write into instance Steven Rostedt
2023-02-08  1:56 ` [for-next][PATCH 11/11] tracing: Allow boot instances to have snapshot buffers Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230208015731.258171441@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mhiramat@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®