From owner-freebsd-mips@FreeBSD.ORG Mon Apr 23 06:44:13 2012 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BA3C5106564A; Mon, 23 Apr 2012 06:44:13 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id 7564C8FC17; Mon, 23 Apr 2012 06:44:13 +0000 (UTC) Received: by pbcwz17 with SMTP id wz17so3508430pbc.13 for ; Sun, 22 Apr 2012 23:44:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=6tFAuzL0rAjmI9DeLNDUSCMkSJUKInawARvehYCcK7I=; b=L364W86yqTer9OO8E0zYdHDFkF2p25aF6O4fPRY1q/XlKUlehu/LL3MRqCfoyY1rus GLRJA3HOE9oO7bsDYTLCNyh6vC0IYX0RbNwDPOdsd0TxQb3EFEdHHnlRsRSIv/0oVgKZ 9gSrkEKynEmxfGaLxDhLyKvFVrmMwC4acpvdLB8CWk2RGM3imoZXAqddX3YodUIQB8bq qe3SqM/nPtS9YdL68spm/+FGxxfuBjW+kwrqgeq9/1sC4PFTDw/GJ6lO+IWanM8K1mz/ whTytkD/hdlI1Lz936p3RpPSJR66Ib+Lrz/gzRIBE1uIZQK4vrBZ8GtdsJBrnA/zHyAb uL/w== MIME-Version: 1.0 Received: by 10.68.227.169 with SMTP id sb9mr15111833pbc.157.1335163453047; Sun, 22 Apr 2012 23:44:13 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.142.101.9 with HTTP; Sun, 22 Apr 2012 23:44:12 -0700 (PDT) In-Reply-To: <201203282058.q2SKwVsJ053900@svn.freebsd.org> References: <201203282058.q2SKwVsJ053900@svn.freebsd.org> Date: Sun, 22 Apr 2012 23:44:12 -0700 X-Google-Sender-Auth: O8xcBAcSPhNdovKe3gsfvvu5GIA Message-ID: From: Adrian Chadd To: Fabien Thomas , monthadar@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-current , freebsd-mips@freebsd.org Subject: Re: svn commit: r233628 - in head: lib/libpmc sys/amd64/amd64 sys/amd64/include sys/arm/include sys/conf sys/dev/hwpmc sys/i386/i386 sys/i386/include sys/kern sys/mips/include sys/modules/hwpmc sys/pow... X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Apr 2012 06:44:13 -0000 Hi Fabien, I've heard some rumours that this broke hwpmc support for mips24k. Monthadar, can you please provide some background info for this? Thanks, adrian On 28 March 2012 13:58, Fabien Thomas wrote: > Author: fabient > Date: Wed Mar 28 20:58:30 2012 > New Revision: 233628 > URL: http://svn.freebsd.org/changeset/base/233628 > > Log: > =A0Add software PMC support. > > =A0New kernel events can be added at various location for sampling or cou= nting. > =A0This will for example allow easy system profiling whatever the process= or is > =A0with known tools like pmcstat(8). > > =A0Simultaneous usage of software PMC and hardware PMC is possible, for e= xample > =A0looking at the lock acquire failure, page fault while sampling on > =A0instructions. > > =A0Sponsored by: NETASQ > =A0MFC after: =A0 =A01 month > > Added: > =A0head/lib/libpmc/pmc.soft.3 =A0 (contents, props changed) > =A0head/sys/dev/hwpmc/hwpmc_soft.c =A0 (contents, props changed) > =A0head/sys/dev/hwpmc/hwpmc_soft.h =A0 (contents, props changed) > Modified: > =A0head/lib/libpmc/Makefile > =A0head/lib/libpmc/libpmc.c > =A0head/lib/libpmc/pmc.3 > =A0head/lib/libpmc/pmc.atom.3 > =A0head/lib/libpmc/pmc.core.3 > =A0head/lib/libpmc/pmc.core2.3 > =A0head/lib/libpmc/pmc.corei7.3 > =A0head/lib/libpmc/pmc.corei7uc.3 > =A0head/lib/libpmc/pmc.iaf.3 > =A0head/lib/libpmc/pmc.k7.3 > =A0head/lib/libpmc/pmc.k8.3 > =A0head/lib/libpmc/pmc.mips24k.3 > =A0head/lib/libpmc/pmc.octeon.3 > =A0head/lib/libpmc/pmc.p4.3 > =A0head/lib/libpmc/pmc.p5.3 > =A0head/lib/libpmc/pmc.p6.3 > =A0head/lib/libpmc/pmc.sandybridge.3 > =A0head/lib/libpmc/pmc.sandybridgeuc.3 > =A0head/lib/libpmc/pmc.tsc.3 > =A0head/lib/libpmc/pmc.ucf.3 > =A0head/lib/libpmc/pmc.westmere.3 > =A0head/lib/libpmc/pmc.westmereuc.3 > =A0head/lib/libpmc/pmc.xscale.3 > =A0head/lib/libpmc/pmclog.c > =A0head/lib/libpmc/pmclog.h > =A0head/sys/amd64/amd64/trap.c > =A0head/sys/amd64/include/pmc_mdep.h > =A0head/sys/arm/include/pmc_mdep.h > =A0head/sys/conf/files > =A0head/sys/dev/hwpmc/hwpmc_amd.c > =A0head/sys/dev/hwpmc/hwpmc_core.c > =A0head/sys/dev/hwpmc/hwpmc_intel.c > =A0head/sys/dev/hwpmc/hwpmc_logging.c > =A0head/sys/dev/hwpmc/hwpmc_mips.c > =A0head/sys/dev/hwpmc/hwpmc_mod.c > =A0head/sys/dev/hwpmc/hwpmc_piv.c > =A0head/sys/dev/hwpmc/hwpmc_powerpc.c > =A0head/sys/dev/hwpmc/hwpmc_ppro.c > =A0head/sys/dev/hwpmc/hwpmc_tsc.c > =A0head/sys/dev/hwpmc/hwpmc_x86.c > =A0head/sys/dev/hwpmc/hwpmc_xscale.c > =A0head/sys/dev/hwpmc/pmc_events.h > =A0head/sys/i386/i386/trap.c > =A0head/sys/i386/include/pmc_mdep.h > =A0head/sys/kern/kern_clock.c > =A0head/sys/kern/kern_lock.c > =A0head/sys/kern/kern_mutex.c > =A0head/sys/kern/kern_pmc.c > =A0head/sys/kern/kern_rwlock.c > =A0head/sys/kern/kern_sx.c > =A0head/sys/kern/subr_trap.c > =A0head/sys/mips/include/pmc_mdep.h > =A0head/sys/modules/hwpmc/Makefile > =A0head/sys/powerpc/include/pmc_mdep.h > =A0head/sys/sys/pmc.h > =A0head/sys/sys/pmckern.h > =A0head/sys/sys/pmclog.h > =A0head/usr.sbin/pmcstat/pmcstat_log.c > > Modified: head/lib/libpmc/Makefile > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libpmc/Makefile =A0 =A0Wed Mar 28 20:49:11 2012 =A0 =A0 =A0 = =A0(r233627) > +++ head/lib/libpmc/Makefile =A0 =A0Wed Mar 28 20:58:30 2012 =A0 =A0 =A0 = =A0(r233628) > @@ -20,6 +20,7 @@ MAN+=3D pmc_read.3 > =A0MAN+=3D =A0pmc_set.3 > =A0MAN+=3D =A0pmc_start.3 > =A0MAN+=3D =A0pmclog.3 > +MAN+=3D =A0pmc.soft.3 > > =A0# PMC-dependent manual pages > =A0.if ${MACHINE_CPUARCH} =3D=3D "i386" || ${MACHINE_CPUARCH} =3D=3D "amd= 64" > > Modified: head/lib/libpmc/libpmc.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libpmc/libpmc.c =A0 =A0Wed Mar 28 20:49:11 2012 =A0 =A0 =A0 = =A0(r233627) > +++ head/lib/libpmc/libpmc.c =A0 =A0Wed Mar 28 20:58:30 2012 =A0 =A0 =A0 = =A0(r233628) > @@ -77,11 +77,12 @@ static int tsc_allocate_pmc(enum pmc_eve > =A0static int xscale_allocate_pmc(enum pmc_event _pe, char *_ctrspec, > =A0 =A0 struct pmc_op_pmcallocate *_pmc_config); > =A0#endif > - > =A0#if defined(__mips__) > =A0static int mips_allocate_pmc(enum pmc_event _pe, char* ctrspec, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 struct pmc_op_pmc= allocate *_pmc_config); > =A0#endif /* __mips__ */ > +static int soft_allocate_pmc(enum pmc_event _pe, char *_ctrspec, > + =A0 =A0struct pmc_op_pmcallocate *_pmc_config); > > =A0#if defined(__powerpc__) > =A0static int ppc7450_allocate_pmc(enum pmc_event _pe, char* ctrspec, > @@ -156,6 +157,8 @@ PMC_CLASSDEP_TABLE(octeon, OCTEON); > =A0PMC_CLASSDEP_TABLE(ucf, UCF); > =A0PMC_CLASSDEP_TABLE(ppc7450, PPC7450); > > +static struct pmc_event_descr soft_event_table[PMC_EV_DYN_COUNT]; > + > =A0#undef __PMC_EV_ALIAS > =A0#define =A0 =A0 =A0 =A0__PMC_EV_ALIAS(N,CODE) =A0{ N, PMC_EV_##CODE }, > > @@ -215,21 +218,22 @@ static const struct pmc_event_descr west > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0PMC_CLASS_##C, __VA_ARGS__ =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0\ > =A0 =A0 =A0 =A0} > > -PMC_MDEP_TABLE(atom, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC); > -PMC_MDEP_TABLE(core, IAP, PMC_CLASS_TSC); > -PMC_MDEP_TABLE(core2, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC); > -PMC_MDEP_TABLE(corei7, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF,= PMC_CLASS_UCP); > -PMC_MDEP_TABLE(sandybridge, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS= _UCF, PMC_CLASS_UCP); > -PMC_MDEP_TABLE(westmere, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UC= F, PMC_CLASS_UCP); > -PMC_MDEP_TABLE(k7, K7, PMC_CLASS_TSC); > -PMC_MDEP_TABLE(k8, K8, PMC_CLASS_TSC); > -PMC_MDEP_TABLE(p4, P4, PMC_CLASS_TSC); > -PMC_MDEP_TABLE(p5, P5, PMC_CLASS_TSC); > -PMC_MDEP_TABLE(p6, P6, PMC_CLASS_TSC); > -PMC_MDEP_TABLE(xscale, XSCALE, PMC_CLASS_XSCALE); > -PMC_MDEP_TABLE(mips24k, MIPS24K, PMC_CLASS_MIPS24K); > -PMC_MDEP_TABLE(octeon, OCTEON, PMC_CLASS_OCTEON); > -PMC_MDEP_TABLE(ppc7450, PPC7450, PMC_CLASS_PPC7450); > +PMC_MDEP_TABLE(atom, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC); > +PMC_MDEP_TABLE(core, IAP, PMC_CLASS_SOFT, PMC_CLASS_TSC); > +PMC_MDEP_TABLE(core2, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC)= ; > +PMC_MDEP_TABLE(corei7, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC= , PMC_CLASS_UCF, PMC_CLASS_UCP); > +PMC_MDEP_TABLE(sandybridge, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLAS= S_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); > +PMC_MDEP_TABLE(westmere, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_T= SC, PMC_CLASS_UCF, PMC_CLASS_UCP); > +PMC_MDEP_TABLE(k7, K7, PMC_CLASS_SOFT, PMC_CLASS_TSC); > +PMC_MDEP_TABLE(k8, K8, PMC_CLASS_SOFT, PMC_CLASS_TSC); > +PMC_MDEP_TABLE(p4, P4, PMC_CLASS_SOFT, PMC_CLASS_TSC); > +PMC_MDEP_TABLE(p5, P5, PMC_CLASS_SOFT, PMC_CLASS_TSC); > +PMC_MDEP_TABLE(p6, P6, PMC_CLASS_SOFT, PMC_CLASS_TSC); > +PMC_MDEP_TABLE(xscale, XSCALE, PMC_CLASS_SOFT, PMC_CLASS_XSCALE); > +PMC_MDEP_TABLE(mips24k, MIPS24K, PMC_CLASS_SOFT, PMC_CLASS_MIPS24K); > +PMC_MDEP_TABLE(octeon, OCTEON, PMC_CLASS_SOFT, PMC_CLASS_OCTEON); > +PMC_MDEP_TABLE(ppc7450, PPC7450, PMC_CLASS_SOFT, PMC_CLASS_PPC7450); > +PMC_MDEP_TABLE(generic, SOFT, PMC_CLASS_SOFT); > > =A0static const struct pmc_event_descr tsc_event_table[] =3D > =A0{ > @@ -279,16 +283,24 @@ PMC_CLASS_TABLE_DESC(tsc, TSC, tsc, tsc) > =A0#if =A0 =A0defined(__XSCALE__) > =A0PMC_CLASS_TABLE_DESC(xscale, XSCALE, xscale, xscale); > =A0#endif > - > =A0#if defined(__mips__) > =A0PMC_CLASS_TABLE_DESC(mips24k, MIPS24K, mips24k, mips); > =A0PMC_CLASS_TABLE_DESC(octeon, OCTEON, octeon, mips); > =A0#endif /* __mips__ */ > - > =A0#if defined(__powerpc__) > =A0PMC_CLASS_TABLE_DESC(ppc7450, PPC7450, ppc7450, ppc7450); > =A0#endif > > +static struct pmc_class_descr soft_class_table_descr =3D > +{ > + =A0 =A0 =A0 .pm_evc_name =A0=3D "SOFT-", > + =A0 =A0 =A0 .pm_evc_name_size =3D sizeof("SOFT-") - 1, > + =A0 =A0 =A0 .pm_evc_class =3D PMC_CLASS_SOFT, > + =A0 =A0 =A0 .pm_evc_event_table =3D NULL, > + =A0 =A0 =A0 .pm_evc_event_table_size =3D 0, > + =A0 =A0 =A0 .pm_evc_allocate_pmc =3D soft_allocate_pmc > +}; > + > =A0#undef PMC_CLASS_TABLE_DESC > > =A0static const struct pmc_class_descr **pmc_class_table; > @@ -343,9 +355,12 @@ static const char * pmc_state_names[] =3D > =A0 =A0 =A0 =A0__PMC_STATES() > =A0}; > > -static int pmc_syscall =3D -1; =A0 =A0 =A0 =A0 =A0 /* filled in by pmc_i= nit() */ > - > -static struct pmc_cpuinfo cpu_info; =A0 =A0/* filled in by pmc_init() */ > +/* > + * Filled in by pmc_init(). > + */ > +static int pmc_syscall =3D -1; > +static struct pmc_cpuinfo cpu_info; > +static struct pmc_op_getdyneventinfo soft_event_info; > > =A0/* Event masks for events */ > =A0struct pmc_masks { > @@ -2179,6 +2194,25 @@ tsc_allocate_pmc(enum pmc_event pe, char > =A0} > =A0#endif > > +static struct pmc_event_alias generic_aliases[] =3D { > + =A0 =A0 =A0 EV_ALIAS("instructions", =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"SO= FT-CLOCK.HARD"), > + =A0 =A0 =A0 EV_ALIAS(NULL, NULL) > +}; > + > +static int > +soft_allocate_pmc(enum pmc_event pe, char *ctrspec, > + =A0 =A0struct pmc_op_pmcallocate *pmc_config) > +{ > + =A0 =A0 =A0 (void)ctrspec; > + =A0 =A0 =A0 (void)pmc_config; > + > + =A0 =A0 =A0 if (pe < PMC_EV_SOFT_FIRST || pe > PMC_EV_SOFT_LAST) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (-1); > + > + =A0 =A0 =A0 pmc_config->pm_caps |=3D (PMC_CAP_READ | PMC_CAP_WRITE); > + =A0 =A0 =A0 return (0); > +} > + > =A0#if =A0 =A0defined(__XSCALE__) > > =A0static struct pmc_event_alias xscale_aliases[] =3D { > @@ -2663,6 +2697,10 @@ pmc_event_names_of_class(enum pmc_class > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ev =3D ppc7450_event_table; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0count =3D PMC_EVENT_TABLE_SIZE(ppc7450); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0break; > + =A0 =A0 =A0 case PMC_CLASS_SOFT: > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ev =3D soft_event_table; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 count =3D soft_event_info.pm_nevent; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; > =A0 =A0 =A0 =A0default: > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0errno =3D EINVAL; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return (-1); > @@ -2676,6 +2714,7 @@ pmc_event_names_of_class(enum pmc_class > > =A0 =A0 =A0 =A0for (;count--; ev++, names++) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*names =3D ev->pm_ev_name; > + > =A0 =A0 =A0 =A0return (0); > =A0} > > @@ -2780,11 +2819,34 @@ pmc_init(void) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0pmc_class_table[n] =3D NULL; > > =A0 =A0 =A0 =A0/* > + =A0 =A0 =A0 =A0* Get soft events list. > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 soft_event_info.pm_class =3D PMC_CLASS_SOFT; > + =A0 =A0 =A0 if (PMC_CALL(GETDYNEVENTINFO, &soft_event_info) < 0) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (pmc_syscall =3D -1); > + > + =A0 =A0 =A0 /* Map soft events to static list. */ > + =A0 =A0 =A0 for (n =3D 0; n < soft_event_info.pm_nevent; n++) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 soft_event_table[n].pm_ev_name =3D > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 soft_event_info.pm_events[n].pm_ev_= name; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 soft_event_table[n].pm_ev_code =3D > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 soft_event_info.pm_events[n].pm_ev_= code; > + =A0 =A0 =A0 } > + =A0 =A0 =A0 soft_class_table_descr.pm_evc_event_table_size =3D \ > + =A0 =A0 =A0 =A0 =A0 soft_event_info.pm_nevent; > + =A0 =A0 =A0 soft_class_table_descr.pm_evc_event_table =3D \ > + =A0 =A0 =A0 =A0 =A0 soft_event_table; > + > + =A0 =A0 =A0 /* > =A0 =A0 =A0 =A0 * Fill in the class table. > =A0 =A0 =A0 =A0 */ > =A0 =A0 =A0 =A0n =3D 0; > + > + =A0 =A0 =A0 /* Fill soft events information. */ > + =A0 =A0 =A0 pmc_class_table[n++] =3D &soft_class_table_descr; > =A0#if defined(__amd64__) || defined(__i386__) > - =A0 =A0 =A0 pmc_class_table[n++] =3D &tsc_class_table_descr; > + =A0 =A0 =A0 if (cpu_info.pm_cputype !=3D PMC_CPU_GENERIC) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 pmc_class_table[n++] =3D &tsc_class_table_d= escr; > > =A0 =A0 =A0 =A0/* > =A0 =A0 =A0 =A0 * Check if this CPU has fixed function counters. > @@ -2867,6 +2929,9 @@ pmc_init(void) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0pmc_class_table[n] =3D &p4_class_table_des= cr; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0break; > =A0#endif > + =A0 =A0 =A0 case PMC_CPU_GENERIC: > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 PMC_MDEP_INIT(generic); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; > =A0#if defined(__XSCALE__) > =A0 =A0 =A0 =A0case PMC_CPU_INTEL_XSCALE: > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0PMC_MDEP_INIT(xscale); > @@ -3035,18 +3100,19 @@ _pmc_name_of_event(enum pmc_event pe, en > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0evfence =3D xscale_event_table + PMC_EVENT= _TABLE_SIZE(xscale); > =A0 =A0 =A0 =A0} else if (pe >=3D PMC_EV_MIPS24K_FIRST && pe <=3D PMC_EV_= MIPS24K_LAST) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ev =3D mips24k_event_table; > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 evfence =3D mips24k_event_table + PMC_EVENT= _TABLE_SIZE(mips24k > -); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 evfence =3D mips24k_event_table + PMC_EVENT= _TABLE_SIZE(mips24k); > =A0 =A0 =A0 =A0} else if (pe >=3D PMC_EV_OCTEON_FIRST && pe <=3D PMC_EV_O= CTEON_LAST) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ev =3D octeon_event_table; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0evfence =3D octeon_event_table + PMC_EVENT= _TABLE_SIZE(octeon); > =A0 =A0 =A0 =A0} else if (pe >=3D PMC_EV_PPC7450_FIRST && pe <=3D PMC_EV_= PPC7450_LAST) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ev =3D ppc7450_event_table; > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 evfence =3D ppc7450_event_table + PMC_EVENT= _TABLE_SIZE(ppc7450 > -); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 evfence =3D ppc7450_event_table + PMC_EVENT= _TABLE_SIZE(ppc7450); > =A0 =A0 =A0 =A0} else if (pe =3D=3D PMC_EV_TSC_TSC) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ev =3D tsc_event_table; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0evfence =3D tsc_event_table + PMC_EVENT_TA= BLE_SIZE(tsc); > + =A0 =A0 =A0 } else if (pe >=3D PMC_EV_SOFT_FIRST && pe <=3D PMC_EV_SOFT= _LAST) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ev =3D soft_event_table; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 evfence =3D soft_event_table + soft_event_i= nfo.pm_nevent; > =A0 =A0 =A0 =A0} > > =A0 =A0 =A0 =A0for (; ev !=3D evfence; ev++) > > Modified: head/lib/libpmc/pmc.3 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libpmc/pmc.3 =A0 =A0 =A0 Wed Mar 28 20:49:11 2012 =A0 =A0 = =A0 =A0(r233627) > +++ head/lib/libpmc/pmc.3 =A0 =A0 =A0 Wed Mar 28 20:58:30 2012 =A0 =A0 = =A0 =A0(r233628) > @@ -223,6 +223,8 @@ and > =A0CPUs. > =A0.It Li PMC_CLASS_TSC > =A0The timestamp counter on i386 and amd64 architecture CPUs. > +.It Li PMC_CLASS_SOFT > +Software events. > =A0.El > =A0.Ss PMC Capabilities > =A0Capabilities of performance monitoring hardware are denoted using > @@ -525,6 +527,7 @@ API is > =A0.Xr pmc.p4 3 , > =A0.Xr pmc.p5 3 , > =A0.Xr pmc.p6 3 , > +.Xr pmc.soft 3 , > =A0.Xr pmc.tsc 3 , > =A0.Xr pmclog 3 , > =A0.Xr hwpmc 4 , > > Modified: head/lib/libpmc/pmc.atom.3 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libpmc/pmc.atom.3 =A0Wed Mar 28 20:49:11 2012 =A0 =A0 =A0 = =A0(r233627) > +++ head/lib/libpmc/pmc.atom.3 =A0Wed Mar 28 20:58:30 2012 =A0 =A0 =A0 = =A0(r233628) > @@ -1176,6 +1176,7 @@ and the underlying hardware events used > =A0.Xr pmc.p4 3 , > =A0.Xr pmc.p5 3 , > =A0.Xr pmc.p6 3 , > +.Xr pmc.soft 3 , > =A0.Xr pmc.tsc 3 , > =A0.Xr pmc_cpuinfo 3 , > =A0.Xr pmclog 3 , > > Modified: head/lib/libpmc/pmc.core.3 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libpmc/pmc.core.3 =A0Wed Mar 28 20:49:11 2012 =A0 =A0 =A0 = =A0(r233627) > +++ head/lib/libpmc/pmc.core.3 =A0Wed Mar 28 20:58:30 2012 =A0 =A0 =A0 = =A0(r233628) > @@ -792,6 +792,7 @@ may not count some transitions. > =A0.Xr pmc.p4 3 , > =A0.Xr pmc.p5 3 , > =A0.Xr pmc.p6 3 , > +.Xr pmc.soft 3 , > =A0.Xr pmc.tsc 3 , > =A0.Xr pmclog 3 , > =A0.Xr hwpmc 4 > > Modified: head/lib/libpmc/pmc.core2.3 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libpmc/pmc.core2.3 Wed Mar 28 20:49:11 2012 =A0 =A0 =A0 =A0(= r233627) > +++ head/lib/libpmc/pmc.core2.3 Wed Mar 28 20:58:30 2012 =A0 =A0 =A0 =A0(= r233628) > @@ -1107,6 +1107,7 @@ and the underlying hardware events used. > =A0.Xr pmc.p4 3 , > =A0.Xr pmc.p5 3 , > =A0.Xr pmc.p6 3 , > +.Xr pmc.soft 3 , > =A0.Xr pmc.tsc 3 , > =A0.Xr pmc_cpuinfo 3 , > =A0.Xr pmclog 3 , > > Modified: head/lib/libpmc/pmc.corei7.3 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libpmc/pmc.corei7.3 =A0 =A0 =A0 =A0Wed Mar 28 20:49:11 2012 = =A0 =A0 =A0 =A0(r233627) > +++ head/lib/libpmc/pmc.corei7.3 =A0 =A0 =A0 =A0Wed Mar 28 20:58:30 2012 = =A0 =A0 =A0 =A0(r233628) > @@ -1559,6 +1559,7 @@ Counts number of segment register loads. > =A0.Xr pmc.corei7uc 3 , > =A0.Xr pmc.westmere 3 , > =A0.Xr pmc.westmereuc 3 , > +.Xr pmc.soft 3 , > =A0.Xr pmc.tsc 3 , > =A0.Xr pmc_cpuinfo 3 , > =A0.Xr pmclog 3 , > > Modified: head/lib/libpmc/pmc.corei7uc.3 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libpmc/pmc.corei7uc.3 =A0 =A0 =A0Wed Mar 28 20:49:11 2012 = =A0 =A0 =A0 =A0(r233627) > +++ head/lib/libpmc/pmc.corei7uc.3 =A0 =A0 =A0Wed Mar 28 20:58:30 2012 = =A0 =A0 =A0 =A0(r233628) > @@ -863,6 +863,7 @@ refreshed or needs to go into a power do > =A0.Xr pmc.corei7 3 , > =A0.Xr pmc.westmere 3 , > =A0.Xr pmc.westmereuc 3 , > +.Xr pmc.soft 3 , > =A0.Xr pmc.tsc 3 , > =A0.Xr pmc_cpuinfo 3 , > =A0.Xr pmclog 3 , > > Modified: head/lib/libpmc/pmc.iaf.3 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libpmc/pmc.iaf.3 =A0 Wed Mar 28 20:49:11 2012 =A0 =A0 =A0 = =A0(r233627) > +++ head/lib/libpmc/pmc.iaf.3 =A0 Wed Mar 28 20:58:30 2012 =A0 =A0 =A0 = =A0(r233628) > @@ -132,6 +132,7 @@ CPU, use the event specifier > =A0.Xr pmc.p4 3 , > =A0.Xr pmc.p5 3 , > =A0.Xr pmc.p6 3 , > +.Xr pmc.soft 3 , > =A0.Xr pmc.tsc 3 , > =A0.Xr pmc_cpuinfo 3 , > =A0.Xr pmclog 3 , > > Modified: head/lib/libpmc/pmc.k7.3 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libpmc/pmc.k7.3 =A0 =A0Wed Mar 28 20:49:11 2012 =A0 =A0 =A0 = =A0(r233627) > +++ head/lib/libpmc/pmc.k7.3 =A0 =A0Wed Mar 28 20:58:30 2012 =A0 =A0 =A0 = =A0(r233628) > @@ -249,6 +249,7 @@ and the underlying hardware events used. > =A0.Xr pmc.p4 3 , > =A0.Xr pmc.p5 3 , > =A0.Xr pmc.p6 3 , > +.Xr pmc.soft 3 , > =A0.Xr pmc.tsc 3 , > =A0.Xr pmclog 3 , > =A0.Xr hwpmc 4 > > Modified: head/lib/libpmc/pmc.k8.3 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libpmc/pmc.k8.3 =A0 =A0Wed Mar 28 20:49:11 2012 =A0 =A0 =A0 = =A0(r233627) > +++ head/lib/libpmc/pmc.k8.3 =A0 =A0Wed Mar 28 20:58:30 2012 =A0 =A0 =A0 = =A0(r233628) > @@ -783,6 +783,7 @@ and the underlying hardware events used. > =A0.Xr pmc.p4 3 , > =A0.Xr pmc.p5 3 , > =A0.Xr pmc.p6 3 , > +.Xr pmc.soft 3 , > =A0.Xr pmc.tsc 3 , > =A0.Xr pmclog 3 , > =A0.Xr hwpmc 4 > > Modified: head/lib/libpmc/pmc.mips24k.3 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libpmc/pmc.mips24k.3 =A0 =A0 =A0 Wed Mar 28 20:49:11 2012 = =A0 =A0 =A0 =A0(r233627) > +++ head/lib/libpmc/pmc.mips24k.3 =A0 =A0 =A0 Wed Mar 28 20:58:30 2012 = =A0 =A0 =A0 =A0(r233628) > @@ -392,6 +392,7 @@ and the underlying hardware events used. > =A0.Xr pmc.p4 3 , > =A0.Xr pmc.p5 3 , > =A0.Xr pmc.p6 3 , > +.Xr pmc.soft 3 , > =A0.Xr pmc.tsc 3 , > =A0.Xr pmc_cpuinfo 3 , > =A0.Xr pmclog 3 , > > Modified: head/lib/libpmc/pmc.octeon.3 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libpmc/pmc.octeon.3 =A0 =A0 =A0 =A0Wed Mar 28 20:49:11 2012 = =A0 =A0 =A0 =A0(r233627) > +++ head/lib/libpmc/pmc.octeon.3 =A0 =A0 =A0 =A0Wed Mar 28 20:58:30 2012 = =A0 =A0 =A0 =A0(r233628) > @@ -232,6 +232,7 @@ and the underlying hardware events used. > =A0.Xr pmc.p4 3 , > =A0.Xr pmc.p5 3 , > =A0.Xr pmc.p6 3 , > +.Xr pmc.soft 3 , > =A0.Xr pmc.tsc 3 , > =A0.Xr pmc_cpuinfo 3 , > =A0.Xr pmclog 3 , > > Modified: head/lib/libpmc/pmc.p4.3 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libpmc/pmc.p4.3 =A0 =A0Wed Mar 28 20:49:11 2012 =A0 =A0 =A0 = =A0(r233627) > +++ head/lib/libpmc/pmc.p4.3 =A0 =A0Wed Mar 28 20:58:30 2012 =A0 =A0 =A0 = =A0(r233628) > @@ -1208,6 +1208,7 @@ and the underlying hardware events used. > =A0.Xr pmc.k8 3 , > =A0.Xr pmc.p5 3 , > =A0.Xr pmc.p6 3 , > +.Xr pmc.soft 3 , > =A0.Xr pmc.tsc 3 , > =A0.Xr pmclog 3 , > =A0.Xr hwpmc 4 > > Modified: head/lib/libpmc/pmc.p5.3 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libpmc/pmc.p5.3 =A0 =A0Wed Mar 28 20:49:11 2012 =A0 =A0 =A0 = =A0(r233627) > +++ head/lib/libpmc/pmc.p5.3 =A0 =A0Wed Mar 28 20:58:30 2012 =A0 =A0 =A0 = =A0(r233628) > @@ -444,6 +444,7 @@ and the underlying hardware events used. > =A0.Xr pmc.k8 3 , > =A0.Xr pmc.p4 3 , > =A0.Xr pmc.p6 3 , > +.Xr pmc.soft 3 , > =A0.Xr pmc.tsc 3 , > =A0.Xr pmclog 3 , > =A0.Xr hwpmc 4 > > Modified: head/lib/libpmc/pmc.p6.3 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libpmc/pmc.p6.3 =A0 =A0Wed Mar 28 20:49:11 2012 =A0 =A0 =A0 = =A0(r233627) > +++ head/lib/libpmc/pmc.p6.3 =A0 =A0Wed Mar 28 20:58:30 2012 =A0 =A0 =A0 = =A0(r233628) > @@ -1010,6 +1010,7 @@ and the underlying hardware events used. > =A0.Xr pmc.k8 3 , > =A0.Xr pmc.p4 3 , > =A0.Xr pmc.p5 3 , > +.Xr pmc.soft 3 , > =A0.Xr pmc.tsc 3 , > =A0.Xr pmclog 3 , > =A0.Xr hwpmc 4 > > Modified: head/lib/libpmc/pmc.sandybridge.3 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libpmc/pmc.sandybridge.3 =A0 Wed Mar 28 20:49:11 2012 =A0 = =A0 =A0 =A0(r233627) > +++ head/lib/libpmc/pmc.sandybridge.3 =A0 Wed Mar 28 20:58:30 2012 =A0 = =A0 =A0 =A0(r233628) > @@ -907,6 +907,7 @@ Split locks in SQ. > =A0.Xr pmc.p5 3 , > =A0.Xr pmc.p6 3 , > =A0.Xr pmc.sandybridgeuc 3 , > +.Xr pmc.soft 3 , > =A0.Xr pmc.tsc 3 , > =A0.Xr pmc.ucf 3 , > =A0.Xr pmc.westmere 3 , > > Modified: head/lib/libpmc/pmc.sandybridgeuc.3 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libpmc/pmc.sandybridgeuc.3 Wed Mar 28 20:49:11 2012 =A0 =A0 = =A0 =A0(r233627) > +++ head/lib/libpmc/pmc.sandybridgeuc.3 Wed Mar 28 20:58:30 2012 =A0 =A0 = =A0 =A0(r233628) > @@ -208,6 +208,7 @@ Counts the number of core-outgoing entri > =A0.Xr pmc.p5 3 , > =A0.Xr pmc.p6 3 , > =A0.Xr pmc.sandybridge 3 , > +.Xr pmc.soft 3 , > =A0.Xr pmc.tsc 3 , > =A0.Xr pmc.ucf 3 , > =A0.Xr pmc.westmere 3 , > > Added: head/lib/libpmc/pmc.soft.3 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- /dev/null =A0 00:00:00 1970 =A0 (empty, because file is newly added) > +++ head/lib/libpmc/pmc.soft.3 =A0Wed Mar 28 20:58:30 2012 =A0 =A0 =A0 = =A0(r233628) > @@ -0,0 +1,104 @@ > +.\" Copyright (c) 2012 Fabien Thomas. =A0All rights reserved. > +.\" > +.\" Redistribution and use in source and binary forms, with or without > +.\" modification, are permitted provided that the following conditions > +.\" are met: > +.\" 1. Redistributions of source code must retain the above copyright > +.\" =A0 =A0notice, this list of conditions and the following disclaimer. > +.\" 2. Redistributions in binary form must reproduce the above copyright > +.\" =A0 =A0notice, this list of conditions and the following disclaimer = in the > +.\" =A0 =A0documentation and/or other materials provided with the distri= bution. > +.\" > +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' A= ND > +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, TH= E > +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR P= URPOSE > +.\" ARE DISCLAIMED. =A0IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE L= IABLE > +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQU= ENTIAL > +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GO= ODS > +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION= ) > +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, = STRICT > +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN AN= Y WAY > +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY = OF > +.\" SUCH DAMAGE. > +.\" > +.\" $FreeBSD$ > +.\" > +.Dd March 28, 2012 > +.Os > +.Dt PMC.SOFT 3 > +.Sh NAME > +.Nm pmc.soft > +.Nd measurements using software based events > +.Sh LIBRARY > +.Lb libpmc > +.Sh SYNOPSIS > +.In pmc.h > +.Sh DESCRIPTION > +Software events are used to collect various source of software events. > +.Ss PMC Features > +16 sampling counters using software events based on various sources. > +These PMCs support the following capabilities: > +.Bl -column "PMC_CAP_INTERRUPT" "Support" > +.It Em Capability Ta Em Support > +.It PMC_CAP_CASCADE Ta \&No > +.It PMC_CAP_EDGE Ta \&No > +.It PMC_CAP_INTERRUPT Ta Yes > +.It PMC_CAP_INVERT Ta \&No > +.It PMC_CAP_READ Ta Yes > +.It PMC_CAP_PRECISE Ta \&No > +.It PMC_CAP_SYSTEM Ta Yes > +.It PMC_CAP_TAGGING Ta \&No > +.It PMC_CAP_THRESHOLD Ta \&No > +.It PMC_CAP_USER Ta Yes > +.It PMC_CAP_WRITE Ta Yes > +.El > +.Ss Event Qualifiers > +There is no supported event qualifier. > +.Pp > +The event specifiers supported by software are: > +.Bl -tag -width indent > +.It Li CLOCK.HARD > +Hard clock ticks. > +.It Li CLOCK.STAT > +Stat clock ticks. > +.It Li LOCK.FAILED > +Lock acquisition failed. > +.It Li PAGE_FAULT.ALL > +All page fault type. > +.It Li PAGE_FAULT.READ > +Read page fault. > +.It Li PAGE_FAULT.WRITE > +Write page fault. > +.El > +.Sh SEE ALSO > +.Xr pmc 3 , > +.Xr pmc.atom 3 , > +.Xr pmc.core 3 , > +.Xr pmc.iaf 3 , > +.Xr pmc.ucf 3 , > +.Xr pmc.k7 3 , > +.Xr pmc.k8 3 , > +.Xr pmc.p4 3 , > +.Xr pmc.p5 3 , > +.Xr pmc.p6 3 , > +.Xr pmc.corei7 3 , > +.Xr pmc.corei7uc 3 , > +.Xr pmc.westmereuc 3 , > +.Xr pmc.tsc 3 , > +.Xr pmc_cpuinfo 3 , > +.Xr pmclog 3 , > +.Xr hwpmc 4 > +.Sh HISTORY > +The > +.Nm pmc > +library first appeared in > +.Fx 6.0 . > +.Sh AUTHORS > +The > +.Lb libpmc > +library was written by > +.An "Joseph Koshy" > +.Aq jkoshy@FreeBSD.org . > +Software PMC was written by > +.An "Fabien Thomas" > +.Aq fabient@FreeBSD.org . > > Modified: head/lib/libpmc/pmc.tsc.3 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libpmc/pmc.tsc.3 =A0 Wed Mar 28 20:49:11 2012 =A0 =A0 =A0 = =A0(r233627) > +++ head/lib/libpmc/pmc.tsc.3 =A0 Wed Mar 28 20:58:30 2012 =A0 =A0 =A0 = =A0(r233628) > @@ -68,6 +68,7 @@ maps to the TSC. > =A0.Xr pmc.p4 3 , > =A0.Xr pmc.p5 3 , > =A0.Xr pmc.p6 3 , > +.Xr pmc.soft 3 , > =A0.Xr pmclog 3 , > =A0.Xr hwpmc 4 > =A0.Sh HISTORY > > Modified: head/lib/libpmc/pmc.ucf.3 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libpmc/pmc.ucf.3 =A0 Wed Mar 28 20:49:11 2012 =A0 =A0 =A0 = =A0(r233627) > +++ head/lib/libpmc/pmc.ucf.3 =A0 Wed Mar 28 20:58:30 2012 =A0 =A0 =A0 = =A0(r233628) > @@ -96,6 +96,7 @@ offset C0H under device number 0 and Fun > =A0.Xr pmc.corei7uc 3 , > =A0.Xr pmc.westmere 3 , > =A0.Xr pmc.westmereuc 3 , > +.Xr pmc.soft 3 , > =A0.Xr pmc.tsc 3 , > =A0.Xr pmc_cpuinfo 3 , > =A0.Xr pmclog 3 , > > Modified: head/lib/libpmc/pmc.westmere.3 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libpmc/pmc.westmere.3 =A0 =A0 =A0Wed Mar 28 20:49:11 2012 = =A0 =A0 =A0 =A0(r233627) > +++ head/lib/libpmc/pmc.westmere.3 =A0 =A0 =A0Wed Mar 28 20:58:30 2012 = =A0 =A0 =A0 =A0(r233628) > @@ -1381,6 +1381,7 @@ Counts number of SID integer 64 bit shif > =A0.Xr pmc.corei7 3 , > =A0.Xr pmc.corei7uc 3 , > =A0.Xr pmc.westmereuc 3 , > +.Xr pmc.soft 3 , > =A0.Xr pmc.tsc 3 , > =A0.Xr pmc_cpuinfo 3 , > =A0.Xr pmclog 3 , > > Modified: head/lib/libpmc/pmc.westmereuc.3 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libpmc/pmc.westmereuc.3 =A0 =A0Wed Mar 28 20:49:11 2012 =A0 = =A0 =A0 =A0(r233627) > +++ head/lib/libpmc/pmc.westmereuc.3 =A0 =A0Wed Mar 28 20:58:30 2012 =A0 = =A0 =A0 =A0(r233628) > @@ -1066,6 +1066,7 @@ disabled. > =A0.Xr pmc.corei7 3 , > =A0.Xr pmc.corei7uc 3 , > =A0.Xr pmc.westmere 3 , > +.Xr pmc.soft 3 , > =A0.Xr pmc.tsc 3 , > =A0.Xr pmc_cpuinfo 3 , > =A0.Xr pmclog 3 , > > Modified: head/lib/libpmc/pmc.xscale.3 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libpmc/pmc.xscale.3 =A0 =A0 =A0 =A0Wed Mar 28 20:49:11 2012 = =A0 =A0 =A0 =A0(r233627) > +++ head/lib/libpmc/pmc.xscale.3 =A0 =A0 =A0 =A0Wed Mar 28 20:58:30 2012 = =A0 =A0 =A0 =A0(r233628) > @@ -134,6 +134,7 @@ and the underlying hardware events used. > =A0.Xr pmc 3 , > =A0.Xr pmc_cpuinfo 3 , > =A0.Xr pmclog 3 , > +.Xr pmc.soft 3 , > =A0.Xr hwpmc 4 > =A0.Sh HISTORY > =A0The > > Modified: head/lib/libpmc/pmclog.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libpmc/pmclog.c =A0 =A0Wed Mar 28 20:49:11 2012 =A0 =A0 =A0 = =A0(r233627) > +++ head/lib/libpmc/pmclog.c =A0 =A0Wed Mar 28 20:58:30 2012 =A0 =A0 =A0 = =A0(r233628) > @@ -369,6 +369,12 @@ pmclog_get_event(void *cookie, char **da > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=3D=3D NULL) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0goto error; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0break; > + =A0 =A0 =A0 case PMCLOG_TYPE_PMCALLOCATEDYN: > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 PMCLOG_READ32(le,ev->pl_u.pl_ad.pl_pmcid); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 PMCLOG_READ32(le,ev->pl_u.pl_ad.pl_event); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 PMCLOG_READ32(le,ev->pl_u.pl_ad.pl_flags); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 PMCLOG_READSTRING(le,ev->pl_u.pl_ad.pl_evna= me,PMC_NAME_MAX); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; > =A0 =A0 =A0 =A0case PMCLOG_TYPE_PMCATTACH: > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0PMCLOG_GET_PATHLEN(pathlen,evlen,pmclog_pm= cattach); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0PMCLOG_READ32(le,ev->pl_u.pl_t.pl_pmcid); > > Modified: head/lib/libpmc/pmclog.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libpmc/pmclog.h =A0 =A0Wed Mar 28 20:49:11 2012 =A0 =A0 =A0 = =A0(r233627) > +++ head/lib/libpmc/pmclog.h =A0 =A0Wed Mar 28 20:58:30 2012 =A0 =A0 =A0 = =A0(r233628) > @@ -88,6 +88,13 @@ struct pmclog_ev_pmcallocate { > =A0 =A0 =A0 =A0pmc_id_t =A0 =A0 =A0 =A0pl_pmcid; > =A0}; > > +struct pmclog_ev_pmcallocatedyn { > + =A0 =A0 =A0 uint32_t =A0 =A0 =A0 =A0pl_event; > + =A0 =A0 =A0 char =A0 =A0 =A0 =A0 =A0 =A0pl_evname[PMC_NAME_MAX]; > + =A0 =A0 =A0 uint32_t =A0 =A0 =A0 =A0pl_flags; > + =A0 =A0 =A0 pmc_id_t =A0 =A0 =A0 =A0pl_pmcid; > +}; > + > =A0struct pmclog_ev_pmcattach { > =A0 =A0 =A0 =A0pmc_id_t =A0 =A0 =A0 =A0pl_pmcid; > =A0 =A0 =A0 =A0pid_t =A0 =A0 =A0 =A0 =A0 pl_pid; > @@ -146,6 +153,7 @@ struct pmclog_ev { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0struct pmclog_ev_map_out =A0 =A0 =A0 =A0pl= _mo; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0struct pmclog_ev_pcsample =A0 =A0 =A0 pl_s= ; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0struct pmclog_ev_pmcallocate =A0 =A0pl_a; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 struct pmclog_ev_pmcallocatedyn pl_ad; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0struct pmclog_ev_pmcattach =A0 =A0 =A0pl_t= ; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0struct pmclog_ev_pmcdetach =A0 =A0 =A0pl_d= ; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0struct pmclog_ev_proccsw =A0 =A0 =A0 =A0pl= _c; > > Modified: head/sys/amd64/amd64/trap.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/amd64/amd64/trap.c Wed Mar 28 20:49:11 2012 =A0 =A0 =A0 =A0(= r233627) > +++ head/sys/amd64/amd64/trap.c Wed Mar 28 20:58:30 2012 =A0 =A0 =A0 =A0(= r233628) > @@ -71,6 +71,9 @@ __FBSDID("$FreeBSD$"); > =A0#include > =A0#ifdef HWPMC_HOOKS > =A0#include > +PMC_SOFT_DEFINE( , , page_fault, all); > +PMC_SOFT_DEFINE( , , page_fault, read); > +PMC_SOFT_DEFINE( , , page_fault, write); > =A0#endif > > =A0#include > @@ -743,8 +746,20 @@ trap_pfault(frame, usermode) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 */ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0rv =3D vm_fault(map, va, ftype, VM_FAULT_N= ORMAL); > =A0 =A0 =A0 =A0} > - =A0 =A0 =A0 if (rv =3D=3D KERN_SUCCESS) > + =A0 =A0 =A0 if (rv =3D=3D KERN_SUCCESS) { > +#ifdef HWPMC_HOOKS > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (ftype =3D=3D VM_PROT_READ || ftype =3D= =3D VM_PROT_WRITE) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 PMC_SOFT_CALL_TF( , , page_= fault, all, frame); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (ftype =3D=3D VM_PROT_RE= AD) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 PMC_SOFT_CA= LL_TF( , , page_fault, read, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 fra= me); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 else > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 PMC_SOFT_CA= LL_TF( , , page_fault, write, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 fra= me); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > +#endif > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return (0); > + =A0 =A0 =A0 } > =A0nogo: > =A0 =A0 =A0 =A0if (!usermode) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (td->td_intr_nesting_level =3D=3D 0 && > > Modified: head/sys/amd64/include/pmc_mdep.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/amd64/include/pmc_mdep.h =A0 Wed Mar 28 20:49:11 2012 =A0 = =A0 =A0 =A0(r233627) > +++ head/sys/amd64/include/pmc_mdep.h =A0 Wed Mar 28 20:58:30 2012 =A0 = =A0 =A0 =A0(r233628) > @@ -50,13 +50,13 @@ struct pmc_mdep; > =A0* measurement architecture have PMCs of the following classes: TSC, > =A0* IAF, IAP, UCF and UCP. > =A0*/ > -#define =A0 =A0 =A0 =A0PMC_MDEP_CLASS_INDEX_TSC =A0 =A0 =A0 =A00 > -#define =A0 =A0 =A0 =A0PMC_MDEP_CLASS_INDEX_K8 =A0 =A0 =A0 =A0 1 > -#define =A0 =A0 =A0 =A0PMC_MDEP_CLASS_INDEX_P4 =A0 =A0 =A0 =A0 1 > -#define =A0 =A0 =A0 =A0PMC_MDEP_CLASS_INDEX_IAP =A0 =A0 =A0 =A01 > -#define =A0 =A0 =A0 =A0PMC_MDEP_CLASS_INDEX_IAF =A0 =A0 =A0 =A02 > -#define =A0 =A0 =A0 =A0PMC_MDEP_CLASS_INDEX_UCP =A0 =A0 =A0 =A03 > -#define =A0 =A0 =A0 =A0PMC_MDEP_CLASS_INDEX_UCF =A0 =A0 =A0 =A04 > +#define =A0 =A0 =A0 =A0PMC_MDEP_CLASS_INDEX_TSC =A0 =A0 =A0 =A01 > +#define =A0 =A0 =A0 =A0PMC_MDEP_CLASS_INDEX_K8 =A0 =A0 =A0 =A0 2 > +#define =A0 =A0 =A0 =A0PMC_MDEP_CLASS_INDEX_P4 =A0 =A0 =A0 =A0 2 > +#define =A0 =A0 =A0 =A0PMC_MDEP_CLASS_INDEX_IAP =A0 =A0 =A0 =A02 > +#define =A0 =A0 =A0 =A0PMC_MDEP_CLASS_INDEX_IAF =A0 =A0 =A0 =A03 > +#define =A0 =A0 =A0 =A0PMC_MDEP_CLASS_INDEX_UCP =A0 =A0 =A0 =A04 > +#define =A0 =A0 =A0 =A0PMC_MDEP_CLASS_INDEX_UCF =A0 =A0 =A0 =A05 > > =A0/* > =A0* On the amd64 platform we support the following PMCs. > @@ -119,6 +119,15 @@ union pmc_md_pmc { > > =A0#define =A0 =A0 =A0 =A0PMC_IN_USERSPACE(va) ((va) <=3D VM_MAXUSER_ADDR= ESS) > > +/* Build a fake kernel trapframe from current instruction pointer. */ > +#define PMC_FAKE_TRAPFRAME(TF) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 \ > + =A0 =A0 =A0 do { =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0\ > + =A0 =A0 =A0 (TF)->tf_cs =3D 0; (TF)->tf_rflags =3D 0; =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 \ > + =A0 =A0 =A0 __asm __volatile("movq %%rbp,%0" : "=3Dr" ((TF)->tf_rbp)); = =A0 =A0 =A0 =A0\ > + =A0 =A0 =A0 __asm __volatile("movq %%rsp,%0" : "=3Dr" ((TF)->tf_rsp)); = =A0 =A0 =A0 =A0\ > + =A0 =A0 =A0 __asm __volatile("call 1f \n\t1: pop %0" : "=3Dr"((TF)->tf_= rip)); \ > + =A0 =A0 =A0 } while (0) > + > =A0/* > =A0* Prototypes > =A0*/ > > Modified: head/sys/arm/include/pmc_mdep.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/arm/include/pmc_mdep.h =A0 =A0 Wed Mar 28 20:49:11 2012 =A0 = =A0 =A0 =A0(r233627) > +++ head/sys/arm/include/pmc_mdep.h =A0 =A0 Wed Mar 28 20:58:30 2012 =A0 = =A0 =A0 =A0(r233628) > @@ -29,7 +29,7 @@ > =A0#ifndef _MACHINE_PMC_MDEP_H_ > =A0#define =A0 =A0 =A0 =A0_MACHINE_PMC_MDEP_H_ > > -#define =A0 =A0 =A0 =A0PMC_MDEP_CLASS_INDEX_XSCALE =A0 =A0 0 > +#define =A0 =A0 =A0 =A0PMC_MDEP_CLASS_INDEX_XSCALE =A0 =A0 1 > =A0/* > =A0* On the ARM platform we support the following PMCs. > =A0* > > Modified: head/sys/conf/files > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/conf/files Wed Mar 28 20:49:11 2012 =A0 =A0 =A0 =A0(r233627) > +++ head/sys/conf/files Wed Mar 28 20:58:30 2012 =A0 =A0 =A0 =A0(r233628) > @@ -1260,6 +1260,7 @@ dev/hme/if_hme_sbus.c =A0 =A0 =A0 =A0 =A0 =A0 optio= nal hme sbus > =A0dev/hptiop/hptiop.c =A0 =A0 =A0 =A0 =A0 =A0optional hptiop scbus > =A0dev/hwpmc/hwpmc_logging.c =A0 =A0 =A0optional hwpmc > =A0dev/hwpmc/hwpmc_mod.c =A0 =A0 =A0 =A0 =A0optional hwpmc > +dev/hwpmc/hwpmc_soft.c =A0 =A0 =A0 =A0 optional hwpmc > =A0dev/ichsmb/ichsmb.c =A0 =A0 =A0 =A0 =A0 =A0optional ichsmb > =A0dev/ichsmb/ichsmb_pci.c =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0optional ichsmb= pci > =A0dev/ida/ida.c =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0optional ida > > Modified: head/sys/dev/hwpmc/hwpmc_amd.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/hwpmc/hwpmc_amd.c =A0 =A0 =A0Wed Mar 28 20:49:11 2012 = =A0 =A0 =A0 =A0(r233627) > +++ head/sys/dev/hwpmc/hwpmc_amd.c =A0 =A0 =A0Wed Mar 28 20:58:30 2012 = =A0 =A0 =A0 =A0(r233628) > @@ -687,7 +687,8 @@ amd_intr(int cpu, struct trapframe *tf) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0wrmsr(perfctr, AMD_RELOAD_COUNT_TO_PERFCTR= _VALUE(v)); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Restart the counter if logging succeede= d. */ > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 error =3D pmc_process_interrupt(cpu, pm, tf= , TRAPF_USERMODE(tf)); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 error =3D pmc_process_interrupt(cpu, PMC_HR= , pm, tf, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 TRAPF_USERMODE(tf)); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (error =3D=3D 0) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0wrmsr(evsel, config | AMD_= PMC_ENABLE); > =A0 =A0 =A0 =A0} > @@ -874,7 +875,7 @@ amd_pcpu_fini(struct pmc_mdep *md, int c > =A0struct pmc_mdep * > =A0pmc_amd_initialize(void) > =A0{ > - =A0 =A0 =A0 int classindex, error, i, nclasses, ncpus; > + =A0 =A0 =A0 int classindex, error, i, ncpus; > =A0 =A0 =A0 =A0struct pmc_classdep *pcd; > =A0 =A0 =A0 =A0enum pmc_cputype cputype; > =A0 =A0 =A0 =A0struct pmc_mdep *pmc_mdep; > @@ -926,12 +927,9 @@ pmc_amd_initialize(void) > =A0 =A0 =A0 =A0 * These processors have two classes of PMCs: the TSC and > =A0 =A0 =A0 =A0 * programmable PMCs. > =A0 =A0 =A0 =A0 */ > - =A0 =A0 =A0 nclasses =3D 2; > - =A0 =A0 =A0 pmc_mdep =3D malloc(sizeof(struct pmc_mdep) + nclasses * si= zeof (struct pmc_classdep), > - =A0 =A0 =A0 =A0 =A0 M_PMC, M_WAITOK|M_ZERO); > + =A0 =A0 =A0 pmc_mdep =3D pmc_mdep_alloc(2); > > =A0 =A0 =A0 =A0pmc_mdep->pmd_cputype =3D cputype; > - =A0 =A0 =A0 pmc_mdep->pmd_nclass =A0=3D nclasses; > > =A0 =A0 =A0 =A0ncpus =3D pmc_cpu_max(); > > > Modified: head/sys/dev/hwpmc/hwpmc_core.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/hwpmc/hwpmc_core.c =A0 =A0 Wed Mar 28 20:49:11 2012 =A0 = =A0 =A0 =A0(r233627) > +++ head/sys/dev/hwpmc/hwpmc_core.c =A0 =A0 Wed Mar 28 20:58:30 2012 =A0 = =A0 =A0 =A0(r233628) > @@ -2239,7 +2239,7 @@ core_intr(int cpu, struct trapframe *tf) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (pm->pm_state !=3D PMC_STATE_RUNNING) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0continue; > > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 error =3D pmc_process_interrupt(cpu, pm, tf= , > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 error =3D pmc_process_interrupt(cpu, PMC_HR= , pm, tf, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0TRAPF_USERMODE(tf)); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0v =3D pm->pm_sc.pm_reloadcount; > @@ -2326,7 +2326,7 @@ core2_intr(int cpu, struct trapframe *tf > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0!PMC_IS_SAMPLING_MODE(PMC_TO_MODE(= pm))) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0continue; > > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 error =3D pmc_process_interrupt(cpu, pm, tf= , > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 error =3D pmc_process_interrupt(cpu, PMC_HR= , pm, tf, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0TRAPF_USERMODE(tf)); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (error) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0intrenable &=3D ~flag; > @@ -2354,7 +2354,7 @@ core2_intr(int cpu, struct trapframe *tf > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0!PMC_IS_SAMPLING_MODE(PMC_TO_MODE(= pm))) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0continue; > > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 error =3D pmc_process_interrupt(cpu, pm, tf= , > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 error =3D pmc_process_interrupt(cpu, PMC_HR= , pm, tf, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0TRAPF_USERMODE(tf)); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (error) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0intrenable &=3D ~flag; > > Modified: head/sys/dev/hwpmc/hwpmc_intel.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/hwpmc/hwpmc_intel.c =A0 =A0Wed Mar 28 20:49:11 2012 =A0 = =A0 =A0 =A0(r233627) > +++ head/sys/dev/hwpmc/hwpmc_intel.c =A0 =A0Wed Mar 28 20:58:30 2012 =A0 = =A0 =A0 =A0(r233628) > @@ -162,12 +162,10 @@ pmc_intel_initialize(void) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return (NULL); > =A0 =A0 =A0 =A0} > > - =A0 =A0 =A0 pmc_mdep =3D malloc(sizeof(struct pmc_mdep) + nclasses * > - =A0 =A0 =A0 =A0 =A0 sizeof(struct pmc_classdep), M_PMC, M_WAITOK|M_ZERO= ); > + =A0 =A0 =A0 /* Allocate base class and initialize machine dependent str= uct */ > + =A0 =A0 =A0 pmc_mdep =3D pmc_mdep_alloc(nclasses); > > =A0 =A0 =A0 =A0pmc_mdep->pmd_cputype =A0 =A0=3D cputype; > - =A0 =A0 =A0 pmc_mdep->pmd_nclass =A0 =A0 =3D nclasses; > - > =A0 =A0 =A0 =A0pmc_mdep->pmd_switch_in =A0=3D intel_switch_in; > =A0 =A0 =A0 =A0pmc_mdep->pmd_switch_out =3D intel_switch_out; > > > Modified: head/sys/dev/hwpmc/hwpmc_logging.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/hwpmc/hwpmc_logging.c =A0Wed Mar 28 20:49:11 2012 =A0 = =A0 =A0 =A0(r233627) > +++ head/sys/dev/hwpmc/hwpmc_logging.c =A0Wed Mar 28 20:58:30 2012 =A0 = =A0 =A0 =A0(r233628) > @@ -129,6 +129,7 @@ static struct mtx pmc_kthread_mtx; =A0/* sl > > =A0/* Emit a string. =A0Caution: does NOT update _le, so needs to be last= */ > =A0#define =A0 =A0 =A0 =A0PMCLOG_EMITSTRING(S,L) =A0do { bcopy((S), _le, = (L)); } while (0) > +#define =A0 =A0 =A0 =A0PMCLOG_EMITNULLSTRING(L) do { bzero(_le, (L)); } = while (0) > > =A0#define =A0 =A0 =A0 =A0PMCLOG_DESPATCH(PO) =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 \ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0pmclog_release((PO)); =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 \ > @@ -835,16 +836,33 @@ void > =A0pmclog_process_pmcallocate(struct pmc *pm) > =A0{ > =A0 =A0 =A0 =A0struct pmc_owner *po; > + =A0 =A0 =A0 struct pmc_soft *ps; > > =A0 =A0 =A0 =A0po =3D pm->pm_owner; > > =A0 =A0 =A0 =A0PMCDBG(LOG,ALL,1, "pm=3D%p", pm); > > - =A0 =A0 =A0 PMCLOG_RESERVE(po, PMCALLOCATE, sizeof(struct pmclog_pmcall= ocate)); > - =A0 =A0 =A0 PMCLOG_EMIT32(pm->pm_id); > - =A0 =A0 =A0 PMCLOG_EMIT32(pm->pm_event); > - =A0 =A0 =A0 PMCLOG_EMIT32(pm->pm_flags); > - =A0 =A0 =A0 PMCLOG_DESPATCH(po); > + =A0 =A0 =A0 if (PMC_TO_CLASS(pm) =3D=3D PMC_CLASS_SOFT) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 PMCLOG_RESERVE(po, PMCALLOCATEDYN, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 sizeof(struct pmclog_pmcallocatedyn= )); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 PMCLOG_EMIT32(pm->pm_id); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 PMCLOG_EMIT32(pm->pm_event); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 PMCLOG_EMIT32(pm->pm_flags); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ps =3D pmc_soft_ev_acquire(pm->pm_event); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (ps !=3D NULL) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 PMCLOG_EMITSTRING(ps->ps_ev= .pm_ev_name,PMC_NAME_MAX); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 else > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 PMCLOG_EMITNULLSTRING(PMC_N= AME_MAX); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 pmc_soft_ev_release(ps); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 PMCLOG_DESPATCH(po); > + =A0 =A0 =A0 } else { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 PMCLOG_RESERVE(po, PMCALLOCATE, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 sizeof(struct pmclog_pmcallocate)); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 PMCLOG_EMIT32(pm->pm_id); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 PMCLOG_EMIT32(pm->pm_event); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 PMCLOG_EMIT32(pm->pm_flags); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 PMCLOG_DESPATCH(po); > + =A0 =A0 =A0 } > =A0} > > =A0void > > Modified: head/sys/dev/hwpmc/hwpmc_mips.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/hwpmc/hwpmc_mips.c =A0 =A0 Wed Mar 28 20:49:11 2012 =A0 = =A0 =A0 =A0(r233627) > +++ head/sys/dev/hwpmc/hwpmc_mips.c =A0 =A0 Wed Mar 28 20:58:30 2012 =A0 = =A0 =A0 =A0(r233628) > @@ -287,7 +287,7 @@ mips_pmc_intr(int cpu, struct trapframe > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0retval =3D 1; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (pm->pm_state !=3D PMC_STATE_RUNNING) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0continue; > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 error =3D pmc_process_interrupt(cpu, pm, tf= , > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 error =3D pmc_process_interrupt(cpu, PMC_HR= , pm, tf, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0TRAPF_USERMODE(tf)); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (error) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* Clear/disable the relev= ant counter */ > > Modified: head/sys/dev/hwpmc/hwpmc_mod.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/hwpmc/hwpmc_mod.c =A0 =A0 =A0Wed Mar 28 20:49:11 2012 = =A0 =A0 =A0 =A0(r233627) > +++ head/sys/dev/hwpmc/hwpmc_mod.c =A0 =A0 =A0Wed Mar 28 20:58:30 2012 = =A0 =A0 =A0 =A0(r233628) > @@ -70,6 +70,8 @@ __FBSDID("$FreeBSD$"); > =A0#include > =A0#include > > +#include "hwpmc_soft.h" > + > =A0/* > =A0* Types > =A0*/ > @@ -182,7 +184,7 @@ static int =A0pmc_attach_one_process(struct > =A0static int =A0 =A0 pmc_can_allocate_rowindex(struct proc *p, unsigned = int ri, > =A0 =A0 int cpu); > =A0static int =A0 =A0 pmc_can_attach(struct pmc *pm, struct proc *p); > -static void =A0 =A0pmc_capture_user_callchain(int cpu, struct trapframe = *tf); > +static void =A0 =A0pmc_capture_user_callchain(int cpu, int soft, struct = trapframe *tf); > =A0static void =A0 =A0pmc_cleanup(void); > =A0static int =A0 =A0 pmc_detach_process(struct proc *p, struct pmc *pm); > =A0static int =A0 =A0 pmc_detach_one_process(struct proc *p, struct pmc *= pm, > @@ -206,7 +208,7 @@ static void pmc_process_csw_out(struct t > =A0static void =A0 =A0pmc_process_exit(void *arg, struct proc *p); > =A0static void =A0 =A0pmc_process_fork(void *arg, struct proc *p1, > =A0 =A0 struct proc *p2, int n); > -static void =A0 =A0pmc_process_samples(int cpu); > +static void =A0 =A0pmc_process_samples(int cpu, int soft); > =A0static void =A0 =A0pmc_release_pmc_descriptor(struct pmc *pmc); > =A0static void =A0 =A0pmc_remove_owner(struct pmc_owner *po); > =A0static void =A0 =A0pmc_remove_process_descriptor(struct pmc_process *p= p); > @@ -218,12 +220,16 @@ static int =A0 =A0 =A0 =A0pmc_stop(struct pmc *pm); > =A0static int =A0 =A0 pmc_syscall_handler(struct thread *td, void *syscal= l_args); > =A0static void =A0 =A0pmc_unlink_target_process(struct pmc *pmc, > =A0 =A0 struct pmc_process *pp); > +static int generic_switch_in(struct pmc_cpu *pc, struct pmc_process *pp)= ; > +static int generic_switch_out(struct pmc_cpu *pc, struct pmc_process *pp= ); > +static struct pmc_mdep *pmc_generic_cpu_initialize(void); > +static void pmc_generic_cpu_finalize(struct pmc_mdep *md); > > =A0/* > =A0* Kernel tunables and sysctl(8) interface. > =A0*/ > > -SYSCTL_NODE(_kern, OID_AUTO, hwpmc, CTLFLAG_RW, 0, "HWPMC parameters"); > +SYSCTL_DECL(_kern_hwpmc); > > =A0static int pmc_callchaindepth =3D PMC_CALLCHAIN_DEPTH; > =A0TUNABLE_INT(PMC_SYSCTL_NAME_PREFIX "callchaindepth", &pmc_callchaindep= th); > @@ -1833,7 +1839,9 @@ const char *pmc_hooknames[] =3D { > =A0 =A0 =A0 =A0"KLDUNLOAD", > =A0 =A0 =A0 =A0"MMAP", > =A0 =A0 =A0 =A0"MUNMAP", > - =A0 =A0 =A0 "CALLCHAIN" > + =A0 =A0 =A0 "CALLCHAIN-NMI", > + =A0 =A0 =A0 "CALLCHAIN-SOFT", > + =A0 =A0 =A0 "SOFTSAMPLING" > =A0}; > =A0#endif > > @@ -1992,7 +2000,8 @@ pmc_hook_handler(struct thread *td, int > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 * lose the interrupt sample. > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 */ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0CPU_CLR_ATOMIC(PCPU_GET(cpuid), &pmc_cpuma= sk); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 pmc_process_samples(PCPU_GET(cpuid)); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 pmc_process_samples(PCPU_GET(cpuid), PMC_HR= ); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 pmc_process_samples(PCPU_GET(cpuid), PMC_SR= ); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0break; > > > @@ -2022,11 +2031,30 @@ pmc_hook_handler(struct thread *td, int > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 */ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0KASSERT(td =3D=3D curthread, ("[pmc,%d] td= !=3D curthread", > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0__LINE__)); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 pmc_capture_user_callchain(PCPU_GET(cpuid), > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 pmc_capture_user_callchain(PCPU_GET(cpuid),= PMC_HR, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(struct trapframe *) arg); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0td->td_pflags &=3D ~TDP_CALLCHAIN; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0break; > > + =A0 =A0 =A0 case PMC_FN_USER_CALLCHAIN_SOFT: > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* Record a call chain. > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 KASSERT(td =3D=3D curthread, ("[pmc,%d] td = !=3D curthread", > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 __LINE__)); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 pmc_capture_user_callchain(PCPU_GET(cpuid),= PMC_SR, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (struct trapframe *) arg); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 td->td_pflags &=3D ~TDP_CALLCHAIN; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; > + > + =A0 =A0 =A0 case PMC_FN_SOFT_SAMPLING: > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* Call soft PMC sampling intr. > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 pmc_soft_intr((struct pmckern_soft *) arg); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; > + > =A0 =A0 =A0 =A0default: > =A0#ifdef DEBUG > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0KASSERT(0, ("[pmc,%d] unknown hook %d\n", = __LINE__, function)); > @@ -2221,18 +2249,17 @@ pmc_destroy_pmc_descriptor(struct pmc *p > =A0static void > =A0pmc_wait_for_pmc_idle(struct pmc *pm) > =A0{ > -#ifdef DEBUG > +#ifdef DEBUG > =A0 =A0 =A0 =A0volatile int maxloop; > > =A0 =A0 =A0 =A0maxloop =3D 100 * pmc_cpu_max(); > =A0#endif > - > =A0 =A0 =A0 =A0/* > =A0 =A0 =A0 =A0 * Loop (with a forced context switch) till the PMC's runc= ount > =A0 =A0 =A0 =A0 * comes down to zero. > =A0 =A0 =A0 =A0 */ > =A0 =A0 =A0 =A0while (atomic_load_acq_32(&pm->pm_runcount) > 0) { > -#ifdef DEBUG > +#ifdef DEBUG > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0maxloop--; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0KASSERT(maxloop > 0, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0("[pmc,%d] (ri%d, rc%d) waiting to= o long for " > @@ -2972,6 +2999,53 @@ pmc_syscall_handler(struct thread *td, v > =A0 =A0 =A0 =A0} > =A0 =A0 =A0 =A0break; > > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* Retrieve soft events list. > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 case PMC_OP_GETDYNEVENTINFO: > + =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 enum pmc_class =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0cl; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 enum pmc_event =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0ev; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 struct pmc_op_getdyneventinfo =A0 *gei; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 struct pmc_dyn_event_descr =A0 =A0 =A0dev; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 struct pmc_soft =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 *ps; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 uint32_t =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0nevent; > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 sx_assert(&pmc_sx, SX_LOCKED); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 gei =3D (struct pmc_op_getdyneventinfo *) a= rg; > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((error =3D copyin(&gei->pm_class, &cl, = sizeof(cl))) !=3D 0) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* Only SOFT class is dynamic. */ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (cl !=3D PMC_CLASS_SOFT) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 error =3D EINVAL; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 nevent =3D 0; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 for (ev =3D PMC_EV_SOFT_FIRST; ev <=3D PMC_= EV_SOFT_LAST; ev++) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ps =3D pmc_soft_ev_acquire(= ev); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (ps =3D=3D NULL) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 continue; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 bcopy(&ps->ps_ev, &dev, siz= eof(dev)); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 pmc_soft_ev_release(ps); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 error =3D copyout(&dev, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 &gei->pm_events[nev= ent], > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 sizeof(struct pmc_d= yn_event_descr)); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (error !=3D 0) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 nevent++; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (error !=3D 0) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 error =3D copyout(&nevent, &gei->pm_nevent, > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-freebsd-mips@FreeBSD.ORG Mon Apr 23 06:55:24 2012 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C2F741065670; Mon, 23 Apr 2012 06:55:24 +0000 (UTC) (envelope-from monthadar@gmail.com) Received: from mail-wg0-f50.google.com (mail-wg0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 784E78FC08; Mon, 23 Apr 2012 06:55:23 +0000 (UTC) Received: by wgbds12 with SMTP id ds12so11068656wgb.31 for ; Sun, 22 Apr 2012 23:55:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=V8r6mflTXnVtBJLqdJEMhJHTZe/QheY36eMftn6YJIg=; b=y7esXWsdrhDtOvTCPV+KyCYBD+JQI3MHRxrGPEnzJldKj568DRVesGg/XCdlS07iWt Tj5REENj/EserMcu3f8AOhHpbw6z/n5qio2wbLebGHvhkmBWV7eQm5dvNCZZIwJAGNv5 WBvj41ROFdWzuAOBod2dvSTaoCxlX2S0Jz40lZQ54USB+Jvb3qul+2ReaXPxupQ/6ccX kIQlzV7oz3cDV/6IqqnEW4JqiJUagxY1HX0fXWrSugy8Js9PuItZa0G/TMNS2DQRVdrr KKoEfvcQY3WjaXaeO7vGu0sur1gHsuzSdDMZM28lcj7XBzgJKlfTPTa58g1lY9U3CuMq VS3Q== MIME-Version: 1.0 Received: by 10.180.101.8 with SMTP id fc8mr18599786wib.12.1335164122337; Sun, 22 Apr 2012 23:55:22 -0700 (PDT) Received: by 10.223.155.74 with HTTP; Sun, 22 Apr 2012 23:55:21 -0700 (PDT) In-Reply-To: References: <201203282058.q2SKwVsJ053900@svn.freebsd.org> Date: Mon, 23 Apr 2012 08:55:21 +0200 Message-ID: From: Monthadar Al Jaberi To: Adrian Chadd Content-Type: multipart/mixed; boundary=f46d0444044c3a938f04be531f69 Cc: monthadar@freebsd.org, freebsd-current , Fabien Thomas , freebsd-mips@freebsd.org Subject: Re: svn commit: r233628 - in head: lib/libpmc sys/amd64/amd64 sys/amd64/include sys/arm/include sys/conf sys/dev/hwpmc sys/i386/i386 sys/i386/include sys/kern sys/mips/include sys/modules/hwpmc sys/pow... X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Apr 2012 06:55:24 -0000 --f46d0444044c3a938f04be531f69 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Mon, Apr 23, 2012 at 8:44 AM, Adrian Chadd wrote: > Hi Fabien, > > I've heard some rumours that this broke hwpmc support for mips24k. > > Monthadar, can you please provide some background info for this? > This is the log output Using default protocol (TFTP) Entry point: 0x80050100, address range: 0x80050000-0x804f1dcc RedBoot> exec Now booting linux kernel: Base address 0x80050000 Entry 0x80050100 memsize=3D0x08000000 modetty0=3D0,n,8,1,hw board=3DRouterStation PRO ethaddr=3D00.15.6d.c8.c9.2e CPU platform: Atheros AR7161 rev 2 CPU Frequency=3D720 MHz CPU DDR Frequency=3D360 MHz CPU AHB Frequency=3D180 MHz platform frequency: 720000000 arguments: a0 =3D 00000002 a1 =3D 80050028 a2 =3D 80050000 a3 =3D 00000001 Cmd line: =EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BDm= =EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF= =BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD_}=EF=BF=BD=EF= =BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=DF=BEq=EF=BF=BD=EF=BF=BD=EF=BF= =BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD= =EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=7F=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD= =EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF= =BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=DF=BF=EF=BF=BD=EF=BF=BD=EF=BF=BD= =EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD_=EF=BF=BDw=EF=BF=BD= =EF=BF=BD=EF=BF=BD=EF=BF=BD=1F=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD= ?-=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD{=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD= =EF=BF=BD=EF=BF=BD~=EF=BF=BD=EF=BF=BD Environment: memsize =3D 0x08000000 modetty0 =3D 0,n,8,1,hw ethaddr =3D 00.15.6d.c8.c9.2e board =3D RouterStation PRO Cache info: picache_stride =3D 4096 picache_loopcount =3D 16 pdcache_stride =3D 4096 pdcache_loopcount =3D 8 cpu0: MIPS Technologies processor v116.147 MMU: Standard TLB, 16 entries L1 i-cache: 4 ways of 512 sets, 32 bytes per line L1 d-cache: 4 ways of 256 sets, 32 bytes per line Config1=3D0x9ee3519e Config3=3D0x20 KDB: debugger backends: ddb KDB: current backend: ddb Copyright (c) 1992-2012 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD is a registered trademark of The FreeBSD Foundation. FreeBSD 10.0-CURRENT #12: Fri Apr 20 18:03:16 CEST 2012 root@freebsd-re-9:/usr/obj/mips.mips/usr/src/sys/RSPRO_USB_PROD mips WARNING: WITNESS option enabled, expect reduced performance. MEMGUARD DEBUGGING ALLOCATOR INITIALIZED: MEMGUARD map base: 0xc0800000 MEMGUARD map limit: 0xc1c00000 MEMGUARD map size: 20480 KBytes real memory =3D 134217728 (131072K bytes) avail memory =3D 123117568 (117MB) random device not loaded; using insecure entropy nexus0: clock0: on nexus0 Timecounter "MIPS32" frequency 360000000 Hz quality 800 Event timer "MIPS32" frequency 360000000 Hz quality 800 apb0 at irq 4 on nexus0 uart0: <16550 or compatible> on apb0 uart0: console (115200,n,8,1) gpio0: on apb0 gpio0: [GIANT-LOCKED] gpio0: gpio pinmask=3D0x0 gpioc0: on gpio0 gpiobus0: on gpio0 ehci0: at mem 0x1b000000-0x1bffffff irq 1 on nexus0 usbus0: set host controller mode usbus0: EHCI version 1.0 usbus0: set host controller mode usbus0 on ehci0 pcib0 at irq 0 on nexus0 pci0: on pcib0 pci0: at device 0.0 (no driver attached) ath0: irq 0 at device 17.0 on pci0 ath0: AR5413 mac 10.5 RF5413 phy 6.1 ath0: 2GHz radio: 0x0000; 5GHz radio: 0x0063 arge0: at mem 0x19000000-0x19000fff irq 2 on nexus0 arge0: No PHY specified, using mask 16 miibus0: on arge0 ukphy0: PHY 4 on miibus0 ukphy0: none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX, 1000baseT-FDX-master, auto arge0: Ethernet address: 00:15:6d:c8:c9:2e arge1: at mem 0x1a000000-0x1a000fff irq 3 on nexus0 arge1: No PHY specified, using mask 15 arge1: Ethernet address: 00:15:6d:c8:c9:2f spi0: at mem 0x1f000000-0x1f00000f on nexus0 spibus0: on spi0 mx25l0: at cs 0 on spibus0 mx25l0: mx25ll128, sector 65536 bytes, 256 sectors ar71xx_wdog0: on nexus0 Timecounters tick every 1.000 msec usbus0: 480Mbps High Speed USB v2.0 ugen0.1: at usbus0 uhub0: on usbus0 panic: [pmc,4816] npmc miscomputed: ri=3D0, md->npmc=3D2 KDB: enter: panic [ thread pid 0 tid 100000 ] Stopped at kdb_enter+0x4c: lui at,0x8050 db> tr Tracing pid 0 tid 100000 td 0x804f76d0 db_trace_thread+30 (?,?,?,?) ra 8068b94800000018 sp 0 sz 0 80075adc+114 (0,?,ffffffff,?) ra 8068b96000000020 sp 100000000 sz 1 80074e24+388 (?,?,?,?) ra 8068b980000000a8 sp 0 sz 0 db_command_loop+70 (?,?,?,?) ra 8068ba2800000018 sp 0 sz 0 80077900+f4 (?,?,?,?) ra 8068ba40000001a8 sp 0 sz 0 kdb_trap+110 (?,?,?,?) ra 8068bbe800000030 sp 0 sz 0 trap+c7c (?,?,?,?) ra 8068bc18000000b8 sp 0 sz 0 MipsKernGenException+134 (0,4,8043b1d4,119) ra 8068bcd0000000c8 sp 100000001 sz 1 kdb_enter+4c (?,?,?,?) ra 8068bd9800000018 sp 0 sz 0 panic+11c (?,12d0,0,2) ra 8068bdb000000028 sp 1 sz 1 800e8ca8+274 (?,?,?,?) ra 8068bdd800000038 sp 0 sz 0 syscall_module_handler+b8 (?,?,?,?) ra 8068be1000000028 sp 0 sz 0 module_register_init+9c (?,?,?,?) ra 8068be3800000028 sp 0 sz 0 mi_startup+138 (?,?,?,?) ra 8068be6000000020 sp 0 sz 0 _start+90 (?,?,?,?) ra 8068be8000000000 sp 0 sz 0 pid 0 db> > Thanks, > > > > adrian > > On 28 March 2012 13:58, Fabien Thomas wrote: >> Author: fabient >> Date: Wed Mar 28 20:58:30 2012 >> New Revision: 233628 >> URL: http://svn.freebsd.org/changeset/base/233628 >> >> Log: >> =C2=A0Add software PMC support. >> >> =C2=A0New kernel events can be added at various location for sampling or= counting. >> =C2=A0This will for example allow easy system profiling whatever the pro= cessor is >> =C2=A0with known tools like pmcstat(8). >> >> =C2=A0Simultaneous usage of software PMC and hardware PMC is possible, f= or example >> =C2=A0looking at the lock acquire failure, page fault while sampling on >> =C2=A0instructions. >> >> =C2=A0Sponsored by: NETASQ >> =C2=A0MFC after: =C2=A0 =C2=A01 month >> >> Added: >> =C2=A0head/lib/libpmc/pmc.soft.3 =C2=A0 (contents, props changed) >> =C2=A0head/sys/dev/hwpmc/hwpmc_soft.c =C2=A0 (contents, props changed) >> =C2=A0head/sys/dev/hwpmc/hwpmc_soft.h =C2=A0 (contents, props changed) >> Modified: >> =C2=A0head/lib/libpmc/Makefile >> =C2=A0head/lib/libpmc/libpmc.c >> =C2=A0head/lib/libpmc/pmc.3 >> =C2=A0head/lib/libpmc/pmc.atom.3 >> =C2=A0head/lib/libpmc/pmc.core.3 >> =C2=A0head/lib/libpmc/pmc.core2.3 >> =C2=A0head/lib/libpmc/pmc.corei7.3 >> =C2=A0head/lib/libpmc/pmc.corei7uc.3 >> =C2=A0head/lib/libpmc/pmc.iaf.3 >> =C2=A0head/lib/libpmc/pmc.k7.3 >> =C2=A0head/lib/libpmc/pmc.k8.3 >> =C2=A0head/lib/libpmc/pmc.mips24k.3 >> =C2=A0head/lib/libpmc/pmc.octeon.3 >> =C2=A0head/lib/libpmc/pmc.p4.3 >> =C2=A0head/lib/libpmc/pmc.p5.3 >> =C2=A0head/lib/libpmc/pmc.p6.3 >> =C2=A0head/lib/libpmc/pmc.sandybridge.3 >> =C2=A0head/lib/libpmc/pmc.sandybridgeuc.3 >> =C2=A0head/lib/libpmc/pmc.tsc.3 >> =C2=A0head/lib/libpmc/pmc.ucf.3 >> =C2=A0head/lib/libpmc/pmc.westmere.3 >> =C2=A0head/lib/libpmc/pmc.westmereuc.3 >> =C2=A0head/lib/libpmc/pmc.xscale.3 >> =C2=A0head/lib/libpmc/pmclog.c >> =C2=A0head/lib/libpmc/pmclog.h >> =C2=A0head/sys/amd64/amd64/trap.c >> =C2=A0head/sys/amd64/include/pmc_mdep.h >> =C2=A0head/sys/arm/include/pmc_mdep.h >> =C2=A0head/sys/conf/files >> =C2=A0head/sys/dev/hwpmc/hwpmc_amd.c >> =C2=A0head/sys/dev/hwpmc/hwpmc_core.c >> =C2=A0head/sys/dev/hwpmc/hwpmc_intel.c >> =C2=A0head/sys/dev/hwpmc/hwpmc_logging.c >> =C2=A0head/sys/dev/hwpmc/hwpmc_mips.c >> =C2=A0head/sys/dev/hwpmc/hwpmc_mod.c >> =C2=A0head/sys/dev/hwpmc/hwpmc_piv.c >> =C2=A0head/sys/dev/hwpmc/hwpmc_powerpc.c >> =C2=A0head/sys/dev/hwpmc/hwpmc_ppro.c >> =C2=A0head/sys/dev/hwpmc/hwpmc_tsc.c >> =C2=A0head/sys/dev/hwpmc/hwpmc_x86.c >> =C2=A0head/sys/dev/hwpmc/hwpmc_xscale.c >> =C2=A0head/sys/dev/hwpmc/pmc_events.h >> =C2=A0head/sys/i386/i386/trap.c >> =C2=A0head/sys/i386/include/pmc_mdep.h >> =C2=A0head/sys/kern/kern_clock.c >> =C2=A0head/sys/kern/kern_lock.c >> =C2=A0head/sys/kern/kern_mutex.c >> =C2=A0head/sys/kern/kern_pmc.c >> =C2=A0head/sys/kern/kern_rwlock.c >> =C2=A0head/sys/kern/kern_sx.c >> =C2=A0head/sys/kern/subr_trap.c >> =C2=A0head/sys/mips/include/pmc_mdep.h >> =C2=A0head/sys/modules/hwpmc/Makefile >> =C2=A0head/sys/powerpc/include/pmc_mdep.h >> =C2=A0head/sys/sys/pmc.h >> =C2=A0head/sys/sys/pmckern.h >> =C2=A0head/sys/sys/pmclog.h >> =C2=A0head/usr.sbin/pmcstat/pmcstat_log.c >> >> Modified: head/lib/libpmc/Makefile >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/lib/libpmc/Makefile =C2=A0 =C2=A0Wed Mar 28 20:49:11 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233627) >> +++ head/lib/libpmc/Makefile =C2=A0 =C2=A0Wed Mar 28 20:58:30 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233628) >> @@ -20,6 +20,7 @@ MAN+=3D pmc_read.3 >> =C2=A0MAN+=3D =C2=A0pmc_set.3 >> =C2=A0MAN+=3D =C2=A0pmc_start.3 >> =C2=A0MAN+=3D =C2=A0pmclog.3 >> +MAN+=3D =C2=A0pmc.soft.3 >> >> =C2=A0# PMC-dependent manual pages >> =C2=A0.if ${MACHINE_CPUARCH} =3D=3D "i386" || ${MACHINE_CPUARCH} =3D=3D = "amd64" >> >> Modified: head/lib/libpmc/libpmc.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/lib/libpmc/libpmc.c =C2=A0 =C2=A0Wed Mar 28 20:49:11 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233627) >> +++ head/lib/libpmc/libpmc.c =C2=A0 =C2=A0Wed Mar 28 20:58:30 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233628) >> @@ -77,11 +77,12 @@ static int tsc_allocate_pmc(enum pmc_eve >> =C2=A0static int xscale_allocate_pmc(enum pmc_event _pe, char *_ctrspec, >> =C2=A0 =C2=A0 struct pmc_op_pmcallocate *_pmc_config); >> =C2=A0#endif >> - >> =C2=A0#if defined(__mips__) >> =C2=A0static int mips_allocate_pmc(enum pmc_event _pe, char* ctrspec, >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct pmc_op_pmcallocate *_pmc_config); >> =C2=A0#endif /* __mips__ */ >> +static int soft_allocate_pmc(enum pmc_event _pe, char *_ctrspec, >> + =C2=A0 =C2=A0struct pmc_op_pmcallocate *_pmc_config); >> >> =C2=A0#if defined(__powerpc__) >> =C2=A0static int ppc7450_allocate_pmc(enum pmc_event _pe, char* ctrspec, >> @@ -156,6 +157,8 @@ PMC_CLASSDEP_TABLE(octeon, OCTEON); >> =C2=A0PMC_CLASSDEP_TABLE(ucf, UCF); >> =C2=A0PMC_CLASSDEP_TABLE(ppc7450, PPC7450); >> >> +static struct pmc_event_descr soft_event_table[PMC_EV_DYN_COUNT]; >> + >> =C2=A0#undef __PMC_EV_ALIAS >> =C2=A0#define =C2=A0 =C2=A0 =C2=A0 =C2=A0__PMC_EV_ALIAS(N,CODE) =C2=A0{ = N, PMC_EV_##CODE }, >> >> @@ -215,21 +218,22 @@ static const struct pmc_event_descr west >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_CLASS_##C, __= VA_ARGS__ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0\ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0} >> >> -PMC_MDEP_TABLE(atom, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC); >> -PMC_MDEP_TABLE(core, IAP, PMC_CLASS_TSC); >> -PMC_MDEP_TABLE(core2, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC); >> -PMC_MDEP_TABLE(corei7, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF= , PMC_CLASS_UCP); >> -PMC_MDEP_TABLE(sandybridge, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLAS= S_UCF, PMC_CLASS_UCP); >> -PMC_MDEP_TABLE(westmere, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_U= CF, PMC_CLASS_UCP); >> -PMC_MDEP_TABLE(k7, K7, PMC_CLASS_TSC); >> -PMC_MDEP_TABLE(k8, K8, PMC_CLASS_TSC); >> -PMC_MDEP_TABLE(p4, P4, PMC_CLASS_TSC); >> -PMC_MDEP_TABLE(p5, P5, PMC_CLASS_TSC); >> -PMC_MDEP_TABLE(p6, P6, PMC_CLASS_TSC); >> -PMC_MDEP_TABLE(xscale, XSCALE, PMC_CLASS_XSCALE); >> -PMC_MDEP_TABLE(mips24k, MIPS24K, PMC_CLASS_MIPS24K); >> -PMC_MDEP_TABLE(octeon, OCTEON, PMC_CLASS_OCTEON); >> -PMC_MDEP_TABLE(ppc7450, PPC7450, PMC_CLASS_PPC7450); >> +PMC_MDEP_TABLE(atom, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC)= ; >> +PMC_MDEP_TABLE(core, IAP, PMC_CLASS_SOFT, PMC_CLASS_TSC); >> +PMC_MDEP_TABLE(core2, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC= ); >> +PMC_MDEP_TABLE(corei7, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TS= C, PMC_CLASS_UCF, PMC_CLASS_UCP); >> +PMC_MDEP_TABLE(sandybridge, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLA= SS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); >> +PMC_MDEP_TABLE(westmere, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_= TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); >> +PMC_MDEP_TABLE(k7, K7, PMC_CLASS_SOFT, PMC_CLASS_TSC); >> +PMC_MDEP_TABLE(k8, K8, PMC_CLASS_SOFT, PMC_CLASS_TSC); >> +PMC_MDEP_TABLE(p4, P4, PMC_CLASS_SOFT, PMC_CLASS_TSC); >> +PMC_MDEP_TABLE(p5, P5, PMC_CLASS_SOFT, PMC_CLASS_TSC); >> +PMC_MDEP_TABLE(p6, P6, PMC_CLASS_SOFT, PMC_CLASS_TSC); >> +PMC_MDEP_TABLE(xscale, XSCALE, PMC_CLASS_SOFT, PMC_CLASS_XSCALE); >> +PMC_MDEP_TABLE(mips24k, MIPS24K, PMC_CLASS_SOFT, PMC_CLASS_MIPS24K); >> +PMC_MDEP_TABLE(octeon, OCTEON, PMC_CLASS_SOFT, PMC_CLASS_OCTEON); >> +PMC_MDEP_TABLE(ppc7450, PPC7450, PMC_CLASS_SOFT, PMC_CLASS_PPC7450); >> +PMC_MDEP_TABLE(generic, SOFT, PMC_CLASS_SOFT); >> >> =C2=A0static const struct pmc_event_descr tsc_event_table[] =3D >> =C2=A0{ >> @@ -279,16 +283,24 @@ PMC_CLASS_TABLE_DESC(tsc, TSC, tsc, tsc) >> =C2=A0#if =C2=A0 =C2=A0defined(__XSCALE__) >> =C2=A0PMC_CLASS_TABLE_DESC(xscale, XSCALE, xscale, xscale); >> =C2=A0#endif >> - >> =C2=A0#if defined(__mips__) >> =C2=A0PMC_CLASS_TABLE_DESC(mips24k, MIPS24K, mips24k, mips); >> =C2=A0PMC_CLASS_TABLE_DESC(octeon, OCTEON, octeon, mips); >> =C2=A0#endif /* __mips__ */ >> - >> =C2=A0#if defined(__powerpc__) >> =C2=A0PMC_CLASS_TABLE_DESC(ppc7450, PPC7450, ppc7450, ppc7450); >> =C2=A0#endif >> >> +static struct pmc_class_descr soft_class_table_descr =3D >> +{ >> + =C2=A0 =C2=A0 =C2=A0 .pm_evc_name =C2=A0=3D "SOFT-", >> + =C2=A0 =C2=A0 =C2=A0 .pm_evc_name_size =3D sizeof("SOFT-") - 1, >> + =C2=A0 =C2=A0 =C2=A0 .pm_evc_class =3D PMC_CLASS_SOFT, >> + =C2=A0 =C2=A0 =C2=A0 .pm_evc_event_table =3D NULL, >> + =C2=A0 =C2=A0 =C2=A0 .pm_evc_event_table_size =3D 0, >> + =C2=A0 =C2=A0 =C2=A0 .pm_evc_allocate_pmc =3D soft_allocate_pmc >> +}; >> + >> =C2=A0#undef PMC_CLASS_TABLE_DESC >> >> =C2=A0static const struct pmc_class_descr **pmc_class_table; >> @@ -343,9 +355,12 @@ static const char * pmc_state_names[] =3D >> =C2=A0 =C2=A0 =C2=A0 =C2=A0__PMC_STATES() >> =C2=A0}; >> >> -static int pmc_syscall =3D -1; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* fi= lled in by pmc_init() */ >> - >> -static struct pmc_cpuinfo cpu_info; =C2=A0 =C2=A0/* filled in by pmc_in= it() */ >> +/* >> + * Filled in by pmc_init(). >> + */ >> +static int pmc_syscall =3D -1; >> +static struct pmc_cpuinfo cpu_info; >> +static struct pmc_op_getdyneventinfo soft_event_info; >> >> =C2=A0/* Event masks for events */ >> =C2=A0struct pmc_masks { >> @@ -2179,6 +2194,25 @@ tsc_allocate_pmc(enum pmc_event pe, char >> =C2=A0} >> =C2=A0#endif >> >> +static struct pmc_event_alias generic_aliases[] =3D { >> + =C2=A0 =C2=A0 =C2=A0 EV_ALIAS("instructions", =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"SOFT-CLOCK.HARD"), >> + =C2=A0 =C2=A0 =C2=A0 EV_ALIAS(NULL, NULL) >> +}; >> + >> +static int >> +soft_allocate_pmc(enum pmc_event pe, char *ctrspec, >> + =C2=A0 =C2=A0struct pmc_op_pmcallocate *pmc_config) >> +{ >> + =C2=A0 =C2=A0 =C2=A0 (void)ctrspec; >> + =C2=A0 =C2=A0 =C2=A0 (void)pmc_config; >> + >> + =C2=A0 =C2=A0 =C2=A0 if (pe < PMC_EV_SOFT_FIRST || pe > PMC_EV_SOFT_LA= ST) >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (-1); >> + >> + =C2=A0 =C2=A0 =C2=A0 pmc_config->pm_caps |=3D (PMC_CAP_READ | PMC_CAP_= WRITE); >> + =C2=A0 =C2=A0 =C2=A0 return (0); >> +} >> + >> =C2=A0#if =C2=A0 =C2=A0defined(__XSCALE__) >> >> =C2=A0static struct pmc_event_alias xscale_aliases[] =3D { >> @@ -2663,6 +2697,10 @@ pmc_event_names_of_class(enum pmc_class >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ev =3D ppc7450_ev= ent_table; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0count =3D PMC_EVE= NT_TABLE_SIZE(ppc7450); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0break; >> + =C2=A0 =C2=A0 =C2=A0 case PMC_CLASS_SOFT: >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ev =3D soft_event_tab= le; >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 count =3D soft_event_= info.pm_nevent; >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0default: >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0errno =3D EINVAL; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return (-1); >> @@ -2676,6 +2714,7 @@ pmc_event_names_of_class(enum pmc_class >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0for (;count--; ev++, names++) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*names =3D ev->pm= _ev_name; >> + >> =C2=A0 =C2=A0 =C2=A0 =C2=A0return (0); >> =C2=A0} >> >> @@ -2780,11 +2819,34 @@ pmc_init(void) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pmc_class_table[n= ] =3D NULL; >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0/* >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0* Get soft events list. >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0*/ >> + =C2=A0 =C2=A0 =C2=A0 soft_event_info.pm_class =3D PMC_CLASS_SOFT; >> + =C2=A0 =C2=A0 =C2=A0 if (PMC_CALL(GETDYNEVENTINFO, &soft_event_info) <= 0) >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (pmc_syscall = =3D -1); >> + >> + =C2=A0 =C2=A0 =C2=A0 /* Map soft events to static list. */ >> + =C2=A0 =C2=A0 =C2=A0 for (n =3D 0; n < soft_event_info.pm_nevent; n++)= { >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 soft_event_table[n].p= m_ev_name =3D >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 soft_ev= ent_info.pm_events[n].pm_ev_name; >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 soft_event_table[n].p= m_ev_code =3D >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 soft_ev= ent_info.pm_events[n].pm_ev_code; >> + =C2=A0 =C2=A0 =C2=A0 } >> + =C2=A0 =C2=A0 =C2=A0 soft_class_table_descr.pm_evc_event_table_size = =3D \ >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 soft_event_info.pm_nevent; >> + =C2=A0 =C2=A0 =C2=A0 soft_class_table_descr.pm_evc_event_table =3D \ >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 soft_event_table; >> + >> + =C2=A0 =C2=A0 =C2=A0 /* >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 * Fill in the class table. >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 */ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0n =3D 0; >> + >> + =C2=A0 =C2=A0 =C2=A0 /* Fill soft events information. */ >> + =C2=A0 =C2=A0 =C2=A0 pmc_class_table[n++] =3D &soft_class_table_descr; >> =C2=A0#if defined(__amd64__) || defined(__i386__) >> - =C2=A0 =C2=A0 =C2=A0 pmc_class_table[n++] =3D &tsc_class_table_descr; >> + =C2=A0 =C2=A0 =C2=A0 if (cpu_info.pm_cputype !=3D PMC_CPU_GENERIC) >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pmc_class_table[n++] = =3D &tsc_class_table_descr; >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0/* >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 * Check if this CPU has fixed function count= ers. >> @@ -2867,6 +2929,9 @@ pmc_init(void) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pmc_class_table[n= ] =3D &p4_class_table_descr; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0break; >> =C2=A0#endif >> + =C2=A0 =C2=A0 =C2=A0 case PMC_CPU_GENERIC: >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PMC_MDEP_INIT(generic= ); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break; >> =C2=A0#if defined(__XSCALE__) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0case PMC_CPU_INTEL_XSCALE: >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_MDEP_INIT(xsc= ale); >> @@ -3035,18 +3100,19 @@ _pmc_name_of_event(enum pmc_event pe, en >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0evfence =3D xscal= e_event_table + PMC_EVENT_TABLE_SIZE(xscale); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0} else if (pe >=3D PMC_EV_MIPS24K_FIRST && pe= <=3D PMC_EV_MIPS24K_LAST) { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ev =3D mips24k_ev= ent_table; >> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 evfence =3D mips24k_e= vent_table + PMC_EVENT_TABLE_SIZE(mips24k >> -); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 evfence =3D mips24k_e= vent_table + PMC_EVENT_TABLE_SIZE(mips24k); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0} else if (pe >=3D PMC_EV_OCTEON_FIRST && pe = <=3D PMC_EV_OCTEON_LAST) { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ev =3D octeon_eve= nt_table; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0evfence =3D octeo= n_event_table + PMC_EVENT_TABLE_SIZE(octeon); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0} else if (pe >=3D PMC_EV_PPC7450_FIRST && pe= <=3D PMC_EV_PPC7450_LAST) { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ev =3D ppc7450_ev= ent_table; >> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 evfence =3D ppc7450_e= vent_table + PMC_EVENT_TABLE_SIZE(ppc7450 >> -); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 evfence =3D ppc7450_e= vent_table + PMC_EVENT_TABLE_SIZE(ppc7450); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0} else if (pe =3D=3D PMC_EV_TSC_TSC) { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ev =3D tsc_event_= table; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0evfence =3D tsc_e= vent_table + PMC_EVENT_TABLE_SIZE(tsc); >> + =C2=A0 =C2=A0 =C2=A0 } else if (pe >=3D PMC_EV_SOFT_FIRST && pe <=3D P= MC_EV_SOFT_LAST) { >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ev =3D soft_event_tab= le; >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 evfence =3D soft_even= t_table + soft_event_info.pm_nevent; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0} >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0for (; ev !=3D evfence; ev++) >> >> Modified: head/lib/libpmc/pmc.3 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/lib/libpmc/pmc.3 =C2=A0 =C2=A0 =C2=A0 Wed Mar 28 20:49:11 2012 = =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233627) >> +++ head/lib/libpmc/pmc.3 =C2=A0 =C2=A0 =C2=A0 Wed Mar 28 20:58:30 2012 = =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233628) >> @@ -223,6 +223,8 @@ and >> =C2=A0CPUs. >> =C2=A0.It Li PMC_CLASS_TSC >> =C2=A0The timestamp counter on i386 and amd64 architecture CPUs. >> +.It Li PMC_CLASS_SOFT >> +Software events. >> =C2=A0.El >> =C2=A0.Ss PMC Capabilities >> =C2=A0Capabilities of performance monitoring hardware are denoted using >> @@ -525,6 +527,7 @@ API is >> =C2=A0.Xr pmc.p4 3 , >> =C2=A0.Xr pmc.p5 3 , >> =C2=A0.Xr pmc.p6 3 , >> +.Xr pmc.soft 3 , >> =C2=A0.Xr pmc.tsc 3 , >> =C2=A0.Xr pmclog 3 , >> =C2=A0.Xr hwpmc 4 , >> >> Modified: head/lib/libpmc/pmc.atom.3 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/lib/libpmc/pmc.atom.3 =C2=A0Wed Mar 28 20:49:11 2012 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(r233627) >> +++ head/lib/libpmc/pmc.atom.3 =C2=A0Wed Mar 28 20:58:30 2012 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(r233628) >> @@ -1176,6 +1176,7 @@ and the underlying hardware events used >> =C2=A0.Xr pmc.p4 3 , >> =C2=A0.Xr pmc.p5 3 , >> =C2=A0.Xr pmc.p6 3 , >> +.Xr pmc.soft 3 , >> =C2=A0.Xr pmc.tsc 3 , >> =C2=A0.Xr pmc_cpuinfo 3 , >> =C2=A0.Xr pmclog 3 , >> >> Modified: head/lib/libpmc/pmc.core.3 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/lib/libpmc/pmc.core.3 =C2=A0Wed Mar 28 20:49:11 2012 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(r233627) >> +++ head/lib/libpmc/pmc.core.3 =C2=A0Wed Mar 28 20:58:30 2012 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(r233628) >> @@ -792,6 +792,7 @@ may not count some transitions. >> =C2=A0.Xr pmc.p4 3 , >> =C2=A0.Xr pmc.p5 3 , >> =C2=A0.Xr pmc.p6 3 , >> +.Xr pmc.soft 3 , >> =C2=A0.Xr pmc.tsc 3 , >> =C2=A0.Xr pmclog 3 , >> =C2=A0.Xr hwpmc 4 >> >> Modified: head/lib/libpmc/pmc.core2.3 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/lib/libpmc/pmc.core2.3 Wed Mar 28 20:49:11 2012 =C2=A0 =C2=A0 = =C2=A0 =C2=A0(r233627) >> +++ head/lib/libpmc/pmc.core2.3 Wed Mar 28 20:58:30 2012 =C2=A0 =C2=A0 = =C2=A0 =C2=A0(r233628) >> @@ -1107,6 +1107,7 @@ and the underlying hardware events used. >> =C2=A0.Xr pmc.p4 3 , >> =C2=A0.Xr pmc.p5 3 , >> =C2=A0.Xr pmc.p6 3 , >> +.Xr pmc.soft 3 , >> =C2=A0.Xr pmc.tsc 3 , >> =C2=A0.Xr pmc_cpuinfo 3 , >> =C2=A0.Xr pmclog 3 , >> >> Modified: head/lib/libpmc/pmc.corei7.3 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/lib/libpmc/pmc.corei7.3 =C2=A0 =C2=A0 =C2=A0 =C2=A0Wed Mar 28 2= 0:49:11 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233627) >> +++ head/lib/libpmc/pmc.corei7.3 =C2=A0 =C2=A0 =C2=A0 =C2=A0Wed Mar 28 2= 0:58:30 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233628) >> @@ -1559,6 +1559,7 @@ Counts number of segment register loads. >> =C2=A0.Xr pmc.corei7uc 3 , >> =C2=A0.Xr pmc.westmere 3 , >> =C2=A0.Xr pmc.westmereuc 3 , >> +.Xr pmc.soft 3 , >> =C2=A0.Xr pmc.tsc 3 , >> =C2=A0.Xr pmc_cpuinfo 3 , >> =C2=A0.Xr pmclog 3 , >> >> Modified: head/lib/libpmc/pmc.corei7uc.3 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/lib/libpmc/pmc.corei7uc.3 =C2=A0 =C2=A0 =C2=A0Wed Mar 28 20:49:= 11 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233627) >> +++ head/lib/libpmc/pmc.corei7uc.3 =C2=A0 =C2=A0 =C2=A0Wed Mar 28 20:58:= 30 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233628) >> @@ -863,6 +863,7 @@ refreshed or needs to go into a power do >> =C2=A0.Xr pmc.corei7 3 , >> =C2=A0.Xr pmc.westmere 3 , >> =C2=A0.Xr pmc.westmereuc 3 , >> +.Xr pmc.soft 3 , >> =C2=A0.Xr pmc.tsc 3 , >> =C2=A0.Xr pmc_cpuinfo 3 , >> =C2=A0.Xr pmclog 3 , >> >> Modified: head/lib/libpmc/pmc.iaf.3 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/lib/libpmc/pmc.iaf.3 =C2=A0 Wed Mar 28 20:49:11 2012 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(r233627) >> +++ head/lib/libpmc/pmc.iaf.3 =C2=A0 Wed Mar 28 20:58:30 2012 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(r233628) >> @@ -132,6 +132,7 @@ CPU, use the event specifier >> =C2=A0.Xr pmc.p4 3 , >> =C2=A0.Xr pmc.p5 3 , >> =C2=A0.Xr pmc.p6 3 , >> +.Xr pmc.soft 3 , >> =C2=A0.Xr pmc.tsc 3 , >> =C2=A0.Xr pmc_cpuinfo 3 , >> =C2=A0.Xr pmclog 3 , >> >> Modified: head/lib/libpmc/pmc.k7.3 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/lib/libpmc/pmc.k7.3 =C2=A0 =C2=A0Wed Mar 28 20:49:11 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233627) >> +++ head/lib/libpmc/pmc.k7.3 =C2=A0 =C2=A0Wed Mar 28 20:58:30 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233628) >> @@ -249,6 +249,7 @@ and the underlying hardware events used. >> =C2=A0.Xr pmc.p4 3 , >> =C2=A0.Xr pmc.p5 3 , >> =C2=A0.Xr pmc.p6 3 , >> +.Xr pmc.soft 3 , >> =C2=A0.Xr pmc.tsc 3 , >> =C2=A0.Xr pmclog 3 , >> =C2=A0.Xr hwpmc 4 >> >> Modified: head/lib/libpmc/pmc.k8.3 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/lib/libpmc/pmc.k8.3 =C2=A0 =C2=A0Wed Mar 28 20:49:11 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233627) >> +++ head/lib/libpmc/pmc.k8.3 =C2=A0 =C2=A0Wed Mar 28 20:58:30 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233628) >> @@ -783,6 +783,7 @@ and the underlying hardware events used. >> =C2=A0.Xr pmc.p4 3 , >> =C2=A0.Xr pmc.p5 3 , >> =C2=A0.Xr pmc.p6 3 , >> +.Xr pmc.soft 3 , >> =C2=A0.Xr pmc.tsc 3 , >> =C2=A0.Xr pmclog 3 , >> =C2=A0.Xr hwpmc 4 >> >> Modified: head/lib/libpmc/pmc.mips24k.3 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/lib/libpmc/pmc.mips24k.3 =C2=A0 =C2=A0 =C2=A0 Wed Mar 28 20:49:= 11 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233627) >> +++ head/lib/libpmc/pmc.mips24k.3 =C2=A0 =C2=A0 =C2=A0 Wed Mar 28 20:58:= 30 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233628) >> @@ -392,6 +392,7 @@ and the underlying hardware events used. >> =C2=A0.Xr pmc.p4 3 , >> =C2=A0.Xr pmc.p5 3 , >> =C2=A0.Xr pmc.p6 3 , >> +.Xr pmc.soft 3 , >> =C2=A0.Xr pmc.tsc 3 , >> =C2=A0.Xr pmc_cpuinfo 3 , >> =C2=A0.Xr pmclog 3 , >> >> Modified: head/lib/libpmc/pmc.octeon.3 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/lib/libpmc/pmc.octeon.3 =C2=A0 =C2=A0 =C2=A0 =C2=A0Wed Mar 28 2= 0:49:11 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233627) >> +++ head/lib/libpmc/pmc.octeon.3 =C2=A0 =C2=A0 =C2=A0 =C2=A0Wed Mar 28 2= 0:58:30 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233628) >> @@ -232,6 +232,7 @@ and the underlying hardware events used. >> =C2=A0.Xr pmc.p4 3 , >> =C2=A0.Xr pmc.p5 3 , >> =C2=A0.Xr pmc.p6 3 , >> +.Xr pmc.soft 3 , >> =C2=A0.Xr pmc.tsc 3 , >> =C2=A0.Xr pmc_cpuinfo 3 , >> =C2=A0.Xr pmclog 3 , >> >> Modified: head/lib/libpmc/pmc.p4.3 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/lib/libpmc/pmc.p4.3 =C2=A0 =C2=A0Wed Mar 28 20:49:11 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233627) >> +++ head/lib/libpmc/pmc.p4.3 =C2=A0 =C2=A0Wed Mar 28 20:58:30 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233628) >> @@ -1208,6 +1208,7 @@ and the underlying hardware events used. >> =C2=A0.Xr pmc.k8 3 , >> =C2=A0.Xr pmc.p5 3 , >> =C2=A0.Xr pmc.p6 3 , >> +.Xr pmc.soft 3 , >> =C2=A0.Xr pmc.tsc 3 , >> =C2=A0.Xr pmclog 3 , >> =C2=A0.Xr hwpmc 4 >> >> Modified: head/lib/libpmc/pmc.p5.3 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/lib/libpmc/pmc.p5.3 =C2=A0 =C2=A0Wed Mar 28 20:49:11 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233627) >> +++ head/lib/libpmc/pmc.p5.3 =C2=A0 =C2=A0Wed Mar 28 20:58:30 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233628) >> @@ -444,6 +444,7 @@ and the underlying hardware events used. >> =C2=A0.Xr pmc.k8 3 , >> =C2=A0.Xr pmc.p4 3 , >> =C2=A0.Xr pmc.p6 3 , >> +.Xr pmc.soft 3 , >> =C2=A0.Xr pmc.tsc 3 , >> =C2=A0.Xr pmclog 3 , >> =C2=A0.Xr hwpmc 4 >> >> Modified: head/lib/libpmc/pmc.p6.3 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/lib/libpmc/pmc.p6.3 =C2=A0 =C2=A0Wed Mar 28 20:49:11 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233627) >> +++ head/lib/libpmc/pmc.p6.3 =C2=A0 =C2=A0Wed Mar 28 20:58:30 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233628) >> @@ -1010,6 +1010,7 @@ and the underlying hardware events used. >> =C2=A0.Xr pmc.k8 3 , >> =C2=A0.Xr pmc.p4 3 , >> =C2=A0.Xr pmc.p5 3 , >> +.Xr pmc.soft 3 , >> =C2=A0.Xr pmc.tsc 3 , >> =C2=A0.Xr pmclog 3 , >> =C2=A0.Xr hwpmc 4 >> >> Modified: head/lib/libpmc/pmc.sandybridge.3 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/lib/libpmc/pmc.sandybridge.3 =C2=A0 Wed Mar 28 20:49:11 2012 = =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233627) >> +++ head/lib/libpmc/pmc.sandybridge.3 =C2=A0 Wed Mar 28 20:58:30 2012 = =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233628) >> @@ -907,6 +907,7 @@ Split locks in SQ. >> =C2=A0.Xr pmc.p5 3 , >> =C2=A0.Xr pmc.p6 3 , >> =C2=A0.Xr pmc.sandybridgeuc 3 , >> +.Xr pmc.soft 3 , >> =C2=A0.Xr pmc.tsc 3 , >> =C2=A0.Xr pmc.ucf 3 , >> =C2=A0.Xr pmc.westmere 3 , >> >> Modified: head/lib/libpmc/pmc.sandybridgeuc.3 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/lib/libpmc/pmc.sandybridgeuc.3 Wed Mar 28 20:49:11 2012 =C2=A0 = =C2=A0 =C2=A0 =C2=A0(r233627) >> +++ head/lib/libpmc/pmc.sandybridgeuc.3 Wed Mar 28 20:58:30 2012 =C2=A0 = =C2=A0 =C2=A0 =C2=A0(r233628) >> @@ -208,6 +208,7 @@ Counts the number of core-outgoing entri >> =C2=A0.Xr pmc.p5 3 , >> =C2=A0.Xr pmc.p6 3 , >> =C2=A0.Xr pmc.sandybridge 3 , >> +.Xr pmc.soft 3 , >> =C2=A0.Xr pmc.tsc 3 , >> =C2=A0.Xr pmc.ucf 3 , >> =C2=A0.Xr pmc.westmere 3 , >> >> Added: head/lib/libpmc/pmc.soft.3 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- /dev/null =C2=A0 00:00:00 1970 =C2=A0 (empty, because file is newly = added) >> +++ head/lib/libpmc/pmc.soft.3 =C2=A0Wed Mar 28 20:58:30 2012 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(r233628) >> @@ -0,0 +1,104 @@ >> +.\" Copyright (c) 2012 Fabien Thomas. =C2=A0All rights reserved. >> +.\" >> +.\" Redistribution and use in source and binary forms, with or without >> +.\" modification, are permitted provided that the following conditions >> +.\" are met: >> +.\" 1. Redistributions of source code must retain the above copyright >> +.\" =C2=A0 =C2=A0notice, this list of conditions and the following disc= laimer. >> +.\" 2. Redistributions in binary form must reproduce the above copyrigh= t >> +.\" =C2=A0 =C2=A0notice, this list of conditions and the following disc= laimer in the >> +.\" =C2=A0 =C2=A0documentation and/or other materials provided with the= distribution. >> +.\" >> +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' = AND >> +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, T= HE >> +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR = PURPOSE >> +.\" ARE DISCLAIMED. =C2=A0IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS = BE LIABLE >> +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQ= UENTIAL >> +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE G= OODS >> +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTIO= N) >> +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,= STRICT >> +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN A= NY WAY >> +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY= OF >> +.\" SUCH DAMAGE. >> +.\" >> +.\" $FreeBSD$ >> +.\" >> +.Dd March 28, 2012 >> +.Os >> +.Dt PMC.SOFT 3 >> +.Sh NAME >> +.Nm pmc.soft >> +.Nd measurements using software based events >> +.Sh LIBRARY >> +.Lb libpmc >> +.Sh SYNOPSIS >> +.In pmc.h >> +.Sh DESCRIPTION >> +Software events are used to collect various source of software events. >> +.Ss PMC Features >> +16 sampling counters using software events based on various sources. >> +These PMCs support the following capabilities: >> +.Bl -column "PMC_CAP_INTERRUPT" "Support" >> +.It Em Capability Ta Em Support >> +.It PMC_CAP_CASCADE Ta \&No >> +.It PMC_CAP_EDGE Ta \&No >> +.It PMC_CAP_INTERRUPT Ta Yes >> +.It PMC_CAP_INVERT Ta \&No >> +.It PMC_CAP_READ Ta Yes >> +.It PMC_CAP_PRECISE Ta \&No >> +.It PMC_CAP_SYSTEM Ta Yes >> +.It PMC_CAP_TAGGING Ta \&No >> +.It PMC_CAP_THRESHOLD Ta \&No >> +.It PMC_CAP_USER Ta Yes >> +.It PMC_CAP_WRITE Ta Yes >> +.El >> +.Ss Event Qualifiers >> +There is no supported event qualifier. >> +.Pp >> +The event specifiers supported by software are: >> +.Bl -tag -width indent >> +.It Li CLOCK.HARD >> +Hard clock ticks. >> +.It Li CLOCK.STAT >> +Stat clock ticks. >> +.It Li LOCK.FAILED >> +Lock acquisition failed. >> +.It Li PAGE_FAULT.ALL >> +All page fault type. >> +.It Li PAGE_FAULT.READ >> +Read page fault. >> +.It Li PAGE_FAULT.WRITE >> +Write page fault. >> +.El >> +.Sh SEE ALSO >> +.Xr pmc 3 , >> +.Xr pmc.atom 3 , >> +.Xr pmc.core 3 , >> +.Xr pmc.iaf 3 , >> +.Xr pmc.ucf 3 , >> +.Xr pmc.k7 3 , >> +.Xr pmc.k8 3 , >> +.Xr pmc.p4 3 , >> +.Xr pmc.p5 3 , >> +.Xr pmc.p6 3 , >> +.Xr pmc.corei7 3 , >> +.Xr pmc.corei7uc 3 , >> +.Xr pmc.westmereuc 3 , >> +.Xr pmc.tsc 3 , >> +.Xr pmc_cpuinfo 3 , >> +.Xr pmclog 3 , >> +.Xr hwpmc 4 >> +.Sh HISTORY >> +The >> +.Nm pmc >> +library first appeared in >> +.Fx 6.0 . >> +.Sh AUTHORS >> +The >> +.Lb libpmc >> +library was written by >> +.An "Joseph Koshy" >> +.Aq jkoshy@FreeBSD.org . >> +Software PMC was written by >> +.An "Fabien Thomas" >> +.Aq fabient@FreeBSD.org . >> >> Modified: head/lib/libpmc/pmc.tsc.3 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/lib/libpmc/pmc.tsc.3 =C2=A0 Wed Mar 28 20:49:11 2012 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(r233627) >> +++ head/lib/libpmc/pmc.tsc.3 =C2=A0 Wed Mar 28 20:58:30 2012 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(r233628) >> @@ -68,6 +68,7 @@ maps to the TSC. >> =C2=A0.Xr pmc.p4 3 , >> =C2=A0.Xr pmc.p5 3 , >> =C2=A0.Xr pmc.p6 3 , >> +.Xr pmc.soft 3 , >> =C2=A0.Xr pmclog 3 , >> =C2=A0.Xr hwpmc 4 >> =C2=A0.Sh HISTORY >> >> Modified: head/lib/libpmc/pmc.ucf.3 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/lib/libpmc/pmc.ucf.3 =C2=A0 Wed Mar 28 20:49:11 2012 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(r233627) >> +++ head/lib/libpmc/pmc.ucf.3 =C2=A0 Wed Mar 28 20:58:30 2012 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(r233628) >> @@ -96,6 +96,7 @@ offset C0H under device number 0 and Fun >> =C2=A0.Xr pmc.corei7uc 3 , >> =C2=A0.Xr pmc.westmere 3 , >> =C2=A0.Xr pmc.westmereuc 3 , >> +.Xr pmc.soft 3 , >> =C2=A0.Xr pmc.tsc 3 , >> =C2=A0.Xr pmc_cpuinfo 3 , >> =C2=A0.Xr pmclog 3 , >> >> Modified: head/lib/libpmc/pmc.westmere.3 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/lib/libpmc/pmc.westmere.3 =C2=A0 =C2=A0 =C2=A0Wed Mar 28 20:49:= 11 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233627) >> +++ head/lib/libpmc/pmc.westmere.3 =C2=A0 =C2=A0 =C2=A0Wed Mar 28 20:58:= 30 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233628) >> @@ -1381,6 +1381,7 @@ Counts number of SID integer 64 bit shif >> =C2=A0.Xr pmc.corei7 3 , >> =C2=A0.Xr pmc.corei7uc 3 , >> =C2=A0.Xr pmc.westmereuc 3 , >> +.Xr pmc.soft 3 , >> =C2=A0.Xr pmc.tsc 3 , >> =C2=A0.Xr pmc_cpuinfo 3 , >> =C2=A0.Xr pmclog 3 , >> >> Modified: head/lib/libpmc/pmc.westmereuc.3 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/lib/libpmc/pmc.westmereuc.3 =C2=A0 =C2=A0Wed Mar 28 20:49:11 20= 12 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233627) >> +++ head/lib/libpmc/pmc.westmereuc.3 =C2=A0 =C2=A0Wed Mar 28 20:58:30 20= 12 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233628) >> @@ -1066,6 +1066,7 @@ disabled. >> =C2=A0.Xr pmc.corei7 3 , >> =C2=A0.Xr pmc.corei7uc 3 , >> =C2=A0.Xr pmc.westmere 3 , >> +.Xr pmc.soft 3 , >> =C2=A0.Xr pmc.tsc 3 , >> =C2=A0.Xr pmc_cpuinfo 3 , >> =C2=A0.Xr pmclog 3 , >> >> Modified: head/lib/libpmc/pmc.xscale.3 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/lib/libpmc/pmc.xscale.3 =C2=A0 =C2=A0 =C2=A0 =C2=A0Wed Mar 28 2= 0:49:11 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233627) >> +++ head/lib/libpmc/pmc.xscale.3 =C2=A0 =C2=A0 =C2=A0 =C2=A0Wed Mar 28 2= 0:58:30 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233628) >> @@ -134,6 +134,7 @@ and the underlying hardware events used. >> =C2=A0.Xr pmc 3 , >> =C2=A0.Xr pmc_cpuinfo 3 , >> =C2=A0.Xr pmclog 3 , >> +.Xr pmc.soft 3 , >> =C2=A0.Xr hwpmc 4 >> =C2=A0.Sh HISTORY >> =C2=A0The >> >> Modified: head/lib/libpmc/pmclog.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/lib/libpmc/pmclog.c =C2=A0 =C2=A0Wed Mar 28 20:49:11 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233627) >> +++ head/lib/libpmc/pmclog.c =C2=A0 =C2=A0Wed Mar 28 20:58:30 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233628) >> @@ -369,6 +369,12 @@ pmclog_get_event(void *cookie, char **da >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D= =3D NULL) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0goto error; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0break; >> + =C2=A0 =C2=A0 =C2=A0 case PMCLOG_TYPE_PMCALLOCATEDYN: >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PMCLOG_READ32(le,ev->= pl_u.pl_ad.pl_pmcid); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PMCLOG_READ32(le,ev->= pl_u.pl_ad.pl_event); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PMCLOG_READ32(le,ev->= pl_u.pl_ad.pl_flags); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PMCLOG_READSTRING(le,= ev->pl_u.pl_ad.pl_evname,PMC_NAME_MAX); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0case PMCLOG_TYPE_PMCATTACH: >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0PMCLOG_GET_PATHLE= N(pathlen,evlen,pmclog_pmcattach); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0PMCLOG_READ32(le,= ev->pl_u.pl_t.pl_pmcid); >> >> Modified: head/lib/libpmc/pmclog.h >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/lib/libpmc/pmclog.h =C2=A0 =C2=A0Wed Mar 28 20:49:11 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233627) >> +++ head/lib/libpmc/pmclog.h =C2=A0 =C2=A0Wed Mar 28 20:58:30 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233628) >> @@ -88,6 +88,13 @@ struct pmclog_ev_pmcallocate { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0pmc_id_t =C2=A0 =C2=A0 =C2=A0 =C2=A0pl_pmcid; >> =C2=A0}; >> >> +struct pmclog_ev_pmcallocatedyn { >> + =C2=A0 =C2=A0 =C2=A0 uint32_t =C2=A0 =C2=A0 =C2=A0 =C2=A0pl_event; >> + =C2=A0 =C2=A0 =C2=A0 char =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pl_= evname[PMC_NAME_MAX]; >> + =C2=A0 =C2=A0 =C2=A0 uint32_t =C2=A0 =C2=A0 =C2=A0 =C2=A0pl_flags; >> + =C2=A0 =C2=A0 =C2=A0 pmc_id_t =C2=A0 =C2=A0 =C2=A0 =C2=A0pl_pmcid; >> +}; >> + >> =C2=A0struct pmclog_ev_pmcattach { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0pmc_id_t =C2=A0 =C2=A0 =C2=A0 =C2=A0pl_pmcid; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0pid_t =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pl_p= id; >> @@ -146,6 +153,7 @@ struct pmclog_ev { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0struct pmclog_ev_= map_out =C2=A0 =C2=A0 =C2=A0 =C2=A0pl_mo; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0struct pmclog_ev_= pcsample =C2=A0 =C2=A0 =C2=A0 pl_s; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0struct pmclog_ev_= pmcallocate =C2=A0 =C2=A0pl_a; >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct pmclog_ev_pmca= llocatedyn pl_ad; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0struct pmclog_ev_= pmcattach =C2=A0 =C2=A0 =C2=A0pl_t; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0struct pmclog_ev_= pmcdetach =C2=A0 =C2=A0 =C2=A0pl_d; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0struct pmclog_ev_= proccsw =C2=A0 =C2=A0 =C2=A0 =C2=A0pl_c; >> >> Modified: head/sys/amd64/amd64/trap.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/sys/amd64/amd64/trap.c Wed Mar 28 20:49:11 2012 =C2=A0 =C2=A0 = =C2=A0 =C2=A0(r233627) >> +++ head/sys/amd64/amd64/trap.c Wed Mar 28 20:58:30 2012 =C2=A0 =C2=A0 = =C2=A0 =C2=A0(r233628) >> @@ -71,6 +71,9 @@ __FBSDID("$FreeBSD$"); >> =C2=A0#include >> =C2=A0#ifdef HWPMC_HOOKS >> =C2=A0#include >> +PMC_SOFT_DEFINE( , , page_fault, all); >> +PMC_SOFT_DEFINE( , , page_fault, read); >> +PMC_SOFT_DEFINE( , , page_fault, write); >> =C2=A0#endif >> >> =C2=A0#include >> @@ -743,8 +746,20 @@ trap_pfault(frame, usermode) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 */ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0rv =3D vm_fault(m= ap, va, ftype, VM_FAULT_NORMAL); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0} >> - =C2=A0 =C2=A0 =C2=A0 if (rv =3D=3D KERN_SUCCESS) >> + =C2=A0 =C2=A0 =C2=A0 if (rv =3D=3D KERN_SUCCESS) { >> +#ifdef HWPMC_HOOKS >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (ftype =3D=3D VM_P= ROT_READ || ftype =3D=3D VM_PROT_WRITE) { >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 PMC_SOFT_CALL_TF( , , page_fault, all, frame); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 if (ftype =3D=3D VM_PROT_READ) >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PMC_SOFT_CALL_TF( , , page_fault, read, >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 frame); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 else >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PMC_SOFT_CALL_TF( , , page_fault, write, >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 frame); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } >> +#endif >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return (0); >> + =C2=A0 =C2=A0 =C2=A0 } >> =C2=A0nogo: >> =C2=A0 =C2=A0 =C2=A0 =C2=A0if (!usermode) { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (td->td_intr_n= esting_level =3D=3D 0 && >> >> Modified: head/sys/amd64/include/pmc_mdep.h >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/sys/amd64/include/pmc_mdep.h =C2=A0 Wed Mar 28 20:49:11 2012 = =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233627) >> +++ head/sys/amd64/include/pmc_mdep.h =C2=A0 Wed Mar 28 20:58:30 2012 = =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233628) >> @@ -50,13 +50,13 @@ struct pmc_mdep; >> =C2=A0* measurement architecture have PMCs of the following classes: TSC= , >> =C2=A0* IAF, IAP, UCF and UCP. >> =C2=A0*/ >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_MDEP_CLASS_INDEX_TSC =C2=A0 =C2= =A0 =C2=A0 =C2=A00 >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_MDEP_CLASS_INDEX_K8 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 1 >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_MDEP_CLASS_INDEX_P4 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 1 >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_MDEP_CLASS_INDEX_IAP =C2=A0 =C2= =A0 =C2=A0 =C2=A01 >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_MDEP_CLASS_INDEX_IAF =C2=A0 =C2= =A0 =C2=A0 =C2=A02 >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_MDEP_CLASS_INDEX_UCP =C2=A0 =C2= =A0 =C2=A0 =C2=A03 >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_MDEP_CLASS_INDEX_UCF =C2=A0 =C2= =A0 =C2=A0 =C2=A04 >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_MDEP_CLASS_INDEX_TSC =C2=A0 =C2= =A0 =C2=A0 =C2=A01 >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_MDEP_CLASS_INDEX_K8 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 2 >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_MDEP_CLASS_INDEX_P4 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 2 >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_MDEP_CLASS_INDEX_IAP =C2=A0 =C2= =A0 =C2=A0 =C2=A02 >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_MDEP_CLASS_INDEX_IAF =C2=A0 =C2= =A0 =C2=A0 =C2=A03 >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_MDEP_CLASS_INDEX_UCP =C2=A0 =C2= =A0 =C2=A0 =C2=A04 >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_MDEP_CLASS_INDEX_UCF =C2=A0 =C2= =A0 =C2=A0 =C2=A05 >> >> =C2=A0/* >> =C2=A0* On the amd64 platform we support the following PMCs. >> @@ -119,6 +119,15 @@ union pmc_md_pmc { >> >> =C2=A0#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_IN_USERSPACE(va) ((va) <=3D= VM_MAXUSER_ADDRESS) >> >> +/* Build a fake kernel trapframe from current instruction pointer. */ >> +#define PMC_FAKE_TRAPFRAME(TF) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ >> + =C2=A0 =C2=A0 =C2=A0 do { =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0\ >> + =C2=A0 =C2=A0 =C2=A0 (TF)->tf_cs =3D 0; (TF)->tf_rflags =3D 0; =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 \ >> + =C2=A0 =C2=A0 =C2=A0 __asm __volatile("movq %%rbp,%0" : "=3Dr" ((TF)->= tf_rbp)); =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >> + =C2=A0 =C2=A0 =C2=A0 __asm __volatile("movq %%rsp,%0" : "=3Dr" ((TF)->= tf_rsp)); =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >> + =C2=A0 =C2=A0 =C2=A0 __asm __volatile("call 1f \n\t1: pop %0" : "=3Dr"= ((TF)->tf_rip)); \ >> + =C2=A0 =C2=A0 =C2=A0 } while (0) >> + >> =C2=A0/* >> =C2=A0* Prototypes >> =C2=A0*/ >> >> Modified: head/sys/arm/include/pmc_mdep.h >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/sys/arm/include/pmc_mdep.h =C2=A0 =C2=A0 Wed Mar 28 20:49:11 20= 12 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233627) >> +++ head/sys/arm/include/pmc_mdep.h =C2=A0 =C2=A0 Wed Mar 28 20:58:30 20= 12 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233628) >> @@ -29,7 +29,7 @@ >> =C2=A0#ifndef _MACHINE_PMC_MDEP_H_ >> =C2=A0#define =C2=A0 =C2=A0 =C2=A0 =C2=A0_MACHINE_PMC_MDEP_H_ >> >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_MDEP_CLASS_INDEX_XSCALE =C2=A0 = =C2=A0 0 >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_MDEP_CLASS_INDEX_XSCALE =C2=A0 = =C2=A0 1 >> =C2=A0/* >> =C2=A0* On the ARM platform we support the following PMCs. >> =C2=A0* >> >> Modified: head/sys/conf/files >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/sys/conf/files Wed Mar 28 20:49:11 2012 =C2=A0 =C2=A0 =C2=A0 = =C2=A0(r233627) >> +++ head/sys/conf/files Wed Mar 28 20:58:30 2012 =C2=A0 =C2=A0 =C2=A0 = =C2=A0(r233628) >> @@ -1260,6 +1260,7 @@ dev/hme/if_hme_sbus.c =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 optional hme sbus >> =C2=A0dev/hptiop/hptiop.c =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0optio= nal hptiop scbus >> =C2=A0dev/hwpmc/hwpmc_logging.c =C2=A0 =C2=A0 =C2=A0optional hwpmc >> =C2=A0dev/hwpmc/hwpmc_mod.c =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0optional h= wpmc >> +dev/hwpmc/hwpmc_soft.c =C2=A0 =C2=A0 =C2=A0 =C2=A0 optional hwpmc >> =C2=A0dev/ichsmb/ichsmb.c =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0optio= nal ichsmb >> =C2=A0dev/ichsmb/ichsmb_pci.c =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0optional ichsmb pci >> =C2=A0dev/ida/ida.c =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0optional ida >> >> Modified: head/sys/dev/hwpmc/hwpmc_amd.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/sys/dev/hwpmc/hwpmc_amd.c =C2=A0 =C2=A0 =C2=A0Wed Mar 28 20:49:= 11 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233627) >> +++ head/sys/dev/hwpmc/hwpmc_amd.c =C2=A0 =C2=A0 =C2=A0Wed Mar 28 20:58:= 30 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233628) >> @@ -687,7 +687,8 @@ amd_intr(int cpu, struct trapframe *tf) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0wrmsr(perfctr, AM= D_RELOAD_COUNT_TO_PERFCTR_VALUE(v)); >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* Restart the co= unter if logging succeeded. */ >> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 error =3D pmc_process= _interrupt(cpu, pm, tf, TRAPF_USERMODE(tf)); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 error =3D pmc_process= _interrupt(cpu, PMC_HR, pm, tf, >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 TRAPF_U= SERMODE(tf)); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (error =3D=3D = 0) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0wrmsr(evsel, config | AMD_PMC_ENABLE); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0} >> @@ -874,7 +875,7 @@ amd_pcpu_fini(struct pmc_mdep *md, int c >> =C2=A0struct pmc_mdep * >> =C2=A0pmc_amd_initialize(void) >> =C2=A0{ >> - =C2=A0 =C2=A0 =C2=A0 int classindex, error, i, nclasses, ncpus; >> + =C2=A0 =C2=A0 =C2=A0 int classindex, error, i, ncpus; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0struct pmc_classdep *pcd; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0enum pmc_cputype cputype; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0struct pmc_mdep *pmc_mdep; >> @@ -926,12 +927,9 @@ pmc_amd_initialize(void) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 * These processors have two classes of PMCs:= the TSC and >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 * programmable PMCs. >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 */ >> - =C2=A0 =C2=A0 =C2=A0 nclasses =3D 2; >> - =C2=A0 =C2=A0 =C2=A0 pmc_mdep =3D malloc(sizeof(struct pmc_mdep) + ncl= asses * sizeof (struct pmc_classdep), >> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 M_PMC, M_WAITOK|M_ZERO); >> + =C2=A0 =C2=A0 =C2=A0 pmc_mdep =3D pmc_mdep_alloc(2); >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0pmc_mdep->pmd_cputype =3D cputype; >> - =C2=A0 =C2=A0 =C2=A0 pmc_mdep->pmd_nclass =C2=A0=3D nclasses; >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0ncpus =3D pmc_cpu_max(); >> >> >> Modified: head/sys/dev/hwpmc/hwpmc_core.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/sys/dev/hwpmc/hwpmc_core.c =C2=A0 =C2=A0 Wed Mar 28 20:49:11 20= 12 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233627) >> +++ head/sys/dev/hwpmc/hwpmc_core.c =C2=A0 =C2=A0 Wed Mar 28 20:58:30 20= 12 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233628) >> @@ -2239,7 +2239,7 @@ core_intr(int cpu, struct trapframe *tf) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (pm->pm_state = !=3D PMC_STATE_RUNNING) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0continue; >> >> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 error =3D pmc_process= _interrupt(cpu, pm, tf, >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 error =3D pmc_process= _interrupt(cpu, PMC_HR, pm, tf, >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0TRA= PF_USERMODE(tf)); >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0v =3D pm->pm_sc.p= m_reloadcount; >> @@ -2326,7 +2326,7 @@ core2_intr(int cpu, struct trapframe *tf >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0!PM= C_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0continue; >> >> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 error =3D pmc_process= _interrupt(cpu, pm, tf, >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 error =3D pmc_process= _interrupt(cpu, PMC_HR, pm, tf, >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0TRA= PF_USERMODE(tf)); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (error) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0intrenable &=3D ~flag; >> @@ -2354,7 +2354,7 @@ core2_intr(int cpu, struct trapframe *tf >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0!PM= C_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0continue; >> >> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 error =3D pmc_process= _interrupt(cpu, pm, tf, >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 error =3D pmc_process= _interrupt(cpu, PMC_HR, pm, tf, >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0TRA= PF_USERMODE(tf)); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (error) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0intrenable &=3D ~flag; >> >> Modified: head/sys/dev/hwpmc/hwpmc_intel.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/sys/dev/hwpmc/hwpmc_intel.c =C2=A0 =C2=A0Wed Mar 28 20:49:11 20= 12 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233627) >> +++ head/sys/dev/hwpmc/hwpmc_intel.c =C2=A0 =C2=A0Wed Mar 28 20:58:30 20= 12 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233628) >> @@ -162,12 +162,10 @@ pmc_intel_initialize(void) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return (NULL); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0} >> >> - =C2=A0 =C2=A0 =C2=A0 pmc_mdep =3D malloc(sizeof(struct pmc_mdep) + ncl= asses * >> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sizeof(struct pmc_classdep), M_PMC,= M_WAITOK|M_ZERO); >> + =C2=A0 =C2=A0 =C2=A0 /* Allocate base class and initialize machine dep= endent struct */ >> + =C2=A0 =C2=A0 =C2=A0 pmc_mdep =3D pmc_mdep_alloc(nclasses); >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0pmc_mdep->pmd_cputype =C2=A0 =C2=A0=3D cputyp= e; >> - =C2=A0 =C2=A0 =C2=A0 pmc_mdep->pmd_nclass =C2=A0 =C2=A0 =3D nclasses; >> - >> =C2=A0 =C2=A0 =C2=A0 =C2=A0pmc_mdep->pmd_switch_in =C2=A0=3D intel_switc= h_in; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0pmc_mdep->pmd_switch_out =3D intel_switch_out= ; >> >> >> Modified: head/sys/dev/hwpmc/hwpmc_logging.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/sys/dev/hwpmc/hwpmc_logging.c =C2=A0Wed Mar 28 20:49:11 2012 = =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233627) >> +++ head/sys/dev/hwpmc/hwpmc_logging.c =C2=A0Wed Mar 28 20:58:30 2012 = =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233628) >> @@ -129,6 +129,7 @@ static struct mtx pmc_kthread_mtx; =C2=A0/* sl >> >> =C2=A0/* Emit a string. =C2=A0Caution: does NOT update _le, so needs to = be last */ >> =C2=A0#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMCLOG_EMITSTRING(S,L) =C2=A0do= { bcopy((S), _le, (L)); } while (0) >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMCLOG_EMITNULLSTRING(L) do { bzero(= _le, (L)); } while (0) >> >> =C2=A0#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMCLOG_DESPATCH(PO) =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pmclog_release((P= O)); =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ >> @@ -835,16 +836,33 @@ void >> =C2=A0pmclog_process_pmcallocate(struct pmc *pm) >> =C2=A0{ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0struct pmc_owner *po; >> + =C2=A0 =C2=A0 =C2=A0 struct pmc_soft *ps; >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0po =3D pm->pm_owner; >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0PMCDBG(LOG,ALL,1, "pm=3D%p", pm); >> >> - =C2=A0 =C2=A0 =C2=A0 PMCLOG_RESERVE(po, PMCALLOCATE, sizeof(struct pmc= log_pmcallocate)); >> - =C2=A0 =C2=A0 =C2=A0 PMCLOG_EMIT32(pm->pm_id); >> - =C2=A0 =C2=A0 =C2=A0 PMCLOG_EMIT32(pm->pm_event); >> - =C2=A0 =C2=A0 =C2=A0 PMCLOG_EMIT32(pm->pm_flags); >> - =C2=A0 =C2=A0 =C2=A0 PMCLOG_DESPATCH(po); >> + =C2=A0 =C2=A0 =C2=A0 if (PMC_TO_CLASS(pm) =3D=3D PMC_CLASS_SOFT) { >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PMCLOG_RESERVE(po, PM= CALLOCATEDYN, >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sizeof(= struct pmclog_pmcallocatedyn)); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PMCLOG_EMIT32(pm->pm_= id); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PMCLOG_EMIT32(pm->pm_= event); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PMCLOG_EMIT32(pm->pm_= flags); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ps =3D pmc_soft_ev_ac= quire(pm->pm_event); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (ps !=3D NULL) >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 PMCLOG_EMITSTRING(ps->ps_ev.pm_ev_name,PMC_NAME_MAX); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 else >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 PMCLOG_EMITNULLSTRING(PMC_NAME_MAX); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pmc_soft_ev_release(p= s); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PMCLOG_DESPATCH(po); >> + =C2=A0 =C2=A0 =C2=A0 } else { >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PMCLOG_RESERVE(po, PM= CALLOCATE, >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sizeof(= struct pmclog_pmcallocate)); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PMCLOG_EMIT32(pm->pm_= id); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PMCLOG_EMIT32(pm->pm_= event); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PMCLOG_EMIT32(pm->pm_= flags); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PMCLOG_DESPATCH(po); >> + =C2=A0 =C2=A0 =C2=A0 } >> =C2=A0} >> >> =C2=A0void >> >> Modified: head/sys/dev/hwpmc/hwpmc_mips.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/sys/dev/hwpmc/hwpmc_mips.c =C2=A0 =C2=A0 Wed Mar 28 20:49:11 20= 12 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233627) >> +++ head/sys/dev/hwpmc/hwpmc_mips.c =C2=A0 =C2=A0 Wed Mar 28 20:58:30 20= 12 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233628) >> @@ -287,7 +287,7 @@ mips_pmc_intr(int cpu, struct trapframe >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0retval =3D 1; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (pm->pm_state = !=3D PMC_STATE_RUNNING) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0continue; >> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 error =3D pmc_process= _interrupt(cpu, pm, tf, >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 error =3D pmc_process= _interrupt(cpu, PMC_HR, pm, tf, >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0TRA= PF_USERMODE(tf)); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (error) { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0/* Clear/disable the relevant counter */ >> >> Modified: head/sys/dev/hwpmc/hwpmc_mod.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/sys/dev/hwpmc/hwpmc_mod.c =C2=A0 =C2=A0 =C2=A0Wed Mar 28 20:49:= 11 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233627) >> +++ head/sys/dev/hwpmc/hwpmc_mod.c =C2=A0 =C2=A0 =C2=A0Wed Mar 28 20:58:= 30 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233628) >> @@ -70,6 +70,8 @@ __FBSDID("$FreeBSD$"); >> =C2=A0#include >> =C2=A0#include >> >> +#include "hwpmc_soft.h" >> + >> =C2=A0/* >> =C2=A0* Types >> =C2=A0*/ >> @@ -182,7 +184,7 @@ static int =C2=A0pmc_attach_one_process(struct >> =C2=A0static int =C2=A0 =C2=A0 pmc_can_allocate_rowindex(struct proc *p,= unsigned int ri, >> =C2=A0 =C2=A0 int cpu); >> =C2=A0static int =C2=A0 =C2=A0 pmc_can_attach(struct pmc *pm, struct pro= c *p); >> -static void =C2=A0 =C2=A0pmc_capture_user_callchain(int cpu, struct tra= pframe *tf); >> +static void =C2=A0 =C2=A0pmc_capture_user_callchain(int cpu, int soft, = struct trapframe *tf); >> =C2=A0static void =C2=A0 =C2=A0pmc_cleanup(void); >> =C2=A0static int =C2=A0 =C2=A0 pmc_detach_process(struct proc *p, struct= pmc *pm); >> =C2=A0static int =C2=A0 =C2=A0 pmc_detach_one_process(struct proc *p, st= ruct pmc *pm, >> @@ -206,7 +208,7 @@ static void pmc_process_csw_out(struct t >> =C2=A0static void =C2=A0 =C2=A0pmc_process_exit(void *arg, struct proc *= p); >> =C2=A0static void =C2=A0 =C2=A0pmc_process_fork(void *arg, struct proc *= p1, >> =C2=A0 =C2=A0 struct proc *p2, int n); >> -static void =C2=A0 =C2=A0pmc_process_samples(int cpu); >> +static void =C2=A0 =C2=A0pmc_process_samples(int cpu, int soft); >> =C2=A0static void =C2=A0 =C2=A0pmc_release_pmc_descriptor(struct pmc *pm= c); >> =C2=A0static void =C2=A0 =C2=A0pmc_remove_owner(struct pmc_owner *po); >> =C2=A0static void =C2=A0 =C2=A0pmc_remove_process_descriptor(struct pmc_= process *pp); >> @@ -218,12 +220,16 @@ static int =C2=A0 =C2=A0 =C2=A0 =C2=A0pmc_stop(str= uct pmc *pm); >> =C2=A0static int =C2=A0 =C2=A0 pmc_syscall_handler(struct thread *td, vo= id *syscall_args); >> =C2=A0static void =C2=A0 =C2=A0pmc_unlink_target_process(struct pmc *pmc= , >> =C2=A0 =C2=A0 struct pmc_process *pp); >> +static int generic_switch_in(struct pmc_cpu *pc, struct pmc_process *pp= ); >> +static int generic_switch_out(struct pmc_cpu *pc, struct pmc_process *p= p); >> +static struct pmc_mdep *pmc_generic_cpu_initialize(void); >> +static void pmc_generic_cpu_finalize(struct pmc_mdep *md); >> >> =C2=A0/* >> =C2=A0* Kernel tunables and sysctl(8) interface. >> =C2=A0*/ >> >> -SYSCTL_NODE(_kern, OID_AUTO, hwpmc, CTLFLAG_RW, 0, "HWPMC parameters"); >> +SYSCTL_DECL(_kern_hwpmc); >> >> =C2=A0static int pmc_callchaindepth =3D PMC_CALLCHAIN_DEPTH; >> =C2=A0TUNABLE_INT(PMC_SYSCTL_NAME_PREFIX "callchaindepth", &pmc_callchai= ndepth); >> @@ -1833,7 +1839,9 @@ const char *pmc_hooknames[] =3D { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0"KLDUNLOAD", >> =C2=A0 =C2=A0 =C2=A0 =C2=A0"MMAP", >> =C2=A0 =C2=A0 =C2=A0 =C2=A0"MUNMAP", >> - =C2=A0 =C2=A0 =C2=A0 "CALLCHAIN" >> + =C2=A0 =C2=A0 =C2=A0 "CALLCHAIN-NMI", >> + =C2=A0 =C2=A0 =C2=A0 "CALLCHAIN-SOFT", >> + =C2=A0 =C2=A0 =C2=A0 "SOFTSAMPLING" >> =C2=A0}; >> =C2=A0#endif >> >> @@ -1992,7 +2000,8 @@ pmc_hook_handler(struct thread *td, int >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * lose the inter= rupt sample. >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 */ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0CPU_CLR_ATOMIC(PC= PU_GET(cpuid), &pmc_cpumask); >> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pmc_process_samples(P= CPU_GET(cpuid)); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pmc_process_samples(P= CPU_GET(cpuid), PMC_HR); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pmc_process_samples(P= CPU_GET(cpuid), PMC_SR); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0break; >> >> >> @@ -2022,11 +2031,30 @@ pmc_hook_handler(struct thread *td, int >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 */ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0KASSERT(td =3D=3D= curthread, ("[pmc,%d] td !=3D curthread", >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__L= INE__)); >> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pmc_capture_user_call= chain(PCPU_GET(cpuid), >> + >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pmc_capture_user_call= chain(PCPU_GET(cpuid), PMC_HR, >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(st= ruct trapframe *) arg); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0td->td_pflags &= =3D ~TDP_CALLCHAIN; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0break; >> >> + =C2=A0 =C2=A0 =C2=A0 case PMC_FN_USER_CALLCHAIN_SOFT: >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* Record a call= chain. >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/ >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 KASSERT(td =3D=3D cur= thread, ("[pmc,%d] td !=3D curthread", >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 __LINE_= _)); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pmc_capture_user_call= chain(PCPU_GET(cpuid), PMC_SR, >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (struct= trapframe *) arg); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 td->td_pflags &=3D ~T= DP_CALLCHAIN; >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break; >> + >> + =C2=A0 =C2=A0 =C2=A0 case PMC_FN_SOFT_SAMPLING: >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* Call soft PMC= sampling intr. >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/ >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pmc_soft_intr((struct= pmckern_soft *) arg); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break; >> + >> =C2=A0 =C2=A0 =C2=A0 =C2=A0default: >> =C2=A0#ifdef DEBUG >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0KASSERT(0, ("[pmc= ,%d] unknown hook %d\n", __LINE__, function)); >> @@ -2221,18 +2249,17 @@ pmc_destroy_pmc_descriptor(struct pmc *p >> =C2=A0static void >> =C2=A0pmc_wait_for_pmc_idle(struct pmc *pm) >> =C2=A0{ >> -#ifdef DEBUG >> +#ifdef DEBUG >> =C2=A0 =C2=A0 =C2=A0 =C2=A0volatile int maxloop; >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0maxloop =3D 100 * pmc_cpu_max(); >> =C2=A0#endif >> - >> =C2=A0 =C2=A0 =C2=A0 =C2=A0/* >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 * Loop (with a forced context switch) till t= he PMC's runcount >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 * comes down to zero. >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 */ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0while (atomic_load_acq_32(&pm->pm_runcount) >= 0) { >> -#ifdef DEBUG >> +#ifdef DEBUG >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0maxloop--; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0KASSERT(maxloop >= 0, >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0("[= pmc,%d] (ri%d, rc%d) waiting too long for " >> @@ -2972,6 +2999,53 @@ pmc_syscall_handler(struct thread *td, v >> =C2=A0 =C2=A0 =C2=A0 =C2=A0} >> =C2=A0 =C2=A0 =C2=A0 =C2=A0break; >> >> + =C2=A0 =C2=A0 =C2=A0 /* >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0* Retrieve soft events list. >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0*/ >> + =C2=A0 =C2=A0 =C2=A0 case PMC_OP_GETDYNEVENTINFO: >> + =C2=A0 =C2=A0 =C2=A0 { >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 enum pmc_class =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0cl; >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 enum pmc_event =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ev; >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct pmc_op_getdyne= ventinfo =C2=A0 *gei; >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct pmc_dyn_event_= descr =C2=A0 =C2=A0 =C2=A0dev; >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct pmc_soft =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 *ps; >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 uint32_t =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ne= vent; >> + >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sx_assert(&pmc_sx, SX= _LOCKED); >> + >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 gei =3D (struct pmc_o= p_getdyneventinfo *) arg; >> + >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if ((error =3D copyin= (&gei->pm_class, &cl, sizeof(cl))) !=3D 0) >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 break; >> + >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Only SOFT class is= dynamic. */ >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (cl !=3D PMC_CLASS= _SOFT) { >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 error =3D EINVAL; >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 break; >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } >> + >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 nevent =3D 0; >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 for (ev =3D PMC_EV_SO= FT_FIRST; ev <=3D PMC_EV_SOFT_LAST; ev++) { >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 ps =3D pmc_soft_ev_acquire(ev); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 if (ps =3D=3D NULL) >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 continue; >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 bcopy(&ps->ps_ev, &dev, sizeof(dev)); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 pmc_soft_ev_release(ps); >> + >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 error =3D copyout(&dev, >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 &gei->pm_events[nevent], >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 sizeof(struct pmc_dyn_event_descr)); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 if (error !=3D 0) >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break; >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 nevent++; >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (error !=3D 0) >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 break; >> + >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 error =3D copyout(&ne= vent, &gei->pm_nevent, >> >> *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** --=20 Monthadar Al Jaberi --f46d0444044c3a938f04be531f69 Content-Type: application/octet-stream; name=RSPRO_USB_PROD Content-Disposition: attachment; filename=RSPRO_USB_PROD Content-Transfer-Encoding: base64 X-Attachment-Id: f_h1d67xor0 IwojIFViaXF1aXRpIFJvdXRlcnN0YXRpb24gUHJvOiBib290IGZyb20gZmlyc3QgRE9TLXBhcnRp dGlvbmVkLCBCU0QKIyBzbGljZWQgZmxhc2ggZGlzay4KIwojICRGcmVlQlNEJAojCgojCiMgQVI3 MVhYIC0tIEtlcm5lbCBjb25maWd1cmF0aW9uIGZpbGUgZm9yIEZyZWVCU0QvTUlQUyBmb3IgQXRo ZXJvcyA3MXh4IHN5c3RlbXMKIwojIFRoaXMgaW5jbHVkZXMgYWxsIHRoZSBjb21tb24gZHJpdmVy cyBmb3IgdGhlIEFSNzFYWCBib2FyZHMgYWxvbmcgd2l0aAojIHRoZSB1c2IsIG5ldDgwMjExIGFu ZCBhdGhlcm9zIGRyaXZlciBjb2RlLgojCiMgJEZyZWVCU0QkCiMKCm1hY2hpbmUJCW1pcHMgbWlw cwppZGVudAkJUlNQUk9fVVNCX1BST0QKY3B1CQlDUFVfTUlQUzRLQwptYWtlb3B0aW9ucwlLRVJO TE9BREFERFI9MHg4MDA1MDAwMApvcHRpb25zCQlIWj0xMDAwCm9wdGlvbnMJCUhXUE1DX0hPT0tT CgpmaWxlcwkJIi4uL2F0aGVyb3MvZmlsZXMuYXI3MXh4IgoKIyBGb3Igbm93LCBoaW50cyBhcmUg cGVyLWJvYXJkLgoKaGludHMJCSJBUjcxWFhfQkFTRS5oaW50cyIKCm1ha2VvcHRpb25zCURFQlVH PS1nCQkjQnVpbGQga2VybmVsIHdpdGggZ2RiKDEpIGRlYnVnIHN5bWJvbHMKCiMgQnVpbGQgdGhl c2UgYXMgbW9kdWxlcyBzbyBzbWFsbCBwbGF0Zm9ybSBidWlsZHMgd2lsbCBoYXZlIHRoZQojIG1v ZHVsZXMgYWxyZWFkeSBidWlsdC4KbWFrZW9wdGlvbnMJTU9EVUxFU19PVkVSUklERT0icmFuZG9t IGdwaW8gYXI3MXh4IGlmX2dpZiBpZl9ncmUgaWZfYnJpZGdlIGJyaWRnZXN0cCB1c2Igd2xhbiB3 bGFuX3hhdXRoIHdsYW5fYWNsIHdsYW5fd2VwIHdsYW5fdGtpcCB3bGFuX2NjbXAgd2xhbl9yc3Nh ZGFwdCB3bGFuX2FtcnIgYXRoIGF0aF9wY2kiCgpvcHRpb25zCQlEREIKb3B0aW9ucwkJS0RCCgpv cHRpb25zIEhXUE1DX0hPT0tTCmRldmljZSBod3BtYwoKb3B0aW9ucwkJU0NIRURfNEJTRAkJIzRC U0Qgc2NoZWR1bGVyCiNvcHRpb25zCQlTQ0hFRF9VTEUJCSM0QlNEIHNjaGVkdWxlcgpvcHRpb25z CQlJTkVUCQkJI0ludGVyTkVUd29ya2luZwojb3B0aW9ucwkJSU5FVDYJCQkjIElQdjYKCiMgb3B0 aW9ucwkJTkZTX0NMCQkjTmV0d29yayBGaWxlc3lzdGVtIENsaWVudAoKb3B0aW9ucwkJUFNFVURP RlMJCSNQc2V1ZG8tZmlsZXN5c3RlbSBmcmFtZXdvcmsKb3B0aW9ucwkJX0tQT1NJWF9QUklPUklU WV9TQ0hFRFVMSU5HICNQb3NpeCBQMTAwM18xQiByZWFsLXRpbWUgZXh0ZW5zaW9ucwoKIyBvcHRp b25zCQlORlNfTEVHQUNZUlBDCiMgRGVidWdnaW5nIGZvciB1c2UgaW4gLWN1cnJlbnQKb3B0aW9u cwkJSU5WQVJJQU5UUwpvcHRpb25zCQlJTlZBUklBTlRfU1VQUE9SVApvcHRpb25zCQlXSVRORVNT Cm9wdGlvbnMJCVdJVE5FU1NfU0tJUFNQSU4Kb3B0aW9ucwkJREVCVUdfUkVEWk9ORQpvcHRpb25z CQlERUJVR19NRU1HVUFSRAoKb3B0aW9ucyAgICAgICAgIEZGUyAgICAgICAgICAgICAgICAgICAg ICNCZXJrZWxleSBGYXN0IEZpbGVzeXN0ZW0KIyBvcHRpb25zICAgICAgICAgU09GVFVQREFURVMg ICAgICAgICAgICAgI0VuYWJsZSBGRlMgc29mdCB1cGRhdGVzIHN1cHBvcnQKIyBvcHRpb25zICAg ICAgICAgVUZTX0FDTCAgICAgICAgICAgICAgICAgI1N1cHBvcnQgZm9yIGFjY2VzcyBjb250cm9s IGxpc3RzCiMgb3B0aW9ucyAgICAgICAgIFVGU19ESVJIQVNIICAgICAgICAgICAgICNJbXByb3Zl IHBlcmZvcm1hbmNlIG9uIGJpZyBkaXJlY3RvcmllcwojIG9wdGlvbnMJCU1TRE9TRlMJCQkjIFJl YWQgTVNET1MgZmlsZXN5c3RlbXM7IHVzZWZ1bCBmb3IgVVNCL0NGCgpkZXZpY2UJCXBjaQpkZXZp Y2UJCWFyNzF4eF9wY2kKCiMgODAyLjExIGZyYW1ld29yawpvcHRpb25zCQlJRUVFODAyMTFfREVC VUcKb3B0aW9ucwkJSUVFRTgwMjExX0FMUQpvcHRpb25zCQlJRUVFODAyMTFfU1VQUE9SVF9NRVNI CiMgVGhpcyBvcHRpb24gaXMgY3VycmVudGx5IGJyb2tlbiBmb3IgaWZfYXRoX3R4LgpvcHRpb25z CQlJRUVFODAyMTFfU1VQUE9SVF9URE1BCm9wdGlvbnMJCUlFRUU4MDIxMV9BTVBEVV9BR0UKZGV2 aWNlCQl3bGFuICAgICAgICAgICAgIyA4MDIuMTEgc3VwcG9ydApkZXZpY2UJCXdsYW5fd2VwICAg ICAgICAjIDgwMi4xMSBXRVAgc3VwcG9ydApkZXZpY2UJCXdsYW5fY2NtcCAgICAgICAjIDgwMi4x MSBDQ01QIHN1cHBvcnQKZGV2aWNlCQl3bGFuX3RraXAgICAgICAgIyA4MDIuMTEgVEtJUCBzdXBw b3J0CmRldmljZQkJd2xhbl94YXV0aAkjIDgwMi4xMSBob3N0YXAgc3VwcG9ydAoKIyBBdGhlcm9z IHdpcmVsZXNzIE5JQ3MKZGV2aWNlCQlhdGggICAgICAgICAgICAgIyBBdGhlcm9zIGludGVyZmFj ZSBzdXBwb3J0CmRldmljZQkJYXRoX3BjaQkJIyBBdGhlcm9zIFBDSS9DYXJkYnVzIGJ1cwpvcHRp b25zIAlBVEhfREVCVUcKb3B0aW9ucwkJQVRIX0RJQUdBUEkKb3B0aW9ucwkJQVRIX0VOQUJMRV8x MU4Kb3B0aW9ucwkJQUhfREVCVUcKb3B0aW9ucwkJQUhfREVCVUdfQUxRCm9wdGlvbnMJCUFMUQpk ZXZpY2UJCWF0aF9oYWwKb3B0aW9uCQlBSF9TVVBQT1JUX0FSNTQxNgpkZXZpY2UJCWF0aF9yYXRl X3NhbXBsZQpvcHRpb24JCUFIX1JYQ0ZHX1NETUFNV180QllURVMKb3B0aW9uCQlBSF9BUjU0MTZf SU5URVJSVVBUX01JVElHQVRJT04KIyBUaGVyZSdzIG5vIERGUyByYWRhciBkZXRlY3Rpb24gc3Vw cG9ydCB5ZXQgc28gdGhpcyB3b24ndCBhY3R1YWxseQojIGRldGVjdCByYWRhcnMuICBJdCBob3dl dmVyIGRvZXMgZW5hYmxlIHRoZSByZXN0IG9mIHRoZSBjaGFubmVsIGNoYW5nZQojIG1hY2hpbmVy eSBzbyBERlMgY2FuIGJlIGRlYnVnZ2VkLgpvcHRpb24JCUFUSF9FTkFCTEVfREZTCgpkZXZpY2UJ CW1paQpkZXZpY2UJCWFyZ2UKCmRldmljZQkJdXNiCm9wdGlvbnMJCVVTQl9FSENJX0JJR19FTkRJ QU5fREVTQyAgICAgICAgIyBoYW5kbGUgYmlnLWVuZGlhbiBieXRlIG9yZGVyCm9wdGlvbnMJCVVT Ql9ERUJVRwpvcHRpb25zCQlVU0JfSE9TVF9BTElHTj0zMgkJIyBBUjcxWFggKE1JUFMgaW4gZ2Vu ZXJhbD8pIHJlcXVpcmVzIHRoaXMKZGV2aWNlCQllaGNpCgpkZXZpY2UJCXNjYnVzCmRldmljZQkJ dW1hc3MKZGV2aWNlCQlkYQoKIyBPbi1ib2FyZCBTUEkgZmxhc2gKZGV2aWNlCQlzcGlidXMKZGV2 aWNlCQlhcjcxeHhfc3BpCmRldmljZQkJbXgyNWwKZGV2aWNlCQlhcjcxeHhfd2RvZwoKZGV2aWNl CQl1YXJ0CgpkZXZpY2UJCWxvb3AKZGV2aWNlCQlldGhlcgpkZXZpY2UJCW1kCmRldmljZQkJYnBm CmRldmljZQkJcmFuZG9tCmRldmljZQkJaWZfYnJpZGdlCmRldmljZQkJZ2lmCQkjIGlwWzQ2XSBp biBpcFs0Nl0gdHVubmVsaW5nIHByb3RvY29sCmRldmljZQkJZ3JlCQkjIGdlbmVyaWMgZW5jYXBz dWxhdGlvbiAtIG9ubHkgZm9yIElQdjQgaW4gSVB2NCB0aG91Z2ggYXRtCgpvcHRpb25zCQlBUkdF X0RFQlVHCSMgRW5hYmxlIGlmX2FyZ2UgZGVidWdnaW5nIGZvciBub3cKCiMgRW5hYmxlIEdQSU8K ZGV2aWNlCQlncGlvCmRldmljZQkJZ3Bpb2xlZAoKCiMgUlRDIC0gcmVxdWlyZXMgaGFja2VyeSBp biB0aGUgc3BpYnVzIGNvZGUgdG8gd29yawpkZXZpY2UJCXBjZjIxMjNfcnRjCgojIE5ldyBOZXR3 b3JrIEZpbGVzeXN0ZW0gQ2xpZW50Cm9wdGlvbnMJCU5GU0NMCgojIEdFT00gbW9kdWxlcwpkZXZp Y2UJCWdlb21fcmVkYm9vdAkjIHRvIGdldCBhY2Nlc3MgdG8gdGhlIFNQSSBmbGFzaCBwYXJ0aXRp b25zCmRldmljZQkJZ2VvbV91emlwCSMgY29tcHJlc3NlZCBpbi1tZW1vcnkgZmlsZXN5c3RlbSBz dXBwb3J0Cm9wdGlvbnMJCUdFT01fVVpJUAoKIyBGb3IgRE9TCm9wdGlvbnMJCUdFT01fUEFSVF9C U0QKb3B0aW9ucwkJR0VPTV9QQVJUX01CUgpvcHRpb25zCQlNU0RPU0ZTCgojIEZvciBHUFQKb3B0 aW9ucwkJR0VPTV9MQUJFTApvcHRpb25zCQlHRU9NX1BBUlRfR1BUCgojIC4uIGZpcnN0IERPUy1w YXJ0aXRpb25lZCwgQlNEIHNsaWNlZCBmbGFzaCBkaXNrCiNvcHRpb25zCQlST09UREVWTkFNRT1c InVmczpkYTBzMWFcIgpvcHRpb25zCQlST09UREVWTkFNRT1cInVmczovZGV2L2dwdC9yc3Byb290 ZnNcIgoK --f46d0444044c3a938f04be531f69-- From owner-freebsd-mips@FreeBSD.ORG Mon Apr 23 07:47:41 2012 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 02257106566B; Mon, 23 Apr 2012 07:47:41 +0000 (UTC) (envelope-from fabien.thomas@netasq.com) Received: from work.netasq.com (gwlille.netasq.com [91.212.116.1]) by mx1.freebsd.org (Postfix) with ESMTP id 02E6C8FC12; Mon, 23 Apr 2012 07:47:39 +0000 (UTC) Received: from [10.2.1.1] (unknown [10.2.1.1]) by work.netasq.com (Postfix) with ESMTPSA id B1F0527030D4; Mon, 23 Apr 2012 09:48:11 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v1257) Content-Type: multipart/signed; boundary="Apple-Mail=_24EA901A-324C-4465-880C-9C948861B2D8"; protocol="application/pkcs7-signature"; micalg=sha1 From: Fabien Thomas In-Reply-To: Date: Mon, 23 Apr 2012 09:47:45 +0200 Message-Id: <25D59FAA-D52A-42FB-8120-66467863AB0B@netasq.com> References: <201203282058.q2SKwVsJ053900@svn.freebsd.org> To: Monthadar Al Jaberi X-Mailer: Apple Mail (2.1257) X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: monthadar@freebsd.org, freebsd-current , Fabien Thomas , freebsd-mips@freebsd.org Subject: Re: svn commit: r233628 - in head: lib/libpmc sys/amd64/amd64 sys/amd64/include sys/arm/include sys/conf sys/dev/hwpmc sys/i386/i386 sys/i386/include sys/kern sys/mips/include sys/modules/hwpmc sys/pow... X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Apr 2012 07:47:41 -0000 --Apple-Mail=_24EA901A-324C-4465-880C-9C948861B2D8 Content-Type: multipart/mixed; boundary="Apple-Mail=_0FFE1445-1962-4A52-A902-4106C0401133" --Apple-Mail=_0FFE1445-1962-4A52-A902-4106C0401133 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Hi, The rumors seems true :) Can you try the patch attached (I cannot test as i've no MIPS hardware) ? Thanks, Fabien --Apple-Mail=_0FFE1445-1962-4A52-A902-4106C0401133 Content-Disposition: attachment; filename=patch-fixsoft Content-Type: application/octet-stream; name="patch-fixsoft" Content-Transfer-Encoding: 7bit Index: dev/hwpmc/hwpmc_mips.c =================================================================== --- dev/hwpmc/hwpmc_mips.c (revision 233824) +++ dev/hwpmc/hwpmc_mips.c (working copy) @@ -431,11 +431,9 @@ M_WAITOK|M_ZERO); /* Just one class */ - pmc_mdep = malloc(sizeof(struct pmc_mdep) + sizeof(struct pmc_classdep), - M_PMC, M_WAITOK|M_ZERO); + pmc_mdep = pmc_mdep_alloc(1); pmc_mdep->pmd_cputype = mips_pmc_spec.ps_cputype; - pmc_mdep->pmd_nclass = 1; pcd = &pmc_mdep->pmd_classdep[PMC_MDEP_CLASS_INDEX_MIPS]; pcd->pcd_caps = mips_pmc_spec.ps_capabilities; Index: dev/hwpmc/hwpmc_powerpc.c =================================================================== --- dev/hwpmc/hwpmc_powerpc.c (revision 233824) +++ dev/hwpmc/hwpmc_powerpc.c (working copy) @@ -803,11 +803,9 @@ M_WAITOK|M_ZERO); /* Just one class */ - pmc_mdep = malloc(sizeof(struct pmc_mdep) + sizeof(struct pmc_classdep), - M_PMC, M_WAITOK|M_ZERO); + pmc_mdep = pmc_mdep_alloc(1); pmc_mdep->pmd_cputype = PMC_CPU_PPC_7450; - pmc_mdep->pmd_nclass = 1; pcd = &pmc_mdep->pmd_classdep[PMC_MDEP_CLASS_INDEX_PPC7450]; pcd->pcd_caps = POWERPC_PMC_CAPS; --Apple-Mail=_0FFE1445-1962-4A52-A902-4106C0401133 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Mon, Apr 23, 2012 at 8:44 AM, Adrian Chadd = wrote: >> Hi Fabien, >>=20 >> I've heard some rumours that this broke hwpmc support for mips24k. >>=20 >> Monthadar, can you please provide some background info for this? >>=20 >=20 > This is the log output >=20 > Using default protocol (TFTP) > Entry point: 0x80050100, address range: 0x80050000-0x804f1dcc > RedBoot> exec > Now booting linux kernel: > Base address 0x80050000 Entry 0x80050100 > memsize=3D0x08000000 > modetty0=3D0,n,8,1,hw > board=3DRouterStation PRO > ethaddr=3D00.15.6d.c8.c9.2e > CPU platform: Atheros AR7161 rev 2 > CPU Frequency=3D720 MHz > CPU DDR Frequency=3D360 MHz > CPU AHB Frequency=3D180 MHz > platform frequency: 720000000 > arguments: > a0 =3D 00000002 > a1 =3D 80050028 > a2 =3D 80050000 > a3 =3D 00000001 > Cmd line: = =EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BDm=EF=BF=BD=EF= =BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF= =BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD_}=EF=BF=BD=EF=BF=BD=EF=BF= =BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=DF=BEq=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF= =BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF= =BD=EF=BF=BD=EF=BF=BD=7F=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF= =BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD= =EF=BF=BD=EF=BF=BD=EF=BF=BD=DF=BF=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF= =BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD_=EF=BF=BDw=EF=BF=BD=EF=BF=BD=EF=BF= =BD=EF=BF=BD=1F=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD?-=EF=BF=BD=EF= =BF=BD=EF=BF=BD=EF=BF=BD{=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF= =BD~=EF=BF=BD=EF=BF=BD > Environment: > memsize =3D 0x08000000 > modetty0 =3D 0,n,8,1,hw > ethaddr =3D 00.15.6d.c8.c9.2e > board =3D RouterStation PRO > Cache info: > picache_stride =3D 4096 > picache_loopcount =3D 16 > pdcache_stride =3D 4096 > pdcache_loopcount =3D 8 > cpu0: MIPS Technologies processor v116.147 > MMU: Standard TLB, 16 entries > L1 i-cache: 4 ways of 512 sets, 32 bytes per line > L1 d-cache: 4 ways of 256 sets, 32 bytes per line > Config1=3D0x9ee3519e > Config3=3D0x20 > KDB: debugger backends: ddb > KDB: current backend: ddb > Copyright (c) 1992-2012 The FreeBSD Project. > Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, = 1994 > The Regents of the University of California. All rights = reserved. > FreeBSD is a registered trademark of The FreeBSD Foundation. > FreeBSD 10.0-CURRENT #12: Fri Apr 20 18:03:16 CEST 2012 > root@freebsd-re-9:/usr/obj/mips.mips/usr/src/sys/RSPRO_USB_PROD = mips > WARNING: WITNESS option enabled, expect reduced performance. > MEMGUARD DEBUGGING ALLOCATOR INITIALIZED: > MEMGUARD map base: 0xc0800000 > MEMGUARD map limit: 0xc1c00000 > MEMGUARD map size: 20480 KBytes > real memory =3D 134217728 (131072K bytes) > avail memory =3D 123117568 (117MB) > random device not loaded; using insecure entropy > nexus0: > clock0: on nexus0 > Timecounter "MIPS32" frequency 360000000 Hz quality 800 > Event timer "MIPS32" frequency 360000000 Hz quality 800 > apb0 at irq 4 on nexus0 > uart0: <16550 or compatible> on apb0 > uart0: console (115200,n,8,1) > gpio0: on apb0 > gpio0: [GIANT-LOCKED] > gpio0: gpio pinmask=3D0x0 > gpioc0: on gpio0 > gpiobus0: on gpio0 > ehci0: at mem > 0x1b000000-0x1bffffff irq 1 on nexus0 > usbus0: set host controller mode > usbus0: EHCI version 1.0 > usbus0: set host controller mode > usbus0 on ehci0 > pcib0 at irq 0 on nexus0 > pci0: on pcib0 > pci0: at device 0.0 (no driver attached) > ath0: irq 0 at device 17.0 on pci0 > ath0: AR5413 mac 10.5 RF5413 phy 6.1 > ath0: 2GHz radio: 0x0000; 5GHz radio: 0x0063 > arge0: at mem > 0x19000000-0x19000fff irq 2 on nexus0 > arge0: No PHY specified, using mask 16 > miibus0: on arge0 > ukphy0: PHY 4 on miibus0 > ukphy0: none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, > 1000baseT-FDX, 1000baseT-FDX-master, auto > arge0: Ethernet address: 00:15:6d:c8:c9:2e > arge1: at mem > 0x1a000000-0x1a000fff irq 3 on nexus0 > arge1: No PHY specified, using mask 15 > arge1: Ethernet address: 00:15:6d:c8:c9:2f > spi0: at mem 0x1f000000-0x1f00000f on nexus0 > spibus0: on spi0 > mx25l0: at cs 0 on spibus0 > mx25l0: mx25ll128, sector 65536 bytes, 256 sectors > ar71xx_wdog0: on nexus0 > Timecounters tick every 1.000 msec > usbus0: 480Mbps High Speed USB v2.0 > ugen0.1: at usbus0 > uhub0: on = usbus0 > panic: [pmc,4816] npmc miscomputed: ri=3D0, md->npmc=3D2 > KDB: enter: panic > [ thread pid 0 tid 100000 ] > Stopped at kdb_enter+0x4c: lui at,0x8050 > db> tr > Tracing pid 0 tid 100000 td 0x804f76d0 > db_trace_thread+30 (?,?,?,?) ra 8068b94800000018 sp 0 sz 0 > 80075adc+114 (0,?,ffffffff,?) ra 8068b96000000020 sp 100000000 sz 1 > 80074e24+388 (?,?,?,?) ra 8068b980000000a8 sp 0 sz 0 > db_command_loop+70 (?,?,?,?) ra 8068ba2800000018 sp 0 sz 0 > 80077900+f4 (?,?,?,?) ra 8068ba40000001a8 sp 0 sz 0 > kdb_trap+110 (?,?,?,?) ra 8068bbe800000030 sp 0 sz 0 > trap+c7c (?,?,?,?) ra 8068bc18000000b8 sp 0 sz 0 > MipsKernGenException+134 (0,4,8043b1d4,119) ra 8068bcd0000000c8 sp > 100000001 sz 1 > kdb_enter+4c (?,?,?,?) ra 8068bd9800000018 sp 0 sz 0 > panic+11c (?,12d0,0,2) ra 8068bdb000000028 sp 1 sz 1 > 800e8ca8+274 (?,?,?,?) ra 8068bdd800000038 sp 0 sz 0 > syscall_module_handler+b8 (?,?,?,?) ra 8068be1000000028 sp 0 sz 0 > module_register_init+9c (?,?,?,?) ra 8068be3800000028 sp 0 sz 0 > mi_startup+138 (?,?,?,?) ra 8068be6000000020 sp 0 sz 0 > _start+90 (?,?,?,?) ra 8068be8000000000 sp 0 sz 0 > pid 0 > db> >=20 >> Thanks, >>=20 >>=20 >>=20 >> adrian >>=20 >> On 28 March 2012 13:58, Fabien Thomas wrote: >>> Author: fabient >>> Date: Wed Mar 28 20:58:30 2012 >>> New Revision: 233628 >>> URL: http://svn.freebsd.org/changeset/base/233628 >>>=20 >>> Log: >>> Add software PMC support. >>>=20 >>> New kernel events can be added at various location for sampling or = counting. >>> This will for example allow easy system profiling whatever the = processor is >>> with known tools like pmcstat(8). >>>=20 >>> Simultaneous usage of software PMC and hardware PMC is possible, = for example >>> looking at the lock acquire failure, page fault while sampling on >>> instructions. >>>=20 >>> Sponsored by: NETASQ >>> MFC after: 1 month >>>=20 >>> Added: >>> head/lib/libpmc/pmc.soft.3 (contents, props changed) >>> head/sys/dev/hwpmc/hwpmc_soft.c (contents, props changed) >>> head/sys/dev/hwpmc/hwpmc_soft.h (contents, props changed) >>> Modified: >>> head/lib/libpmc/Makefile >>> head/lib/libpmc/libpmc.c >>> head/lib/libpmc/pmc.3 >>> head/lib/libpmc/pmc.atom.3 >>> head/lib/libpmc/pmc.core.3 >>> head/lib/libpmc/pmc.core2.3 >>> head/lib/libpmc/pmc.corei7.3 >>> head/lib/libpmc/pmc.corei7uc.3 >>> head/lib/libpmc/pmc.iaf.3 >>> head/lib/libpmc/pmc.k7.3 >>> head/lib/libpmc/pmc.k8.3 >>> head/lib/libpmc/pmc.mips24k.3 >>> head/lib/libpmc/pmc.octeon.3 >>> head/lib/libpmc/pmc.p4.3 >>> head/lib/libpmc/pmc.p5.3 >>> head/lib/libpmc/pmc.p6.3 >>> head/lib/libpmc/pmc.sandybridge.3 >>> head/lib/libpmc/pmc.sandybridgeuc.3 >>> head/lib/libpmc/pmc.tsc.3 >>> head/lib/libpmc/pmc.ucf.3 >>> head/lib/libpmc/pmc.westmere.3 >>> head/lib/libpmc/pmc.westmereuc.3 >>> head/lib/libpmc/pmc.xscale.3 >>> head/lib/libpmc/pmclog.c >>> head/lib/libpmc/pmclog.h >>> head/sys/amd64/amd64/trap.c >>> head/sys/amd64/include/pmc_mdep.h >>> head/sys/arm/include/pmc_mdep.h >>> head/sys/conf/files >>> head/sys/dev/hwpmc/hwpmc_amd.c >>> head/sys/dev/hwpmc/hwpmc_core.c >>> head/sys/dev/hwpmc/hwpmc_intel.c >>> head/sys/dev/hwpmc/hwpmc_logging.c >>> head/sys/dev/hwpmc/hwpmc_mips.c >>> head/sys/dev/hwpmc/hwpmc_mod.c >>> head/sys/dev/hwpmc/hwpmc_piv.c >>> head/sys/dev/hwpmc/hwpmc_powerpc.c >>> head/sys/dev/hwpmc/hwpmc_ppro.c >>> head/sys/dev/hwpmc/hwpmc_tsc.c >>> head/sys/dev/hwpmc/hwpmc_x86.c >>> head/sys/dev/hwpmc/hwpmc_xscale.c >>> head/sys/dev/hwpmc/pmc_events.h >>> head/sys/i386/i386/trap.c >>> head/sys/i386/include/pmc_mdep.h >>> head/sys/kern/kern_clock.c >>> head/sys/kern/kern_lock.c >>> head/sys/kern/kern_mutex.c >>> head/sys/kern/kern_pmc.c >>> head/sys/kern/kern_rwlock.c >>> head/sys/kern/kern_sx.c >>> head/sys/kern/subr_trap.c >>> head/sys/mips/include/pmc_mdep.h >>> head/sys/modules/hwpmc/Makefile >>> head/sys/powerpc/include/pmc_mdep.h >>> head/sys/sys/pmc.h >>> head/sys/sys/pmckern.h >>> head/sys/sys/pmclog.h >>> head/usr.sbin/pmcstat/pmcstat_log.c >>>=20 >>> Modified: head/lib/libpmc/Makefile >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/lib/libpmc/Makefile Wed Mar 28 20:49:11 2012 = (r233627) >>> +++ head/lib/libpmc/Makefile Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -20,6 +20,7 @@ MAN+=3D pmc_read.3 >>> MAN+=3D pmc_set.3 >>> MAN+=3D pmc_start.3 >>> MAN+=3D pmclog.3 >>> +MAN+=3D pmc.soft.3 >>>=20 >>> # PMC-dependent manual pages >>> .if ${MACHINE_CPUARCH} =3D=3D "i386" || ${MACHINE_CPUARCH} =3D=3D = "amd64" >>>=20 >>> Modified: head/lib/libpmc/libpmc.c >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/lib/libpmc/libpmc.c Wed Mar 28 20:49:11 2012 = (r233627) >>> +++ head/lib/libpmc/libpmc.c Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -77,11 +77,12 @@ static int tsc_allocate_pmc(enum pmc_eve >>> static int xscale_allocate_pmc(enum pmc_event _pe, char *_ctrspec, >>> struct pmc_op_pmcallocate *_pmc_config); >>> #endif >>> - >>> #if defined(__mips__) >>> static int mips_allocate_pmc(enum pmc_event _pe, char* ctrspec, >>> struct pmc_op_pmcallocate *_pmc_config); >>> #endif /* __mips__ */ >>> +static int soft_allocate_pmc(enum pmc_event _pe, char *_ctrspec, >>> + struct pmc_op_pmcallocate *_pmc_config); >>>=20 >>> #if defined(__powerpc__) >>> static int ppc7450_allocate_pmc(enum pmc_event _pe, char* ctrspec, >>> @@ -156,6 +157,8 @@ PMC_CLASSDEP_TABLE(octeon, OCTEON); >>> PMC_CLASSDEP_TABLE(ucf, UCF); >>> PMC_CLASSDEP_TABLE(ppc7450, PPC7450); >>>=20 >>> +static struct pmc_event_descr soft_event_table[PMC_EV_DYN_COUNT]; >>> + >>> #undef __PMC_EV_ALIAS >>> #define __PMC_EV_ALIAS(N,CODE) { N, PMC_EV_##CODE }, >>>=20 >>> @@ -215,21 +218,22 @@ static const struct pmc_event_descr west >>> PMC_CLASS_##C, __VA_ARGS__ \ >>> } >>>=20 >>> -PMC_MDEP_TABLE(atom, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC); >>> -PMC_MDEP_TABLE(core, IAP, PMC_CLASS_TSC); >>> -PMC_MDEP_TABLE(core2, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC); >>> -PMC_MDEP_TABLE(corei7, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC, = PMC_CLASS_UCF, PMC_CLASS_UCP); >>> -PMC_MDEP_TABLE(sandybridge, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC, = PMC_CLASS_UCF, PMC_CLASS_UCP); >>> -PMC_MDEP_TABLE(westmere, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC, = PMC_CLASS_UCF, PMC_CLASS_UCP); >>> -PMC_MDEP_TABLE(k7, K7, PMC_CLASS_TSC); >>> -PMC_MDEP_TABLE(k8, K8, PMC_CLASS_TSC); >>> -PMC_MDEP_TABLE(p4, P4, PMC_CLASS_TSC); >>> -PMC_MDEP_TABLE(p5, P5, PMC_CLASS_TSC); >>> -PMC_MDEP_TABLE(p6, P6, PMC_CLASS_TSC); >>> -PMC_MDEP_TABLE(xscale, XSCALE, PMC_CLASS_XSCALE); >>> -PMC_MDEP_TABLE(mips24k, MIPS24K, PMC_CLASS_MIPS24K); >>> -PMC_MDEP_TABLE(octeon, OCTEON, PMC_CLASS_OCTEON); >>> -PMC_MDEP_TABLE(ppc7450, PPC7450, PMC_CLASS_PPC7450); >>> +PMC_MDEP_TABLE(atom, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, = PMC_CLASS_TSC); >>> +PMC_MDEP_TABLE(core, IAP, PMC_CLASS_SOFT, PMC_CLASS_TSC); >>> +PMC_MDEP_TABLE(core2, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, = PMC_CLASS_TSC); >>> +PMC_MDEP_TABLE(corei7, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, = PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); >>> +PMC_MDEP_TABLE(sandybridge, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, = PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); >>> +PMC_MDEP_TABLE(westmere, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, = PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); >>> +PMC_MDEP_TABLE(k7, K7, PMC_CLASS_SOFT, PMC_CLASS_TSC); >>> +PMC_MDEP_TABLE(k8, K8, PMC_CLASS_SOFT, PMC_CLASS_TSC); >>> +PMC_MDEP_TABLE(p4, P4, PMC_CLASS_SOFT, PMC_CLASS_TSC); >>> +PMC_MDEP_TABLE(p5, P5, PMC_CLASS_SOFT, PMC_CLASS_TSC); >>> +PMC_MDEP_TABLE(p6, P6, PMC_CLASS_SOFT, PMC_CLASS_TSC); >>> +PMC_MDEP_TABLE(xscale, XSCALE, PMC_CLASS_SOFT, PMC_CLASS_XSCALE); >>> +PMC_MDEP_TABLE(mips24k, MIPS24K, PMC_CLASS_SOFT, = PMC_CLASS_MIPS24K); >>> +PMC_MDEP_TABLE(octeon, OCTEON, PMC_CLASS_SOFT, PMC_CLASS_OCTEON); >>> +PMC_MDEP_TABLE(ppc7450, PPC7450, PMC_CLASS_SOFT, = PMC_CLASS_PPC7450); >>> +PMC_MDEP_TABLE(generic, SOFT, PMC_CLASS_SOFT); >>>=20 >>> static const struct pmc_event_descr tsc_event_table[] =3D >>> { >>> @@ -279,16 +283,24 @@ PMC_CLASS_TABLE_DESC(tsc, TSC, tsc, tsc) >>> #if defined(__XSCALE__) >>> PMC_CLASS_TABLE_DESC(xscale, XSCALE, xscale, xscale); >>> #endif >>> - >>> #if defined(__mips__) >>> PMC_CLASS_TABLE_DESC(mips24k, MIPS24K, mips24k, mips); >>> PMC_CLASS_TABLE_DESC(octeon, OCTEON, octeon, mips); >>> #endif /* __mips__ */ >>> - >>> #if defined(__powerpc__) >>> PMC_CLASS_TABLE_DESC(ppc7450, PPC7450, ppc7450, ppc7450); >>> #endif >>>=20 >>> +static struct pmc_class_descr soft_class_table_descr =3D >>> +{ >>> + .pm_evc_name =3D "SOFT-", >>> + .pm_evc_name_size =3D sizeof("SOFT-") - 1, >>> + .pm_evc_class =3D PMC_CLASS_SOFT, >>> + .pm_evc_event_table =3D NULL, >>> + .pm_evc_event_table_size =3D 0, >>> + .pm_evc_allocate_pmc =3D soft_allocate_pmc >>> +}; >>> + >>> #undef PMC_CLASS_TABLE_DESC >>>=20 >>> static const struct pmc_class_descr **pmc_class_table; >>> @@ -343,9 +355,12 @@ static const char * pmc_state_names[] =3D >>> __PMC_STATES() >>> }; >>>=20 >>> -static int pmc_syscall =3D -1; /* filled in by pmc_init() = */ >>> - >>> -static struct pmc_cpuinfo cpu_info; /* filled in by pmc_init() = */ >>> +/* >>> + * Filled in by pmc_init(). >>> + */ >>> +static int pmc_syscall =3D -1; >>> +static struct pmc_cpuinfo cpu_info; >>> +static struct pmc_op_getdyneventinfo soft_event_info; >>>=20 >>> /* Event masks for events */ >>> struct pmc_masks { >>> @@ -2179,6 +2194,25 @@ tsc_allocate_pmc(enum pmc_event pe, char >>> } >>> #endif >>>=20 >>> +static struct pmc_event_alias generic_aliases[] =3D { >>> + EV_ALIAS("instructions", "SOFT-CLOCK.HARD"), >>> + EV_ALIAS(NULL, NULL) >>> +}; >>> + >>> +static int >>> +soft_allocate_pmc(enum pmc_event pe, char *ctrspec, >>> + struct pmc_op_pmcallocate *pmc_config) >>> +{ >>> + (void)ctrspec; >>> + (void)pmc_config; >>> + >>> + if (pe < PMC_EV_SOFT_FIRST || pe > PMC_EV_SOFT_LAST) >>> + return (-1); >>> + >>> + pmc_config->pm_caps |=3D (PMC_CAP_READ | PMC_CAP_WRITE); >>> + return (0); >>> +} >>> + >>> #if defined(__XSCALE__) >>>=20 >>> static struct pmc_event_alias xscale_aliases[] =3D { >>> @@ -2663,6 +2697,10 @@ pmc_event_names_of_class(enum pmc_class >>> ev =3D ppc7450_event_table; >>> count =3D PMC_EVENT_TABLE_SIZE(ppc7450); >>> break; >>> + case PMC_CLASS_SOFT: >>> + ev =3D soft_event_table; >>> + count =3D soft_event_info.pm_nevent; >>> + break; >>> default: >>> errno =3D EINVAL; >>> return (-1); >>> @@ -2676,6 +2714,7 @@ pmc_event_names_of_class(enum pmc_class >>>=20 >>> for (;count--; ev++, names++) >>> *names =3D ev->pm_ev_name; >>> + >>> return (0); >>> } >>>=20 >>> @@ -2780,11 +2819,34 @@ pmc_init(void) >>> pmc_class_table[n] =3D NULL; >>>=20 >>> /* >>> + * Get soft events list. >>> + */ >>> + soft_event_info.pm_class =3D PMC_CLASS_SOFT; >>> + if (PMC_CALL(GETDYNEVENTINFO, &soft_event_info) < 0) >>> + return (pmc_syscall =3D -1); >>> + >>> + /* Map soft events to static list. */ >>> + for (n =3D 0; n < soft_event_info.pm_nevent; n++) { >>> + soft_event_table[n].pm_ev_name =3D >>> + soft_event_info.pm_events[n].pm_ev_name; >>> + soft_event_table[n].pm_ev_code =3D >>> + soft_event_info.pm_events[n].pm_ev_code; >>> + } >>> + soft_class_table_descr.pm_evc_event_table_size =3D \ >>> + soft_event_info.pm_nevent; >>> + soft_class_table_descr.pm_evc_event_table =3D \ >>> + soft_event_table; >>> + >>> + /* >>> * Fill in the class table. >>> */ >>> n =3D 0; >>> + >>> + /* Fill soft events information. */ >>> + pmc_class_table[n++] =3D &soft_class_table_descr; >>> #if defined(__amd64__) || defined(__i386__) >>> - pmc_class_table[n++] =3D &tsc_class_table_descr; >>> + if (cpu_info.pm_cputype !=3D PMC_CPU_GENERIC) >>> + pmc_class_table[n++] =3D &tsc_class_table_descr; >>>=20 >>> /* >>> * Check if this CPU has fixed function counters. >>> @@ -2867,6 +2929,9 @@ pmc_init(void) >>> pmc_class_table[n] =3D &p4_class_table_descr; >>> break; >>> #endif >>> + case PMC_CPU_GENERIC: >>> + PMC_MDEP_INIT(generic); >>> + break; >>> #if defined(__XSCALE__) >>> case PMC_CPU_INTEL_XSCALE: >>> PMC_MDEP_INIT(xscale); >>> @@ -3035,18 +3100,19 @@ _pmc_name_of_event(enum pmc_event pe, en >>> evfence =3D xscale_event_table + = PMC_EVENT_TABLE_SIZE(xscale); >>> } else if (pe >=3D PMC_EV_MIPS24K_FIRST && pe <=3D = PMC_EV_MIPS24K_LAST) { >>> ev =3D mips24k_event_table; >>> - evfence =3D mips24k_event_table + = PMC_EVENT_TABLE_SIZE(mips24k >>> -); >>> + evfence =3D mips24k_event_table + = PMC_EVENT_TABLE_SIZE(mips24k); >>> } else if (pe >=3D PMC_EV_OCTEON_FIRST && pe <=3D = PMC_EV_OCTEON_LAST) { >>> ev =3D octeon_event_table; >>> evfence =3D octeon_event_table + = PMC_EVENT_TABLE_SIZE(octeon); >>> } else if (pe >=3D PMC_EV_PPC7450_FIRST && pe <=3D = PMC_EV_PPC7450_LAST) { >>> ev =3D ppc7450_event_table; >>> - evfence =3D ppc7450_event_table + = PMC_EVENT_TABLE_SIZE(ppc7450 >>> -); >>> + evfence =3D ppc7450_event_table + = PMC_EVENT_TABLE_SIZE(ppc7450); >>> } else if (pe =3D=3D PMC_EV_TSC_TSC) { >>> ev =3D tsc_event_table; >>> evfence =3D tsc_event_table + = PMC_EVENT_TABLE_SIZE(tsc); >>> + } else if (pe >=3D PMC_EV_SOFT_FIRST && pe <=3D = PMC_EV_SOFT_LAST) { >>> + ev =3D soft_event_table; >>> + evfence =3D soft_event_table + = soft_event_info.pm_nevent; >>> } >>>=20 >>> for (; ev !=3D evfence; ev++) >>>=20 >>> Modified: head/lib/libpmc/pmc.3 >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/lib/libpmc/pmc.3 Wed Mar 28 20:49:11 2012 = (r233627) >>> +++ head/lib/libpmc/pmc.3 Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -223,6 +223,8 @@ and >>> CPUs. >>> .It Li PMC_CLASS_TSC >>> The timestamp counter on i386 and amd64 architecture CPUs. >>> +.It Li PMC_CLASS_SOFT >>> +Software events. >>> .El >>> .Ss PMC Capabilities >>> Capabilities of performance monitoring hardware are denoted using >>> @@ -525,6 +527,7 @@ API is >>> .Xr pmc.p4 3 , >>> .Xr pmc.p5 3 , >>> .Xr pmc.p6 3 , >>> +.Xr pmc.soft 3 , >>> .Xr pmc.tsc 3 , >>> .Xr pmclog 3 , >>> .Xr hwpmc 4 , >>>=20 >>> Modified: head/lib/libpmc/pmc.atom.3 >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/lib/libpmc/pmc.atom.3 Wed Mar 28 20:49:11 2012 = (r233627) >>> +++ head/lib/libpmc/pmc.atom.3 Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -1176,6 +1176,7 @@ and the underlying hardware events used >>> .Xr pmc.p4 3 , >>> .Xr pmc.p5 3 , >>> .Xr pmc.p6 3 , >>> +.Xr pmc.soft 3 , >>> .Xr pmc.tsc 3 , >>> .Xr pmc_cpuinfo 3 , >>> .Xr pmclog 3 , >>>=20 >>> Modified: head/lib/libpmc/pmc.core.3 >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/lib/libpmc/pmc.core.3 Wed Mar 28 20:49:11 2012 = (r233627) >>> +++ head/lib/libpmc/pmc.core.3 Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -792,6 +792,7 @@ may not count some transitions. >>> .Xr pmc.p4 3 , >>> .Xr pmc.p5 3 , >>> .Xr pmc.p6 3 , >>> +.Xr pmc.soft 3 , >>> .Xr pmc.tsc 3 , >>> .Xr pmclog 3 , >>> .Xr hwpmc 4 >>>=20 >>> Modified: head/lib/libpmc/pmc.core2.3 >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/lib/libpmc/pmc.core2.3 Wed Mar 28 20:49:11 2012 = (r233627) >>> +++ head/lib/libpmc/pmc.core2.3 Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -1107,6 +1107,7 @@ and the underlying hardware events used. >>> .Xr pmc.p4 3 , >>> .Xr pmc.p5 3 , >>> .Xr pmc.p6 3 , >>> +.Xr pmc.soft 3 , >>> .Xr pmc.tsc 3 , >>> .Xr pmc_cpuinfo 3 , >>> .Xr pmclog 3 , >>>=20 >>> Modified: head/lib/libpmc/pmc.corei7.3 >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/lib/libpmc/pmc.corei7.3 Wed Mar 28 20:49:11 2012 = (r233627) >>> +++ head/lib/libpmc/pmc.corei7.3 Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -1559,6 +1559,7 @@ Counts number of segment register loads. >>> .Xr pmc.corei7uc 3 , >>> .Xr pmc.westmere 3 , >>> .Xr pmc.westmereuc 3 , >>> +.Xr pmc.soft 3 , >>> .Xr pmc.tsc 3 , >>> .Xr pmc_cpuinfo 3 , >>> .Xr pmclog 3 , >>>=20 >>> Modified: head/lib/libpmc/pmc.corei7uc.3 >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/lib/libpmc/pmc.corei7uc.3 Wed Mar 28 20:49:11 2012 = (r233627) >>> +++ head/lib/libpmc/pmc.corei7uc.3 Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -863,6 +863,7 @@ refreshed or needs to go into a power do >>> .Xr pmc.corei7 3 , >>> .Xr pmc.westmere 3 , >>> .Xr pmc.westmereuc 3 , >>> +.Xr pmc.soft 3 , >>> .Xr pmc.tsc 3 , >>> .Xr pmc_cpuinfo 3 , >>> .Xr pmclog 3 , >>>=20 >>> Modified: head/lib/libpmc/pmc.iaf.3 >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/lib/libpmc/pmc.iaf.3 Wed Mar 28 20:49:11 2012 = (r233627) >>> +++ head/lib/libpmc/pmc.iaf.3 Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -132,6 +132,7 @@ CPU, use the event specifier >>> .Xr pmc.p4 3 , >>> .Xr pmc.p5 3 , >>> .Xr pmc.p6 3 , >>> +.Xr pmc.soft 3 , >>> .Xr pmc.tsc 3 , >>> .Xr pmc_cpuinfo 3 , >>> .Xr pmclog 3 , >>>=20 >>> Modified: head/lib/libpmc/pmc.k7.3 >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/lib/libpmc/pmc.k7.3 Wed Mar 28 20:49:11 2012 = (r233627) >>> +++ head/lib/libpmc/pmc.k7.3 Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -249,6 +249,7 @@ and the underlying hardware events used. >>> .Xr pmc.p4 3 , >>> .Xr pmc.p5 3 , >>> .Xr pmc.p6 3 , >>> +.Xr pmc.soft 3 , >>> .Xr pmc.tsc 3 , >>> .Xr pmclog 3 , >>> .Xr hwpmc 4 >>>=20 >>> Modified: head/lib/libpmc/pmc.k8.3 >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/lib/libpmc/pmc.k8.3 Wed Mar 28 20:49:11 2012 = (r233627) >>> +++ head/lib/libpmc/pmc.k8.3 Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -783,6 +783,7 @@ and the underlying hardware events used. >>> .Xr pmc.p4 3 , >>> .Xr pmc.p5 3 , >>> .Xr pmc.p6 3 , >>> +.Xr pmc.soft 3 , >>> .Xr pmc.tsc 3 , >>> .Xr pmclog 3 , >>> .Xr hwpmc 4 >>>=20 >>> Modified: head/lib/libpmc/pmc.mips24k.3 >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/lib/libpmc/pmc.mips24k.3 Wed Mar 28 20:49:11 2012 = (r233627) >>> +++ head/lib/libpmc/pmc.mips24k.3 Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -392,6 +392,7 @@ and the underlying hardware events used. >>> .Xr pmc.p4 3 , >>> .Xr pmc.p5 3 , >>> .Xr pmc.p6 3 , >>> +.Xr pmc.soft 3 , >>> .Xr pmc.tsc 3 , >>> .Xr pmc_cpuinfo 3 , >>> .Xr pmclog 3 , >>>=20 >>> Modified: head/lib/libpmc/pmc.octeon.3 >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/lib/libpmc/pmc.octeon.3 Wed Mar 28 20:49:11 2012 = (r233627) >>> +++ head/lib/libpmc/pmc.octeon.3 Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -232,6 +232,7 @@ and the underlying hardware events used. >>> .Xr pmc.p4 3 , >>> .Xr pmc.p5 3 , >>> .Xr pmc.p6 3 , >>> +.Xr pmc.soft 3 , >>> .Xr pmc.tsc 3 , >>> .Xr pmc_cpuinfo 3 , >>> .Xr pmclog 3 , >>>=20 >>> Modified: head/lib/libpmc/pmc.p4.3 >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/lib/libpmc/pmc.p4.3 Wed Mar 28 20:49:11 2012 = (r233627) >>> +++ head/lib/libpmc/pmc.p4.3 Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -1208,6 +1208,7 @@ and the underlying hardware events used. >>> .Xr pmc.k8 3 , >>> .Xr pmc.p5 3 , >>> .Xr pmc.p6 3 , >>> +.Xr pmc.soft 3 , >>> .Xr pmc.tsc 3 , >>> .Xr pmclog 3 , >>> .Xr hwpmc 4 >>>=20 >>> Modified: head/lib/libpmc/pmc.p5.3 >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/lib/libpmc/pmc.p5.3 Wed Mar 28 20:49:11 2012 = (r233627) >>> +++ head/lib/libpmc/pmc.p5.3 Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -444,6 +444,7 @@ and the underlying hardware events used. >>> .Xr pmc.k8 3 , >>> .Xr pmc.p4 3 , >>> .Xr pmc.p6 3 , >>> +.Xr pmc.soft 3 , >>> .Xr pmc.tsc 3 , >>> .Xr pmclog 3 , >>> .Xr hwpmc 4 >>>=20 >>> Modified: head/lib/libpmc/pmc.p6.3 >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/lib/libpmc/pmc.p6.3 Wed Mar 28 20:49:11 2012 = (r233627) >>> +++ head/lib/libpmc/pmc.p6.3 Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -1010,6 +1010,7 @@ and the underlying hardware events used. >>> .Xr pmc.k8 3 , >>> .Xr pmc.p4 3 , >>> .Xr pmc.p5 3 , >>> +.Xr pmc.soft 3 , >>> .Xr pmc.tsc 3 , >>> .Xr pmclog 3 , >>> .Xr hwpmc 4 >>>=20 >>> Modified: head/lib/libpmc/pmc.sandybridge.3 >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/lib/libpmc/pmc.sandybridge.3 Wed Mar 28 20:49:11 2012 = (r233627) >>> +++ head/lib/libpmc/pmc.sandybridge.3 Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -907,6 +907,7 @@ Split locks in SQ. >>> .Xr pmc.p5 3 , >>> .Xr pmc.p6 3 , >>> .Xr pmc.sandybridgeuc 3 , >>> +.Xr pmc.soft 3 , >>> .Xr pmc.tsc 3 , >>> .Xr pmc.ucf 3 , >>> .Xr pmc.westmere 3 , >>>=20 >>> Modified: head/lib/libpmc/pmc.sandybridgeuc.3 >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/lib/libpmc/pmc.sandybridgeuc.3 Wed Mar 28 20:49:11 2012 = (r233627) >>> +++ head/lib/libpmc/pmc.sandybridgeuc.3 Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -208,6 +208,7 @@ Counts the number of core-outgoing entri >>> .Xr pmc.p5 3 , >>> .Xr pmc.p6 3 , >>> .Xr pmc.sandybridge 3 , >>> +.Xr pmc.soft 3 , >>> .Xr pmc.tsc 3 , >>> .Xr pmc.ucf 3 , >>> .Xr pmc.westmere 3 , >>>=20 >>> Added: head/lib/libpmc/pmc.soft.3 >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- /dev/null 00:00:00 1970 (empty, because file is newly added) >>> +++ head/lib/libpmc/pmc.soft.3 Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -0,0 +1,104 @@ >>> +.\" Copyright (c) 2012 Fabien Thomas. All rights reserved. >>> +.\" >>> +.\" Redistribution and use in source and binary forms, with or = without >>> +.\" modification, are permitted provided that the following = conditions >>> +.\" are met: >>> +.\" 1. Redistributions of source code must retain the above = copyright >>> +.\" notice, this list of conditions and the following = disclaimer. >>> +.\" 2. Redistributions in binary form must reproduce the above = copyright >>> +.\" notice, this list of conditions and the following disclaimer = in the >>> +.\" documentation and/or other materials provided with the = distribution. >>> +.\" >>> +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS = IS'' AND >>> +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED = TO, THE >>> +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A = PARTICULAR PURPOSE >>> +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS = BE LIABLE >>> +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR = CONSEQUENTIAL >>> +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF = SUBSTITUTE GOODS >>> +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS = INTERRUPTION) >>> +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN = CONTRACT, STRICT >>> +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING = IN ANY WAY >>> +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE = POSSIBILITY OF >>> +.\" SUCH DAMAGE. >>> +.\" >>> +.\" $FreeBSD$ >>> +.\" >>> +.Dd March 28, 2012 >>> +.Os >>> +.Dt PMC.SOFT 3 >>> +.Sh NAME >>> +.Nm pmc.soft >>> +.Nd measurements using software based events >>> +.Sh LIBRARY >>> +.Lb libpmc >>> +.Sh SYNOPSIS >>> +.In pmc.h >>> +.Sh DESCRIPTION >>> +Software events are used to collect various source of software = events. >>> +.Ss PMC Features >>> +16 sampling counters using software events based on various = sources. >>> +These PMCs support the following capabilities: >>> +.Bl -column "PMC_CAP_INTERRUPT" "Support" >>> +.It Em Capability Ta Em Support >>> +.It PMC_CAP_CASCADE Ta \&No >>> +.It PMC_CAP_EDGE Ta \&No >>> +.It PMC_CAP_INTERRUPT Ta Yes >>> +.It PMC_CAP_INVERT Ta \&No >>> +.It PMC_CAP_READ Ta Yes >>> +.It PMC_CAP_PRECISE Ta \&No >>> +.It PMC_CAP_SYSTEM Ta Yes >>> +.It PMC_CAP_TAGGING Ta \&No >>> +.It PMC_CAP_THRESHOLD Ta \&No >>> +.It PMC_CAP_USER Ta Yes >>> +.It PMC_CAP_WRITE Ta Yes >>> +.El >>> +.Ss Event Qualifiers >>> +There is no supported event qualifier. >>> +.Pp >>> +The event specifiers supported by software are: >>> +.Bl -tag -width indent >>> +.It Li CLOCK.HARD >>> +Hard clock ticks. >>> +.It Li CLOCK.STAT >>> +Stat clock ticks. >>> +.It Li LOCK.FAILED >>> +Lock acquisition failed. >>> +.It Li PAGE_FAULT.ALL >>> +All page fault type. >>> +.It Li PAGE_FAULT.READ >>> +Read page fault. >>> +.It Li PAGE_FAULT.WRITE >>> +Write page fault. >>> +.El >>> +.Sh SEE ALSO >>> +.Xr pmc 3 , >>> +.Xr pmc.atom 3 , >>> +.Xr pmc.core 3 , >>> +.Xr pmc.iaf 3 , >>> +.Xr pmc.ucf 3 , >>> +.Xr pmc.k7 3 , >>> +.Xr pmc.k8 3 , >>> +.Xr pmc.p4 3 , >>> +.Xr pmc.p5 3 , >>> +.Xr pmc.p6 3 , >>> +.Xr pmc.corei7 3 , >>> +.Xr pmc.corei7uc 3 , >>> +.Xr pmc.westmereuc 3 , >>> +.Xr pmc.tsc 3 , >>> +.Xr pmc_cpuinfo 3 , >>> +.Xr pmclog 3 , >>> +.Xr hwpmc 4 >>> +.Sh HISTORY >>> +The >>> +.Nm pmc >>> +library first appeared in >>> +.Fx 6.0 . >>> +.Sh AUTHORS >>> +The >>> +.Lb libpmc >>> +library was written by >>> +.An "Joseph Koshy" >>> +.Aq jkoshy@FreeBSD.org . >>> +Software PMC was written by >>> +.An "Fabien Thomas" >>> +.Aq fabient@FreeBSD.org . >>>=20 >>> Modified: head/lib/libpmc/pmc.tsc.3 >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/lib/libpmc/pmc.tsc.3 Wed Mar 28 20:49:11 2012 = (r233627) >>> +++ head/lib/libpmc/pmc.tsc.3 Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -68,6 +68,7 @@ maps to the TSC. >>> .Xr pmc.p4 3 , >>> .Xr pmc.p5 3 , >>> .Xr pmc.p6 3 , >>> +.Xr pmc.soft 3 , >>> .Xr pmclog 3 , >>> .Xr hwpmc 4 >>> .Sh HISTORY >>>=20 >>> Modified: head/lib/libpmc/pmc.ucf.3 >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/lib/libpmc/pmc.ucf.3 Wed Mar 28 20:49:11 2012 = (r233627) >>> +++ head/lib/libpmc/pmc.ucf.3 Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -96,6 +96,7 @@ offset C0H under device number 0 and Fun >>> .Xr pmc.corei7uc 3 , >>> .Xr pmc.westmere 3 , >>> .Xr pmc.westmereuc 3 , >>> +.Xr pmc.soft 3 , >>> .Xr pmc.tsc 3 , >>> .Xr pmc_cpuinfo 3 , >>> .Xr pmclog 3 , >>>=20 >>> Modified: head/lib/libpmc/pmc.westmere.3 >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/lib/libpmc/pmc.westmere.3 Wed Mar 28 20:49:11 2012 = (r233627) >>> +++ head/lib/libpmc/pmc.westmere.3 Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -1381,6 +1381,7 @@ Counts number of SID integer 64 bit shif >>> .Xr pmc.corei7 3 , >>> .Xr pmc.corei7uc 3 , >>> .Xr pmc.westmereuc 3 , >>> +.Xr pmc.soft 3 , >>> .Xr pmc.tsc 3 , >>> .Xr pmc_cpuinfo 3 , >>> .Xr pmclog 3 , >>>=20 >>> Modified: head/lib/libpmc/pmc.westmereuc.3 >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/lib/libpmc/pmc.westmereuc.3 Wed Mar 28 20:49:11 2012 = (r233627) >>> +++ head/lib/libpmc/pmc.westmereuc.3 Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -1066,6 +1066,7 @@ disabled. >>> .Xr pmc.corei7 3 , >>> .Xr pmc.corei7uc 3 , >>> .Xr pmc.westmere 3 , >>> +.Xr pmc.soft 3 , >>> .Xr pmc.tsc 3 , >>> .Xr pmc_cpuinfo 3 , >>> .Xr pmclog 3 , >>>=20 >>> Modified: head/lib/libpmc/pmc.xscale.3 >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/lib/libpmc/pmc.xscale.3 Wed Mar 28 20:49:11 2012 = (r233627) >>> +++ head/lib/libpmc/pmc.xscale.3 Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -134,6 +134,7 @@ and the underlying hardware events used. >>> .Xr pmc 3 , >>> .Xr pmc_cpuinfo 3 , >>> .Xr pmclog 3 , >>> +.Xr pmc.soft 3 , >>> .Xr hwpmc 4 >>> .Sh HISTORY >>> The >>>=20 >>> Modified: head/lib/libpmc/pmclog.c >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/lib/libpmc/pmclog.c Wed Mar 28 20:49:11 2012 = (r233627) >>> +++ head/lib/libpmc/pmclog.c Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -369,6 +369,12 @@ pmclog_get_event(void *cookie, char **da >>> =3D=3D NULL) >>> goto error; >>> break; >>> + case PMCLOG_TYPE_PMCALLOCATEDYN: >>> + PMCLOG_READ32(le,ev->pl_u.pl_ad.pl_pmcid); >>> + PMCLOG_READ32(le,ev->pl_u.pl_ad.pl_event); >>> + PMCLOG_READ32(le,ev->pl_u.pl_ad.pl_flags); >>> + = PMCLOG_READSTRING(le,ev->pl_u.pl_ad.pl_evname,PMC_NAME_MAX); >>> + break; >>> case PMCLOG_TYPE_PMCATTACH: >>> PMCLOG_GET_PATHLEN(pathlen,evlen,pmclog_pmcattach); >>> PMCLOG_READ32(le,ev->pl_u.pl_t.pl_pmcid); >>>=20 >>> Modified: head/lib/libpmc/pmclog.h >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/lib/libpmc/pmclog.h Wed Mar 28 20:49:11 2012 = (r233627) >>> +++ head/lib/libpmc/pmclog.h Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -88,6 +88,13 @@ struct pmclog_ev_pmcallocate { >>> pmc_id_t pl_pmcid; >>> }; >>>=20 >>> +struct pmclog_ev_pmcallocatedyn { >>> + uint32_t pl_event; >>> + char pl_evname[PMC_NAME_MAX]; >>> + uint32_t pl_flags; >>> + pmc_id_t pl_pmcid; >>> +}; >>> + >>> struct pmclog_ev_pmcattach { >>> pmc_id_t pl_pmcid; >>> pid_t pl_pid; >>> @@ -146,6 +153,7 @@ struct pmclog_ev { >>> struct pmclog_ev_map_out pl_mo; >>> struct pmclog_ev_pcsample pl_s; >>> struct pmclog_ev_pmcallocate pl_a; >>> + struct pmclog_ev_pmcallocatedyn pl_ad; >>> struct pmclog_ev_pmcattach pl_t; >>> struct pmclog_ev_pmcdetach pl_d; >>> struct pmclog_ev_proccsw pl_c; >>>=20 >>> Modified: head/sys/amd64/amd64/trap.c >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/sys/amd64/amd64/trap.c Wed Mar 28 20:49:11 2012 = (r233627) >>> +++ head/sys/amd64/amd64/trap.c Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -71,6 +71,9 @@ __FBSDID("$FreeBSD$"); >>> #include >>> #ifdef HWPMC_HOOKS >>> #include >>> +PMC_SOFT_DEFINE( , , page_fault, all); >>> +PMC_SOFT_DEFINE( , , page_fault, read); >>> +PMC_SOFT_DEFINE( , , page_fault, write); >>> #endif >>>=20 >>> #include >>> @@ -743,8 +746,20 @@ trap_pfault(frame, usermode) >>> */ >>> rv =3D vm_fault(map, va, ftype, VM_FAULT_NORMAL); >>> } >>> - if (rv =3D=3D KERN_SUCCESS) >>> + if (rv =3D=3D KERN_SUCCESS) { >>> +#ifdef HWPMC_HOOKS >>> + if (ftype =3D=3D VM_PROT_READ || ftype =3D=3D = VM_PROT_WRITE) { >>> + PMC_SOFT_CALL_TF( , , page_fault, all, = frame); >>> + if (ftype =3D=3D VM_PROT_READ) >>> + PMC_SOFT_CALL_TF( , , page_fault, = read, >>> + frame); >>> + else >>> + PMC_SOFT_CALL_TF( , , page_fault, = write, >>> + frame); >>> + } >>> +#endif >>> return (0); >>> + } >>> nogo: >>> if (!usermode) { >>> if (td->td_intr_nesting_level =3D=3D 0 && >>>=20 >>> Modified: head/sys/amd64/include/pmc_mdep.h >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/sys/amd64/include/pmc_mdep.h Wed Mar 28 20:49:11 2012 = (r233627) >>> +++ head/sys/amd64/include/pmc_mdep.h Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -50,13 +50,13 @@ struct pmc_mdep; >>> * measurement architecture have PMCs of the following classes: TSC, >>> * IAF, IAP, UCF and UCP. >>> */ >>> -#define PMC_MDEP_CLASS_INDEX_TSC 0 >>> -#define PMC_MDEP_CLASS_INDEX_K8 1 >>> -#define PMC_MDEP_CLASS_INDEX_P4 1 >>> -#define PMC_MDEP_CLASS_INDEX_IAP 1 >>> -#define PMC_MDEP_CLASS_INDEX_IAF 2 >>> -#define PMC_MDEP_CLASS_INDEX_UCP 3 >>> -#define PMC_MDEP_CLASS_INDEX_UCF 4 >>> +#define PMC_MDEP_CLASS_INDEX_TSC 1 >>> +#define PMC_MDEP_CLASS_INDEX_K8 2 >>> +#define PMC_MDEP_CLASS_INDEX_P4 2 >>> +#define PMC_MDEP_CLASS_INDEX_IAP 2 >>> +#define PMC_MDEP_CLASS_INDEX_IAF 3 >>> +#define PMC_MDEP_CLASS_INDEX_UCP 4 >>> +#define PMC_MDEP_CLASS_INDEX_UCF 5 >>>=20 >>> /* >>> * On the amd64 platform we support the following PMCs. >>> @@ -119,6 +119,15 @@ union pmc_md_pmc { >>>=20 >>> #define PMC_IN_USERSPACE(va) ((va) <=3D VM_MAXUSER_ADDRESS) >>>=20 >>> +/* Build a fake kernel trapframe from current instruction pointer. = */ >>> +#define PMC_FAKE_TRAPFRAME(TF) = \ >>> + do { = \ >>> + (TF)->tf_cs =3D 0; (TF)->tf_rflags =3D 0; = \ >>> + __asm __volatile("movq %%rbp,%0" : "=3Dr" ((TF)->tf_rbp)); = \ >>> + __asm __volatile("movq %%rsp,%0" : "=3Dr" ((TF)->tf_rsp)); = \ >>> + __asm __volatile("call 1f \n\t1: pop %0" : = "=3Dr"((TF)->tf_rip)); \ >>> + } while (0) >>> + >>> /* >>> * Prototypes >>> */ >>>=20 >>> Modified: head/sys/arm/include/pmc_mdep.h >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/sys/arm/include/pmc_mdep.h Wed Mar 28 20:49:11 2012 = (r233627) >>> +++ head/sys/arm/include/pmc_mdep.h Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -29,7 +29,7 @@ >>> #ifndef _MACHINE_PMC_MDEP_H_ >>> #define _MACHINE_PMC_MDEP_H_ >>>=20 >>> -#define PMC_MDEP_CLASS_INDEX_XSCALE 0 >>> +#define PMC_MDEP_CLASS_INDEX_XSCALE 1 >>> /* >>> * On the ARM platform we support the following PMCs. >>> * >>>=20 >>> Modified: head/sys/conf/files >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/sys/conf/files Wed Mar 28 20:49:11 2012 (r233627) >>> +++ head/sys/conf/files Wed Mar 28 20:58:30 2012 (r233628) >>> @@ -1260,6 +1260,7 @@ dev/hme/if_hme_sbus.c optional hme = sbus >>> dev/hptiop/hptiop.c optional hptiop scbus >>> dev/hwpmc/hwpmc_logging.c optional hwpmc >>> dev/hwpmc/hwpmc_mod.c optional hwpmc >>> +dev/hwpmc/hwpmc_soft.c optional hwpmc >>> dev/ichsmb/ichsmb.c optional ichsmb >>> dev/ichsmb/ichsmb_pci.c optional ichsmb pci >>> dev/ida/ida.c optional ida >>>=20 >>> Modified: head/sys/dev/hwpmc/hwpmc_amd.c >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/sys/dev/hwpmc/hwpmc_amd.c Wed Mar 28 20:49:11 2012 = (r233627) >>> +++ head/sys/dev/hwpmc/hwpmc_amd.c Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -687,7 +687,8 @@ amd_intr(int cpu, struct trapframe *tf) >>> wrmsr(perfctr, AMD_RELOAD_COUNT_TO_PERFCTR_VALUE(v)); >>>=20 >>> /* Restart the counter if logging succeeded. */ >>> - error =3D pmc_process_interrupt(cpu, pm, tf, = TRAPF_USERMODE(tf)); >>> + error =3D pmc_process_interrupt(cpu, PMC_HR, pm, tf, >>> + TRAPF_USERMODE(tf)); >>> if (error =3D=3D 0) >>> wrmsr(evsel, config | AMD_PMC_ENABLE); >>> } >>> @@ -874,7 +875,7 @@ amd_pcpu_fini(struct pmc_mdep *md, int c >>> struct pmc_mdep * >>> pmc_amd_initialize(void) >>> { >>> - int classindex, error, i, nclasses, ncpus; >>> + int classindex, error, i, ncpus; >>> struct pmc_classdep *pcd; >>> enum pmc_cputype cputype; >>> struct pmc_mdep *pmc_mdep; >>> @@ -926,12 +927,9 @@ pmc_amd_initialize(void) >>> * These processors have two classes of PMCs: the TSC and >>> * programmable PMCs. >>> */ >>> - nclasses =3D 2; >>> - pmc_mdep =3D malloc(sizeof(struct pmc_mdep) + nclasses * = sizeof (struct pmc_classdep), >>> - M_PMC, M_WAITOK|M_ZERO); >>> + pmc_mdep =3D pmc_mdep_alloc(2); >>>=20 >>> pmc_mdep->pmd_cputype =3D cputype; >>> - pmc_mdep->pmd_nclass =3D nclasses; >>>=20 >>> ncpus =3D pmc_cpu_max(); >>>=20 >>>=20 >>> Modified: head/sys/dev/hwpmc/hwpmc_core.c >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/sys/dev/hwpmc/hwpmc_core.c Wed Mar 28 20:49:11 2012 = (r233627) >>> +++ head/sys/dev/hwpmc/hwpmc_core.c Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -2239,7 +2239,7 @@ core_intr(int cpu, struct trapframe *tf) >>> if (pm->pm_state !=3D PMC_STATE_RUNNING) >>> continue; >>>=20 >>> - error =3D pmc_process_interrupt(cpu, pm, tf, >>> + error =3D pmc_process_interrupt(cpu, PMC_HR, pm, tf, >>> TRAPF_USERMODE(tf)); >>>=20 >>> v =3D pm->pm_sc.pm_reloadcount; >>> @@ -2326,7 +2326,7 @@ core2_intr(int cpu, struct trapframe *tf >>> !PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) >>> continue; >>>=20 >>> - error =3D pmc_process_interrupt(cpu, pm, tf, >>> + error =3D pmc_process_interrupt(cpu, PMC_HR, pm, tf, >>> TRAPF_USERMODE(tf)); >>> if (error) >>> intrenable &=3D ~flag; >>> @@ -2354,7 +2354,7 @@ core2_intr(int cpu, struct trapframe *tf >>> !PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) >>> continue; >>>=20 >>> - error =3D pmc_process_interrupt(cpu, pm, tf, >>> + error =3D pmc_process_interrupt(cpu, PMC_HR, pm, tf, >>> TRAPF_USERMODE(tf)); >>> if (error) >>> intrenable &=3D ~flag; >>>=20 >>> Modified: head/sys/dev/hwpmc/hwpmc_intel.c >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/sys/dev/hwpmc/hwpmc_intel.c Wed Mar 28 20:49:11 2012 = (r233627) >>> +++ head/sys/dev/hwpmc/hwpmc_intel.c Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -162,12 +162,10 @@ pmc_intel_initialize(void) >>> return (NULL); >>> } >>>=20 >>> - pmc_mdep =3D malloc(sizeof(struct pmc_mdep) + nclasses * >>> - sizeof(struct pmc_classdep), M_PMC, M_WAITOK|M_ZERO); >>> + /* Allocate base class and initialize machine dependent = struct */ >>> + pmc_mdep =3D pmc_mdep_alloc(nclasses); >>>=20 >>> pmc_mdep->pmd_cputype =3D cputype; >>> - pmc_mdep->pmd_nclass =3D nclasses; >>> - >>> pmc_mdep->pmd_switch_in =3D intel_switch_in; >>> pmc_mdep->pmd_switch_out =3D intel_switch_out; >>>=20 >>>=20 >>> Modified: head/sys/dev/hwpmc/hwpmc_logging.c >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/sys/dev/hwpmc/hwpmc_logging.c Wed Mar 28 20:49:11 2012 = (r233627) >>> +++ head/sys/dev/hwpmc/hwpmc_logging.c Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -129,6 +129,7 @@ static struct mtx pmc_kthread_mtx; /* sl >>>=20 >>> /* Emit a string. Caution: does NOT update _le, so needs to be = last */ >>> #define PMCLOG_EMITSTRING(S,L) do { bcopy((S), _le, (L)); } = while (0) >>> +#define PMCLOG_EMITNULLSTRING(L) do { bzero(_le, (L)); } = while (0) >>>=20 >>> #define PMCLOG_DESPATCH(PO) = \ >>> pmclog_release((PO)); = \ >>> @@ -835,16 +836,33 @@ void >>> pmclog_process_pmcallocate(struct pmc *pm) >>> { >>> struct pmc_owner *po; >>> + struct pmc_soft *ps; >>>=20 >>> po =3D pm->pm_owner; >>>=20 >>> PMCDBG(LOG,ALL,1, "pm=3D%p", pm); >>>=20 >>> - PMCLOG_RESERVE(po, PMCALLOCATE, sizeof(struct = pmclog_pmcallocate)); >>> - PMCLOG_EMIT32(pm->pm_id); >>> - PMCLOG_EMIT32(pm->pm_event); >>> - PMCLOG_EMIT32(pm->pm_flags); >>> - PMCLOG_DESPATCH(po); >>> + if (PMC_TO_CLASS(pm) =3D=3D PMC_CLASS_SOFT) { >>> + PMCLOG_RESERVE(po, PMCALLOCATEDYN, >>> + sizeof(struct pmclog_pmcallocatedyn)); >>> + PMCLOG_EMIT32(pm->pm_id); >>> + PMCLOG_EMIT32(pm->pm_event); >>> + PMCLOG_EMIT32(pm->pm_flags); >>> + ps =3D pmc_soft_ev_acquire(pm->pm_event); >>> + if (ps !=3D NULL) >>> + = PMCLOG_EMITSTRING(ps->ps_ev.pm_ev_name,PMC_NAME_MAX); >>> + else >>> + PMCLOG_EMITNULLSTRING(PMC_NAME_MAX); >>> + pmc_soft_ev_release(ps); >>> + PMCLOG_DESPATCH(po); >>> + } else { >>> + PMCLOG_RESERVE(po, PMCALLOCATE, >>> + sizeof(struct pmclog_pmcallocate)); >>> + PMCLOG_EMIT32(pm->pm_id); >>> + PMCLOG_EMIT32(pm->pm_event); >>> + PMCLOG_EMIT32(pm->pm_flags); >>> + PMCLOG_DESPATCH(po); >>> + } >>> } >>>=20 >>> void >>>=20 >>> Modified: head/sys/dev/hwpmc/hwpmc_mips.c >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/sys/dev/hwpmc/hwpmc_mips.c Wed Mar 28 20:49:11 2012 = (r233627) >>> +++ head/sys/dev/hwpmc/hwpmc_mips.c Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -287,7 +287,7 @@ mips_pmc_intr(int cpu, struct trapframe >>> retval =3D 1; >>> if (pm->pm_state !=3D PMC_STATE_RUNNING) >>> continue; >>> - error =3D pmc_process_interrupt(cpu, pm, tf, >>> + error =3D pmc_process_interrupt(cpu, PMC_HR, pm, tf, >>> TRAPF_USERMODE(tf)); >>> if (error) { >>> /* Clear/disable the relevant counter */ >>>=20 >>> Modified: head/sys/dev/hwpmc/hwpmc_mod.c >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/sys/dev/hwpmc/hwpmc_mod.c Wed Mar 28 20:49:11 2012 = (r233627) >>> +++ head/sys/dev/hwpmc/hwpmc_mod.c Wed Mar 28 20:58:30 2012 = (r233628) >>> @@ -70,6 +70,8 @@ __FBSDID("$FreeBSD$"); >>> #include >>> #include >>>=20 >>> +#include "hwpmc_soft.h" >>> + >>> /* >>> * Types >>> */ >>> @@ -182,7 +184,7 @@ static int pmc_attach_one_process(struct >>> static int pmc_can_allocate_rowindex(struct proc *p, unsigned = int ri, >>> int cpu); >>> static int pmc_can_attach(struct pmc *pm, struct proc *p); >>> -static void pmc_capture_user_callchain(int cpu, struct trapframe = *tf); >>> +static void pmc_capture_user_callchain(int cpu, int soft, struct = trapframe *tf); >>> static void pmc_cleanup(void); >>> static int pmc_detach_process(struct proc *p, struct pmc *pm); >>> static int pmc_detach_one_process(struct proc *p, struct pmc = *pm, >>> @@ -206,7 +208,7 @@ static void pmc_process_csw_out(struct t >>> static void pmc_process_exit(void *arg, struct proc *p); >>> static void pmc_process_fork(void *arg, struct proc *p1, >>> struct proc *p2, int n); >>> -static void pmc_process_samples(int cpu); >>> +static void pmc_process_samples(int cpu, int soft); >>> static void pmc_release_pmc_descriptor(struct pmc *pmc); >>> static void pmc_remove_owner(struct pmc_owner *po); >>> static void pmc_remove_process_descriptor(struct pmc_process = *pp); >>> @@ -218,12 +220,16 @@ static int pmc_stop(struct pmc *pm); >>> static int pmc_syscall_handler(struct thread *td, void = *syscall_args); >>> static void pmc_unlink_target_process(struct pmc *pmc, >>> struct pmc_process *pp); >>> +static int generic_switch_in(struct pmc_cpu *pc, struct pmc_process = *pp); >>> +static int generic_switch_out(struct pmc_cpu *pc, struct = pmc_process *pp); >>> +static struct pmc_mdep *pmc_generic_cpu_initialize(void); >>> +static void pmc_generic_cpu_finalize(struct pmc_mdep *md); >>>=20 >>> /* >>> * Kernel tunables and sysctl(8) interface. >>> */ >>>=20 >>> -SYSCTL_NODE(_kern, OID_AUTO, hwpmc, CTLFLAG_RW, 0, "HWPMC = parameters"); >>> +SYSCTL_DECL(_kern_hwpmc); >>>=20 >>> static int pmc_callchaindepth =3D PMC_CALLCHAIN_DEPTH; >>> TUNABLE_INT(PMC_SYSCTL_NAME_PREFIX "callchaindepth", = &pmc_callchaindepth); >>> @@ -1833,7 +1839,9 @@ const char *pmc_hooknames[] =3D { >>> "KLDUNLOAD", >>> "MMAP", >>> "MUNMAP", >>> - "CALLCHAIN" >>> + "CALLCHAIN-NMI", >>> + "CALLCHAIN-SOFT", >>> + "SOFTSAMPLING" >>> }; >>> #endif >>>=20 >>> @@ -1992,7 +2000,8 @@ pmc_hook_handler(struct thread *td, int >>> * lose the interrupt sample. >>> */ >>> CPU_CLR_ATOMIC(PCPU_GET(cpuid), &pmc_cpumask); >>> - pmc_process_samples(PCPU_GET(cpuid)); >>> + pmc_process_samples(PCPU_GET(cpuid), PMC_HR); >>> + pmc_process_samples(PCPU_GET(cpuid), PMC_SR); >>> break; >>>=20 >>>=20 >>> @@ -2022,11 +2031,30 @@ pmc_hook_handler(struct thread *td, int >>> */ >>> KASSERT(td =3D=3D curthread, ("[pmc,%d] td !=3D = curthread", >>> __LINE__)); >>> - pmc_capture_user_callchain(PCPU_GET(cpuid), >>> + >>> + pmc_capture_user_callchain(PCPU_GET(cpuid), PMC_HR, >>> (struct trapframe *) arg); >>> td->td_pflags &=3D ~TDP_CALLCHAIN; >>> break; >>>=20 >>> + case PMC_FN_USER_CALLCHAIN_SOFT: >>> + /* >>> + * Record a call chain. >>> + */ >>> + KASSERT(td =3D=3D curthread, ("[pmc,%d] td !=3D = curthread", >>> + __LINE__)); >>> + pmc_capture_user_callchain(PCPU_GET(cpuid), PMC_SR, >>> + (struct trapframe *) arg); >>> + td->td_pflags &=3D ~TDP_CALLCHAIN; >>> + break; >>> + >>> + case PMC_FN_SOFT_SAMPLING: >>> + /* >>> + * Call soft PMC sampling intr. >>> + */ >>> + pmc_soft_intr((struct pmckern_soft *) arg); >>> + break; >>> + >>> default: >>> #ifdef DEBUG >>> KASSERT(0, ("[pmc,%d] unknown hook %d\n", __LINE__, = function)); >>> @@ -2221,18 +2249,17 @@ pmc_destroy_pmc_descriptor(struct pmc *p >>> static void >>> pmc_wait_for_pmc_idle(struct pmc *pm) >>> { >>> -#ifdef DEBUG >>> +#ifdef DEBUG >>> volatile int maxloop; >>>=20 >>> maxloop =3D 100 * pmc_cpu_max(); >>> #endif >>> - >>> /* >>> * Loop (with a forced context switch) till the PMC's = runcount >>> * comes down to zero. >>> */ >>> while (atomic_load_acq_32(&pm->pm_runcount) > 0) { >>> -#ifdef DEBUG >>> +#ifdef DEBUG >>> maxloop--; >>> KASSERT(maxloop > 0, >>> ("[pmc,%d] (ri%d, rc%d) waiting too long for " >>> @@ -2972,6 +2999,53 @@ pmc_syscall_handler(struct thread *td, v >>> } >>> break; >>>=20 >>> + /* >>> + * Retrieve soft events list. >>> + */ >>> + case PMC_OP_GETDYNEVENTINFO: >>> + { >>> + enum pmc_class cl; >>> + enum pmc_event ev; >>> + struct pmc_op_getdyneventinfo *gei; >>> + struct pmc_dyn_event_descr dev; >>> + struct pmc_soft *ps; >>> + uint32_t nevent; >>> + >>> + sx_assert(&pmc_sx, SX_LOCKED); >>> + >>> + gei =3D (struct pmc_op_getdyneventinfo *) arg; >>> + >>> + if ((error =3D copyin(&gei->pm_class, &cl, = sizeof(cl))) !=3D 0) >>> + break; >>> + >>> + /* Only SOFT class is dynamic. */ >>> + if (cl !=3D PMC_CLASS_SOFT) { >>> + error =3D EINVAL; >>> + break; >>> + } >>> + >>> + nevent =3D 0; >>> + for (ev =3D PMC_EV_SOFT_FIRST; ev <=3D = PMC_EV_SOFT_LAST; ev++) { >>> + ps =3D pmc_soft_ev_acquire(ev); >>> + if (ps =3D=3D NULL) >>> + continue; >>> + bcopy(&ps->ps_ev, &dev, sizeof(dev)); >>> + pmc_soft_ev_release(ps); >>> + >>> + error =3D copyout(&dev, >>> + &gei->pm_events[nevent], >>> + sizeof(struct pmc_dyn_event_descr)); >>> + if (error !=3D 0) >>> + break; >>> + nevent++; >>> + } >>> + if (error !=3D 0) >>> + break; >>> + >>> + error =3D copyout(&nevent, &gei->pm_nevent, >>>=20 >>> *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** >=20 >=20 >=20 > --=20 > Monthadar Al Jaberi > --Apple-Mail=_0FFE1445-1962-4A52-A902-4106C0401133-- --Apple-Mail=_24EA901A-324C-4465-880C-9C948861B2D8-- From owner-freebsd-mips@FreeBSD.ORG Mon Apr 23 08:06:44 2012 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E320D106564A; Mon, 23 Apr 2012 08:06:44 +0000 (UTC) (envelope-from monthadar@gmail.com) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 7409D8FC12; Mon, 23 Apr 2012 08:06:43 +0000 (UTC) Received: by weyt57 with SMTP id t57so736767wey.13 for ; Mon, 23 Apr 2012 01:06:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=TRmRQFOPcbm0jOjVEA5z98WYI/6AgEpsL4qftn+/ES4=; b=Ah8RP20px8Umq6zozUuYg10y4TVRsUIh4ozdiqljoHN7iuePaJvmLjCBbIZi50qyMO FYh3iXtHnKsl3AgoxbeQDhBfA6JUhEzUqQ3yWTPprNTpYKce8wPGxsfqCoFg3s74Zac2 +sDmvgVqgAi0DIdPrR3L7xwfBigZj6EIjvgji4QWpRtB4RNnN1a1+roD1K+hZ5bT9oKI adragkIpPI4TRpvVGjvrBX57qOApHa2LGy0zActWSc84BtYCbsl/IOPaUOs1KyHKRfNX wc4HOKDcER5W4EbXwImlnPgV7bEWz2F62E3tirjfyEMOKomaMfxSFIef9UYRZ/33jRJM /t6w== MIME-Version: 1.0 Received: by 10.216.135.219 with SMTP id u69mr9025316wei.89.1335168402280; Mon, 23 Apr 2012 01:06:42 -0700 (PDT) Received: by 10.223.155.74 with HTTP; Mon, 23 Apr 2012 01:06:42 -0700 (PDT) In-Reply-To: <25D59FAA-D52A-42FB-8120-66467863AB0B@netasq.com> References: <201203282058.q2SKwVsJ053900@svn.freebsd.org> <25D59FAA-D52A-42FB-8120-66467863AB0B@netasq.com> Date: Mon, 23 Apr 2012 10:06:42 +0200 Message-ID: From: Monthadar Al Jaberi To: Fabien Thomas Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: monthadar@freebsd.org, freebsd-current , Fabien Thomas , freebsd-mips@freebsd.org Subject: Re: svn commit: r233628 - in head: lib/libpmc sys/amd64/amd64 sys/amd64/include sys/arm/include sys/conf sys/dev/hwpmc sys/i386/i386 sys/i386/include sys/kern sys/mips/include sys/modules/hwpmc sys/pow... X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Apr 2012 08:06:45 -0000 On Mon, Apr 23, 2012 at 9:47 AM, Fabien Thomas w= rote: > Hi, > > The rumors seems true :) > Can you try the patch attached (I cannot test as i've no MIPS hardware) ? my RSPRO boots fine now, thank you :) > > Thanks, > Fabien > > >> On Mon, Apr 23, 2012 at 8:44 AM, Adrian Chadd wrote= : >>> Hi Fabien, >>> >>> I've heard some rumours that this broke hwpmc support for mips24k. >>> >>> Monthadar, can you please provide some background info for this? >>> >> >> This is the log output >> >> Using default protocol (TFTP) >> Entry point: 0x80050100, address range: 0x80050000-0x804f1dcc >> RedBoot> exec >> Now booting linux kernel: >> Base address 0x80050000 Entry 0x80050100 >> memsize=3D0x08000000 >> modetty0=3D0,n,8,1,hw >> board=3DRouterStation PRO >> ethaddr=3D00.15.6d.c8.c9.2e >> CPU platform: Atheros AR7161 rev 2 >> CPU Frequency=3D720 MHz >> CPU DDR Frequency=3D360 MHz >> CPU AHB Frequency=3D180 MHz >> platform frequency: 720000000 >> arguments: >> =C2=A0a0 =3D 00000002 >> =C2=A0a1 =3D 80050028 >> =C2=A0a2 =3D 80050000 >> =C2=A0a3 =3D 00000001 >> Cmd line: =C2=A0=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD= =EF=BF=BDm=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD= =EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD_}= =EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=DF=BEq=EF=BF=BD=EF= =BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF= =BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD =EF=BF=BD=EF=BF=BD=EF=BF= =BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD= =EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=DF=BF=EF=BF=BD=EF=BF= =BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD_=EF=BF= =BDw=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD =EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF= =BD=EF=BF=BD?-=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD{=EF=BF=BD=EF=BF=BD=EF=BF= =BD=EF=BF=BD=EF=BF=BD=EF=BF=BD~=EF=BF=BD=EF=BF=BD >> Environment: >> =C2=A0memsize =3D 0x08000000 >> =C2=A0modetty0 =3D 0,n,8,1,hw >> =C2=A0ethaddr =3D 00.15.6d.c8.c9.2e >> =C2=A0board =3D RouterStation PRO >> Cache info: >> =C2=A0picache_stride =C2=A0 =C2=A0=3D 4096 >> =C2=A0picache_loopcount =3D 16 >> =C2=A0pdcache_stride =C2=A0 =C2=A0=3D 4096 >> =C2=A0pdcache_loopcount =3D 8 >> cpu0: MIPS Technologies processor v116.147 >> =C2=A0MMU: Standard TLB, 16 entries >> =C2=A0L1 i-cache: 4 ways of 512 sets, 32 bytes per line >> =C2=A0L1 d-cache: 4 ways of 256 sets, 32 bytes per line >> =C2=A0Config1=3D0x9ee3519e >> =C2=A0Config3=3D0x20 >> KDB: debugger backends: ddb >> KDB: current backend: ddb >> Copyright (c) 1992-2012 The FreeBSD Project. >> Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 >> =C2=A0 =C2=A0 =C2=A0 The Regents of the University of California. All ri= ghts reserved. >> FreeBSD is a registered trademark of The FreeBSD Foundation. >> FreeBSD 10.0-CURRENT #12: Fri Apr 20 18:03:16 CEST 2012 >> =C2=A0 =C2=A0root@freebsd-re-9:/usr/obj/mips.mips/usr/src/sys/RSPRO_USB_= PROD mips >> WARNING: WITNESS option enabled, expect reduced performance. >> MEMGUARD DEBUGGING ALLOCATOR INITIALIZED: >> =C2=A0 =C2=A0 =C2=A0 MEMGUARD map base: 0xc0800000 >> =C2=A0 =C2=A0 =C2=A0 MEMGUARD map limit: 0xc1c00000 >> =C2=A0 =C2=A0 =C2=A0 MEMGUARD map size: 20480 KBytes >> real memory =C2=A0=3D 134217728 (131072K bytes) >> avail memory =3D 123117568 (117MB) >> random device not loaded; using insecure entropy >> nexus0: >> clock0: on nexus0 >> Timecounter "MIPS32" frequency 360000000 Hz quality 800 >> Event timer "MIPS32" frequency 360000000 Hz quality 800 >> apb0 at irq 4 on nexus0 >> uart0: <16550 or compatible> on apb0 >> uart0: console (115200,n,8,1) >> gpio0: on apb0 >> gpio0: [GIANT-LOCKED] >> gpio0: gpio pinmask=3D0x0 >> gpioc0: on gpio0 >> gpiobus0: on gpio0 >> ehci0: at mem >> 0x1b000000-0x1bffffff irq 1 on nexus0 >> usbus0: set host controller mode >> usbus0: EHCI version 1.0 >> usbus0: set host controller mode >> usbus0 on ehci0 >> pcib0 at irq 0 on nexus0 >> pci0: on pcib0 >> pci0: at device 0.0 (no driver attached) >> ath0: irq 0 at device 17.0 on pci0 >> ath0: AR5413 mac 10.5 RF5413 phy 6.1 >> ath0: 2GHz radio: 0x0000; 5GHz radio: 0x0063 >> arge0: at mem >> 0x19000000-0x19000fff irq 2 on nexus0 >> arge0: No PHY specified, using mask 16 >> miibus0: on arge0 >> ukphy0: PHY 4 on miibus0 >> ukphy0: =C2=A0none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, >> 1000baseT-FDX, 1000baseT-FDX-master, auto >> arge0: Ethernet address: 00:15:6d:c8:c9:2e >> arge1: at mem >> 0x1a000000-0x1a000fff irq 3 on nexus0 >> arge1: No PHY specified, using mask 15 >> arge1: Ethernet address: 00:15:6d:c8:c9:2f >> spi0: at mem 0x1f000000-0x1f00000f on nexus0 >> spibus0: on spi0 >> mx25l0: at cs 0 on spibus0 >> mx25l0: mx25ll128, sector 65536 bytes, 256 sectors >> ar71xx_wdog0: on nexus0 >> Timecounters tick every 1.000 msec >> usbus0: 480Mbps High Speed USB v2.0 >> ugen0.1: at usbus0 >> uhub0: on usbu= s0 >> panic: [pmc,4816] npmc miscomputed: ri=3D0, md->npmc=3D2 >> KDB: enter: panic >> [ thread pid 0 tid 100000 ] >> Stopped at =C2=A0 =C2=A0 =C2=A0kdb_enter+0x4c: lui =C2=A0 =C2=A0 at,0x80= 50 >> db> tr >> Tracing pid 0 tid 100000 td 0x804f76d0 >> db_trace_thread+30 (?,?,?,?) ra 8068b94800000018 sp 0 sz 0 >> 80075adc+114 (0,?,ffffffff,?) ra 8068b96000000020 sp 100000000 sz 1 >> 80074e24+388 (?,?,?,?) ra 8068b980000000a8 sp 0 sz 0 >> db_command_loop+70 (?,?,?,?) ra 8068ba2800000018 sp 0 sz 0 >> 80077900+f4 (?,?,?,?) ra 8068ba40000001a8 sp 0 sz 0 >> kdb_trap+110 (?,?,?,?) ra 8068bbe800000030 sp 0 sz 0 >> trap+c7c (?,?,?,?) ra 8068bc18000000b8 sp 0 sz 0 >> MipsKernGenException+134 (0,4,8043b1d4,119) ra 8068bcd0000000c8 sp >> 100000001 sz 1 >> kdb_enter+4c (?,?,?,?) ra 8068bd9800000018 sp 0 sz 0 >> panic+11c (?,12d0,0,2) ra 8068bdb000000028 sp 1 sz 1 >> 800e8ca8+274 (?,?,?,?) ra 8068bdd800000038 sp 0 sz 0 >> syscall_module_handler+b8 (?,?,?,?) ra 8068be1000000028 sp 0 sz 0 >> module_register_init+9c (?,?,?,?) ra 8068be3800000028 sp 0 sz 0 >> mi_startup+138 (?,?,?,?) ra 8068be6000000020 sp 0 sz 0 >> _start+90 (?,?,?,?) ra 8068be8000000000 sp 0 sz 0 >> pid 0 >> db> >> >>> Thanks, >>> >>> >>> >>> adrian >>> >>> On 28 March 2012 13:58, Fabien Thomas wrote: >>>> Author: fabient >>>> Date: Wed Mar 28 20:58:30 2012 >>>> New Revision: 233628 >>>> URL: http://svn.freebsd.org/changeset/base/233628 >>>> >>>> Log: >>>> =C2=A0Add software PMC support. >>>> >>>> =C2=A0New kernel events can be added at various location for sampling = or counting. >>>> =C2=A0This will for example allow easy system profiling whatever the p= rocessor is >>>> =C2=A0with known tools like pmcstat(8). >>>> >>>> =C2=A0Simultaneous usage of software PMC and hardware PMC is possible,= for example >>>> =C2=A0looking at the lock acquire failure, page fault while sampling o= n >>>> =C2=A0instructions. >>>> >>>> =C2=A0Sponsored by: NETASQ >>>> =C2=A0MFC after: =C2=A0 =C2=A01 month >>>> >>>> Added: >>>> =C2=A0head/lib/libpmc/pmc.soft.3 =C2=A0 (contents, props changed) >>>> =C2=A0head/sys/dev/hwpmc/hwpmc_soft.c =C2=A0 (contents, props changed) >>>> =C2=A0head/sys/dev/hwpmc/hwpmc_soft.h =C2=A0 (contents, props changed) >>>> Modified: >>>> =C2=A0head/lib/libpmc/Makefile >>>> =C2=A0head/lib/libpmc/libpmc.c >>>> =C2=A0head/lib/libpmc/pmc.3 >>>> =C2=A0head/lib/libpmc/pmc.atom.3 >>>> =C2=A0head/lib/libpmc/pmc.core.3 >>>> =C2=A0head/lib/libpmc/pmc.core2.3 >>>> =C2=A0head/lib/libpmc/pmc.corei7.3 >>>> =C2=A0head/lib/libpmc/pmc.corei7uc.3 >>>> =C2=A0head/lib/libpmc/pmc.iaf.3 >>>> =C2=A0head/lib/libpmc/pmc.k7.3 >>>> =C2=A0head/lib/libpmc/pmc.k8.3 >>>> =C2=A0head/lib/libpmc/pmc.mips24k.3 >>>> =C2=A0head/lib/libpmc/pmc.octeon.3 >>>> =C2=A0head/lib/libpmc/pmc.p4.3 >>>> =C2=A0head/lib/libpmc/pmc.p5.3 >>>> =C2=A0head/lib/libpmc/pmc.p6.3 >>>> =C2=A0head/lib/libpmc/pmc.sandybridge.3 >>>> =C2=A0head/lib/libpmc/pmc.sandybridgeuc.3 >>>> =C2=A0head/lib/libpmc/pmc.tsc.3 >>>> =C2=A0head/lib/libpmc/pmc.ucf.3 >>>> =C2=A0head/lib/libpmc/pmc.westmere.3 >>>> =C2=A0head/lib/libpmc/pmc.westmereuc.3 >>>> =C2=A0head/lib/libpmc/pmc.xscale.3 >>>> =C2=A0head/lib/libpmc/pmclog.c >>>> =C2=A0head/lib/libpmc/pmclog.h >>>> =C2=A0head/sys/amd64/amd64/trap.c >>>> =C2=A0head/sys/amd64/include/pmc_mdep.h >>>> =C2=A0head/sys/arm/include/pmc_mdep.h >>>> =C2=A0head/sys/conf/files >>>> =C2=A0head/sys/dev/hwpmc/hwpmc_amd.c >>>> =C2=A0head/sys/dev/hwpmc/hwpmc_core.c >>>> =C2=A0head/sys/dev/hwpmc/hwpmc_intel.c >>>> =C2=A0head/sys/dev/hwpmc/hwpmc_logging.c >>>> =C2=A0head/sys/dev/hwpmc/hwpmc_mips.c >>>> =C2=A0head/sys/dev/hwpmc/hwpmc_mod.c >>>> =C2=A0head/sys/dev/hwpmc/hwpmc_piv.c >>>> =C2=A0head/sys/dev/hwpmc/hwpmc_powerpc.c >>>> =C2=A0head/sys/dev/hwpmc/hwpmc_ppro.c >>>> =C2=A0head/sys/dev/hwpmc/hwpmc_tsc.c >>>> =C2=A0head/sys/dev/hwpmc/hwpmc_x86.c >>>> =C2=A0head/sys/dev/hwpmc/hwpmc_xscale.c >>>> =C2=A0head/sys/dev/hwpmc/pmc_events.h >>>> =C2=A0head/sys/i386/i386/trap.c >>>> =C2=A0head/sys/i386/include/pmc_mdep.h >>>> =C2=A0head/sys/kern/kern_clock.c >>>> =C2=A0head/sys/kern/kern_lock.c >>>> =C2=A0head/sys/kern/kern_mutex.c >>>> =C2=A0head/sys/kern/kern_pmc.c >>>> =C2=A0head/sys/kern/kern_rwlock.c >>>> =C2=A0head/sys/kern/kern_sx.c >>>> =C2=A0head/sys/kern/subr_trap.c >>>> =C2=A0head/sys/mips/include/pmc_mdep.h >>>> =C2=A0head/sys/modules/hwpmc/Makefile >>>> =C2=A0head/sys/powerpc/include/pmc_mdep.h >>>> =C2=A0head/sys/sys/pmc.h >>>> =C2=A0head/sys/sys/pmckern.h >>>> =C2=A0head/sys/sys/pmclog.h >>>> =C2=A0head/usr.sbin/pmcstat/pmcstat_log.c >>>> >>>> Modified: head/lib/libpmc/Makefile >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/lib/libpmc/Makefile =C2=A0 =C2=A0Wed Mar 28 20:49:11 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233627) >>>> +++ head/lib/libpmc/Makefile =C2=A0 =C2=A0Wed Mar 28 20:58:30 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233628) >>>> @@ -20,6 +20,7 @@ MAN+=3D pmc_read.3 >>>> =C2=A0MAN+=3D =C2=A0pmc_set.3 >>>> =C2=A0MAN+=3D =C2=A0pmc_start.3 >>>> =C2=A0MAN+=3D =C2=A0pmclog.3 >>>> +MAN+=3D =C2=A0pmc.soft.3 >>>> >>>> =C2=A0# PMC-dependent manual pages >>>> =C2=A0.if ${MACHINE_CPUARCH} =3D=3D "i386" || ${MACHINE_CPUARCH} =3D= =3D "amd64" >>>> >>>> Modified: head/lib/libpmc/libpmc.c >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/lib/libpmc/libpmc.c =C2=A0 =C2=A0Wed Mar 28 20:49:11 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233627) >>>> +++ head/lib/libpmc/libpmc.c =C2=A0 =C2=A0Wed Mar 28 20:58:30 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233628) >>>> @@ -77,11 +77,12 @@ static int tsc_allocate_pmc(enum pmc_eve >>>> =C2=A0static int xscale_allocate_pmc(enum pmc_event _pe, char *_ctrspe= c, >>>> =C2=A0 =C2=A0 struct pmc_op_pmcallocate *_pmc_config); >>>> =C2=A0#endif >>>> - >>>> =C2=A0#if defined(__mips__) >>>> =C2=A0static int mips_allocate_pmc(enum pmc_event _pe, char* ctrspec, >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct pmc_op_pmcallocate *_pmc_config); >>>> =C2=A0#endif /* __mips__ */ >>>> +static int soft_allocate_pmc(enum pmc_event _pe, char *_ctrspec, >>>> + =C2=A0 =C2=A0struct pmc_op_pmcallocate *_pmc_config); >>>> >>>> =C2=A0#if defined(__powerpc__) >>>> =C2=A0static int ppc7450_allocate_pmc(enum pmc_event _pe, char* ctrspe= c, >>>> @@ -156,6 +157,8 @@ PMC_CLASSDEP_TABLE(octeon, OCTEON); >>>> =C2=A0PMC_CLASSDEP_TABLE(ucf, UCF); >>>> =C2=A0PMC_CLASSDEP_TABLE(ppc7450, PPC7450); >>>> >>>> +static struct pmc_event_descr soft_event_table[PMC_EV_DYN_COUNT]; >>>> + >>>> =C2=A0#undef __PMC_EV_ALIAS >>>> =C2=A0#define =C2=A0 =C2=A0 =C2=A0 =C2=A0__PMC_EV_ALIAS(N,CODE) =C2=A0= { N, PMC_EV_##CODE }, >>>> >>>> @@ -215,21 +218,22 @@ static const struct pmc_event_descr west >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_CLASS_##C, = __VA_ARGS__ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0\ >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0} >>>> >>>> -PMC_MDEP_TABLE(atom, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC); >>>> -PMC_MDEP_TABLE(core, IAP, PMC_CLASS_TSC); >>>> -PMC_MDEP_TABLE(core2, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC); >>>> -PMC_MDEP_TABLE(corei7, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_U= CF, PMC_CLASS_UCP); >>>> -PMC_MDEP_TABLE(sandybridge, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CL= ASS_UCF, PMC_CLASS_UCP); >>>> -PMC_MDEP_TABLE(westmere, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS= _UCF, PMC_CLASS_UCP); >>>> -PMC_MDEP_TABLE(k7, K7, PMC_CLASS_TSC); >>>> -PMC_MDEP_TABLE(k8, K8, PMC_CLASS_TSC); >>>> -PMC_MDEP_TABLE(p4, P4, PMC_CLASS_TSC); >>>> -PMC_MDEP_TABLE(p5, P5, PMC_CLASS_TSC); >>>> -PMC_MDEP_TABLE(p6, P6, PMC_CLASS_TSC); >>>> -PMC_MDEP_TABLE(xscale, XSCALE, PMC_CLASS_XSCALE); >>>> -PMC_MDEP_TABLE(mips24k, MIPS24K, PMC_CLASS_MIPS24K); >>>> -PMC_MDEP_TABLE(octeon, OCTEON, PMC_CLASS_OCTEON); >>>> -PMC_MDEP_TABLE(ppc7450, PPC7450, PMC_CLASS_PPC7450); >>>> +PMC_MDEP_TABLE(atom, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TS= C); >>>> +PMC_MDEP_TABLE(core, IAP, PMC_CLASS_SOFT, PMC_CLASS_TSC); >>>> +PMC_MDEP_TABLE(core2, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_T= SC); >>>> +PMC_MDEP_TABLE(corei7, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_= TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); >>>> +PMC_MDEP_TABLE(sandybridge, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_C= LASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); >>>> +PMC_MDEP_TABLE(westmere, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLAS= S_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); >>>> +PMC_MDEP_TABLE(k7, K7, PMC_CLASS_SOFT, PMC_CLASS_TSC); >>>> +PMC_MDEP_TABLE(k8, K8, PMC_CLASS_SOFT, PMC_CLASS_TSC); >>>> +PMC_MDEP_TABLE(p4, P4, PMC_CLASS_SOFT, PMC_CLASS_TSC); >>>> +PMC_MDEP_TABLE(p5, P5, PMC_CLASS_SOFT, PMC_CLASS_TSC); >>>> +PMC_MDEP_TABLE(p6, P6, PMC_CLASS_SOFT, PMC_CLASS_TSC); >>>> +PMC_MDEP_TABLE(xscale, XSCALE, PMC_CLASS_SOFT, PMC_CLASS_XSCALE); >>>> +PMC_MDEP_TABLE(mips24k, MIPS24K, PMC_CLASS_SOFT, PMC_CLASS_MIPS24K); >>>> +PMC_MDEP_TABLE(octeon, OCTEON, PMC_CLASS_SOFT, PMC_CLASS_OCTEON); >>>> +PMC_MDEP_TABLE(ppc7450, PPC7450, PMC_CLASS_SOFT, PMC_CLASS_PPC7450); >>>> +PMC_MDEP_TABLE(generic, SOFT, PMC_CLASS_SOFT); >>>> >>>> =C2=A0static const struct pmc_event_descr tsc_event_table[] =3D >>>> =C2=A0{ >>>> @@ -279,16 +283,24 @@ PMC_CLASS_TABLE_DESC(tsc, TSC, tsc, tsc) >>>> =C2=A0#if =C2=A0 =C2=A0defined(__XSCALE__) >>>> =C2=A0PMC_CLASS_TABLE_DESC(xscale, XSCALE, xscale, xscale); >>>> =C2=A0#endif >>>> - >>>> =C2=A0#if defined(__mips__) >>>> =C2=A0PMC_CLASS_TABLE_DESC(mips24k, MIPS24K, mips24k, mips); >>>> =C2=A0PMC_CLASS_TABLE_DESC(octeon, OCTEON, octeon, mips); >>>> =C2=A0#endif /* __mips__ */ >>>> - >>>> =C2=A0#if defined(__powerpc__) >>>> =C2=A0PMC_CLASS_TABLE_DESC(ppc7450, PPC7450, ppc7450, ppc7450); >>>> =C2=A0#endif >>>> >>>> +static struct pmc_class_descr soft_class_table_descr =3D >>>> +{ >>>> + =C2=A0 =C2=A0 =C2=A0 .pm_evc_name =C2=A0=3D "SOFT-", >>>> + =C2=A0 =C2=A0 =C2=A0 .pm_evc_name_size =3D sizeof("SOFT-") - 1, >>>> + =C2=A0 =C2=A0 =C2=A0 .pm_evc_class =3D PMC_CLASS_SOFT, >>>> + =C2=A0 =C2=A0 =C2=A0 .pm_evc_event_table =3D NULL, >>>> + =C2=A0 =C2=A0 =C2=A0 .pm_evc_event_table_size =3D 0, >>>> + =C2=A0 =C2=A0 =C2=A0 .pm_evc_allocate_pmc =3D soft_allocate_pmc >>>> +}; >>>> + >>>> =C2=A0#undef PMC_CLASS_TABLE_DESC >>>> >>>> =C2=A0static const struct pmc_class_descr **pmc_class_table; >>>> @@ -343,9 +355,12 @@ static const char * pmc_state_names[] =3D >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0__PMC_STATES() >>>> =C2=A0}; >>>> >>>> -static int pmc_syscall =3D -1; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* = filled in by pmc_init() */ >>>> - >>>> -static struct pmc_cpuinfo cpu_info; =C2=A0 =C2=A0/* filled in by pmc_= init() */ >>>> +/* >>>> + * Filled in by pmc_init(). >>>> + */ >>>> +static int pmc_syscall =3D -1; >>>> +static struct pmc_cpuinfo cpu_info; >>>> +static struct pmc_op_getdyneventinfo soft_event_info; >>>> >>>> =C2=A0/* Event masks for events */ >>>> =C2=A0struct pmc_masks { >>>> @@ -2179,6 +2194,25 @@ tsc_allocate_pmc(enum pmc_event pe, char >>>> =C2=A0} >>>> =C2=A0#endif >>>> >>>> +static struct pmc_event_alias generic_aliases[] =3D { >>>> + =C2=A0 =C2=A0 =C2=A0 EV_ALIAS("instructions", =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"SOFT-CLOCK.HARD"), >>>> + =C2=A0 =C2=A0 =C2=A0 EV_ALIAS(NULL, NULL) >>>> +}; >>>> + >>>> +static int >>>> +soft_allocate_pmc(enum pmc_event pe, char *ctrspec, >>>> + =C2=A0 =C2=A0struct pmc_op_pmcallocate *pmc_config) >>>> +{ >>>> + =C2=A0 =C2=A0 =C2=A0 (void)ctrspec; >>>> + =C2=A0 =C2=A0 =C2=A0 (void)pmc_config; >>>> + >>>> + =C2=A0 =C2=A0 =C2=A0 if (pe < PMC_EV_SOFT_FIRST || pe > PMC_EV_SOFT_= LAST) >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (-1); >>>> + >>>> + =C2=A0 =C2=A0 =C2=A0 pmc_config->pm_caps |=3D (PMC_CAP_READ | PMC_CA= P_WRITE); >>>> + =C2=A0 =C2=A0 =C2=A0 return (0); >>>> +} >>>> + >>>> =C2=A0#if =C2=A0 =C2=A0defined(__XSCALE__) >>>> >>>> =C2=A0static struct pmc_event_alias xscale_aliases[] =3D { >>>> @@ -2663,6 +2697,10 @@ pmc_event_names_of_class(enum pmc_class >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ev =3D ppc7450_= event_table; >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0count =3D PMC_E= VENT_TABLE_SIZE(ppc7450); >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0break; >>>> + =C2=A0 =C2=A0 =C2=A0 case PMC_CLASS_SOFT: >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ev =3D soft_event_t= able; >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 count =3D soft_even= t_info.pm_nevent; >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break; >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0default: >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0errno =3D EINVA= L; >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return (-1); >>>> @@ -2676,6 +2714,7 @@ pmc_event_names_of_class(enum pmc_class >>>> >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0for (;count--; ev++, names++) >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*names =3D ev->= pm_ev_name; >>>> + >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0return (0); >>>> =C2=A0} >>>> >>>> @@ -2780,11 +2819,34 @@ pmc_init(void) >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pmc_class_table= [n] =3D NULL; >>>> >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0/* >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0* Get soft events list. >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0*/ >>>> + =C2=A0 =C2=A0 =C2=A0 soft_event_info.pm_class =3D PMC_CLASS_SOFT; >>>> + =C2=A0 =C2=A0 =C2=A0 if (PMC_CALL(GETDYNEVENTINFO, &soft_event_info)= < 0) >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (pmc_syscall= =3D -1); >>>> + >>>> + =C2=A0 =C2=A0 =C2=A0 /* Map soft events to static list. */ >>>> + =C2=A0 =C2=A0 =C2=A0 for (n =3D 0; n < soft_event_info.pm_nevent; n+= +) { >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 soft_event_table[n]= .pm_ev_name =3D >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 soft_= event_info.pm_events[n].pm_ev_name; >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 soft_event_table[n]= .pm_ev_code =3D >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 soft_= event_info.pm_events[n].pm_ev_code; >>>> + =C2=A0 =C2=A0 =C2=A0 } >>>> + =C2=A0 =C2=A0 =C2=A0 soft_class_table_descr.pm_evc_event_table_size = =3D \ >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 soft_event_info.pm_nevent; >>>> + =C2=A0 =C2=A0 =C2=A0 soft_class_table_descr.pm_evc_event_table =3D \ >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 soft_event_table; >>>> + >>>> + =C2=A0 =C2=A0 =C2=A0 /* >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 * Fill in the class table. >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 */ >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0n =3D 0; >>>> + >>>> + =C2=A0 =C2=A0 =C2=A0 /* Fill soft events information. */ >>>> + =C2=A0 =C2=A0 =C2=A0 pmc_class_table[n++] =3D &soft_class_table_desc= r; >>>> =C2=A0#if defined(__amd64__) || defined(__i386__) >>>> - =C2=A0 =C2=A0 =C2=A0 pmc_class_table[n++] =3D &tsc_class_table_descr= ; >>>> + =C2=A0 =C2=A0 =C2=A0 if (cpu_info.pm_cputype !=3D PMC_CPU_GENERIC) >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pmc_class_table[n++= ] =3D &tsc_class_table_descr; >>>> >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0/* >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 * Check if this CPU has fixed function cou= nters. >>>> @@ -2867,6 +2929,9 @@ pmc_init(void) >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pmc_class_table= [n] =3D &p4_class_table_descr; >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0break; >>>> =C2=A0#endif >>>> + =C2=A0 =C2=A0 =C2=A0 case PMC_CPU_GENERIC: >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PMC_MDEP_INIT(gener= ic); >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break; >>>> =C2=A0#if defined(__XSCALE__) >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0case PMC_CPU_INTEL_XSCALE: >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_MDEP_INIT(x= scale); >>>> @@ -3035,18 +3100,19 @@ _pmc_name_of_event(enum pmc_event pe, en >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0evfence =3D xsc= ale_event_table + PMC_EVENT_TABLE_SIZE(xscale); >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0} else if (pe >=3D PMC_EV_MIPS24K_FIRST && = pe <=3D PMC_EV_MIPS24K_LAST) { >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ev =3D mips24k_= event_table; >>>> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 evfence =3D mips24k= _event_table + PMC_EVENT_TABLE_SIZE(mips24k >>>> -); >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 evfence =3D mips24k= _event_table + PMC_EVENT_TABLE_SIZE(mips24k); >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0} else if (pe >=3D PMC_EV_OCTEON_FIRST && p= e <=3D PMC_EV_OCTEON_LAST) { >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ev =3D octeon_e= vent_table; >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0evfence =3D oct= eon_event_table + PMC_EVENT_TABLE_SIZE(octeon); >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0} else if (pe >=3D PMC_EV_PPC7450_FIRST && = pe <=3D PMC_EV_PPC7450_LAST) { >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ev =3D ppc7450_= event_table; >>>> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 evfence =3D ppc7450= _event_table + PMC_EVENT_TABLE_SIZE(ppc7450 >>>> -); >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 evfence =3D ppc7450= _event_table + PMC_EVENT_TABLE_SIZE(ppc7450); >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0} else if (pe =3D=3D PMC_EV_TSC_TSC) { >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ev =3D tsc_even= t_table; >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0evfence =3D tsc= _event_table + PMC_EVENT_TABLE_SIZE(tsc); >>>> + =C2=A0 =C2=A0 =C2=A0 } else if (pe >=3D PMC_EV_SOFT_FIRST && pe <=3D= PMC_EV_SOFT_LAST) { >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ev =3D soft_event_t= able; >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 evfence =3D soft_ev= ent_table + soft_event_info.pm_nevent; >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0} >>>> >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0for (; ev !=3D evfence; ev++) >>>> >>>> Modified: head/lib/libpmc/pmc.3 >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/lib/libpmc/pmc.3 =C2=A0 =C2=A0 =C2=A0 Wed Mar 28 20:49:11 201= 2 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233627) >>>> +++ head/lib/libpmc/pmc.3 =C2=A0 =C2=A0 =C2=A0 Wed Mar 28 20:58:30 201= 2 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233628) >>>> @@ -223,6 +223,8 @@ and >>>> =C2=A0CPUs. >>>> =C2=A0.It Li PMC_CLASS_TSC >>>> =C2=A0The timestamp counter on i386 and amd64 architecture CPUs. >>>> +.It Li PMC_CLASS_SOFT >>>> +Software events. >>>> =C2=A0.El >>>> =C2=A0.Ss PMC Capabilities >>>> =C2=A0Capabilities of performance monitoring hardware are denoted usin= g >>>> @@ -525,6 +527,7 @@ API is >>>> =C2=A0.Xr pmc.p4 3 , >>>> =C2=A0.Xr pmc.p5 3 , >>>> =C2=A0.Xr pmc.p6 3 , >>>> +.Xr pmc.soft 3 , >>>> =C2=A0.Xr pmc.tsc 3 , >>>> =C2=A0.Xr pmclog 3 , >>>> =C2=A0.Xr hwpmc 4 , >>>> >>>> Modified: head/lib/libpmc/pmc.atom.3 >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/lib/libpmc/pmc.atom.3 =C2=A0Wed Mar 28 20:49:11 2012 =C2=A0 = =C2=A0 =C2=A0 =C2=A0(r233627) >>>> +++ head/lib/libpmc/pmc.atom.3 =C2=A0Wed Mar 28 20:58:30 2012 =C2=A0 = =C2=A0 =C2=A0 =C2=A0(r233628) >>>> @@ -1176,6 +1176,7 @@ and the underlying hardware events used >>>> =C2=A0.Xr pmc.p4 3 , >>>> =C2=A0.Xr pmc.p5 3 , >>>> =C2=A0.Xr pmc.p6 3 , >>>> +.Xr pmc.soft 3 , >>>> =C2=A0.Xr pmc.tsc 3 , >>>> =C2=A0.Xr pmc_cpuinfo 3 , >>>> =C2=A0.Xr pmclog 3 , >>>> >>>> Modified: head/lib/libpmc/pmc.core.3 >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/lib/libpmc/pmc.core.3 =C2=A0Wed Mar 28 20:49:11 2012 =C2=A0 = =C2=A0 =C2=A0 =C2=A0(r233627) >>>> +++ head/lib/libpmc/pmc.core.3 =C2=A0Wed Mar 28 20:58:30 2012 =C2=A0 = =C2=A0 =C2=A0 =C2=A0(r233628) >>>> @@ -792,6 +792,7 @@ may not count some transitions. >>>> =C2=A0.Xr pmc.p4 3 , >>>> =C2=A0.Xr pmc.p5 3 , >>>> =C2=A0.Xr pmc.p6 3 , >>>> +.Xr pmc.soft 3 , >>>> =C2=A0.Xr pmc.tsc 3 , >>>> =C2=A0.Xr pmclog 3 , >>>> =C2=A0.Xr hwpmc 4 >>>> >>>> Modified: head/lib/libpmc/pmc.core2.3 >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/lib/libpmc/pmc.core2.3 Wed Mar 28 20:49:11 2012 =C2=A0 =C2=A0= =C2=A0 =C2=A0(r233627) >>>> +++ head/lib/libpmc/pmc.core2.3 Wed Mar 28 20:58:30 2012 =C2=A0 =C2=A0= =C2=A0 =C2=A0(r233628) >>>> @@ -1107,6 +1107,7 @@ and the underlying hardware events used. >>>> =C2=A0.Xr pmc.p4 3 , >>>> =C2=A0.Xr pmc.p5 3 , >>>> =C2=A0.Xr pmc.p6 3 , >>>> +.Xr pmc.soft 3 , >>>> =C2=A0.Xr pmc.tsc 3 , >>>> =C2=A0.Xr pmc_cpuinfo 3 , >>>> =C2=A0.Xr pmclog 3 , >>>> >>>> Modified: head/lib/libpmc/pmc.corei7.3 >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/lib/libpmc/pmc.corei7.3 =C2=A0 =C2=A0 =C2=A0 =C2=A0Wed Mar 28= 20:49:11 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233627) >>>> +++ head/lib/libpmc/pmc.corei7.3 =C2=A0 =C2=A0 =C2=A0 =C2=A0Wed Mar 28= 20:58:30 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233628) >>>> @@ -1559,6 +1559,7 @@ Counts number of segment register loads. >>>> =C2=A0.Xr pmc.corei7uc 3 , >>>> =C2=A0.Xr pmc.westmere 3 , >>>> =C2=A0.Xr pmc.westmereuc 3 , >>>> +.Xr pmc.soft 3 , >>>> =C2=A0.Xr pmc.tsc 3 , >>>> =C2=A0.Xr pmc_cpuinfo 3 , >>>> =C2=A0.Xr pmclog 3 , >>>> >>>> Modified: head/lib/libpmc/pmc.corei7uc.3 >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/lib/libpmc/pmc.corei7uc.3 =C2=A0 =C2=A0 =C2=A0Wed Mar 28 20:4= 9:11 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233627) >>>> +++ head/lib/libpmc/pmc.corei7uc.3 =C2=A0 =C2=A0 =C2=A0Wed Mar 28 20:5= 8:30 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233628) >>>> @@ -863,6 +863,7 @@ refreshed or needs to go into a power do >>>> =C2=A0.Xr pmc.corei7 3 , >>>> =C2=A0.Xr pmc.westmere 3 , >>>> =C2=A0.Xr pmc.westmereuc 3 , >>>> +.Xr pmc.soft 3 , >>>> =C2=A0.Xr pmc.tsc 3 , >>>> =C2=A0.Xr pmc_cpuinfo 3 , >>>> =C2=A0.Xr pmclog 3 , >>>> >>>> Modified: head/lib/libpmc/pmc.iaf.3 >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/lib/libpmc/pmc.iaf.3 =C2=A0 Wed Mar 28 20:49:11 2012 =C2=A0 = =C2=A0 =C2=A0 =C2=A0(r233627) >>>> +++ head/lib/libpmc/pmc.iaf.3 =C2=A0 Wed Mar 28 20:58:30 2012 =C2=A0 = =C2=A0 =C2=A0 =C2=A0(r233628) >>>> @@ -132,6 +132,7 @@ CPU, use the event specifier >>>> =C2=A0.Xr pmc.p4 3 , >>>> =C2=A0.Xr pmc.p5 3 , >>>> =C2=A0.Xr pmc.p6 3 , >>>> +.Xr pmc.soft 3 , >>>> =C2=A0.Xr pmc.tsc 3 , >>>> =C2=A0.Xr pmc_cpuinfo 3 , >>>> =C2=A0.Xr pmclog 3 , >>>> >>>> Modified: head/lib/libpmc/pmc.k7.3 >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/lib/libpmc/pmc.k7.3 =C2=A0 =C2=A0Wed Mar 28 20:49:11 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233627) >>>> +++ head/lib/libpmc/pmc.k7.3 =C2=A0 =C2=A0Wed Mar 28 20:58:30 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233628) >>>> @@ -249,6 +249,7 @@ and the underlying hardware events used. >>>> =C2=A0.Xr pmc.p4 3 , >>>> =C2=A0.Xr pmc.p5 3 , >>>> =C2=A0.Xr pmc.p6 3 , >>>> +.Xr pmc.soft 3 , >>>> =C2=A0.Xr pmc.tsc 3 , >>>> =C2=A0.Xr pmclog 3 , >>>> =C2=A0.Xr hwpmc 4 >>>> >>>> Modified: head/lib/libpmc/pmc.k8.3 >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/lib/libpmc/pmc.k8.3 =C2=A0 =C2=A0Wed Mar 28 20:49:11 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233627) >>>> +++ head/lib/libpmc/pmc.k8.3 =C2=A0 =C2=A0Wed Mar 28 20:58:30 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233628) >>>> @@ -783,6 +783,7 @@ and the underlying hardware events used. >>>> =C2=A0.Xr pmc.p4 3 , >>>> =C2=A0.Xr pmc.p5 3 , >>>> =C2=A0.Xr pmc.p6 3 , >>>> +.Xr pmc.soft 3 , >>>> =C2=A0.Xr pmc.tsc 3 , >>>> =C2=A0.Xr pmclog 3 , >>>> =C2=A0.Xr hwpmc 4 >>>> >>>> Modified: head/lib/libpmc/pmc.mips24k.3 >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/lib/libpmc/pmc.mips24k.3 =C2=A0 =C2=A0 =C2=A0 Wed Mar 28 20:4= 9:11 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233627) >>>> +++ head/lib/libpmc/pmc.mips24k.3 =C2=A0 =C2=A0 =C2=A0 Wed Mar 28 20:5= 8:30 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233628) >>>> @@ -392,6 +392,7 @@ and the underlying hardware events used. >>>> =C2=A0.Xr pmc.p4 3 , >>>> =C2=A0.Xr pmc.p5 3 , >>>> =C2=A0.Xr pmc.p6 3 , >>>> +.Xr pmc.soft 3 , >>>> =C2=A0.Xr pmc.tsc 3 , >>>> =C2=A0.Xr pmc_cpuinfo 3 , >>>> =C2=A0.Xr pmclog 3 , >>>> >>>> Modified: head/lib/libpmc/pmc.octeon.3 >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/lib/libpmc/pmc.octeon.3 =C2=A0 =C2=A0 =C2=A0 =C2=A0Wed Mar 28= 20:49:11 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233627) >>>> +++ head/lib/libpmc/pmc.octeon.3 =C2=A0 =C2=A0 =C2=A0 =C2=A0Wed Mar 28= 20:58:30 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233628) >>>> @@ -232,6 +232,7 @@ and the underlying hardware events used. >>>> =C2=A0.Xr pmc.p4 3 , >>>> =C2=A0.Xr pmc.p5 3 , >>>> =C2=A0.Xr pmc.p6 3 , >>>> +.Xr pmc.soft 3 , >>>> =C2=A0.Xr pmc.tsc 3 , >>>> =C2=A0.Xr pmc_cpuinfo 3 , >>>> =C2=A0.Xr pmclog 3 , >>>> >>>> Modified: head/lib/libpmc/pmc.p4.3 >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/lib/libpmc/pmc.p4.3 =C2=A0 =C2=A0Wed Mar 28 20:49:11 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233627) >>>> +++ head/lib/libpmc/pmc.p4.3 =C2=A0 =C2=A0Wed Mar 28 20:58:30 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233628) >>>> @@ -1208,6 +1208,7 @@ and the underlying hardware events used. >>>> =C2=A0.Xr pmc.k8 3 , >>>> =C2=A0.Xr pmc.p5 3 , >>>> =C2=A0.Xr pmc.p6 3 , >>>> +.Xr pmc.soft 3 , >>>> =C2=A0.Xr pmc.tsc 3 , >>>> =C2=A0.Xr pmclog 3 , >>>> =C2=A0.Xr hwpmc 4 >>>> >>>> Modified: head/lib/libpmc/pmc.p5.3 >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/lib/libpmc/pmc.p5.3 =C2=A0 =C2=A0Wed Mar 28 20:49:11 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233627) >>>> +++ head/lib/libpmc/pmc.p5.3 =C2=A0 =C2=A0Wed Mar 28 20:58:30 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233628) >>>> @@ -444,6 +444,7 @@ and the underlying hardware events used. >>>> =C2=A0.Xr pmc.k8 3 , >>>> =C2=A0.Xr pmc.p4 3 , >>>> =C2=A0.Xr pmc.p6 3 , >>>> +.Xr pmc.soft 3 , >>>> =C2=A0.Xr pmc.tsc 3 , >>>> =C2=A0.Xr pmclog 3 , >>>> =C2=A0.Xr hwpmc 4 >>>> >>>> Modified: head/lib/libpmc/pmc.p6.3 >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/lib/libpmc/pmc.p6.3 =C2=A0 =C2=A0Wed Mar 28 20:49:11 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233627) >>>> +++ head/lib/libpmc/pmc.p6.3 =C2=A0 =C2=A0Wed Mar 28 20:58:30 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233628) >>>> @@ -1010,6 +1010,7 @@ and the underlying hardware events used. >>>> =C2=A0.Xr pmc.k8 3 , >>>> =C2=A0.Xr pmc.p4 3 , >>>> =C2=A0.Xr pmc.p5 3 , >>>> +.Xr pmc.soft 3 , >>>> =C2=A0.Xr pmc.tsc 3 , >>>> =C2=A0.Xr pmclog 3 , >>>> =C2=A0.Xr hwpmc 4 >>>> >>>> Modified: head/lib/libpmc/pmc.sandybridge.3 >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/lib/libpmc/pmc.sandybridge.3 =C2=A0 Wed Mar 28 20:49:11 2012 = =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233627) >>>> +++ head/lib/libpmc/pmc.sandybridge.3 =C2=A0 Wed Mar 28 20:58:30 2012 = =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233628) >>>> @@ -907,6 +907,7 @@ Split locks in SQ. >>>> =C2=A0.Xr pmc.p5 3 , >>>> =C2=A0.Xr pmc.p6 3 , >>>> =C2=A0.Xr pmc.sandybridgeuc 3 , >>>> +.Xr pmc.soft 3 , >>>> =C2=A0.Xr pmc.tsc 3 , >>>> =C2=A0.Xr pmc.ucf 3 , >>>> =C2=A0.Xr pmc.westmere 3 , >>>> >>>> Modified: head/lib/libpmc/pmc.sandybridgeuc.3 >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/lib/libpmc/pmc.sandybridgeuc.3 Wed Mar 28 20:49:11 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233627) >>>> +++ head/lib/libpmc/pmc.sandybridgeuc.3 Wed Mar 28 20:58:30 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233628) >>>> @@ -208,6 +208,7 @@ Counts the number of core-outgoing entri >>>> =C2=A0.Xr pmc.p5 3 , >>>> =C2=A0.Xr pmc.p6 3 , >>>> =C2=A0.Xr pmc.sandybridge 3 , >>>> +.Xr pmc.soft 3 , >>>> =C2=A0.Xr pmc.tsc 3 , >>>> =C2=A0.Xr pmc.ucf 3 , >>>> =C2=A0.Xr pmc.westmere 3 , >>>> >>>> Added: head/lib/libpmc/pmc.soft.3 >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- /dev/null =C2=A0 00:00:00 1970 =C2=A0 (empty, because file is newl= y added) >>>> +++ head/lib/libpmc/pmc.soft.3 =C2=A0Wed Mar 28 20:58:30 2012 =C2=A0 = =C2=A0 =C2=A0 =C2=A0(r233628) >>>> @@ -0,0 +1,104 @@ >>>> +.\" Copyright (c) 2012 Fabien Thomas. =C2=A0All rights reserved. >>>> +.\" >>>> +.\" Redistribution and use in source and binary forms, with or withou= t >>>> +.\" modification, are permitted provided that the following condition= s >>>> +.\" are met: >>>> +.\" 1. Redistributions of source code must retain the above copyright >>>> +.\" =C2=A0 =C2=A0notice, this list of conditions and the following di= sclaimer. >>>> +.\" 2. Redistributions in binary form must reproduce the above copyri= ght >>>> +.\" =C2=A0 =C2=A0notice, this list of conditions and the following di= sclaimer in the >>>> +.\" =C2=A0 =C2=A0documentation and/or other materials provided with t= he distribution. >>>> +.\" >>>> +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'= ' AND >>>> +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,= THE >>>> +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULA= R PURPOSE >>>> +.\" ARE DISCLAIMED. =C2=A0IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTOR= S BE LIABLE >>>> +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONS= EQUENTIAL >>>> +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE= GOODS >>>> +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPT= ION) >>>> +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRAC= T, STRICT >>>> +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN= ANY WAY >>>> +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILI= TY OF >>>> +.\" SUCH DAMAGE. >>>> +.\" >>>> +.\" $FreeBSD$ >>>> +.\" >>>> +.Dd March 28, 2012 >>>> +.Os >>>> +.Dt PMC.SOFT 3 >>>> +.Sh NAME >>>> +.Nm pmc.soft >>>> +.Nd measurements using software based events >>>> +.Sh LIBRARY >>>> +.Lb libpmc >>>> +.Sh SYNOPSIS >>>> +.In pmc.h >>>> +.Sh DESCRIPTION >>>> +Software events are used to collect various source of software events= . >>>> +.Ss PMC Features >>>> +16 sampling counters using software events based on various sources. >>>> +These PMCs support the following capabilities: >>>> +.Bl -column "PMC_CAP_INTERRUPT" "Support" >>>> +.It Em Capability Ta Em Support >>>> +.It PMC_CAP_CASCADE Ta \&No >>>> +.It PMC_CAP_EDGE Ta \&No >>>> +.It PMC_CAP_INTERRUPT Ta Yes >>>> +.It PMC_CAP_INVERT Ta \&No >>>> +.It PMC_CAP_READ Ta Yes >>>> +.It PMC_CAP_PRECISE Ta \&No >>>> +.It PMC_CAP_SYSTEM Ta Yes >>>> +.It PMC_CAP_TAGGING Ta \&No >>>> +.It PMC_CAP_THRESHOLD Ta \&No >>>> +.It PMC_CAP_USER Ta Yes >>>> +.It PMC_CAP_WRITE Ta Yes >>>> +.El >>>> +.Ss Event Qualifiers >>>> +There is no supported event qualifier. >>>> +.Pp >>>> +The event specifiers supported by software are: >>>> +.Bl -tag -width indent >>>> +.It Li CLOCK.HARD >>>> +Hard clock ticks. >>>> +.It Li CLOCK.STAT >>>> +Stat clock ticks. >>>> +.It Li LOCK.FAILED >>>> +Lock acquisition failed. >>>> +.It Li PAGE_FAULT.ALL >>>> +All page fault type. >>>> +.It Li PAGE_FAULT.READ >>>> +Read page fault. >>>> +.It Li PAGE_FAULT.WRITE >>>> +Write page fault. >>>> +.El >>>> +.Sh SEE ALSO >>>> +.Xr pmc 3 , >>>> +.Xr pmc.atom 3 , >>>> +.Xr pmc.core 3 , >>>> +.Xr pmc.iaf 3 , >>>> +.Xr pmc.ucf 3 , >>>> +.Xr pmc.k7 3 , >>>> +.Xr pmc.k8 3 , >>>> +.Xr pmc.p4 3 , >>>> +.Xr pmc.p5 3 , >>>> +.Xr pmc.p6 3 , >>>> +.Xr pmc.corei7 3 , >>>> +.Xr pmc.corei7uc 3 , >>>> +.Xr pmc.westmereuc 3 , >>>> +.Xr pmc.tsc 3 , >>>> +.Xr pmc_cpuinfo 3 , >>>> +.Xr pmclog 3 , >>>> +.Xr hwpmc 4 >>>> +.Sh HISTORY >>>> +The >>>> +.Nm pmc >>>> +library first appeared in >>>> +.Fx 6.0 . >>>> +.Sh AUTHORS >>>> +The >>>> +.Lb libpmc >>>> +library was written by >>>> +.An "Joseph Koshy" >>>> +.Aq jkoshy@FreeBSD.org . >>>> +Software PMC was written by >>>> +.An "Fabien Thomas" >>>> +.Aq fabient@FreeBSD.org . >>>> >>>> Modified: head/lib/libpmc/pmc.tsc.3 >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/lib/libpmc/pmc.tsc.3 =C2=A0 Wed Mar 28 20:49:11 2012 =C2=A0 = =C2=A0 =C2=A0 =C2=A0(r233627) >>>> +++ head/lib/libpmc/pmc.tsc.3 =C2=A0 Wed Mar 28 20:58:30 2012 =C2=A0 = =C2=A0 =C2=A0 =C2=A0(r233628) >>>> @@ -68,6 +68,7 @@ maps to the TSC. >>>> =C2=A0.Xr pmc.p4 3 , >>>> =C2=A0.Xr pmc.p5 3 , >>>> =C2=A0.Xr pmc.p6 3 , >>>> +.Xr pmc.soft 3 , >>>> =C2=A0.Xr pmclog 3 , >>>> =C2=A0.Xr hwpmc 4 >>>> =C2=A0.Sh HISTORY >>>> >>>> Modified: head/lib/libpmc/pmc.ucf.3 >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/lib/libpmc/pmc.ucf.3 =C2=A0 Wed Mar 28 20:49:11 2012 =C2=A0 = =C2=A0 =C2=A0 =C2=A0(r233627) >>>> +++ head/lib/libpmc/pmc.ucf.3 =C2=A0 Wed Mar 28 20:58:30 2012 =C2=A0 = =C2=A0 =C2=A0 =C2=A0(r233628) >>>> @@ -96,6 +96,7 @@ offset C0H under device number 0 and Fun >>>> =C2=A0.Xr pmc.corei7uc 3 , >>>> =C2=A0.Xr pmc.westmere 3 , >>>> =C2=A0.Xr pmc.westmereuc 3 , >>>> +.Xr pmc.soft 3 , >>>> =C2=A0.Xr pmc.tsc 3 , >>>> =C2=A0.Xr pmc_cpuinfo 3 , >>>> =C2=A0.Xr pmclog 3 , >>>> >>>> Modified: head/lib/libpmc/pmc.westmere.3 >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/lib/libpmc/pmc.westmere.3 =C2=A0 =C2=A0 =C2=A0Wed Mar 28 20:4= 9:11 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233627) >>>> +++ head/lib/libpmc/pmc.westmere.3 =C2=A0 =C2=A0 =C2=A0Wed Mar 28 20:5= 8:30 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233628) >>>> @@ -1381,6 +1381,7 @@ Counts number of SID integer 64 bit shif >>>> =C2=A0.Xr pmc.corei7 3 , >>>> =C2=A0.Xr pmc.corei7uc 3 , >>>> =C2=A0.Xr pmc.westmereuc 3 , >>>> +.Xr pmc.soft 3 , >>>> =C2=A0.Xr pmc.tsc 3 , >>>> =C2=A0.Xr pmc_cpuinfo 3 , >>>> =C2=A0.Xr pmclog 3 , >>>> >>>> Modified: head/lib/libpmc/pmc.westmereuc.3 >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/lib/libpmc/pmc.westmereuc.3 =C2=A0 =C2=A0Wed Mar 28 20:49:11 = 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233627) >>>> +++ head/lib/libpmc/pmc.westmereuc.3 =C2=A0 =C2=A0Wed Mar 28 20:58:30 = 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233628) >>>> @@ -1066,6 +1066,7 @@ disabled. >>>> =C2=A0.Xr pmc.corei7 3 , >>>> =C2=A0.Xr pmc.corei7uc 3 , >>>> =C2=A0.Xr pmc.westmere 3 , >>>> +.Xr pmc.soft 3 , >>>> =C2=A0.Xr pmc.tsc 3 , >>>> =C2=A0.Xr pmc_cpuinfo 3 , >>>> =C2=A0.Xr pmclog 3 , >>>> >>>> Modified: head/lib/libpmc/pmc.xscale.3 >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/lib/libpmc/pmc.xscale.3 =C2=A0 =C2=A0 =C2=A0 =C2=A0Wed Mar 28= 20:49:11 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233627) >>>> +++ head/lib/libpmc/pmc.xscale.3 =C2=A0 =C2=A0 =C2=A0 =C2=A0Wed Mar 28= 20:58:30 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233628) >>>> @@ -134,6 +134,7 @@ and the underlying hardware events used. >>>> =C2=A0.Xr pmc 3 , >>>> =C2=A0.Xr pmc_cpuinfo 3 , >>>> =C2=A0.Xr pmclog 3 , >>>> +.Xr pmc.soft 3 , >>>> =C2=A0.Xr hwpmc 4 >>>> =C2=A0.Sh HISTORY >>>> =C2=A0The >>>> >>>> Modified: head/lib/libpmc/pmclog.c >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/lib/libpmc/pmclog.c =C2=A0 =C2=A0Wed Mar 28 20:49:11 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233627) >>>> +++ head/lib/libpmc/pmclog.c =C2=A0 =C2=A0Wed Mar 28 20:58:30 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233628) >>>> @@ -369,6 +369,12 @@ pmclog_get_event(void *cookie, char **da >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =3D=3D NULL) >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0goto error; >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0break; >>>> + =C2=A0 =C2=A0 =C2=A0 case PMCLOG_TYPE_PMCALLOCATEDYN: >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PMCLOG_READ32(le,ev= ->pl_u.pl_ad.pl_pmcid); >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PMCLOG_READ32(le,ev= ->pl_u.pl_ad.pl_event); >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PMCLOG_READ32(le,ev= ->pl_u.pl_ad.pl_flags); >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PMCLOG_READSTRING(l= e,ev->pl_u.pl_ad.pl_evname,PMC_NAME_MAX); >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break; >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0case PMCLOG_TYPE_PMCATTACH: >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0PMCLOG_GET_PATH= LEN(pathlen,evlen,pmclog_pmcattach); >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0PMCLOG_READ32(l= e,ev->pl_u.pl_t.pl_pmcid); >>>> >>>> Modified: head/lib/libpmc/pmclog.h >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/lib/libpmc/pmclog.h =C2=A0 =C2=A0Wed Mar 28 20:49:11 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233627) >>>> +++ head/lib/libpmc/pmclog.h =C2=A0 =C2=A0Wed Mar 28 20:58:30 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233628) >>>> @@ -88,6 +88,13 @@ struct pmclog_ev_pmcallocate { >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0pmc_id_t =C2=A0 =C2=A0 =C2=A0 =C2=A0pl_pmci= d; >>>> =C2=A0}; >>>> >>>> +struct pmclog_ev_pmcallocatedyn { >>>> + =C2=A0 =C2=A0 =C2=A0 uint32_t =C2=A0 =C2=A0 =C2=A0 =C2=A0pl_event; >>>> + =C2=A0 =C2=A0 =C2=A0 char =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0p= l_evname[PMC_NAME_MAX]; >>>> + =C2=A0 =C2=A0 =C2=A0 uint32_t =C2=A0 =C2=A0 =C2=A0 =C2=A0pl_flags; >>>> + =C2=A0 =C2=A0 =C2=A0 pmc_id_t =C2=A0 =C2=A0 =C2=A0 =C2=A0pl_pmcid; >>>> +}; >>>> + >>>> =C2=A0struct pmclog_ev_pmcattach { >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0pmc_id_t =C2=A0 =C2=A0 =C2=A0 =C2=A0pl_pmci= d; >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0pid_t =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pl= _pid; >>>> @@ -146,6 +153,7 @@ struct pmclog_ev { >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0struct pmclog_e= v_map_out =C2=A0 =C2=A0 =C2=A0 =C2=A0pl_mo; >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0struct pmclog_e= v_pcsample =C2=A0 =C2=A0 =C2=A0 pl_s; >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0struct pmclog_e= v_pmcallocate =C2=A0 =C2=A0pl_a; >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct pmclog_ev_pm= callocatedyn pl_ad; >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0struct pmclog_e= v_pmcattach =C2=A0 =C2=A0 =C2=A0pl_t; >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0struct pmclog_e= v_pmcdetach =C2=A0 =C2=A0 =C2=A0pl_d; >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0struct pmclog_e= v_proccsw =C2=A0 =C2=A0 =C2=A0 =C2=A0pl_c; >>>> >>>> Modified: head/sys/amd64/amd64/trap.c >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/sys/amd64/amd64/trap.c Wed Mar 28 20:49:11 2012 =C2=A0 =C2=A0= =C2=A0 =C2=A0(r233627) >>>> +++ head/sys/amd64/amd64/trap.c Wed Mar 28 20:58:30 2012 =C2=A0 =C2=A0= =C2=A0 =C2=A0(r233628) >>>> @@ -71,6 +71,9 @@ __FBSDID("$FreeBSD$"); >>>> =C2=A0#include >>>> =C2=A0#ifdef HWPMC_HOOKS >>>> =C2=A0#include >>>> +PMC_SOFT_DEFINE( , , page_fault, all); >>>> +PMC_SOFT_DEFINE( , , page_fault, read); >>>> +PMC_SOFT_DEFINE( , , page_fault, write); >>>> =C2=A0#endif >>>> >>>> =C2=A0#include >>>> @@ -743,8 +746,20 @@ trap_pfault(frame, usermode) >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 */ >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0rv =3D vm_fault= (map, va, ftype, VM_FAULT_NORMAL); >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0} >>>> - =C2=A0 =C2=A0 =C2=A0 if (rv =3D=3D KERN_SUCCESS) >>>> + =C2=A0 =C2=A0 =C2=A0 if (rv =3D=3D KERN_SUCCESS) { >>>> +#ifdef HWPMC_HOOKS >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (ftype =3D=3D VM= _PROT_READ || ftype =3D=3D VM_PROT_WRITE) { >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 PMC_SOFT_CALL_TF( , , page_fault, all, frame); >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 if (ftype =3D=3D VM_PROT_READ) >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PMC_SOFT_CALL_TF( , , page_fault, re= ad, >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 frame); >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 else >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PMC_SOFT_CALL_TF( , , page_fault, wr= ite, >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 frame); >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } >>>> +#endif >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return (0); >>>> + =C2=A0 =C2=A0 =C2=A0 } >>>> =C2=A0nogo: >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0if (!usermode) { >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (td->td_intr= _nesting_level =3D=3D 0 && >>>> >>>> Modified: head/sys/amd64/include/pmc_mdep.h >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/sys/amd64/include/pmc_mdep.h =C2=A0 Wed Mar 28 20:49:11 2012 = =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233627) >>>> +++ head/sys/amd64/include/pmc_mdep.h =C2=A0 Wed Mar 28 20:58:30 2012 = =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233628) >>>> @@ -50,13 +50,13 @@ struct pmc_mdep; >>>> =C2=A0* measurement architecture have PMCs of the following classes: T= SC, >>>> =C2=A0* IAF, IAP, UCF and UCP. >>>> =C2=A0*/ >>>> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_MDEP_CLASS_INDEX_TSC =C2=A0 = =C2=A0 =C2=A0 =C2=A00 >>>> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_MDEP_CLASS_INDEX_K8 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 1 >>>> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_MDEP_CLASS_INDEX_P4 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 1 >>>> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_MDEP_CLASS_INDEX_IAP =C2=A0 = =C2=A0 =C2=A0 =C2=A01 >>>> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_MDEP_CLASS_INDEX_IAF =C2=A0 = =C2=A0 =C2=A0 =C2=A02 >>>> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_MDEP_CLASS_INDEX_UCP =C2=A0 = =C2=A0 =C2=A0 =C2=A03 >>>> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_MDEP_CLASS_INDEX_UCF =C2=A0 = =C2=A0 =C2=A0 =C2=A04 >>>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_MDEP_CLASS_INDEX_TSC =C2=A0 = =C2=A0 =C2=A0 =C2=A01 >>>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_MDEP_CLASS_INDEX_K8 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 2 >>>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_MDEP_CLASS_INDEX_P4 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 2 >>>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_MDEP_CLASS_INDEX_IAP =C2=A0 = =C2=A0 =C2=A0 =C2=A02 >>>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_MDEP_CLASS_INDEX_IAF =C2=A0 = =C2=A0 =C2=A0 =C2=A03 >>>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_MDEP_CLASS_INDEX_UCP =C2=A0 = =C2=A0 =C2=A0 =C2=A04 >>>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_MDEP_CLASS_INDEX_UCF =C2=A0 = =C2=A0 =C2=A0 =C2=A05 >>>> >>>> =C2=A0/* >>>> =C2=A0* On the amd64 platform we support the following PMCs. >>>> @@ -119,6 +119,15 @@ union pmc_md_pmc { >>>> >>>> =C2=A0#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_IN_USERSPACE(va) ((va) <= =3D VM_MAXUSER_ADDRESS) >>>> >>>> +/* Build a fake kernel trapframe from current instruction pointer. */ >>>> +#define PMC_FAKE_TRAPFRAME(TF) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ >>>> + =C2=A0 =C2=A0 =C2=A0 do { =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0\ >>>> + =C2=A0 =C2=A0 =C2=A0 (TF)->tf_cs =3D 0; (TF)->tf_rflags =3D 0; =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 \ >>>> + =C2=A0 =C2=A0 =C2=A0 __asm __volatile("movq %%rbp,%0" : "=3Dr" ((TF)= ->tf_rbp)); =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >>>> + =C2=A0 =C2=A0 =C2=A0 __asm __volatile("movq %%rsp,%0" : "=3Dr" ((TF)= ->tf_rsp)); =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >>>> + =C2=A0 =C2=A0 =C2=A0 __asm __volatile("call 1f \n\t1: pop %0" : "=3D= r"((TF)->tf_rip)); \ >>>> + =C2=A0 =C2=A0 =C2=A0 } while (0) >>>> + >>>> =C2=A0/* >>>> =C2=A0* Prototypes >>>> =C2=A0*/ >>>> >>>> Modified: head/sys/arm/include/pmc_mdep.h >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/sys/arm/include/pmc_mdep.h =C2=A0 =C2=A0 Wed Mar 28 20:49:11 = 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233627) >>>> +++ head/sys/arm/include/pmc_mdep.h =C2=A0 =C2=A0 Wed Mar 28 20:58:30 = 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233628) >>>> @@ -29,7 +29,7 @@ >>>> =C2=A0#ifndef _MACHINE_PMC_MDEP_H_ >>>> =C2=A0#define =C2=A0 =C2=A0 =C2=A0 =C2=A0_MACHINE_PMC_MDEP_H_ >>>> >>>> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_MDEP_CLASS_INDEX_XSCALE =C2=A0= =C2=A0 0 >>>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMC_MDEP_CLASS_INDEX_XSCALE =C2=A0= =C2=A0 1 >>>> =C2=A0/* >>>> =C2=A0* On the ARM platform we support the following PMCs. >>>> =C2=A0* >>>> >>>> Modified: head/sys/conf/files >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/sys/conf/files Wed Mar 28 20:49:11 2012 =C2=A0 =C2=A0 =C2=A0 = =C2=A0(r233627) >>>> +++ head/sys/conf/files Wed Mar 28 20:58:30 2012 =C2=A0 =C2=A0 =C2=A0 = =C2=A0(r233628) >>>> @@ -1260,6 +1260,7 @@ dev/hme/if_hme_sbus.c =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 optional hme sbus >>>> =C2=A0dev/hptiop/hptiop.c =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0opt= ional hptiop scbus >>>> =C2=A0dev/hwpmc/hwpmc_logging.c =C2=A0 =C2=A0 =C2=A0optional hwpmc >>>> =C2=A0dev/hwpmc/hwpmc_mod.c =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0optional= hwpmc >>>> +dev/hwpmc/hwpmc_soft.c =C2=A0 =C2=A0 =C2=A0 =C2=A0 optional hwpmc >>>> =C2=A0dev/ichsmb/ichsmb.c =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0opt= ional ichsmb >>>> =C2=A0dev/ichsmb/ichsmb_pci.c =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0optional ichsmb pci >>>> =C2=A0dev/ida/ida.c =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0optional ida >>>> >>>> Modified: head/sys/dev/hwpmc/hwpmc_amd.c >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/sys/dev/hwpmc/hwpmc_amd.c =C2=A0 =C2=A0 =C2=A0Wed Mar 28 20:4= 9:11 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233627) >>>> +++ head/sys/dev/hwpmc/hwpmc_amd.c =C2=A0 =C2=A0 =C2=A0Wed Mar 28 20:5= 8:30 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233628) >>>> @@ -687,7 +687,8 @@ amd_intr(int cpu, struct trapframe *tf) >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0wrmsr(perfctr, = AMD_RELOAD_COUNT_TO_PERFCTR_VALUE(v)); >>>> >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* Restart the = counter if logging succeeded. */ >>>> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 error =3D pmc_proce= ss_interrupt(cpu, pm, tf, TRAPF_USERMODE(tf)); >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 error =3D pmc_proce= ss_interrupt(cpu, PMC_HR, pm, tf, >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 TRAPF= _USERMODE(tf)); >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (error =3D= =3D 0) >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0wrmsr(evsel, config | AMD_PMC_ENABLE); >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0} >>>> @@ -874,7 +875,7 @@ amd_pcpu_fini(struct pmc_mdep *md, int c >>>> =C2=A0struct pmc_mdep * >>>> =C2=A0pmc_amd_initialize(void) >>>> =C2=A0{ >>>> - =C2=A0 =C2=A0 =C2=A0 int classindex, error, i, nclasses, ncpus; >>>> + =C2=A0 =C2=A0 =C2=A0 int classindex, error, i, ncpus; >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0struct pmc_classdep *pcd; >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0enum pmc_cputype cputype; >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0struct pmc_mdep *pmc_mdep; >>>> @@ -926,12 +927,9 @@ pmc_amd_initialize(void) >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 * These processors have two classes of PMC= s: the TSC and >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 * programmable PMCs. >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 */ >>>> - =C2=A0 =C2=A0 =C2=A0 nclasses =3D 2; >>>> - =C2=A0 =C2=A0 =C2=A0 pmc_mdep =3D malloc(sizeof(struct pmc_mdep) + n= classes * sizeof (struct pmc_classdep), >>>> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 M_PMC, M_WAITOK|M_ZERO); >>>> + =C2=A0 =C2=A0 =C2=A0 pmc_mdep =3D pmc_mdep_alloc(2); >>>> >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0pmc_mdep->pmd_cputype =3D cputype; >>>> - =C2=A0 =C2=A0 =C2=A0 pmc_mdep->pmd_nclass =C2=A0=3D nclasses; >>>> >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0ncpus =3D pmc_cpu_max(); >>>> >>>> >>>> Modified: head/sys/dev/hwpmc/hwpmc_core.c >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/sys/dev/hwpmc/hwpmc_core.c =C2=A0 =C2=A0 Wed Mar 28 20:49:11 = 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233627) >>>> +++ head/sys/dev/hwpmc/hwpmc_core.c =C2=A0 =C2=A0 Wed Mar 28 20:58:30 = 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233628) >>>> @@ -2239,7 +2239,7 @@ core_intr(int cpu, struct trapframe *tf) >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (pm->pm_stat= e !=3D PMC_STATE_RUNNING) >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0continue; >>>> >>>> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 error =3D pmc_proce= ss_interrupt(cpu, pm, tf, >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 error =3D pmc_proce= ss_interrupt(cpu, PMC_HR, pm, tf, >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0T= RAPF_USERMODE(tf)); >>>> >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0v =3D pm->pm_sc= .pm_reloadcount; >>>> @@ -2326,7 +2326,7 @@ core2_intr(int cpu, struct trapframe *tf >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0!= PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0continue; >>>> >>>> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 error =3D pmc_proce= ss_interrupt(cpu, pm, tf, >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 error =3D pmc_proce= ss_interrupt(cpu, PMC_HR, pm, tf, >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0T= RAPF_USERMODE(tf)); >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (error) >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0intrenable &=3D ~flag; >>>> @@ -2354,7 +2354,7 @@ core2_intr(int cpu, struct trapframe *tf >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0!= PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0continue; >>>> >>>> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 error =3D pmc_proce= ss_interrupt(cpu, pm, tf, >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 error =3D pmc_proce= ss_interrupt(cpu, PMC_HR, pm, tf, >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0T= RAPF_USERMODE(tf)); >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (error) >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0intrenable &=3D ~flag; >>>> >>>> Modified: head/sys/dev/hwpmc/hwpmc_intel.c >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/sys/dev/hwpmc/hwpmc_intel.c =C2=A0 =C2=A0Wed Mar 28 20:49:11 = 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233627) >>>> +++ head/sys/dev/hwpmc/hwpmc_intel.c =C2=A0 =C2=A0Wed Mar 28 20:58:30 = 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233628) >>>> @@ -162,12 +162,10 @@ pmc_intel_initialize(void) >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return (NULL); >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0} >>>> >>>> - =C2=A0 =C2=A0 =C2=A0 pmc_mdep =3D malloc(sizeof(struct pmc_mdep) + n= classes * >>>> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sizeof(struct pmc_classdep), M_PM= C, M_WAITOK|M_ZERO); >>>> + =C2=A0 =C2=A0 =C2=A0 /* Allocate base class and initialize machine d= ependent struct */ >>>> + =C2=A0 =C2=A0 =C2=A0 pmc_mdep =3D pmc_mdep_alloc(nclasses); >>>> >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0pmc_mdep->pmd_cputype =C2=A0 =C2=A0=3D cput= ype; >>>> - =C2=A0 =C2=A0 =C2=A0 pmc_mdep->pmd_nclass =C2=A0 =C2=A0 =3D nclasses= ; >>>> - >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0pmc_mdep->pmd_switch_in =C2=A0=3D intel_swi= tch_in; >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0pmc_mdep->pmd_switch_out =3D intel_switch_o= ut; >>>> >>>> >>>> Modified: head/sys/dev/hwpmc/hwpmc_logging.c >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/sys/dev/hwpmc/hwpmc_logging.c =C2=A0Wed Mar 28 20:49:11 2012 = =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233627) >>>> +++ head/sys/dev/hwpmc/hwpmc_logging.c =C2=A0Wed Mar 28 20:58:30 2012 = =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233628) >>>> @@ -129,6 +129,7 @@ static struct mtx pmc_kthread_mtx; =C2=A0/* sl >>>> >>>> =C2=A0/* Emit a string. =C2=A0Caution: does NOT update _le, so needs t= o be last */ >>>> =C2=A0#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMCLOG_EMITSTRING(S,L) =C2=A0= do { bcopy((S), _le, (L)); } while (0) >>>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMCLOG_EMITNULLSTRING(L) do { bzer= o(_le, (L)); } while (0) >>>> >>>> =C2=A0#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PMCLOG_DESPATCH(PO) =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pmclog_release(= (PO)); =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ >>>> @@ -835,16 +836,33 @@ void >>>> =C2=A0pmclog_process_pmcallocate(struct pmc *pm) >>>> =C2=A0{ >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0struct pmc_owner *po; >>>> + =C2=A0 =C2=A0 =C2=A0 struct pmc_soft *ps; >>>> >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0po =3D pm->pm_owner; >>>> >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0PMCDBG(LOG,ALL,1, "pm=3D%p", pm); >>>> >>>> - =C2=A0 =C2=A0 =C2=A0 PMCLOG_RESERVE(po, PMCALLOCATE, sizeof(struct p= mclog_pmcallocate)); >>>> - =C2=A0 =C2=A0 =C2=A0 PMCLOG_EMIT32(pm->pm_id); >>>> - =C2=A0 =C2=A0 =C2=A0 PMCLOG_EMIT32(pm->pm_event); >>>> - =C2=A0 =C2=A0 =C2=A0 PMCLOG_EMIT32(pm->pm_flags); >>>> - =C2=A0 =C2=A0 =C2=A0 PMCLOG_DESPATCH(po); >>>> + =C2=A0 =C2=A0 =C2=A0 if (PMC_TO_CLASS(pm) =3D=3D PMC_CLASS_SOFT) { >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PMCLOG_RESERVE(po, = PMCALLOCATEDYN, >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sizeo= f(struct pmclog_pmcallocatedyn)); >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PMCLOG_EMIT32(pm->p= m_id); >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PMCLOG_EMIT32(pm->p= m_event); >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PMCLOG_EMIT32(pm->p= m_flags); >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ps =3D pmc_soft_ev_= acquire(pm->pm_event); >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (ps !=3D NULL) >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 PMCLOG_EMITSTRING(ps->ps_ev.pm_ev_name,PMC_NAME_MAX); >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 else >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 PMCLOG_EMITNULLSTRING(PMC_NAME_MAX); >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pmc_soft_ev_release= (ps); >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PMCLOG_DESPATCH(po)= ; >>>> + =C2=A0 =C2=A0 =C2=A0 } else { >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PMCLOG_RESERVE(po, = PMCALLOCATE, >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sizeo= f(struct pmclog_pmcallocate)); >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PMCLOG_EMIT32(pm->p= m_id); >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PMCLOG_EMIT32(pm->p= m_event); >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PMCLOG_EMIT32(pm->p= m_flags); >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PMCLOG_DESPATCH(po)= ; >>>> + =C2=A0 =C2=A0 =C2=A0 } >>>> =C2=A0} >>>> >>>> =C2=A0void >>>> >>>> Modified: head/sys/dev/hwpmc/hwpmc_mips.c >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/sys/dev/hwpmc/hwpmc_mips.c =C2=A0 =C2=A0 Wed Mar 28 20:49:11 = 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233627) >>>> +++ head/sys/dev/hwpmc/hwpmc_mips.c =C2=A0 =C2=A0 Wed Mar 28 20:58:30 = 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233628) >>>> @@ -287,7 +287,7 @@ mips_pmc_intr(int cpu, struct trapframe >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0retval =3D 1; >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (pm->pm_stat= e !=3D PMC_STATE_RUNNING) >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0continue; >>>> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 error =3D pmc_proce= ss_interrupt(cpu, pm, tf, >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 error =3D pmc_proce= ss_interrupt(cpu, PMC_HR, pm, tf, >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0T= RAPF_USERMODE(tf)); >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (error) { >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0/* Clear/disable the relevant counter */ >>>> >>>> Modified: head/sys/dev/hwpmc/hwpmc_mod.c >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/sys/dev/hwpmc/hwpmc_mod.c =C2=A0 =C2=A0 =C2=A0Wed Mar 28 20:4= 9:11 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233627) >>>> +++ head/sys/dev/hwpmc/hwpmc_mod.c =C2=A0 =C2=A0 =C2=A0Wed Mar 28 20:5= 8:30 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r233628) >>>> @@ -70,6 +70,8 @@ __FBSDID("$FreeBSD$"); >>>> =C2=A0#include >>>> =C2=A0#include >>>> >>>> +#include "hwpmc_soft.h" >>>> + >>>> =C2=A0/* >>>> =C2=A0* Types >>>> =C2=A0*/ >>>> @@ -182,7 +184,7 @@ static int =C2=A0pmc_attach_one_process(struct >>>> =C2=A0static int =C2=A0 =C2=A0 pmc_can_allocate_rowindex(struct proc *= p, unsigned int ri, >>>> =C2=A0 =C2=A0 int cpu); >>>> =C2=A0static int =C2=A0 =C2=A0 pmc_can_attach(struct pmc *pm, struct p= roc *p); >>>> -static void =C2=A0 =C2=A0pmc_capture_user_callchain(int cpu, struct t= rapframe *tf); >>>> +static void =C2=A0 =C2=A0pmc_capture_user_callchain(int cpu, int soft= , struct trapframe *tf); >>>> =C2=A0static void =C2=A0 =C2=A0pmc_cleanup(void); >>>> =C2=A0static int =C2=A0 =C2=A0 pmc_detach_process(struct proc *p, stru= ct pmc *pm); >>>> =C2=A0static int =C2=A0 =C2=A0 pmc_detach_one_process(struct proc *p, = struct pmc *pm, >>>> @@ -206,7 +208,7 @@ static void pmc_process_csw_out(struct t >>>> =C2=A0static void =C2=A0 =C2=A0pmc_process_exit(void *arg, struct proc= *p); >>>> =C2=A0static void =C2=A0 =C2=A0pmc_process_fork(void *arg, struct proc= *p1, >>>> =C2=A0 =C2=A0 struct proc *p2, int n); >>>> -static void =C2=A0 =C2=A0pmc_process_samples(int cpu); >>>> +static void =C2=A0 =C2=A0pmc_process_samples(int cpu, int soft); >>>> =C2=A0static void =C2=A0 =C2=A0pmc_release_pmc_descriptor(struct pmc *= pmc); >>>> =C2=A0static void =C2=A0 =C2=A0pmc_remove_owner(struct pmc_owner *po); >>>> =C2=A0static void =C2=A0 =C2=A0pmc_remove_process_descriptor(struct pm= c_process *pp); >>>> @@ -218,12 +220,16 @@ static int =C2=A0 =C2=A0 =C2=A0 =C2=A0pmc_stop(s= truct pmc *pm); >>>> =C2=A0static int =C2=A0 =C2=A0 pmc_syscall_handler(struct thread *td, = void *syscall_args); >>>> =C2=A0static void =C2=A0 =C2=A0pmc_unlink_target_process(struct pmc *p= mc, >>>> =C2=A0 =C2=A0 struct pmc_process *pp); >>>> +static int generic_switch_in(struct pmc_cpu *pc, struct pmc_process *= pp); >>>> +static int generic_switch_out(struct pmc_cpu *pc, struct pmc_process = *pp); >>>> +static struct pmc_mdep *pmc_generic_cpu_initialize(void); >>>> +static void pmc_generic_cpu_finalize(struct pmc_mdep *md); >>>> >>>> =C2=A0/* >>>> =C2=A0* Kernel tunables and sysctl(8) interface. >>>> =C2=A0*/ >>>> >>>> -SYSCTL_NODE(_kern, OID_AUTO, hwpmc, CTLFLAG_RW, 0, "HWPMC parameters"= ); >>>> +SYSCTL_DECL(_kern_hwpmc); >>>> >>>> =C2=A0static int pmc_callchaindepth =3D PMC_CALLCHAIN_DEPTH; >>>> =C2=A0TUNABLE_INT(PMC_SYSCTL_NAME_PREFIX "callchaindepth", &pmc_callch= aindepth); >>>> @@ -1833,7 +1839,9 @@ const char *pmc_hooknames[] =3D { >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0"KLDUNLOAD", >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0"MMAP", >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0"MUNMAP", >>>> - =C2=A0 =C2=A0 =C2=A0 "CALLCHAIN" >>>> + =C2=A0 =C2=A0 =C2=A0 "CALLCHAIN-NMI", >>>> + =C2=A0 =C2=A0 =C2=A0 "CALLCHAIN-SOFT", >>>> + =C2=A0 =C2=A0 =C2=A0 "SOFTSAMPLING" >>>> =C2=A0}; >>>> =C2=A0#endif >>>> >>>> @@ -1992,7 +2000,8 @@ pmc_hook_handler(struct thread *td, int >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * lose the int= errupt sample. >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 */ >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0CPU_CLR_ATOMIC(= PCPU_GET(cpuid), &pmc_cpumask); >>>> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pmc_process_samples= (PCPU_GET(cpuid)); >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pmc_process_samples= (PCPU_GET(cpuid), PMC_HR); >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pmc_process_samples= (PCPU_GET(cpuid), PMC_SR); >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0break; >>>> >>>> >>>> @@ -2022,11 +2031,30 @@ pmc_hook_handler(struct thread *td, int >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 */ >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0KASSERT(td =3D= =3D curthread, ("[pmc,%d] td !=3D curthread", >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0_= _LINE__)); >>>> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pmc_capture_user_ca= llchain(PCPU_GET(cpuid), >>>> + >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pmc_capture_user_ca= llchain(PCPU_GET(cpuid), PMC_HR, >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(= struct trapframe *) arg); >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0td->td_pflags &= =3D ~TDP_CALLCHAIN; >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0break; >>>> >>>> + =C2=A0 =C2=A0 =C2=A0 case PMC_FN_USER_CALLCHAIN_SOFT: >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* Record a ca= ll chain. >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/ >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 KASSERT(td =3D=3D c= urthread, ("[pmc,%d] td !=3D curthread", >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 __LIN= E__)); >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pmc_capture_user_ca= llchain(PCPU_GET(cpuid), PMC_SR, >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (stru= ct trapframe *) arg); >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 td->td_pflags &=3D = ~TDP_CALLCHAIN; >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break; >>>> + >>>> + =C2=A0 =C2=A0 =C2=A0 case PMC_FN_SOFT_SAMPLING: >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* Call soft P= MC sampling intr. >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/ >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pmc_soft_intr((stru= ct pmckern_soft *) arg); >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break; >>>> + >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0default: >>>> =C2=A0#ifdef DEBUG >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0KASSERT(0, ("[p= mc,%d] unknown hook %d\n", __LINE__, function)); >>>> @@ -2221,18 +2249,17 @@ pmc_destroy_pmc_descriptor(struct pmc *p >>>> =C2=A0static void >>>> =C2=A0pmc_wait_for_pmc_idle(struct pmc *pm) >>>> =C2=A0{ >>>> -#ifdef DEBUG >>>> +#ifdef DEBUG >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0volatile int maxloop; >>>> >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0maxloop =3D 100 * pmc_cpu_max(); >>>> =C2=A0#endif >>>> - >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0/* >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 * Loop (with a forced context switch) till= the PMC's runcount >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 * comes down to zero. >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 */ >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0while (atomic_load_acq_32(&pm->pm_runcount)= > 0) { >>>> -#ifdef DEBUG >>>> +#ifdef DEBUG >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0maxloop--; >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0KASSERT(maxloop= > 0, >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(= "[pmc,%d] (ri%d, rc%d) waiting too long for " >>>> @@ -2972,6 +2999,53 @@ pmc_syscall_handler(struct thread *td, v >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0} >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0break; >>>> >>>> + =C2=A0 =C2=A0 =C2=A0 /* >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0* Retrieve soft events list. >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0*/ >>>> + =C2=A0 =C2=A0 =C2=A0 case PMC_OP_GETDYNEVENTINFO: >>>> + =C2=A0 =C2=A0 =C2=A0 { >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 enum pmc_class =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0cl; >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 enum pmc_event =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ev; >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct pmc_op_getdy= neventinfo =C2=A0 *gei; >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct pmc_dyn_even= t_descr =C2=A0 =C2=A0 =C2=A0dev; >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct pmc_soft =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 *ps; >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 uint32_t =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ne= vent; >>>> + >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sx_assert(&pmc_sx, = SX_LOCKED); >>>> + >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 gei =3D (struct pmc= _op_getdyneventinfo *) arg; >>>> + >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if ((error =3D copy= in(&gei->pm_class, &cl, sizeof(cl))) !=3D 0) >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 break; >>>> + >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Only SOFT class = is dynamic. */ >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (cl !=3D PMC_CLA= SS_SOFT) { >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 error =3D EINVAL; >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 break; >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } >>>> + >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 nevent =3D 0; >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 for (ev =3D PMC_EV_= SOFT_FIRST; ev <=3D PMC_EV_SOFT_LAST; ev++) { >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 ps =3D pmc_soft_ev_acquire(ev); >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 if (ps =3D=3D NULL) >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 continue; >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 bcopy(&ps->ps_ev, &dev, sizeof(dev)); >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 pmc_soft_ev_release(ps); >>>> + >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 error =3D copyout(&dev, >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 &gei->pm_events[nevent], >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 sizeof(struct pmc_dyn_event_descr)); >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 if (error !=3D 0) >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break; >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 nevent++; >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (error !=3D 0) >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 break; >>>> + >>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 error =3D copyout(&= nevent, &gei->pm_nevent, >>>> >>>> *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** >> >> >> >> -- >> Monthadar Al Jaberi >> > > --=20 Monthadar Al Jaberi From owner-freebsd-mips@FreeBSD.ORG Mon Apr 23 08:59:02 2012 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 319F51065675; Mon, 23 Apr 2012 08:59:02 +0000 (UTC) (envelope-from fabien.thomas@netasq.com) Received: from work.netasq.com (gwlille.netasq.com [91.212.116.1]) by mx1.freebsd.org (Postfix) with ESMTP id 35BFE8FC08; Mon, 23 Apr 2012 08:59:01 +0000 (UTC) Received: from [10.2.1.1] (unknown [10.2.1.1]) by work.netasq.com (Postfix) with ESMTPSA id 32F1427038E2; Mon, 23 Apr 2012 10:59:33 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v1257) Content-Type: multipart/signed; boundary="Apple-Mail=_AA16D944-B364-4C83-BE40-AEE3A01B5AB1"; protocol="application/pkcs7-signature"; micalg=sha1 From: Fabien Thomas In-Reply-To: Date: Mon, 23 Apr 2012 10:59:07 +0200 Message-Id: <2DB1BD7C-D909-4D36-90F4-8F19CD27412B@netasq.com> References: <201203282058.q2SKwVsJ053900@svn.freebsd.org> <25D59FAA-D52A-42FB-8120-66467863AB0B@netasq.com> To: Monthadar Al Jaberi X-Mailer: Apple Mail (2.1257) X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: monthadar@freebsd.org, freebsd-current , Fabien Thomas , freebsd-mips@freebsd.org Subject: Re: svn commit: r233628 - in head: lib/libpmc sys/amd64/amd64 sys/amd64/include sys/arm/include sys/conf sys/dev/hwpmc sys/i386/i386 sys/i386/include sys/kern sys/mips/include sys/modules/hwpmc sys/pow... X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Apr 2012 08:59:02 -0000 --Apple-Mail=_AA16D944-B364-4C83-BE40-AEE3A01B5AB1 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Le 23 avr. 2012 =C3=A0 10:06, Monthadar Al Jaberi a =C3=A9crit : > On Mon, Apr 23, 2012 at 9:47 AM, Fabien Thomas = wrote: >> Hi, >>=20 >> The rumors seems true :) >> Can you try the patch attached (I cannot test as i've no MIPS = hardware) ? >=20 > my RSPRO boots fine now, thank you :) >=20 commited as r234598. Thanks! >>=20 >> Thanks, >> Fabien >>=20 >>=20 >>> On Mon, Apr 23, 2012 at 8:44 AM, Adrian Chadd = wrote: >>>> Hi Fabien, >>>>=20 >>>> I've heard some rumours that this broke hwpmc support for mips24k. >>>>=20 >>>> Monthadar, can you please provide some background info for this? >>>>=20 >>>=20 >>> This is the log output >>>=20 >>> Using default protocol (TFTP) >>> Entry point: 0x80050100, address range: 0x80050000-0x804f1dcc >>> RedBoot> exec >>> Now booting linux kernel: >>> Base address 0x80050000 Entry 0x80050100 >>> memsize=3D0x08000000 >>> modetty0=3D0,n,8,1,hw >>> board=3DRouterStation PRO >>> ethaddr=3D00.15.6d.c8.c9.2e >>> CPU platform: Atheros AR7161 rev 2 >>> CPU Frequency=3D720 MHz >>> CPU DDR Frequency=3D360 MHz >>> CPU AHB Frequency=3D180 MHz >>> platform frequency: 720000000 >>> arguments: >>> a0 =3D 00000002 >>> a1 =3D 80050028 >>> a2 =3D 80050000 >>> a3 =3D 00000001 >>> Cmd line: = =EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BDm=EF=BF=BD=EF= =BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF= =BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD_}=EF=BF=BD=EF=BF=BD=EF=BF= =BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=DF=BEq=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF= =BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF= =BD=EF=BF=BD=EF=BF=BD = =EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF= =BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF= =BD=DF=BF=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF= =BF=BD=EF=BF=BD_=EF=BF=BDw=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD = =EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD?-=EF=BF=BD=EF=BF=BD=EF=BF=BD= =EF=BF=BD{=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD~=EF=BF=BD= =EF=BF=BD >>> Environment: >>> memsize =3D 0x08000000 >>> modetty0 =3D 0,n,8,1,hw >>> ethaddr =3D 00.15.6d.c8.c9.2e >>> board =3D RouterStation PRO >>> Cache info: >>> picache_stride =3D 4096 >>> picache_loopcount =3D 16 >>> pdcache_stride =3D 4096 >>> pdcache_loopcount =3D 8 >>> cpu0: MIPS Technologies processor v116.147 >>> MMU: Standard TLB, 16 entries >>> L1 i-cache: 4 ways of 512 sets, 32 bytes per line >>> L1 d-cache: 4 ways of 256 sets, 32 bytes per line >>> Config1=3D0x9ee3519e >>> Config3=3D0x20 >>> KDB: debugger backends: ddb >>> KDB: current backend: ddb >>> Copyright (c) 1992-2012 The FreeBSD Project. >>> Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, = 1994 >>> The Regents of the University of California. All rights = reserved. >>> FreeBSD is a registered trademark of The FreeBSD Foundation. >>> FreeBSD 10.0-CURRENT #12: Fri Apr 20 18:03:16 CEST 2012 >>> root@freebsd-re-9:/usr/obj/mips.mips/usr/src/sys/RSPRO_USB_PROD = mips >>> WARNING: WITNESS option enabled, expect reduced performance. >>> MEMGUARD DEBUGGING ALLOCATOR INITIALIZED: >>> MEMGUARD map base: 0xc0800000 >>> MEMGUARD map limit: 0xc1c00000 >>> MEMGUARD map size: 20480 KBytes >>> real memory =3D 134217728 (131072K bytes) >>> avail memory =3D 123117568 (117MB) >>> random device not loaded; using insecure entropy >>> nexus0: >>> clock0: on nexus0 >>> Timecounter "MIPS32" frequency 360000000 Hz quality 800 >>> Event timer "MIPS32" frequency 360000000 Hz quality 800 >>> apb0 at irq 4 on nexus0 >>> uart0: <16550 or compatible> on apb0 >>> uart0: console (115200,n,8,1) >>> gpio0: on apb0 >>> gpio0: [GIANT-LOCKED] >>> gpio0: gpio pinmask=3D0x0 >>> gpioc0: on gpio0 >>> gpiobus0: on gpio0 >>> ehci0: at mem >>> 0x1b000000-0x1bffffff irq 1 on nexus0 >>> usbus0: set host controller mode >>> usbus0: EHCI version 1.0 >>> usbus0: set host controller mode >>> usbus0 on ehci0 >>> pcib0 at irq 0 on nexus0 >>> pci0: on pcib0 >>> pci0: at device 0.0 (no driver = attached) >>> ath0: irq 0 at device 17.0 on pci0 >>> ath0: AR5413 mac 10.5 RF5413 phy 6.1 >>> ath0: 2GHz radio: 0x0000; 5GHz radio: 0x0063 >>> arge0: at mem >>> 0x19000000-0x19000fff irq 2 on nexus0 >>> arge0: No PHY specified, using mask 16 >>> miibus0: on arge0 >>> ukphy0: PHY 4 on miibus0 >>> ukphy0: none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, >>> 1000baseT-FDX, 1000baseT-FDX-master, auto >>> arge0: Ethernet address: 00:15:6d:c8:c9:2e >>> arge1: at mem >>> 0x1a000000-0x1a000fff irq 3 on nexus0 >>> arge1: No PHY specified, using mask 15 >>> arge1: Ethernet address: 00:15:6d:c8:c9:2f >>> spi0: at mem 0x1f000000-0x1f00000f on nexus0 >>> spibus0: on spi0 >>> mx25l0: at cs 0 on spibus0 >>> mx25l0: mx25ll128, sector 65536 bytes, 256 sectors >>> ar71xx_wdog0: on nexus0 >>> Timecounters tick every 1.000 msec >>> usbus0: 480Mbps High Speed USB v2.0 >>> ugen0.1: at usbus0 >>> uhub0: on = usbus0 >>> panic: [pmc,4816] npmc miscomputed: ri=3D0, md->npmc=3D2 >>> KDB: enter: panic >>> [ thread pid 0 tid 100000 ] >>> Stopped at kdb_enter+0x4c: lui at,0x8050 >>> db> tr >>> Tracing pid 0 tid 100000 td 0x804f76d0 >>> db_trace_thread+30 (?,?,?,?) ra 8068b94800000018 sp 0 sz 0 >>> 80075adc+114 (0,?,ffffffff,?) ra 8068b96000000020 sp 100000000 sz 1 >>> 80074e24+388 (?,?,?,?) ra 8068b980000000a8 sp 0 sz 0 >>> db_command_loop+70 (?,?,?,?) ra 8068ba2800000018 sp 0 sz 0 >>> 80077900+f4 (?,?,?,?) ra 8068ba40000001a8 sp 0 sz 0 >>> kdb_trap+110 (?,?,?,?) ra 8068bbe800000030 sp 0 sz 0 >>> trap+c7c (?,?,?,?) ra 8068bc18000000b8 sp 0 sz 0 >>> MipsKernGenException+134 (0,4,8043b1d4,119) ra 8068bcd0000000c8 sp >>> 100000001 sz 1 >>> kdb_enter+4c (?,?,?,?) ra 8068bd9800000018 sp 0 sz 0 >>> panic+11c (?,12d0,0,2) ra 8068bdb000000028 sp 1 sz 1 >>> 800e8ca8+274 (?,?,?,?) ra 8068bdd800000038 sp 0 sz 0 >>> syscall_module_handler+b8 (?,?,?,?) ra 8068be1000000028 sp 0 sz 0 >>> module_register_init+9c (?,?,?,?) ra 8068be3800000028 sp 0 sz 0 >>> mi_startup+138 (?,?,?,?) ra 8068be6000000020 sp 0 sz 0 >>> _start+90 (?,?,?,?) ra 8068be8000000000 sp 0 sz 0 >>> pid 0 >>> db> >>>=20 >>>> Thanks, >>>>=20 >>>>=20 >>>>=20 >>>> adrian >>>>=20 >>>> On 28 March 2012 13:58, Fabien Thomas wrote: >>>>> Author: fabient >>>>> Date: Wed Mar 28 20:58:30 2012 >>>>> New Revision: 233628 >>>>> URL: http://svn.freebsd.org/changeset/base/233628 >>>>>=20 >>>>> Log: >>>>> Add software PMC support. >>>>>=20 >>>>> New kernel events can be added at various location for sampling = or counting. >>>>> This will for example allow easy system profiling whatever the = processor is >>>>> with known tools like pmcstat(8). >>>>>=20 >>>>> Simultaneous usage of software PMC and hardware PMC is possible, = for example >>>>> looking at the lock acquire failure, page fault while sampling on >>>>> instructions. >>>>>=20 >>>>> Sponsored by: NETASQ >>>>> MFC after: 1 month >>>>>=20 >>>>> Added: >>>>> head/lib/libpmc/pmc.soft.3 (contents, props changed) >>>>> head/sys/dev/hwpmc/hwpmc_soft.c (contents, props changed) >>>>> head/sys/dev/hwpmc/hwpmc_soft.h (contents, props changed) >>>>> Modified: >>>>> head/lib/libpmc/Makefile >>>>> head/lib/libpmc/libpmc.c >>>>> head/lib/libpmc/pmc.3 >>>>> head/lib/libpmc/pmc.atom.3 >>>>> head/lib/libpmc/pmc.core.3 >>>>> head/lib/libpmc/pmc.core2.3 >>>>> head/lib/libpmc/pmc.corei7.3 >>>>> head/lib/libpmc/pmc.corei7uc.3 >>>>> head/lib/libpmc/pmc.iaf.3 >>>>> head/lib/libpmc/pmc.k7.3 >>>>> head/lib/libpmc/pmc.k8.3 >>>>> head/lib/libpmc/pmc.mips24k.3 >>>>> head/lib/libpmc/pmc.octeon.3 >>>>> head/lib/libpmc/pmc.p4.3 >>>>> head/lib/libpmc/pmc.p5.3 >>>>> head/lib/libpmc/pmc.p6.3 >>>>> head/lib/libpmc/pmc.sandybridge.3 >>>>> head/lib/libpmc/pmc.sandybridgeuc.3 >>>>> head/lib/libpmc/pmc.tsc.3 >>>>> head/lib/libpmc/pmc.ucf.3 >>>>> head/lib/libpmc/pmc.westmere.3 >>>>> head/lib/libpmc/pmc.westmereuc.3 >>>>> head/lib/libpmc/pmc.xscale.3 >>>>> head/lib/libpmc/pmclog.c >>>>> head/lib/libpmc/pmclog.h >>>>> head/sys/amd64/amd64/trap.c >>>>> head/sys/amd64/include/pmc_mdep.h >>>>> head/sys/arm/include/pmc_mdep.h >>>>> head/sys/conf/files >>>>> head/sys/dev/hwpmc/hwpmc_amd.c >>>>> head/sys/dev/hwpmc/hwpmc_core.c >>>>> head/sys/dev/hwpmc/hwpmc_intel.c >>>>> head/sys/dev/hwpmc/hwpmc_logging.c >>>>> head/sys/dev/hwpmc/hwpmc_mips.c >>>>> head/sys/dev/hwpmc/hwpmc_mod.c >>>>> head/sys/dev/hwpmc/hwpmc_piv.c >>>>> head/sys/dev/hwpmc/hwpmc_powerpc.c >>>>> head/sys/dev/hwpmc/hwpmc_ppro.c >>>>> head/sys/dev/hwpmc/hwpmc_tsc.c >>>>> head/sys/dev/hwpmc/hwpmc_x86.c >>>>> head/sys/dev/hwpmc/hwpmc_xscale.c >>>>> head/sys/dev/hwpmc/pmc_events.h >>>>> head/sys/i386/i386/trap.c >>>>> head/sys/i386/include/pmc_mdep.h >>>>> head/sys/kern/kern_clock.c >>>>> head/sys/kern/kern_lock.c >>>>> head/sys/kern/kern_mutex.c >>>>> head/sys/kern/kern_pmc.c >>>>> head/sys/kern/kern_rwlock.c >>>>> head/sys/kern/kern_sx.c >>>>> head/sys/kern/subr_trap.c >>>>> head/sys/mips/include/pmc_mdep.h >>>>> head/sys/modules/hwpmc/Makefile >>>>> head/sys/powerpc/include/pmc_mdep.h >>>>> head/sys/sys/pmc.h >>>>> head/sys/sys/pmckern.h >>>>> head/sys/sys/pmclog.h >>>>> head/usr.sbin/pmcstat/pmcstat_log.c >>>>>=20 >>>>> Modified: head/lib/libpmc/Makefile >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/lib/libpmc/Makefile Wed Mar 28 20:49:11 2012 = (r233627) >>>>> +++ head/lib/libpmc/Makefile Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -20,6 +20,7 @@ MAN+=3D pmc_read.3 >>>>> MAN+=3D pmc_set.3 >>>>> MAN+=3D pmc_start.3 >>>>> MAN+=3D pmclog.3 >>>>> +MAN+=3D pmc.soft.3 >>>>>=20 >>>>> # PMC-dependent manual pages >>>>> .if ${MACHINE_CPUARCH} =3D=3D "i386" || ${MACHINE_CPUARCH} =3D=3D = "amd64" >>>>>=20 >>>>> Modified: head/lib/libpmc/libpmc.c >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/lib/libpmc/libpmc.c Wed Mar 28 20:49:11 2012 = (r233627) >>>>> +++ head/lib/libpmc/libpmc.c Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -77,11 +77,12 @@ static int tsc_allocate_pmc(enum pmc_eve >>>>> static int xscale_allocate_pmc(enum pmc_event _pe, char = *_ctrspec, >>>>> struct pmc_op_pmcallocate *_pmc_config); >>>>> #endif >>>>> - >>>>> #if defined(__mips__) >>>>> static int mips_allocate_pmc(enum pmc_event _pe, char* ctrspec, >>>>> struct pmc_op_pmcallocate = *_pmc_config); >>>>> #endif /* __mips__ */ >>>>> +static int soft_allocate_pmc(enum pmc_event _pe, char *_ctrspec, >>>>> + struct pmc_op_pmcallocate *_pmc_config); >>>>>=20 >>>>> #if defined(__powerpc__) >>>>> static int ppc7450_allocate_pmc(enum pmc_event _pe, char* = ctrspec, >>>>> @@ -156,6 +157,8 @@ PMC_CLASSDEP_TABLE(octeon, OCTEON); >>>>> PMC_CLASSDEP_TABLE(ucf, UCF); >>>>> PMC_CLASSDEP_TABLE(ppc7450, PPC7450); >>>>>=20 >>>>> +static struct pmc_event_descr soft_event_table[PMC_EV_DYN_COUNT]; >>>>> + >>>>> #undef __PMC_EV_ALIAS >>>>> #define __PMC_EV_ALIAS(N,CODE) { N, PMC_EV_##CODE }, >>>>>=20 >>>>> @@ -215,21 +218,22 @@ static const struct pmc_event_descr west >>>>> PMC_CLASS_##C, __VA_ARGS__ \ >>>>> } >>>>>=20 >>>>> -PMC_MDEP_TABLE(atom, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC); >>>>> -PMC_MDEP_TABLE(core, IAP, PMC_CLASS_TSC); >>>>> -PMC_MDEP_TABLE(core2, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC); >>>>> -PMC_MDEP_TABLE(corei7, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC, = PMC_CLASS_UCF, PMC_CLASS_UCP); >>>>> -PMC_MDEP_TABLE(sandybridge, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC, = PMC_CLASS_UCF, PMC_CLASS_UCP); >>>>> -PMC_MDEP_TABLE(westmere, IAP, PMC_CLASS_IAF, PMC_CLASS_TSC, = PMC_CLASS_UCF, PMC_CLASS_UCP); >>>>> -PMC_MDEP_TABLE(k7, K7, PMC_CLASS_TSC); >>>>> -PMC_MDEP_TABLE(k8, K8, PMC_CLASS_TSC); >>>>> -PMC_MDEP_TABLE(p4, P4, PMC_CLASS_TSC); >>>>> -PMC_MDEP_TABLE(p5, P5, PMC_CLASS_TSC); >>>>> -PMC_MDEP_TABLE(p6, P6, PMC_CLASS_TSC); >>>>> -PMC_MDEP_TABLE(xscale, XSCALE, PMC_CLASS_XSCALE); >>>>> -PMC_MDEP_TABLE(mips24k, MIPS24K, PMC_CLASS_MIPS24K); >>>>> -PMC_MDEP_TABLE(octeon, OCTEON, PMC_CLASS_OCTEON); >>>>> -PMC_MDEP_TABLE(ppc7450, PPC7450, PMC_CLASS_PPC7450); >>>>> +PMC_MDEP_TABLE(atom, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, = PMC_CLASS_TSC); >>>>> +PMC_MDEP_TABLE(core, IAP, PMC_CLASS_SOFT, PMC_CLASS_TSC); >>>>> +PMC_MDEP_TABLE(core2, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, = PMC_CLASS_TSC); >>>>> +PMC_MDEP_TABLE(corei7, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, = PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); >>>>> +PMC_MDEP_TABLE(sandybridge, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, = PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); >>>>> +PMC_MDEP_TABLE(westmere, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, = PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); >>>>> +PMC_MDEP_TABLE(k7, K7, PMC_CLASS_SOFT, PMC_CLASS_TSC); >>>>> +PMC_MDEP_TABLE(k8, K8, PMC_CLASS_SOFT, PMC_CLASS_TSC); >>>>> +PMC_MDEP_TABLE(p4, P4, PMC_CLASS_SOFT, PMC_CLASS_TSC); >>>>> +PMC_MDEP_TABLE(p5, P5, PMC_CLASS_SOFT, PMC_CLASS_TSC); >>>>> +PMC_MDEP_TABLE(p6, P6, PMC_CLASS_SOFT, PMC_CLASS_TSC); >>>>> +PMC_MDEP_TABLE(xscale, XSCALE, PMC_CLASS_SOFT, PMC_CLASS_XSCALE); >>>>> +PMC_MDEP_TABLE(mips24k, MIPS24K, PMC_CLASS_SOFT, = PMC_CLASS_MIPS24K); >>>>> +PMC_MDEP_TABLE(octeon, OCTEON, PMC_CLASS_SOFT, PMC_CLASS_OCTEON); >>>>> +PMC_MDEP_TABLE(ppc7450, PPC7450, PMC_CLASS_SOFT, = PMC_CLASS_PPC7450); >>>>> +PMC_MDEP_TABLE(generic, SOFT, PMC_CLASS_SOFT); >>>>>=20 >>>>> static const struct pmc_event_descr tsc_event_table[] =3D >>>>> { >>>>> @@ -279,16 +283,24 @@ PMC_CLASS_TABLE_DESC(tsc, TSC, tsc, tsc) >>>>> #if defined(__XSCALE__) >>>>> PMC_CLASS_TABLE_DESC(xscale, XSCALE, xscale, xscale); >>>>> #endif >>>>> - >>>>> #if defined(__mips__) >>>>> PMC_CLASS_TABLE_DESC(mips24k, MIPS24K, mips24k, mips); >>>>> PMC_CLASS_TABLE_DESC(octeon, OCTEON, octeon, mips); >>>>> #endif /* __mips__ */ >>>>> - >>>>> #if defined(__powerpc__) >>>>> PMC_CLASS_TABLE_DESC(ppc7450, PPC7450, ppc7450, ppc7450); >>>>> #endif >>>>>=20 >>>>> +static struct pmc_class_descr soft_class_table_descr =3D >>>>> +{ >>>>> + .pm_evc_name =3D "SOFT-", >>>>> + .pm_evc_name_size =3D sizeof("SOFT-") - 1, >>>>> + .pm_evc_class =3D PMC_CLASS_SOFT, >>>>> + .pm_evc_event_table =3D NULL, >>>>> + .pm_evc_event_table_size =3D 0, >>>>> + .pm_evc_allocate_pmc =3D soft_allocate_pmc >>>>> +}; >>>>> + >>>>> #undef PMC_CLASS_TABLE_DESC >>>>>=20 >>>>> static const struct pmc_class_descr **pmc_class_table; >>>>> @@ -343,9 +355,12 @@ static const char * pmc_state_names[] =3D >>>>> __PMC_STATES() >>>>> }; >>>>>=20 >>>>> -static int pmc_syscall =3D -1; /* filled in by = pmc_init() */ >>>>> - >>>>> -static struct pmc_cpuinfo cpu_info; /* filled in by pmc_init() = */ >>>>> +/* >>>>> + * Filled in by pmc_init(). >>>>> + */ >>>>> +static int pmc_syscall =3D -1; >>>>> +static struct pmc_cpuinfo cpu_info; >>>>> +static struct pmc_op_getdyneventinfo soft_event_info; >>>>>=20 >>>>> /* Event masks for events */ >>>>> struct pmc_masks { >>>>> @@ -2179,6 +2194,25 @@ tsc_allocate_pmc(enum pmc_event pe, char >>>>> } >>>>> #endif >>>>>=20 >>>>> +static struct pmc_event_alias generic_aliases[] =3D { >>>>> + EV_ALIAS("instructions", = "SOFT-CLOCK.HARD"), >>>>> + EV_ALIAS(NULL, NULL) >>>>> +}; >>>>> + >>>>> +static int >>>>> +soft_allocate_pmc(enum pmc_event pe, char *ctrspec, >>>>> + struct pmc_op_pmcallocate *pmc_config) >>>>> +{ >>>>> + (void)ctrspec; >>>>> + (void)pmc_config; >>>>> + >>>>> + if (pe < PMC_EV_SOFT_FIRST || pe > PMC_EV_SOFT_LAST) >>>>> + return (-1); >>>>> + >>>>> + pmc_config->pm_caps |=3D (PMC_CAP_READ | PMC_CAP_WRITE); >>>>> + return (0); >>>>> +} >>>>> + >>>>> #if defined(__XSCALE__) >>>>>=20 >>>>> static struct pmc_event_alias xscale_aliases[] =3D { >>>>> @@ -2663,6 +2697,10 @@ pmc_event_names_of_class(enum pmc_class >>>>> ev =3D ppc7450_event_table; >>>>> count =3D PMC_EVENT_TABLE_SIZE(ppc7450); >>>>> break; >>>>> + case PMC_CLASS_SOFT: >>>>> + ev =3D soft_event_table; >>>>> + count =3D soft_event_info.pm_nevent; >>>>> + break; >>>>> default: >>>>> errno =3D EINVAL; >>>>> return (-1); >>>>> @@ -2676,6 +2714,7 @@ pmc_event_names_of_class(enum pmc_class >>>>>=20 >>>>> for (;count--; ev++, names++) >>>>> *names =3D ev->pm_ev_name; >>>>> + >>>>> return (0); >>>>> } >>>>>=20 >>>>> @@ -2780,11 +2819,34 @@ pmc_init(void) >>>>> pmc_class_table[n] =3D NULL; >>>>>=20 >>>>> /* >>>>> + * Get soft events list. >>>>> + */ >>>>> + soft_event_info.pm_class =3D PMC_CLASS_SOFT; >>>>> + if (PMC_CALL(GETDYNEVENTINFO, &soft_event_info) < 0) >>>>> + return (pmc_syscall =3D -1); >>>>> + >>>>> + /* Map soft events to static list. */ >>>>> + for (n =3D 0; n < soft_event_info.pm_nevent; n++) { >>>>> + soft_event_table[n].pm_ev_name =3D >>>>> + soft_event_info.pm_events[n].pm_ev_name; >>>>> + soft_event_table[n].pm_ev_code =3D >>>>> + soft_event_info.pm_events[n].pm_ev_code; >>>>> + } >>>>> + soft_class_table_descr.pm_evc_event_table_size =3D \ >>>>> + soft_event_info.pm_nevent; >>>>> + soft_class_table_descr.pm_evc_event_table =3D \ >>>>> + soft_event_table; >>>>> + >>>>> + /* >>>>> * Fill in the class table. >>>>> */ >>>>> n =3D 0; >>>>> + >>>>> + /* Fill soft events information. */ >>>>> + pmc_class_table[n++] =3D &soft_class_table_descr; >>>>> #if defined(__amd64__) || defined(__i386__) >>>>> - pmc_class_table[n++] =3D &tsc_class_table_descr; >>>>> + if (cpu_info.pm_cputype !=3D PMC_CPU_GENERIC) >>>>> + pmc_class_table[n++] =3D &tsc_class_table_descr; >>>>>=20 >>>>> /* >>>>> * Check if this CPU has fixed function counters. >>>>> @@ -2867,6 +2929,9 @@ pmc_init(void) >>>>> pmc_class_table[n] =3D &p4_class_table_descr; >>>>> break; >>>>> #endif >>>>> + case PMC_CPU_GENERIC: >>>>> + PMC_MDEP_INIT(generic); >>>>> + break; >>>>> #if defined(__XSCALE__) >>>>> case PMC_CPU_INTEL_XSCALE: >>>>> PMC_MDEP_INIT(xscale); >>>>> @@ -3035,18 +3100,19 @@ _pmc_name_of_event(enum pmc_event pe, en >>>>> evfence =3D xscale_event_table + = PMC_EVENT_TABLE_SIZE(xscale); >>>>> } else if (pe >=3D PMC_EV_MIPS24K_FIRST && pe <=3D = PMC_EV_MIPS24K_LAST) { >>>>> ev =3D mips24k_event_table; >>>>> - evfence =3D mips24k_event_table + = PMC_EVENT_TABLE_SIZE(mips24k >>>>> -); >>>>> + evfence =3D mips24k_event_table + = PMC_EVENT_TABLE_SIZE(mips24k); >>>>> } else if (pe >=3D PMC_EV_OCTEON_FIRST && pe <=3D = PMC_EV_OCTEON_LAST) { >>>>> ev =3D octeon_event_table; >>>>> evfence =3D octeon_event_table + = PMC_EVENT_TABLE_SIZE(octeon); >>>>> } else if (pe >=3D PMC_EV_PPC7450_FIRST && pe <=3D = PMC_EV_PPC7450_LAST) { >>>>> ev =3D ppc7450_event_table; >>>>> - evfence =3D ppc7450_event_table + = PMC_EVENT_TABLE_SIZE(ppc7450 >>>>> -); >>>>> + evfence =3D ppc7450_event_table + = PMC_EVENT_TABLE_SIZE(ppc7450); >>>>> } else if (pe =3D=3D PMC_EV_TSC_TSC) { >>>>> ev =3D tsc_event_table; >>>>> evfence =3D tsc_event_table + = PMC_EVENT_TABLE_SIZE(tsc); >>>>> + } else if (pe >=3D PMC_EV_SOFT_FIRST && pe <=3D = PMC_EV_SOFT_LAST) { >>>>> + ev =3D soft_event_table; >>>>> + evfence =3D soft_event_table + = soft_event_info.pm_nevent; >>>>> } >>>>>=20 >>>>> for (; ev !=3D evfence; ev++) >>>>>=20 >>>>> Modified: head/lib/libpmc/pmc.3 >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/lib/libpmc/pmc.3 Wed Mar 28 20:49:11 2012 = (r233627) >>>>> +++ head/lib/libpmc/pmc.3 Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -223,6 +223,8 @@ and >>>>> CPUs. >>>>> .It Li PMC_CLASS_TSC >>>>> The timestamp counter on i386 and amd64 architecture CPUs. >>>>> +.It Li PMC_CLASS_SOFT >>>>> +Software events. >>>>> .El >>>>> .Ss PMC Capabilities >>>>> Capabilities of performance monitoring hardware are denoted using >>>>> @@ -525,6 +527,7 @@ API is >>>>> .Xr pmc.p4 3 , >>>>> .Xr pmc.p5 3 , >>>>> .Xr pmc.p6 3 , >>>>> +.Xr pmc.soft 3 , >>>>> .Xr pmc.tsc 3 , >>>>> .Xr pmclog 3 , >>>>> .Xr hwpmc 4 , >>>>>=20 >>>>> Modified: head/lib/libpmc/pmc.atom.3 >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/lib/libpmc/pmc.atom.3 Wed Mar 28 20:49:11 2012 = (r233627) >>>>> +++ head/lib/libpmc/pmc.atom.3 Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -1176,6 +1176,7 @@ and the underlying hardware events used >>>>> .Xr pmc.p4 3 , >>>>> .Xr pmc.p5 3 , >>>>> .Xr pmc.p6 3 , >>>>> +.Xr pmc.soft 3 , >>>>> .Xr pmc.tsc 3 , >>>>> .Xr pmc_cpuinfo 3 , >>>>> .Xr pmclog 3 , >>>>>=20 >>>>> Modified: head/lib/libpmc/pmc.core.3 >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/lib/libpmc/pmc.core.3 Wed Mar 28 20:49:11 2012 = (r233627) >>>>> +++ head/lib/libpmc/pmc.core.3 Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -792,6 +792,7 @@ may not count some transitions. >>>>> .Xr pmc.p4 3 , >>>>> .Xr pmc.p5 3 , >>>>> .Xr pmc.p6 3 , >>>>> +.Xr pmc.soft 3 , >>>>> .Xr pmc.tsc 3 , >>>>> .Xr pmclog 3 , >>>>> .Xr hwpmc 4 >>>>>=20 >>>>> Modified: head/lib/libpmc/pmc.core2.3 >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/lib/libpmc/pmc.core2.3 Wed Mar 28 20:49:11 2012 = (r233627) >>>>> +++ head/lib/libpmc/pmc.core2.3 Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -1107,6 +1107,7 @@ and the underlying hardware events used. >>>>> .Xr pmc.p4 3 , >>>>> .Xr pmc.p5 3 , >>>>> .Xr pmc.p6 3 , >>>>> +.Xr pmc.soft 3 , >>>>> .Xr pmc.tsc 3 , >>>>> .Xr pmc_cpuinfo 3 , >>>>> .Xr pmclog 3 , >>>>>=20 >>>>> Modified: head/lib/libpmc/pmc.corei7.3 >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/lib/libpmc/pmc.corei7.3 Wed Mar 28 20:49:11 2012 = (r233627) >>>>> +++ head/lib/libpmc/pmc.corei7.3 Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -1559,6 +1559,7 @@ Counts number of segment register loads. >>>>> .Xr pmc.corei7uc 3 , >>>>> .Xr pmc.westmere 3 , >>>>> .Xr pmc.westmereuc 3 , >>>>> +.Xr pmc.soft 3 , >>>>> .Xr pmc.tsc 3 , >>>>> .Xr pmc_cpuinfo 3 , >>>>> .Xr pmclog 3 , >>>>>=20 >>>>> Modified: head/lib/libpmc/pmc.corei7uc.3 >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/lib/libpmc/pmc.corei7uc.3 Wed Mar 28 20:49:11 2012 = (r233627) >>>>> +++ head/lib/libpmc/pmc.corei7uc.3 Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -863,6 +863,7 @@ refreshed or needs to go into a power do >>>>> .Xr pmc.corei7 3 , >>>>> .Xr pmc.westmere 3 , >>>>> .Xr pmc.westmereuc 3 , >>>>> +.Xr pmc.soft 3 , >>>>> .Xr pmc.tsc 3 , >>>>> .Xr pmc_cpuinfo 3 , >>>>> .Xr pmclog 3 , >>>>>=20 >>>>> Modified: head/lib/libpmc/pmc.iaf.3 >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/lib/libpmc/pmc.iaf.3 Wed Mar 28 20:49:11 2012 = (r233627) >>>>> +++ head/lib/libpmc/pmc.iaf.3 Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -132,6 +132,7 @@ CPU, use the event specifier >>>>> .Xr pmc.p4 3 , >>>>> .Xr pmc.p5 3 , >>>>> .Xr pmc.p6 3 , >>>>> +.Xr pmc.soft 3 , >>>>> .Xr pmc.tsc 3 , >>>>> .Xr pmc_cpuinfo 3 , >>>>> .Xr pmclog 3 , >>>>>=20 >>>>> Modified: head/lib/libpmc/pmc.k7.3 >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/lib/libpmc/pmc.k7.3 Wed Mar 28 20:49:11 2012 = (r233627) >>>>> +++ head/lib/libpmc/pmc.k7.3 Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -249,6 +249,7 @@ and the underlying hardware events used. >>>>> .Xr pmc.p4 3 , >>>>> .Xr pmc.p5 3 , >>>>> .Xr pmc.p6 3 , >>>>> +.Xr pmc.soft 3 , >>>>> .Xr pmc.tsc 3 , >>>>> .Xr pmclog 3 , >>>>> .Xr hwpmc 4 >>>>>=20 >>>>> Modified: head/lib/libpmc/pmc.k8.3 >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/lib/libpmc/pmc.k8.3 Wed Mar 28 20:49:11 2012 = (r233627) >>>>> +++ head/lib/libpmc/pmc.k8.3 Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -783,6 +783,7 @@ and the underlying hardware events used. >>>>> .Xr pmc.p4 3 , >>>>> .Xr pmc.p5 3 , >>>>> .Xr pmc.p6 3 , >>>>> +.Xr pmc.soft 3 , >>>>> .Xr pmc.tsc 3 , >>>>> .Xr pmclog 3 , >>>>> .Xr hwpmc 4 >>>>>=20 >>>>> Modified: head/lib/libpmc/pmc.mips24k.3 >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/lib/libpmc/pmc.mips24k.3 Wed Mar 28 20:49:11 2012 = (r233627) >>>>> +++ head/lib/libpmc/pmc.mips24k.3 Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -392,6 +392,7 @@ and the underlying hardware events used. >>>>> .Xr pmc.p4 3 , >>>>> .Xr pmc.p5 3 , >>>>> .Xr pmc.p6 3 , >>>>> +.Xr pmc.soft 3 , >>>>> .Xr pmc.tsc 3 , >>>>> .Xr pmc_cpuinfo 3 , >>>>> .Xr pmclog 3 , >>>>>=20 >>>>> Modified: head/lib/libpmc/pmc.octeon.3 >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/lib/libpmc/pmc.octeon.3 Wed Mar 28 20:49:11 2012 = (r233627) >>>>> +++ head/lib/libpmc/pmc.octeon.3 Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -232,6 +232,7 @@ and the underlying hardware events used. >>>>> .Xr pmc.p4 3 , >>>>> .Xr pmc.p5 3 , >>>>> .Xr pmc.p6 3 , >>>>> +.Xr pmc.soft 3 , >>>>> .Xr pmc.tsc 3 , >>>>> .Xr pmc_cpuinfo 3 , >>>>> .Xr pmclog 3 , >>>>>=20 >>>>> Modified: head/lib/libpmc/pmc.p4.3 >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/lib/libpmc/pmc.p4.3 Wed Mar 28 20:49:11 2012 = (r233627) >>>>> +++ head/lib/libpmc/pmc.p4.3 Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -1208,6 +1208,7 @@ and the underlying hardware events used. >>>>> .Xr pmc.k8 3 , >>>>> .Xr pmc.p5 3 , >>>>> .Xr pmc.p6 3 , >>>>> +.Xr pmc.soft 3 , >>>>> .Xr pmc.tsc 3 , >>>>> .Xr pmclog 3 , >>>>> .Xr hwpmc 4 >>>>>=20 >>>>> Modified: head/lib/libpmc/pmc.p5.3 >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/lib/libpmc/pmc.p5.3 Wed Mar 28 20:49:11 2012 = (r233627) >>>>> +++ head/lib/libpmc/pmc.p5.3 Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -444,6 +444,7 @@ and the underlying hardware events used. >>>>> .Xr pmc.k8 3 , >>>>> .Xr pmc.p4 3 , >>>>> .Xr pmc.p6 3 , >>>>> +.Xr pmc.soft 3 , >>>>> .Xr pmc.tsc 3 , >>>>> .Xr pmclog 3 , >>>>> .Xr hwpmc 4 >>>>>=20 >>>>> Modified: head/lib/libpmc/pmc.p6.3 >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/lib/libpmc/pmc.p6.3 Wed Mar 28 20:49:11 2012 = (r233627) >>>>> +++ head/lib/libpmc/pmc.p6.3 Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -1010,6 +1010,7 @@ and the underlying hardware events used. >>>>> .Xr pmc.k8 3 , >>>>> .Xr pmc.p4 3 , >>>>> .Xr pmc.p5 3 , >>>>> +.Xr pmc.soft 3 , >>>>> .Xr pmc.tsc 3 , >>>>> .Xr pmclog 3 , >>>>> .Xr hwpmc 4 >>>>>=20 >>>>> Modified: head/lib/libpmc/pmc.sandybridge.3 >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/lib/libpmc/pmc.sandybridge.3 Wed Mar 28 20:49:11 2012 = (r233627) >>>>> +++ head/lib/libpmc/pmc.sandybridge.3 Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -907,6 +907,7 @@ Split locks in SQ. >>>>> .Xr pmc.p5 3 , >>>>> .Xr pmc.p6 3 , >>>>> .Xr pmc.sandybridgeuc 3 , >>>>> +.Xr pmc.soft 3 , >>>>> .Xr pmc.tsc 3 , >>>>> .Xr pmc.ucf 3 , >>>>> .Xr pmc.westmere 3 , >>>>>=20 >>>>> Modified: head/lib/libpmc/pmc.sandybridgeuc.3 >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/lib/libpmc/pmc.sandybridgeuc.3 Wed Mar 28 20:49:11 2012 = (r233627) >>>>> +++ head/lib/libpmc/pmc.sandybridgeuc.3 Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -208,6 +208,7 @@ Counts the number of core-outgoing entri >>>>> .Xr pmc.p5 3 , >>>>> .Xr pmc.p6 3 , >>>>> .Xr pmc.sandybridge 3 , >>>>> +.Xr pmc.soft 3 , >>>>> .Xr pmc.tsc 3 , >>>>> .Xr pmc.ucf 3 , >>>>> .Xr pmc.westmere 3 , >>>>>=20 >>>>> Added: head/lib/libpmc/pmc.soft.3 >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- /dev/null 00:00:00 1970 (empty, because file is newly = added) >>>>> +++ head/lib/libpmc/pmc.soft.3 Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -0,0 +1,104 @@ >>>>> +.\" Copyright (c) 2012 Fabien Thomas. All rights reserved. >>>>> +.\" >>>>> +.\" Redistribution and use in source and binary forms, with or = without >>>>> +.\" modification, are permitted provided that the following = conditions >>>>> +.\" are met: >>>>> +.\" 1. Redistributions of source code must retain the above = copyright >>>>> +.\" notice, this list of conditions and the following = disclaimer. >>>>> +.\" 2. Redistributions in binary form must reproduce the above = copyright >>>>> +.\" notice, this list of conditions and the following = disclaimer in the >>>>> +.\" documentation and/or other materials provided with the = distribution. >>>>> +.\" >>>>> +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS = IS'' AND >>>>> +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED = TO, THE >>>>> +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A = PARTICULAR PURPOSE >>>>> +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS = BE LIABLE >>>>> +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR = CONSEQUENTIAL >>>>> +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF = SUBSTITUTE GOODS >>>>> +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS = INTERRUPTION) >>>>> +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN = CONTRACT, STRICT >>>>> +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) = ARISING IN ANY WAY >>>>> +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE = POSSIBILITY OF >>>>> +.\" SUCH DAMAGE. >>>>> +.\" >>>>> +.\" $FreeBSD$ >>>>> +.\" >>>>> +.Dd March 28, 2012 >>>>> +.Os >>>>> +.Dt PMC.SOFT 3 >>>>> +.Sh NAME >>>>> +.Nm pmc.soft >>>>> +.Nd measurements using software based events >>>>> +.Sh LIBRARY >>>>> +.Lb libpmc >>>>> +.Sh SYNOPSIS >>>>> +.In pmc.h >>>>> +.Sh DESCRIPTION >>>>> +Software events are used to collect various source of software = events. >>>>> +.Ss PMC Features >>>>> +16 sampling counters using software events based on various = sources. >>>>> +These PMCs support the following capabilities: >>>>> +.Bl -column "PMC_CAP_INTERRUPT" "Support" >>>>> +.It Em Capability Ta Em Support >>>>> +.It PMC_CAP_CASCADE Ta \&No >>>>> +.It PMC_CAP_EDGE Ta \&No >>>>> +.It PMC_CAP_INTERRUPT Ta Yes >>>>> +.It PMC_CAP_INVERT Ta \&No >>>>> +.It PMC_CAP_READ Ta Yes >>>>> +.It PMC_CAP_PRECISE Ta \&No >>>>> +.It PMC_CAP_SYSTEM Ta Yes >>>>> +.It PMC_CAP_TAGGING Ta \&No >>>>> +.It PMC_CAP_THRESHOLD Ta \&No >>>>> +.It PMC_CAP_USER Ta Yes >>>>> +.It PMC_CAP_WRITE Ta Yes >>>>> +.El >>>>> +.Ss Event Qualifiers >>>>> +There is no supported event qualifier. >>>>> +.Pp >>>>> +The event specifiers supported by software are: >>>>> +.Bl -tag -width indent >>>>> +.It Li CLOCK.HARD >>>>> +Hard clock ticks. >>>>> +.It Li CLOCK.STAT >>>>> +Stat clock ticks. >>>>> +.It Li LOCK.FAILED >>>>> +Lock acquisition failed. >>>>> +.It Li PAGE_FAULT.ALL >>>>> +All page fault type. >>>>> +.It Li PAGE_FAULT.READ >>>>> +Read page fault. >>>>> +.It Li PAGE_FAULT.WRITE >>>>> +Write page fault. >>>>> +.El >>>>> +.Sh SEE ALSO >>>>> +.Xr pmc 3 , >>>>> +.Xr pmc.atom 3 , >>>>> +.Xr pmc.core 3 , >>>>> +.Xr pmc.iaf 3 , >>>>> +.Xr pmc.ucf 3 , >>>>> +.Xr pmc.k7 3 , >>>>> +.Xr pmc.k8 3 , >>>>> +.Xr pmc.p4 3 , >>>>> +.Xr pmc.p5 3 , >>>>> +.Xr pmc.p6 3 , >>>>> +.Xr pmc.corei7 3 , >>>>> +.Xr pmc.corei7uc 3 , >>>>> +.Xr pmc.westmereuc 3 , >>>>> +.Xr pmc.tsc 3 , >>>>> +.Xr pmc_cpuinfo 3 , >>>>> +.Xr pmclog 3 , >>>>> +.Xr hwpmc 4 >>>>> +.Sh HISTORY >>>>> +The >>>>> +.Nm pmc >>>>> +library first appeared in >>>>> +.Fx 6.0 . >>>>> +.Sh AUTHORS >>>>> +The >>>>> +.Lb libpmc >>>>> +library was written by >>>>> +.An "Joseph Koshy" >>>>> +.Aq jkoshy@FreeBSD.org . >>>>> +Software PMC was written by >>>>> +.An "Fabien Thomas" >>>>> +.Aq fabient@FreeBSD.org . >>>>>=20 >>>>> Modified: head/lib/libpmc/pmc.tsc.3 >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/lib/libpmc/pmc.tsc.3 Wed Mar 28 20:49:11 2012 = (r233627) >>>>> +++ head/lib/libpmc/pmc.tsc.3 Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -68,6 +68,7 @@ maps to the TSC. >>>>> .Xr pmc.p4 3 , >>>>> .Xr pmc.p5 3 , >>>>> .Xr pmc.p6 3 , >>>>> +.Xr pmc.soft 3 , >>>>> .Xr pmclog 3 , >>>>> .Xr hwpmc 4 >>>>> .Sh HISTORY >>>>>=20 >>>>> Modified: head/lib/libpmc/pmc.ucf.3 >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/lib/libpmc/pmc.ucf.3 Wed Mar 28 20:49:11 2012 = (r233627) >>>>> +++ head/lib/libpmc/pmc.ucf.3 Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -96,6 +96,7 @@ offset C0H under device number 0 and Fun >>>>> .Xr pmc.corei7uc 3 , >>>>> .Xr pmc.westmere 3 , >>>>> .Xr pmc.westmereuc 3 , >>>>> +.Xr pmc.soft 3 , >>>>> .Xr pmc.tsc 3 , >>>>> .Xr pmc_cpuinfo 3 , >>>>> .Xr pmclog 3 , >>>>>=20 >>>>> Modified: head/lib/libpmc/pmc.westmere.3 >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/lib/libpmc/pmc.westmere.3 Wed Mar 28 20:49:11 2012 = (r233627) >>>>> +++ head/lib/libpmc/pmc.westmere.3 Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -1381,6 +1381,7 @@ Counts number of SID integer 64 bit shif >>>>> .Xr pmc.corei7 3 , >>>>> .Xr pmc.corei7uc 3 , >>>>> .Xr pmc.westmereuc 3 , >>>>> +.Xr pmc.soft 3 , >>>>> .Xr pmc.tsc 3 , >>>>> .Xr pmc_cpuinfo 3 , >>>>> .Xr pmclog 3 , >>>>>=20 >>>>> Modified: head/lib/libpmc/pmc.westmereuc.3 >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/lib/libpmc/pmc.westmereuc.3 Wed Mar 28 20:49:11 2012 = (r233627) >>>>> +++ head/lib/libpmc/pmc.westmereuc.3 Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -1066,6 +1066,7 @@ disabled. >>>>> .Xr pmc.corei7 3 , >>>>> .Xr pmc.corei7uc 3 , >>>>> .Xr pmc.westmere 3 , >>>>> +.Xr pmc.soft 3 , >>>>> .Xr pmc.tsc 3 , >>>>> .Xr pmc_cpuinfo 3 , >>>>> .Xr pmclog 3 , >>>>>=20 >>>>> Modified: head/lib/libpmc/pmc.xscale.3 >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/lib/libpmc/pmc.xscale.3 Wed Mar 28 20:49:11 2012 = (r233627) >>>>> +++ head/lib/libpmc/pmc.xscale.3 Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -134,6 +134,7 @@ and the underlying hardware events used. >>>>> .Xr pmc 3 , >>>>> .Xr pmc_cpuinfo 3 , >>>>> .Xr pmclog 3 , >>>>> +.Xr pmc.soft 3 , >>>>> .Xr hwpmc 4 >>>>> .Sh HISTORY >>>>> The >>>>>=20 >>>>> Modified: head/lib/libpmc/pmclog.c >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/lib/libpmc/pmclog.c Wed Mar 28 20:49:11 2012 = (r233627) >>>>> +++ head/lib/libpmc/pmclog.c Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -369,6 +369,12 @@ pmclog_get_event(void *cookie, char **da >>>>> =3D=3D NULL) >>>>> goto error; >>>>> break; >>>>> + case PMCLOG_TYPE_PMCALLOCATEDYN: >>>>> + PMCLOG_READ32(le,ev->pl_u.pl_ad.pl_pmcid); >>>>> + PMCLOG_READ32(le,ev->pl_u.pl_ad.pl_event); >>>>> + PMCLOG_READ32(le,ev->pl_u.pl_ad.pl_flags); >>>>> + = PMCLOG_READSTRING(le,ev->pl_u.pl_ad.pl_evname,PMC_NAME_MAX); >>>>> + break; >>>>> case PMCLOG_TYPE_PMCATTACH: >>>>> PMCLOG_GET_PATHLEN(pathlen,evlen,pmclog_pmcattach); >>>>> PMCLOG_READ32(le,ev->pl_u.pl_t.pl_pmcid); >>>>>=20 >>>>> Modified: head/lib/libpmc/pmclog.h >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/lib/libpmc/pmclog.h Wed Mar 28 20:49:11 2012 = (r233627) >>>>> +++ head/lib/libpmc/pmclog.h Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -88,6 +88,13 @@ struct pmclog_ev_pmcallocate { >>>>> pmc_id_t pl_pmcid; >>>>> }; >>>>>=20 >>>>> +struct pmclog_ev_pmcallocatedyn { >>>>> + uint32_t pl_event; >>>>> + char pl_evname[PMC_NAME_MAX]; >>>>> + uint32_t pl_flags; >>>>> + pmc_id_t pl_pmcid; >>>>> +}; >>>>> + >>>>> struct pmclog_ev_pmcattach { >>>>> pmc_id_t pl_pmcid; >>>>> pid_t pl_pid; >>>>> @@ -146,6 +153,7 @@ struct pmclog_ev { >>>>> struct pmclog_ev_map_out pl_mo; >>>>> struct pmclog_ev_pcsample pl_s; >>>>> struct pmclog_ev_pmcallocate pl_a; >>>>> + struct pmclog_ev_pmcallocatedyn pl_ad; >>>>> struct pmclog_ev_pmcattach pl_t; >>>>> struct pmclog_ev_pmcdetach pl_d; >>>>> struct pmclog_ev_proccsw pl_c; >>>>>=20 >>>>> Modified: head/sys/amd64/amd64/trap.c >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/sys/amd64/amd64/trap.c Wed Mar 28 20:49:11 2012 = (r233627) >>>>> +++ head/sys/amd64/amd64/trap.c Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -71,6 +71,9 @@ __FBSDID("$FreeBSD$"); >>>>> #include >>>>> #ifdef HWPMC_HOOKS >>>>> #include >>>>> +PMC_SOFT_DEFINE( , , page_fault, all); >>>>> +PMC_SOFT_DEFINE( , , page_fault, read); >>>>> +PMC_SOFT_DEFINE( , , page_fault, write); >>>>> #endif >>>>>=20 >>>>> #include >>>>> @@ -743,8 +746,20 @@ trap_pfault(frame, usermode) >>>>> */ >>>>> rv =3D vm_fault(map, va, ftype, VM_FAULT_NORMAL); >>>>> } >>>>> - if (rv =3D=3D KERN_SUCCESS) >>>>> + if (rv =3D=3D KERN_SUCCESS) { >>>>> +#ifdef HWPMC_HOOKS >>>>> + if (ftype =3D=3D VM_PROT_READ || ftype =3D=3D = VM_PROT_WRITE) { >>>>> + PMC_SOFT_CALL_TF( , , page_fault, all, = frame); >>>>> + if (ftype =3D=3D VM_PROT_READ) >>>>> + PMC_SOFT_CALL_TF( , , page_fault, = read, >>>>> + frame); >>>>> + else >>>>> + PMC_SOFT_CALL_TF( , , page_fault, = write, >>>>> + frame); >>>>> + } >>>>> +#endif >>>>> return (0); >>>>> + } >>>>> nogo: >>>>> if (!usermode) { >>>>> if (td->td_intr_nesting_level =3D=3D 0 && >>>>>=20 >>>>> Modified: head/sys/amd64/include/pmc_mdep.h >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/sys/amd64/include/pmc_mdep.h Wed Mar 28 20:49:11 2012 = (r233627) >>>>> +++ head/sys/amd64/include/pmc_mdep.h Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -50,13 +50,13 @@ struct pmc_mdep; >>>>> * measurement architecture have PMCs of the following classes: = TSC, >>>>> * IAF, IAP, UCF and UCP. >>>>> */ >>>>> -#define PMC_MDEP_CLASS_INDEX_TSC 0 >>>>> -#define PMC_MDEP_CLASS_INDEX_K8 1 >>>>> -#define PMC_MDEP_CLASS_INDEX_P4 1 >>>>> -#define PMC_MDEP_CLASS_INDEX_IAP 1 >>>>> -#define PMC_MDEP_CLASS_INDEX_IAF 2 >>>>> -#define PMC_MDEP_CLASS_INDEX_UCP 3 >>>>> -#define PMC_MDEP_CLASS_INDEX_UCF 4 >>>>> +#define PMC_MDEP_CLASS_INDEX_TSC 1 >>>>> +#define PMC_MDEP_CLASS_INDEX_K8 2 >>>>> +#define PMC_MDEP_CLASS_INDEX_P4 2 >>>>> +#define PMC_MDEP_CLASS_INDEX_IAP 2 >>>>> +#define PMC_MDEP_CLASS_INDEX_IAF 3 >>>>> +#define PMC_MDEP_CLASS_INDEX_UCP 4 >>>>> +#define PMC_MDEP_CLASS_INDEX_UCF 5 >>>>>=20 >>>>> /* >>>>> * On the amd64 platform we support the following PMCs. >>>>> @@ -119,6 +119,15 @@ union pmc_md_pmc { >>>>>=20 >>>>> #define PMC_IN_USERSPACE(va) ((va) <=3D = VM_MAXUSER_ADDRESS) >>>>>=20 >>>>> +/* Build a fake kernel trapframe from current instruction = pointer. */ >>>>> +#define PMC_FAKE_TRAPFRAME(TF) = \ >>>>> + do { = \ >>>>> + (TF)->tf_cs =3D 0; (TF)->tf_rflags =3D 0; = \ >>>>> + __asm __volatile("movq %%rbp,%0" : "=3Dr" ((TF)->tf_rbp)); = \ >>>>> + __asm __volatile("movq %%rsp,%0" : "=3Dr" ((TF)->tf_rsp)); = \ >>>>> + __asm __volatile("call 1f \n\t1: pop %0" : = "=3Dr"((TF)->tf_rip)); \ >>>>> + } while (0) >>>>> + >>>>> /* >>>>> * Prototypes >>>>> */ >>>>>=20 >>>>> Modified: head/sys/arm/include/pmc_mdep.h >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/sys/arm/include/pmc_mdep.h Wed Mar 28 20:49:11 2012 = (r233627) >>>>> +++ head/sys/arm/include/pmc_mdep.h Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -29,7 +29,7 @@ >>>>> #ifndef _MACHINE_PMC_MDEP_H_ >>>>> #define _MACHINE_PMC_MDEP_H_ >>>>>=20 >>>>> -#define PMC_MDEP_CLASS_INDEX_XSCALE 0 >>>>> +#define PMC_MDEP_CLASS_INDEX_XSCALE 1 >>>>> /* >>>>> * On the ARM platform we support the following PMCs. >>>>> * >>>>>=20 >>>>> Modified: head/sys/conf/files >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/sys/conf/files Wed Mar 28 20:49:11 2012 (r233627) >>>>> +++ head/sys/conf/files Wed Mar 28 20:58:30 2012 (r233628) >>>>> @@ -1260,6 +1260,7 @@ dev/hme/if_hme_sbus.c optional = hme sbus >>>>> dev/hptiop/hptiop.c optional hptiop scbus >>>>> dev/hwpmc/hwpmc_logging.c optional hwpmc >>>>> dev/hwpmc/hwpmc_mod.c optional hwpmc >>>>> +dev/hwpmc/hwpmc_soft.c optional hwpmc >>>>> dev/ichsmb/ichsmb.c optional ichsmb >>>>> dev/ichsmb/ichsmb_pci.c optional ichsmb pci >>>>> dev/ida/ida.c optional ida >>>>>=20 >>>>> Modified: head/sys/dev/hwpmc/hwpmc_amd.c >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/sys/dev/hwpmc/hwpmc_amd.c Wed Mar 28 20:49:11 2012 = (r233627) >>>>> +++ head/sys/dev/hwpmc/hwpmc_amd.c Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -687,7 +687,8 @@ amd_intr(int cpu, struct trapframe *tf) >>>>> wrmsr(perfctr, = AMD_RELOAD_COUNT_TO_PERFCTR_VALUE(v)); >>>>>=20 >>>>> /* Restart the counter if logging succeeded. */ >>>>> - error =3D pmc_process_interrupt(cpu, pm, tf, = TRAPF_USERMODE(tf)); >>>>> + error =3D pmc_process_interrupt(cpu, PMC_HR, pm, = tf, >>>>> + TRAPF_USERMODE(tf)); >>>>> if (error =3D=3D 0) >>>>> wrmsr(evsel, config | AMD_PMC_ENABLE); >>>>> } >>>>> @@ -874,7 +875,7 @@ amd_pcpu_fini(struct pmc_mdep *md, int c >>>>> struct pmc_mdep * >>>>> pmc_amd_initialize(void) >>>>> { >>>>> - int classindex, error, i, nclasses, ncpus; >>>>> + int classindex, error, i, ncpus; >>>>> struct pmc_classdep *pcd; >>>>> enum pmc_cputype cputype; >>>>> struct pmc_mdep *pmc_mdep; >>>>> @@ -926,12 +927,9 @@ pmc_amd_initialize(void) >>>>> * These processors have two classes of PMCs: the TSC and >>>>> * programmable PMCs. >>>>> */ >>>>> - nclasses =3D 2; >>>>> - pmc_mdep =3D malloc(sizeof(struct pmc_mdep) + nclasses * = sizeof (struct pmc_classdep), >>>>> - M_PMC, M_WAITOK|M_ZERO); >>>>> + pmc_mdep =3D pmc_mdep_alloc(2); >>>>>=20 >>>>> pmc_mdep->pmd_cputype =3D cputype; >>>>> - pmc_mdep->pmd_nclass =3D nclasses; >>>>>=20 >>>>> ncpus =3D pmc_cpu_max(); >>>>>=20 >>>>>=20 >>>>> Modified: head/sys/dev/hwpmc/hwpmc_core.c >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/sys/dev/hwpmc/hwpmc_core.c Wed Mar 28 20:49:11 2012 = (r233627) >>>>> +++ head/sys/dev/hwpmc/hwpmc_core.c Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -2239,7 +2239,7 @@ core_intr(int cpu, struct trapframe *tf) >>>>> if (pm->pm_state !=3D PMC_STATE_RUNNING) >>>>> continue; >>>>>=20 >>>>> - error =3D pmc_process_interrupt(cpu, pm, tf, >>>>> + error =3D pmc_process_interrupt(cpu, PMC_HR, pm, = tf, >>>>> TRAPF_USERMODE(tf)); >>>>>=20 >>>>> v =3D pm->pm_sc.pm_reloadcount; >>>>> @@ -2326,7 +2326,7 @@ core2_intr(int cpu, struct trapframe *tf >>>>> !PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) >>>>> continue; >>>>>=20 >>>>> - error =3D pmc_process_interrupt(cpu, pm, tf, >>>>> + error =3D pmc_process_interrupt(cpu, PMC_HR, pm, = tf, >>>>> TRAPF_USERMODE(tf)); >>>>> if (error) >>>>> intrenable &=3D ~flag; >>>>> @@ -2354,7 +2354,7 @@ core2_intr(int cpu, struct trapframe *tf >>>>> !PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) >>>>> continue; >>>>>=20 >>>>> - error =3D pmc_process_interrupt(cpu, pm, tf, >>>>> + error =3D pmc_process_interrupt(cpu, PMC_HR, pm, = tf, >>>>> TRAPF_USERMODE(tf)); >>>>> if (error) >>>>> intrenable &=3D ~flag; >>>>>=20 >>>>> Modified: head/sys/dev/hwpmc/hwpmc_intel.c >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/sys/dev/hwpmc/hwpmc_intel.c Wed Mar 28 20:49:11 2012 = (r233627) >>>>> +++ head/sys/dev/hwpmc/hwpmc_intel.c Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -162,12 +162,10 @@ pmc_intel_initialize(void) >>>>> return (NULL); >>>>> } >>>>>=20 >>>>> - pmc_mdep =3D malloc(sizeof(struct pmc_mdep) + nclasses * >>>>> - sizeof(struct pmc_classdep), M_PMC, M_WAITOK|M_ZERO); >>>>> + /* Allocate base class and initialize machine dependent = struct */ >>>>> + pmc_mdep =3D pmc_mdep_alloc(nclasses); >>>>>=20 >>>>> pmc_mdep->pmd_cputype =3D cputype; >>>>> - pmc_mdep->pmd_nclass =3D nclasses; >>>>> - >>>>> pmc_mdep->pmd_switch_in =3D intel_switch_in; >>>>> pmc_mdep->pmd_switch_out =3D intel_switch_out; >>>>>=20 >>>>>=20 >>>>> Modified: head/sys/dev/hwpmc/hwpmc_logging.c >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/sys/dev/hwpmc/hwpmc_logging.c Wed Mar 28 20:49:11 2012 = (r233627) >>>>> +++ head/sys/dev/hwpmc/hwpmc_logging.c Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -129,6 +129,7 @@ static struct mtx pmc_kthread_mtx; /* sl >>>>>=20 >>>>> /* Emit a string. Caution: does NOT update _le, so needs to be = last */ >>>>> #define PMCLOG_EMITSTRING(S,L) do { bcopy((S), _le, (L)); = } while (0) >>>>> +#define PMCLOG_EMITNULLSTRING(L) do { bzero(_le, (L)); } = while (0) >>>>>=20 >>>>> #define PMCLOG_DESPATCH(PO) = \ >>>>> pmclog_release((PO)); = \ >>>>> @@ -835,16 +836,33 @@ void >>>>> pmclog_process_pmcallocate(struct pmc *pm) >>>>> { >>>>> struct pmc_owner *po; >>>>> + struct pmc_soft *ps; >>>>>=20 >>>>> po =3D pm->pm_owner; >>>>>=20 >>>>> PMCDBG(LOG,ALL,1, "pm=3D%p", pm); >>>>>=20 >>>>> - PMCLOG_RESERVE(po, PMCALLOCATE, sizeof(struct = pmclog_pmcallocate)); >>>>> - PMCLOG_EMIT32(pm->pm_id); >>>>> - PMCLOG_EMIT32(pm->pm_event); >>>>> - PMCLOG_EMIT32(pm->pm_flags); >>>>> - PMCLOG_DESPATCH(po); >>>>> + if (PMC_TO_CLASS(pm) =3D=3D PMC_CLASS_SOFT) { >>>>> + PMCLOG_RESERVE(po, PMCALLOCATEDYN, >>>>> + sizeof(struct pmclog_pmcallocatedyn)); >>>>> + PMCLOG_EMIT32(pm->pm_id); >>>>> + PMCLOG_EMIT32(pm->pm_event); >>>>> + PMCLOG_EMIT32(pm->pm_flags); >>>>> + ps =3D pmc_soft_ev_acquire(pm->pm_event); >>>>> + if (ps !=3D NULL) >>>>> + = PMCLOG_EMITSTRING(ps->ps_ev.pm_ev_name,PMC_NAME_MAX); >>>>> + else >>>>> + PMCLOG_EMITNULLSTRING(PMC_NAME_MAX); >>>>> + pmc_soft_ev_release(ps); >>>>> + PMCLOG_DESPATCH(po); >>>>> + } else { >>>>> + PMCLOG_RESERVE(po, PMCALLOCATE, >>>>> + sizeof(struct pmclog_pmcallocate)); >>>>> + PMCLOG_EMIT32(pm->pm_id); >>>>> + PMCLOG_EMIT32(pm->pm_event); >>>>> + PMCLOG_EMIT32(pm->pm_flags); >>>>> + PMCLOG_DESPATCH(po); >>>>> + } >>>>> } >>>>>=20 >>>>> void >>>>>=20 >>>>> Modified: head/sys/dev/hwpmc/hwpmc_mips.c >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/sys/dev/hwpmc/hwpmc_mips.c Wed Mar 28 20:49:11 2012 = (r233627) >>>>> +++ head/sys/dev/hwpmc/hwpmc_mips.c Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -287,7 +287,7 @@ mips_pmc_intr(int cpu, struct trapframe >>>>> retval =3D 1; >>>>> if (pm->pm_state !=3D PMC_STATE_RUNNING) >>>>> continue; >>>>> - error =3D pmc_process_interrupt(cpu, pm, tf, >>>>> + error =3D pmc_process_interrupt(cpu, PMC_HR, pm, = tf, >>>>> TRAPF_USERMODE(tf)); >>>>> if (error) { >>>>> /* Clear/disable the relevant counter */ >>>>>=20 >>>>> Modified: head/sys/dev/hwpmc/hwpmc_mod.c >>>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>>> --- head/sys/dev/hwpmc/hwpmc_mod.c Wed Mar 28 20:49:11 2012 = (r233627) >>>>> +++ head/sys/dev/hwpmc/hwpmc_mod.c Wed Mar 28 20:58:30 2012 = (r233628) >>>>> @@ -70,6 +70,8 @@ __FBSDID("$FreeBSD$"); >>>>> #include >>>>> #include >>>>>=20 >>>>> +#include "hwpmc_soft.h" >>>>> + >>>>> /* >>>>> * Types >>>>> */ >>>>> @@ -182,7 +184,7 @@ static int pmc_attach_one_process(struct >>>>> static int pmc_can_allocate_rowindex(struct proc *p, unsigned = int ri, >>>>> int cpu); >>>>> static int pmc_can_attach(struct pmc *pm, struct proc *p); >>>>> -static void pmc_capture_user_callchain(int cpu, struct = trapframe *tf); >>>>> +static void pmc_capture_user_callchain(int cpu, int soft, = struct trapframe *tf); >>>>> static void pmc_cleanup(void); >>>>> static int pmc_detach_process(struct proc *p, struct pmc = *pm); >>>>> static int pmc_detach_one_process(struct proc *p, struct pmc = *pm, >>>>> @@ -206,7 +208,7 @@ static void pmc_process_csw_out(struct t >>>>> static void pmc_process_exit(void *arg, struct proc *p); >>>>> static void pmc_process_fork(void *arg, struct proc *p1, >>>>> struct proc *p2, int n); >>>>> -static void pmc_process_samples(int cpu); >>>>> +static void pmc_process_samples(int cpu, int soft); >>>>> static void pmc_release_pmc_descriptor(struct pmc *pmc); >>>>> static void pmc_remove_owner(struct pmc_owner *po); >>>>> static void pmc_remove_process_descriptor(struct pmc_process = *pp); >>>>> @@ -218,12 +220,16 @@ static int pmc_stop(struct pmc *pm); >>>>> static int pmc_syscall_handler(struct thread *td, void = *syscall_args); >>>>> static void pmc_unlink_target_process(struct pmc *pmc, >>>>> struct pmc_process *pp); >>>>> +static int generic_switch_in(struct pmc_cpu *pc, struct = pmc_process *pp); >>>>> +static int generic_switch_out(struct pmc_cpu *pc, struct = pmc_process *pp); >>>>> +static struct pmc_mdep *pmc_generic_cpu_initialize(void); >>>>> +static void pmc_generic_cpu_finalize(struct pmc_mdep *md); >>>>>=20 >>>>> /* >>>>> * Kernel tunables and sysctl(8) interface. >>>>> */ >>>>>=20 >>>>> -SYSCTL_NODE(_kern, OID_AUTO, hwpmc, CTLFLAG_RW, 0, "HWPMC = parameters"); >>>>> +SYSCTL_DECL(_kern_hwpmc); >>>>>=20 >>>>> static int pmc_callchaindepth =3D PMC_CALLCHAIN_DEPTH; >>>>> TUNABLE_INT(PMC_SYSCTL_NAME_PREFIX "callchaindepth", = &pmc_callchaindepth); >>>>> @@ -1833,7 +1839,9 @@ const char *pmc_hooknames[] =3D { >>>>> "KLDUNLOAD", >>>>> "MMAP", >>>>> "MUNMAP", >>>>> - "CALLCHAIN" >>>>> + "CALLCHAIN-NMI", >>>>> + "CALLCHAIN-SOFT", >>>>> + "SOFTSAMPLING" >>>>> }; >>>>> #endif >>>>>=20 >>>>> @@ -1992,7 +2000,8 @@ pmc_hook_handler(struct thread *td, int >>>>> * lose the interrupt sample. >>>>> */ >>>>> CPU_CLR_ATOMIC(PCPU_GET(cpuid), &pmc_cpumask); >>>>> - pmc_process_samples(PCPU_GET(cpuid)); >>>>> + pmc_process_samples(PCPU_GET(cpuid), PMC_HR); >>>>> + pmc_process_samples(PCPU_GET(cpuid), PMC_SR); >>>>> break; >>>>>=20 >>>>>=20 >>>>> @@ -2022,11 +2031,30 @@ pmc_hook_handler(struct thread *td, int >>>>> */ >>>>> KASSERT(td =3D=3D curthread, ("[pmc,%d] td !=3D = curthread", >>>>> __LINE__)); >>>>> - pmc_capture_user_callchain(PCPU_GET(cpuid), >>>>> + >>>>> + pmc_capture_user_callchain(PCPU_GET(cpuid), = PMC_HR, >>>>> (struct trapframe *) arg); >>>>> td->td_pflags &=3D ~TDP_CALLCHAIN; >>>>> break; >>>>>=20 >>>>> + case PMC_FN_USER_CALLCHAIN_SOFT: >>>>> + /* >>>>> + * Record a call chain. >>>>> + */ >>>>> + KASSERT(td =3D=3D curthread, ("[pmc,%d] td !=3D = curthread", >>>>> + __LINE__)); >>>>> + pmc_capture_user_callchain(PCPU_GET(cpuid), = PMC_SR, >>>>> + (struct trapframe *) arg); >>>>> + td->td_pflags &=3D ~TDP_CALLCHAIN; >>>>> + break; >>>>> + >>>>> + case PMC_FN_SOFT_SAMPLING: >>>>> + /* >>>>> + * Call soft PMC sampling intr. >>>>> + */ >>>>> + pmc_soft_intr((struct pmckern_soft *) arg); >>>>> + break; >>>>> + >>>>> default: >>>>> #ifdef DEBUG >>>>> KASSERT(0, ("[pmc,%d] unknown hook %d\n", __LINE__, = function)); >>>>> @@ -2221,18 +2249,17 @@ pmc_destroy_pmc_descriptor(struct pmc *p >>>>> static void >>>>> pmc_wait_for_pmc_idle(struct pmc *pm) >>>>> { >>>>> -#ifdef DEBUG >>>>> +#ifdef DEBUG >>>>> volatile int maxloop; >>>>>=20 >>>>> maxloop =3D 100 * pmc_cpu_max(); >>>>> #endif >>>>> - >>>>> /* >>>>> * Loop (with a forced context switch) till the PMC's = runcount >>>>> * comes down to zero. >>>>> */ >>>>> while (atomic_load_acq_32(&pm->pm_runcount) > 0) { >>>>> -#ifdef DEBUG >>>>> +#ifdef DEBUG >>>>> maxloop--; >>>>> KASSERT(maxloop > 0, >>>>> ("[pmc,%d] (ri%d, rc%d) waiting too long for " >>>>> @@ -2972,6 +2999,53 @@ pmc_syscall_handler(struct thread *td, v >>>>> } >>>>> break; >>>>>=20 >>>>> + /* >>>>> + * Retrieve soft events list. >>>>> + */ >>>>> + case PMC_OP_GETDYNEVENTINFO: >>>>> + { >>>>> + enum pmc_class cl; >>>>> + enum pmc_event ev; >>>>> + struct pmc_op_getdyneventinfo *gei; >>>>> + struct pmc_dyn_event_descr dev; >>>>> + struct pmc_soft *ps; >>>>> + uint32_t nevent; >>>>> + >>>>> + sx_assert(&pmc_sx, SX_LOCKED); >>>>> + >>>>> + gei =3D (struct pmc_op_getdyneventinfo *) arg; >>>>> + >>>>> + if ((error =3D copyin(&gei->pm_class, &cl, = sizeof(cl))) !=3D 0) >>>>> + break; >>>>> + >>>>> + /* Only SOFT class is dynamic. */ >>>>> + if (cl !=3D PMC_CLASS_SOFT) { >>>>> + error =3D EINVAL; >>>>> + break; >>>>> + } >>>>> + >>>>> + nevent =3D 0; >>>>> + for (ev =3D PMC_EV_SOFT_FIRST; ev <=3D = PMC_EV_SOFT_LAST; ev++) { >>>>> + ps =3D pmc_soft_ev_acquire(ev); >>>>> + if (ps =3D=3D NULL) >>>>> + continue; >>>>> + bcopy(&ps->ps_ev, &dev, sizeof(dev)); >>>>> + pmc_soft_ev_release(ps); >>>>> + >>>>> + error =3D copyout(&dev, >>>>> + &gei->pm_events[nevent], >>>>> + sizeof(struct pmc_dyn_event_descr)); >>>>> + if (error !=3D 0) >>>>> + break; >>>>> + nevent++; >>>>> + } >>>>> + if (error !=3D 0) >>>>> + break; >>>>> + >>>>> + error =3D copyout(&nevent, &gei->pm_nevent, >>>>>=20 >>>>> *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** >>>=20 >>>=20 >>>=20 >>> -- >>> Monthadar Al Jaberi >>> >>=20 >>=20 >=20 >=20 >=20 > --=20 > Monthadar Al Jaberi --Apple-Mail=_AA16D944-B364-4C83-BE40-AEE3A01B5AB1-- From owner-freebsd-mips@FreeBSD.ORG Mon Apr 23 11:07:20 2012 Return-Path: Delivered-To: freebsd-mips@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7D31E106566B for ; Mon, 23 Apr 2012 11:07:20 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 4DF458FC0A for ; Mon, 23 Apr 2012 11:07:20 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q3NB7KHu047636 for ; Mon, 23 Apr 2012 11:07:20 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q3NB7J5x047634 for freebsd-mips@FreeBSD.org; Mon, 23 Apr 2012 11:07:19 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 23 Apr 2012 11:07:19 GMT Message-Id: <201204231107.q3NB7J5x047634@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: gnats set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: freebsd-mips@FreeBSD.org Cc: Subject: Current problem reports assigned to freebsd-mips@FreeBSD.org X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Apr 2012 11:07:20 -0000 Note: to view an individual PR, use: http://www.freebsd.org/cgi/query-pr.cgi?pr=(number). The following is a listing of current problems submitted by FreeBSD users. These represent problem reports covering all versions including experimental development code and obsolete releases. S Tracker Resp. Description -------------------------------------------------------------------------------- o kern/165951 mips [ar913x] [ath] DDR flush isn't being done for the WMAC p kern/163670 mips [mips][arge] arge can't allocate ring buffer on multip 2 problems total. From owner-freebsd-mips@FreeBSD.ORG Tue Apr 24 06:35:43 2012 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13271106564A; Tue, 24 Apr 2012 06:35:43 +0000 (UTC) (envelope-from c.jayachandran@gmail.com) Received: from mail-wg0-f50.google.com (mail-wg0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 46D428FC0C; Tue, 24 Apr 2012 06:35:42 +0000 (UTC) Received: by wgbds12 with SMTP id ds12so276236wgb.31 for ; Mon, 23 Apr 2012 23:35:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=3WxFbshD+8rnPM6LkI+nTR0we9toe03+AGfmaP+EVSA=; b=KydIpHJOvylbKNw8AU6YyKR/28JsP6++owbBH7D3VeZ4V8J66L9Kxii1Jks/vgVl1j SghZUF/wD/CkeltrvgN5wcBj1uaWPJMElkyZPb8LsXjn6jSOkHD8xx39UvPRwYIiuIUY YHVYHY6d6hDZyQzySsJDqXX7r/5mdUgLsVpNjNslgskDFXFeW3p95TULhP9ynSeO14Yc 5ZQgHDWJz3t6d91VidYqbRgVBafmb9lCvTs8YRBHH0Ofqygsb4+Y7Z7fF14cU9S9ts0Z 0qmU2lMaOLSkMkkcTZw1fqriTGtnp/DDBZM8f0+CijlVje3YUT8jX83Mp+qV4NGnLfQO 8TJA== MIME-Version: 1.0 Received: by 10.180.102.129 with SMTP id fo1mr19896276wib.6.1335249340605; Mon, 23 Apr 2012 23:35:40 -0700 (PDT) Sender: c.jayachandran@gmail.com Received: by 10.216.60.71 with HTTP; Mon, 23 Apr 2012 23:35:40 -0700 (PDT) In-Reply-To: <201204170722.q3H7ME6A070934@svn.freebsd.org> References: <201204170722.q3H7ME6A070934@svn.freebsd.org> Date: Tue, 24 Apr 2012 12:05:40 +0530 X-Google-Sender-Auth: 8-7zcALqxC0FQin-Mef0oxQgcak Message-ID: From: "Jayachandran C." To: Jason Evans Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-mips@freebsd.org Subject: Re: svn commit: r234370 - in head: contrib/jemalloc contrib/jemalloc/doc contrib/jemalloc/include contrib/jemalloc/include/jemalloc contrib/jemalloc/include/jemalloc/internal contrib/jemalloc/src inclu... X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Apr 2012 06:35:43 -0000 On Tue, Apr 17, 2012 at 12:52 PM, Jason Evans wrote: > Author: jasone > Date: Tue Apr 17 07:22:14 2012 > New Revision: 234370 > URL: http://svn.freebsd.org/changeset/base/234370 [....] > +diff --git a/include/jemalloc/jemalloc_FreeBSD.h b/include/jemalloc/jema= lloc_FreeBSD.h > +new file mode 100644 > +index 0000000..2c5797f > +--- /dev/null > ++++ b/include/jemalloc/jemalloc_FreeBSD.h > +@@ -0,0 +1,76 @@ [....] > ++#ifdef __mips__ > ++# =A0define LG_SIZEOF_PTR =A0 =A0 =A0 =A0 =A0 =A0 =A0 2 > ++#endif This breaks 64-bit mips platforms. I have a simple patch that fixes this at http://people.freebsd.org/~jchandra/jemalloc.patch Another possible fix suggested by Juli is to do #define LG_SIZEOF_PTR _MIPS_SZPTR Can you please check-in one of these? If you are busy, I can do the check-in if you approve the changes. Thanks, JC. From owner-freebsd-mips@FreeBSD.ORG Tue Apr 24 06:45:12 2012 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 84A891065672; Tue, 24 Apr 2012 06:45:12 +0000 (UTC) (envelope-from jasone@freebsd.org) Received: from canonware.com (10140.x.rootbsd.net [204.109.63.53]) by mx1.freebsd.org (Postfix) with ESMTP id 5C3618FC0A; Tue, 24 Apr 2012 06:45:12 +0000 (UTC) Received: from [172.25.16.174] (unknown [173.252.71.3]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by canonware.com (Postfix) with ESMTPSA id A8E1128419; Mon, 23 Apr 2012 23:45:06 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v1257) Content-Type: text/plain; charset=iso-8859-1 From: Jason Evans In-Reply-To: Date: Mon, 23 Apr 2012 23:45:05 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201204170722.q3H7ME6A070934@svn.freebsd.org> To: "Jayachandran C." X-Mailer: Apple Mail (2.1257) Cc: freebsd-mips@freebsd.org Subject: Re: svn commit: r234370 - in head: contrib/jemalloc contrib/jemalloc/doc contrib/jemalloc/include contrib/jemalloc/include/jemalloc contrib/jemalloc/include/jemalloc/internal contrib/jemalloc/src inclu... X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Apr 2012 06:45:12 -0000 On Apr 23, 2012, at 11:35 PM, Jayachandran C. wrote: > On Tue, Apr 17, 2012 at 12:52 PM, Jason Evans = wrote: >> Author: jasone >> Date: Tue Apr 17 07:22:14 2012 >> New Revision: 234370 >> URL: http://svn.freebsd.org/changeset/base/234370 >=20 > [....] >> +diff --git a/include/jemalloc/jemalloc_FreeBSD.h = b/include/jemalloc/jemalloc_FreeBSD.h >> +new file mode 100644 >> +index 0000000..2c5797f >> +--- /dev/null >> ++++ b/include/jemalloc/jemalloc_FreeBSD.h >> +@@ -0,0 +1,76 @@ > [....] >> ++#ifdef __mips__ >> ++# define LG_SIZEOF_PTR 2 >> ++#endif >=20 > This breaks 64-bit mips platforms. I have a simple patch that fixes > this at http://people.freebsd.org/~jchandra/jemalloc.patch >=20 > Another possible fix suggested by Juli is to do > #define LG_SIZEOF_PTR _MIPS_SZPTR >=20 > Can you please check-in one of these? If you are busy, I can do the > check-in if you approve the changes. I had planned to do this, based on Juli's suggestion: > #ifdef __mips__ > # if (_MIPS_SZPTR =3D=3D 64) > # define LG_SIZEOF_PTR 3 > # else > # define LG_SIZEOF_PTR 2 > # endif > #endif Feel free to check in whichever approach you feel is cleaner. I can't = test it, so you might as well do the honors. =3D) Thanks, Jason= From owner-freebsd-mips@FreeBSD.ORG Tue Apr 24 06:59:41 2012 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DA99F106564A; Tue, 24 Apr 2012 06:59:41 +0000 (UTC) (envelope-from c.jayachandran@gmail.com) Received: from mail-wg0-f50.google.com (mail-wg0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 19AB98FC17; Tue, 24 Apr 2012 06:59:40 +0000 (UTC) Received: by wgbds12 with SMTP id ds12so293107wgb.31 for ; Mon, 23 Apr 2012 23:59:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=g3qIPRzX7WBHIRdLxHKkOBSjNwPlvZFVF0Ak7is81o8=; b=bvYcq5+9BAVSKmEp8vsgph5Wj5wjyvXaOftZ1i0bv1SIJ8rWE/Bz8DgzKiTUnYxy9C T1EJ4nFpmQD3VaVvq6zDA8uLv3yXpD9xjojT4/KVcf0qXEyMgKOtchxKSchgmDoe+UKO bz/ztsweuW+4cYVrjI8w90axshFEFgQXSPi34GQ4SkkeaMu5DmQF0/AzbuvbsqKPuHDP EHLDx/WUchV2lrQS4Ozw1Q0LG3YxuyWVglt1ltFacjHC4R89QMub6bnVFajN0h8AHMcA 26xJMsf2tCkE/qmvYUpYRSvt6bzcxw4AFWnhr/ScWHe57sO0xO+hKFQPeMgoyF2KN3rZ t2Bg== MIME-Version: 1.0 Received: by 10.180.102.101 with SMTP id fn5mr28293867wib.6.1335250780299; Mon, 23 Apr 2012 23:59:40 -0700 (PDT) Sender: c.jayachandran@gmail.com Received: by 10.216.60.71 with HTTP; Mon, 23 Apr 2012 23:59:40 -0700 (PDT) In-Reply-To: References: <201204170722.q3H7ME6A070934@svn.freebsd.org> Date: Tue, 24 Apr 2012 12:29:40 +0530 X-Google-Sender-Auth: ytBxKP3zoGfSBa9rLenakjNMJc4 Message-ID: From: "Jayachandran C." To: Jason Evans Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-mips@freebsd.org Subject: Re: svn commit: r234370 - in head: contrib/jemalloc contrib/jemalloc/doc contrib/jemalloc/include contrib/jemalloc/include/jemalloc contrib/jemalloc/include/jemalloc/internal contrib/jemalloc/src inclu... X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Apr 2012 06:59:41 -0000 On Tue, Apr 24, 2012 at 12:15 PM, Jason Evans wrote: > On Apr 23, 2012, at 11:35 PM, Jayachandran C. wrote: >> On Tue, Apr 17, 2012 at 12:52 PM, Jason Evans wrote= : >>> Author: jasone >>> Date: Tue Apr 17 07:22:14 2012 >>> New Revision: 234370 >>> URL: http://svn.freebsd.org/changeset/base/234370 >> >> [....] >>> +diff --git a/include/jemalloc/jemalloc_FreeBSD.h b/include/jemalloc/je= malloc_FreeBSD.h >>> +new file mode 100644 >>> +index 0000000..2c5797f >>> +--- /dev/null >>> ++++ b/include/jemalloc/jemalloc_FreeBSD.h >>> +@@ -0,0 +1,76 @@ >> [....] >>> ++#ifdef __mips__ >>> ++# =A0define LG_SIZEOF_PTR =A0 =A0 =A0 =A0 =A0 =A0 =A0 2 >>> ++#endif >> >> This breaks 64-bit mips platforms. I have a simple patch that fixes >> this at http://people.freebsd.org/~jchandra/jemalloc.patch >> >> Another possible fix suggested by Juli is to do >> #define =A0LG_SIZEOF_PTR _MIPS_SZPTR >> >> Can you please check-in one of these? =A0If you are busy, I can do the >> check-in if you approve the changes. > > I had planned to do this, based on Juli's suggestion: > >> #ifdef __mips__ >> # =A0if (_MIPS_SZPTR =3D=3D 64) >> # =A0 =A0define LG_SIZEOF_PTR 3 >> # =A0else >> # =A0 =A0define LG_SIZEOF_PTR 2 >> # =A0endif >> #endif > > Feel free to check in whichever approach you feel is cleaner. =A0I can't = test it, so you might as well do the honors. =3D) I seems to have mis-understood Juli's suggestion (sorry). Do I need to update the FREEBSD-diffs file as well? Thanks, JC. From owner-freebsd-mips@FreeBSD.ORG Tue Apr 24 07:02:43 2012 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2E2AA106566B; Tue, 24 Apr 2012 07:02:43 +0000 (UTC) (envelope-from jasone@freebsd.org) Received: from canonware.com (10140.x.rootbsd.net [204.109.63.53]) by mx1.freebsd.org (Postfix) with ESMTP id 077408FC15; Tue, 24 Apr 2012 07:02:43 +0000 (UTC) Received: from [172.25.16.174] (unknown [173.252.71.3]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by canonware.com (Postfix) with ESMTPSA id A1EA02841A; Tue, 24 Apr 2012 00:02:42 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v1257) Content-Type: text/plain; charset=iso-8859-1 From: Jason Evans In-Reply-To: Date: Tue, 24 Apr 2012 00:02:41 -0700 Content-Transfer-Encoding: 7bit Message-Id: References: <201204170722.q3H7ME6A070934@svn.freebsd.org> To: "Jayachandran C." X-Mailer: Apple Mail (2.1257) Cc: freebsd-mips@freebsd.org Subject: Re: svn commit: r234370 - in head: contrib/jemalloc contrib/jemalloc/doc contrib/jemalloc/include contrib/jemalloc/include/jemalloc contrib/jemalloc/include/jemalloc/internal contrib/jemalloc/src inclu... X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Apr 2012 07:02:43 -0000 On Apr 23, 2012, at 11:59 PM, Jayachandran C. wrote: > Do I need > to update the FREEBSD-diffs file as well? Don't worry about FREEBSD-diffs; I'll regenerate it the next time I import. Thanks, Jason From owner-freebsd-mips@FreeBSD.ORG Sat Apr 28 13:12:28 2012 Return-Path: Delivered-To: mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4976B106566C; Sat, 28 Apr 2012 13:12:28 +0000 (UTC) (envelope-from tinderbox@freebsd.org) Received: from freebsd-current.sentex.ca (freebsd-current.sentex.ca [64.7.128.98]) by mx1.freebsd.org (Postfix) with ESMTP id 083A78FC0A; Sat, 28 Apr 2012 13:12:27 +0000 (UTC) Received: from freebsd-current.sentex.ca (localhost [127.0.0.1]) by freebsd-current.sentex.ca (8.14.5/8.14.5) with ESMTP id q3SDCQJw059222; Sat, 28 Apr 2012 09:12:26 -0400 (EDT) (envelope-from tinderbox@freebsd.org) Received: (from tinderbox@localhost) by freebsd-current.sentex.ca (8.14.5/8.14.5/Submit) id q3SDCQca059217; Sat, 28 Apr 2012 13:12:26 GMT (envelope-from tinderbox@freebsd.org) Date: Sat, 28 Apr 2012 13:12:26 GMT Message-Id: <201204281312.q3SDCQca059217@freebsd-current.sentex.ca> X-Authentication-Warning: freebsd-current.sentex.ca: tinderbox set sender to FreeBSD Tinderbox using -f Sender: FreeBSD Tinderbox From: FreeBSD Tinderbox To: FreeBSD Tinderbox , , Precedence: bulk Cc: Subject: [head tinderbox] failure on mips/mips X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Apr 2012 13:12:28 -0000 TB --- 2012-04-28 12:07:32 - tinderbox 2.9 running on freebsd-current.sentex.ca TB --- 2012-04-28 12:07:32 - FreeBSD freebsd-current.sentex.ca 8.3-PRERELEASE FreeBSD 8.3-PRERELEASE #0: Mon Mar 26 13:54:12 EDT 2012 des@freebsd-current.sentex.ca:/usr/obj/usr/src/sys/GENERIC amd64 TB --- 2012-04-28 12:07:32 - starting HEAD tinderbox run for mips/mips TB --- 2012-04-28 12:07:32 - cleaning the object tree TB --- 2012-04-28 12:07:32 - cvsupping the source tree TB --- 2012-04-28 12:07:32 - /usr/bin/csup -z -r 3 -g -L 1 -h cvsup.sentex.ca /tinderbox/HEAD/mips/mips/supfile TB --- 2012-04-28 12:09:04 - building world TB --- 2012-04-28 12:09:04 - CROSS_BUILD_TESTING=YES TB --- 2012-04-28 12:09:04 - MAKEOBJDIRPREFIX=/obj TB --- 2012-04-28 12:09:04 - PATH=/usr/bin:/usr/sbin:/bin:/sbin TB --- 2012-04-28 12:09:04 - SRCCONF=/dev/null TB --- 2012-04-28 12:09:04 - TARGET=mips TB --- 2012-04-28 12:09:04 - TARGET_ARCH=mips TB --- 2012-04-28 12:09:04 - TZ=UTC TB --- 2012-04-28 12:09:04 - __MAKE_CONF=/dev/null TB --- 2012-04-28 12:09:04 - cd /src TB --- 2012-04-28 12:09:04 - /usr/bin/make -B buildworld >>> World build started on Sat Apr 28 12:09:05 UTC 2012 >>> Rebuilding the temporary build tree >>> stage 1.1: legacy release compatibility shims >>> stage 1.2: bootstrap tools >>> stage 2.1: cleaning up the object tree >>> stage 2.2: rebuilding the object tree >>> stage 2.3: build tools >>> stage 3: cross tools >>> stage 4.1: building includes >>> stage 4.2: building libraries >>> stage 4.3: make dependencies >>> stage 4.4: building everything >>> World build completed on Sat Apr 28 13:11:21 UTC 2012 TB --- 2012-04-28 13:11:21 - cd /src/sys/mips/conf TB --- 2012-04-28 13:11:21 - /usr/sbin/config -m ADM5120 TB --- 2012-04-28 13:11:21 - skipping ADM5120 kernel TB --- 2012-04-28 13:11:21 - cd /src/sys/mips/conf TB --- 2012-04-28 13:11:21 - /usr/sbin/config -m ALCHEMY TB --- 2012-04-28 13:11:21 - skipping ALCHEMY kernel TB --- 2012-04-28 13:11:21 - cd /src/sys/mips/conf TB --- 2012-04-28 13:11:21 - /usr/sbin/config -m AP94 TB --- 2012-04-28 13:11:21 - building AP94 kernel TB --- 2012-04-28 13:11:21 - CROSS_BUILD_TESTING=YES TB --- 2012-04-28 13:11:21 - MAKEOBJDIRPREFIX=/obj TB --- 2012-04-28 13:11:21 - PATH=/usr/bin:/usr/sbin:/bin:/sbin TB --- 2012-04-28 13:11:21 - SRCCONF=/dev/null TB --- 2012-04-28 13:11:21 - TARGET=mips TB --- 2012-04-28 13:11:21 - TARGET_ARCH=mips TB --- 2012-04-28 13:11:21 - TZ=UTC TB --- 2012-04-28 13:11:21 - __MAKE_CONF=/dev/null TB --- 2012-04-28 13:11:21 - cd /src TB --- 2012-04-28 13:11:21 - /usr/bin/make -B buildkernel KERNCONF=AP94 >>> Kernel build for AP94 started on Sat Apr 28 13:11:21 UTC 2012 >>> stage 1: configuring the kernel >>> stage 2.1: cleaning up the object tree >>> stage 2.2: rebuilding the object tree >>> stage 2.3: build tools >>> stage 3.1: making dependencies >>> stage 3.2: building everything [...] cc -c -O -pipe -std=c99 -g -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs -fdiagnostics-show-option -nostdinc -I. -I/src/sys -I/src/sys/contrib/altq -I/src/sys/contrib/libfdt -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common -finline-limit=8000 --param inline-unit-growth=10000 --param large-function-growth=100000 --param max-inline-insns-single=10000 -fno-pic -mno-abicalls -G0 -DKERNLOADADDR=0x80050000 -march=mips32 -msoft-float -ffreestanding -Werror /src/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c -I/src/sys/dev/ath -I/src/sys/dev/ath/ath_hal cc -c -O -pipe -std=c99 -g -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs -fdiagnostics-show-option -nostdinc -I. -I/src/sys -I/src/sys/contrib/altq -I/src/sys/contrib/libfdt -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common -finline-limit=8000 --param inline-unit-growth=10000 --param large-function-growth=100000 --param max-inline-insns-single=10000 -fno-pic -mno-abicalls -G0 -DKERNLOADADDR=0x80050000 -march=mips32 -msoft-float -ffreestanding -Werror /src/sys/dev/ath/ath_hal/ar5212/ar5212_rfgain.c -I/src/sys/dev/ath -I/src/sys/dev/ath/ath_hal cc -c -O -pipe -std=c99 -g -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs -fdiagnostics-show-option -nostdinc -I. -I/src/sys -I/src/sys/contrib/altq -I/src/sys/contrib/libfdt -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common -finline-limit=8000 --param inline-unit-growth=10000 --param large-function-growth=100000 --param max-inline-insns-single=10000 -fno-pic -mno-abicalls -G0 -DKERNLOADADDR=0x80050000 -march=mips32 -msoft-float -ffreestanding -Werror /src/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c -I/src/sys/dev/ath -I/src/sys/dev/ath/ath_hal cc -c -O -pipe -std=c99 -g -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs -fdiagnostics-show-option -nostdinc -I. -I/src/sys -I/src/sys/contrib/altq -I/src/sys/contrib/libfdt -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common -finline-limit=8000 --param inline-unit-growth=10000 --param large-function-growth=100000 --param max-inline-insns-single=10000 -fno-pic -mno-abicalls -G0 -DKERNLOADADDR=0x80050000 -march=mips32 -msoft-float -ffreestanding -Werror /src/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c -I/src/sys/dev/ath -I/src/sys/dev/ath/ath_hal cc1: warnings being treated as errors /src/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c: In function 'ar5416AniPoll': /src/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c:818: warning: 'listenTime' may be used uninitialized in this function /src/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c:818: note: 'listenTime' was declared here *** Error code 1 Stop in /obj/mips.mips/src/sys/AP94. *** Error code 1 Stop in /src. *** Error code 1 Stop in /src. TB --- 2012-04-28 13:12:26 - WARNING: /usr/bin/make returned exit code 1 TB --- 2012-04-28 13:12:26 - ERROR: failed to build AP94 kernel TB --- 2012-04-28 13:12:26 - 2593.20 user 573.01 system 3894.23 real http://tinderbox.freebsd.org/tinderbox-head-HEAD-mips-mips.full From owner-freebsd-mips@FreeBSD.ORG Sat Apr 28 18:50:16 2012 Return-Path: Delivered-To: mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 380AF106566B; Sat, 28 Apr 2012 18:50:16 +0000 (UTC) (envelope-from tinderbox@freebsd.org) Received: from freebsd-current.sentex.ca (freebsd-current.sentex.ca [64.7.128.98]) by mx1.freebsd.org (Postfix) with ESMTP id E32DB8FC0A; Sat, 28 Apr 2012 18:50:15 +0000 (UTC) Received: from freebsd-current.sentex.ca (localhost [127.0.0.1]) by freebsd-current.sentex.ca (8.14.5/8.14.5) with ESMTP id q3SIoFWt070097; Sat, 28 Apr 2012 14:50:15 -0400 (EDT) (envelope-from tinderbox@freebsd.org) Received: (from tinderbox@localhost) by freebsd-current.sentex.ca (8.14.5/8.14.5/Submit) id q3SIoFRB070096; Sat, 28 Apr 2012 18:50:15 GMT (envelope-from tinderbox@freebsd.org) Date: Sat, 28 Apr 2012 18:50:15 GMT Message-Id: <201204281850.q3SIoFRB070096@freebsd-current.sentex.ca> X-Authentication-Warning: freebsd-current.sentex.ca: tinderbox set sender to FreeBSD Tinderbox using -f Sender: FreeBSD Tinderbox From: FreeBSD Tinderbox To: FreeBSD Tinderbox , , Precedence: bulk Cc: Subject: [head tinderbox] failure on mips/mips X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Apr 2012 18:50:16 -0000 TB --- 2012-04-28 17:44:18 - tinderbox 2.9 running on freebsd-current.sentex.ca TB --- 2012-04-28 17:44:18 - FreeBSD freebsd-current.sentex.ca 8.3-PRERELEASE FreeBSD 8.3-PRERELEASE #0: Mon Mar 26 13:54:12 EDT 2012 des@freebsd-current.sentex.ca:/usr/obj/usr/src/sys/GENERIC amd64 TB --- 2012-04-28 17:44:18 - starting HEAD tinderbox run for mips/mips TB --- 2012-04-28 17:44:18 - cleaning the object tree TB --- 2012-04-28 17:45:24 - cvsupping the source tree TB --- 2012-04-28 17:45:24 - /usr/bin/csup -z -r 3 -g -L 1 -h cvsup.sentex.ca /tinderbox/HEAD/mips/mips/supfile TB --- 2012-04-28 17:46:10 - building world TB --- 2012-04-28 17:46:10 - CROSS_BUILD_TESTING=YES TB --- 2012-04-28 17:46:10 - MAKEOBJDIRPREFIX=/obj TB --- 2012-04-28 17:46:10 - PATH=/usr/bin:/usr/sbin:/bin:/sbin TB --- 2012-04-28 17:46:10 - SRCCONF=/dev/null TB --- 2012-04-28 17:46:10 - TARGET=mips TB --- 2012-04-28 17:46:10 - TARGET_ARCH=mips TB --- 2012-04-28 17:46:10 - TZ=UTC TB --- 2012-04-28 17:46:10 - __MAKE_CONF=/dev/null TB --- 2012-04-28 17:46:10 - cd /src TB --- 2012-04-28 17:46:10 - /usr/bin/make -B buildworld >>> World build started on Sat Apr 28 17:46:11 UTC 2012 >>> Rebuilding the temporary build tree >>> stage 1.1: legacy release compatibility shims >>> stage 1.2: bootstrap tools >>> stage 2.1: cleaning up the object tree >>> stage 2.2: rebuilding the object tree >>> stage 2.3: build tools >>> stage 3: cross tools >>> stage 4.1: building includes >>> stage 4.2: building libraries >>> stage 4.3: make dependencies >>> stage 4.4: building everything >>> World build completed on Sat Apr 28 18:49:06 UTC 2012 TB --- 2012-04-28 18:49:06 - cd /src/sys/mips/conf TB --- 2012-04-28 18:49:06 - /usr/sbin/config -m ADM5120 TB --- 2012-04-28 18:49:06 - skipping ADM5120 kernel TB --- 2012-04-28 18:49:06 - cd /src/sys/mips/conf TB --- 2012-04-28 18:49:06 - /usr/sbin/config -m ALCHEMY TB --- 2012-04-28 18:49:06 - skipping ALCHEMY kernel TB --- 2012-04-28 18:49:06 - cd /src/sys/mips/conf TB --- 2012-04-28 18:49:06 - /usr/sbin/config -m AP94 TB --- 2012-04-28 18:49:06 - building AP94 kernel TB --- 2012-04-28 18:49:06 - CROSS_BUILD_TESTING=YES TB --- 2012-04-28 18:49:06 - MAKEOBJDIRPREFIX=/obj TB --- 2012-04-28 18:49:06 - PATH=/usr/bin:/usr/sbin:/bin:/sbin TB --- 2012-04-28 18:49:06 - SRCCONF=/dev/null TB --- 2012-04-28 18:49:06 - TARGET=mips TB --- 2012-04-28 18:49:06 - TARGET_ARCH=mips TB --- 2012-04-28 18:49:06 - TZ=UTC TB --- 2012-04-28 18:49:06 - __MAKE_CONF=/dev/null TB --- 2012-04-28 18:49:06 - cd /src TB --- 2012-04-28 18:49:06 - /usr/bin/make -B buildkernel KERNCONF=AP94 >>> Kernel build for AP94 started on Sat Apr 28 18:49:06 UTC 2012 >>> stage 1: configuring the kernel >>> stage 2.1: cleaning up the object tree >>> stage 2.2: rebuilding the object tree >>> stage 2.3: build tools >>> stage 3.1: making dependencies >>> stage 3.2: building everything [...] cc -c -O -pipe -std=c99 -g -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs -fdiagnostics-show-option -nostdinc -I. -I/src/sys -I/src/sys/contrib/altq -I/src/sys/contrib/libfdt -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common -finline-limit=8000 --param inline-unit-growth=10000 --param large-function-growth=100000 --param max-inline-insns-single=10000 -fno-pic -mno-abicalls -G0 -DKERNLOADADDR=0x80050000 -march=mips32 -msoft-float -ffreestanding -Werror /src/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c -I/src/sys/dev/ath -I/src/sys/dev/ath/ath_hal cc -c -O -pipe -std=c99 -g -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs -fdiagnostics-show-option -nostdinc -I. -I/src/sys -I/src/sys/contrib/altq -I/src/sys/contrib/libfdt -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common -finline-limit=8000 --param inline-unit-growth=10000 --param large-function-growth=100000 --param max-inline-insns-single=10000 -fno-pic -mno-abicalls -G0 -DKERNLOADADDR=0x80050000 -march=mips32 -msoft-float -ffreestanding -Werror /src/sys/dev/ath/ath_hal/ar5212/ar5212_rfgain.c -I/src/sys/dev/ath -I/src/sys/dev/ath/ath_hal cc -c -O -pipe -std=c99 -g -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs -fdiagnostics-show-option -nostdinc -I. -I/src/sys -I/src/sys/contrib/altq -I/src/sys/contrib/libfdt -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common -finline-limit=8000 --param inline-unit-growth=10000 --param large-function-growth=100000 --param max-inline-insns-single=10000 -fno-pic -mno-abicalls -G0 -DKERNLOADADDR=0x80050000 -march=mips32 -msoft-float -ffreestanding -Werror /src/sys/dev/ath/ath_hal/ar5212/ar5212_xmit.c -I/src/sys/dev/ath -I/src/sys/dev/ath/ath_hal cc -c -O -pipe -std=c99 -g -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs -fdiagnostics-show-option -nostdinc -I. -I/src/sys -I/src/sys/contrib/altq -I/src/sys/contrib/libfdt -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common -finline-limit=8000 --param inline-unit-growth=10000 --param large-function-growth=100000 --param max-inline-insns-single=10000 -fno-pic -mno-abicalls -G0 -DKERNLOADADDR=0x80050000 -march=mips32 -msoft-float -ffreestanding -Werror /src/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c -I/src/sys/dev/ath -I/src/sys/dev/ath/ath_hal cc1: warnings being treated as errors /src/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c: In function 'ar5416AniPoll': /src/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c:818: warning: 'listenTime' may be used uninitialized in this function /src/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c:818: note: 'listenTime' was declared here *** Error code 1 Stop in /obj/mips.mips/src/sys/AP94. *** Error code 1 Stop in /src. *** Error code 1 Stop in /src. TB --- 2012-04-28 18:50:14 - WARNING: /usr/bin/make returned exit code 1 TB --- 2012-04-28 18:50:14 - ERROR: failed to build AP94 kernel TB --- 2012-04-28 18:50:14 - 2574.40 user 574.20 system 3956.96 real http://tinderbox.freebsd.org/tinderbox-head-HEAD-mips-mips.full