PERFORCE change 126094 for review
Kip Macy
kmacy at FreeBSD.org
Wed Sep 5 11:05:50 PDT 2007
http://perforce.freebsd.org/chv.cgi?CH=126094
Change 126094 by kmacy at 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 <dev/hwpmc/hwpmc_amd.h>
#include <dev/hwpmc/hwpmc_piv.h>
+#include <dev/hwpmc/hwpmc_ppro.h>
+
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
More information about the p4-projects
mailing list