linux电源管理(二),内核的CPUFreq(DVFS)和ARM的SCPI
更多linux系统电源管理相关的内容请看:https://blog.csdn.net/u010936265/article/details/146436725?spm=1011.2415.3001.5331
1 简介
CPUFreq子系统位于drivers/cpufreq目录下,负责进行运行过程中CPU频率和电压的动态调整,即DVFS (Dynamic Voltage Frequency Scaling,动态电源频率调整)。
《Linux设备驱动开发详解:基于最新的Linux4.0内核》19.2 CPUFreq驱动
CPU工作态电源管理在Linux内核中称为CPUFreq子系统(在一些文献中也称DVFS),它主要适用于CPU利用率在5%~100%(对单个CPU核而言)动态变化的场景,基本方法是动态变频和动态变压。
《用“芯”探核:基于龙芯的Linux内核探索解析》8.2 运行时电源管理
SoC CPUFreq驱动只是设定了CPU的频率参数,以及提供了设置频率的途径,但是它并不会管CPU自身究竟应该运行在哪种频率上。究竟频率依据的是哪种标准,进行何种变化,而这些完全由CPUFreq的策略决定。

系统的状态以及CPUFreq的策略共同决定了CPU频率跳变的目标,CPUFreq核心层并将目标频率传递给底层具体SoC的CPUFreq驱动,该驱动修改硬件,完成频率的变换。

《Linux设备驱动开发详解:基于最新的Linux4.0内核》19.2.2 CPUFreq的策略
2 cpufreq_driver
2.1 简介
每个SoC的具体CPUFreq驱动实例只需要实现电压、频率表,以及从硬件层面完成这些变化。
《Linux设备驱动开发详解:基于最新的Linux4.0内核》19.2.1 SoC的CPUFreq驱动实现
2.2 数据结构
//include/linux/cpufreq.h
struct cpufreq_driver {char name[CPUFREQ_NAME_LEN];......int (*target)(struct cpufreq_policy *policy,unsigned int target_freq,unsigned int relation); /* Deprecated */int (*target_index)(struct cpufreq_policy *policy,unsigned int index);......
};
target()和target_index()
实现最终调频的接口,内部可以自行实现或调用CLK接口。
这是最重要的一个功能,在切换频率时调用。它会将当前CPU核的主频设置成CPUFreq策略提供的目标频率。
《SoC底层软件低功耗系统设计与实现》13.1.4 主要数据结构;3.driver相关数据结构
《⽤“芯”探核:基于⻰芯的Linux内核探索解析》8.2.1 动态变频;(一) CPUFreq的机制部分
register和unregister接口
int cpufreq_register_driver(struct cpufreq_driver *driver_data);
int cpufreq_unregister_driver(struct cpufreq_driver *driver);
2.3 实例分析:phytium (ARM)平台CPU的cpufreq_driver
2.3.1 phytium平台CPU相关功能简介
以phytium平台的FT-2000/4 CPU为例。
FT-2000/4 支持处理器的多种功耗管理技术,并通过 ARM 定义的 SCPI(System Control and Power Interface)[2]接口和 PSCI(Power State Corodination Interface)[3] 供系统功耗管理软件调用。
实现 core 运行频率的动态调节。通过 SCPI 接口,可以查询 CPU 支持的频率点集合,以及实现频率的动态切换。
《FT-2000/4软件编程手册》(V1.4); 7.1 CPU 功耗管理
2.3.2 ARM的SCP,SCPI简介
A System Control Processor (SCP) is a processor-based capability that provides a flexible and
extensible platform for provision of power management functions and services.

