public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Chris Metcalf <cmetcalf@tilera.com>, "H. Peter Anvin" <hpa@zytor.com>
Cc: linux-kernel@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>,
	Jeff Moyer <jmoyer@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	John Stultz <johnstul@us.ibm.com>
Subject: Re: [PATCH] compat: fixes to allow working with tile arch
Date: Thu, 5 May 2011 09:01:50 +0200	[thread overview]
Message-ID: <201105050901.50673.arnd@arndb.de> (raw)
In-Reply-To: <201105042004.p44K4nRJ011722@farm-0032.internal.tilera.com>

On Wednesday 04 May 2011, Chris Metcalf wrote:
> <linux/compat.h> doesn't currently provide enough to allow the new
> <asm-generic/unistd.h> approach to work for the compat syscall vector.
> In principle you should be able to "#define __SYSCALL(nr, call)
> [nr] = (compat_##call)," and then #include <asm/unistd.h>.  This change
> adds all the remaining compat_sys_xxx() prototypes, and also adds
> appropriate #defines for compat syscalls that can use the non-compat
> implementation.  See arch/tile/kernel/compat.c for an example.

I didn't realize this was still missing, my impression was that this
already worked when you added the tile arch tree, but apparently
I was missing something there.

Thanks for bringing it up and doing the patch for it!

> +/* Standard Linux functions that don't have "compat" versions. */
> +#define compat_sys_accept sys_accept
> +#define compat_sys_accept4 sys_accept4
> +#define compat_sys_access sys_access
> +#define compat_sys_acct sys_acct
> +#define compat_sys_add_key sys_add_key
> ...

It seems kludgy to have to add all the "regular" system calls to yet
another list, I'd prefer the default to be using the same entry point
for the regular syscall and the compat_ version, so you only need to
list the exceptions in the asm-generic/unistd.h file.

Maybe something like

#if __BITS_PER_LONG == 32 || defined(__SYSCALL_COMPAT)
#define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _32)
#define __SC_COMP(_nr, _32, _64) __SYSCALL(_nr, _32)
#elif defined(__SYSCALL_COMPAT)
#define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _32)
#define __SC_COMP(_nr, _32, _64) __SYSCALL(_nr, compat ## _32)
#else
#define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _64)
#define __SC_COMP(_nr, _32, _64) __SYSCALL(_nr, _64)
#endif

Then you replace all __SC_3264 with __SC_COMP for the cases where
you call the compat version instead of the regular syscall in case
of 32-bit compat.

Alternatively, you could create a tristate version in addition
to the existing __SC_3264:

#ifdef __SYSCALL_COMPAT
#define __SC_COMP(_nr, _32, _64, _comp) __SC_3264(_comp, _64)
#else
#define __SC_COMP(_nr, _32, _64, _comp) __SC_3264(_32, _64)
#endif

This requires listing all entry points explicitly, but makes it easier
to grep for where the compat syscalls are actually used.

	Arnd

  reply	other threads:[~2011-05-05  7:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-04 15:16 [PATCH] compat: fixes to allow working with tile arch Chris Metcalf
2011-05-05  7:01 ` Arnd Bergmann [this message]
2011-05-09 17:12   ` [PATCH v2] " Chris Metcalf
2011-05-11 21:08     ` Arnd Bergmann

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=201105050901.50673.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=akpm@linux-foundation.org \
    --cc=benh@kernel.crashing.org \
    --cc=cmetcalf@tilera.com \
    --cc=davem@davemloft.net \
    --cc=hpa@zytor.com \
    --cc=jmoyer@redhat.com \
    --cc=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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