[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250402075209.GR5880@noisy.programming.kicks-ass.net>
Date: Wed, 2 Apr 2025 09:52:09 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Josh Poimboeuf <jpoimboe@...hat.com>
Cc: Robin Murphy <robin.murphy@....com>, Joerg Roedel <joro@...tes.org>,
Will Deacon <will@...nel.org>, linux-kernel@...r.kernel.org,
iommu@...ts.linux.dev, Randy Dunlap <rdunlap@...radead.org>,
"Paul E. McKenney" <paulmck@...nel.org>
Subject: Re: [PATCH] iommu: Convert unreachable() to BUG()
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.
Powered by blists - more mailing lists