How to visualize cache misses with pmc

2009-05-25 Thread Nikola Knežević
Hi, During the tuning of my system, I was using pmc(3) to get various counters. Most important was the number of retired instructions, which helped me to discover some bottlenecks. However, I now need to get L2 cache misses, which I do by running: sudo pmcstat -S L2_LD -O /tmp/sample.out

Re: Obtaining l2 misses and cpu utilization in a module

2009-02-19 Thread Nikola Knežević
On 19 Feb 2009, at 12:15 , Joseph Koshy wrote: % pmccontrol -L pmccontrol: Initialization of the pmc(3) library failed: No such file or directory. Did you load hwpmc(4) into the kernel? How can I check that? kldload pmc reports that pmc interface exists in kernel. pmc: Unknown Intel

Obtaining l2 misses and cpu utilization in a module

2009-02-18 Thread Nikola Knežević
Hi, I would like to obtain fore mentioned data from within my module. I need these performance metrics to see how certain code executes, and make decisions during the runtime. pmc(3) seems complete, but it also seems to be intended for use in the userland. How to use pmc from modules? Is

Re: blockable sleep lock (sleep mutex) 16

2009-02-04 Thread Nikola Knežević
On 2 Feb 2009, at 19:09 , Julian Elischer wrote: It says non-sleepable locks, yet it classifies click_instance as sleep mutex. I think witness code should emit messages which are more clear. It is confusing, but you can't do an M_WAITOK malloc while holding a mutex. Basically, sleeping

Re: blockable sleep lock (sleep mutex) 16

2009-02-02 Thread Nikola Knežević
On 30 Jan 2009, at 18:11 , Nikola Knežević wrote: This is the message buffer: Unread portion of the kernel message buffer: panic: blockable sleep lock (sleep mutex) 16 @ /usr/src/sys/vm/ uma_core.c:1834 Any hints where I should search for the cause? Ok, I solved this problem. I had

blockable sleep lock (sleep mutex) 16

2009-01-30 Thread Nikola Knežević
Hi, I'm trying to port Click modular router to FreeBSD 7.1, but with a twist. Instead of letting Click run in netisr (as it used to run in FreeBSD 4), I want to have it running in a kthread. I managed to get it running this way, but when I turn on INVARIANTS and WITNESS (along with

Re: debugging mbuf allocation/dealocation

2008-12-29 Thread Nikola Knežević
You can use the KTR(4) facility to trace memory allocations and deallocations, logging them to memory, disk, etc. Unfortunately interpreting the data can be fairly tricky, as network leaks tend to happen over a long period of time, be stored in sockets, etc, but it's definitely possible

Re: ps not showing CPU# correctly

2008-12-27 Thread Nikola Knežević
On 27 Dec 2008, at 02:30 , Mateusz Guzik wrote: on my system, I noticed that ps(1) is not showing the CPU# correctly (it always displays 0). There was a bug in it, and it was fetching ki_estcpu instead of ki_lastcpu. From the man page: cpushort-term CPU usage factor (for

ps not showing CPU# correctly

2008-12-26 Thread Nikola Knežević
Hi, on my system, I noticed that ps(1) is not showing the CPU# correctly (it always displays 0). There was a bug in it, and it was fetching ki_estcpu instead of ki_lastcpu. The attached patch fixes this issue. Cheers, Nikola ps.patch Description: Binary data

debugging mbuf allocation/dealocation

2008-12-26 Thread Nikola Knežević
Hi, I'm trying to make some code which uses a lot of mbufs (Click modular router) running under FreeBSD 7.1. The problem is that it is leaking mbufs, and I can't find where... After running the Click in a configuration which generates 150k packets (using m_dup) and discards them

Re: How to build kernel module spread on subdirectories?

2008-12-02 Thread Nikola Knežević
On 2 Dec 2008, at 13:33 , Dag-Erling Smørgrav wrote: [EMAIL PROTECTED] writes: heresy Provided the module in question is contemplated for delivery as a port, rather than as part of the base -- so that having a build dependency on a port is tolerable -- perhaps it would be more easily built

Re: How to build kernel module spread on subdirectories?

2008-12-01 Thread Nikola Knežević
On 1 Dec 2008, at 01:22 , Tim Kientzle wrote: .MAKEFILEDEPS: elements.mk .sinclude elements.mk .include bsd.kmod.mk ---8--- When I run make depend, it only includes SRCSs from BSDmakefile, not those from elements.mk. I would try adding a beforedepend requirement: beforedepend: elements.mk

Re: How to build kernel module spread on subdirectories?

2008-11-30 Thread Nikola Knežević
On 30 Nov 2008, at 18:43 , Mel wrote: since there were no replies, I went into the various .mk's, and I found some inconsistencies when building modules. If you have a file in a different directory, below the directory where you BSDmakefile is, objects won't be linked nor cleaned properly. The

Re: How to build kernel module spread on subdirectories?

2008-11-29 Thread Nikola Knežević
On 25 Nov 2008, at 15:20 , Nikola Knežević wrote: I tried to move from OBJS into SRCS (main BSDmakefile now has: SRCS+= $(ELEMENT_SRCS)), by using something like: # subdir0 ELEMENT_SRCS__x =\ subdir1/file0.cc \ subdir1/file1.cc ... But this fails during the linking phase, because the linker

How to build kernel module spread on subdirectories?

2008-11-25 Thread Nikola Knežević
Hi, I'm playing with the Click Modular router on my FreeBSD box. Out of curiosity, I decided to switch its GNU makefile to BSD style. I managed to do it, but I would like to polish it a bit more (and learn some things along). Old GNUmakefile relies heavily on OBJS and *_OBJS, as it fills

kldload: unexpected relocation type 10

2008-09-01 Thread Nikola Knežević
Hi guys, I'm trying to do something unusual - to build my own module, mixed with the Click (Modular Router). In order to do so, I had to write a Makefile which borrows a lot from Click's Makefile. Like all other kernel modules, I include bsd.kmod.ko, but I'm modifying CFLAGS (with +=),