linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Roland McGrath <roland@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
	x86@kernel.org
Subject: Re: [PATCH 0/2] __builtin_unreachable
Date: Thu, 10 Sep 2009 08:13:47 +0200	[thread overview]
Message-ID: <20090910061347.GD14664@tyan-ft48-01.lab.bos.redhat.com> (raw)
In-Reply-To: <20090910015923.8FB628AE5F@magilla.sf.frob.com>

On Wed, Sep 09, 2009 at 06:59:23PM -0700, Roland McGrath wrote:
> The latest GCC has a better way than "for (;;)" to indicate that a code
> path cannot be reached due to reasons the compiler doesn't understand (such
> as code in an asm).  These patches provide UNREACHABLE() as a macro to hide
> the details of this, and then use it for the BUG() macro on x86, saving
> some dead code otherwise generated.
> 
> Other arch's BUG() may want to this too instead of "for (;;)" or __builtin_trap.

Just instead of for (;;) (or any place where an asm never returns). 
__builtin_trap () shouldn't be replaced - __builtin_unreachable () just says
that the location is never reachable, so everything after it not reachable
through other ways can be optimized out - while __builtin_trap () emits an
instruction that traps and then assumes anything after it is unreachable.

Also, I wonder if Fedora/RHEL specific GCC backport is desirable to be
handled in upstream kernel (i.e. whether compiler-gcc4.h shouldn't enable it
just for GCC 4.5+) and Fedora/RHEL should patch it for our backport.

	Jakub

      parent reply	other threads:[~2009-09-10  6:17 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-10  1:59 [PATCH 0/2] __builtin_unreachable Roland McGrath
2009-09-10  2:00 ` [PATCH 1/2] UNREACHABLE() macro Roland McGrath
2009-09-11 20:45   ` Andrew Morton
2009-09-11 20:59     ` Kyle McMartin
2009-09-11 20:59       ` Kyle McMartin
2009-09-11 21:55     ` Roland McGrath
2009-09-12  3:49       ` Arjan van de Ven
2009-09-12  4:43         ` H. Peter Anvin
2009-09-12  5:30           ` Arjan van de Ven
2009-09-12  5:30             ` Arjan van de Ven
2009-09-12  5:52           ` Andrew Morton
2009-09-12  6:38             ` Jakub Jelinek
2009-09-12  6:38               ` Jakub Jelinek
2009-09-13 20:10               ` H. Peter Anvin
2009-09-10  2:01 ` [PATCH 2/2] x86: BUG(): use UNREACHABLE() Roland McGrath
2009-09-10  2:01   ` Roland McGrath
2009-09-10  4:42 ` [PATCH 0/2] __builtin_unreachable Américo Wang
2009-09-10  6:42   ` H. Peter Anvin
2009-09-10  6:13 ` Jakub Jelinek [this message]

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=20090910061347.GD14664@tyan-ft48-01.lab.bos.redhat.com \
    --to=jakub@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roland@redhat.com \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@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;
as well as URLs for NNTP newsgroup(s).