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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB4EEC433EF for ; Wed, 27 Oct 2021 01:11:58 +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 C865161039 for ; Wed, 27 Oct 2021 01:11:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C865161039 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Hf9dS0Cg9z3bN8 for ; Wed, 27 Oct 2021 12:11:56 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ellerman.id.au header.i=@ellerman.id.au header.a=rsa-sha256 header.s=201909 header.b=KtTiqffv; dkim-atps=neutral Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Hf9cm3wM1z2xVt for ; Wed, 27 Oct 2021 12:11:20 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ellerman.id.au header.i=@ellerman.id.au header.a=rsa-sha256 header.s=201909 header.b=KtTiqffv; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4Hf9cm1Wd2z4xbW; Wed, 27 Oct 2021 12:11:20 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1635297080; bh=I3Ag9NoPyPnvqS/AhH06q+iM0kEFuT48hNrE1E088vQ=; h=From:To:Subject:In-Reply-To:References:Date:From; b=KtTiqffvf7wsJxcwV+p+kntC3Cy9YyjexeiXB1IUgzz9Hmm/wOGQ3AAlfmpp9harF xLgJGzPTSGdGkGlufnv0DNnfnX8MZ/mhszerQF/NRj/zg4Zx3e65cSAhuoStZmVNri bFjCgeGbH0exCoU3CGKEDSVX6Ts01lysKx1fqdQ/dBhVt3zQMni4d/zqcH2wSB3nCL KS+LltQvL8N8nsordTQH2ljpI8yRhY4RbCIZhNrYuturV9KmkuEwqDoLyaiZ/hcI25 fYF25WGH+Ynu1UHzNvCaOvUjrmoEd5TOUf6H27xMfOxB7RpWsKzDfEdHku+bCO+32M ow3TGyu3+Ywvw== From: Michael Ellerman To: Denis Kirjanov , linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH] powerpc/xmon: fix task state output In-Reply-To: <20211026133108.7113-1-kda@linux-powerpc.org> References: <20211026133108.7113-1-kda@linux-powerpc.org> Date: Wed, 27 Oct 2021 12:11:15 +1100 Message-ID: <87bl3bb7bg.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain 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: , Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Denis Kirjanov writes: > p_state is unsigned since the commit 2f064a59a11f > > The patch also uses TASK_RUNNING instead of null. > > Fixes: 2f064a59a11f ("sched: Change task_struct::state") > Signed-off-by: Denis Kirjanov > --- > arch/powerpc/xmon/xmon.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c > index dd8241c009e5..8b28ff9d98d1 100644 > --- a/arch/powerpc/xmon/xmon.c > +++ b/arch/powerpc/xmon/xmon.c > @@ -3264,8 +3264,7 @@ static void show_task(struct task_struct *volatile tsk) > * appropriate for calling from xmon. This could be moved > * to a common, generic, routine used by both. > */ > - state = (p_state == 0) ? 'R' : > - (p_state < 0) ? 'U' : I guess 'U' meant 'unknown'? I always thought it meant uninterruptible, but obviously that is 'D'. > + state = (p_state == TASK_RUNNING) ? 'R' : > (p_state & TASK_UNINTERRUPTIBLE) ? 'D' : > (p_state & TASK_STOPPED) ? 'T' : > (p_state & TASK_TRACED) ? 'C' : I think a better cleanup would be to use task_is_running(), task_is_traced(), task_is_stopped(). That way we're insulated somewhat from any future changes. That would add additional READ_ONCE()s of the state, but I don't think we care, the task should not be running if the system is in xmon. cheers