[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAK8P3a2LA_MzP=mZ7_QODx5c7qq-r5t-5pZCiThjD_jX_KPXPA@mail.gmail.com>
Date: Thu, 1 Jul 2021 15:47:48 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Christophe Leroy <christophe.leroy@...roup.eu>
Cc: Jason Wang <wangborong@...rlc.com>, Jeremy Kerr <jk@...abs.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Paul Mackerras <paulus@...ba.org>,
linuxppc-dev <linuxppc-dev@...ts.ozlabs.org>
Subject: Re: [PATCH] sched: Use WARN_ON
On Thu, Jul 1, 2021 at 2:57 PM Christophe Leroy
<christophe.leroy@...roup.eu> wrote:
> Le 01/07/2021 à 14:50, Jason Wang a écrit :
> > The BUG_ON macro simplifies the if condition followed by BUG, but it
> > will lead to the kernel crashing. Therefore, we can try using WARN_ON
> > instead of if condition followed by BUG.
>
> But are you sure it is ok to continue if spu_acquire(ctx) returned false ?
> Shouldn't there be at least for fallback handling ?
>
> Something like:
>
> if (WARN_ON(spu_acquire(ctx)))
> return;
I think you get a crash in either case:
- with the existing BUG_ON() there is an immediate backtrace and it stops there
- with WARN_ON() and continuing, you operate on a context that is not
valid
- with the 'return', you get an endless loop, as it keeps calling
spusched_tick()
without sleeping.
Out of those options, the existing BUG_ON() seems best.
Arnd
Powered by blists - more mailing lists