public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Ulrich Drepper <drepper@redhat.com>
Cc: Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: ppc/ppc64 and x86 vsyscalls
Date: Mon, 08 Mar 2004 12:17:28 +1100	[thread overview]
Message-ID: <1078708647.5698.196.camel@gaston> (raw)

Hi Ulrich !

I've seen the various debates regarding the x86 vsyscalls.

I want to implement something similar for ppc, though the actual
syscalls covered will be differents.

The idea is that the kernel already has the necessary infrastructure
for precisely identifying each CPU model and doing various optimisations
based on which CPU we are running on.

We are planning on adding a set of per-CPU (model/familly)
implementation of some critical functions, that I would like to "share"
between the kernel and userland.

That include the atomic ops (some CPUs like embedde 4xx need additional
sync in there, while a sync would be a huge overhead on others) and
spinlocks, but also memory copy routines, and eventually cache
flush/invalidate functions (especially since some CPUs don't need them
at all) and possibly a userland implementation of gettimeofday.

The basic idea is to have a set of pages containing those functions
mapped in the top of the address space. The interest here is that it
would possibly allow to use the short absolute branch instructions
to get there.

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.

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
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.

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. But then, adding those for each
implementation makes the complexity of building those completely out
of control.

What do you think ? Any "smart" idea on how we could implement that
keeping the complexity of the kernel side reasonable without making
the userland side a nightmare ?

Regards,
Ben.



             reply	other threads:[~2004-03-08  1:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-08  1:17 Benjamin Herrenschmidt [this message]
2004-03-09  8:05 ` ppc/ppc64 and x86 vsyscalls Ulrich Drepper
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=1078708647.5698.196.camel@gaston \
    --to=benh@kernel.crashing.org \
    --cc=drepper@redhat.com \
    --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