public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Ard Biesheuvel" <ardb@kernel.org>
Cc: "Andre Przywara" <andre.przywara@arm.com>,
	"Naresh Kamboju" <naresh.kamboju@linaro.org>,
	"open list" <linux-kernel@vger.kernel.org>,
	"Linux ARM" <linux-arm-kernel@lists.infradead.org>,
	linux-sunxi@lists.linux.dev, dri-devel@lists.freedesktop.org,
	lkft-triage@lists.linaro.org,
	"Maxime Ripard" <mripard@kernel.org>,
	"Dave Airlie" <airlied@redhat.com>,
	"Dan Carpenter" <dan.carpenter@linaro.org>
Subject: Re: arm: ERROR: modpost: "__aeabi_uldivmod" [drivers/gpu/drm/sun4i/sun4i-drm-hdmi.ko] undefined!
Date: Mon, 04 Mar 2024 14:48:56 +0100	[thread overview]
Message-ID: <61aa333f-aa13-4068-b73f-eeae615f4640@app.fastmail.com> (raw)
In-Reply-To: <CAMj1kXENYqUx=esK9b_pGd4wpwE43fNaGRCUhJLK_4MQzrAQeg@mail.gmail.com>

On Mon, Mar 4, 2024, at 14:01, Ard Biesheuvel wrote:
> On Mon, 4 Mar 2024 at 13:35, Arnd Bergmann <arnd@arndb.de> wrote:
>> On Mon, Mar 4, 2024, at 12:45, Andre Przywara wrote:
>> It's not critical if this is called infrequently, and as Maxime
>> just replied, the 64-bit division is in fact required here.
>> Since we are dividing by a constant value (200), there is a good
>> chance that this will be get turned into fairly efficient
>> multiply/shift code.
>>
>
> Clang does not implement that optimization for 64-bit division. That
> is how we ended up with this error in the first place.

I meant it will use the optimization after the patch to convert
the plain '/' to div_u64().

> Perhaps it is worthwhile to make div_u64() check its divisor, e.g.,
>
> --- a/include/linux/math64.h
> +++ b/include/linux/math64.h
> @@ -127,6 +127,9 @@
>  static inline u64 div_u64(u64 dividend, u32 divisor)
>  {
>         u32 remainder;
> +
> +       if (IS_ENABLED(CONFIG_CC_IS_GCC) && __builtin_constant_p(divisor))
> +               return dividend / divisor;
>         return div_u64_rem(dividend, divisor, &remainder);
>  }

I think the div_u64()->do_div()->__div64_const32()->__arch_xprod_64()
optimization in asm-generic/div64.h already produces what we want
on both compilers. Is there something missing there?

     Arnd

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2024-03-04 13:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-04  8:07 arm: ERROR: modpost: "__aeabi_uldivmod" [drivers/gpu/drm/sun4i/sun4i-drm-hdmi.ko] undefined! Naresh Kamboju
2024-03-04 11:11 ` Arnd Bergmann
2024-03-04 11:24   ` Andre Przywara
2024-03-04 11:26     ` Arnd Bergmann
2024-03-04 11:45       ` Andre Przywara
2024-03-04 12:34         ` Arnd Bergmann
2024-03-04 13:01           ` Ard Biesheuvel
2024-03-04 13:48             ` Arnd Bergmann [this message]
2024-03-04 13:55               ` Ard Biesheuvel
2024-03-04 11:46   ` Maxime Ripard
2024-03-09 14:33     ` David Laight
2024-03-14  9:27       ` Geert Uytterhoeven
2024-03-14 11:14         ` Geert Uytterhoeven
2024-03-14 15:04         ` Maxime Ripard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=61aa333f-aa13-4068-b73f-eeae615f4640@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=airlied@redhat.com \
    --cc=andre.przywara@arm.com \
    --cc=ardb@kernel.org \
    --cc=dan.carpenter@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=lkft-triage@lists.linaro.org \
    --cc=mripard@kernel.org \
    --cc=naresh.kamboju@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox