Messages in this thread | | | Date | Wed, 22 Mar 2023 13:40:44 +0000 | From | Mark Rutland <> | Subject | Re: [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.
| |