Message ID | 1615966419-20549-1-git-send-email-jiapeng.chong@linux.alibaba.com (mailing list archive) |
---|---|
State | Rejected, archived |
Headers | show |
Series | [v2] sched: replace if (cond) BUG() with WARN_ON() | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | Successfully applied on branch powerpc/merge (0512161accb8b6f6dacc85d165350b1812ddcc33) |
snowpatch_ozlabs/build-ppc64le | success | Build succeeded |
snowpatch_ozlabs/build-ppc64be | success | Build succeeded |
snowpatch_ozlabs/build-ppc64e | success | Build succeeded |
snowpatch_ozlabs/build-pmac32 | success | Build succeeded |
snowpatch_ozlabs/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 9 lines checked |
snowpatch_ozlabs/needsstable | success | Patch has no Fixes tags |
On Wed, Mar 17, 2021 at 8:35 AM Jiapeng Chong <jiapeng.chong@linux.alibaba.com> wrote: > > Fix the following coccicheck warnings: > > ./arch/powerpc/platforms/cell/spufs/sched.c:908:2-5: WARNING: Use BUG_ON > instead of if condition followed by BUG. > > Reported-by: Abaci Robot <abaci@linux.alibaba.com> > Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com> If you change it from BUG() to WARN_ON(), you should explain why it's safe to do that in this case. Here it is not, since the following spu_release() will end up making things worse if the acquire failed. Also if there was a signal pending, then spusched_tick() will just get called again and constantly print these warnings. There is probably a way to use WARN_ON_ONCE() here, in combination with a way to terminate the thread safely, but this has to be done carefully. Arnd
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c index 3692064..1031448 100644 --- a/arch/powerpc/platforms/cell/spufs/sched.c +++ b/arch/powerpc/platforms/cell/spufs/sched.c @@ -904,8 +904,7 @@ static noinline void spusched_tick(struct spu_context *ctx) struct spu_context *new = NULL; struct spu *spu = NULL; - if (spu_acquire(ctx)) - BUG(); /* a kernel thread never has signals pending */ + WARN_ON(spu_acquire(ctx)); /* a kernel thread never has signals pending */ if (ctx->state != SPU_STATE_RUNNABLE) goto out;
Fix the following coccicheck warnings: ./arch/powerpc/platforms/cell/spufs/sched.c:908:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG. Reported-by: Abaci Robot <abaci@linux.alibaba.com> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com> --- Changes in v2: - replace BUG with WARN_ON. arch/powerpc/platforms/cell/spufs/sched.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)