Re: PMC (performance counters) problems - kernel panic in 6-beta1

From: Martin Cracauer <cracauer_at_cons.org>
Date: Wed, 27 Jul 2005 11:00:04 -0400
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 <cracauer_at_cons.org>   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.
Received on Wed Jul 27 2005 - 13:00:06 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:39 UTC