summaryrefslogtreecommitdiffstats
path: root/scripts/syscallnr.sh
diff options
context:
space:
mode:
authorNicolas Pitre <npitre@baylibre.com>2024-07-07 21:05:19 +0200
committerAndrew Morton <akpm@linux-foundation.org>2024-09-02 05:43:22 +0200
commitb29a62d87cc0af3e9d134e9e0863b2cb053070b8 (patch)
treef4310b4fdd7cd91867afcf97c79af0822b5a1e58 /scripts/syscallnr.sh
parentLinux 6.11-rc6 (diff)
downloadlinux-b29a62d87cc0af3e9d134e9e0863b2cb053070b8.tar.xz
linux-b29a62d87cc0af3e9d134e9e0863b2cb053070b8.zip
mul_u64_u64_div_u64: make it precise always
Patch series "mul_u64_u64_div_u64: new implementation", v3. This provides an implementation for mul_u64_u64_div_u64() that always produces exact results. This patch (of 2): Library facilities must always return exact results. If the caller may be contented with approximations then it should do the approximation on its own. In this particular case the comment in the code says "the algorithm ... below might lose some precision". Well, if you try it with e.g.: a = 18446462598732840960 b = 18446462598732840960 c = 18446462598732840961 then the produced answer is 0 whereas the exact answer should be 18446462598732840959. This is _some_ precision lost indeed! Let's reimplement this function so it always produces the exact result regardless of its inputs while preserving existing fast paths when possible. Uwe said: : My personal interest is to get the calculations in pwm drivers right. : This function is used in several drivers below drivers/pwm/ . With the : errors in mul_u64_u64_div_u64(), pwm consumers might not get the : settings they request. Although I have to admit that I'm not aware it : breaks real use cases (because typically the periods used are too short : to make the involved multiplications overflow), but I pretty sure am : not aware of all usages and it breaks testing. : : Another justification is commits like : https://git.kernel.org/tip/77baa5bafcbe1b2a15ef9c37232c21279c95481c, : where people start to work around the precision shortcomings of : mul_u64_u64_div_u64(). Link: https://lkml.kernel.org/r/20240707190648.1982714-1-nico@fluxnic.net Link: https://lkml.kernel.org/r/20240707190648.1982714-2-nico@fluxnic.net Signed-off-by: Nicolas Pitre <npitre@baylibre.com> Tested-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Reviewed-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Tested-by: Biju Das <biju.das.jz@bp.renesas.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'scripts/syscallnr.sh')
0 files changed, 0 insertions, 0 deletions