From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?ISO-8859-1?Q?Christian_K=F6nig?= Subject: Re: [PATCH] drm/radeon: Inline r100_mm_rreg Date: Thu, 10 Apr 2014 21:30:03 +0200 Message-ID: <5346F13B.6060604@vodafone.de> References: <20140410160817.5275493d.cand@gmx.com> <20140410214634.ba440af5.cand@gmx.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from pegasos-out.vodafone.de (pegasos-out.vodafone.de [80.84.1.38]) by gabe.freedesktop.org (Postfix) with ESMTP id 926606E2CF for ; Thu, 10 Apr 2014 12:30:20 -0700 (PDT) Received: from localhost (localhost.localdomain [127.0.0.1]) by pegasos-out.vodafone.de (Rohrpostix2 Daemon) with ESMTP id D1F8F64007F for ; Thu, 10 Apr 2014 21:30:17 +0200 (CEST) Received: from pegasos-out.vodafone.de ([127.0.0.1]) by localhost (rohrpostix2.prod.vfnet.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BXmHwk0n2nxQ for ; Thu, 10 Apr 2014 21:30:12 +0200 (CEST) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Ilia Mirkin , Lauri Kasanen Cc: "dri-devel@lists.freedesktop.org" List-Id: dri-devel@lists.freedesktop.org Am 10.04.2014 20:52, schrieb Ilia Mirkin: > On Thu, Apr 10, 2014 at 2:46 PM, Lauri Kasanen wrote: >> On Thu, 10 Apr 2014 12:19:10 -0400 >> Ilia Mirkin 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