All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Carstens <heiko.carstens@de.ibm.com>
To: Yury Norov <ynorov@caviumnetworks.com>
Cc: linux-arch@vger.kernel.org, linux-s390@vger.kernel.org,
	arnd@arndb.de, pinskia@gmail.com,
	Prasun.Kapoor@caviumnetworks.com, catalin.marinas@arm.com,
	Nathan_Lynch@mentor.com, linux-kernel@vger.kernel.org,
	agraf@suse.de, klimov.linux@gmail.com, broonie@kernel.org,
	joseph@codesourcery.com, schwidefsky@de.ibm.com,
	linux-arm-kernel@lists.infradead.org,
	christoph.muellner@theobroma-systems.com
Subject: Re: [PATCH 1/5] all: s390: move wrapper infrastructure to generic headers
Date: Tue, 2 Feb 2016 17:08:26 +0100	[thread overview]
Message-ID: <20160202160826.GF3990@osiris> (raw)
In-Reply-To: <20160202154331.GA3003@yury-N73SV>

On Tue, Feb 02, 2016 at 06:43:31PM +0300, Yury Norov wrote:
> > Well, I'd like to have some proof by the compiler or linker that nothing
> > went wrong. Which seems hard if only selected system call defines will be
> > converted to the new defines.
> > 
> > How can you tell that nothing has been forgotten?
> > 
> > Also, what happens if the prototype of a system call get's changed shortly
> > after it was merged. We might miss such changes and have bugs.
> > 
> 
> As for now, there's no such proof, and everything is OK. Syscall ABI
> is extremely conservative, and Greg KH, and other people spent a lot
> of efforts to keep it that way. This is the only reason for me to not
> worry much about it. Modification of syscall ABI is virtually
> impossible now, because it breaks binary compatibility. Even addition
> of new syscall is very difficult procedure.
> (Documentation/adding-syscalls.txt begins with section "System Call
> Alternatives".)

Well... during the years a lot of system calls have been added. And we've
also seen last-minute changes or reverts. So I don't share your optimistic
view here :)

See e.g. 485d52768685 ("sys_personality: change sys_personality() to accept
"unsigned int" instead of u_long") would have been a candidate which could
silently break architectures which need compat wrappers.

> We can invent some protection, but it will cost us in complexity and/or
> runtime delays. Because syscall ABI is so stable, I think it's OK to
> review wrappers carefully once, and they will be fine for long time.

Here I don't agree with you. These interfaces are so important that I'd
like to have a waterproof method that these don't break.  If this involves
a couple of superfluous instructions then that's what I'm willing to pay
for it.

> > Before doing that I think you should actually revert this patch: my commit
> > 7681df456f97 ("s390/compat: remove superfluous compat wrappers") probably
> > wasn't a very bright idea :)
> This patch is OK for me. pid_t, uid_t, gid_t, unsigned and signed int
> types are all 32-bit both on LP64 and ILP32. Normally, compiler should
> care about top halves... Did I miss something?

The patch was correct when writing it, but e.g. a patch like named above
would introduce a possible bug which would go in unnoticed.
The only thing we save is a _single_ unconditional branch here. I'd say
that's well worth it if you get a (hopefully) always bug free sign and zero
extension infrastructure in return.

> I don't know much about s390 specifics. Maybe because of that I do not
> understand completely your worries. I'm OK with both 1st and 2nd
> version, but I'd choose 2nd one because it allows inlines, and we
> don't need the compat_wrapper.c.

It would be only nicer if we can guarentee correctness all the time. That
being said I'm about to revert my own commit :)

So if you want to go without compat_wrapper.c then we should have a
solution which will do the right thing all the time without that a system
call author has to know about the sign and zero extension issue some
architectures face. It _will_ go wrong.

WARNING: multiple messages have this Message-ID (diff)
From: heiko.carstens@de.ibm.com (Heiko Carstens)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/5] all: s390: move wrapper infrastructure to generic headers
Date: Tue, 2 Feb 2016 17:08:26 +0100	[thread overview]
Message-ID: <20160202160826.GF3990@osiris> (raw)
In-Reply-To: <20160202154331.GA3003@yury-N73SV>

On Tue, Feb 02, 2016 at 06:43:31PM +0300, Yury Norov wrote:
> > Well, I'd like to have some proof by the compiler or linker that nothing
> > went wrong. Which seems hard if only selected system call defines will be
> > converted to the new defines.
> > 
> > How can you tell that nothing has been forgotten?
> > 
> > Also, what happens if the prototype of a system call get's changed shortly
> > after it was merged. We might miss such changes and have bugs.
> > 
> 
> As for now, there's no such proof, and everything is OK. Syscall ABI
> is extremely conservative, and Greg KH, and other people spent a lot
> of efforts to keep it that way. This is the only reason for me to not
> worry much about it. Modification of syscall ABI is virtually
> impossible now, because it breaks binary compatibility. Even addition
> of new syscall is very difficult procedure.
> (Documentation/adding-syscalls.txt begins with section "System Call
> Alternatives".)

Well... during the years a lot of system calls have been added. And we've
also seen last-minute changes or reverts. So I don't share your optimistic
view here :)

