Debian Bug report logs - #460331
Unknown HZ value messages on kfreebsd arch

version graph

Package: kfreebsd-7; Maintainer for kfreebsd-7 is (unknown);

Reported by: Joey Hess <joeyh@debian.org>

Date: Sat, 12 Jan 2008 03:45:05 UTC

Severity: normal

Tags: help

Fixed in version 7.3-7+rm

Done: Debian FTP Masters <ftpmaster@ftp-master.debian.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Craig Small <csmall@debian.org>:
Bug#460331; Package procps. Full text and rfc822 format available.

Acknowledgement sent to Joey Hess <joeyh@debian.org>:
New Bug report received and forwarded. Copy sent to Craig Small <csmall@debian.org>. Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Joey Hess <joeyh@debian.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: Unknown HZ value! (94) Assume 100.
Date: Fri, 11 Jan 2008 22:42:37 -0500
[Message part 1 (text/plain, inline)]
Package: procps
Version: 1:3.2.7-5
Severity: normal

The subject error message is printed by ps, top, and other libproc using
programs when run on a Thecus N2100, running the debian armel port.

  case   62 ...   65 :  Hertz =   64; break; /* StrongARM /Shark */
  case   95 ...  105 :  Hertz =  100; break; /* normal Linux */
  case  124 ...  132 :  Hertz =  128; break; /* MIPS, ARM */

Interesting that the value 94 is just below the "normal Linux" range here.

Adding 94 to the table will suppress the message. I don't know why the kernel
is reporting it's using 94 herz.

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: armel

Linux turtle 2.6.22-3-iop32x #1 Fri Nov 16 18:47:40 UTC 2007 armv5tel GNU/Linux
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Craig Small <csmall@debian.org>:
Bug#460331; Package procps. Full text and rfc822 format available.

Acknowledgement sent to Joey Hess <joeyh@debian.org>:
Extra info received and forwarded to list. Copy sent to Craig Small <csmall@debian.org>. Full text and rfc822 format available.

Message #10 received at 460331@bugs.debian.org (full text, mbox):

From: Joey Hess <joeyh@debian.org>
To: 460331@bugs.debian.org
Subject: also 92..
Date: Tue, 11 Mar 2008 14:36:27 -0400
[Message part 1 (text/plain, inline)]
I'm also seeing the message with the value of 92 on another arm system.

-- 
see shy jo
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Craig Small <csmall@debian.org>:
Bug#460331; Package procps. Full text and rfc822 format available.

Acknowledgement sent to Joey Hess <joeyh@debian.org>:
Extra info received and forwarded to list. Copy sent to Craig Small <csmall@debian.org>. Full text and rfc822 format available.

Message #15 received at 460331@bugs.debian.org (full text, mbox):

From: Joey Hess <joeyh@debian.org>
To: 460331@bugs.debian.org
Subject: analysis
Date: Tue, 11 Mar 2008 16:29:47 -0400
[Message part 1 (text/plain, inline)]
Here's a good explanation about what procps is doing:
http://lkml.org/lkml/2002/2/18/187
However, the problem I'm seeing is not due to an overflow.

Just after a boot:

adsdebian:~# ps >/dev/null
Unknown HZ value! (67) Assume 100.
adsdebian:~# cat /proc/uptime  /proc/stat
92.52 64.55
cpu  1336 0 1458 3773 2681 4 0 0

If I sum all the cpu values and divide by uptime, I get 100, every time.
Meanwhile, procps warns about unknown hz values that are trending toward 100
as the uptime increases. After enough uptime, the problem disappears.

adsdebian:~# ps >/dev/null
Unknown HZ value! (89) Assume 100.
adsdebian:~# cat /proc/uptime  /proc/stat
271.05 242.41
cpu  1367 0 1494 21521 2716 6 1 0

adsdebian:~# ps >/dev/null
Unknown HZ value! (91) Assume 100.
adsdebian:~# cat /proc/uptime  /proc/stat
336.21 307.28
cpu  1380 0 1510 27984 2740 6 1 0

adsdebian:/tmp# ps >/dev/null
adsdebian:/tmp# cat /proc/uptime /proc/stat
1195.29 1155.56
cpu  2319 0 1651 109945 5596 11 7 0


Now, looking at the code:

    sscanf(buf, "cpu %Lu %Lu %Lu %Lu", &user_j, &nice_j, &sys_j, &other_j);

Why are only 4 of the numbers extracted? All of them seem to be needed.
Especially on slow and disk-bound systems, the current code only
succeeds in getting a number between 95 and 105 some time after boot,
when the time the system has spent in sys+user+idle mode swamps the
iowait+irq+softirq+steal numbers.

       /proc/stat
              kernel/system  statistics.   Varies  with  architecture.  Common
              entries include:

              cpu  3357 0 4313 1362393
                     The  amount  of  time,  measured  in  units  of   USER_HZ
                     (1/100ths  of  a  second on most architectures), that the
                     system spent in user mode, user mode  with  low  priority
                     (nice),  system  mode,  and  the idle task, respectively.
                     The last value should be USER_HZ times the  second  entry
                     in the uptime pseudo-file.

                     In Linux 2.6 this line includes three additional columns:
                     iowait - time waiting for I/O to complete (since 2.5.41);
                     irq  -  time  servicing  interrupts  (since 2.6.0-test4);
                     softirq - time servicing softirqs (since 2.6.0-test4).

                     Since Linux 2.6.11, there is an eighth  column,  steal  -
                     stolen  time,  which is the time spent in other operating
                     systems when running in a virtualized environment

Based on this, it seems right to add up all of the values if all are
available. (For values of "right" that assume this gross approach is the
right way to get the Hz value in the first place..)



With that said, on my laptop, I have:

2677820.60 1205073.58
cpu  17764500 386487 3214308 117025796 3022994 318693 296809 0 0

Using the first 4 numbers yeilds 52, while adding all yeilds 53, which
would be an unknown Hz value with the current code.

-- 
see shy jo
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org:
Bug#460331; Package procps. Full text and rfc822 format available.

Acknowledgement sent to Craig Small <csmall@debian.org>:
Extra info received and forwarded to list. Full text and rfc822 format available.

Message #20 received at 460331@bugs.debian.org (full text, mbox):

From: Craig Small <csmall@debian.org>
To: Joey Hess <joeyh@debian.org>, 460331@bugs.debian.org
Subject: Re: Bug#460331: analysis
Date: Wed, 12 Mar 2008 08:48:28 +1100
On Tue, Mar 11, 2008 at 04:29:47PM -0400, Joey Hess wrote:
> Here's a good explanation about what procps is doing:
> http://lkml.org/lkml/2002/2/18/187
It's not quite how it does it. procps uses a delta or change in the
values.

> If I sum all the cpu values and divide by uptime, I get 100, every time.
But is that the correct value? I'm worried that this masks the actual
problem.

> Meanwhile, procps warns about unknown hz values that are trending toward 100
> as the uptime increases. After enough uptime, the problem disappears.
That's the strangest part of it, as it is using a delta it shouldn't
matter when you do it.  Unless there is some strange underflow going on.

> Why are only 4 of the numbers extracted? All of them seem to be needed.
> Especially on slow and disk-bound systems, the current code only
> succeeds in getting a number between 95 and 105 some time after boot,
> when the time the system has spent in sys+user+idle mode swamps the
> iowait+irq+softirq+steal numbers.
I'm not sure, for example it could be that the iowait time is a
duplicate of user or system time.

> Based on this, it seems right to add up all of the values if all are
> available. (For values of "right" that assume this gross approach is the
> right way to get the Hz value in the first place..)
The right way is to have an elf note.

I'll try to work out why all numbers are not added.

 - Craig

