summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2023-02-02 10:37:15 -0600
committerLouis Burda <quent.burda@gmail.com>2023-02-02 10:38:13 -0600
commitdbb1ac88094516d1165c9e43c4a79cbc3a18d7d1 (patch)
treebdd4842be53f3953674cd88a1ded8c33bea1693f
parentda9326a66bd534de38ab07dac96e8af051e94923 (diff)
downloadcachepc-dbb1ac88094516d1165c9e43c4a79cbc3a18d7d1.tar.gz
cachepc-dbb1ac88094516d1165c9e43c4a79cbc3a18d7d1.zip
Set default frequency to 1.5GHz and adjust apic timer divide accordingly
-rwxr-xr-xMakefile4
-rw-r--r--cachepc/cachepc.c2
-rw-r--r--cachepc/const.h5
-rw-r--r--cachepc/event.c3
4 files changed, 9 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index b1fef3e..cedeb9f 100755
--- a/Makefile
+++ b/Makefile
@@ -60,7 +60,9 @@ load:
prep:
sudo sh -c "echo 0 > /proc/sys/kernel/watchdog"
- sudo cpupower frequency-set -g powersave
+ sudo sh -c "echo 1500000 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq"
+ sudo sh -c "echo 1500000 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq"
+ sudo sh -c "echo 1500000 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq"
sudo bash -c "for f in /proc/irq/*/smp_affinity; do echo 1 > \$$f 2>/dev/null; done"
util/%: util/%.c $(UTIL_SRCS)
diff --git a/cachepc/cachepc.c b/cachepc/cachepc.c
index 62eb47e..d789dad 100644
--- a/cachepc/cachepc.c
+++ b/cachepc/cachepc.c
@@ -216,7 +216,7 @@ void
cpc_apic_oneshot_run(uint32_t interval)
{
native_apic_mem_write(APIC_LVTT, LOCAL_TIMER_VECTOR | APIC_LVT_TIMER_ONESHOT);
- native_apic_mem_write(APIC_TDCR, APIC_TDR_DIV_1);
+ native_apic_mem_write(APIC_TDCR, CPC_APIC_TIMER_TDCR);
native_apic_mem_write(APIC_TMICT, interval / CPC_APIC_TIMER_SOFTDIV);
}
EXPORT_SYMBOL(cpc_apic_oneshot_run);
diff --git a/cachepc/const.h b/cachepc/const.h
index fce887b..a7a3c4f 100644
--- a/cachepc/const.h
+++ b/cachepc/const.h
@@ -20,7 +20,8 @@
#define CPC_CL_PREV_OFFSET 8
#define CPC_CL_COUNT_OFFSET 16
-#define CPC_APIC_TIMER_SOFTDIV 3
-#define CPC_APIC_TIMER_MIN (50 * CPC_APIC_TIMER_SOFTDIV)
+#define CPC_APIC_TIMER_TDCR APIC_TDR_DIV_2 // APIC_TDR_DIV_1
+#define CPC_APIC_TIMER_SOFTDIV 1
+#define CPC_APIC_TIMER_MIN (100 * CPC_APIC_TIMER_SOFTDIV)
#define CPC_EVENT_BATCH_MAX 1000
diff --git a/cachepc/event.c b/cachepc/event.c
index 1f07418..518a112 100644
--- a/cachepc/event.c
+++ b/cachepc/event.c
@@ -72,7 +72,8 @@ cpc_send_event(struct cpc_event event)
}
if (cpc_event_batching) {
- if (cpc_eventbuf_len < CPC_EVENT_BATCH_MAX) {
+ if (event.type != CPC_EVENT_GUEST
+ && cpc_eventbuf_len < CPC_EVENT_BATCH_MAX) {
event.id = 0;
memcpy(&cpc_eventbuf[cpc_eventbuf_len], &event,
sizeof(struct cpc_event));