From: "Christian König" <deathsimple@vodafone.de>
To: Ilia Mirkin <imirkin@alum.mit.edu>, Lauri Kasanen <cand@gmx.com>
Cc: "dri-devel@lists.freedesktop.org" <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH] drm/radeon: Inline r100_mm_rreg
Date: Thu, 10 Apr 2014 21:30:03 +0200 [thread overview]
Message-ID: <5346F13B.6060604@vodafone.de> (raw)
In-Reply-To: <CAKb7UvgpDvE9et8Uxt6=qPH-a3bZ3p5eEXupLFhZVNEqA6B12A@mail.gmail.com>
Am 10.04.2014 20:52, schrieb Ilia Mirkin:
> On Thu, Apr 10, 2014 at 2:46 PM, Lauri Kasanen <cand@gmx.com> wrote:
>> On Thu, 10 Apr 2014 12:19:10 -0400
>> Ilia Mirkin <imirkin@alum.mit.edu> wrote:
>>
>>>> +static inline uint32_t r100_mm_rreg(struct radeon_device *rdev, uint32_t reg,
>>>> + bool always_indirect)
>>>> +{
>>>> + if (reg < rdev->rmmio_size && !always_indirect)
>>>> + return readl(((void __iomem *)rdev->rmmio) + reg);
>>> Quick thought from someone entirely unfamiliar with the hardware:
>>> perhaps you can get the performance benefit without the size increase
>>> by moving the else portion into a non-inline function? I'm guessing
>>> that most accesses happen in the "if" branch.
>> The function call overhead is about equal to branching overhead, so
>> splitting it would only help about half that. It's called from many
>> places, and a lot of calls per sec.
Actually direct register access shouldn't be necessary so often. Apart
from page flips, write/read pointer updates and irq processing there
shouldn't be so many of them. Could you clarify a bit more what issue
you are seeing here?
> Is that really true? I haven't profiled it, but a function call has to
> save/restore registers, set up new stack, etc. And the jump is to some
> far-away code, so perhaps less likely to be in i-cache? (But maybe
> not, not sure on the details of how all that works.) And I'm guessing
> most of the size increase is coming from the spinlock/unlock, which,
> I'm guessing again, is the much-rarer case.
>
> And the branch would happen either way... so that's a sunk cost.
> (Except I bet that the always_indirect param is always constant and
> that bit of the if can be resolved at compile time with that part
> being inlined.)
>
> Anyways, it was just a thought.
And a pretty much correct one. The "else" case shouldn't be necessary on
modern hardware any more and so nearly never taken.
Christian.
>
> -ilia
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2014-04-10 19:30 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-10 13:08 [PATCH] drm/radeon: Inline r100_mm_rreg Lauri Kasanen
2014-04-10 16:19 ` Ilia Mirkin
2014-04-10 18:46 ` Lauri Kasanen
2014-04-10 18:52 ` Ilia Mirkin
2014-04-10 19:30 ` Christian König [this message]
2014-04-11 7:52 ` Lauri Kasanen
2014-04-11 8:33 ` Christian König
2014-04-11 9:54 ` Lauri Kasanen
2014-04-11 12:32 ` Christian König
2014-04-11 16:47 ` Lauri Kasanen
2014-04-11 17:38 ` Lauri Kasanen
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=5346F13B.6060604@vodafone.de \
--to=deathsimple@vodafone.de \
--cc=cand@gmx.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=imirkin@alum.mit.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.