On Thu, Nov 13, 2008 at 5:25 AM, Rich Smrcina <rsmrcina at wi.rr.com> wrote:
You posted this last night:
Memory Used Total Percentage Physical 4294963639M 4294966523M 0% Swap 0M 4098M 0%
I said that was from hobbit, not from NetBSD. It's from the hobbit display page which I assume is generated from the "client data" information it has received, which is why I later included the "meminfo" information from the client data, which is generated by the hobbit client. The only thing directly generated by NetBSD that I've included was the "sysctl -a|grep physmem" information.
It appears that Hobbit is reading the 'physical' line, therefore causing the negative value in meminfo. If you have 4G of memory on your machine, the value is clearly wrong, so the error is in netbsd. Changing the Hobbit code isn't fixing the problem, it just makes the value more readable... :) Hobbit will still reflect a wrong memory value.
Was I wrong to assume that the hobbit display page (bb-hostsvc.sh?HOST=hostname&SERVICE=memory) is generated from the information the "client data" link on that page shows me, by hobbit? My assumption was that the meminfo section of the client data page was generated directly by the meminfo-netbsd.c program, since the printfs seem to match. If that's the path the data takes, I still don't see how this is a bug in NetBSD.
I also don't see how hobbit's meminfo-netbsd.c can be correct if it's putting physmem in an int, when physmem is more than 2GB. The sysctl -a output below I previously sent is correct. If a signed int is being used, hw.physmem (= -537526272) has the proper bit pattern. physmem is defined as an int in meminfo-netbsd.c. It is likely that netbsd-meminfo.c should be using unsigned longs instead, or at least unsigned int. The freebsd-meminfo.c uses an unsigned long, which made sense for me to use in meminfo-netbsd.c, and at that point, meminfo-netbsd.c could probably use hw.physmem64 instead of hw.physmem.
-Tracy
Tracy Di Marco White wrote:
On Wed, Nov 12, 2008 at 10:43 PM, Rich Smrcina <rsmrcina at wi.rr.com> wrote:
It looks like the problem is this, then?
sysctl -a|grep physmem
hw.physmem = -537526272 hw.physmem64 = 3757441024
But if hobbit is using a signed int, which it does seem to be here, I don't see how hobbit could get it anything but wrong when there's more than 2 GB of RAM. Given this code, that's my understanding: 25 int physmem; 67 printf("Total:%d\n", (physmem / (1024 * 1024)));
So is this also a bug in FreeBSD, as they are also using an unsigned long, for this and for pagesize?
Could you help me understand why you say this is a bug in NetBSD?