summaryrefslogtreecommitdiffstats
path: root/sys/amd64/amd64/apic_vector.S
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2010-06-17 11:54:49 +0000
committermav <mav@FreeBSD.org>2010-06-17 11:54:49 +0000
commit71d7c38373261bf5664d7f1a1890eef6c2f30356 (patch)
treecbf8d07299f47472d94b91ec634c2217df714910 /sys/amd64/amd64/apic_vector.S
parent9f2d4c3357718975468ee4d1f2479c9dd704adfd (diff)
downloadFreeBSD-src-71d7c38373261bf5664d7f1a1890eef6c2f30356.zip
FreeBSD-src-71d7c38373261bf5664d7f1a1890eef6c2f30356.tar.gz
Merge COUNT_XINVLTLB_HITS and COUNT_IPIS kernel options from i386 to amd64.
This information can be very valuable for CPU sleep-time (and respectively idle power consumption) optimization. Add counters for timer-related IPIs. Reviewed by: jhb@ (previous version)
Diffstat (limited to 'sys/amd64/amd64/apic_vector.S')
-rw-r--r--sys/amd64/amd64/apic_vector.S54
1 files changed, 54 insertions, 0 deletions
diff --git a/sys/amd64/amd64/apic_vector.S b/sys/amd64/amd64/apic_vector.S
index 1c044b8..73a0eab 100644
--- a/sys/amd64/amd64/apic_vector.S
+++ b/sys/amd64/amd64/apic_vector.S
@@ -36,6 +36,8 @@
* as well as IPI handlers.
*/
+#include "opt_smp.h"
+
#include <machine/asmacros.h>
#include <machine/apicreg.h>
@@ -135,6 +137,19 @@ IDTVEC(errorint)
.text
SUPERALIGN_TEXT
IDTVEC(invltlb)
+#if defined(COUNT_XINVLTLB_HITS) || defined(COUNT_IPIS)
+ PUSH_FRAME
+ movl PCPU(CPUID), %eax
+#ifdef COUNT_XINVLTLB_HITS
+ incl xhits_gbl(,%rax,4)
+#endif
+#ifdef COUNT_IPIS
+ movq ipi_invltlb_counts(,%rax,8),%rax
+ incq (%rax)
+#endif
+ POP_FRAME
+#endif
+
pushq %rax
movq %cr3, %rax /* invalidate the TLB */
@@ -155,6 +170,19 @@ IDTVEC(invltlb)
.text
SUPERALIGN_TEXT
IDTVEC(invlpg)
+#if defined(COUNT_XINVLTLB_HITS) || defined(COUNT_IPIS)
+ PUSH_FRAME
+ movl PCPU(CPUID), %eax
+#ifdef COUNT_XINVLTLB_HITS
+ incl xhits_pg(,%rax,4)
+#endif
+#ifdef COUNT_IPIS
+ movq ipi_invlpg_counts(,%rax,8),%rax
+ incq (%rax)
+#endif
+ POP_FRAME
+#endif
+
pushq %rax
movq smp_tlb_addr1, %rax
@@ -175,6 +203,19 @@ IDTVEC(invlpg)
.text
SUPERALIGN_TEXT
IDTVEC(invlrng)
+#if defined(COUNT_XINVLTLB_HITS) || defined(COUNT_IPIS)
+ PUSH_FRAME
+ movl PCPU(CPUID), %eax
+#ifdef COUNT_XINVLTLB_HITS
+ incl xhits_rng(,%rax,4)
+#endif
+#ifdef COUNT_IPIS
+ movq ipi_invlrng_counts(,%rax,8),%rax
+ incq (%rax)
+#endif
+ POP_FRAME
+#endif
+
pushq %rax
pushq %rdx
@@ -201,6 +242,14 @@ IDTVEC(invlrng)
.text
SUPERALIGN_TEXT
IDTVEC(invlcache)
+#ifdef COUNT_IPIS
+ PUSH_FRAME
+ movl PCPU(CPUID), %eax
+ movq ipi_invlcache_counts(,%rax,8),%rax
+ incq (%rax)
+ POP_FRAME
+#endif
+
pushq %rax
wbinvd
@@ -270,6 +319,11 @@ IDTVEC(cpususpend)
SUPERALIGN_TEXT
IDTVEC(rendezvous)
PUSH_FRAME
+#ifdef COUNT_IPIS
+ movl PCPU(CPUID), %eax
+ movq ipi_rendezvous_counts(,%rax,8), %rax
+ incq (%rax)
+#endif
call smp_rendezvous_action
movq lapic, %rax
movl $0, LA_EOI(%rax) /* End Of Interrupt to APIC */
OpenPOWER on IntegriCloud