All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Robin Murphy <robin.murphy@arm.com>,
	Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
	linux-kernel@vger.kernel.org, iommu@lists.linux.dev,
	Randy Dunlap <rdunlap@infradead.org>,
	"Paul E. McKenney" <paulmck@kernel.org>
Subject: Re: [PATCH] iommu: Convert unreachable() to BUG()
Date: Wed, 2 Apr 2025 09:52:09 +0200	[thread overview]
Message-ID: <20250402075209.GR5880@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <6zzyjtvkqc4ipj7ngtkx3jithfwpwuxlix677urlehgdnljwbl@wfoa5futari6>

On Tue, Apr 01, 2025 at 05:50:32PM -0700, Josh Poimboeuf wrote:
> On Thu, Mar 27, 2025 at 01:37:18PM +0100, Peter Zijlstra wrote:
> > On Wed, Mar 26, 2025 at 10:28:46PM -0700, Josh Poimboeuf wrote:
> > > Bare unreachable() should be avoided as it generates undefined behavior,
> > > e.g. falling through to the next function.  Use BUG() instead so the
> > > error is defined.
> > 
> > Right; I did a pass like this a while ago and thought I'd removed all
> > unreachable() abuse.
> 
> Any reason not to just "#define unreachable() BUG()" and convert UD2 and
> similar to use __builtin_unreachable()?

Just remove unreachable() entirely at that point. But you're going to
have to update all the various arch code that does use it correctly :/

There are a few sites besides BUG() that need it; eg, long jumps when
bootstrapping etc.

But basically nothing outside of arch code should ever need or want
unreachable.

  reply	other threads:[~2025-04-02  7:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-27  5:28 [PATCH] iommu: Convert unreachable() to BUG() Josh Poimboeuf
2025-03-27 12:37 ` Peter Zijlstra
2025-04-02  0:50   ` Josh Poimboeuf
2025-04-02  7:52     ` Peter Zijlstra [this message]
2025-03-27 13:00 ` Jason Gunthorpe
2025-03-27 14:58 ` 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=20250402075209.GR5880@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=robin.murphy@arm.com \
    --cc=will@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 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.