public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Andre Przywara" <andre.przywara@arm.com>
Cc: "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>,
	"Ard Biesheuvel" <ardb@kernel.org>
Subject: Re: arm: ERROR: modpost: "__aeabi_uldivmod" [drivers/gpu/drm/sun4i/sun4i-drm-hdmi.ko] undefined!
Date: Mon, 04 Mar 2024 13:34:49 +0100	[thread overview]
Message-ID: <badf279a-f1fa-4938-a5d2-492b89d7c27c@app.fastmail.com> (raw)
In-Reply-To: <20240304114546.4e8e1e32@donnerap.manchester.arm.com>

On Mon, Mar 4, 2024, at 12:45, Andre Przywara wrote:
> On Mon, 04 Mar 2024 12:26:46 +0100
> "Arnd Bergmann" <arnd@arndb.de> wrote:
>
>> On Mon, Mar 4, 2024, at 12:24, Andre Przywara wrote:
>> > On Mon, 04 Mar 2024 12:11:36 +0100 "Arnd Bergmann" <arnd@arndb.de> wrote:  
>> >>
>> >> This used to be a 32-bit division. If the rate is never more than
>> >> 4.2GHz, clock could be turned back into 'unsigned long' to avoid
>> >> the expensive div_u64().  
>> >
>> > Wouldn't "div_u64(clock, 200)" solve this problem?  
>> 
>> Yes, that's why I mentioned it as the worse of the two obvious
>> solutions. ;-)
>
> Argh, should have cleaned my glasses first ;-)
>
> I guess I was put somehow put off by the word "expensive". While it's
> admittedly not trivial, I wonder if we care about the (hidden) complexity
> of that function? I mean it's neither core code nor something called
> frequently?

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.

> I don't think we have any clock exceeding 3GHz at the moment, but it
> sounds fishy to rely on that.

Right, it's just important to look at each case individually.
The cost of 64-bit division is crazy if it gets called repeatedly,
which is of course the entire reason we don't provide a
__aeabi_uldivmod() function and require developers to think
before adding div_u64().

     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 12:35 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 [this message]
2024-03-04 13:01           ` Ard Biesheuvel
2024-03-04 13:48             ` Arnd Bergmann
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=badf279a-f1fa-4938-a5d2-492b89d7c27c@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