RE: [PATCH v2 2/2] mul_u64_u64_div_u64: basic sanity test

From: Biju Das
Date: Thu Jul 04 2024 - 04:57:09 EST


Hi All,

> -----Original Message-----
> From: Biju Das
> Sent: Thursday, July 4, 2024 7:41 AM
> Subject: RE: [PATCH v2 2/2] mul_u64_u64_div_u64: basic sanity test
>
> Hi All,
>
> > -----Original Message-----
> > From: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxx>
> > Sent: Wednesday, July 3, 2024 10:36 PM
> > Subject: Re: [PATCH v2 2/2] mul_u64_u64_div_u64: basic sanity test
> >
> > Hello Andrew,
> >
> > On Wed, Jul 03, 2024 at 01:47:10PM -0400, Nicolas Pitre wrote:
> > > On Wed, 3 Jul 2024, Andrew Morton wrote:
> > >
> > > > On Tue, 2 Jul 2024 23:34:09 -0400 Nicolas Pitre <nico@xxxxxxxxxxx> wrote:
> > > >
> > > > > Verify that edge cases produce proper results, and some more.
> > > >
> > > > Awesome, thanks.
> > > >
> > > > Do you know of any situations in which the present implementation
> > > > causes issues?
> > >
> > > Uwe could probably elaborate further, but the example given in the
> > > first commit log is causing trouble for a driver he's working on.
> >
> > Actually the example was a constructed one. I became aware of
> > mul_u64_u64_div_u64() being only an approximation while reviewing a pwm driver by Biju Das:
> >
> > https://lore.kernel.org/linux-
> > pwm/TYCPR01MB1126992DD51F714AEDADF0A4F868DA@xxxxxxxxxxxxxxxxxxxxxxxxxx
> > od.outlook.com
> >
> > mul_u64_u64_div_u64 is used in various pwm drivers, but in practise
> > the periods used are small enough to not be problematic for the status
> > quo implementation since commit 8c86fb68ffcb
> > ("mul_u64_u64_div_u64: increase precision by conditionally swapping a
> > and b"). At least I think Biju (added to Cc:) only hit this problem during testing, and not in a
> real world application.
> >
> > I intend to do a performance test of Nico's code. I hope I get to that tomorrow.
>
> I should be able to test the new patch[1] with [2] as mul_u64_u64_div_u64() used in [2].
>
> [1] https://lkml.org/lkml/2024/6/28/1130
> [2] https://lore.kernel.org/linux-renesas-soc/20240614154242.419043-1-biju.das.jz@xxxxxxxxxxxxxx/
>
> I will test and provide feedback soon.

I tested the patch [1] with [2] (CONFIG_PWM_DEBUG=y)
I don't see any idempotent issues. So,

Tested-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>

Cheers,
Biju