From owner-p4-projects@FreeBSD.ORG Wed Sep 5 18:05:50 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 0104216A41A; Wed, 5 Sep 2007 18:05:50 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B9FCB16A418 for ; Wed, 5 Sep 2007 18:05:49 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id A69ED13C48A for ; Wed, 5 Sep 2007 18:05:49 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id l85I5nj6084883 for ; Wed, 5 Sep 2007 18:05:49 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id l85I5nx1084880 for perforce@freebsd.org; Wed, 5 Sep 2007 18:05:49 GMT (envelope-from kmacy@freebsd.org) Date: Wed, 5 Sep 2007 18:05:49 GMT Message-Id: <200709051805.l85I5nx1084880@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to kmacy@freebsd.org using -f From: Kip Macy To: Perforce Change Reviews Cc: Subject: PERFORCE change 126094 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2007 18:05:50 -0000 http://perforce.freebsd.org/chv.cgi?CH=126094 Change 126094 by kmacy@kmacy_home:ethng on 2007/09/05 18:05:42 Support hwpmc for newer Intel processors by enabling p6 under 64-bit as well. Note that this does not add support for the newer counters. Affected files ... .. //depot/projects/ethng/src/lib/libpmc/libpmc.c#2 edit .. //depot/projects/ethng/src/sys/amd64/conf/GENERIC#4 edit .. //depot/projects/ethng/src/sys/amd64/include/pmc_mdep.h#2 edit .. //depot/projects/ethng/src/sys/conf/files.amd64#3 edit .. //depot/projects/ethng/src/sys/dev/hwpmc/hwpmc_x86.c#2 edit .. //depot/projects/ethng/src/sys/modules/hwpmc/Makefile#2 edit Differences ... ==== //depot/projects/ethng/src/lib/libpmc/libpmc.c#2 (text+ko) ==== @@ -46,16 +46,14 @@ #if defined(__i386__) static int k7_allocate_pmc(enum pmc_event _pe, char *_ctrspec, struct pmc_op_pmcallocate *_pmc_config); +static int p5_allocate_pmc(enum pmc_event _pe, char *_ctrspec, + struct pmc_op_pmcallocate *_pmc_config); #endif #if defined(__amd64__) || defined(__i386__) static int k8_allocate_pmc(enum pmc_event _pe, char *_ctrspec, struct pmc_op_pmcallocate *_pmc_config); static int p4_allocate_pmc(enum pmc_event _pe, char *_ctrspec, struct pmc_op_pmcallocate *_pmc_config); -#endif -#if defined(__i386__) -static int p5_allocate_pmc(enum pmc_event _pe, char *_ctrspec, - struct pmc_op_pmcallocate *_pmc_config); static int p6_allocate_pmc(enum pmc_event _pe, char *_ctrspec, struct pmc_op_pmcallocate *_pmc_config); #endif @@ -1285,26 +1283,6 @@ return 0; } -#endif - -#if defined(__i386__) - -/* - * Pentium style PMCs - */ - -static struct pmc_event_alias p5_aliases[] = { - EV_ALIAS("cycles", "tsc"), - EV_ALIAS(NULL, NULL) -}; - -static int -p5_allocate_pmc(enum pmc_event pe, char *ctrspec, - struct pmc_op_pmcallocate *pmc_config) -{ - return -1 || pe || ctrspec || pmc_config; /* shut up gcc */ -} - /* * Pentium Pro style PMCs. These PMCs are found in Pentium II, Pentium III, * and Pentium M CPUs. @@ -1634,9 +1612,30 @@ return 0; } + #endif +#if defined(__i386__) + /* + * Pentium style PMCs + */ + +static struct pmc_event_alias p5_aliases[] = { + EV_ALIAS("cycles", "tsc"), + EV_ALIAS(NULL, NULL) +}; + +static int +p5_allocate_pmc(enum pmc_event pe, char *ctrspec, + struct pmc_op_pmcallocate *pmc_config) +{ + return -1 || pe || ctrspec || pmc_config; /* shut up gcc */ +} + +#endif + +/* * API entry points */ @@ -1953,12 +1952,12 @@ case PMC_CPU_INTEL_P6: /* P6 ... Pentium M CPUs have */ case PMC_CPU_INTEL_PII: /* similar PMCs. */ case PMC_CPU_INTEL_PIII: +#endif +#if defined(__amd64__) || defined(__i386__) case PMC_CPU_INTEL_PM: pmc_mdep_event_aliases = p6_aliases; pmc_mdep_allocate_pmc = p6_allocate_pmc; break; -#endif -#if defined(__amd64__) || defined(__i386__) case PMC_CPU_INTEL_PIV: pmc_mdep_event_aliases = p4_aliases; pmc_mdep_allocate_pmc = p4_allocate_pmc; ==== //depot/projects/ethng/src/sys/amd64/conf/GENERIC#4 (text+ko) ==== @@ -23,7 +23,7 @@ # To statically compile in device wiring instead of /boot/device.hints #hints "GENERIC.hints" # Default places to look for devices. -makeoptions MODULES_OVERRIDE="cxgb em if_vlan linux linprocfs netgraph" +makeoptions MODULES_OVERRIDE="cxgb em if_vlan linux linprocfs hwpmc netgraph" makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols @@ -69,10 +69,10 @@ options KDB # Enable kernel debugger support. options DDB # Support DDB. options GDB # Support remote GDB. -options INVARIANTS # Enable calls of extra sanity checking -options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS -options WITNESS # Enable checks to detect deadlocks and cycles -options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed +#options INVARIANTS # Enable calls of extra sanity checking +#options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS +#options WITNESS # Enable checks to detect deadlocks and cycles +#options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed # Make an SMP-capable kernel by default options SMP # Symmetric MultiProcessor Kernel @@ -80,6 +80,9 @@ # CPU frequency control device cpufreq +# Add hooks for PMC +options HWPMC_HOOKS + # Bus support. device acpi device pci @@ -208,5 +211,5 @@ device dcons # Dumb console driver device dcons_crom # Configuration ROM for dcons -#options IFNET_MULTIQUEUE # add support for using multiple tx queues to ifnet options ALT_BREAK_TO_DEBUGGER +#options BIND_ALL ==== //depot/projects/ethng/src/sys/amd64/include/pmc_mdep.h#2 (text+ko) ==== @@ -33,10 +33,13 @@ #include #include +#include + union pmc_md_op_pmcallocate { struct pmc_md_amd_op_pmcallocate pm_amd; struct pmc_md_p4_op_pmcallocate pm_p4; + struct pmc_md_ppro_op_pmcallocate pm_ppro; uint64_t __pad[4]; }; @@ -49,6 +52,8 @@ union pmc_md_pmc { struct pmc_md_amd_pmc pm_amd; struct pmc_md_p4_pmc pm_p4; + struct pmc_md_ppro_pmc pm_ppro; + }; struct pmc; ==== //depot/projects/ethng/src/sys/conf/files.amd64#3 (text+ko) ==== ==== //depot/projects/ethng/src/sys/dev/hwpmc/hwpmc_x86.c#2 (text+ko) ==== @@ -64,7 +64,7 @@ cputype = -1; switch (cpu_id & 0xF00) { -#if defined(__i386__) +#if defined(__i386__) || defined(__amd64__) case 0x500: /* Pentium family processors */ cputype = PMC_CPU_INTEL_P5; break; @@ -82,9 +82,12 @@ case 0x7: case 0x8: case 0xA: case 0xB: cputype = PMC_CPU_INTEL_PIII; break; - case 0x9: case 0xD: case 0xE: + case 0x9: case 0xD: case 0xE: case 0xF: cputype = PMC_CPU_INTEL_PM; break; + default: + printf("cpu_type=0x%x cpu_model=0x%x\n", (cpu_id & 0xF00), + ((cpu_id & 0xF0) >> 4)); } break; #endif @@ -127,7 +130,7 @@ break; #endif -#if defined(__i386__) +#if defined(__i386__) || defined(__amd64__) /* * P6 Family Processors */ @@ -144,7 +147,8 @@ /* * Intel Pentium PMCs. */ - +#endif +#if defined(__i386__) case PMC_CPU_INTEL_P5: error = pmc_initialize_p5(pmc_mdep); break; ==== //depot/projects/ethng/src/sys/modules/hwpmc/Makefile#2 (text+ko) ==== @@ -11,7 +11,7 @@ WARNS?= 2 .if ${MACHINE_ARCH} == "amd64" -SRCS+= hwpmc_amd.c hwpmc_piv.c hwpmc_x86.c +SRCS+= hwpmc_amd.c hwpmc_piv.c hwpmc_ppro.c hwpmc_x86.c SRCS+= device_if.h bus_if.h .endif