lkml.org 
[lkml]   [2021]   [Jul]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH] sched: Use WARN_ON
From
Date


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;


Christophe


>
> Signed-off-by: Jason Wang <wangborong@cdjrlc.com>
> ---
> arch/powerpc/platforms/cell/spufs/sched.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
> index 369206489895..0f218d9e5733 100644
> --- a/arch/powerpc/platforms/cell/spufs/sched.c
> +++ b/arch/powerpc/platforms/cell/spufs/sched.c
> @@ -904,8 +904,8 @@ 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 */
> + /* a kernel thread never has signals pending */
> + WARN_ON(spu_acquire(ctx));
>
> if (ctx->state != SPU_STATE_RUNNABLE)
> goto out;
>

\
 
 \ /
  Last update: 2021-07-01 15:21    [W:0.358 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site