[Letux-kernel] [PATCH] MIPS: Fix a longstanding error in div64.h
Huacai Chen
chenhuacai at kernel.org
Thu Apr 8 06:56:06 CEST 2021
Hi, Maciej,
On Wed, Apr 7, 2021 at 9:38 PM Maciej W. Rozycki <macro at orcam.me.uk> wrote:
>
> On Wed, 7 Apr 2021, Huacai Chen wrote:
>
> > > This code is rather broken in an obvious way, starting from:
> > >
> > > unsigned long long __n; \
> > > \
> > > __high = *__n >> 32; \
> > > __low = __n; \
> > >
> > > where `__n' is used uninitialised. Since this is my code originally I'll
> > > look into it; we may want to reinstate `do_div' too, which didn't have to
> > > be removed in the first place.
> > I think we can reuse the generic do_div().
>
> We can, but it's not clear to me if this is optimal. We have a DIVMOD
> instruction which original code took advantage of (although I can see
> potential in reusing bits from include/asm-generic/div64.h). The two
> implementations would have to be benchmarked against each other across a
> couple of different CPUs.
The original MIPS do_div() has "h" constraint, and this is also the
reason why Ralf rewrote this file. How can we reintroduce do_div()
without "h" constraint?
Huacai
>
> > > Huacai, thanks for your investigation! Please be more careful in
> > > verifying your future submissions however.
> > Sorry, I thought there is only one bug in div64.h, but in fact there
> > are three...
>
> This just shows the verification you made was not good enough, hence my
> observation.
>
> Maciej
More information about the Letux-kernel
mailing list