[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAC_TJveS5shKASQZuBeXr2SbVURQPCAWWgMEHBgnv5zPvCC40g@mail.gmail.com>
Date: Tue, 19 Oct 2021 14:24:25 -0700
From: Kalesh Singh <kaleshsingh@...gle.com>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Suren Baghdasaryan <surenb@...gle.com>,
Hridya Valsaraju <hridya@...gle.com>,
Namhyung Kim <namhyung@...nel.org>,
Jonathan Corbet <corbet@....net>,
Ingo Molnar <mingo@...hat.com>, Shuah Khan <shuah@...nel.org>,
Tom Zanussi <zanussi@...nel.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
"open list:DOCUMENTATION" <linux-doc@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@...r.kernel.org>,
"Cc: Android Kernel" <kernel-team@...roid.com>
Subject: Re: [PATCH 2/5] tracing: Add division and multiplication support for
hist triggers
On Tue, Oct 19, 2021 at 1:45 PM Steven Rostedt <rostedt@...dmis.org> wrote:
>
> On Wed, 15 Sep 2021 19:52:46 +0000
> Kalesh Singh <kaleshsingh@...gle.com> wrote:
>
> > +static u64 hist_field_div(struct hist_field *hist_field,
> > + struct tracing_map_elt *elt,
> > + struct trace_buffer *buffer,
> > + struct ring_buffer_event *rbe,
> > + void *event)
> > +{
> > + struct hist_field *operand1 = hist_field->operands[0];
> > + struct hist_field *operand2 = hist_field->operands[1];
> > +
> > + u64 val1 = operand1->fn(operand1, elt, buffer, rbe, event);
> > + u64 val2 = operand2->fn(operand2, elt, buffer, rbe, event);
> > +
> > + /* Return -1 for the undefined case */
> > + if (!val2)
> > + return -1;
> > +
> > + return val1 / val2;
>
> This wont work on x86 32 bit machines, as u64 division will trigger
> floating point arithmetic by the compiler, and cause a fault.
Thanks for catching this. I'll address it in the next version.
- Kalesh
>
> You'll need to use one of the div64() helpers.
>
> -- Steve
>
>
> > +}
> > +
Powered by blists - more mailing lists