NetBSD Problem Report #36295

From martin@duskware.de  Tue May  8 06:16:53 2007
Return-Path: <martin@duskware.de>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id C28FF63B970
	for <gnats-bugs@gnats.netbsd.org>; Tue,  8 May 2007 06:16:52 +0000 (UTC)
Message-Id: <20070508025929.88E1C63B853@narn.NetBSD.org>
Date: Tue,  8 May 2007 02:59:29 +0000 (UTC)
From: hbent@cs.oberlin.edu
Reply-To: hbent@cs.oberlin.edu
To: netbsd-bugs-owner@NetBSD.org
Subject: ps displays 0:00.00 for CPU time of all processes
X-Send-Pr-Version: www-1.0

>Number:         36295
>Category:       bin
>Synopsis:       ps displays 0:00.00 for CPU time of all processes
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue May 08 06:20:00 +0000 2007
>Closed-Date:    Mon Jan 07 13:35:00 +0000 2008
>Last-Modified:  Mon Jan 07 13:35:00 +0000 2008
>Originator:     Henry Bent
>Release:        4.99.17
>Organization:
Oberlin College CIT
>Environment:
NetBSD aelfric 4.99.17 NetBSD 4.99.17 (AELFRIC) #1: Tue Apr 10 17:23:39 EDT 2007  root@aelfric:/usr/obj/src-current/sys/arch/i386/compile/AELFRIC i386
>Description:
ps displays 0:00.00 for CPU time of all processes.  For example, here is a line from "top":

676 root       2    0    20M   75M select/0   4:27  1.42%  1.42% XFree86

and here is its corresponding line from "ps ax":

676 ?     S    0:00.00 X :0 (XFree86)

This also happens on my other 4.99.17 box, but with one interesting difference: a multi-threaded program is being reported correctly while none of the others are:

10376 ttyp0 Rl+  716:11.72 mencoder


>How-To-Repeat:
Nothing special, just run some processes that take up CPU time and notice that "ps" does not report that CPU time.
>Fix:
none known, sorry.

>Release-Note:

>Audit-Trail:
From: Michael van Elst <mlelstv@serpens.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/36295: ps displays 0:00.00 for CPU time of all processes
Date: Sat, 28 Jul 2007 18:18:24 +0200

 There are several issues:

 processes and LWPs share common state values like SIDL (for proc)
 and LSIDL (for lwp) that used to be identical. ps thus interprets
 them the same.

 The value LSSLEEP (==3) however is now seen as SDYING (==3). A
 process in state SDYING is handled like a zombie process and
 has no valid cputime accumulated. Thus ps shows zero.


 One solution would be to renumber the SDYING state to something
 new (like 10).

 The other solution would be to teach the kvm interface (syscall
 and userland for core-file groveling) that the state values
 for proc and lwp do not have identical values for equivalent
 states.


 -- 
                                 Michael van Elst
 Internet: mlelstv@serpens.de
                                 "A potential Snark may lurk in every tree."

From: David Laight <dsl@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: PR/36295 CVS commit: src/bin/ps
Date: Sat, 28 Jul 2007 17:05:51 +0000 (UTC)

 Module Name:	src
 Committed By:	dsl
 Date:		Sat Jul 28 17:05:50 UTC 2007

 Modified Files:
 	src/bin/ps: print.c

 Log Message:
 Don't call P_ZOMBIE(struct kinfo_proc2), it's p_stat field contains
 lwp states, not process states!
 Since the times are filled with zeros for zombie processes the check
 before assuming teh process time is zero is moot - delete it.
 Fix the other chact to test the p_realstat.
 Fixer PR kern/36295


 To generate a diff of this commit:
 cvs rdiff -r1.99 -r1.100 src/bin/ps/print.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Liam J. Foy" <liamjfoy@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: PR/36295 CVS commit: [netbsd-4] src/bin/ps
Date: Mon, 30 Jul 2007 12:47:56 +0000 (UTC)

 Module Name:	src
 Committed By:	liamjfoy
 Date:		Mon Jul 30 12:47:56 UTC 2007

 Modified Files:
 	src/bin/ps [netbsd-4]: print.c

 Log Message:
 Pull up following revision(s) (requested by dsl in ticket #798):
 	bin/ps/print.c: revision 1.100
 Don't call P_ZOMBIE(struct kinfo_proc2), it's p_stat field contains
 lwp states, not process states!
 Since the times are filled with zeros for zombie processes the check
 before assuming teh process time is zero is moot - delete it.
 Fix the other chact to test the p_realstat.
 Fixer PR kern/36295


 To generate a diff of this commit:
 cvs rdiff -r1.96 -r1.96.2.1 src/bin/ps/print.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Henry Bent <hbent@cs.oberlin.edu>
To: <gnats-bugs@netbsd.org>
Cc: 
Subject: Re: bin/36295
Date: Mon, 7 Jan 2008 02:20:18 -0500 (EST)

 This has definitely been fixed in newer versions of -current and can be
 closed.  Thanks!

 --
 Henry Bent
 hbent@cs.oberlin.edu

State-Changed-From-To: open->closed
State-Changed-By: jnemeth@netbsd.org
State-Changed-When: Mon, 07 Jan 2008 13:35:00 +0000
State-Changed-Why:
submitter reports that it is fixed, thanks...


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.