-- 
Craig Small      GnuPG:1C1B D893 1418 2AF4 45EE  95CB C76C E5AC 12CA DFA5
http://www.enc.com.au/                             csmall at : enc.com.au
http://www.debian.org/          Debian GNU/Linux, software should be Free 




Information forwarded to debian-bugs-dist@lists.debian.org, Craig Small <csmall@debian.org>:
Bug#460331; Package procps. Full text and rfc822 format available.

Acknowledgement sent to Joey Hess <joeyh@debian.org>:
Extra info received and forwarded to list. Copy sent to Craig Small <csmall@debian.org>. Full text and rfc822 format available.

Message #25 received at 460331@bugs.debian.org (full text, mbox):

From: Joey Hess <joeyh@debian.org>
To: Craig Small <csmall@debian.org>, 460331@bugs.debian.org
Subject: Re: Bug#460331: analysis
Date: Tue, 11 Mar 2008 18:36:27 -0400
[Message part 1 (text/plain, inline)]
Craig Small wrote:
> On Tue, Mar 11, 2008 at 04:29:47PM -0400, Joey Hess wrote:
> > Here's a good explanation about what procps is doing:
> > http://lkml.org/lkml/2002/2/18/187
> It's not quite how it does it. procps uses a delta or change in the
> values.

I don't see any delta. ps doesn't wait for multiple values..

> > If I sum all the cpu values and divide by uptime, I get 100, every time.
> But is that the correct value? I'm worried that this masks the actual
> problem.

I don't know how to figure out what the real value is for a given
machine.

> I'll try to work out why all numbers are not added.

Probably has something to do with this code having been written for 2.4
:-)

-- 
see shy jo
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org:
Bug#460331; Package procps. Full text and rfc822 format available.

Acknowledgement sent to Craig Small <csmall@debian.org>:
Extra info received and forwarded to list. Full text and rfc822 format available.

Message #30 received at 460331@bugs.debian.org (full text, mbox):

From: Craig Small <csmall@debian.org>
To: Joey Hess <joeyh@debian.org>, 460331@bugs.debian.org
Subject: Re: Bug#460331: analysis
Date: Thu, 13 Mar 2008 11:19:45 +1100
On Tue, Mar 11, 2008 at 06:36:27PM -0400, Joey Hess wrote:
> I don't see any delta. ps doesn't wait for multiple values..
Sorry, you're right. There is a while loop but that's to ensure that
the uptime doesn't vary that much, it's not a difference.

It all makes more sense now. Well, at least why you get the problem.

> > I'll try to work out why all numbers are not added.
> Probably has something to do with this code having been written for 2.4
I'd say so. I'll look more into it and ask upstream.

 - Craig

-- 
Craig Small      GnuPG:1C1B D893 1418 2AF4 45EE  95CB C76C E5AC 12CA DFA5
http://www.enc.com.au/                             csmall at : enc.com.au
http://www.debian.org/          Debian GNU/Linux, software should be Free 




Information forwarded to debian-bugs-dist@lists.debian.org, Craig Small <csmall@debian.org>:
Bug#460331; Package procps. Full text and rfc822 format available.

Acknowledgement sent to "Albert Cahalan" <acahalan@gmail.com>:
Extra info received and forwarded to list. Copy sent to Craig Small <csmall@debian.org>. Full text and rfc822 format available.

Message #35 received at 460331@bugs.debian.org (full text, mbox):

From: "Albert Cahalan" <acahalan@gmail.com>
To: 460331@bugs.debian.org
Subject: bad Hz on ARM
Date: Mon, 24 Mar 2008 02:32:20 -0400
I could update that code to handle recent 2.6.xx kernels,
but I'd rather rip it out entirely. I suppose the code might
be useful for the guy who does the Cygwin (Windows!!!)
port, and there might be a person running a.out binaries.

My first suspicion is that you are using a broken libc.
There have been some non-glibc ones that messed up
the stack prior to calling main. The ELF notes were
thus unavailable, causing procps to use the obsolete
code that you see failing.

My second suspicion is that you aren't using ELF.
Might you also lack an MMU? If so you must be in
considerable pain, as ps likes to mmap() a huge
chunk of memory for the output buffer. ELF is the
norm for 2.6.xx kernels.

You might prefer the minimal.c version that can be
found in the procps source package.




Information forwarded to debian-bugs-dist@lists.debian.org, Craig Small <csmall@debian.org>:
Bug#460331; Package procps. Full text and rfc822 format available.

Acknowledgement sent to "David Wennström" <david.wennstrom@gmail.com>:
Extra info received and forwarded to list. Copy sent to Craig Small <csmall@debian.org>. Full text and rfc822 format available.

Message #40 received at 460331@bugs.debian.org (full text, mbox):

From: "David Wennström" <david.wennstrom@gmail.com>
To: 460331@bugs.debian.org
Subject: same issue on qnap orion5x
Date: Thu, 24 Jul 2008 11:06:08 +0200
[Message part 1 (text/plain, inline)]
I see this on my newly installed qnap 209 device.

$ uptime
Unknown HZ value! (94) Assume 100.
 13:00:05 up 1 day, 12:38,  1 user,  load average: 0.65, 0.46, 0.34


