From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BBF96C11F64 for ; Thu, 1 Jul 2021 12:58:32 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4374361406 for ; Thu, 1 Jul 2021 12:58:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4374361406 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=csgroup.eu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4GFyvB5cbmz302c for ; Thu, 1 Jul 2021 22:58:30 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=csgroup.eu (client-ip=93.17.236.30; helo=pegase1.c-s.fr; envelope-from=christophe.leroy@csgroup.eu; receiver=) Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4GFytq0RxXz2ysq for ; Thu, 1 Jul 2021 22:58:08 +1000 (AEST) Received: from localhost (mailhub3.si.c-s.fr [192.168.12.233]) by localhost (Postfix) with ESMTP id 4GFytj08T5zB9np; Thu, 1 Jul 2021 14:58:05 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id F3Q4u9vNdjG6; Thu, 1 Jul 2021 14:58:04 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4GFytg6LvnzB9pC; Thu, 1 Jul 2021 14:58:03 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id C88098B903; Thu, 1 Jul 2021 14:58:03 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id uOkqtDmpu2rb; Thu, 1 Jul 2021 14:58:03 +0200 (CEST) Received: from [192.168.4.90] (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 62FDB8B961; Thu, 1 Jul 2021 14:58:03 +0200 (CEST) Subject: Re: [PATCH] sched: Use WARN_ON To: Jason Wang , jk@ozlabs.org References: <20210701125046.43018-1-wangborong@cdjrlc.com> From: Christophe Leroy Message-ID: Date: Thu, 1 Jul 2021 14:57:59 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210701125046.43018-1-wangborong@cdjrlc.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org, paulus@samba.org, linux-kernel@vger.kernel.org, arnd@arndb.de Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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 > --- > 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; >