From owner-freebsd-current@FreeBSD.ORG Tue Jun 3 13:10:04 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 51BE737B401 for ; Tue, 3 Jun 2003 13:10:04 -0700 (PDT) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id F1E9A43F3F for ; Tue, 3 Jun 2003 13:10:02 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from katana.zip.com.au (katana.zip.com.au [61.8.7.246]) by mailman.zeta.org.au (8.9.3p2/8.8.7) with ESMTP id GAA10951; Wed, 4 Jun 2003 06:09:42 +1000 Date: Wed, 4 Jun 2003 06:09:41 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Pete Fritchman In-Reply-To: <20030603190113.GA42673@absolutbsd.org> Message-ID: <20030604054926.T20844@gamplex.bde.org> References: <000001c32a00$a3e227e0$4116f00a@corona> <20030603190113.GA42673@absolutbsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: Pawel Worach cc: current@freebsd.org Subject: Re: vmstat -s broken X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jun 2003 20:10:04 -0000 On Tue, 3 Jun 2003, Pete Fritchman wrote: > ++ 03/06/03 20:47 +0200 - Pawel Worach: > | I don't know for how long this has been broken but vmstat > | always reports 0 (zero) for the number of system calls > | executed which is virtually impossible. > | > | This is on a system built > | FreeBSD darkstar 5.1-CURRENT FreeBSD 5.1-CURRENT #1: Tue Jun 3 02:48:51 > | CEST 2003 > | > | darkstar# vmstat -s | grep "system calls" > | > | 0 system calls > | darkstar# uptime > > FWIW, I also see this behaviour on -current built Feb 13th: > > knap.sac(/home/sac1/petef) [258] > vmstat -s | grep system.calls > 0 system calls > knap.sac(/home/sac1/petef) [259] > uname -a > FreeBSD knap.sac.fedex.com 5.0-CURRENT FreeBSD 5.0-CURRENT #0: > Thu Feb 13 16:26:14 CST 2003 > root@knap.sac.fedex.com:/usr/obj/usr/src/sys/SAC-DELL240-5 i386 > knap.sac(/home/sac1/petef) [260] > Rev.1.67 of vm/vm_meter.c unbroke the sysctl that returns the number of syscalls, but vmstat(1) accesses cnt.v_syscalls in kmem so it is still broken. systat(1) uses the sysctl so it was unbroken. Using the sysctl updates cnt.v_syscall, but programs that read it from kmem see a stale value (the one made by the last call to the sysctl). I use a different fix which restores the previous code for the SMP case. The SMP case remains broken: the count is stored in per-CPU data (in all cases in -current but only in the SMP case in my version) so that updating it doesn't require locking or expensive atomic operations. Thus there is never any up to date copy of the full count, and programs that access it in kmem need to know how to assemble it. None do. Bruce