public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Ulrich Drepper <drepper@redhat.com>
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
	mingo@elte.hu, tglx@linutronix.de, torvalds@linux-foundation.org
Subject: Re: [PATCHv3 0/4] sys_indirect system call
Date: Mon, 19 Nov 2007 20:27:13 -0800	[thread overview]
Message-ID: <47426221.6020609@zytor.com> (raw)
In-Reply-To: <47425470.2000608@redhat.com>

Ulrich Drepper wrote:
> 
> But I still don't see that the magic encoding is a valid solution, it
> doesn't address the limited parameter number.  Plus, using sys_indirect
> could in future be used to transport entire parameters (like a sigset_t)
> along with other information, thereby saving individual copy operations.
> 

The limited number of parameters is a non-issue, we already have the 
convention for that: for more than 6 parameters, pass a parameter to 
arguments 6 and higher in the register normally used for parameter 6.

Now, for the specific case of x86-64 (as well as some of the RISC 
architectures), this meshes poorly with the C calling convention, which 
is that parameter 7+ are passed on the stack.  We would obtain a more 
efficient calling convention by allocating an additional register for 
such an indirect pointer and/or adopt the convention that the additional 
parameters are simply stored on the user stack starting at a specific 
offset, presumably +8.

I would really like to see a systematic calling convention that doesn't 
have limits that we have already broken several times.  In particular, I 
would like to see a convention that can be mapped 1:1 onto the platform 
C calling convention in a syscall-independent way.  We *almost* have 
this today, but sys_indirect would blow that out of the water in a 
particularly ugly way.(*)

> I think the sys_indirect approach is the way forward.  I'll submit a
> last version of the patch in a bit.

I think it is a horrible kluge.  It's yet another multiplexer, which we 
are trying desperately to avoid in the kernel.  Just to make things more 
painful, it is a multiplexer which creates yet another ad hoc calling 
convention, whereas we should strive to make the kernel calling 
convention as uniform as possible.

If is is NOT going to be used in the common case, then it really doesn't 
matter -- we can just use manually or automatically generated thunks. 
It's not like we have thousands of system calls, and it's not like "a 
system call" is a precious thing.

If it IS going to be used in the common case, then we should use 
something more streamlined.

	-hpa


  reply	other threads:[~2007-11-20  4:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-17  5:31 [PATCHv3 0/4] sys_indirect system call Ulrich Drepper
2007-11-18  7:44 ` H. Peter Anvin
2007-11-18  9:36   ` Ulrich Drepper
2007-11-18 19:37     ` H. Peter Anvin
2007-11-20  3:28       ` Ulrich Drepper
2007-11-20  4:27         ` H. Peter Anvin [this message]
2007-11-19 13:52 ` Eric Dumazet
2007-11-19 15:12   ` Ulrich Drepper
2007-11-19 15:43     ` Eric Dumazet
2007-11-19 15:48       ` Ulrich Drepper
2007-11-19 16:14         ` Eric Dumazet
2007-11-19 19:08           ` Ingo Molnar
2007-11-20 14:11             ` dean gaudet
2007-11-20 16:16               ` Ulrich Drepper

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=47426221.6020609@zytor.com \
    --to=hpa@zytor.com \
    --cc=akpm@linux-foundation.org \
    --cc=drepper@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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