AmpereComputing / ampere-lts-kernel---DEPRECATED

Linux 5.4 and 5.10 Longterm kernel (LTS) with Ampere patches
21 stars 18 forks source link

cpupower cannot work #52

Open adamliyi opened 3 years ago

adamliyi commented 3 years ago

kernel: 5.10.27

# cpupower frequency-info
analyzing CPU 0:
  no or unknown cpufreq driver is active on this CPU
  CPUs which run at the same hardware frequency: Not Available
  CPUs which need to have their frequency coordinated by software: Not Available
  maximum transition latency:  Cannot determine or is not supported.
Not Available
  available cpufreq governors: Not Available
  Unable to determine current policy
  current CPU frequency: Unable to call hardware
  current CPU frequency:  Unable to call to kernel

strace shows there is no cpufreq in sysfs: '/sys/devices/system/cpu/cpu0/cpufreq/'.

zcat /proc/config.gz | grep -i freq
# CPU Frequency scaling
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_GOV_ATTR_SET=y
CONFIG_CPU_FREQ_GOV_COMMON=y
CONFIG_CPU_FREQ_STAT=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL is not set
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=y
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y
# CPU frequency scaling drivers
# CONFIG_CPUFREQ_DT is not set
CONFIG_ACPI_CPPC_CPUFREQ=y
CONFIG_ARM_SCPI_CPUFREQ=m
# CONFIG_ARM_QCOM_CPUFREQ_HW is not set
# end of CPU Frequency scaling
CONFIG_CPU_FREQ_THERMAL=y
# CONFIG_PM_DEVFREQ is not set
adamliyi commented 3 years ago

It is caused by incorrect bios setting:

ACPI-> Enable CPPC [Disabled]

Change to enable CPPC.

# ls /sys/devices/system/cpu/cpu0/cpufreq
ls: cannot access '/sys/devices/system/cpu/cpu0/cpufreq': No such file or directory
[root@adam_mj_cent83 ~]# modprobe cppc_cpufreq
[root@adam_mj_cent83 ~]# ls /sys/devices/system/cpu/cpu0/cpufreq
affected_cpus     cpuinfo_min_freq            scaling_available_governors  scaling_governor  scaling_setspeed
cpuinfo_cur_freq  cpuinfo_transition_latency  scaling_cur_freq             scaling_max_freq
cpuinfo_max_freq  related_cpus                scaling_driver               scaling_min_freq
adamliyi commented 3 years ago

After 'enable CPPC' in BIOS, cpupower works as expected:

# cpupower frequency-info
analyzing CPU 0:
  driver: cppc_cpufreq
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency:  Cannot determine or is not supported.
  hardware limits: 1000 MHz - 2.80 GHz
  available cpufreq governors: conservative ondemand userspace powersave performance schedutil
  current policy: frequency should be within 2.00 GHz and 2.80 GHz.
                  The governor "performance" may decide which speed to use
                  within this range.
  current CPU frequency: 1.40 GHz (asserted by call to hardware)
adamliyi commented 3 years ago

If we disable CPPC in bios, cppc_cpufreq driver cannot get initialized (tested with 5.10.27 LTS kernel)

# modprobe cppc_cpufreq
modprobe: ERROR: could not insert 'cppc_cpufreq': No such device

Remaining issue: user may disable ‘CPPC’ to get fixed frequency. In this case, since ‘cpupower frequency-info’ cannot work, how do we know current core frequency in OS.