All of lore.kernel.org
 help / color / mirror / Atom feed
From: via llvm-dev <llvm-dev@lists.llvm.org>
To: Linus Torvalds via llvm-dev <torvalds@linux-foundation.org>,
	Markus Trippelsdorf <markus@trippelsdorf.de>
Cc: linux-arch@vger.kernel.org, gcc@gcc.gnu.org,
	Paul McKenney <paulmck@linux.vnet.ibm.com>,
	parallel@lists.isocpp.org, llvm-dev@lists.llvm.org,
	Will Deacon <will.deacon@arm.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	David Howells <dhowells@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ramana Radhakrishnan <Ramana.Radhakrishnan@arm.com>,
	Luc Maranget <luc.maranget@inria.fr>,
	Andrew Morton <akpm@linux-foundation.org>,
	Jade Alglave <j.alglave@ucl.ac.uk>,
	Ingo Molnar <mingo@kernel.org>
Subject: Re: [isocpp-parallel] Proposal for new memory_order_consume definition
Date: Sun, 28 Feb 2016 23:50:08 +0700	[thread overview]
Message-ID: <20160228165008.5468244.19084.78457@pathscale.com> (raw)
In-Reply-To: <CA+55aFyauwKmUdxfrKcy5Q2kvdej5fWt6xL+amVyPFhzmHMcsg@mail.gmail.com>

Sometimes Linus says some really flippant and funny things but gosh I couldn't agree more.. with one tiny nit..

Properly written Fortran and a good compiler is potentially as fast or faster than typical C version in HPC codes. (yes you may be able to get the c version faster, but it would take some effort.)

  Original Message  
From: Linus Torvalds via llvm-dev
Sent: Sunday, February 28, 2016 23:13
To: Markus Trippelsdorf
Reply To: Linus Torvalds
Cc: linux-arch@vger.kernel.org; gcc@gcc.gnu.org; Jade Alglave; parallel@lists.isocpp.org; llvm-dev@lists.llvm.org; Will Deacon; Linux Kernel Mailing List; David Howells; Peter Zijlstra; Ramana Radhakrishnan; Luc Maranget; Andrew Morton; Paul McKenney; Ingo Molnar
Subject: Re: [llvm-dev] [isocpp-parallel] Proposal for new memory_order_consume definition

On Sun, Feb 28, 2016 at 12:27 AM, Markus Trippelsdorf
<markus@trippelsdorf.de> wrote:
>> >
>> > -fno-strict-overflow
>>
>> -fno-strict-aliasing.
>
> Do not forget -fno-delete-null-pointer-checks.
>
> So the kernel obviously is already using its own C dialect, that is
> pretty far from standard C.
> All these options also have a negative impact on the performance of the
> generated code.

They really don't.

Have you ever seen code that cared about signed integer overflow?
Yeah, getting it right can make the compiler generate an extra ALU
instruction once in a blue moon, but trust me - you'll never notice.
You *will* notice when you suddenly have a crash or a security issue
due to bad code generation, though.

The idiotic C alias rules aren't even worth discussing. They were a
mistake. The kernel doesn't use some "C dialect pretty far from
standard C". Yeah, let's just say that the original C designers were
better at their job than a gaggle of standards people who were making
bad crap up to make some Fortran-style programs go faster.

They don't speed up normal code either, they just introduce undefined
behavior in a lot of code.

And deleting NULL pointer checks because somebody made a mistake, and
then turning that small mistake into a real and exploitable security
hole? Not so smart either.

The fact is, undefined compiler behavior is never a good idea. Not for
serious projects.

Performance doesn't come from occasional small and odd
micro-optimizations. I care about performance a lot, and I actually
look at generated code and do profiling etc. None of those three
options have *ever* shown up as issues. But the incorrect code they
generate? It has.

Linus
_______________________________________________
LLVM Developers mailing list
llvm-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
_______________________________________________
LLVM Developers mailing list
llvm-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

WARNING: multiple messages have this Message-ID (diff)
From: cbergstrom@pathscale.com
To: Linus Torvalds via llvm-dev <torvalds@linux-foundation.org>,
	Markus Trippelsdorf <markus@trippelsdorf.de>
Cc: linux-arch@vger.kernel.org, gcc@gcc.gnu.org,
	Jade Alglave <j.alglave@ucl.ac.uk>,
	parallel@lists.isocpp.org, llvm-dev@lists.llvm.org,
	Will Deacon <will.deacon@arm.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	David Howells <dhowells@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ramana Radhakrishnan <Ramana.Radhakrishnan@arm.com>,
	Luc Maranget <luc.maranget@inria.fr>,
	Andrew Morton <akpm@linux-foundation.org>,
	Paul McKenney <paulmck@linux.vnet.ibm.com>,
	Ingo Molnar <mingo@kernel.org>
