public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: kernel test robot <lkp@intel.com>,
	"Masami Hiramatsu (Google)" <mhiramat@kernel.org>,
	llvm@lists.linux.dev, kbuild-all@lists.01.org,
	Tom Zanussi <zanussi@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] tracing: Add .percent suffix option to histogram values
Date: Thu, 4 Aug 2022 23:57:19 +0900	[thread overview]
Message-ID: <20220804235719.d9fdd769212455958a721df9@kernel.org> (raw)
In-Reply-To: <20220802105646.50819088@gandalf.local.home>

On Tue, 2 Aug 2022 10:56:46 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Tue, 2 Aug 2022 14:49:36 +0800
> kernel test robot <lkp@intel.com> wrote:
> 
> > All errors (new ones prefixed by >>):
> > 
> > >> ld.lld: error: undefined symbol: __udivdi3  
> 
> This is due to this:
> 
> > @@ -5190,18 +5202,34 @@ static void hist_trigger_print_key(struct seq_file *m,
> >  	seq_puts(m, "}");
> >  }
> >  
> > +/* Get the 100 times of the percentage of @val in @total */
> > +static inline unsigned int __get_percentage(u64 val, u64 total)
> > +{
> > +	if (val < (U64_MAX / 10000))
> > +		return (unsigned int)(val * 10000 / total);
> > +	else
> > +		return val / (total / 10000);
> > +}
> > +
> 
> You can't use '/' on u64 values. You have to use div64*(). Otherwise 32 bit
> architectures may use floating point operations or glibc helpers.

Yeah, I forgot that. And also I have to check "total != 0" here. 

> 
> See the other divisions in trace_events_hist.c that do so too.

Thanks!

> 
> -- Steve
> 
> 
> >    >>> referenced by trace_events_hist.c:5211 (kernel/trace/trace_events_hist.c:5211)
> >    >>>               trace/trace_events_hist.o:(hist_show) in archive kernel/built-in.a
> >    >>> referenced by trace_events_hist.c:0 (kernel/trace/trace_events_hist.c:0)
> >    >>>               trace/trace_events_hist.o:(hist_show) in archive kernel/built-in.a
> >    >>> referenced by trace_events_hist.c:5211 (kernel/trace/trace_events_hist.c:5211)
> >    >>>               trace/trace_events_hist.o:(hist_show) in archive kernel/built-in.a
> >    >>> referenced 1 more times  
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

      reply	other threads:[~2022-08-04 14:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <165932284978.2881436.13536997915615710506.stgit@devnote2>
2022-08-02  6:49 ` [PATCH 1/2] tracing: Add .percent suffix option to histogram values kernel test robot
2022-08-02 14:56   ` Steven Rostedt
2022-08-04 14:57     ` Masami Hiramatsu [this message]

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=20220804235719.d9fdd769212455958a721df9@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=zanussi@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