Subject: Re: indirect calls [Re: issues with com and non-PCI platforms.... a proposal]
To: None <>
From: Thor Lancelot Simon <>
List: tech-kern
Date: 03/14/2006 17:39:31
On Tue, Mar 14, 2006 at 12:57:01PM -0800, Garrett D'Amore wrote:
> My understanding, from what others have said, is that the problem is
> that function calls *in general* are expensive on a VAX.

And almost everywhere else, compared to a one or two instruction
sequence to read across the bus.  Doing a function call every time
you want a byte from the device is a pretty painful way to do PIO,
unless your CPU is many orders of magnitude faster than some of the
hardware people are still trying to use -- some of the hardware
that's still being built and deployed today, even.

Indirect calls, on some CPUs, are even worse, because they defeat
I-cache prefetch.

> It is mind boggling to me, that we have to design our software to
> eliminate  function calls where-ever possible, in order to get good
> performance.

I think this is not really a reasonable interpretation of anything
anyone has actually said (here or elsewhere).

It is plain as day that NetBSD is *not* designed "to eliminate function
calls where-ever possible"; a trivial examination of the code will show
that.  The specific concern that making function calls to grab a single
byte across the bus is rather onerous for some platforms, however, is
quite simply not equivalent to the claim that "we have to design our
software to eliminate function calls where-ever possible".

Obviously on most CPUs that anyone cares about, most of the time,
function calls are just fine -- and, just as obviously, you're
right that it is good programming practice to use them.  Sometimes,
some other factors _might_ agitate against making certain code
paths use function calls.

But it is hardly the case that anyone, much less anyone in a technical
decision-making role (e.g. core), has actually said "eliminate function
calls wherever possible" or even "don't put any function calls into
bus_space".  This is a silly argument, with straw men at every turn
on both sides.  Everyone is arguing with the most extreme possible
distortion of the opposing position -- if, in fact, there even really
_is_ an opposing position.

Can't we put the straw men back in the field, where they belong, to scare
the birds?