public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ulrich Drepper <drepper@redhat.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: Re: ppc/ppc64 and x86 vsyscalls
Date: Tue, 09 Mar 2004 00:05:23 -0800	[thread overview]
Message-ID: <404D7AC3.9050207@redhat.com> (raw)
In-Reply-To: <1078708647.5698.196.camel@gaston>

Benjamin Herrenschmidt wrote:

> However, the actual "form" of those is a bit difficult to decide on. The
> problem is that just exposing a .so like x86 does is difficult. There
> will be much more functions exposed (maybe around 20) and for each of
> them, about 1 to 4 or 5 variations depending on the CPU we are running
> on, but also depending on the current process beeing 32 or 64 bits.

This is no reason for not using the DSO form.  The userlevel code finds
the vDSO via the auxiliary vector.  By passing up different values for
32 and 64 bit processes you easily handle the last problem.

Many functions are no real issue either.  It not inefficient to use the
symbol table.

The only issue is that the vDSO should (IMO must) be position
independent.  You certainly want to map the same copy in each address
space.  This means the symbol table cannot contain addresses, only offsets.



> They are all very simple leaf functions though. The "easy" way would
> be to just have some kind of branch table code can "bal" to directly,
> that or an exception-like design, which every function at an 0xn00
> offset (with possible branch to some scratch space in the rare case

This means adding a multiplexer in the vDSO while the caller knows
exactly which function is wanted.  Sure, it's possible and quite easy to
implement.

If you want it more complicated you could do it as I suggested for x86.
 Add absolute symbols to the symbol table, have the libc use the dlsym()
equivalent to determine whether the symbol is defined.  If it is, it'll
return an offset which then can be used for the jump.  ppc64 function
descriptors can certainly be handled.

The results of the dlsym() calls would be cached so that it only happens
once for each symbol.  And since the soname of the vdso is known, one
doesn't even have to look in the global scope but instead directly in
the vdso's symbol table.

This all would definitely need changes in libc and ld.so.  But I guess
it'll work.


> where a given implementation may overflow). The kernel could esily
> "build" the pages based on which implementation is to be used on a
> given CPU & process context.

That's easily doable with a real DSO.



> However, the above makes things more difficult for userland, the big
> problem as I was told by Alan Modra will be the lack of CFI informations
> for stack unwinding on exceptions.

Why lack?  As a real DSO the vDSO can use the normal unwind info
handling userlevel DSOs use, too.  I do not see a reason which this
cannot work.  The unwind info for DSOs is position-independent so it
should work just fine.

-- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖

  reply	other threads:[~2004-03-09  8:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-08  1:17 ppc/ppc64 and x86 vsyscalls Benjamin Herrenschmidt
2004-03-09  8:05 ` Ulrich Drepper [this message]
2004-03-09 11:05   ` Benjamin Herrenschmidt
2004-03-09 21:14     ` Ulrich Drepper
2004-03-09 21:33       ` Benjamin Herrenschmidt
2004-03-10  0:35         ` Ulrich Drepper
2004-03-10  2:08           ` Benjamin Herrenschmidt

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=404D7AC3.9050207@redhat.com \
    --to=drepper@redhat.com \
    --cc=benh@kernel.crashing.org \
    --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