Subject: Re: [llvm-dev] [isocpp-parallel] Proposal for new memory_order_consume definition
Date: Sun, 28 Feb 2016 23:50:08 +0700	[thread overview]
Message-ID: <20160228165008.5468244.19084.78457@pathscale.com> (raw)
Message-ID: <20160228165008.RyE2XcGP16ftYBPInYYWZ0MpcJlw12ZVnzw1gkPSgog@z> (raw)
In-Reply-To: <CA+55aFyauwKmUdxfrKcy5Q2kvdej5fWt6xL+amVyPFhzmHMcsg@mail.gmail.com>

Sometimes Linus says some really flippant and funny things but gosh I couldn't agree more.. with one tiny nit..

Properly written Fortran and a good compiler is potentially as fast or faster than typical C version in HPC codes. (yes you may be able to get the c version faster, but it would take some effort.)

  Original Message  
From: Linus Torvalds via llvm-dev
Sent: Sunday, February 28, 2016 23:13
To: Markus Trippelsdorf
Reply To: Linus Torvalds
Cc: linux-arch@vger.kernel.org; gcc@gcc.gnu.org; Jade Alglave; parallel@lists.isocpp.org; llvm-dev@lists.llvm.org; Will Deacon; Linux Kernel Mailing List; David Howells; Peter Zijlstra; Ramana Radhakrishnan; Luc Maranget; Andrew Morton; Paul McKenney; Ingo Molnar
Subject: Re: [llvm-dev] [isocpp-parallel] Proposal for new memory_order_consume definition

On Sun, Feb 28, 2016 at 12:27 AM, Markus Trippelsdorf
<markus@trippelsdorf.de> wrote:
>> >
>> > -fno-strict-overflow
>>
>> -fno-strict-aliasing.
>
> Do not forget -fno-delete-null-pointer-checks.
>
> So the kernel obviously is already using its own C dialect, that is
> pretty far from standard C.
> All these options also have a negative impact on the performance of the
> generated code.

They really don't.

Have you ever seen code that cared about signed integer overflow?
Yeah, getting it right can make the compiler generate an extra ALU
instruction once in a blue moon, but trust me - you'll never notice.
You *will* notice when you suddenly have a crash or a security issue
due to bad code generation, though.

The idiotic C alias rules aren't even worth discussing. They were a
mistake. The kernel doesn't use some "C dialect pretty far from
standard C". Yeah, let's just say that the original C designers were
better at their job than a gaggle of standards people who were making
bad crap up to make some Fortran-style programs go faster.

They don't speed up normal code either, they just introduce undefined
behavior in a lot of code.

And deleting NULL pointer checks because somebody made a mistake, and
then turning that small mistake into a real and exploitable security
hole? Not so smart either.

The fact is, undefined compiler behavior is never a good idea. Not for
serious projects.

Performance doesn't come from occasional small and odd
micro-optimizations. I care about performance a lot, and I actually
look at generated code and do profiling etc. None of those three
options have *ever* shown up as issues. But the incorrect code they
generate? It has.

Linus
_______________________________________________
LLVM Developers mailing list
llvm-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

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

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-18  1:10 Proposal for new memory_order_consume definition Paul E. McKenney
2016-02-20  2:15 ` [isocpp-parallel] " Tony V E
2016-02-20  2:15   ` Tony V E
2016-02-20 19:53   ` Paul E. McKenney
2016-02-26  0:46     ` Hans Boehm via llvm-dev
2016-02-26 23:56       ` Lawrence Crowl
2016-02-27 17:06       ` Paul E. McKenney
2016-02-27 19:16         ` Linus Torvalds via llvm-dev
2016-02-27 23:10           ` Paul E. McKenney via llvm-dev
2016-02-27 23:10             ` Paul E. McKenney
2016-02-28  8:27             ` Markus Trippelsdorf via llvm-dev
2016-02-28  8:27               ` Markus Trippelsdorf
2016-02-28 16:13               ` Linus Torvalds
2016-02-28 16:50                 ` via llvm-dev [this message]
2016-02-28 16:50                   ` [llvm-dev] " cbergstrom
2016-02-29 17:37                 ` Michael Matz
2016-02-29 17:57                   ` Linus Torvalds via llvm-dev
2016-02-29 17:57                     ` Linus Torvalds
2016-02-29 19:38                 ` Lawrence Crowl
2016-02-29 21:10                   ` James Y Knight via llvm-dev
2016-02-29 21:12                   ` James Y Knight via llvm-dev
2016-02-29 21:12                     ` [llvm-dev] " James Y Knight
2016-02-29 20:45                 ` Toon Moene
2016-02-29 18:17         ` Michael Matz
2016-03-01  1:28           ` Paul E. McKenney via llvm-dev
2016-03-01  1:28             ` Paul E. McKenney

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=20160228165008.5468244.19084.78457@pathscale.com \
    --to=llvm-dev@lists.llvm.org \
    --cc=Ramana.Radhakrishnan@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=cbergstrom@pathscale.com \
    --cc=dhowells@redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=j.alglave@ucl.ac.uk \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luc.maranget@inria.fr \
    --cc=markus@trippelsdorf.de \
    --cc=mingo@kernel.org \
    --cc=parallel@lists.isocpp.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=torvalds@linux-foundation.org \
    --cc=will.deacon@arm.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.