From owner-freebsd-small Fri Jul 3 07:44:30 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id HAA07833 for freebsd-small-outgoing; Fri, 3 Jul 1998 07:44:30 -0700 (PDT) (envelope-from owner-freebsd-small@FreeBSD.ORG) Received: from antipodes.cdrom.com (castles221.castles.com [208.214.165.221]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id HAA07828 for ; Fri, 3 Jul 1998 07:44:27 -0700 (PDT) (envelope-from mike@antipodes.cdrom.com) Received: from antipodes.cdrom.com (localhost [127.0.0.1]) by antipodes.cdrom.com (8.8.8/8.8.5) with ESMTP id WAA04364; Thu, 2 Jul 1998 22:36:23 -0700 (PDT) Message-Id: <199807030536.WAA04364@antipodes.cdrom.com> X-Mailer: exmh version 2.0zeta 7/24/97 To: "Jasmine(Yongqi) Wang" cc: freebsd-small@FreeBSD.ORG Subject: Re: (no subject) In-reply-to: Your message of "Wed, 01 Jul 1998 13:55:12 PDT." <359AA230.A5D@cs.ubc.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 02 Jul 1998 22:36:22 -0700 From: Mike Smith Sender: owner-freebsd-small@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > HI, there, > > I need to run some test to get an idea of TLB miss rate. I have found > out that there is performance monitor counter in Pentium processors. I > will run it on Pentium Pro. > > There are 4 MSRs, two for performance event select and two for counting. > also there is RDMSR, WRMSR and RDPMC to use. so in my case the event > type should be TLB miss and TLB hit. > > It's said the way it will work is to > 1. set up PerfEvtSel0/1 with wrmsr > 2. counter will start if 1 succeed and counter is enabled in above > instruction. > > my questions are: > RDMSR and WRMSR are only usable in Kernel mode, so should I make a small > kernel or is there alternatives? You haven't really been clear enough here. Are you trying to evaluate TLB miss rates for a single process, or for the entire system? If for just a single process, what do you plan to do to deal with the errors introduced by interrupts and scheduling? > when get the result back I can use RDPMC, if CR4[PCE]=1, i can get it in > user mode; otherwise I can only run in kernel too. but i can't find any > instruction to read CR4. There are instructions for CR0, CR2 and CR3, or > I am missing sth. here? It would be trivial to add a sysctl variable to obtain the value from userland, should you wish to do so, as the handler runs in the kernel. AFAIK, you can simply modify the support functions for the other CR registers, eg. in sys/i386/i386/support.s: /* rcr4() */ ENTRY(rcr4) movl %cr4,%eax ret -- \\ Sometimes you're ahead, \\ Mike Smith \\ sometimes you're behind. \\ mike@smith.net.au \\ The race is long, and in the \\ msmith@freebsd.org \\ end it's only with yourself. \\ msmith@cdrom.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-small" in the body of the message