See e.g. 485d52768685 ("sys_personality: change sys_personality() to accept
"unsigned int" instead of u_long") would have been a candidate which could
silently break architectures which need compat wrappers.

> We can invent some protection, but it will cost us in complexity and/or
> runtime delays. Because syscall ABI is so stable, I think it's OK to
> review wrappers carefully once, and they will be fine for long time.

Here I don't agree with you. These interfaces are so important that I'd
like to have a waterproof method that these don't break.  If this involves
a couple of superfluous instructions then that's what I'm willing to pay
for it.

> > Before doing that I think you should actually revert this patch: my commit
> > 7681df456f97 ("s390/compat: remove superfluous compat wrappers") probably
> > wasn't a very bright idea :)
> This patch is OK for me. pid_t, uid_t, gid_t, unsigned and signed int
> types are all 32-bit both on LP64 and ILP32. Normally, compiler should
> care about top halves... Did I miss something?

The patch was correct when writing it, but e.g. a patch like named above
would introduce a possible bug which would go in unnoticed.
The only thing we save is a _single_ unconditional branch here. I'd say
that's well worth it if you get a (hopefully) always bug free sign and zero
extension infrastructure in return.

> I don't know much about s390 specifics. Maybe because of that I do not
> understand completely your worries. I'm OK with both 1st and 2nd
> version, but I'd choose 2nd one because it allows inlines, and we
> don't need the compat_wrapper.c.

It would be only nicer if we can guarentee correctness all the time. That
being said I'm about to revert my own commit :)

So if you want to go without compat_wrapper.c then we should have a
solution which will do the right thing all the time without that a system
call author has to know about the sign and zero extension issue some
architectures face. It _will_ go wrong.

  reply	other threads:[~2016-02-02 16:08 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-25 16:57 [PATCH 0/5] all: s390: make compat wrappers the generic solution Yury Norov
2016-01-25 16:57 ` Yury Norov
2016-01-25 16:57 ` Yury Norov
2016-01-25 16:57 ` Yury Norov
2016-01-25 16:57 ` [PATCH 1/5] all: s390: move wrapper infrastructure to generic headers Yury Norov
2016-01-25 16:57   ` Yury Norov
2016-01-25 16:57   ` Yury Norov
2016-01-25 18:10   ` kbuild test robot
2016-01-25 18:10     ` kbuild test robot
2016-01-25 18:10     ` kbuild test robot
2016-01-25 18:10     ` kbuild test robot
2016-01-28 12:16   ` Heiko Carstens
2016-01-28 12:16     ` Heiko Carstens
2016-01-28 16:31     ` Yury Norov
2016-01-28 16:31       ` Yury Norov
2016-01-28 16:31       ` Yury Norov
2016-02-01 11:42       ` Yury Norov
2016-02-01 11:42         ` Yury Norov
2016-02-01 11:42         ` Yury Norov
2016-02-02  7:39         ` Heiko Carstens
2016-02-02  7:39           ` Heiko Carstens
2016-02-02 15:43           ` Yury Norov
2016-02-02 15:43             ` Yury Norov
2016-02-02 15:43             ` Yury Norov
2016-02-02 16:08             ` Heiko Carstens [this message]
2016-02-02 16:08               ` Heiko Carstens
2016-02-02 19:54               ` Heiko Carstens
2016-02-02 19:54                 ` Heiko Carstens
2016-02-02 20:41                 ` Yury Norov
2016-02-02 20:41                   ` Yury Norov
2016-02-02 20:41                   ` Yury Norov
2016-02-03  8:01                   ` Heiko Carstens
2016-02-03  8:01                     ` Heiko Carstens
2016-02-17  8:22                   ` Heiko Carstens
2016-02-17  8:22                     ` Heiko Carstens
2016-02-17 13:57                     ` Yury Norov
2016-02-17 13:57                       ` Yury Norov
2016-02-17 13:57                       ` Yury Norov
2016-01-25 16:57 ` [PATCH 2/5] all: declare new wrappers Yury Norov
2016-01-25 16:57   ` Yury Norov
2016-01-25 16:57   ` Yury Norov
2016-01-25 16:57 ` [PATCH 3/5] all: s390: redefine wrappers in generic code Yury Norov
2016-01-25 16:57   ` Yury Norov
2016-01-25 16:57   ` Yury Norov
2016-01-25 16:57 ` [PATCH 4/5] all: wrap getdents64 syscall Yury Norov
2016-01-25 16:57   ` Yury Norov
2016-01-25 16:57   ` Yury Norov
2016-01-25 16:57 ` [PATCH 5/5] all: introduce COMPAT_WRAPPER option and enable it for s390 Yury Norov
2016-01-25 16:57   ` Yury Norov
2016-01-25 16:57   ` Yury Norov

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=20160202160826.GF3990@osiris \
    --to=heiko.carstens@de.ibm.com \
    --cc=Nathan_Lynch@mentor.com \
    --cc=Prasun.Kapoor@caviumnetworks.com \
    --cc=agraf@suse.de \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=christoph.muellner@theobroma-systems.com \
    --cc=joseph@codesourcery.com \
    --cc=klimov.linux@gmail.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=pinskia@gmail.com \
    --cc=schwidefsky@de.ibm.com \
    --cc=ynorov@caviumnetworks.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.