public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Anton Blanchard <anton@samba.org>
To: Keith Owens <kaos@ocs.com.au>
Cc: linux-kernel@vger.kernel.org
Subject: Re: speed difference between using hard-linked and modular drives?
Date: Sat, 10 Nov 2001 14:35:58 +1100	[thread overview]
Message-ID: <20011110143557.A767@krispykreme> (raw)
In-Reply-To: <20011109105921.A6822@krispykreme> <7462.1005282683@kao2.melbourne.sgi.com>
In-Reply-To: <7462.1005282683@kao2.melbourne.sgi.com>

 
Hi,

> Is that TOC save and restore just for module code or does it apply to
> all calls through function pointers?
>
> On IA64, R1 (global data pointer) must be saved and restored on all
> calls through function pointers, even if both the caller and callee are
> in the kernel.  You might know that this is a kernel to kernel call but
> gcc does not so it has to assume the worst.  This is not a module
> problem, it affects all indirect function calls.

Yep all indirect function calls require save and reload of the TOC
(which is r2):

std     r2,40(r1)
mtctr   r0
ld      r2,8(r9)
bctrl			# function call

When calling a function in the kernel from within the kernel (eg printk),
we dont have to save and reload the TOC:

000014ec bl .printk
000014f0 nop

Alan Modra tells me the linker does the fixup of nop -> r2 reload. So
in this case it isnt needed.

However when we do the same printk from a module, the nop is replaced
with an r2 reload:

000014ec  bl	0x2f168		# call trampoline
000014f0  ld	r2,40(r1)

And because we have to load the new TOC for the call to printk, it is
done in a small trampoline. (r12 is a pointer to the function descriptor
for printk which contains 3 values, 1. the function address, 2. the TOC,
ignore the 3rd)

0002f168  ld	r12,-32456(r2)
0002f16c  std	r2,40(r1)
0002f170  ld	r0,0(r12)
0002f174  ld	r2,8(r12)
0002f178  mtctr	r0
0002f17c  bctr			# call printk

So the trampoline and r2 restore is the overhead Im talking about :)

btw the trampoline is also required because of the limited range of
relative branches on ppc. So ppc32 also has an overhead except it is
smaller because it doesnt need the TOC juggling.

Anton

  reply	other threads:[~2001-11-10  4:38 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-08 16:01 speed difference between using hard-linked and modular drives? Roy Sigurd Karlsbakk
2001-11-08 17:02 ` Ingo Molnar
2001-11-08 17:37   ` Ingo Molnar
2001-11-08 23:59   ` Anton Blanchard
2001-11-09  5:11     ` Keith Owens
2001-11-10  3:35       ` Anton Blanchard [this message]
2001-11-10  7:26         ` Keith Owens
2001-11-08 17:53 ` Robert Love
     [not found] <Pine.LNX.4.33.0111081802380.15975-100000@localhost.localdomain.suse.lists.linux.kernel>
     [not found] ` <Pine.LNX.4.33.0111081836080.15975-100000@localhost.localdomain.suse.lists.linux.kernel>
2001-11-08 23:00   ` Andi Kleen
2001-11-09  0:05     ` Anton Blanchard
2001-11-09  5:45       ` Andi Kleen
2001-11-09  6:04         ` David S. Miller
2001-11-09  6:39           ` Andi Kleen
2001-11-09  6:54             ` Andrew Morton
2001-11-09  7:17               ` David S. Miller
2001-11-09  7:16                 ` Andrew Morton
2001-11-09  7:24                   ` David S. Miller
2001-11-09  8:21                   ` Ingo Molnar
2001-11-09  7:35                     ` Andrew Morton
2001-11-09  7:44                       ` David S. Miller
2001-11-09  7:14             ` David S. Miller
2001-11-09  7:16             ` David S. Miller
2001-11-09 12:59               ` Alan Cox
2001-11-09 12:54                 ` David S. Miller
2001-11-09 13:15                   ` Philip Dodd
2001-11-09 13:26                     ` David S. Miller
2001-11-09 20:45                       ` Mike Fedyk
2001-11-09 13:17                   ` Andi Kleen
2001-11-09 13:25                     ` David S. Miller
2001-11-09 13:39                       ` Andi Kleen
2001-11-09 13:41                         ` David S. Miller
2001-11-10  5:20               ` Anton Blanchard
2001-11-10  4:56             ` Anton Blanchard
2001-11-10  5:09               ` Andi Kleen
2001-11-10 13:29               ` David S. Miller
2001-11-10 13:44                 ` David S. Miller
2001-11-10 13:52                 ` David S. Miller
2001-11-09  3:12     ` Rusty Russell
2001-11-09  5:59       ` Andi Kleen
2001-11-09 11:16       ` Helge Hafting
2001-11-12  9:59         ` Rusty Russell
2001-11-12 23:23           ` David S. Miller
2001-11-12 23:14             ` Rusty Russell
2001-11-13  1:30               ` Mike Fedyk
2001-11-13  1:15                 ` David Lang

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=20011110143557.A767@krispykreme \
    --to=anton@samba.org \
    --cc=kaos@ocs.com.au \
    --cc=linux-kernel@vger.kernel.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