《ARM Compute Subsystem SCP Message Interface Protocols》
1.1 The System Control Processor
System Control and Power Interface (SCPI)
The SCPI is one of the primary interfaces to the SCP in an ARM CSS-based platform. It is used
to access many of the services that are exposed to the AP. The SCP is expected to be idle and
waiting for SCPI commands for most of the time after the system boot process completes.
《ARM Compute Subsystem SCP Message Interface Protocols》
Chapter 3 CSS System Control and Power Interface (SCPI)
2.3.3 数据结构
//drivers/cpufreq/scpi-cpufreq.c
static struct cpufreq_driver scpi_cpufreq_driver = { .name = "scpi-cpufreq",.flags = CPUFREQ_STICKY | CPUFREQ_HAVE_GOVERNOR_PER_POLICY |CPUFREQ_NEED_INITIAL_FREQ_CHECK |CPUFREQ_IS_COOLING_DEV,.verify = cpufreq_generic_frequency_table_verify,.attr = cpufreq_generic_attr,.get = scpi_cpufreq_get_rate,.init = scpi_cpufreq_init,.exit = scpi_cpufreq_exit,.target_index = scpi_cpufreq_set_target,
};
2.3.4 scpi_cpufreq_init()代码大致流程
scpi_cpufreq_init();-> scpi_ops->add_opps_to_device(cpu_dev);-> scpi_dvfs_add_opps_to_device();-> scpi_dvfs_info();-> scpi_dvfs_get_info();-> scpi_send_message(CMD_GET_DVFS_INFO, ...);-> info->count = buf.opp_count;-> opp->freq = le32_to_cpu(buf.opps[i].freq);-> dev_pm_opp_add();-> dev_pm_opp_init_cpufreq_table(); //create a cpufreq table for a device
scpi_cpufreq_init()函数会使用SCPI接口获取CPU的频率和电压等信息,然后根据这些信息实现一个struct cpufreq_frequency_table。
具体信息请看SCPI命令中的Get DVFS Info命令(《ARM Compute Subsystem SCP Message Interface Protocols》3.2.9 Get DVFS Info)
2.3.5 设置频率的流程
scpi_cpufreq_set_target();-> clk_set_rate(priv->clk, rate);-> clk_core_set_rate_nolock();-> clk_change_rate();-> core->ops->set_rate();-> scpi_clk_set_rate();-> clk->scpi_ops->clk_set_val();-> scpi_clk_set_val();-> scpi_send_message(CMD_SET_CLOCK_VALUE, ...);
《ARM Compute Subsystem SCP Message Interface Protocols》3.2.15 Set Clock Value
2.4 查看系统当前使用的cpufreq_driver
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver
或者
cat /sys/devices/system/cpu/cpufreq/policy0/scaling_driver
3 CPUFreq的governor
3.1 简介
CPUFreq策略(Governor)的主要原则是根据当前系统负载来选择最合适的主频/电压。
《用“芯”探核:基于龙芯的Linux内核探索解析》8.2 运行时电源管理
3.2 数据结构
3.2.1 struct cpufreq_governor
//include/linux/cpufreq.h
struct cpufreq_governor {char name[CPUFREQ_NAME_LEN];int (*init)(struct cpufreq_policy *policy);void (*exit)(struct cpufreq_policy *policy);int (*start)(struct cpufreq_policy *policy);void (*stop)(struct cpufreq_policy *policy);void (*limits)(struct cpufreq_policy *policy);ssize_t (*show_setspeed) (struct cpufreq_policy *policy,char *buf);int (*store_setspeed) (struct cpufreq_policy *policy,unsigned int freq);/* For governors which change frequency dynamically by themselves */bool dynamic_switching;struct list_head governor_list;struct module *owner;
};
register和unregister函数:
int cpufreq_register_governor(struct cpufreq_governor *governor)
void cpufreq_unregister_governor(struct cpufreq_governor *governor)
3.2.2 struct dbs_governor;
//drivers/cpufreq/cpufreq_governor.h
/* Common Governor data across policies */
struct dbs_governor {struct cpufreq_governor gov;struct kobj_type kobj_type;/* * Common data for platforms that don't set* CPUFREQ_HAVE_GOVERNOR_PER_POLICY*/struct dbs_data *gdbs_data;unsigned int (*gov_dbs_update)(struct cpufreq_policy *policy);struct policy_dbs_info *(*alloc)(void);void (*free)(struct policy_dbs_info *policy_dbs);int (*init)(struct dbs_data *dbs_data);void (*exit)(struct dbs_data *dbs_data);void (*start)(struct cpufreq_policy *policy);
};
3.2.3 链表:cpufreq_governor_list
用来存放所有注册的governor节点
//drivers/cpufreq/cpufreq.c
static LIST_HEAD(cpufreq_governor_list);cpufreq_register_governor();-> list_add(&governor->governor_list, &cpufreq_governor_list);
3.3 现有的策略
3.3.1 performance
this governor causes the highest frequency, within the ``scaling_max_freq`` policy limit, to be requested for that policy.
//drivers/cpufreq/cpufreq_performance.c
static struct cpufreq_governor cpufreq_gov_performance = {.name = "performance",.owner = THIS_MODULE,.limits = cpufreq_gov_performance_limits,
};
cpufreq_gov_performance_init();-> cpufreq_register_governor(&cpufreq_gov_performance);
3.3.2 powersave
this governor causes the lowest frequency, within the ``scaling_min_freq`` policy limit, to be requested for that policy.
//drivers/cpufreq/cpufreq_powersave.c
static struct cpufreq_governor cpufreq_gov_powersave = {.name = "powersave",.limits = cpufreq_gov_powersave_limits,.owner = THIS_MODULE,
};
cpufreq_gov_powersave_init();-> cpufreq_register_governor(&cpufreq_gov_powersave);
3.3.3 userspace
This governor does not do anything by itself. Instead, it allows user space to set the CPU frequency for the policy it is attached to by writing to the ``scaling_setspeed`` attribute of that policy.
//drivers/cpufreq/cpufreq_userspace.c
static struct cpufreq_governor cpufreq_gov_userspace = {.name = "userspace",.init = cpufreq_userspace_policy_init,.exit = cpufreq_userspace_policy_exit,.start = cpufreq_userspace_policy_start,.stop = cpufreq_userspace_policy_stop,.limits = cpufreq_userspace_policy_limits,.store_setspeed = cpufreq_set,.show_setspeed = show_speed,.owner = THIS_MODULE,
};
cpufreq_gov_userspace_init();-> cpufreq_register_governor(&cpufreq_gov_userspace);
3.3.4 schedutil
This governor uses CPU utilization data available from the CPU scheduler. It generally is regarded as a part of the CPU scheduler, so it can access the scheduler's internal data structures directly.
//kernel/sched/cpufreq_schedutil.c
struct cpufreq_governor schedutil_gov = {.name = "schedutil",.owner = THIS_MODULE,.dynamic_switching = true,.init = sugov_init,.exit = sugov_exit,.start = sugov_start,.stop = sugov_stop,.limits = sugov_limits,
};
sugov_register();-> cpufreq_register_governor(&schedutil_gov);
当系统负载发生变化时,会根据负载来调整CPU频率,流程大致如下:
cpufreq_update_util();-> data->func();-> sugov_update_single();-> sugov_deferred_update();-> irq_work_queue(&sg_policy->irq_work);-> sugov_irq_work();-> sugov_work();-> __cpufreq_driver_target();-> cpufreq_driver->target();
3.3.5 ondemand
按需(Ondemand)策略:设置CPU负载的阈值T,当负载低于T时,调节⾄⼀个刚好能够 满⾜当前负载需求的最低频/最低压;当负载⾼于T时,⽴即提升到最⾼性能状态。
//drivers/cpufreq/cpufreq_ondemand.c
static struct dbs_governor od_dbs_gov = { .gov = CPUFREQ_DBS_GOVERNOR_INITIALIZER("ondemand"),.kobj_type = { .default_attrs = od_attributes },.gov_dbs_update = od_dbs_update,.alloc = od_alloc,.free = od_free,.init = od_init,.exit = od_exit,.start = od_start,
};
cpufreq_gov_dbs_init();-> cpufreq_register_governor(CPU_FREQ_GOV_ONDEMAND);
3.3.6 conservative
保守(Conservative)策略:跟Ondemand策略类似,设置CPU负载的阈值T,当 负载低于T时,调节⾄⼀个刚好能够满⾜当前负载需求的最低频/最低压;但当负载 ⾼于T时,不是⽴即设置为最⾼性能状态,⽽是逐级升⾼主频/电压。
//drivers/cpufreq/cpufreq_conservative.c
static struct dbs_governor cs_governor = {.gov = CPUFREQ_DBS_GOVERNOR_INITIALIZER("conservative"),.kobj_type = { .default_attrs = cs_attributes },.gov_dbs_update = cs_dbs_update,.alloc = cs_alloc,.free = cs_free,.init = cs_init,.exit = cs_exit,.start = cs_start,
};
cpufreq_gov_dbs_init();-> cpufreq_register_governor(CPU_FREQ_GOV_CONSERVATIVE);
参考资料
Documentation/admin-guide/pm/cpufreq.rst
《Linux设备驱动开发详解:基于最新的Linux4.0内核》 19.2.2 CPUFreq的策略
《SoC底层软件低功耗系统设计与实现》 13.1.5主要函数实现;4.ondemand governor
《⽤“芯”探核:基于⻰芯的Linux内核探索解析》 8.2 运⾏时电源管理
3.4 配置系统当前的governor
查看当前支持的governor
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
performance powersave
或者
# cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_governors
performance powersave
设置当前的governor
echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
或者
echo powersave > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
4 其他数据结构
4.1 struct cpufreq_frequency_table;
当前CPU支持的频率表。
//include/linux/cpufreq.h
struct cpufreq_frequency_table {unsigned int flags;unsigned int driver_data; /* driver specific data, not used by core */unsigned int frequency; /* kHz - doesn't need to be in ascending* order */
};
4.2 struct cpufreq_policy;
每个CPU核都有自己的控制策略(cpufreq_policy)
//include/linux/cpufreq.h
struct cpufreq_policy {/* CPUs sharing clock, require sw coordination */cpumask_var_t cpus; /* Online CPUs only */cpumask_var_t related_cpus; /* Online + Offline CPUs */......unsigned int min; /* in kHz */ unsigned int max; /* in kHz */unsigned int cur; /* in kHz, only needed if cpufreq */......struct cpufreq_governor *governor;......struct cpufreq_frequency_table *freq_table; //当前CPU支持的频率表......
};
结构体成员说明
<1> cpus和related_cpus
cpus及related_cpus表示当前policy管理的CPU,cpus代表当前处于online状态的CPU,related_cpus表示所有包含online/offline的CPU。
查看cpus和related_cpus的值
cat /sys/devices/system/cpu/cpufreq/policy0/affected_cpus
cat /sys/devices/system/cpu/cpufreq/policy0/related_cpus
<2> min/max/cur
min/max/cur表示当前policy支持的最大、最小及当前频率。
查看或者设置min/max的值
/sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq
/sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq
查看cur的值
cat /sys/devices/system/cpu/cpufreq/policy0/scaling_cur_freq
《SoC底层软件低功耗系统设计与实现》
13.1.4 主要数据结构;1.cpufreq_policy结构体
初始化函数:cpufreq_init_policy();
5 nofifier
5.1 简介
在频率变化的过程 中,会发送2次通知:
CPUFREQ_PRECHANGE:准备进⾏频率变更
CPUFREQ_POSTCHANGE:已经完成频率变更
数据结构:BLOCKING_NOTIFIER_HEAD(cpufreq_policy_notifier_list);
发出通知的代码:
srcu_notifier_call_chain(&cpufreq_transition_notifier_list,CPUFREQ_PRECHANGE, freqs);srcu_notifier_call_chain(&cpufreq_transition_notifier_list,CPUFREQ_POSTCHANGE, freqs);
《Linux设备驱动开发详解:基于最新的Linux4.0内核》 19.2.4 CPUFreq通知
6 调试
6.1 cpufreq-stats
cpufreq-stats is a driver that provides CPU frequency statistics for each CPU.
/sys/devices/system/cpu/cpu0/cpufreq/stats # ls -l
total 0
drwxr-xr-x 2 root root 0 May 14 16:06 .
drwxr-xr-x 3 root root 0 May 14 15:58 ..
--w------- 1 root root 4096 May 14 16:06 reset
-r--r--r-- 1 root root 4096 May 14 16:06 time_in_state
-r--r--r-- 1 root root 4096 May 14 16:06 total_trans
-r--r--r-- 1 root root 4096 May 14 16:06 trans_table
Documentation/cpu-freq/cpufreq-stats.txt
注意:
当使⽤cpufreq_driver驱动是intel_pstate时,不会存在stats/⽬录
6.2 /sys/kernel/debug/tracing/events/power/
cpu_frequency_limits
cpu_frequency
6.3 cpufreq-bench
工具源码:<kernel_src>/tools/power/cpupower/bench/
cpufreq-bench工具的工作原理是模拟系统运行时候的“空闲→忙→空闲→忙”场景,从而触发系统的动态频率变化,然后在使用ondemand、conservative、interactive等策略的情况下,计算在做与performance高频模式下同样的运算完成任务的时间比例。
⼀般的⽬标是在采⽤CPUFreq动态调整频率和电压后,性能应该 为performance这个性能策略下的90%左右,这样才⽐较理想。
《Linux设备驱动开发详解:基于最新的Linux4.0内核》 19.2.3 CPUFreq的性能测试和调优
6.4 cpupower frequency-info|frequency-set
cpupower frequency-info
A small tool which prints out cpufreq information helpful to developers and interested users.
cpupower frequency-set
cpupower frequency-set allows you to modify cpufreq settings without having to type e.g. "/sys/devices/system/cpu/cpu0/cpufreq/scaling_set_speed" all the time.
6.5 cpufreq-info和cpufreq-set
cpufreq-info
A small tool which prints out cpufreq information helpful to developers and interested users.
cpufreq-set
cpufreq-set allows you to modify cpufreq settings without having to type e.g. "/sys/devices/system/cpu/cpu0/cpufreq/scaling_set_speed" all the time.
相关文章:
linux电源管理(二),内核的CPUFreq(DVFS)和ARM的SCPI
更多linux系统电源管理相关的内容请看:https://blog.csdn.net/u010936265/article/details/146436725?spm1011.2415.3001.5331 1 简介 CPUFreq子系统位于drivers/cpufreq目录下,负责进行运行过程中CPU频率和电压的动态调整,即DVFS (Dynami…...
【LeetCode 热题 100】哈希 系列
📁1. 两数之和 本题就是将通过两层遍历优化而成的,为什么需要两层遍历,因为遍历 i 位置时,不知道i-1之前的元素是多少,如果我们知道了,就可以通过两数相加和target比较即可。 因为本题要求返回下标…...
ES6学习04-数组扩展:扩展运算符、新增方法
一、扩展运算符 1. 2. eg: 3. 二、新增方法 1. arguments 元素组合 类似数组对象 2....
Redis存储“大数据对象”的常用策略及StackOverflowError错误解决方案
Hi,大家好,我是灰小猿! 在一些功能的开发中,我们一般会有一些场景需要将得到的数据先暂时的存储起来,以便后面的接口或业务使用,这种场景我们一般常用的场景就是将数据暂时存储在缓存中,之后再…...
在轨道交通控制系统中如何实现μs级任务同步
轨道交通作为现代城市化进程中的重要支柱,承载着数以亿计的乘客出行需求,同时也是城市经济运行的命脉。无论是地铁、轻轨还是高速铁路,其控制系统的稳定性和可靠性直接关系到运营安全和效率。在这样一个高风险、高复杂度的环境中,任何微小的失误都可能导致灾难性后果。因此…...
嵌入式程序设计英语
实际要求:认识最基本的英文单词即可,(总计几百个) IDE 集成开发环境 fatal error fatal 致命的,error 错误,fatal error 致命的错误 main 主要的 include 包含 io input 输入,output 输出,input output …...
滚轮控制目标臂长度调整相机距离
通过鼠标滚轮来控制摄像机目标臂长度 , 调整相机距离 看图就行,不多说,照着连就完事了...
FireCrawl爬虫工具, Craw4ai
FireCrawl是一款开源的AI爬虫工具,专门用于Web数据提取,并将其转换为Markdown格式或其他结构化数据。FireCrawl特别适合处理使用JavaScript动态生成的网站,能够自动抓取网站及其所有可访问的子页面内容,并将其转换为适合大语言…...
pyenv库应用入门与Ubuntu端安装实践
pyenv库应用入门与Ubuntu端安装实践 pyenv概述virtualenv、pyvenv、pyenvvirtualenvpyvenvpyenv Ubuntu端安装pyenv实践安装依赖报错解决安装pyenv配置环境变量更换pyenv源地址 pyenv基本用法安装成功服务器部署scrapyd pyenv概述 pyenv 是一个用于管理多个 Python 版本的工具…...
CS5346 - Annotation in Visualization (可视化中的注释)
文章目录 Annotation 的重要性Levels of Annotation (注释的层级)Headings and IntroductionHeadings(标题)陈述型(Statement):突出结论或有趣发现疑问型(Question)&…...
如何开发一套场外个股期权交易系统?个股期权交易软件包含:询价,报价,交易,持仓,行权,账户盈亏统计等
一、场外个股期权的定义与特点 场外个股期权(Over-the-Counter Equity Option)是一种由交易双方私下协商的非标准化金融衍生品合约,以特定个股为标的资产。与交易所上市的标准化期权不同,其合约条款(如行权价、到期日…...
高速电路中的电阻、电容的选型及应用
2.1 电阻的应用 2.1.1 与电阻相关的经典案例 如果说芯片是电路的骨架,那么电阻就是在芯片之间起连接作用的关节。电阻的阻值、布放位置等,对设计的成功起着至关重要的作用。 【案例2.1】串联电阻过大,导致板间告警失败 某产品由业务板和主…...
六、adb通过Wifi连接
背景 收集是荣耀X40,数据线原装全新的,USB连上之后,老是断,电脑一直叮咚叮咚的响个不停,试试WIFI 连接是否稳定,需要手机和电脑用相同的WIFI. 连接 1.通过 USB 连接手机和电脑(打开USB调试等这些都略过) adb device…...
Java新手村第二站:泛型、集合与IO流初探
文章目录 Java新手村第二站:泛型、集合与IO流初探泛型包装类集合IO流函数式接口和Lambda表达式 Java新手村第二站:泛型、集合与IO流初探 泛型 泛型的概念与作用: 核心目的:在编译期提供类型安全检查,避免运行时的 Cla…...
AT_abc398_e [ABC398E] Tree Game 题解
题目传送门 题目大意 题目描述 本题是一道交互题(你的程序需要通过输入输出与评测系统进行交互)。 给定一棵包含 N N N 个顶点的树 G G G,顶点编号为 1 1 1 至 N N N。第 i i i 条边连接顶点 U i U_i Ui 和 V i V_i Vi。 你和…...
CSI-external-provisioner
main() 这段Go代码是一个CSI(容器存储接口)Provisioner(供应器)的实现,用于在Kubernetes集群中动态提供持久卷。代码涉及多个组件和步骤,下面是对关键部分的解释: 初始化和配置 命令行标志和…...
android中dp和px的关系
关于android的dp和px的关系是我刚开始学习android的第一个知识点,不知不觉学安卓也有一年了,但是偶然间我发现我理解的dp和px的关系一直是错的,真的是有一点搞笑,今天特意写一篇博客纪念一下这个我理解错一年的知识点。 dp和px之间…...
DeepSeek模型在非图形智能体的应用中是否需要GPU
答:不一定 概念 1、是否需要GPU与应用是否图形处理应用无关 2、文本内容智能体大多也需要GPU来提供更好的性能 3、DeepSeek模型在非图形智能体的应用中是否需要GPU取决于具体的模型版本和部署环境 不需要GPU的模型版本 DeepSeek-R1-1.5B: 这…...
4.14代码随想录第四十三天打卡
图论理论基础 https://www.programmercarl.com/kamacoder/%E5%9B%BE%E8%AE%BA%E7%90%86%E8%AE%BA%E5%9F%BA%E7%A1%80.html 98. 所有可达路径 (1)题目描述: (2)解题思路: #include <iostream> #include <vector> #include <list> using namespace std;vec…...
【视频目标分割论文集】Efficient Track Anything0000
github 摘要 视频对象分割和追踪任意目标领域出现了强大的工具——分割任意模型 2(SAM 2)。SAM 2 实现令人印象深刻的视频对象分割性能的关键组成部分包括用于帧特征提取的大型多阶段图像编码器,以及存储过去帧记忆上下文以辅助当前帧分割的…...
码率自适应(ABR)决策的直播场景
直播场景 1. 直播场景的普遍框架与工作原理 主播端:即各类主播(游戏、网红歌手、户外达人等),通过手机端或者个人电脑在线直播录制个人活动。 编码服务器:主播端上传视频流以后,编码服务器根据相应的编码转…...
SCP-Firmware安全通告:CVE-2024-11863和CVE-2024-11864
安全之安全(security)博客目录导读 目录 一、概述 二、CVE详情 三、受影响产品 四、修复建议 五、致谢 六、版本历史 一、概述 在SCP固件(SCP-Firmware)中发现两处安全漏洞,可能允许普通世界特权软件(normal world privileged softwareÿ…...
Redis高频面试题(含答案)
当然可以,Redis 是面试中非常常见的高频考点,尤其在后台开发、分布式系统、缓存设计等方向,面试官常常通过 Redis 来考察你的高并发处理能力、系统设计能力和对缓存一致性理解。 以下是一些典型 Redis 的面试场景题目类型和你可以如何回答的思路: ✅ 一、基础使用类问题 …...
双按键控制LED(中断优先级)
1.启动时,两个LED灯熄灭,1秒钟后(定时器实现),LED自动点亮; 2.按键1按下后,通过中断int0把两个LED熄灭5s时间,int0优先级设置为最高(优先级必须设置,设置后才…...
(四)机器学习---逻辑回归及其Python实现
之前我们提到了常见的任务和算法,本篇我们使用逻辑回归来进行分类 分类问题回归问题聚类问题各种复杂问题决策树√线性回归√K-means√神经网络√逻辑回归√岭回归密度聚类深度学习√集成学习√Lasso回归谱聚类条件随机场贝叶斯层次聚类隐马尔可夫模型支持向量机高…...
代码随想录第17天:二叉树
一、二叉搜索树的最近公共祖先(Leetcode 235) 由于是二叉搜索树,节点的值有严格的顺序关系:左子树的节点值都小于父节点,右子树的节点值都大于父节点。利用这一点,可以在树中更高效地找到最低公共祖先。 c…...
超越CUDA:ROCm与oneAPI在异构计算中的性能对比实验(国产GPU生态下的开发路径探索)
一、异构计算生态的竞争格局 当前异构计算领域呈现“一超多强”格局:英伟达凭借CUDA生态占据90%以上的AI训练市场份额,而AMD的ROCm与英特尔的oneAPI通过差异化技术路线持续挑战其垄断地位。二者在国产GPU生态建设中展现出独特价值—— R…...
全新电脑如何快速安装nvm,npm,pnpm
以下是全新电脑快速安装 nvm、npm 和 pnpm 的详细步骤,覆盖 Windows/macOS/Linux 系统: 一、安装 nvm(Node Version Manager) 1. Windows 系统 下载安装包: 访问 nvm-windows 官方仓库,下载 nvm-setup.ex…...
面试篇 - GPT-1(Generative Pre-Training 1)
GPT-1(Generative Pre-Training 1) ⭐模型结构 Transformer only-decoder:GPT-1模型使用了一个12层的Transformer解码器。具体细节与标准的Transformer相同,但位置编码是可训练的。 注意力机制: 原始Transformer的解…...
测试用例如何编写
综合起来,做测试用例时,需要考虑两个方面(主要配合接口测试) ①页面上显示的数据是从哪里来的,是否有全部显示 -- 简单来说就是数据效验②页面上显示的数据是否有交互/依赖(操作的先后顺序会影响页面显示的…...
