NetBSD Problem Report #10095

Received: (qmail 7283 invoked from network); 11 May 2000 03:18:10 -0000
Message-Id: <200005110318.VAA26265@amiga2.msu.montana.edu>
Date: Wed, 10 May 2000 21:18:08 -0600 (MDT)
From: mhitch@montana.edu
Reply-To: mhitch@montana.edu
To: gnats-bugs@gnats.netbsd.org
Subject: systat vmstat displays invalid data on long-running 64-bit systems
X-Send-Pr-Version: 3.95

>Number:         10095
>Category:       bin
>Synopsis:       systat vmstat display invalid data on long-running 64-bit systems
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu May 11 03:19:00 +0000 2000
>Closed-Date:    Sat Aug 30 12:58:17 +0000 2003
>Last-Modified:  Sat Aug 30 12:58:17 +0000 2003
>Originator:     Michael L. Hitch
>Release:        20000506
>Organization:
	Montana State University
>Environment:

System: NetBSD alpha.msu.montana.edu 1.4W NetBSD 1.4W (PC164) #17: Tue Apr 11 18:36:05 MDT 2000 mhitch@alpha.msu.montana.edu:/usr/cvsroot/src/sys/arch/alpha/compile/PC164 alpha


>Description:
	After a 64-bit system such as an Alpha has been running for a time
	sufficient to cause some counters to exceed 31 bits, the systat vmstat
	display begins displaying bogus data.  This is caused by the use of
	a 32 bit variable as a temporary when computing the change since the
	previous display for a number of items (interrupt counters and time
	in the cpu states for specific examples).  The variable is named t,
	and is defined as a time_t.

	There is also another potential for loss in the copyinfo() procedure
	caused by using sizeof(int) for computing the size of an array of
	long items.  It did not cause a problem on my AlphaPC 164 because the
	number of items in the interrupt count array is sufficiently larger
	than the highest active interrupt.
>How-To-Repeat:
	Run an Alpha system for several weeks with high network and disk
	activity.  Wonder why the system shows a constant 512 interrupts
	per second for both Ethernet interfaces, and a constant 50% system
	time, and no disk transfers when it's very obvious the disk is
	quite busy.
>Fix:
	This patch will define a different local variable for t (the variable
	used to calculate the value differences) as a long variable instead
	of a time_t.  The patch also uses sizeof(long) instead of sizeof(int)
	in copyinfo() when copying the array of interrupt counts.

	It might be better to use a different variable name than t in the
	macros used to calculate the display values to remove confusion
	with the static variable t.

--- /opt/src/usr.bin/systat/vmstat.c	Sat Jan 22 05:46:43 2000
+++ ./vmstat.c	Wed May 10 20:45:17 2000
@@ -349,6 +349,7 @@
 	int psiz, inttotal;
 	int i, l, c;
 	static int failcnt = 0;
+	long t;

 	if (state == TIME)
 		dkswap();
@@ -647,7 +648,7 @@

 	intrcnt = to->intrcnt;
 	*to = *from;
-	memmove(to->intrcnt = intrcnt, from->intrcnt, nintr * sizeof (int));
+	memmove(to->intrcnt = intrcnt, from->intrcnt, nintr * sizeof (long));
 }

 static void
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: dsl 
State-Changed-When: Sat Aug 30 12:57:21 UTC 2003 
State-Changed-Why:  
't' was changed to uint64_t in rev 1.25 
I've just fixed the memmove in rev 1.53 
>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.