cpupower 和 libcpupower

cpupower 和 libcpupower

cpupower 有时无法执行并出现以下错误:

cpupower: error while loading shared libraries: libcpupower.so.0: cannot open shared object file: No such file or directory

我已经在我的工作站上从源代码编译并安装了最后一个 cpupower 工具。

Makefile 安装命令将库安装在 /usr/local/lib 中,并相应地设置了我的 LD_LIBRARY_PATH :

syl@WorkStation-T3500:~$ echo $LD_LIBRARY_PATH 
:/usr/local/lib/

lrwxrwxrwx  1 root root     20 juin  26 11:46 libcpupower.so -> libcpupower.so.0.0.1
lrwxrwxrwx  1 root root     20 juin  26 11:46 libcpupower.so.0 -> libcpupower.so.0.0.1

-rwxr-xr-x 1根根77048 juin 26 11:46 libcpupower.so.0.0.1 l

一个简单的 cpupower 信息查询效果很好:

syl@WorkStation-T3500:~$ cpupower frequency-info
analyzing CPU 0:
driver: intel_pstate
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: 1.20 GHz - 3.20 GHz
available cpufreq governors: performance powersave
current policy: frequency should be within 1.20 GHz and 3.20 GHz.
              The governor "powersave" may decide which speed to use
              within this range.
current CPU frequency: Unable to call hardware
current CPU frequency: 1.20 GHz (asserted by call to kernel)
boost state support:
Supported: yes
Active: yes

尽管如此,当我尝试制定一些政策时,会发生以下情况:

syl@WorkStation-T3500:~$ sudo cpupower frequency-set --governor userspace
cpupower: error while loading shared libraries: libcpupower.so.0: cannot open shared object file: No such file or directory

我可以问你一些关于这个奇怪问题的提示吗?

一切顺利

西尔万

答案1

我发现 LD_LIBRARY_PATH 正确初始化是不够的,我必须将 lib 路径添加到 /etc/ld.so.conf.d/x86_64-linux-gnu.conf 中:

syl@WorkStation-T3500:~$ sudo vim /etc/ld.so.conf.d/x86_64-linux-gnu.conf

# Multiarch support
/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu
/usr/loca/lib/

然后 :

syl@WorkStation-T3500:~$ sudo ldconfig

这使得事情有效,但我无法理解这一点:

 syl@WorkStation-T3500:~$ sudo cpupower frequency-set --governor userspace Setting cpu: 0
Error setting new values. Common errors:
- Do you have proper administration rights? (super-user?)
- Is the governor you requested available and modprobed?
- Trying to set an invalid policy?
- Trying to set a specific frequency, but userspace governor is not available,
for example because of hardware which cannot be set to a specific frequency or because the userspace governor isn't loaded?

好吧,除了理解为什么这个命令不起作用之外什么都没有......

干杯!

西尔万

答案2

驱动intel_pstate程序仅接受powersaveperformance策略调节器,而不接受userspace。此限制已强制执行<kernel source>/drivers/cpufreq/intel_pstate.c文件中,按功能intel_pstate_verify_policy:

static int intel_pstate_verify_policy(struct cpufreq_policy *policy)
{
        struct cpudata *cpu = all_cpu_data[policy->cpu];

        update_turbo_state();
        cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
                                     intel_pstate_get_max_freq(cpu));

        if (policy->policy != CPUFREQ_POLICY_POWERSAVE &&
            policy->policy != CPUFREQ_POLICY_PERFORMANCE)
                return -EINVAL;

        intel_pstate_adjust_policy_max(policy, cpu);

        return 0;
}

如果您确实需要使用userspace调速器,则需要切换到另一个 CPUFreq 驱动程序。请参阅此问题了解更多详细信息。

相关内容