Skip to content

CoreFreq as the Clock Source, CPU Freq and CPU Idle driver

CyrIng edited this page Aug 29, 2023 · 4 revisions

Boot Bare-Metal

  • Add the following arguments in the Kernel boot command line

Intel

  • Prerequisites
modprobe.blacklist=acpi_cpufreq,pcc_cpufreq intel_pstate=disable idle=halt tsc=unstable
  • Recommended
nmi_watchdog=0 modprobe.blacklist=i5500_temp,coretemp,intel_idle,intel_cstate,intel_uncore,acpi_cpufreq,pcc_cpufreq,intel_powerclamp,i7core_edac,intel_rapl_msr,intel_rapl_common,intel_pmc_bxt idle=halt intel_pstate=disable intel_idle.max_cstate=0 cpufreq.off=0 tsc=unstable nowatchdog

AMD

  • Prerequisites
modprobe.blacklist=acpi_cpufreq idle=halt tsc=unstable
  • Recommended
nmi_watchdog=0 modprobe.blacklist=k10temp,acpi_cpufreq,rapl,intel_rapl_msr,intel_rapl_common,sp5100_tco,wmi,eeepc_wmi,asus_wmi idle=halt tsc=unstable nowatchdog

TSC built-in

make DELAY_TSC=1 clean all

Clock-Source, CPU-Freq and CPU-Idle

Registration

  • Start the CoreFreq module as the clock-source provider, cpufreq and cpuidle driver
insmod corefreqk.ko Register_ClockSource=1 Register_CPU_Freq=1 Register_Governor=1 Register_CPU_Idle=1

Control

  • Inform the Kernel to switch to the CoreFreq' clock-source
echo "corefreq_tsc" > /sys/devices/system/clocksource/clocksource0/current_clocksource
  • Start the Daemon and the Client
corefreqd
corefreq-cli

Verification

  • Client>Settings window
 CPU-IDLE driver          < ON>
 CPU-FREQ driver          < ON>
 Governor driver          < ON>
 Clock Source             < ON>
  • Client>Kernel window
CPU-Freq driver                                            [  corefreqk-perf]
Governor                                                   [ corefreq-policy]
CPU-Idle driver                                            [  corefreqk-idle]
  Idle Limit                                               <              C7>

Linux integration

Once CoreFreq fully registered, one can set various settings using the Linux common file operations

CPU-Freq & Governor

/sys/devices/system/cpu/cpufreq/
	boost
	policy0
		affected_cpus     cpuinfo_transition_latency   scaling_governor
		bios_limit        related_cpus                 scaling_max_freq
		cpuinfo_cur_freq  scaling_available_governors  scaling_min_freq
		cpuinfo_max_freq  scaling_cur_freq             scaling_setspeed
		cpuinfo_min_freq  scaling_driver
...
	policy31

CPU-Idle

/sys/devices/system/cpu/
	cpu0/cpuidle/
		state0
		state1
		state2
		state3
		state4
		state5
		state6
...
	cpu31/cpuidle/