From dbb1ac88094516d1165c9e43c4a79cbc3a18d7d1 Mon Sep 17 00:00:00 2001 From: Louis Burda Date: Thu, 2 Feb 2023 10:37:15 -0600 Subject: Set default frequency to 1.5GHz and adjust apic timer divide accordingly --- Makefile | 4 +++- cachepc/cachepc.c | 2 +- cachepc/const.h | 5 +++-- cachepc/event.c | 3 ++- 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)); -- cgit v1.2.3-71-gd317