From owner-freebsd-current@FreeBSD.ORG Wed Jul 27 15:00:06 2005 Return-Path: X-Original-To: freebsd-current@FreeBSD.ORG 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 EF57016A41F; Wed, 27 Jul 2005 15:00:05 +0000 (GMT) (envelope-from cracauer@schlepper.zs64.net) Received: from schlepper.zs64.net (schlepper.zs64.net [212.12.50.230]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7823943D4C; Wed, 27 Jul 2005 15:00:05 +0000 (GMT) (envelope-from cracauer@schlepper.zs64.net) Received: from schlepper.zs64.net (schlepper [212.12.50.230]) by schlepper.zs64.net (8.13.1/8.12.9) with ESMTP id j6RF04pm030691; Wed, 27 Jul 2005 17:00:04 +0200 (CEST) (envelope-from cracauer@schlepper.zs64.net) Received: (from cracauer@localhost) by schlepper.zs64.net (8.13.1/8.12.9/Submit) id j6RF044V030690; Wed, 27 Jul 2005 11:00:04 -0400 (EDT) (envelope-from cracauer) Date: Wed, 27 Jul 2005 11:00:04 -0400 From: Martin Cracauer To: Joseph Koshy Message-ID: <20050727110003.A29939@cons.org> References: <20050727035928.4C94716A420@hub.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20050727035928.4C94716A420@hub.freebsd.org>; from jkoshy@FreeBSD.ORG on Wed, Jul 27, 2005 at 03:59:28AM +0000 Cc: freebsd-current@FreeBSD.ORG Subject: Re: PMC (performance counters) problems - kernel panic in 6-beta1 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 27 Jul 2005 15:00:06 -0000 Joseph Koshy wrote on Wed, Jul 27, 2005 at 03:59:28AM +0000: > > > >>>> "mc" == "Martin Cracauer" said: > > mc> In FreeBSD 6-beta1, source of yesterday, on a Pentium-M I get a kernel > mc> panic. > > There are a few changes I need to MFC over still [patch at the end]. The patch fixes the panic and together with the kernel option make pmcstat work. > mc> I tried all values from `pmccontrol -L` (in a loop) and all of them > mc> are always zero (some fail with e.g. "pmcstat: ERROR: Cannot allocate > mc> process-mode pmc with specification > mc> "k8-nb-memory-controller-page-access-event": Invalid argument"). > > Do "system-mode/counting" PMCs work? I.e. using "-s" instead of "-p". They work (without the kernel option). I tried before and thought they didn't work because -s does not print a last report after the process ends and the wait time has never reached. (wings)22% sudo pmcstat -w 1 -s k8-dc-l1-dtlb-miss-and-l2-dtlb-hit -s k8-dc-l1-dtlb-miss-and-l2-dtlb-miss ls /asdlk ls: /asdlk: No such file or directory ~(wings)23% sudo pmcstat -w 1 -p k8-dc-l1-dtlb-miss-and-l2-dtlb-hit -p k8-dc-l1-dtlb-miss-and-l2-dtlb-miss ls /asdlk ls: /asdlk: No such file or directory # p/k8-dc-l1-dtlb-miss-and-l2-dtlb-hit p/k8-dc-l1-dtlb-miss-and-l2-dtlb-miss 0 0 But ~(wings)24% sudo pmcstat -w 1 -s k8-dc-l1-dtlb-miss-and-l2-dtlb-hit -s k8-dc-l1-dtlb-miss-and-l2-dtlb-miss gzip < /dev/zero > /dev/null # s/k8-dc-l1-dtlb-miss-and-l2-dtlb-hit s/k8-dc-l1-dtlb-miss-and-l2-dtlb-miss 213821 30532 213785 17620 213801 20783 ^C So it is just the final count that -s is missing. > mc> machine dmesg, kernel conf, pciconf etc is on: > mc> http://www.cons.org/cracauer/machines/wings/ > > Config option 'HWPMC_HOOKS' seems to be missing from this configuration > file, which might explain the observed behaviour. Ah. I spotted that option in some mailing list archive file but since it didn't appear in GENERIC or NOTES I thought it is the default now. The option fixes -p. Things work now :-) Can you please port this to Linux so that I can use it at work without running a Linux binary on FreeBSD :-)? It's so much more straightforward that the L-equivalent. And has documentation. And is in the base system. > Could you please let me know if the following patch works? The > patch is untested, sorry -- I had to return the borrowed P6 test > box I was using and am still in the process of arranging for a new > one. It fixes the panic and things work now. I would be happy to test whatever you like on that CPU. Another question, what is the difference of -s versus -S and -p versus -P, respectively? Thanks for great work. As suggestions, I think you might want to enter the kernel options into LINT or GENERIC (I don't think there's a real slowdown here so I think GENERIC is appropriate), edit the manpage for pmcstat to explain -s versus -S and -p versus -P and make both -s and -p print a final count (see above), not just -p. Martin -- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Martin Cracauer http://www.cons.org/cracauer/ No warranty. This email is probably produced by one of my cats stepping on the keys. No, I don't have an infinite number of cats.