lkml.org 
[lkml]   [2023]   [Mar]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/2] tracing/hist: add modulus operator
On Sat, Mar 18, 2023 at 03:19:02PM -0400, Steven Rostedt wrote:
> On Thu, 2 Mar 2023 17:17:55 +0000
> Mark Rutland <mark.rutland@arm.com> wrote:
>
> > @@ -436,6 +438,21 @@ static u64 hist_field_mult(struct hist_field *hist_field,
> > return val1 * val2;
> > }
> >
> > +static u64 hist_field_mod(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 = hist_fn_call(operand1, elt, buffer, rbe, event);
> > + u64 val2 = hist_fn_call(operand2, elt, buffer, rbe, event);
> > +
> > + return val1 % val2;
>
> Is modulus operations on 64 bit integers valid on 32 bit architectures?
>
> Don't we need to do something like:
>
> div64_u64_rem(val1, val2, &rem);
> return rem;
>
> ?

Yes, we do; the build bots have also started shouting at me for this.

I'll go fold that in...

Mark.

\
 
 \ /
  Last update: 2023-03-27 01:12    [W:0.377 / U:0.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site