diff --git a/study/kernel/00-DESCRIPTION/ARCH.md b/study/kernel/00-DESCRIPTION/ARCH.md index 1ca0b5f..8e5f250 100644 --- a/study/kernel/00-DESCRIPTION/ARCH.md +++ b/study/kernel/00-DESCRIPTION/ARCH.md @@ -260,13 +260,17 @@ ASYM_PACKING 用于平衡物理核心与 SMT 之间的负载均衡处理 (例如 ##### 1.4.1.4.1 Hardware Feedback Interface 支持 ------- + +phoronix 上所有关于 HFI 相关的报道 [phoronix, Hardware Feedback Interface Linux & Open-Source News](https://www.phoronix.com/search/Hardware+Feedback+Interface). + | 时间 | 作者 | 特性 | 描述 | 是否合入主线 | 链接 | |:----:|:----:|:---:|:----:|:---------:|:----:| | 2021/11/06 | Ricardo Neri | [Thermal: Introduce the Hardware Feedback Interface for thermal and performance management](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/?id=bd30cdfd9bd73b68e4977ce7c5540aa7b14c25cd) | 支持 Intel HFI.
英特尔硬件反馈接口 (HFI) 提供系统中每个 CPU 的性能(performance) 和能效 (Energy efficiency) 的信息. 它使用一个在硬件和操作系统之间共享的表. 该表的内容可能由于系统运行条件的变化 (如达到热极限) 或外部因素的作用 (如热设计功率的变化) 而更新.
HFI 提供的信息被指定为相对于系统中其他 cpu 的数字、单元较少的能力. 这些功能的范围为 [0-255], 其中更高的数字表示更高的功能. 如果 CPU 的性能效率或能量能力效率为 0, 硬件建议分别出于性能、能量效率或热原因, 不要在该 CPU 上调度任何任务.
内核或用户空间可以使用来自 HFI 的信息来修改任务放置或调整功率限制. 当前这个补丁集中于用户空间. 热通知框架 (thermal notification framework) 被扩展以支持 CPU capacity 的更新. | v1 ☑ 5.18-rc1 | [2021/11/06 LWN](https://lwn.net/Articles/875296)
*-*-*-*-*-*-*-*
[LORE v2,0/7](https://lore.kernel.org/lkml/20211220151438.1196-1-ricardo.neri-calderon@linux.intel.com), [phoronix v2](https://www.phoronix.com/scan.php?page=news_item&px=Intel-HFI-Linux-v2-2021)
*-*-*-*-*-*-*-*
[PatchWork v5,0/7](https://patchwork.kernel.org/project/linux-pm/cover/20220127193454.12814-1-ricardo.neri-calderon@linux.intel.com), [phoronix v5](https://www.phoronix.com/scan.php?page=news_item&px=Intel-HFI-For-Linux-5.18) | | 2022/09/09 | Ricardo Neri | [sched: Introduce classes of tasks for load balance](https://lore.kernel.org/all/20220909231205.14009-1-ricardo.neri-calderon@linux.intel.com) | 实现 Thread-Director, 根据应用程序的类型 classes 实现选核和负载均衡. | v1 ☐☑✓ | [LORE v1,00/23](https://lore.kernel.org/all/20220909231205.14009-1-ricardo.neri-calderon@linux.intel.com)
*-*-*-*-*-*-*-*
[LORE v2,00/22](https://lore.kernel.org/all/20221128132100.30253-1-ricardo.neri-calderon@linux.intel.com)
*-*-*-*-*-*-*-*
[LORE v3,0/24](https://lore.kernel.org/all/20230207051105.11575-1-ricardo.neri-calderon@linux.intel.com)
*-*-*-*-*-*-*-*
[LORE v4,00/24](https://lore.kernel.org/all/20230613042422.5344-1-ricardo.neri-calderon@linux.intel.com) | | 2024/01/31 | Stanislaw Gruszka | [thermal/netlink/intel_hfi: Enable HFI feature only when required](https://lore.kernel.org/all/20240131120535.933424-1-stanislaw.gruszka@linux.intel.com) | 该补丁集仅在有用户空间实体侦听热网络链接事件时才启用 HFI. 引入了一个 netlink 通知, 它与 netlink_has_listners()检查一起, 允许驱动程序根据实际用户空间消费者的存在发送 netlink 多播事件. 此功能通过允许在不需要时禁用功能来优化资源使用. 然后在 intel_hif 驱动程序中实现通知机制, 用于动态禁用硬件反馈接口 (HFI). 通过实现 netlink 通知回调, 驱动程序现在可以根据实际需求启用或禁用 HFI, 特别是当用户空间应用程序(如英特尔速度选择或英特尔低功耗守护进程) 利用与性能和能效功能相关的事件时. 在有 Intel HFI 但没有安装用户空间组件的机器上, 我们可以节省大量的 CPU 周期. | v1 ☐☑✓ | [LORE v1,0/3](https://lore.kernel.org/all/20240131120535.933424-1-stanislaw.gruszka@linux.intel.com) | | 2024/02/02 | Ricardo Neri | [thermal: intel: hfi: Prework for the virtualization of HFI](https://lore.kernel.org/all/20240203040515.23947-1-ricardo.neri-calderon@linux.intel.com) | 用于 [支持 IPC 类任务的调度](https://lore.kernel.org/all/20230613042422.5344-1-ricardo.neri-calderon@linux.intel.com) 的基础
1. 重新组织 HFI 驱动程序的部分, 以便于实现虚拟 HFI 表.
2. 引入了 ITD 类的概念并启用了 ITD.
3. 增加了对重置当前任务的 ITD 分类历史的支持, 以便在上下文切换期间使用. HFI 的虚拟化要求在系统中无条件启用 HFI 和 ITD. 这与 Stanislaw 的补丁集 [thermal/netlink/intel_hfi: Enable HFI feature only when required](https://lore.kernel.org/all/20240131120535.933424-1-stanislaw.gruszka@linux.intel.com) 存在冲突. | v1 ☐☑✓ | [LORE v1,0/9](https://lore.kernel.org/all/20240203040515.23947-1-ricardo.neri-calderon@linux.intel.com) | -| 2024/02/23 | Stanislaw Gruszka | [thermal/netlink/intel_hfi: Enable HFI feature only when required](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/?id=b33f3d2677b8ddd7a3aba2b02497422a1d2c2a01) | 英特尔 HFI 驱动程序可以在需要时启用它, 从而 "节省大量 CPU 周期". 仅在有用户空间使用者处于活动状态时启用它. 如果英特尔 Speed Select 或英特尔低功耗守护程序正在运行, 英特尔 HFI 接口将被激活, 但如果不是, 它将被禁用, 从而显然可以节省大量 CPU 资源. 参见 phoronix 报道 [英特尔 HFI 驱动程序可以“节省大量 CPU 周期”,只需在需要时才启用自身](https://www.phoronix.com/news/Intel-HFI-Enable-Disable) 以及 [](https://www.phoronix.com/news/Intel-HFI-Efficient-Linux-6.10) | v4 ☐☑✓ v6.10-rc1 | [LORE v4,0/3](https://lore.kernel.org/all/20240223155942.60813-1-stanislaw.gruszka@linux.intel.com) | +| 2024/02/23 | Stanislaw Gruszka | [thermal/netlink/intel_hfi: Enable HFI feature only when required](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/?id=b33f3d2677b8ddd7a3aba2b02497422a1d2c2a01) | 英特尔 HFI 驱动程序可以在需要时启用它, 从而 "节省大量 CPU 周期". 仅在有用户空间使用者处于活动状态时启用它. 如果英特尔 Speed Select 或英特尔低功耗守护程序正在运行, 英特尔 HFI 接口将被激活, 但如果不是, 它将被禁用, 从而显然可以节省大量 CPU 资源. 参见 phoronix 报道 [英特尔 HFI 驱动程序可以“节省大量 CPU 周期”,只需在需要时才启用自身](https://www.phoronix.com/news/Intel-HFI-Enable-Disable) 以及 [phoronix, 2024/04/01, Intel HFI Driver Will Quit Wasting CPU Cycles With Linux 6.10](https://www.phoronix.com/news/Intel-HFI-Efficient-Linux-6.10) | v4 ☐☑✓ v6.10-rc1 | [LORE v4,0/3](https://lore.kernel.org/all/20240223155942.60813-1-stanislaw.gruszka@linux.intel.com) | +| 2024/10/10 | Mario Limonciello | [Add support for AMD hardware feedback interface](https://lore.kernel.org/all/20241010193705.10362-1-mario.limonciello@amd.com) | AMD 异构内核设计和硬件反馈接口 (HFI) 为调度程序提供行为分类和动态更新的排名表, 供调度程序在为任务选择内核时使用. 这用于向操作系统指示基于工作负载的启发式反馈, 以便做出计划决策.1.
实时线程特征分类功能: 新增 X86_FEATURE_WORKLOAD_CLASS "工作负载分类" 功能. 线程在运行时硬件根据特征将其分类为 3 个类型(0 到 2), 这些类表示可能受益于特殊调度行为的线程性能/功耗特征. 实时线程分类功能由操作系统使用, 用于通知计划程序应将线程放置在何处以获得最佳性能或能效.
2. 排名表: 线程分类有助于从排名表中选择 CPU, 该表从两个维度描述了每个分类的效率和性能排名. 排名表提供的排名数据是 0 到 255 之间的数字, 其中性能值越高表示性能能力越高, 效率越高表示效率越高. 所有 CPU 内核都分为不同的类 ID. 在每个类排名中, 核心可能具有不同的排名值. 因此, 从每个分类 ID 中选取允许调度程序选择最佳核心, 同时将线程分类到指定的工作负载类中. 内核排名表提供了 PCCT 子空间类型 4 共享内存, 其中包括内存基址和长度. 参见 [phoronix, 2024/08/24, AMD Developing New Heterogeneous CPU Core Driver For Linux Systems](https://www.phoronix.com/news/AMD-Heterogeneous-Core-Driver), [phoronix, 2024/10/11, AMD Hardware Feedback Interface "HFI" Driver Updated For Heterogeneous CPUs](https://www.phoronix.com/news/AMD-HFI-Linux-Driver-v2) | v2 ☐☑✓ | [2024/08/27, LORE, 00/10](https://lore.kernel.org/platform-driver-x86/cover.1724748733.git.perry.yuan@amd.com/)
*-*-*-*-*-*-*-*
[2024/10/10, LORE v2,0/13](https://lore.kernel.org/all/20241010193705.10362-1-mario.limonciello@amd.com) | @@ -307,11 +311,11 @@ hfi_update_work_fn 英特尔低功耗模式守护程序 LPMD, 用于优化 Linux 下现代酷睿混合 CPU 的主动空闲电源, 这些 CPU 具有 E 和 P 内核的组合. Intel LPMD 支持多种低功耗状态, 可以根据 EPP/EPB/ITMT 设置、IRQ 迁移和任务迁移定义多种状态. 还可以根据不同的利用率阈值选择不同的低功耗状态. 根据检测到的 CPU 拓扑或用户配置文件选择最节能的 CPU. 根据系统利用率等信息, 将在适用时将系统置于低功耗模式, 比如使用最节能的 E 核, 并在不需要时禁用 P 的内核. -2024/06/12 LPMD 发布 v0.0.4, 增强了其硬件反馈接口 (HFI) 监视器, 支持对来自被禁止的 CPU 的提示进行 HFI 监视, 支持多种低功耗状态, 支持工作负载类型提示, 并支持在低功耗模式转换期间更改能效偏好(EPP). 参见 phoronix 报道 [phoronix, 2024/06/12, Intel Low Power Mode Daemon v0.0.4 Released To Optimize Hybrid CPUs On Linux](https://www.phoronix.com/news/Intel-LPMD-Low-Power-0.0.4) - - -2024/09/24 LPMD 发布 v0.0.7, 更改之一是新的 "--ignore-platform-check" 选项, 允许覆盖平台检查, 以便守护程序在未经验证的硬件平台上启动. 此新版本中还有 Autotool 构建系统改进和各种修复. 参见 phoronix 报道 [phoronix, 2024/09/24, Intel's LPMD "Low Power Mode Daemon" Now Identifies As The "Energy Optimizer"](https://www.phoronix.com/news/Intel-LPMD-v0.0.7). - +| 时间 | 版本 | 描述 | 报道 | +|:---:|:---:|:----:|:---:| +| 2024/06/12 | v0.0.4 | 增强了其硬件反馈接口 (HFI) 监视器, 支持对来自被禁止的 CPU 的提示进行 HFI 监视, 支持多种低功耗状态, 支持工作负载类型提示, 并支持在低功耗模式转换期间更改能效偏好(EPP). | [phoronix, 2024/06/12, Intel Low Power Mode Daemon v0.0.4 Released To Optimize Hybrid CPUs On Linux](https://www.phoronix.com/news/Intel-LPMD-Low-Power-0.0.4). | +| 2024/09/24 | v0.0.7 | 更改之一是新的 "--ignore-platform-check" 选项, 允许覆盖平台检查, 以便守护程序在未经验证的硬件平台上启动. 此新版本中还有 Autotool 构建系统改进和各种修复. | [phoronix, 2024/09/24, Intel's LPMD "Low Power Mode Daemon" Now Identifies As The "Energy Optimizer"](https://www.phoronix.com/news/Intel-LPMD-v0.0.7). | +| 2024/10/16 | v0.0.8 | 引入工作负载类型代理支持, 支持特定于型号/SKU 的配置文件、英特尔 Meteor Lake P 配置文件和其他更改, 添加对 AC/DC 状态的检测, 还原时遵循电源配置文件守护程序默认 EPP, 引入 MeteorLake-P 平台特定的配置文件. | [phoronix, 2024/10/16, Intel Low Power Mode Daemon v0.0.8 Brings New Features](https://www.phoronix.com/news/Intel-Low-Power-LPMD-0.0.8) | #### 1.4.1.5 编译器支持 ------- diff --git a/study/kernel/00-DESCRIPTION/BPF.md b/study/kernel/00-DESCRIPTION/BPF.md index c65e081..74568bf 100644 --- a/study/kernel/00-DESCRIPTION/BPF.md +++ b/study/kernel/00-DESCRIPTION/BPF.md @@ -529,7 +529,6 @@ raw_tracepoint 相比 tracepoint [How to use libbpf-tools with ubuntu 18.04 4.15 kernel](https://www.gitmemory.com/issue/iovisor/bcc/3232/761744003) - ## 8.2 perf ------- @@ -603,11 +602,15 @@ glcc 则实现了 eBPF 驱动和 libbpf 的支持, 允许 eBPF 程序无需修 ## 8.7 continuous profiling ------- +[Building a Continuous Profiler Part 1: An Intro to App Profiling](https://blog.px.dev/cpu-profiling) +[Building a Continuous Profiler Part 2: A Simple eBPF-Based Profiler](https://blog.px.dev/cpu-profiling-2) +[Building a Continuous Profiler Part 3: Optimizing for Prod Systems](https://blog.px.dev/cpu-profiling-3) + | 博客 | 描述 | |:---:|:----:| | [Introduction to Parca - Part 1](https://www.polarsignals.com/blog/posts/2023/01/19/introduction-to-parca-agent) | Parca 是一个基于 eBPF 在线采样工具. | -| [grafana/phlare](https://github.com/grafana/phlare) | - +| [grafana/phlare](https://github.com/grafana/phlare) | 一个水平可扩展, 高可用, 多租户的持续性能分析聚合系统. 它已被 Grafana LAB 收购, 未来的 | +| [maxgio92/yap](https://github.com/maxgio92/yap) | 一个基于 Go 和 eBPF 的低开销的采样 CPU Profiler, 它不需要在被分析的二进制文件中进行任何插装. [Unleashing the power of frame pointers pt.1 - The execution environment](https://blog.maxgio.me/posts/unleashing-power-frame-pointers-execution-environment), [Unleashing the power of frame pointers for profiling pt.2 - Writing a simple profiler](https://blog.maxgio.me/posts/unleashing-power-frame-pointers-writing-simple-continuous-profiler) | # 9 WASM(WebAssembly) ------- @@ -638,6 +641,8 @@ Wasmtime 完全开源, 使用 Rust 编程语言, 是的, 并且符合 WASI 标 # X 学习参考 ------- +[zoidyzoidzoid/awesome-ebpf](https://github.com/zoidyzoidzoid/awesome-ebpf) + ## X.1 业界工具 ------- diff --git a/study/kernel/00-DESCRIPTION/DEBUGGING.md b/study/kernel/00-DESCRIPTION/DEBUGGING.md index 3fe3619..397ad6f 100644 --- a/study/kernel/00-DESCRIPTION/DEBUGGING.md +++ b/study/kernel/00-DESCRIPTION/DEBUGGING.md @@ -339,13 +339,12 @@ $reclaim = current\_mem \times reclaim\_ratio \times max(0,1 – \frac{psi_some} | 2022/02/07 | John Ogness | [implement threaded console printing](https://lore.kernel.org/all/20220207194323.273637-1-john.ogness@linutronix.de) | 参见 phoronix 报道 [Linux Gets Patches For Threaded Console Printing](https://www.phoronix.com/scan.php?page=news_item&px=Linux-Threaded-Console-Print) 和 [Patches Updated For Linux To Enjoy Consoles Running At Full-Speed](https://www.phoronix.com/scan.php?page=news_item&px=Printk-v3-Consoles-Full-Speed) | v1 ☐ | [LORE v1,0/13](https://lore.kernel.org/all/20220207194323.273637-1-john.ogness@linutronix.de) | | 2023/03/02 | John Ogness | [threaded/atomic console support](https://lore.kernel.org/all/87wn3zsz5x.fsf@jogness.linutronix.de) | TODO | v1 ☐☑✓ | [LORE v1,0/18](https://lore.kernel.org/all/87wn3zsz5x.fsf@jogness.linutronix.de) | | 2024/02/18 | John Ogness | [wire up write_atomic() printing](https://lore.kernel.org/all/20240218185726.1994771-1-john.ogness@linutronix.de) | TODO | v2 ☐☑✓ | [LORE v2,0/26](https://lore.kernel.org/all/20240218185726.1994771-1-john.ogness@linutronix.de) | -| 2024/06/04 | John Ogness | [add threaded printing + the rest](https://lore.kernel.org/all/20240603232453.33992-1-john.ogness@linutronix.de) | [Updated Printk Rework Patches - Necessary Step For Mainlining Linux Real-Time"RT"](https://www.phoronix.com/news/Printk-Rework-v2-Linux) | v2 ☐☑✓ | [LORE v2,0/18](https://lore.kernel.org/all/20240603232453.33992-1-john.ogness@linutronix.de) | +| 2024/06/04 | John Ogness | [add threaded printing + the rest](https://lore.kernel.org/all/20240603232453.33992-1-john.ogness@linutronix.de) | [Updated Printk Rework Patches - Necessary Step For Mainlining Linux Real-Time"RT"](https://www.phoronix.com/news/Printk-Rework-v2-Linux) | v2 ☐☑✓ | [LORE v2,0/18](https://lore.kernel.org/all/20240603232453.33992-1-john.ogness@linutronix.de)
*-*-*-*-*-*-*-*
[LORE v6,0/17](https://lore.kernel.org/all/20240904120536.115780-1-john.ogness@linutronix.de) | | 2022/09/11 | Thomas Gleixner | [printk: A new approach - WIP](https://lore.kernel.org/all/20220910221947.171557773@linutronix.de) | | v1 ☐☑✓ | [LORE v1,0/29](https://lore.kernel.org/all/20220910221947.171557773@linutronix.de) | | 2023/09/16 | John Ogness | [provide nbcon base](https://lore.kernel.org/all/20230916192007.608398-1-john.ogness@linutronix.de) | [NBCON Console Patches Updated For Eventually Unblocking Real-Time Linux Kernel](https://www.phoronix.com/news/Linux-NCON-Consoles-v5) | v5 ☐☑✓ | [LORE v5,0/8](https://lore.kernel.org/all/20230916192007.608398-1-john.ogness@linutronix.de) | - # 10 KEXEC ------- @@ -926,7 +925,7 @@ Intel 编译器随后也切到 LLVM 框架, 参见 [Intel Fully Embracing LLVM F | 编号 | 应用 | 功能 | |:---:|:----:|:---:| | 1 | [Cling](https://github.com/vgvassilev/cling) | 用于这个基于 LLVM/Clang 构建的开源交互式 C++ 解释器. Cling 是作为 LLVM/Clang 的扩展实现的, 以用作利用读取 - 求值 - 打印循环 (REPL) 概念的中间人, 并依赖于实时 (JIT) 编译. [Cling 1.0 发布用于交互式 C++ 解释器](https://www.phoronix.com/news/Cling-1.0-Released) | - +| 2 | [](https://www.phoronix.com/news/AMD-AOCC-5.0-Compiler) | AMD 基于 LLVM/Clang/Flang 编译器的下游版本, 提供了一些 AMD 处理器编译优化的支持. 参见 [phoronix, 2024/10/11, AMD AOCC 5.0 Compiler Released With Zen 5 Support, New Optimizations](https://www.phoronix.com/news/AMD-AOCC-5.0-Compiler). | ## 13.15 Package BUILD diff --git a/study/kernel/00-DESCRIPTION/MEMORY_MANAGER.md b/study/kernel/00-DESCRIPTION/MEMORY_MANAGER.md index a66079c..9e003eb 100644 --- a/study/kernel/00-DESCRIPTION/MEMORY_MANAGER.md +++ b/study/kernel/00-DESCRIPTION/MEMORY_MANAGER.md @@ -747,6 +747,14 @@ MTE 实现了锁和密钥访问内存. 这样在内存访问期间, 可以在内 | 2023/07/14 | GONG, Ruiqi | [Randomized slab caches for kmalloc()](https://lore.kernel.org/all/20230714064422.3305234-1-gongruiqi@huaweicloud.com) | TODO | v5 ☐☑✓ | [LORE](https://lore.kernel.org/all/20230714064422.3305234-1-gongruiqi@huaweicloud.com) | | 2024/03/05 | Kees Cook | [slab: Introduce dedicated bucket allocator](https://lore.kernel.org/all/20240305100933.it.923-kees@kernel.org) | [Hardening the kernel against heap-spraying attacks](https://lwn.net/Articles/965837) | v2 ☐☑✓ | [LORE v2,0/9](https://lore.kernel.org/all/20240305100933.it.923-kees@kernel.org) | +### 1.8.7 GCS(Guarded Control Stack) +------- + +| 时间 | 作者 | 特性 | 描述 | 是否合入主线 | 链接 | +|:---:|:----:|:---:|:----:|:---------:|:----:| +| 2024/10/01 | Mark Brown | [arm64/gcs: Provide support for GCS in userspace](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/?id=bb9ae1a66c85eeb626864efd812c62026e126ec0) | [phoronix, 2024/10/08, Arm's Guarded Control Stack "GCS" Support Looks Like It Will Be Ready For Linux 6.13](https://www.phoronix.com/news/Arm-GCS-Prep-Linux-6.13) | v13 ☐☑✓ | [LORE v13,0/40](https://lore.kernel.org/all/20241001-arm64-gcs-v13-0-222b78d87eee@kernel.org) | + + ## 1.9 page attributes @@ -5678,6 +5686,8 @@ mcpage 有成本. 除了 THP 没有带来 TLB 的好处之外, 与 4K 基本页 [AmpereOne Performance On Linux 6.11 Kernel, 4K vs. 64K Page Size Comparison](https://www.phoronix.com/review/ampereone-64k-linux611) +[Google Making Progress On 16KB Page Size For Android](https://www.phoronix.com/news/Android-16KB-Page-Size-Progress) + # 8 进程虚拟地址空间(VMA) ------- diff --git a/study/kernel/00-DESCRIPTION/SCHEDULER.md b/study/kernel/00-DESCRIPTION/SCHEDULER.md index 0da3098..86e68b6 100644 --- a/study/kernel/00-DESCRIPTION/SCHEDULER.md +++ b/study/kernel/00-DESCRIPTION/SCHEDULER.md @@ -496,13 +496,13 @@ RT_RUNTIME_SHARE 这个机制本身是为了解决不同 CPU 上, 以及不同 |:---:|:----:|:---:| | 2013/01/29 | [Deadline servers as a realtime throttling replacement](https://lwn.net/Articles/934415) | [LinuxNews搬运工--LWN: 用 deadline server 来实现实时任务的限制!](https://blog.csdn.net/Linux_Everything/article/details/131388431), [知乎--草莓熊麦昆的翻译](https://zhuanlan.zhihu.com/p/697548424) | - +SCHED_DEADLINE server 最终于 v6.12 合入, Linux 6.12 调度的 Merge Request [`Merge tag 'sched-core-2024-09-19' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip`](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2004cef11ea072838f99bd95cefa5c8e45df0847) 首先就介绍了 SCHED_DEADLINE 服务器基础架构. SCHED_DEADLINE 服务器工作由已故的 Daniel Bristot de Oliveira 领导. 当高优先级任务垄断 CPU 周期时, SCHED_DEADLINE 服务器可以帮助解决低优先级任务(例如 SCHED_OTHER)的匮乏问题. DEADLINE 服务器能够替换和改进 RT Throttling 机制. 参见 [phoronix, 2024/09/19, Linux 6.12 Scheduler Code Adds SCHED_DEADLINE Servers & Complete EEVDF](https://www.phoronix.com/news/Linux-6.12-Scheduler). | 时间 | 作者 | 特性 | 描述 | 是否合入主线 | 链接 | |:----:|:----:|:---:|:----:|:---------:|:----:| | 2023/06/08 | Daniel Bristot de Oliveira | [sched/deadline: Introduce deadline servers](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/?id=63ba8422f876e32ee564ea95da9a7313b13ff0a1) | 如果具有较高优先级的任务 (例如 SCHED_FIFO) 独占 CPU, 则低优先级任务 (例如, SCHED_OTHER) 可能会出现饥饿. RT Throttling 是不久前引入的一种 (主要是调试) 对策, 可以用来为低优先级任务 (通常是后台类型的工作, 例如工作队列、计时器等) 保留一些 CPU 时间. 然而, 它也有自己的问题 (请参阅文档), 并且即使不需要运行优先级较低的活动, 也会无条件地限制 FIFO 任务, 这会产生不希望的影响 (也有一些机制可以解决这个问题, 但同样也有其自身的问题). 引入截止日期服务器, 为饥饿条件下的低优先级任务需求提供服务. 最后期限服务器是通过扩展 SCHED_Deadline 实现来构建的, 以允许两级调度 (即, deadline 实体成为低优先级调度实体的容器). | v3 ☐☑✓ v6.8-rc1 | [LORE v1,00/13](https://lore.kernel.org/all/20190726145409.947503076@infradead.org)
*-*-*-*-*-*-*-*
[LORE v2,0/6](https://lore.kernel.org/all/20200807095051.385985-1-juri.lelli@redhat.com)
*-*-*-*-*-*-*-*
[LORE v3,0/6](https://lore.kernel.org/all/cover.1686239016.git.bristot@kernel.org)
*-*-*-*-*-*-*-*
[LORE v5,0/7](https://lore.kernel.org/all/cover.1699095159.git.bristot@kernel.org)
*-*-*-*-*-*-*-*
[LORE v6,0/6](https://lore.kernel.org/all/cover.1712337227.git.bristot@kernel.org) | | 2024/03/12 | Joel Fernandes (Google) | [Fair scheduling deadline server fixes](https://lore.kernel.org/all/20240313012451.1693807-1-joel@joelfernandes.org) | 截止日期服务器 [SCHED_DEADLINE server infrastructure](https://lore.kernel.org/all/cover.1699095159.git.bristot@kernel.org) 允许 RT 任务在系统上安全运行, 而不是由于 RT 节流, 浪费了 RT 任务可能无法在空闲系统上执行的 CPU. 以下是我们在测试 ChromeOS 的截止日期服务器时发现的修补程序. 当我发现我的单元测试正在崩溃时, 它像滚雪球一样从 10 个补丁增加到 15 个补丁, 然后我们也看到了与 dl_timer 相关的领域中的一些崩溃! 所有这些都是固定的. 在其他几个修复程序中, 还有一个对核心调度的修复程序. 感谢您的全面审查. 我把所有的补丁都放在 Daniel 和 Peter 的补丁之上, 因为我会让他们把它压缩掉, 并适当地归因于贡献者. | v2 ☐☑✓ | [LORE 00/10](https://lore.kernel.org/all/20240216183108.1564958-1-joel@joelfernandes.org)
*-*-*-*-*-*-*-*
[LORE v2,0/15](https://lore.kernel.org/all/20240313012451.1693807-1-joel@joelfernandes.org) | -| 2023/06/08 | Daniel Bristot de Oliveira | [SCHED_DEADLINE server infrastructure](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/?id=5f6bd380c7bdbe10f7b4e8ddcceed60ce0714c6d) | 使用 deadline 服务器为公平任务提供服务. 此补丁集添加并使能了一个 fair_server deadline 实体, 它充当了 CFS 调度实体的容器, 可用于解决优先级较高时的饥饿问题. | v3 ☐☑✓ v6.12-rc1 | [LORE v6,0/6](https://lore.kernel.org/all/cover.1712337227.git.bristot@kernel.org)
*-*-*-*-*-*-*-*
[2024/05/27, LORE v9,0/9](https://lore.kernel.org/all/cover.1716811043.git.bristot@kernel.org) | +| 2023/06/08 | Daniel Bristot de Oliveira | [SCHED_DEADLINE server infrastructure](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/?id=cea5a3472ac43f18590e1bd6b842f808347a810c) | 使用 deadline 服务器为公平任务提供服务. 此补丁集添加并使能了一个 fair_server deadline 实体, 它充当了 CFS 调度实体的容器, 可用于解决优先级较高时的饥饿问题. | v3 ☐☑✓ v6.12-rc1 | [LORE v6,0/6](https://lore.kernel.org/all/cover.1712337227.git.bristot@kernel.org)
*-*-*-*-*-*-*-*
[2024/05/27, LORE v9,0/9](https://lore.kernel.org/all/cover.1716811043.git.bristot@kernel.org) | ## 1.4 其他一些调度类的尝试 @@ -715,7 +715,7 @@ b37e67a6c648 ck: sched: introduce per-cgroup identity | 时间 | 作者 | 特性 | 描述 | 是否合入主线 | 链接 | |:---:|:----:|:---:|:----:|:---------:|:----:| | 2023/07/05 | Laurent Dufour | [Introduce SMT level and add PowerPC support](https://lore.kernel.org/all/20230705145143.40545-1-ldufour@linux.ibm.com) | [Partial SMT Enablement Support Lands For Linux 6.6](https://www.phoronix.com/news/Linux-6.6-Partial-SMT-Enable) | v4 ☐☑✓ | [LORE v4,0/10](https://lore.kernel.org/all/20230705145143.40545-1-ldufour@linux.ibm.com) | -| 2023/09/19 | Yicong Yang | [arch_topology: Support SMT control on arm64](https://lore.kernel.org/all/20230919123319.23785-1-yangyicong@huawei.com) | [HiSilicon Posts SMT Run-Time Control Patches For ARM64 Linux](https://www.phoronix.com/news/Linux-ARM64-Run-Time-SMT-Switch) | v1 ☐☑✓ | [LORE](https://lore.kernel.org/all/20230919123319.23785-1-yangyicong@huawei.com) | +| 2024/10/15 | Yicong Yang | [Support SMT control on arm64](https://lore.kernel.org/all/20230919123319.23785-1-yangyicong@huawei.com) | [HiSilicon Posts SMT Run-Time Control Patches For ARM64 Linux](https://www.phoronix.com/news/Linux-ARM64-Run-Time-SMT-Switch) 以及 [phoronix, 2024/10/15, ARM64 SMT Control Patches Updated For The Linux Kernel](https://www.phoronix.com/news/ARM64-SMT-Controls-Linux) | v1 ☐☑✓ | [LORE](https://lore.kernel.org/all/20230919123319.23785-1-yangyicong@huawei.com)
*-*-*-*-*-*-*-*
[2024/10/15, LORE v6,0/4](https://lore.kernel.org/lkml/20241015021841.35713-1-yangyicong@huawei.com) | @@ -6898,11 +6898,10 @@ Roman Gushchin 在邮件列表发起了 BPF 对调度器的潜在应用的讨论 作者在 [github--sched-ext/scx](https://github.com/sched-ext/scx)提供了 sched_ext 的工具集和开发套件, 并提供了一些基于 c/rust 的用户态调度程序. 以及一个用户态服务用来管理这些用户态调度程序. 参见 LWN 报道 [Improving performance with SCHED_EXT and IOCost](https://lwn.net/Articles/966618). 2024 年 01 月, Ubuntu/Canonical 的工程师 Andrea Righi, 在 X(Twitter) 上发文谈到, 他利用圣诞假期通过 sched_ext 实现了能够在运行时加载的 Rust 调度器 scx_rustland, 他在自己的博客中展示了这个调度器的巨大潜力和希望, 在某些负载(例如游戏)下性能甚至可以超越 Linux 内核默认的 EEVDF 调度器. [Righi: Writing a scheduler for Linux in Rust that runs in user-space](https://arighi.blogspot.com/2024/02/writing-scheduler-for-linux-in-rust.html), 参见 LWN 报道 [Righi: Writing a scheduler for Linux in Rust that runs in user-space](https://lwn.net/Articles/962897), phoronix 的报道 [Rust-Written Linux Scheduler Showing Promising Results For Gaming Performance](https://www.phoronix.com/news/Rust-Linux-Scheduler-Experiment) 和 [Ubuntu Blog Talks Up Rust Schedulers, Potential For Micro-Kernel Design Future](https://www.phoronix.com/news/Ubuntu-Rust-Scheduler-Micro), 以及 Ubuntu blog [Crafting new Linux schedulers with sched-ext, Rust and Ubuntu](https://ubuntu.com//blog/crafting-new-linux-schedulers-with-sched-ext-rust-and-ubuntu). scx_rustland 调度器的瓶颈是内核和用户空间之间通信的开销. 为了解决这个问题, 同年 8 月份, Andrea Righi 在 eBPF 中完全实现了 scx_rustland, 讲新的调度器命名为 scx_bpfland. scx_bpfland 调度器采用与 scx_rustland 相同的逻辑, 但没有内核/用户空间的通信开销. Andrea 已经运行了一些基准测试, 新的 bpfland 代码显示出非常有希望的结果. PostgreSQL 快 30~39%, FFmpeg 快几个百分点, nginx 快 8% 左右, 等等. 参见 [phoronix, 2024/08/10, Reimplementing A Linux Rust Scheduler In eBPF Shows Very Promising Results](https://www.phoronix.com/news/Linux-Rust-Sched-To-eBPF) 以及作者博客 [blog, 2024/08/10, Reimplementing my Linux Rust Scheduler In eBPF](https://arighi.blogspot.com/2024/08/re-implementing-my-linux-rust-scheduler.html). -. Changwoo Min 和 Igalia 昨天在北美开源峰会上发表了关于为 Linux 游戏优化内核调度器的演讲, [Optimizing Scheduler for Linux Gaming - Changwoo Min, Igalia](https://ossna2024.sched.com/event/1aBOT/optimizing-scheduler-for-linux-gaming-changwoo-min-igalia?iframe=no&w=100%&sidebar=yes&bg=no), 提出延迟关键感知虚拟截止时间(LAVD) 调度器. 这个[使用 Rust 基于 sched_ext 编写](https://crates.io/crates/scx_lavd/versions)的基于截止日期的调度器已经显示出可喜的结果. 在 Igalia 在基于 Linux 6.9-rc1的内核上进行的测试中, LAVD调度器在平均FPS和1%的低帧速率下都显示出与EEVDF更好或相似的性能. 参见 phoronix 报道 [Rust-Written LAVD Kernel Scheduler Shows Promising Results For Linux Gaming](https://www.phoronix.com/news/LAVD-Scheduler-Linux-Gaming). -随后作者发布了 sched_ext 的 v6 版本 [Another push for sched_ext](https://lwn.net/Articles/972710), BPF 的工具集 `sched_ext/ravg[_impl].BPF.h` 和 `ravg.read.rs.h` 中的运行平均实现来跟踪负载度量. 以前, 用户空间部分迭代所有任务来计算负载度量并做出 LB 决策. 现在, 高级 LB 决策是通过简单地读取每个域的负载平均值来做出的, 而 Picking 迁移目标任务只访问推送域中固定数量的最近活动任务的负载度量. 这大大减少了 CPU 开销, 并使 rust 的可扩展性大大提高. +随后作者发布了 sched_ext 的 v6 版本 [Another push for sched_ext](https://lwn.net/Articles/972710), BPF 的工具集 `sched_ext/ravg[_impl].BPF.h` 和 `ravg.read.rs.h` 中的运行平均实现来跟踪负载度量. 以前, 用户空间部分迭代所有任务来计算负载度量并做出 LB 决策. 现在, 高级 LB 决策是通过简单地读取每个域的负载平均值来做出的, 而 Picking 迁移目标任务只访问推送域中固定数量的最近活动任务的负载度量. 这大大减少了 CPU 开销, 并使 rust 的可扩展性大大提高. LSFMMBPF 2024 上对 sched_ext 进行了讨论 [LWN, 2024/05/23, LSFMMBPF-2024, What's scheduled for sched_ext](https://lwn.net/Articles/974387). @@ -6925,12 +6924,12 @@ LSFMMBPF 2024 上对 sched_ext 进行了讨论 [LWN, 2024/05/23, LSFMMBPF-2024, | 时间 | 作者 | 特性 | 描述 | 是否合入主线 | 链接 | |:----:|:----:|:---:|:----:|:---------:|:----:| | 2021/09/15 | Roman Gushchin | [Scheduler BPF](https://www.phoronix.com/scan.php?page=news_item&px=Linux-BPF-Scheduler) | NA | RFC ☐ | [PatchWork rfc,0/6](https://patchwork.kernel.org/project/netdevbpf/cover/20210916162451.709260-1-guro@fb.com)
*-*-*-*-*-*-*-*
[LPC 2021](https://linuxplumbersconf.org/event/11/contributions/954)
*-*-*-*-*-*-*-*
[LKML](https://lkml.org/lkml/2021/9/16/1049), [LWN](https://lwn.net/Articles/869433), [LWN](https://lwn.net/Articles/873244) | -| 2022/11/29 | Tejun Heo | [sched: Implement BPF extensible scheduler class](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/?id=513ed0c7ccc103c2ff668154854ec410729a3170) | 随后 FaceBook 进一步扩展, 引入 sched_ext 模块, 使用 eBPF 对调度器进行可编程重构. [Experimental Patches Allow eBPF To Extend The Linux Kernel's Scheduler](https://www.phoronix.com/news/RFC-eBPF-Linux-Scheduler), [The BPF extensible scheduler class](https://lwn.net/Articles/916291), [The extensible scheduler class](https://lwn.net/Articles/922405/), [Patches Updated For Hooking eBPF Programs Into The Linux Kernel Scheduler](https://www.phoronix.com/news/Linux-Scheduler-eBPF-v2-sched). 以及 [Extensible scheduler class rejected](https://lwn.net/Articles/939332) | v1 ☐☑✓ | [LORE](https://lore.kernel.org/all/20221130082313.3241517-1-tj@kernel.org)
*-*-*-*-*-*-*-*
[LORE v2,00/30](https://lore.kernel.org/lkml/20230128001639.3510083-1-tj@kernel.org)
*-*-*-*-*-*-*-*
[2023/11/11, LORE v5](https://lore.kernel.org/all/20231111024835.2164816-1-tj@kernel.org)
*-*-*-*-*-*-*-*
[2024/05/11, LORE v6,00/39](https://lore.kernel.org/all/20240501151312.635565-1-tj@kernel.org)
*-*-*-*-*-*-*-*
[2024/06/18, LORE v7,00/30](https://lore.kernel.org/all/20240618212056.2833381-1-tj@kernel.org) | +| 2024/08/14 | Peter Zijlstra | [sched: Prepare for sched_ext](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/?id=b2d70222dbf2a2ff7a972a685d249a5d75afa87f) | 为了适应 sched_ext 的需求, 这个补丁集进行了一些必要的重构
1. 重新排列了公平的 pick_task() 函数, 使它们的状态不变, 以便在选择 (和取消排队/出队) 延迟任务后可以轻松重新启动.2. 它需要在上下文切换时拥有下一个任务的最终回调, 以便判断切换是否会离开调度类 (sched_class). [sched: Use set_next_task(.first) where required](https://lore.kernel.org/lkml/20240813224015.614146342@infradead.org/)

3. 调整 put_prev_task() 的位置: 将 (最终)put_prev_task() 推到 pick_task() 之后. 这样在最终的回调中可以确保拥有下一个任务. [sched: Rework pick_next_task()](https://lore.kernel.org/lkml/20240813224016.051225657@infradead.org). 参见 [phoronix, 2024/08/14, New Linux Kernel Patches Better Prepare For sched_ext](https://www.phoronix.com/news/Linux-sched_ext-Prep) | v1 ☐☑✓ v6.12-rc1 | [LORE v1,0/9](https://lore.kernel.org/all/20240813222548.049744955@infradead.org) | +| 2022/11/29 | Tejun Heo | [sched: Implement BPF extensible scheduler class](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/?id=513ed0c7ccc103c2ff668154854ec410729a3170) | 随后 FaceBook 进一步扩展, 引入 sched_ext 模块, 使用 eBPF 对调度器进行可编程重构. [Experimental Patches Allow eBPF To Extend The Linux Kernel's Scheduler](https://www.phoronix.com/news/RFC-eBPF-Linux-Scheduler), [The BPF extensible scheduler class](https://lwn.net/Articles/916291), [The extensible scheduler class](https://lwn.net/Articles/922405/), [Patches Updated For Hooking eBPF Programs Into The Linux Kernel Scheduler](https://www.phoronix.com/news/Linux-Scheduler-eBPF-v2-sched). 以及 [Extensible scheduler class rejected](https://lwn.net/Articles/939332) | v1 ☐☑✓ v6.12-rc1 | [LORE](https://lore.kernel.org/all/20221130082313.3241517-1-tj@kernel.org)
*-*-*-*-*-*-*-*
[LORE v2,00/30](https://lore.kernel.org/lkml/20230128001639.3510083-1-tj@kernel.org)
*-*-*-*-*-*-*-*
[2023/11/11, LORE v5](https://lore.kernel.org/all/20231111024835.2164816-1-tj@kernel.org)
*-*-*-*-*-*-*-*
[2024/05/11, LORE v6,00/39](https://lore.kernel.org/all/20240501151312.635565-1-tj@kernel.org)
*-*-*-*-*-*-*-*
[2024/06/18, LORE v7,00/30](https://lore.kernel.org/all/20240618212056.2833381-1-tj@kernel.org) | | 2024/07/08 | Hongyan Xia | [sched/ext: Add BPF function to fetch rq](https://lore.kernel.org/all/7359b5cd17d56837bc15f4883b21837163c51d37.1720441953.git.hongyan.xia2@arm.com) | rq 包含许多有用的字段, 可用于执行自定义调度程序. 例如, 可以使用各种时钟信号(如 clock_task 和 clock_pelt)来跟踪负载. 它还包含其他 sched_classes 中的统计信息, 这些信息对于在 ext 中驱动调度决策非常有用. | v1 ☐☑✓ | [LORE](https://lore.kernel.org/all/7359b5cd17d56837bc15f4883b21837163c51d37.1720441953.git.hongyan.xia2@arm.com) | | 2024/06/18 | Tejun Heo | [sched_ext: Integrate with schedutil](https://lore.kernel.org/all/20240619031250.2936087-1-tj@kernel.org) | sched_ext 目前没有与 schedutil 集成. 当 schedutil 作为调频 GOVERNOR 时, 频率不受控制. 本补丁集将 sched_ext 与 schedutil 集成, 以便 BPF 调度程序 调度器时可以控制 CPU 频率. 实现 sugov_get_util() 更新, 以添加 BPF 调度器提供的利用率. | v1 ☐☑✓ | [LORE](https://lore.kernel.org/all/20240619031250.2936087-1-tj@kernel.org) | | 2024/07/10 | K Prateek Nayak | [sched/core: Fixes and enhancements around spurious need_resched() and idle load balancing](https://lore.kernel.org/all/20240710090210.41856-1-kprateek.nayak@amd.com) | TODO | v1 ☐☑✓ | [LORE v1,0/3](https://lore.kernel.org/all/20240710090210.41856-1-kprateek.nayak@amd.com) | | 2024/07/19 | Carlos Bilbao | [docs: scheduler: Start documenting the EEVDF scheduler](https://lore.kernel.org/all/20240720002207.444286-1-carlos.bilbao.osdev@gmail.com) | Carlos Bilbao 在更新 CFS(Completely Fair Scheduler) 文档的过程中意识到, 目前还没有指向 EEVDF 文档的资料, 因此他开始了这项工作. | v3 ☐☑✓ | [LORE v3,0/1](https://lore.kernel.org/all/20240720002207.444286-1-carlos.bilbao.osdev@gmail.com) | -| 2024/08/14 | Peter Zijlstra | [sched: Prepare for sched_ext](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/?id=b2d70222dbf2a2ff7a972a685d249a5d75afa87f) | 为了适应 sched_ext 的需求, 这个补丁集进行了一些必要的重构
1. 重新排列了公平的 pick_task() 函数, 使它们的状态不变, 以便在选择 (和取消排队/出队) 延迟任务后可以轻松重新启动.2. 它需要在上下文切换时拥有下一个任务的最终回调, 以便判断切换是否会离开调度类 (sched_class). [sched: Use set_next_task(.first) where required](https://lore.kernel.org/lkml/20240813224015.614146342@infradead.org/)

3. 调整 put_prev_task() 的位置: 将 (最终)put_prev_task() 推到 pick_task() 之后. 这样在最终的回调中可以确保拥有下一个任务. [sched: Rework pick_next_task()](https://lore.kernel.org/lkml/20240813224016.051225657@infradead.org). 参见 [phoronix, 2024/08/14, New Linux Kernel Patches Better Prepare For sched_ext](https://www.phoronix.com/news/Linux-sched_ext-Prep) | v1 ☐☑✓ v6.12-rc1 | [LORE v1,0/9](https://lore.kernel.org/all/20240813222548.049744955@infradead.org) | | 2024/08/26 | Tejun Heo | [sched_ext: Add cgroup support](https://lore.kernel.org/all/20240826225822.791578-1-tj@kernel.org) | TODO | v2 ☐☑✓ | [2024/08/08, LORE v1, 0/7](https://lore.kernel.org/all/20240808002550.731248-1-tj@kernel.org)
*-*-*-*-*-*-*-*
[2024/08/26, LORE v2, 0/5](https://lore.kernel.org/all/20240826225822.791578-1-tj@kernel.org) | | 2024/09/03 | Tejun Heo | [sched_ext: Apply pick_next_task() updates and remove switch_class()](https://lore.kernel.org/all/20240904080326.1132275-1-tj@kernel.org) | 这个补丁系列针对 Linux 内核调度器(scheduler)的扩展(sched_ext)进行了更新, 以适应内核主分支中对 pick_next_task() 函数的更新, 并移除了 switch_class() 函数. 以下是补丁系列的主要工作内容:
1. 更新 pick_next_task(): 补丁系列替换了 pick_next_task_scx() 函数, 引入了新的 pick_task_scx() 函数. 新函数不需要当前任务已经被排入队列, 并且能够不依赖于当前任务的状态来确定是选择当前任务还是本地直接队列(DSQ)顶部的任务. 统一常规和核心调度器的任务选择路径: 通过这次更新, 常规和基于核心的调度器的任务选择路径被统一, 简化了代码结构.
2. 移除 switch_class(): 在更新后, sched_class->switch_class() 不再被使用, 并从代码中移除. 这意味着调度器扩展不再需要这个接口.
3. 对 BPF 调度器的影响: 这次更改对基于 BPF(Berkeley Packet Filter)的调度器造成了两个微妙的 API 变化, 但这些变化是期望的, 并且现有的所有调度器都应该能够适应这些变化. | v1 ☐☑✓ | [LORE](https://lore.kernel.org/all/20240904080326.1132275-1-tj@kernel.org) | @@ -7232,6 +7231,8 @@ ECRTS 2020(32nd Euromicro Conference on Real-Time Systems) 上 Daniel 等人发 [System76 Scheduler v1.1 发布](https://www.phoronix.com/scan.php?page=news_item&px=System76-Scheduler-1.1) +[System76 Pop!_OS Scheduler Now Detects Hyprland, Lands Various Fixes](https://www.phoronix.com/news/PopOS-Scheduler-2.0.2) + #### 12.4.3.2 Ananicy ------- diff --git a/study/kernel/00-DESCRIPTION/TEST.md b/study/kernel/00-DESCRIPTION/TEST.md index 789e3ef..10b059c 100644 --- a/study/kernel/00-DESCRIPTION/TEST.md +++ b/study/kernel/00-DESCRIPTION/TEST.md @@ -1,35 +1,6 @@ -这个补丁是由 Athira Rajeev 提交的, 标题为 "[PATCH V8 00/15] Add data type profiling support for powerpc". 这个补丁集(总共包含15个补丁)的主要目的是为 PowerPC 架构添加数据类型剖析(data type profiling)的支持. +AMD 异构内核设计和硬件反馈接口 (HFI) 为调度程序提供行为分类和动态更新的排名表, 供调度程序在为任务选择内核时使用. -补丁集背景 -在补丁集中提到, 之前由 Namhyung Kim 提交的一系列补丁已经为 perf 工具引入了数据类型剖析的基本支持. 这些补丁使 perf 能够关联性能监控单元(PMU)的样本到它们所引用的数据类型, 利用 DWARF 调试信息来实现这一点. 目前, 这种支持已经在 x86 架构上可用, 可以通过 perf report 或 perf annotate 命令来查看数据类型信息. +线程在运行时被分类为枚举类. 目前, 该驱动程序支持 3 个类(0 到 2). 这些类表示可能受益于特殊调度行为的线程性能/功耗特征. 实时线程分类由操作系统使用, 用于通知计划程序应将线程放置在何处以获得最佳性能或能效. -补丁集内容 -Athira Rajeev 的补丁集旨在为 PowerPC 架构添加类似的支持. 以下是该补丁集的主要更改点: - -PowerPC 指令表更新: 添加了一个 PowerPC 指令助记符表, 用于将负载/存储指令与移动操作关联起来, 从而识别指令是否涉及内存访问. -获取寄存器编号和偏移量: 为了从给定的指令中获取寄存器编号和访问偏移量, 代码使用了 struct arch 中的 objump 字段. 为 PowerPC 添加了相应的条目. -获取寄存器编号函数: 实现了一个 get_arch_regnum 函数, 可以从寄存器名称字符串中返回寄存器编号. -解析原始指令 -为了更准确地解析 PowerPC 指令, 补丁集采取了以下步骤: - -使用原始指令: 补丁集支持直接使用原始指令而非解析后的指令名称. 这样可以通过宏来提取指令的操作码和寄存器字段. -示例: 例如, 使用 --show-raw-insn 选项时, objdump 会给出原始指令的十六进制表示, 如 "38 01 81 e8", 这对应于 "ld r4,312(r1)" 指令. -避免重复使用 objdump: 补丁集避免了重复使用 objdump 来读取原始指令, 而是直接从动态共享对象 (DSO) 中读取二进制代码. -具体补丁概述 -Patch 4: 添加了支持捕捉和解析 PowerPC 原始指令的功能, 使用 dso__data_read_offset 实用程序. -Patch 5: 添加了 disasm_line__parse 函数来解析 PowerPC 的原始指令. -Patch 6: 更新了寄存器提取函数的参数, 以支持 PowerPC 上的原始指令. -Patch 7: 更新了 ins__find 函数来携带原始指令, 并为 PowerPC 添加了内存指令的解析回调. -Patch 8: 支持识别具有操作码 31 的 PowerPC 内存指令. -Patch 9: 添加更多指令来支持 PowerPC 上的指令跟踪. -Patch 10 和 11: 处理 PowerPC 上的指令跟踪. -Patch 12、13 和 14: 添加支持使用 libcapstone 库在 PowerPC 上解析指令. -Patch 15: 处理 perf annotate 的 insn-stat 选项. -测试结果 -补丁集作者提供了测试结果, 其中展示了使用 perf annotate --data-type --insn-stat 命令的结果. 结果显示有大约 43.7% 的指令被正确解析, 而 56.3% 的指令未能成功解析. 作者指出还有大约 25% 的未知指令没有得到处理. - -后续计划 -作者提到这个补丁集还没有在 PowerPC32 架构上进行过测试. 下一步的增强计划包括处理剩余的未知指令, 并覆盖 PowerPC32 的变化, 具体取决于测试的结果. 此外, 关于全局寄存器的支持将会在解决完 Namhyung Kim 的评论后发布后续补丁. - -总结 -这个补丁集为 PowerPC 架构添加了数据类型剖析的支持, 并且引入了一系列技术来更准确地解析 PowerPC 指令, 以便更好地理解内存访问行为. +线程分类有助于从排名表中选择 CPU, 该表从两个维度描述了每个分类的效率和性能排名. +排名表提供的排名数据是 0 到 255 之间的数字, 其中性能值越高表示性能能力越高, 效率越高表示效率越高. 所有 CPU 内核都分为不同的类 ID. 在每个类排名中, 核心可能具有不同的排名值. 因此, 从每个分类 ID 中选取允许调度程序选择最佳核心, 同时将线程分类到指定的工作负载类中. 内核排名表提供了 PCCT 子空间类型 4 共享内存, 其中包括内存基址和长度.