It goes up, yesterday it was 93...
--David
[Message part 2 (text/html, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org:
Bug#460331; Package procps. Full text and rfc822 format available.

Acknowledgement sent to Craig Small <csmall@debian.org>:
Extra info received and forwarded to list. Full text and rfc822 format available.

Message #45 received at 460331@bugs.debian.org (full text, mbox):

From: Craig Small <csmall@debian.org>
To: Joey Hess <joeyh@debian.org>, 460331@bugs.debian.org
Subject: Re: Bug#460331: analysis
Date: Sun, 10 Aug 2008 00:27:39 +1000
[Message part 1 (text/plain, inline)]
tags 460331 pending
thankyou
On Tue, Mar 11, 2008 at 06:36:27PM -0400, Joey Hess wrote:
> Probably has something to do with this code having been written for 2.4
It was, and the next version of procps should have this patch in it.
If you're keen, patch it and run it up. I'd appreciate any comments.

 - Craig
-- 
Craig Small      GnuPG:1C1B D893 1418 2AF4 45EE  95CB C76C E5AC 12CA DFA5
http://www.enc.com.au/                             csmall at : enc.com.au
http://www.debian.org/          Debian GNU/Linux, software should be Free 
[30_sysinfo_7numbers.dpatch (text/plain, attachment)]

Reply sent to Craig Small <csmall@debian.org>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to Joey Hess <joeyh@debian.org>:
Bug acknowledged by developer. Full text and rfc822 format available.

Message #50 received at 460331-close@bugs.debian.org (full text, mbox):

From: Craig Small <csmall@debian.org>
To: 460331-close@bugs.debian.org
Subject: Bug#460331: fixed in procps 1:3.2.7-9
Date: Sun, 10 Aug 2008 02:02:03 +0000
Source: procps
Source-Version: 1:3.2.7-9

We believe that the bug you reported is fixed in the latest version of
procps, which is due to be installed in the Debian FTP archive:

libproc-dev_3.2.7-9_i386.deb
  to pool/main/p/procps/libproc-dev_3.2.7-9_i386.deb
procps_3.2.7-9.diff.gz
  to pool/main/p/procps/procps_3.2.7-9.diff.gz
procps_3.2.7-9.dsc
  to pool/main/p/procps/procps_3.2.7-9.dsc
procps_3.2.7-9_i386.deb
  to pool/main/p/procps/procps_3.2.7-9_i386.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 460331@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Craig Small <csmall@debian.org> (supplier of updated procps package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.8
Date: Sun, 10 Aug 2008 11:49:12 +1000
Source: procps
Binary: procps libproc-dev
Architecture: source i386
Version: 1:3.2.7-9
Distribution: unstable
Urgency: low
Maintainer: Craig Small <csmall@debian.org>
Changed-By: Craig Small <csmall@debian.org>
Description: 
 libproc-dev - library for accessing process information from /proc
 procps     - /proc file system utilities
Closes: 390225 408608 416976 446466 458986 460331
Changes: 
 procps (1:3.2.7-9) unstable; urgency=low
 .
   * Reverse order of sysctl file reads
   * Added sys.kernel.maps_protect option to syctl.conf Closes: #446466
   * Add up 7 cpu numbers Closes: 460331
   * Top closes when it gets EOF Closes: #458986, #416976
   * Fixed -a option processing Closes: #408608
   * Added German man page for w Closes: #390225
   * Updated to standards version 3.8.0
Checksums-Sha1: 
 19f1924196b6ebae76726dc7729167e7b557015f 986 procps_3.2.7-9.dsc
 5d5045b7ef410acbecef243756282bd12597384f 47775 procps_3.2.7-9.diff.gz
 0a2ce1e4a773002e14b5de3796a312e8968a2614 222470 procps_3.2.7-9_i386.deb
 219f82fc7bf019c89fc45a02ea8f148afe6eb450 56098 libproc-dev_3.2.7-9_i386.deb
Checksums-Sha256: 
 4e50a2c7c1ca6bbc08f3f19e7c71e4259ae5c0fac60efccb3bf7183600c2192d 986 procps_3.2.7-9.dsc
 bd53253607562bffcf2342186280562fca5fa0af2378b550e2815785a5219fc6 47775 procps_3.2.7-9.diff.gz
 43a12899cad6366efbf5cfa9e30279710c220171a8596875fdb9c47ca8ce2b12 222470 procps_3.2.7-9_i386.deb
 092ee101eb8f0abf4e9ac4dfffef363c52ac82bbc9ce169a5069700bc2952c9d 56098 libproc-dev_3.2.7-9_i386.deb
Files: 
 68f83b28d8cb87ce4890a08fc481cd0d 986 admin required procps_3.2.7-9.dsc
 7858a6a27ee3cba65439cd3a01950abd 47775 admin required procps_3.2.7-9.diff.gz
 9e1cb5b9ebb63902482be361d7001f59 222470 admin required procps_3.2.7-9_i386.deb
 dab027f6096651d90c96dec8419dcf24 56098 libdevel optional libproc-dev_3.2.7-9_i386.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iD8DBQFInkp8x2zlrBLK36URAiS4AJ9Qgh6IWtYu6dzPciVA6bfTRJTWEACgmZpw
Lz2zcVzjznwb51DUbqv9J38=
=+Z71
-----END PGP SIGNATURE-----





Information forwarded to debian-bugs-dist@lists.debian.org, Craig Small <csmall@debian.org>:
Bug#460331; Package procps. (Mon, 19 Jan 2009 03:45:02 GMT) Full text and rfc822 format available.

Message #53 received at 460331@bugs.debian.org (full text, mbox):

From: Craig Small <csmall@debian.org>
To: 460331@bugs.debian.org
Subject: Re: Bug#460331: analysis, was this ever fixed?
Date: Mon, 19 Jan 2009 14:43:09 +1100
reopen 460331
tags 460331 help
thankyou

I've BCC'ed you on this email and its gone to the Debian BTS as it does
explain the underlying bug quite well. Replies will go there too, I
think.

On Mon, Jan 19, 2009 at 12:10:18PM +1100, Tom wrote:
> old_Hertz_hack() is summing up FOUR jiffy values. That matches what  
> Kernel 2.4 did. Kernel 2.6 has SEVEN jiffy values, and if I add them up  
> manually the problem goes away.
That's good!

> old_Hertz_hack() is only called from init_libproc on kernels <= 2.4.0.  
> So on 2.6 kernels old_Hertz_hack() SHOULDN'T BE RUNNING AT ALL and that  
> looks to be the real bug. old_Hertz_hack() shouldn't be patched (to 2.6  
> with 7 parameters) as it is only used for 2.4 kernels as per:
Actually you're not correct there, it could be a 2.3 kernel or the note
not found, but..

> If the "find_elf_note()" call failed it would be printing the ""2.4+  
> kernel w/o ELF notes?" warning as well as the "Unknown HZ value!".
you're dead right here. Why isn't it complaining?

> Probably because "linux_version_code" isn't valid or set. That is set from:
That's exactly the problem.

> static void init_libproc(void) __attribute__((constructor));
> static void init_Linux_version(void) __attribute__((constructor));
>
> are "magically" called on library startup, and obviously  
> init_Linux_version() had better be called to set linux_version_code  
> before init_libproc() is being called to use the result.
>
> I can't see any guarantee of this in the code. Nothing in any calling  
> order (there isn't one) and nothing I can find in the Makefile. That may  
> be the real problem here. Which is still there.
In fact depending on what you are using, it is different.

On a i386:
(gdb) run
Starting program: /home/csmall/debian/procps/procps-3.2.7.o/ps/ps

Breakpoint 2, init_Linux_version () at proc/version.c:39
39          int x = 0, y = 0, z = 0;    /* cleared in case sscanf() < 3 */
(gdb) c
Continuing.

Breakpoint 1, init_libproc () at proc/sysinfo.c:211
211       have_privs = check_for_privs();


On an Armel (agricola):
(gdb) run
Starting program: /home/csmall/procps-3.2.7/ps/ps

Breakpoint 1, init_libproc () at proc/sysinfo.c:211
211       have_privs = check_for_privs();
(gdb) c
Continuing.

Breakpoint 2, init_Linux_version () at proc/version.c:41
41          if (uname(&uts) == -1)      /* failure implies impending death */
(gdb)

So! the million dollar question, is the code wrong or is GCC on an Armel
wrong?  Is there supposed to be an order here?  It seems to be
consistently correct for the i386.

Setting the priority will fix it, I'm just not sure if the real problem
is a GCC bug on the Armel. I wish the GCC documentation was written
a little clearer.

 - Craig

-- 
Craig Small      GnuPG:1C1B D893 1418 2AF4 45EE  95CB C76C E5AC 12CA DFA5
http://www.enc.com.au/                             csmall at : enc.com.au
http://www.debian.org/          Debian GNU/Linux, software should be Free 




Bug reopened, originator not changed. Request was from Craig Small <csmall@debian.org> to control@bugs.debian.org. (Mon, 19 Jan 2009 03:45:03 GMT) Full text and rfc822 format available.

Tags added: help Request was from Craig Small <csmall@debian.org> to control@bugs.debian.org. (Mon, 19 Jan 2009 03:45:04 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Craig Small <csmall@debian.org>:
Bug#460331; Package procps. (Mon, 19 Jan 2009 04:54:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tom Evans <tom@ceos.com.au>:
Extra info received and forwarded to list. Copy sent to Craig Small <csmall@debian.org>. (Mon, 19 Jan 2009 04:54:03 GMT) Full text and rfc822 format available.

Message #62 received at 460331@bugs.debian.org (full text, mbox):

From: Tom Evans <tom@ceos.com.au>
To: 460331@bugs.debian.org
Cc: Tom Evans <thomasaevans@optusnet.com.au>
Subject: Re: Bug#460331: analysis, was this ever fixed?
Date: Mon, 19 Jan 2009 15:51:04 +1100
Craig Small wrote:
> reopen 460331
> tags 460331 help
> thankyou

And thanks to you for the rapid response. That's service!

> On a i386:
> ... 
> On an Armel (agricola):
> ...

I had this information last Friday courtesy of strace and didn't realise it!

open("/proc/stat", O_RDONLY)            = 3
...
read(3, "cpu  892 0 1477 18830 1336 54 1 0"..., 1024) = 564
...
open("/proc/uptime", O_RDONLY)          = 3
...
read(3, "225.92 201.84\n"..., 1023)     = 14
open("/proc/stat", O_RDONLY)            = 4
...
read(4, "cpu  892 0 1478 18830 1336 54 1 0"..., 1023) = 564
...
write(2, "Unknown HZ value! (93) Assume 100"..., 35Unknown HZ value!
...
open("/proc/version", O_RDONLY)         = 5
...
read(5, "Linux version 2.6.27.10.colibri32"..., 1024) = 155

> So! the million dollar question, is the code wrong or
> is GCC on an Armel wrong?

Or is it the famous "undefined behaviour"?

> Is there supposed to be an order here?  It seems to be
> consistently correct for the i386.

Possible getting lucky with a linker or compiler hash table.

> Setting the priority will fix it,

Where can that be set? Is this something in the Makefile or are there 
extra parameters to the attribute macro?

> I'm just not sure if the real problem
> is a GCC bug on the Armel.

I think the REAL problem is that objects "initialized/constructed" with 
those attributes are assumed to be INDEPENDENT. If different parts are 
dependent (as these two are) then the programmer is meant to handle this.

Maybe a library is only meant to have one constructor (that calls the 
other initialisation functions in the right order)?

That would be the easiest way to fix this one, at the "expense" of 
making init_Linux_version() non-static and exposing it in a header file.

The simplest fix I can think of would probably be a correct variation on:

- static void init_Linux_version(void) __attribute__((constructor));

  static void init_libproc(void) __attribute__((constructor));
  static void init_libproc(void){
    have_privs = check_for_privs();
+   init_Linux_version();

init_signal_list() is also a "constructor". It is independent of the 
other two and so is OK (but could probably be replaced with an assert of 
some sort).

> I wish the GCC documentation was written
> a little clearer.

Could you please give me a pointer to which GCC docs cover dynamic 
libraries?

-- 
===
Tom Evans      Tom.Evans@ceos.com.au
CEOS Pty Ltd   www.ceos.com.au
3/17 Burgundy St, Heidelberg,
Victoria 3084, Australia

Phone  (+61 3) 9458 4955
Direct         Unsupported
FAX    (+61 3) 9458 4966
Mobile         0405 776 431




Information forwarded to debian-bugs-dist@lists.debian.org:
Bug#460331; Package procps. (Mon, 19 Jan 2009 05:15:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Craig Small <csmall@debian.org>:
Extra info received and forwarded to list. (Mon, 19 Jan 2009 05:15:02 GMT) Full text and rfc822 format available.

Message #67 received at 460331@bugs.debian.org (full text, mbox):

From: Craig Small <csmall@debian.org>
To: Tom Evans <tom@ceos.com.au>, 460331@bugs.debian.org
Cc: Tom Evans <thomasaevans@optusnet.com.au>
Subject: Re: Bug#460331: analysis, was this ever fixed?
Date: Mon, 19 Jan 2009 16:13:35 +1100
On Mon, Jan 19, 2009 at 03:51:04PM +1100, Tom Evans wrote:
> Or is it the famous "undefined behaviour"?
That would then mean it's procps' fault.

>> I wish the GCC documentation was written
>> a little clearer.
>
> Could you please give me a pointer to which GCC docs cover dynamic  
> libraries?
http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
(scroll down to constructors)

Why don't they mention the priority ranges or lowest wins? Or if there
are two constructors which one goes first, even "its not defined" would
of been better. Also it doesn't say what the default priority is.
To think, a few more words would of made life so much easier :(

Setting the priority will fix it for procps, but it may be masking a 
bug in the GCC; not THIS bugs problem for sure but it should be fixed.
Next release I'll set the priority, at the very least it makes it clear
what I want the code to do.

 - Craig
-- 
Craig Small      GnuPG:1C1B D893 1418 2AF4 45EE  95CB C76C E5AC 12CA DFA5
http://www.enc.com.au/                             csmall at : enc.com.au
http://www.debian.org/          Debian GNU/Linux, software should be Free 




Information forwarded to debian-bugs-dist@lists.debian.org, baryluk@smp.if.uj.edu.pl, Craig Small <csmall@debian.org>:
Bug#460331; Package procps. (Fri, 09 Oct 2009 14:30:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Witold Baryluk <baryluk@smp.if.uj.edu.pl>:
Extra info received and forwarded to list. Copy sent to baryluk@smp.if.uj.edu.pl, Craig Small <csmall@debian.org>. (Fri, 09 Oct 2009 14:30:04 GMT) Full text and rfc822 format available.

Message #72 received at 460331@bugs.debian.org (full text, mbox):

From: Witold Baryluk <baryluk@smp.if.uj.edu.pl>
To: Debian Bug Tracking System <460331@bugs.debian.org>
Subject: Re: Unknown HZ value! (83) Assume 100, kfreebsd
Date: Fri, 09 Oct 2009 18:10:45 +0200
Package: procps
Version: 1:3.2.8-2
Severity: normal

Hi, I have exactly the same problem on kfreebsd-i386.

baryluk@debian:~$ uptime
Unknown HZ value! (83) Assume 100.
 18:06:15 up  1:07,  3 users,  load average: 0.11, 0.42, 0.63
baryluk@debian:~$ free
Unknown HZ value! (82) Assume 100.
             total       used       free     shared    buffers     cached
Mem:        118180      33744      84436      16916          0       3284
-/+ buffers/cache:      30460      87720
Swap:       265040      32340     232700
baryluk@debian:~$ w
Unknown HZ value! (82) Assume 100.
baryluk@debian:~$

top and ps also have this problem.

Sometimes it is 83, 82, sometimes 67, and similar values.



-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: kfreebsd-i386 (i686)

Kernel: kFreeBSD 7.2-1-686
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages procps depends on:
ii  initscripts               2.87dsf-6      scripts for initializing and shutt
ii  libc0.1                   2.9-27         GNU C Library: Shared libraries
ii  libncurses5               5.7+20090803-2 shared libraries for terminal hand
ii  lsb-base                  3.2-23         Linux Standard Base 3.2 init scrip

Versions of packages procps recommends:
ii  psmisc                        22.8-1     utilities that use the proc file s

procps suggests no packages.

-- no debconf information




Reply sent to Craig Small <csmall@debian.org>:
You have taken responsibility. (Sun, 31 Jan 2010 11:09:14 GMT) Full text and rfc822 format available.

Notification sent to Joey Hess <joeyh@debian.org>:
Bug acknowledged by developer. (Sun, 31 Jan 2010 11:09:14 GMT) Full text and rfc822 format available.

Message #77 received at 460331-close@bugs.debian.org (full text, mbox):

From: Craig Small <csmall@debian.org>
To: 460331-close@bugs.debian.org
Subject: Bug#460331: fixed in procps 1:3.2.8-3
Date: Sun, 31 Jan 2010 11:06:04 +0000
Source: procps
Source-Version: 1:3.2.8-3

We believe that the bug you reported is fixed in the latest version of
procps, which is due to be installed in the Debian FTP archive:

libproc-dev_3.2.8-3_amd64.deb
  to main/p/procps/libproc-dev_3.2.8-3_amd64.deb
procps_3.2.8-3.debian.tar.gz
  to main/p/procps/procps_3.2.8-3.debian.tar.gz
procps_3.2.8-3.dsc
  to main/p/procps/procps_3.2.8-3.dsc
procps_3.2.8-3_amd64.deb
  to main/p/procps/procps_3.2.8-3_amd64.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 460331@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Craig Small <csmall@debian.org> (supplier of updated procps package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.8
Date: Sun, 31 Jan 2010 18:31:08 +1100
Source: procps
Binary: procps libproc-dev
Architecture: source amd64
Version: 1:3.2.8-3
Distribution: unstable
Urgency: low
Maintainer: Craig Small <csmall@debian.org>
Changed-By: Craig Small <csmall@debian.org>
Description: 
 libproc-dev - library for accessing process information from /proc
 procps     - /proc file system utilities
Closes: 306778 331419 347476 460331 503089 505571 526604 545007 550009 551173 551933 554808 558089 558134 558361 567704
Changes: 
 procps (1:3.2.8-3) unstable; urgency=low
 .
   * Changed source format to 3.0 quilt
   * rules file to new debhelper tiny format
   * some pid points set to null if status file cannot be read Closes: #550009
   * vmstat doesn't scale things that shouldn't Closes: #558134
   * Limit counter wrap with vmstat Closes: #558361
   * Adjusted rules file so wont build amd64 files on i386 Closes:
     #558089
   * Removed kernel.maps_protect from example file Closes: #554808
   * skill doesnt treat null param as 0 Closes: #551173
   * Reduced init.d verbosity Closes: #567704
   * Documented /etc/sysctl.d directory Closes: #551933
   * sysctl.conf warns about RAs ignored with ipv6 forwarding Closes:
     #545007
   * free -o better documented Closes: #526604
   * slabtop -o doesnt use ncurses slabtop_once patch Closes: #503089
   * libproc.so symlink in -dev package Closes: #306778
   * skill/snice option parsing fixed Closes: #331419
   * Forced libproc constructor order Closes: #460331
   * pmap -x prints RSS and dirty columns Closes: #347476, #505571
Checksums-Sha1: 
 dba3e75ae34c15e2d484cca369e29cb5b48e8847 1022 procps_3.2.8-3.dsc
 6166efd2f4cbb3167193b2a47ed3ca2e273c39d9 81831 procps_3.2.8-3.debian.tar.gz
 b3f0861f2cb3559ab76974084c31471774ca0b9e 246846 procps_3.2.8-3_amd64.deb
 f3fa5abdc4ae83b8e4cd9f2668944e048b8a9cf0 64660 libproc-dev_3.2.8-3_amd64.deb
Checksums-Sha256: 
 cf48e363beb174c9469a88bf37167f5a0885e5d86df6c874343b3111ccef994f 1022 procps_3.2.8-3.dsc
 64029e1b0873e7076c390da86a74dd02c0e540c37ab28da1b41114dcbabbdf39 81831 procps_3.2.8-3.debian.tar.gz
 af4d07ea8b91b34088da7a071f37eca9c964412538f81c94a3ba1685b7c37f47 246846 procps_3.2.8-3_amd64.deb
 318f36d1fbbd46c5ea09dc6d7a1e6d8aa905bc3eed1d6df819a05e6153893ff5 64660 libproc-dev_3.2.8-3_amd64.deb
Files: 
 d020c30fd7972c8387357bcaf2146eb4 1022 admin required procps_3.2.8-3.dsc
 9a8b64dd7a2bebfcac0a84d011d9cb44 81831 admin required procps_3.2.8-3.debian.tar.gz
 a1f626d5eccb26f745debe83861d3efd 246846 admin required procps_3.2.8-3_amd64.deb
 feafc7fdbe0935a82f95c278aad0f041 64660 libdevel optional libproc-dev_3.2.8-3_amd64.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iD8DBQFLZV9Kx2zlrBLK36URAsClAJ9UhcxcjBKg4qrhU0XWKPNQdTuUPACfTjvR
kwhtQ43liljg+++7BIyzGDY=
=EgZ2
-----END PGP SIGNATURE-----





Information forwarded to debian-bugs-dist@lists.debian.org, Craig Small <csmall@debian.org>:
Bug#460331; Package procps. (Wed, 10 Feb 2010 13:36:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Peter Palfrader <weasel@debian.org>:
Extra info received and forwarded to list. Copy sent to Craig Small <csmall@debian.org>. (Wed, 10 Feb 2010 13:36:03 GMT) Full text and rfc822 format available.

Message #82 received at 460331@bugs.debian.org (full text, mbox):

From: Peter Palfrader <weasel@debian.org>
To: 460331@bugs.debian.org
Cc: control@bugs.debian.org
Subject: still have this problem on kfreebsd-i386
Date: Wed, 10 Feb 2010 14:33:52 +0100
reopen 460331
thanks

I upgraded procps on field.debian.org in the hope of appeasing ps (and
this nagios) but no such luck:

| weasel@field:~$ dpkg -l procps
..
| ii  procps                      1:3.2.8-6                   /proc file system utilities
| weasel@field:~$ uptime
| Unknown HZ value! (45) Assume 100.
|  13:32:48 up 1 day, 17:14,  2 users,  load average: 0.87, 0.80, 0.58
| weasel@field:~$ ps xuf
| Unknown HZ value! (45) Assume 100.
| USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
| weasel   28843  0.0  0.0   9264     0 ?        S    Feb12   0:00 /usr/sbin/sshd -R
| weasel   28844  0.0  0.0   7552     0 ?        Ss   Feb12   0:00  \_ -zsh
| weasel   28942  0.0  0.0   4352     0 ?        R+   Feb12   0:00      \_ ps xuf

So it appears that this issue is not yet resolved.
-- 
                           |  .''`.  ** Debian GNU/Linux **
      Peter Palfrader      | : :' :      The  universal
 http://www.palfrader.org/ | `. `'      Operating System
                           |   `-    http://www.debian.org/




Bug No longer marked as fixed in versions procps/1:3.2.8-3 and reopened. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Wed, 10 Feb 2010 13:36:06 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org:
Bug#460331; Package procps. (Thu, 11 Feb 2010 00:30:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Craig Small <csmall@debian.org>:
Extra info received and forwarded to list. (Thu, 11 Feb 2010 00:30:06 GMT) Full text and rfc822 format available.

Message #89 received at 460331@bugs.debian.org (full text, mbox):

From: Craig Small <csmall@debian.org>
To: Peter Palfrader <weasel@debian.org>, 460331@bugs.debian.org
Subject: Re: Bug#460331: still have this problem on kfreebsd-i386
Date: Thu, 11 Feb 2010 11:26:56 +1100
On Wed, Feb 10, 2010 at 02:33:52PM +0100, Peter Palfrader wrote:
> I upgraded procps on field.debian.org in the hope of appeasing ps (and
> this nagios) but no such luck:
kfreebsd has unbelievably broken procfs so it could be a symptom of
that. Unforuntately the bugs about procfs are several years old.

Can you send me the output of
cat /proc/uptime ; grep 'cpu ' /proc/stat ; cat /proc/uptime

also
getconf CLK_TCK

That will at least tell me if we're getting sensible numbers first.
Jiffies is calculated by adding the 7 numbers of the cpu line and
dividing it by the average of the two first number of the uptime.
On my amd64 it was 102 which is close enough to 100, which is what
CLK_TCK gives me.

On asdfasdf which is an amd64 kfreebsd computer getconf gives 60 but 
the calculation gives 99. This is wrong!
 - Craig
-- 
Craig Small      GnuPG:1C1B D893 1418 2AF4 45EE  95CB C76C E5AC 12CA DFA5
http://www.enc.com.au/                             csmall at : enc.com.au
http://www.debian.org/          Debian GNU/Linux, software should be Free 




Information forwarded to debian-bugs-dist@lists.debian.org, Craig Small <csmall@debian.org>:
Bug#460331; Package procps. (Thu, 11 Feb 2010 00:51:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Peter Palfrader <weasel@debian.org>:
Extra info received and forwarded to list. Copy sent to Craig Small <csmall@debian.org>. (Thu, 11 Feb 2010 00:51:06 GMT) Full text and rfc822 format available.

Message #94 received at 460331@bugs.debian.org (full text, mbox):

From: Peter Palfrader <weasel@debian.org>
To: Craig Small <csmall@debian.org>, 460331@bugs.debian.org
Subject: Re: Bug#460331: still have this problem on kfreebsd-i386
Date: Thu, 11 Feb 2010 01:48:07 +0100
On Thu, 11 Feb 2010, Craig Small wrote:

> On Wed, Feb 10, 2010 at 02:33:52PM +0100, Peter Palfrader wrote:
> > I upgraded procps on field.debian.org in the hope of appeasing ps (and
> > this nagios) but no such luck:
> kfreebsd has unbelievably broken procfs so it could be a symptom of
> that. Unforuntately the bugs about procfs are several years old.
> 
> Can you send me the output of
> cat /proc/uptime ; grep 'cpu ' /proc/stat ; cat /proc/uptime
> 
> also
> getconf CLK_TCK

Sure:

| weasel@field:~$ cat /proc/uptime ; grep 'cpu ' /proc/stat ; cat /proc/uptime
| 188847.15 673325.21
| cpu 119994 4473784 3539322 2746621
| 188847.16 673325.21
| weasel@field:~$ getconf CLK_TCK
| 60


> That will at least tell me if we're getting sensible numbers first.
> Jiffies is calculated by adding the 7 numbers of the cpu line and
> dividing it by the average of the two first number of the uptime.
> On my amd64 it was 102 which is close enough to 100, which is what
> CLK_TCK gives me.

[Is this in any way related to ps showing completely broken timestamps
in the START column?  If not and there isn't a bug report about that
that ought to get filed too.]
-- 
                           |  .''`.  ** Debian GNU/Linux **
      Peter Palfrader      | : :' :      The  universal
 http://www.palfrader.org/ | `. `'      Operating System
                           |   `-    http://www.debian.org/




Information forwarded to debian-bugs-dist@lists.debian.org:
Bug#460331; Package procps. (Thu, 11 Feb 2010 01:48:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Craig Small <csmall@debian.org>:
Extra info received and forwarded to list. (Thu, 11 Feb 2010 01:48:03 GMT) Full text and rfc822 format available.

Message #99 received at 460331@bugs.debian.org (full text, mbox):

From: Craig Small <csmall@debian.org>
To: Peter Palfrader <weasel@debian.org>
Cc: 460331@bugs.debian.org
Subject: Re: Bug#460331: still have this problem on kfreebsd-i386
Date: Thu, 11 Feb 2010 12:44:29 +1100
On Thu, Feb 11, 2010 at 01:48:07AM +0100, Peter Palfrader wrote:
> | weasel@field:~$ cat /proc/uptime ; grep 'cpu ' /proc/stat ; cat /proc/uptime
> | 188847.15 673325.21
> | cpu 119994 4473784 3539322 2746621
> | 188847.16 673325.21
> | weasel@field:~$ getconf CLK_TCK
> | 60
I calculate 57 which is close enough to 60, though not close enough for
procps:
  case   58 ...   61 :  Hertz =   60; break;

However you were getting 45!
On  linux, we just use ELF notes and this problem goes away.  If there
is something equivalent in freeBSD then I could use that as well.

alternatively there is sysconf(_SC_CLK_TCK) which gives a value.

> [Is this in any way related to ps showing completely broken timestamps
> in the START column?  If not and there isn't a bug report about that
> that ought to get filed too.]
That bug was reported in procps but was moved to kfreebsd-7 package
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=344546
It boils down to that the freebsd procfs is incomplete.

 - Craig
-- 
Craig Small      GnuPG:1C1B D893 1418 2AF4 45EE  95CB C76C E5AC 12CA DFA5
http://www.enc.com.au/                             csmall at : enc.com.au
http://www.debian.org/          Debian GNU/Linux, software should be Free 




Information forwarded to debian-bugs-dist@lists.debian.org, Craig Small <csmall@debian.org>:
Bug#460331; Package procps. (Thu, 11 Feb 2010 11:06:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Peter Palfrader <weasel@debian.org>:
Extra info received and forwarded to list. Copy sent to Craig Small <csmall@debian.org>. (Thu, 11 Feb 2010 11:06:03 GMT) Full text and rfc822 format available.

Message #104 received at 460331@bugs.debian.org (full text, mbox):

From: Peter Palfrader <weasel@debian.org>
To: Craig Small <csmall@debian.org>
Cc: 460331@bugs.debian.org, debian-bsd@lists.debian.org
Subject: Re: Bug#460331: still have this problem on kfreebsd-i386
Date: Thu, 11 Feb 2010 12:04:50 +0100
On Thu, 11 Feb 2010, Craig Small wrote:

> On Thu, Feb 11, 2010 at 01:48:07AM +0100, Peter Palfrader wrote:
> > | weasel@field:~$ cat /proc/uptime ; grep 'cpu ' /proc/stat ; cat /proc/uptime
> > | 188847.15 673325.21
> > | cpu 119994 4473784 3539322 2746621
> > | 188847.16 673325.21
> > | weasel@field:~$ getconf CLK_TCK
> > | 60
> I calculate 57 which is close enough to 60, though not close enough for
> procps:
>   case   58 ...   61 :  Hertz =   60; break;
> 
> However you were getting 45!

I've also seen other values like 7, 12, 23, 28, 35, 53.

> On  linux, we just use ELF notes and this problem goes away.  If there
> is something equivalent in freeBSD then I could use that as well.

I wouldn't know, I'm just the poor DSA who gets to fight these machines.  :)
Maybe the debian-bsd list would know.


> > [Is this in any way related to ps showing completely broken timestamps
> > in the START column?  If not and there isn't a bug report about that
> > that ought to get filed too.]
> That bug was reported in procps but was moved to kfreebsd-7 package
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=344546
> It boils down to that the freebsd procfs is incomplete.

Hmm.  Thanks.

-- 
                           |  .''`.  ** Debian GNU/Linux **
      Peter Palfrader      | : :' :      The  universal
 http://www.palfrader.org/ | `. `'      Operating System
                           |   `-    http://www.debian.org/




Information forwarded to debian-bugs-dist@lists.debian.org, Craig Small <csmall@debian.org>:
Bug#460331; Package procps. (Thu, 11 Feb 2010 11:51:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Petr Salinger <Petr.Salinger@seznam.cz>:
Extra info received and forwarded to list. Copy sent to Craig Small <csmall@debian.org>. (Thu, 11 Feb 2010 11:51:03 GMT) Full text and rfc822 format available.

Message #109 received at 460331@bugs.debian.org (full text, mbox):

From: Petr Salinger <Petr.Salinger@seznam.cz>
To: Peter Palfrader <weasel@debian.org>
Cc: 460331@bugs.debian.org, debian-bsd@lists.debian.org
Subject: Re: Bug#460331: still have this problem on kfreebsd-i386
Date: Thu, 11 Feb 2010 14:53:45 +0100 (CET)
>> On  linux, we just use ELF notes and this problem goes away.  If there
>> is something equivalent in freeBSD then I could use that as well.
>
> I wouldn't know, I'm just the poor DSA who gets to fight these machines.  :)
> Maybe the debian-bsd list would know.

The ELF notes are the property of ELF format which is used on both 
platforms. In general, the ELF notes are available on GNU/kFreeBSD.

The kernel supplies them. Each note is a pair of name and value.
The GNU/kFreeBSD kernel does not supply note with name AT_CLKTCK.

On GNU/kFreeBSD:

$ LD_SHOW_AUXV=1 /bin/true
AT_PHDR:         0x400040
AT_PHENT:        56
AT_PHNUM:        8
AT_PAGESZ:       4096
AT_FLAGS:        0x0
AT_ENTRY:        0x400d90
AT_BASE:         0x800604000
AT_PLATFORM:     /bin/true

And on Linux:

$ LD_SHOW_AUXV=1 /bin/true
AT_SYSINFO_EHDR: 0x7ffff636f000
AT_HWCAP:        bfebfbff
AT_PAGESZ:       4096
AT_CLKTCK:       100
AT_PHDR:         0x400040
AT_PHENT:        56
AT_PHNUM:        8
AT_BASE:         0x7ff5b45f6000
AT_FLAGS:        0x0
AT_ENTRY:        0x400d50
AT_UID:          1000
AT_EUID:         1000
AT_GID:          1000
AT_EGID:         1000
AT_SECURE:       0
AT_PLATFORM:     x86_64

In general it might correspond to one of the following 
values
  $ sysctl kern.clockrate
  kern.clockrate: { hz = 1000, tick = 1000, profhz = 2000, stathz = 133 }

In case of /proc file system under GNU/kFreeBSD it seems as constant 100. 
See definition of T2J in
http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/compat/linprocfs/linprocfs.c

>>> [Is this in any way related to ps showing completely broken timestamps
>>> in the START column?
>> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=344546
>> It boils down to that the freebsd procfs is incomplete.
>
> Hmm.  Thanks.

Yes, the linprocfs.c file have to be extended and verified against 
contemporary linux's /proc values.

Petr




Information forwarded to debian-bugs-dist@lists.debian.org:
Bug#460331; Package procps. (Thu, 11 Feb 2010 14:12:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Craig Small <csmall@debian.org>:
Extra info received and forwarded to list. (Thu, 11 Feb 2010 14:12:03 GMT) Full text and rfc822 format available.

Message #114 received at 460331@bugs.debian.org (full text, mbox):

From: Craig Small <csmall@debian.org>
To: Petr Salinger <Petr.Salinger@seznam.cz>, 460331@bugs.debian.org
Cc: Peter Palfrader <weasel@debian.org>, debian-bsd@lists.debian.org
Subject: Re: Bug#460331: still have this problem on kfreebsd-i386
Date: Fri, 12 Feb 2010 01:10:06 +1100
On Thu, Feb 11, 2010 at 02:53:45PM +0100, Petr Salinger wrote:
> The kernel supplies them. Each note is a pair of name and value.
> The GNU/kFreeBSD kernel does not supply note with name AT_CLKTCK.
So that rules out ELF notes.

The old_Hertz_hack appears to be giving widely differing (and wrong)
numbers. To get this value add up the 4 (7 in Linux) numbers on the cpu
line in /proc/stat and divide by the first line in /proc/uptime.
On Linux (now with the 4 to 7 cpu number patch) it's pretty solid across
all arches. On kFreeBSD its wildely out and fluctuates.
So that rules out Hertz hack.

I've also got the sysconf (getconf on the command line) function.
I have heard it is inaccurate at times, I'm not sure how bad it is on
kFreeBSD.

What I'm really trying to find is
 How do you convert between ticks and time on kFreeBSD accurately?

> In general it might correspond to one of the following values
>   $ sysctl kern.clockrate
>   kern.clockrate: { hz = 1000, tick = 1000, profhz = 2000, stathz = 133 }
asdfasdf.debian.net has that same result, getconf says 60 and my
calculation says 99. Which one is correct?

> In case of /proc file system under GNU/kFreeBSD it seems as constant
> 100. See definition of T2J in
> http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/compat/linprocfs/linprocfs.c
100 jiffies = 1 second, that seems quite clear.
stathz ticks = 1 second.

But looking at poor field.debian.org
188847.15 673325.21
cpu 119994 4473784 3539322 2746621

The second number first line is idle seconds, the 4th number is idle
ticks. See linprocfs_dostat() and linprocfs_douptime().
If its relationship is 100 then one is 100 times the other.
It's not, it's about 4 times.

Adding all 4 cpu numbers and dividing by the first number first row
should be 100, I get 57.

So, in short none of these numbers make any sense at all.
I'll retitle this bug because it's now a kFreeBSD specific problem.

 - Craig
-- 
Craig Small      GnuPG:1C1B D893 1418 2AF4 45EE  95CB C76C E5AC 12CA DFA5
http://www.enc.com.au/                             csmall at : enc.com.au
http://www.debian.org/          Debian GNU/Linux, software should be Free 




Changed Bug title to 'Unknown HZ value messages on kfreebsd arch' from 'Unknown HZ value! (94) Assume 100.' Request was from Craig Small <csmall@debian.org> to control@bugs.debian.org. (Thu, 11 Feb 2010 14:15:03 GMT) Full text and rfc822 format available.

Bug Marked as found in versions procps/1:3.2.8-6. Request was from Craig Small <csmall@debian.org> to control@bugs.debian.org. (Thu, 11 Feb 2010 14:15:04 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Craig Small <csmall@debian.org>:
Bug#460331; Package procps. (Thu, 11 Feb 2010 18:21:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Petr Salinger <Petr.Salinger@seznam.cz>:
Extra info received and forwarded to list. Copy sent to Craig Small <csmall@debian.org>. (Thu, 11 Feb 2010 18:21:02 GMT) Full text and rfc822 format available.

Message #123 received at 460331@bugs.debian.org (full text, mbox):

From: Petr Salinger <Petr.Salinger@seznam.cz>
To: 460331@bugs.debian.org
Cc: Peter Palfrader <weasel@debian.org>, debian-bsd@lists.debian.org
Subject: Re: Bug#460331: still have this problem on kfreebsd-i386
Date: Thu, 11 Feb 2010 21:23:02 +0100 (CET)
> But looking at poor field.debian.org
> 188847.15 673325.21
> cpu 119994 4473784 3539322 2746621

> The second number first line is idle seconds, the 4th number is idle
> ticks. See linprocfs_dostat() and linprocfs_douptime().
> If its relationship is 100 then one is 100 times the other.
> It's not, it's about 4 times.

How much cores (CPUs) does field.debian.org have ?
My guess is 4.

(gdb) p  673325 * 133 * 100 / 133
$5 = 2746525

The 32-bit overflow during calculation is responsible
for remaining problem.

The GNU/kFreeBSD internal counters run at 133
(stathz from "sysctl kern.clockrate").
Linux used to use 100, the emulation recalculates the value.

In mean time please use "100" as hardcoded value of HZ for GNU/kFreeBSD.

The long term solution would be to improve linux /proc emulation,
may be drop the recalculation completely and directly use stathz.

Petr










Information forwarded to debian-bugs-dist@lists.debian.org, Craig Small <csmall@debian.org>:
Bug#460331; Package procps. (Thu, 11 Feb 2010 18:27:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Cyril Brulebois <kibi@debian.org>:
Extra info received and forwarded to list. Copy sent to Craig Small <csmall@debian.org>. (Thu, 11 Feb 2010 18:27:03 GMT) Full text and rfc822 format available.

Message #128 received at 460331@bugs.debian.org (full text, mbox):

From: Cyril Brulebois <kibi@debian.org>
To: Petr Salinger <Petr.Salinger@seznam.cz>
Cc: 460331@bugs.debian.org, Peter Palfrader <weasel@debian.org>, debian-bsd@lists.debian.org
Subject: Re: Bug#460331: still have this problem on kfreebsd-i386
Date: Thu, 11 Feb 2010 19:23:07 +0100
[Message part 1 (text/plain, inline)]
Petr Salinger <Petr.Salinger@seznam.cz> (11/02/2010):
> How much cores (CPUs) does field.debian.org have ?
> My guess is 4.

Correct:
,----
| $ ssh field.debian.org grep ^processor /proc/cpuinfo
| processor	: 0
| processor	: 1
| processor	: 2
| processor	: 3
`----

Mraw,
KiBi.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Craig Small <csmall@debian.org>:
Bug#460331; Package procps. (Thu, 11 Feb 2010 18:36:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Peter Palfrader <weasel@debian.org>:
Extra info received and forwarded to list. Copy sent to Craig Small <csmall@debian.org>. (Thu, 11 Feb 2010 18:36:03 GMT) Full text and rfc822 format available.

Message #133 received at 460331@bugs.debian.org (full text, mbox):

From: Peter Palfrader <weasel@debian.org>
To: Cyril Brulebois <kibi@debian.org>
Cc: Petr Salinger <Petr.Salinger@seznam.cz>, 460331@bugs.debian.org, debian-bsd@lists.debian.org
Subject: Re: Bug#460331: still have this problem on kfreebsd-i386
Date: Thu, 11 Feb 2010 19:33:12 +0100
On Thu, 11 Feb 2010, Cyril Brulebois wrote:

> Petr Salinger <Petr.Salinger@seznam.cz> (11/02/2010):
> > How much cores (CPUs) does field.debian.org have ?
> > My guess is 4.
> 
> Correct:
> ,----
> | $ ssh field.debian.org grep ^processor /proc/cpuinfo
> | processor	: 0
> | processor	: 1
> | processor	: 2
> | processor	: 3
> `----

Probably two single-core CPUs times two for hyperthreading.  I don't
think it has 4 cores.

Cheers,
-- 
                           |  .''`.  ** Debian GNU/Linux **
      Peter Palfrader      | : :' :      The  universal
 http://www.palfrader.org/ | `. `'      Operating System
                           |   `-    http://www.debian.org/




Information forwarded to debian-bugs-dist@lists.debian.org:
Bug#460331; Package procps. (Thu, 11 Feb 2010 23:36:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Craig Small <csmall@debian.org>:
Extra info received and forwarded to list. (Thu, 11 Feb 2010 23:36:03 GMT) Full text and rfc822 format available.

Message #138 received at 460331@bugs.debian.org (full text, mbox):

From: Craig Small <csmall@debian.org>
To: 460331@bugs.debian.org, debian-bsd@lists.debian.org
Subject: Re: Bug#460331: still have this problem on kfreebsd-i386
Date: Fri, 12 Feb 2010 10:33:51 +1100
On Thu, Feb 11, 2010 at 09:23:02PM +0100, Petr Salinger wrote:
> The 32-bit overflow during calculation is responsible
> for remaining problem.
That overflow is in the kernel itself then? I'm using bc to do these
calculations and it seems ok with large numbers.  procps itself uses
long longs. May explain why the calculation varies so much.

> In mean time please use "100" as hardcoded value of HZ for GNU/kFreeBSD.
The code can use HZ from /usr/include/asm/param.h This is set at 100
now, as Peter's bug report says (the assume is from HZ):
| weasel@field:~$ uptime
| Unknown HZ value! (45) Assume 100.

The code conditionally (#ifdef __linux__) uses elf notes so around there
I'll put a #ifdef __FreeBSD__ clause and
  a) if HZ is available, use that
  b) make it 100
or can asm/param.h HZ not be trusted?

Thanks everyone for your time, it's cleared up this problem quite
quickly.

 - Craig
-- 
Craig Small      GnuPG:1C1B D893 1418 2AF4 45EE  95CB C76C E5AC 12CA DFA5
http://www.enc.com.au/                             csmall at : enc.com.au
http://www.debian.org/          Debian GNU/Linux, software should be Free 




Information forwarded to debian-bugs-dist@lists.debian.org, Craig Small <csmall@debian.org>:
Bug#460331; Package procps. (Fri, 12 Feb 2010 06:24:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Petr Salinger <Petr.Salinger@seznam.cz>:
Extra info received and forwarded to list. Copy sent to Craig Small <csmall@debian.org>. (Fri, 12 Feb 2010 06:24:03 GMT) Full text and rfc822 format available.

Message #143 received at 460331@bugs.debian.org (full text, mbox):

From: Petr Salinger <Petr.Salinger@seznam.cz>
To: Craig Small <csmall@debian.org>
Cc: 460331@bugs.debian.org
Subject: Re: Bug#460331: still have this problem on kfreebsd-i386
Date: Fri, 12 Feb 2010 09:24:30 +0100 (CET)
>> The 32-bit overflow during calculation is responsible
>> for remaining problem.
> That overflow is in the kernel itself then?

Yes :-( The kernel uses long, i.e on k-i it is only 32 bit.

> The code can use HZ from /usr/include/asm/param.h This is set at 100

This file does not exist on GNU/kFreeBSD.

> now, as Peter's bug report says (the assume is from HZ):
> | weasel@field:~$ uptime
> | Unknown HZ value! (45) Assume 100.
>
> The code conditionally (#ifdef __linux__) uses elf notes so around there
> I'll put a #ifdef __FreeBSD__ clause and
>  a) if HZ is available, use that
>  b) make it 100
> or can asm/param.h HZ not be trusted?

Please hardcode it for now and use

#if defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
  Hertz = 100;
  return;
#endif

But please keep the bug open, blocked by #521304.

Many thanks.

Petr





Bug reassigned from package 'procps' to 'kfreebsd-7'. Request was from Craig Small <csmall@debian.org> to control@bugs.debian.org. (Sat, 13 Feb 2010 12:06:17 GMT) Full text and rfc822 format available.

Bug No longer marked as found in versions procps/1:3.2.8-2, procps/1:3.2.8-6, and procps/1:3.2.7-5. Request was from Craig Small <csmall@debian.org> to control@bugs.debian.org. (Sat, 13 Feb 2010 12:06:17 GMT) Full text and rfc822 format available.

Added indication that 460331 affects procps Request was from Craig Small <csmall@debian.org> to control@bugs.debian.org. (Sat, 13 Feb 2010 12:06:18 GMT) Full text and rfc822 format available.

Reply sent to Debian FTP Masters <ftpmaster@ftp-master.debian.org>:
You have taken responsibility. (Fri, 17 Jun 2011 11:18:57 GMT) Full text and rfc822 format available.

Notification sent to Joey Hess <joeyh@debian.org>:
Bug acknowledged by developer. (Fri, 17 Jun 2011 11:18:58 GMT) Full text and rfc822 format available.

Message #154 received at 460331-done@bugs.debian.org (full text, mbox):

From: Debian FTP Masters <ftpmaster@ftp-master.debian.org>
To: 322197-done@bugs.debian.org,353302-done@bugs.debian.org,357021-done@bugs.debian.org,460331-done@bugs.debian.org,477588-done@bugs.debian.org,550429-done@bugs.debian.org,551702-done@bugs.debian.org,559107-done@bugs.debian.org,593699-done@bugs.debian.org,594287-done@bugs.debian.org,601305-done@bugs.debian.org,
Cc: kfreebsd-7@packages.debian.org, kfreebsd-7@packages.qa.debian.org
Subject: Bug#630694: Removed package(s) from unstable
Date: Fri, 17 Jun 2011 11:15:01 +0000
Version: 7.3-7+rm

Dear submitter,

as the package kfreebsd-7 has just been removed from the Debian archive
unstable we hereby close the associated bug reports.  We are sorry
that we couldn't deal with your issue properly.

For details on the removal, please see http://bugs.debian.org/630694

The version of this package that was in Debian prior to this removal
can still be found using http://snapshot.debian.org/.

This message was generated automatically; if you believe that there is
a problem with it please contact the archive administrators by mailing
ftpmaster@debian.org.

Debian distribution maintenance software
pp.
Alexander Reichle-Schmehl (the ftpmaster behind the curtain)




Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Sat, 16 Jul 2011 07:35:47 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Wed Apr 16 08:17:08 2014; Machine Name: buxtehude.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.