Linux Kernel Roadmap
From Confusion to Insight: An Engineering-Level Linux Kernel Roadmap
Part 1: Kernel Worldview and Engineering Mental Model
Chapter 1: Linux Kernel Resource Management Model
- 1.1 The Kernel as Resource Manager(按 CPU、内存、I/O、设备、网络定位内核管理的资源边界)
- 1.2 User Space vs Kernel Space(区分权限边界、隔离边界与执行边界)
- 1.3 Monolithic Kernel, Modules, and Extensibility(分析 Linux 宏内核结构与模块扩展之间的边界)
- 1.4 The Kernel as a Collection of Subsystems(画出调度、内存、文件系统、网络、驱动之间的协作路径)
- 1.5 Engineering Insight: Stop Reading the Kernel as One Giant Program(用“对象、路径、状态机与回调”拆解一个内核入口)
Chapter 2: The Programmers Confusion About the Kernel
- 2.1 Kernel Source Reading Difficulty(分析源码入口分散、宏展开和调用链变深的原因)
- 2.2 Cross-Subsystem Operation Paths(追踪
read、send、fork穿过多个子系统的路径) - 2.3 Runtime Context Dependent Kernel Behavior(区分进程上下文、中断上下文和持锁状态对同一段代码的约束)
- 2.4 Kernel Bug Reproduction Difficulty(排查并发、时序、硬件状态和配置差异造成的复现失败)
- 2.5 Engineering Insight: Ask “Which Path?” Before Asking “Which File?”(判断确定执行路径、数据路径和状态变化,再定位源码文件)
Chapter 3: Core Kernel Design Forces
- 3.1 Performance vs Safety(分析速度、隔离和检查成本之间的内核设计权衡)
- 3.2 Generality vs Hardware Specificity(追踪通用抽象如何覆盖 CPU、磁盘、网卡、总线等不同硬件)
- 3.3 Latency vs Throughput(判断调度、网络、I/O 中延迟优先和吞吐优先的设计冲突)
- 3.4 Stability vs Evolution(梳理用户态 ABI 稳定性与内核内部持续重构之间的关系)
- 3.5 Engineering Insight: Every Kernel Design Is a Tradeoff Under Pressure(分析内核在性能、兼容、硬件和社区维护之间的工程平衡)
Chapter 4: The Four Great Paths Through the Kernel
- 4.1 The Execution Path(追踪程序如何变成 task,如何进入调度器并获得 CPU 时间)
- 4.2 The Memory Path(追踪虚拟地址如何经过页表、缺页异常、分配器映射到物理页)
- 4.3 The I/O Path(追踪文件描述符如何连接 VFS、页缓存、块层、驱动和存储设备)
- 4.4 The Network Path(追踪 socket、
sk_buff、协议栈、队列、网卡驱动如何组成收发路径) - 4.5 Engineering Insight: Kernel Mastery Begins with Path Thinking(用路径图追踪请求穿过系统的关键节点)
Chapter 5: How This Handbook Should Be Read
- 5.1 Sequential Reading vs Reference Reading(选择顺序阅读或按主题查阅的使用方式)
- 5.2 From Mechanism to Source Code(把每个机制落到结构体、函数、回调表和调用链)
- 5.3 From Source Code to Observability(用
/proc、sysfs、tracefs、ftrace、perf验证源码阅读后的行为判断) - 5.4 From Bug to Insight(通过真实故障分析为何内核必须这样设计)
- 5.5 Engineering Insight: Learn the Kernel by Proving It Runs That Way(用运行时证据验证机制确实按该路径工作)
Part 2: Kernel Source Tree and Code Navigation
Chapter 6: The Shape of the Kernel Source Tree
- 6.1 Top-Level Directories and Their Responsibilities(定位
kernel/、mm/、fs/、net/、drivers/、arch/等顶层目录的职责边界) - 6.2 Architecture-Independent vs Architecture-Specific Code(区分通用内核逻辑与
arch/下的架构相关实现) - 6.3 Header Files and Interface Boundaries(区分
include/linux/、include/uapi/、arch/*/include/的接口层级) - 6.4 Documentation as a Source Code Map(使用
Documentation/建立源码阅读地图) - 6.5 Engineering Insight: Directory Names Mark Subsystem Boundaries(判断源码目录代表工程边界,并据此区分目录边界、学习顺序和调用顺序)
Chapter 7: Finding Entry Points in a Huge Codebase
- 7.1 From System Call Name to Kernel Implementation(从用户态系统调用名称追踪到 syscall 表、入口汇编和内核实现函数)
- 7.2 From Driver Probe to Runtime Operation(从驱动
probe入口追踪到设备初始化、资源申请和操作回调) - 7.3 From Kernel Log to Source Location(根据
dmesg、Oops、WARN、panic 日志反查源码位置) - 7.4 From Tracepoint to Runtime Path(通过 tracepoint、ftrace、perf 先观察运行路径,再回到源码验证)
- 7.5 Engineering Insight: Runtime Evidence Gives You the First Clue(根据运行时证据定位巨大代码库中的第一条线索)
Chapter 8: Reading Kernel Data Structures
- 8.1 Structs as Kernel Object Models(把结构体看作内核对象模型,例如
task_struct、file、inode、sk_buff) - 8.2 Embedded Structures and
container_of(追踪结构体嵌入和container_of如何把成员反向定位到宿主对象) - 8.3 Intrusive Lists, Trees, Hash Tables, and XArray(阅读
list_head、红黑树、哈希链表、XArray 等通用数据结构) - 8.4 Function Pointers and Operation Tables(分析
file_operations、net_device_ops、address_space_operations这类回调表) - 8.5 Engineering Insight: The Kernel Builds Object Systems with C(用 C 的结构体、嵌入、回调和生命周期规则拆解内核对象系统)
Chapter 9: Following Call Chains with State and Context
- 9.1 Direct Calls vs Indirect Calls(区分普通函数调用、函数指针回调、静态分支和间接分发)
- 9.2 Fast Paths and Slow Paths(区分 fast path、slow path、fallback path 的触发条件)
- 9.3 State-Dependent Execution Paths(追踪同一调用链如何被锁状态、上下文、配置选项、硬件能力改变)
- 9.4 Error Paths and
gotoUnwind(阅读资源申请失败后的错误回滚路径,并判断释放顺序和部分初始化状态) - 9.5 Engineering Insight: State Turns a Call Chain into a Mechanism(判断调用链如何结合对象状态、上下文和配置条件,形成完整机制)
Chapter 10: Building a Personal Kernel Reading Workflow
- 10.1
grep,ripgrep,ctags,cscope, and LSP(建立本地源码检索和跳转工具链) - 10.2 Code Browser and Web-Based Navigation(使用在线源码浏览器、交叉引用工具和 Git 历史辅助阅读)
- 10.3 Reading with Documentation and Commit History(结合官方文档、提交记录和补丁讨论追溯设计动机)
- 10.4 Building Source Maps for Subsystems(为每个子系统整理入口函数、核心结构体、回调表和关键路径)
- 10.5 Engineering Insight: Reading Kernel Code Is Reverse Engineering a Living System(把内核阅读转化为逆向一个运行中工程系统的过程)
Part 3: Kernel Code Grammar, Core APIs, and C Runtime Constraints
Chapter 11: Kernel C Runtime Constraints
- 11.1 No libc, No User-Space Runtime(检查内核代码缺少普通用户态运行时后带来的约束)
- 11.2 GNU C Dialect and Kernel-Specific Extensions(追踪 GNU C11 方言、编译器扩展、内核伪关键字和属性标注如何影响代码语义)
- 11.3 Execution Context Determines What Code May Do(判断进程上下文、中断上下文、软中断上下文、持锁状态决定代码能否睡眠、分配内存或访问用户空间)
- 11.4 Kernel Pointers Carry Address Space Semantics(区分普通内核指针、
__user指针、__iomem指针、错误指针和物理地址) - 11.5 Engineering Insight: Kernel C Is C Under Operational Constraints(识别内核 C 受上下文、权限、并发和硬件约束的代码点)
Chapter 12: Core Kernel Data Structures
- 12.1
list_headand Intrusive Lists(追踪侵入式链表如何把节点嵌入对象内部,并成为内核对象集合的基础结构) - 12.2
hlist,rbtree, XArray, IDR, and IDA(区分哈希链表、红黑树、XArray、IDR/IDA 在索引、查找和 ID 分配中的不同用途) - 12.3
kref,refcount_t, and Lifetime Safety(通过引用计数表达对象所有权、共享关系和释放时机) - 12.4 Wait Queues, Completions, and Kernel Synchronization Helpers(追踪等待队列、完成量、睡眠唤醒机制如何支撑异步协作)
- 12.5 Engineering Insight: Generic Data Structures Become Subsystem Language(把通用数据结构作为各子系统组织对象和状态的共同语言来阅读)
Chapter 13: Kernel Error Handling and Return Conventions
- 13.1 Negative
errnoand Error Propagation(追踪内核为何使用负错误码,以及错误如何沿调用链向上传播) - 13.2
ERR_PTR,IS_ERR, andPTR_ERR(追踪指针返回值如何编码错误,以及这种约定如何减少额外输出参数) - 13.3 Resource Acquisition and Cleanup Order(判断资源申请顺序决定释放顺序,错误路径必须处理部分初始化状态)
- 13.4
goto-Based Error Unwinding(追踪goto在内核中如何用于集中释放资源和表达错误回滚阶段) - 13.5 Engineering Insight: Error Paths Are First-Class Kernel Code(检查失败路径是否被当作核心逻辑设计)
Chapter 14: Kernel Logging and Diagnostics Grammar
- 14.1
printkand Kernel Log Levels(梳理printk、日志级别、ring buffer 和控制台输出之间的关系) - 14.2
pr_debug, Dynamic Debug, and Rate Limiting(追踪调试日志如何按文件、模块、调用点动态打开,并通过 rate limiting 控制高频日志成本) - 14.3
WARN,BUG,panic, and Failure Severity(区分可恢复异常、严重一致性错误和必须终止系统的失败) - 14.4 Stack Traces, Symbols, and Call Site Evidence(通过调用栈、符号解析、偏移地址和源码位置定位问题发生路径)
- 14.5 Engineering Insight: Logging Is a Runtime Control Surface(把内核日志当作运行时诊断、故障分级和行为证据来使用)
Chapter 15: Coding Style, Review Expectations, and Maintainability
- 15.1 Kernel Coding Style as a Maintenance Contract(分析内核代码风格为何是长期维护和社区评审的协作契约)
- 15.2 Small Patches, Clear Diffs, and Reviewable Change Units(分析内核补丁为何强调小而清晰,并把重构、功能和格式修改拆成可审查变更单元)
- 15.3 Kernel-Doc, Comments, and API Documentation(追踪内核注释如何服务 API 使用者、维护者和未来修改者)
- 15.4 Keeping Critical Path Code Explicit(判断关键路径代码为何强调明确、可验证、可维护,并降低炫技式抽象)
- 15.5 Engineering Insight: Maintainability Is a Kernel Performance Feature(把可维护性纳入长期演进、性能稳定和缺陷控制的判断)
Part 4: Kconfig, Kbuild, Modules, and Kernel Images
Chapter 16: Kernel Configuration with Kconfig
- 16.1
CONFIG_*Options and Build-Time Control Surface(分析CONFIG_*对编译单元、数据结构字段、代码路径和运行时能力的影响) - 16.2
menuconfig,defconfig,oldconfig, andlocalmodconfig(选择合适配置入口,并判断它适用于发行版内核、嵌入式内核、最小化内核还是本机裁剪内核) - 16.3 Tristate Logic: Built-In, Module, and Disabled(追踪
y/m/n三态配置如何决定代码被编进内核、编成模块或完全排除) - 16.4 Dependencies,
select,imply, and Hidden Constraints(追踪 Kconfig 依赖关系、反向选择和隐式约束如何影响最终.config) - 16.5 Engineering Insight: Kernel Behavior Often Starts at Configuration Time(判断很多内核行为取决于配置阶段是否被编进目标内核,而源码存在只说明可能性)
Chapter 17: Kernel Build System with Kbuild
- 17.1 The Top-Level Makefile and Recursive Build Model(追踪顶层 Makefile 如何根据配置和架构 Makefile 组织整个内核构建)
- 17.2 Built-In Objects, Modules, and Directory Descent(追踪
obj-y、obj-m、子目录递归和链接顺序如何决定代码进入内核的方式) - 17.3 Generated Headers,
autoconf.h, and Build-Time Metadata(追踪构建过程中自动生成的配置头文件和元数据如何被源码引用) - 17.4 Symbol Export,
Module.symvers, and Dependency Resolution(梳理导出符号、模块版本、外部模块依赖和符号解析之间的关系) - 17.5 Engineering Insight: A Kernel Build Is a Dependency Graph of Features(梳理内核构建是由配置、架构、符号、目录和依赖共同形成的特性图)
Chapter 18: Loadable Kernel Modules
- 18.1 Module Init, Exit, and Object Lifetime(分析模块加载时的初始化入口、卸载时的清理路径和模块对象生命周期)
- 18.2
insmod,modprobe,lsmod, and Module Dependency Handling(区分直接插入模块、按依赖加载模块、查看模块状态和自动解析依赖的工作方式) - 18.3 Module Parameters and Runtime Customization(追踪模块参数如何把一部分行为从编译期移动到加载期或运行期)
- 18.4 Built-In Code vs Loadable Modules(比较内建代码和可加载模块在启动顺序、符号可见性、调试、部署和安全边界上的差异)
- 18.5 Engineering Insight: Modules Are Runtime Extension Points with Kernel-Level Risk(判断模块让内核可扩展,但它们运行在内核态,错误会直接影响整个系统)
Chapter 19: Kernel Images, vmlinux, bzImage, and initramfs
- 19.1
vmlinuxas the Linked Kernel ELF(分析vmlinux是带符号和链接信息的内核 ELF,常用于调试、符号解析和构建后处理) - 19.2 Compressed Boot Images and Architecture-Specific Formats(追踪
bzImage、Image、zImage等启动镜像如何服务不同架构和启动协议) - 19.3
System.map, kallsyms, and Symbol Visibility(追踪符号表如何帮助定位函数地址、解析调用栈和分析崩溃信息) - 19.4
initramfsand Early User Space(追踪早期用户空间如何提供根文件系统挂载前所需的驱动、脚本和初始化资源) - 19.5 Engineering Insight: The Bootable Kernel Is a System Package(梳理可启动内核是镜像、符号、模块、initramfs、启动参数共同组成的系统包)
Chapter 20: Engineering a Reproducible Kernel Build
- 20.1 Pinning Source Version, Toolchain, and Configuration(通过固定源码版本、编译器版本和
.config保证构建结果可复现) - 20.2 Out-of-Tree Builds and Clean Build Directories(使用独立输出目录隔离源码和构建产物,降低污染和误判风险)
- 20.3 Debug Builds vs Production Builds(比较调试符号、sanitizer、lockdep、trace 选项与生产性能、安全和体积之间的权衡)
- 20.4 Packaging Kernel, Modules, Headers, and initramfs Together(把内核镜像、模块目录、头文件、符号文件和 initramfs 作为一个整体交付)
- 20.5 Engineering Insight: A Kernel You Cannot Rebuild Is a Kernel You Cannot Trust(判断如果无法稳定重建同一个内核,就很难可靠调试、回归、修复和部署)
Part 5: Boot Sequence, Initcalls, and Early Kernel Initialization
Chapter 21: From Firmware to Bootloader
- 21.1 Firmware as the First Execution Environment(追踪 BIOS、UEFI、Open Firmware、U-Boot 等固件如何完成最早期硬件初始化)
- 21.2 Bootloader Responsibilities and Kernel Handoff(追踪 bootloader 如何加载内核镜像、initramfs、设备树或启动参数,并把控制权交给内核)
- 21.3 Boot Protocols and Architecture-Specific Entry Rules(追踪不同架构如何规定内核入口地址、寄存器状态、内存布局和启动信息格式)
- 21.4 Early Hardware Assumptions Before the Kernel Takes Over(判断内核接管前哪些硬件状态已经被设置,哪些必须由内核重新初始化)
- 21.5 Engineering Insight: Boot Is a Contract Between Firmware, Bootloader, and Kernel(判断启动是固件、bootloader、内核之间的状态交接协议)
Chapter 22: Kernel Decompression and Early Architecture Setup
- 22.1 Compressed Kernel Image and Decompression Stub(追踪压缩内核镜像如何先运行解压代码,再展开目标内核映像)
- 22.2 Early CPU Mode, Page Tables, and Address Translation(追踪内核早期如何建立基本 CPU 模式、页表和地址映射)
- 22.3 Architecture Setup Before Generic Kernel Code(追踪
arch/代码如何完成架构相关初始化,然后进入通用内核初始化路径) - 22.4 Early Memory Discovery and Reserved Regions(追踪内核如何发现可用内存、保留区域、initrd、设备树、ACPI 表和内核自身占用区域)
- 22.5 Engineering Insight: Before the Kernel Can Manage the System, It Must First Build Its Own Ground(判断内核必须先建立最小运行环境,才能开始管理 CPU、内存和设备)
Chapter 23: Kernel Command Line and Early Parameters
- 23.1 Kernel Command Line as Early Runtime Configuration(追踪启动参数如何在内核尚未完全初始化前影响行为)
- 23.2
early_param,__setup,core_param, andmodule_param(区分早期参数、普通 setup 参数、核心参数和模块参数的解析时机) - 23.3 Passing Unknown Parameters to init(追踪内核无法识别的参数如何被传递给用户态 init 或作为环境变量)
- 23.4 Boot-Time Debug Parameters(追踪
earlycon、loglevel、initcall_debug、ftrace 相关参数如何帮助定位早期问题) - 23.5 Engineering Insight: Boot Parameters Are a Control Plane Before User Space Exists(判断启动参数是在用户态出现之前控制内核行为的第一层工程接口)
Chapter 24: Initcall Levels and Subsystem Initialization
- 24.1 Initcall Levels and Dependency Order(分析内核按层级和依赖顺序执行初始化的原因)
- 24.2 From Early Initcalls to Late Initcalls(区分 early、core、postcore、arch、subsys、fs、device、late 等 initcall 阶段的职责差异)
- 24.3 Subsystem Dependencies During Boot(追踪设备模型、文件系统、内存、调度、驱动框架之间如何形成启动依赖)
- 24.4 Initcall Ordering Bugs and Deferred Probe(追踪初始化顺序错误、资源尚未准备、驱动延迟 probe 如何导致启动期问题)
- 24.5 Engineering Insight: Kernel Initialization Is a Dependency Graph(判断内核初始化如何按子系统依赖关系拓扑展开)
Chapter 25: Debugging Early Boot Failures
- 25.1 Early Boot Observability Limits(判断早期启动时日志、控制台、内存分配、调试接口都可能尚未可用)
- 25.2 Early Console, Early printk, and Serial Debugging(使用 early console、串口、早期 printk 让启动失败留下可见证据)
- 25.3 Reading Boot Logs and Identifying the Last Successful Stage(通过启动日志判断失败发生在解压、架构初始化、内存初始化、initcall 还是用户态切换阶段)
- 25.4 Boot-Time Tracing and
initcall_debug(利用启动参数追踪 initcall 耗时、失败位置和初始化卡死点) - 25.5 Engineering Insight: Early Boot Debugging Is About Recovering Observability Before the System Exists(判断早期启动调试的核心是在系统尚未成形前恢复最小可观测性)
Part 6: Kernel Objects, Lifetimes, References, and Error Paths
Chapter 26: Kernel Objects as C Structures with Lifetimes
- 26.1 Structures as Runtime Objects with State and Lifetime(把
task_struct、file、inode、device、sk_buff判定为带状态、关系和生命周期的运行时对象) - 26.2 Allocation, Initialization, Registration, and Visibility(判断对象从分配、初始化到注册进全局表、链表、树或命名空间后,如何被其他路径看见)
- 26.3 Private Fields, Embedded Objects, and Subsystem Ownership(追踪结构体字段如何表达子系统私有状态、嵌入对象和所有权边界)
- 26.4 Object State Machines and Legal Transitions(判断对象通常是在 created、registered、active、dying、released 等状态之间迁移)
- 26.5 Engineering Insight: A Kernel Object Is a State Machine with Memory Behind It(梳理内核对象是由内存、状态、引用、注册位置和回调共同定义的状态机)
Chapter 27: Reference Counting and Ownership Transfer
- 27.1 Reference Counts for Shared Kernel Objects(分析多个路径同时持有对象时,为何必须显式记录对象仍可能被访问)
- 27.2
kref,refcount_t, and Object Release Callbacks(追踪kref如何嵌入对象、递增引用、递减引用,并在归零时调用释放函数) - 27.3 Ownership Transfer Across Lookups, Opens, and Callbacks(追踪查找、打开、注册、回调、队列传递中对象所有权如何转移)
- 27.4 Refcount Bugs: Leaks, Use-After-Free, and Double Put(追踪引用计数错误如何导致资源泄漏、悬空指针、重复释放和安全问题)
- 27.5 Engineering Insight: Lifetime Bugs Are Usually Ownership Bugs(排查生命周期问题表面是崩溃或泄漏,核心通常是某条路径没有说清楚谁拥有对象)
Chapter 28: Resource Acquisition and Release Ordering
- 28.1 Resources as Ordered Dependencies(判断内存、锁、IRQ、DMA、设备节点、工作队列等资源之间存在申请和释放顺序)
- 28.2 Partial Initialization and Midway Failure(排查驱动 probe、子系统初始化和对象构造经常在完成一半时失败,必须正确处理半初始化状态)
- 28.3 Reverse-Order Cleanup and Unwind Discipline(判断释放顺序通常要和申请顺序相反,确保后释放的资源仍能访问有效依赖对象)
- 28.4 Managed Resources and
devm_*Helpers(判断设备托管资源如何把释放动作绑定到 device 生命周期,并减少手写错误路径) - 28.5 Engineering Insight: Cleanup Order Is Architecture(判断资源释放顺序是对象依赖关系和故障恢复架构的一部分)
Chapter 29: Object Registration, Lookup, and Teardown
- 29.1 Registration Makes Objects Discoverable(判断对象注册进 IDR、XArray、链表、sysfs、VFS、driver core 后,才会被其他执行路径访问)
- 29.2 Lookup Rules and Temporary References(判断查找对象时通常需要临时引用,防止对象在使用过程中被并发释放)
- 29.3 Unregistration vs Final Free(判断注销对象如何关闭新发现路径,并继续等待旧引用释放完成)
- 29.4 Teardown Under Concurrency(判断对象销毁必须处理正在运行的回调、工作队列、定时器、中断、RCU 读侧和异步 I/O)
- 29.5 Engineering Insight: Removing an Object Is Harder Than Creating It(判断创建对象如何发布出去,删除对象如何等待所有可能路径释放旧引用)
Chapter 30: Failure Paths as the Real Test of Kernel Design
- 30.1 Success Paths Hide Lifetime Assumptions(排查失败和并发退出路径如何暴露成功路径中的生命周期假设)
- 30.2 Error Labels as Explicit Recovery States(判断
goto err_*标签是在表达对象构造过程中每个恢复阶段) - 30.3 Testing Failure Paths with Fault Injection(通过内存分配失败、I/O 错误、probe 失败、超时等方式主动验证错误路径)
- 30.4 Diagnosing Lifetime Failures from Oops, KASAN, and Refcount Warnings(使用 Oops、KASAN、refcount warning、lockdep 和日志还原对象何时被错误释放或泄漏)
- 30.5 Engineering Insight: Kernel Quality Is Measured by What Happens When the Happy Path Breaks(排查内核代码在失败、并发退出和资源回滚时是否仍然正确)
Part 7: Observability Interfaces procfs, sysfs, debugfs, tracefs, and dmesg
Chapter 31: procfs as a Runtime View of Processes and Kernel State
- 31.1
/procas a Window into Kernel Internal Data Structures(追踪/proc如何把进程、内存、调度、文件描述符和内核状态暴露成伪文件) - 31.2 Process-Specific Views under
/proc/<pid>(通过/proc/<pid>/status、maps、smaps、fd、stat观察单个进程的运行时状态) - 31.3 System-Wide Kernel State under
/proc(通过/proc/meminfo、cpuinfo、interrupts、softirqs、slabinfo等观察系统级状态) - 31.4
/proc/sysand Runtime Kernel Tuning(追踪 sysctl 如何通过/proc/sys暴露可读写的内核运行参数) - 31.5 Engineering Insight: procfs Turns Kernel State into Queryable Evidence(判断
procfs如何把运行时状态变成可以查询和对比的证据)
Chapter 32: sysfs as a Device and Object Model Interface
- 32.1 sysfs and the Kernel Object Hierarchy(追踪
sysfs如何把 device、driver、bus、class、kobject 的层级关系暴露到用户空间) - 32.2
/sys/devices,/sys/bus,/sys/class, and/sys/module(通过不同目录观察设备拓扑、总线绑定、设备类别和模块状态) - 32.3 Attributes as Object Properties(分析 sysfs 文件通常表示单个对象属性,并保持一文件一属性的接口边界)
- 32.4 Driver Binding, Device State, and Runtime Control(通过 sysfs 观察和控制驱动绑定、电源状态、设备参数和热插拔状态)
- 32.5 Engineering Insight: sysfs Is the User-Space Projection of the Kernel Device Model(判断
sysfs是内核对象模型在用户态的投影)
Chapter 33: debugfs as a Developer-Controlled Debug Surface
- 33.1 debugfs and Unstable Debug ABI(分析
debugfs适合调试开发信息的原因,以及它和稳定用户态 ABI 的边界) - 33.2 Mounting and Exploring
/sys/kernel/debug(分析 debugfs 的挂载位置、权限要求和常见子系统调试入口) - 33.3 Exporting Internal State for Developers(追踪子系统和驱动如何通过 debugfs 暴露队列、寄存器、统计信息、内部状态和调试开关)
- 33.4 Risks of Debug Interfaces in Production Systems(分析 debugfs 在权限、安全、稳定性和生产环境中的风险)
- 33.5 Engineering Insight: debugfs Serves Developers and Diagnostics(排查
debugfs如何快速暴露内部状态,并说明它的接口兼容性边界)
Chapter 34: tracefs and the Kernel Tracing Interface
- 34.1 tracefs as the Filesystem Interface to Kernel Tracing(追踪
tracefs如何暴露 tracing 控制文件、trace buffer、events、tracers 和过滤条件) - 34.2 Function Tracing and Function Graph Tracing(通过函数级 tracing 观察调用路径、嵌套关系和执行成本)
- 34.3 Tracepoints and Event-Based Observability(使用调度、块层、网络、内存等 tracepoint 观察关键子系统事件)
- 34.4 Filtering, Triggers, and Latency Investigation(追踪事件过滤、触发器、latency tracer 如何缩小问题范围)
- 34.5 Engineering Insight: tracefs Lets You Watch Kernel Behavior at Runtime(判断
tracefs如何在运行时提供路径证据,补足静态源码推断的边界)
Chapter 35: dmesg, printk, and Runtime Evidence Collection
- 35.1
printkRing Buffer anddmesgOutput(追踪内核日志如何进入 ring buffer,并通过dmesg、journald 或控制台输出) - 35.2 Log Levels, Rate Limiting, and Noise Control(执行日志级别、限速、防刷屏机制和调试信息打开方式)
- 35.3 Oops, WARN, Panic, and Failure Signatures(从 Oops、WARN、panic、call trace 中识别错误类型和失败路径)
- 35.4 Correlating Logs with procfs, sysfs, and tracefs Evidence(把日志时间线与
/proc状态、sysfs对象、trace 事件组合成完整证据链) - 35.5 Engineering Insight: Kernel Debugging Begins by Preserving Evidence(判断内核调试的第一步是尽可能保留日志、状态、trace 和复现条件)
Part 8: User-Kernel Boundary and System Call Path
Chapter 36: User Code Entry into the Kernel
- 36.1 System Calls Are Controlled Boundary Crossings(分析系统调用是从低权限用户态进入高权限内核态的受控入口)
- 36.2 CPU Mode Switch, Registers, and Calling Convention(追踪系统调用如何通过架构约定传递参数、切换特权级并进入内核入口代码)
- 36.3 From Architecture Entry Code to Generic Kernel Logic(追踪架构相关入口如何保存现场、建立内核执行上下文,并分发到通用 syscall 实现)
- 36.4 Returning to User Space Safely(追踪系统调用返回前如何处理返回值、信号、调度点、审计、追踪和恢复用户态上下文)
- 36.5 Engineering Insight: A Syscall Is a Contracted Transition(梳理系统调用的核心是 ABI、权限、上下文和对象规则共同定义的边界协议)
Chapter 37: System Call Tables, Entry Code, and ABI Stability
- 37.1 System Call Numbers and Architecture-Specific Tables(追踪 syscall number 如何映射到不同架构下的 syscall table 和实现函数)
- 37.2 ABI Stability and Syscall Change Constraints(分析系统调用暴露给用户态后必须长期保持兼容的原因)
- 37.3 Compat Syscalls and 32-bit User Space on 64-bit Kernels(追踪 compat 层如何处理 32 位用户程序在 64 位内核上的参数布局和数据结构差异)
- 37.4 vDSO, Fast User-Space Helpers, and Syscall Avoidance(分析某些时间相关操作如何通过 vDSO 在用户态完成,并减少进入内核的开销)
- 37.5 Engineering Insight: The Syscall ABI Is More Stable Than Most Kernel Internals(判断内核内部可以重构,但 syscall ABI 是用户态生态依赖的长期契约)
Chapter 38: Copying Data Across the User-Kernel Boundary
- 38.1 User Pointers Are Untrusted Inputs(分析来自用户态的指针为何必须通过专门的 uaccess 机制处理)
- 38.2
copy_from_user,copy_to_user, and Fault Handling(追踪内核如何在复制用户内存时处理缺页、非法地址和部分复制) - 38.3
__userAnnotations and Static Checking(追踪__user标注如何帮助区分用户指针和内核指针,降低误用风险) - 38.4 TOCTOU and Validation Across Boundary Copies(分析检查用户数据和实际使用用户数据之间的竞态风险)
- 38.5 Engineering Insight: Boundary Copying Is Security-Critical Data Movement(把用户态和内核态之间的数据复制判定为安全边界上的受控数据移动)
Chapter 39: File Descriptors, Handles, and Kernel Objects
- 39.1 File Descriptor as the Universal User-Space Handle(追踪 fd 如何让用户态以整数 handle 引用内核中的 file、socket、event、epoll、timer 等对象)
- 39.2 From fd Table to
struct file(追踪系统调用如何从进程文件描述符表找到struct file,并进入对应对象操作) - 39.3
file_operationsand Object-Specific Behavior(追踪同一个read、write、ioctl如何根据底层对象类型分发到不同实现) - 39.4 Close-on-exec, fd Leaks, and Lifetime Boundaries(梳理
O_CLOEXEC、fork/exec、fd 泄漏和对象引用生命周期之间的关系) - 39.5 Engineering Insight: File Descriptors Let User Space Hold Kernel Object References(判断 fd 如何让用户态通过通用句柄安全引用内核对象)
Chapter 40: Failure, errno, and Boundary-Level Diagnostics
- 40.1 Negative Kernel Errors and Positive User-Space
errno(追踪内核负错误码如何在 libc 边界转换为用户态errno) - 40.2 Partial Success, Short Reads, and Restartable Syscalls(判断系统调用为何可能部分成功、被信号打断,或需要自动重启)
- 40.3
straceas the First Boundary Debugger(使用strace从用户态观察 syscall 参数、返回值、错误码和阻塞点) - 40.4 Correlating Syscalls with ftrace, perf, and Kernel Logs(把用户态 syscall 轨迹与内核 trace、perf 采样、dmesg 日志组合起来定位问题)
- 40.5 Engineering Insight: Syscall Failures Are Often the Cleanest Clues(排查系统调用失败返回的错误码和边界证据,往往是定位内核路径问题的第一入口)
Part 9: Process, Thread, Task Struct, and Execution Context
Chapter 41: task_struct as the Kernels Process Object
- 41.1
task_structas the Central Execution Object(分析 Linux 如何用task_struct表示可调度实体,并区分它与用户态进程概念) - 41.2 Process Identity: PID, TGID, Thread Group, and Namespace View(区分 PID、TGID、线程组和 PID namespace 视角下的进程身份)
- 41.3 Links to Memory, Files, Signals, Credentials, and Scheduler State(通过
mm_struct、files_struct、signal_struct、cred、调度字段分析 task 如何连接多个子系统) - 41.4 Task Lifetime, Reference Counting, and Exit State(分析 task 从创建、运行、退出到最终释放之间的引用关系和状态变化)
- 41.5 Engineering Insight: A Process Is a Hub of Kernel Relationships(判断进程是内存、文件、信号、权限、调度和命名空间关系的汇聚点)
Chapter 42: Process Creation with fork, clone, and exec
- 42.1
forkas Controlled Duplication of Execution Context(追踪fork如何复制当前执行上下文,并通过写时复制推迟完整内存复制) - 42.2
cloneFlags and Resource Sharing(追踪clone如何通过 flags 控制地址空间、文件表、信号处理、线程组等资源是否共享) - 42.3
execas Image Replacement with Preserved Identity(分析exec如何在保留部分身份和资源的同时替换用户态程序映像) - 42.4 Copy-on-Write, File Table Sharing, and Signal State During Creation(追踪进程创建过程中内存、文件描述符、信号处理和凭证如何被复制或共享)
- 42.5 Engineering Insight: Linux Threads and Processes Are Policy Built on the Same Task Mechanism(判断 Linux 的进程和线程差异,核心是同一个 task 机制上不同资源共享策略的结果)
Chapter 43: Threads, Thread Groups, and Shared Resources
- 43.1 Kernel Task vs User-Space Thread(分析每个用户态线程通常对应一个内核可调度 task,但线程语义由共享资源关系定义)
- 43.2 Thread Group Leadership and TGID Semantics(分析线程组 leader、TGID、
getpid()、gettid()背后的内核身份模型) - 43.3 Shared Address Space, File Table, and Signal Handlers(排查线程之间共享地址空间、文件表和信号处理器时带来的并发与生命周期问题)
- 43.4 Per-Thread State: Stack, Registers, TLS, and Scheduling Entity(区分每个线程独立拥有的内核栈、寄存器现场、TLS、调度实体和阻塞状态)
- 43.5 Engineering Insight: Threads Are Shared Process State with Independent Scheduling(判断线程是共享进程资源、独立参与调度的执行实体)
Chapter 44: Process States, Sleep, Wakeup, and Signals
- 44.1 Running, Runnable, Sleeping, Stopped, Zombie, and Dead States(分析 task 在运行、可运行、睡眠、停止、僵尸和释放阶段之间的状态迁移)
- 44.2 Interruptible vs Uninterruptible Sleep(区分可被信号打断的睡眠和不可中断睡眠,以及它们对系统卡顿诊断的影响)
- 44.3 Wait Queues and Wakeup Paths(追踪等待队列如何让 task 睡眠并在事件到来时被唤醒)
- 44.4 Signals as Asynchronous Control Flow(追踪信号如何跨 task 传递异步控制意图,并在返回用户态或可中断点被处理)
- 44.5 Engineering Insight: A “Stuck Process” Is Usually Waiting on a Kernel Condition(判断所谓进程卡住,通常是在等待某个内核条件、资源或事件)
Chapter 45: Execution Contexts Process, Interrupt, and Kernel Thread
- 45.1 Process Context and the Meaning of
current(分析进程上下文中current指向当前 task,代码可以访问进程资源并可能睡眠) - 45.2 Interrupt Context and Non-Sleepable Execution(分析中断上下文的非睡眠约束、进程资源边界和快速返回要求)
- 45.3 Softirq, Workqueue, and Deferred Process-Like Execution(区分软中断、工作队列和延迟执行机制如何在不同上下文中运行)
- 45.4 Kernel Threads and Borrowed Address Spaces(分析内核线程没有普通用户地址空间,必要时会借用 active mm;官方文档也说明没有真实地址空间的任务会使用 borrowed
active_mm) - 45.5 Engineering Insight: The Same Function Can Be Safe or Broken Depending on Context(判断同一段代码能否分配内存、睡眠、访问用户指针或获取锁,取决于它运行在哪种执行上下文)
Part 10: Scheduler Architecture, CFS, Real-Time Classes, and CPU Time
Chapter 46: Scheduler Classes and the Scheduling Framework
- 46.1 The Scheduler as a Policy Multiplexer(追踪 Linux 调度器如何通过调度类把普通任务、实时任务、deadline 任务和 idle 任务纳入统一框架)
- 46.2
sched_class,rq, and Per-CPU Runqueues(追踪调度类、每 CPU 运行队列和可运行实体如何组成调度器核心数据结构) - 46.3 Pick Next Task and Class Priority Order(追踪调度器如何按类优先级选择下一个任务,并降低全局线性查找成本)
- 46.4 Scheduler Hooks Across Wakeup, Sleep, Fork, Exit, and Tick(追踪调度逻辑如何分布在唤醒、睡眠、创建、退出、时钟 tick 等多个路径中)
- 46.5 Engineering Insight: Scheduling Is Distributed Across State Transitions(判断调度是贯穿 task 状态变化的分布式决策系统)
Chapter 47: CFS, vruntime, Weights, and Fairness
- 47.1 The Ideal Fair CPU Model Behind CFS(追踪 CFS 如何用“理想公平 CPU”模型解释普通任务之间的 CPU 时间分配)
- 47.2
vruntimeas Normalized CPU Consumption(追踪vruntime如何把实际运行时间按权重归一化,用于比较任务“已经获得多少公平份额”) - 47.3 Nice Values, Weights, and Proportional Share(追踪 nice 值如何映射为权重,并影响任务获得 CPU 时间的比例)
- 47.4 Runqueue Ordering and Picking the Leftmost Entity(追踪 CFS 如何维护可运行实体排序,并倾向选择虚拟运行时间最小的实体)
- 47.5 Engineering Insight: Fairness Is Accounting by Weight and History(判断 CFS 的公平是基于权重和历史消耗的连续记账)
Chapter 48: Real-Time Scheduling Classes and Latency Guarantees
- 48.1
SCHED_FIFO,SCHED_RR, and Real-Time Priority(追踪 FIFO、RR 实时策略如何按实时优先级抢占普通任务) - 48.2 Real-Time Scheduling Starvation Risk(判断实时任务为何可能长期占用 CPU,并让普通 CFS 任务得不到运行机会)
- 48.3 Real-Time Bandwidth Control and Group Scheduling(追踪实时运行时间限制如何防止实时任务完全拖死系统)
- 48.4 Deadline Scheduling and Runtime/Deadline/Period Model(追踪 deadline 调度如何用运行时间、截止时间和周期表达实时约束)
- 48.5 Engineering Insight: Real-Time Means Bounded Latency(判断实时调度如何围绕可预测延迟建立保证)
Chapter 49: CPU Affinity, Load Balancing, and Multi-Core Scheduling
- 49.1 CPU Affinity and Where a Task Is Allowed to Run(追踪 CPU affinity、cpumask、隔离 CPU 和亲和性限制如何影响调度选择)
- 49.2 Scheduler Domains and Topology-Aware Balancing(追踪调度域如何表达 SMT、核心、NUMA 节点等 CPU 拓扑层级)
- 49.3 Wakeup Placement and Cache Locality(追踪任务被唤醒时如何在负载均衡和缓存局部性之间做选择)
- 49.4 Capacity-Aware and Energy-Aware Scheduling(追踪在异构 CPU 或移动设备上,调度器如何考虑 CPU 能力和能耗)
- 49.5 Engineering Insight: Multi-Core Scheduling Is a Topology Problem(判断多核调度需要分析拓扑、缓存、能耗和负载迁移成本)
Chapter 50: Diagnosing Scheduling Latency and Starvation
- 50.1 Reading Load Average, Runqueue Pressure, and CPU Utilization Together(区分负载高、CPU 忙、任务排队和 CPU 饥饿之间的差异)
- 50.2
perf sched, ftrace, andsched_switchEvidence(使用调度 tracepoint、perf sched、function graph tracing 观察任务何时被切走和唤醒) - 50.3 Detecting Priority Inversion and RT Interference(定位低优先级任务持锁、高优先级任务等待、实时任务干扰普通任务的场景)
- 50.4 Scheduler Debugfs and Runtime Tuning Knobs(通过调度器 debugfs、sysctl 和运行时统计分析调度行为)
- 50.5 Engineering Insight: A Slow Program May Be Waiting for CPU(判断程序变慢可能来自长期处于可运行状态却未获得 CPU)
Part 11: Context Switching, Preemption, Timers, and Timekeeping
Chapter 51: Context Switch Saved State and Resume Path
- 51.1 Context Switch as Execution Ownership Transfer(分析上下文切换是 CPU 执行权从一个 task 转移到另一个 task)
- 51.2 Registers, Stack, Program Counter, and CPU State(追踪寄存器、栈指针、程序计数器、标志位和架构状态如何在切换中保存与恢复)
- 51.3 Address Space Switching and TLB Effects(追踪切换
mm_struct、页表根和 TLB 状态如何影响上下文切换成本) - 51.4 Lazy State, FPU State, and Architecture-Specific Details(分析 FPU、SIMD、调试寄存器等扩展状态为何可能采用延迟保存或架构特定策略)
- 51.5 Engineering Insight: Context Switching Is a Controlled Loss of Locality(判断上下文切换如何消耗指令、缓存、TLB 和执行局部性)
Chapter 52: Kernel Preemption Models and Voluntary Preemption
- 52.1 Non-Preemptible Kernel and Explicit Scheduling Points(分析早期或非抢占内核中,内核态代码通常只有在显式调度点才让出 CPU)
- 52.2 Voluntary Preemption and Latency Reduction(追踪自愿抢占如何在长路径中插入调度点,降低普通负载下的延迟)
- 52.3 Preemptible Kernel and Critical Sections(追踪可抢占内核如何允许更细粒度抢占,同时依赖锁、preempt count 和临界区保护一致性)
- 52.4 PREEMPT_RT and Sleeping Locks(追踪实时内核如何把部分自旋等待转化为可调度等待,以降低最坏情况延迟)
- 52.5 Engineering Insight: Preemption Is a Latency Contract with Concurrency Costs(判断抢占模型越激进,延迟可能越低,但同步、锁和上下文约束也越复杂)
Chapter 53: Timer Infrastructure and High-Resolution Timers
- 53.1 Timers as Deferred Execution by Time(追踪 timer 如何把“未来某个时间执行”的需求编码进内核)
- 53.2 Timer Wheel, hrtimer, and Precision Tradeoffs(区分传统低精度 timer 和 high-resolution timer 在精度、成本和用途上的差异)
- 53.3 Clockevents and One-Shot Timer Delivery(追踪 clockevents 设备如何在指定时间触发事件,并支撑高精度定时器行为)
- 53.4 Timer Callback Context and Safety Rules(分析 timer 回调运行上下文、锁规则、睡眠约束和对象生命周期风险)
- 53.5 Engineering Insight: Timers Are Time-Based Interruptions of Control Flow(判断定时器是时间驱动的控制流插入点)
Chapter 54: Timekeeping, Jiffies, Clocksource, and Clockevents
- 54.1
jiffiesand Tick-Based Time Accounting(追踪传统 tick 如何驱动时间统计、调度记账和周期性维护) - 54.2 Clocksource as the Kernel’s Time Reader(追踪 clocksource 如何提供单调递增时间读数,是内核判断“现在几点”的底层来源)
- 54.3 Clockevents as the Kernel’s Time Alarm(追踪 clockevents 如何负责“何时触发下一次事件”,与 clocksource 形成读时和定时的分工)
- 54.4 NO_HZ, Tickless Operation, and Idle CPUs(追踪 tickless 设计如何减少空闲 CPU 上的周期性 tick,降低功耗和干扰)
- 54.5 Engineering Insight: Timekeeping Separates Measuring Time from Scheduling Time Events(判断时间管理要区分读时间和安排未来事件,二者由不同内核机制支撑)
Chapter 55: Latency Sources in Preemption and Timer Paths
- 55.1 Long Non-Preemptible Sections(判断长时间关闭抢占或持有不可睡眠锁,会直接增加调度延迟和实时抖动)
- 55.2 Interrupt Disabled Regions and Timer Delivery Delay(判断关闭中断的区域会延迟 timer、中断和调度事件的处理)
- 55.3 Timer Callback Overrun and Work Deferral(判断 timer 回调过重会拖慢时间路径,通常需要把复杂工作转移到 workqueue 或线程上下文)
- 55.4 Measuring Latency with ftrace and Scheduler Events(使用 ftrace、function graph、
sched_switch、timer 相关 tracepoints 定位延迟来源) - 55.5 Engineering Insight: Latency Is Often Hidden in Places That Temporarily Stop the Kernel from Being Interruptible(排查延迟问题经常藏在那些短暂阻止抢占、中断或 timer 及时处理的路径里)
Part 12: Interrupts, Exceptions, Softirq, Tasklet, and Workqueue
Chapter 56: CPU Exceptions and Hardware Interrupt Entry
- 56.1 Exceptions vs External Interrupts(区分同步异常和异步硬件中断:异常由当前指令触发,中断由外部设备或控制器触发)
- 56.2 Interrupt Entry as Forced Control Transfer(追踪 CPU 如何暂停当前执行流、保存最小现场,并跳转到内核定义的异常或中断入口)
- 56.3 Faults, Traps, Aborts, and Architecture-Specific Semantics(分析 page fault、breakpoint、general protection fault 等异常在不同架构下的语义差异)
- 56.4 Interrupt Context and Non-Sleepable Constraints(分析硬中断上下文的非睡眠约束、短路径要求和进程上下文边界)
- 56.5 Engineering Insight: Interrupts Are Forced Execution Interleavings(判断中断是强制插入当前执行流的异步控制路径)
Chapter 57: Interrupt Controllers, IRQ Domains, and IRQ Descriptors
- 57.1 Interrupt Controllers as Hardware Event Routers(追踪 APIC、GIC、GPIO interrupt controller 等硬件如何把设备事件路由到 CPU)
- 57.2 Linux Generic IRQ Layer(追踪 generic IRQ layer 如何把不同硬件控制器抽象成统一的 IRQ 管理模型)
- 57.3 IRQ Domains and Hardware-to-Linux IRQ Mapping(追踪 irq domain 如何把硬件中断号映射成 Linux 内部 irq 编号)
- 57.4
irq_desc,irq_chip, and Flow Handlers(追踪 IRQ 描述符、控制器操作、level/edge/EOI 等流控处理如何协作) - 57.5 Engineering Insight: IRQ Handling Is a Hardware Abstraction Layer with Timing Pressure(排查 IRQ 子系统既要屏蔽硬件差异,又要在严格时序压力下快速响应)
Chapter 58: Top Halves, Bottom Halves, and Deferred Execution
- 58.1 Split Interrupt Handling Top and Bottom Halves(分析中断处理为何要拆成快速响应的 top half 和延迟处理的 bottom half)
- 58.2 Top Half Responsibilities and Minimal Hardware Acknowledgement(判断硬中断处理函数通常只完成确认中断、读取关键状态、安排后续工作等最小任务)
- 58.3 Bottom Half as Deferred Kernel Work(追踪延迟执行机制如何把耗时处理推迟到更合适的上下文中完成)
- 58.4 Choosing Between Softirq, Tasklet, Workqueue, and Threaded IRQ(根据并发性、是否可睡眠、延迟要求和驱动复杂度选择合适机制)
- 58.5 Engineering Insight: Interrupt Design Is About Moving Work to the Right Context(判断中断工程的核心是在正确上下文中做正确数量的工作)
Chapter 59: Softirq, Tasklet, Workqueue, and Threaded IRQs
- 59.1 Softirq as Low-Level Deferred Interrupt Work(分析 softirq 是底层延迟执行机制,仍然运行在中断相关上下文中,适合高频并发事件)
- 59.2 Tasklet as Serialized Deferred Work on Top of Softirq(追踪 tasklet 如何基于 softirq 提供更简单的串行化延迟执行模型)
- 59.3 Workqueue as Process-Context Deferred Execution(追踪 workqueue 如何把工作交给内核线程执行,从而允许睡眠、阻塞和复杂资源操作)
- 59.4 Threaded IRQs and PREEMPT_RT-Friendly Interrupt Handling(追踪 threaded IRQ 如何把部分中断处理放入线程上下文,改善实时性和可调度性)
- 59.5 Engineering Insight: Deferred Work Mechanisms Differ Mainly by Context, Concurrency, and Sleepability(判断 softirq、tasklet、workqueue、threaded IRQ 的核心区别在于运行上下文、并发模型和是否允许睡眠)
Chapter 60: Interrupt Storms, Latency, and Debugging Strategies
- 60.1 Interrupt Storms and Misbehaving Devices(追踪设备、驱动或中断控制器错误如何导致中断频率异常升高并拖垮 CPU)
- 60.2 Softirq Backlog and
ksoftirqdPressure(追踪 softirq 处理不过来时如何转移到ksoftirqd,以及这对网络、块层和调度延迟的影响) - 60.3 IRQ Affinity and CPU Distribution(通过 IRQ affinity 调整中断落在哪些 CPU 上,以改善局部性、负载均衡或隔离实时任务)
- 60.4 Observing Interrupt Behavior with
/proc/interrupts,/proc/softirqs, ftrace, and perf(结合中断计数、softirq 统计、trace 事件和 perf 采样建立证据链) - 60.5 Engineering Insight: Interrupt Problems Look Like Performance Problems Until You See the Event Rate(排查中断问题如何通过事件频率、分布和延迟线索定位)
Part 13: Concurrency, Locking, Atomics, Memory Barriers, and RCU
Chapter 61: Kernel Concurrency Context Lifetime and Ordering
- 61.1 Concurrency Across CPUs, Interrupts, and Preemption(分析内核并发如何来自线程、多 CPU、中断插入、软中断、抢占和异步回调)
- 61.2 Shared Objects with Multiple Lifetime Owners(判断同一个对象可能同时被进程路径、中断路径、workqueue、RCU 读侧和驱动回调访问)
- 61.3 Sleepable vs Non-Sleepable Contexts(追踪能否睡眠如何决定可用同步原语,例如 mutex、spinlock、RCU、atomic 的适用边界)
- 61.4 Correctness Under Rare Interleavings(排查很多并发 bug 只在极少数时序下出现,因此必须靠模型、锁规则和工具辅助证明)
- 61.5 Engineering Insight: Kernel Concurrency Is About Context, Lifetime, and Ordering Together(判断内核并发的核心是同时处理上下文、生命周期和内存顺序)
Chapter 62: Spinlocks, Mutexes, Semaphores, and Reader-Writer Locks
- 62.1 Spinlocks and Busy-Wait Mutual Exclusion(追踪 spinlock 如何通过忙等保护短临界区,以及为何它适合不可睡眠上下文)
- 62.2 Mutexes and Sleepable Mutual Exclusion(追踪 mutex 如何让等待者睡眠,并判断它适合较长临界区和可睡眠上下文)
- 62.3 Semaphores and Counting Access Control(追踪 semaphore 如何表达有限资源数量和多参与者访问控制)
- 62.4 Reader-Writer Locks and Read-Mostly Tradeoffs(追踪读写锁如何允许并发读,但在写路径、饥饿和复杂度上引入新权衡)
- 62.5 Engineering Insight: Lock Choice Is Context Choice(选择锁时同时评估运行上下文、临界区长度、睡眠能力、并发读写比例和性能影响)
Chapter 63: Atomic Operations and Memory Ordering
- 63.1 Atomicity vs Ordering(区分“操作不可分割”和“内存访问顺序被约束”这两个不同概念)
- 63.2
atomic_t,refcount_t, and Counter Semantics(分析普通原子计数、引用计数和安全溢出检查之间的语义差异) - 63.3 Read-Modify-Write Operations(追踪 compare-and-swap、fetch-add、test-and-set 等原子读改写操作如何构造无锁状态更新)
- 63.4 Acquire, Release, and Full Barrier Semantics(追踪 acquire/release/full barrier 如何约束前后内存访问在其他 CPU 上的可见顺序)
- 63.5 Engineering Insight: Atomics Need Ordering to Become Synchronization(判断原子操作如何结合顺序语义解决竞争写入和跨 CPU 可见性)
Chapter 64: Memory Barriers and CPU Reordering
- 64.1 CPU Compiler Memory Access Reordering(分析现代 CPU 和编译器为何会为了性能改变内存访问观察顺序)
- 64.2 Compiler Barriers vs CPU Memory Barriers(区分阻止编译器重排的屏障和约束 CPU 内存可见顺序的屏障)
- 64.3
smp_mb,smp_rmb,smp_wmb, and One-Way Barriers(分析全屏障、读屏障、写屏障以及单向 acquire/release 屏障的使用场景) - 64.4 Locking Primitives as Implicit Barriers(分析加锁和解锁操作为何通常隐含 acquire/release 语义,并说明额外顺序保证的推导边界)
- 64.5 Engineering Insight: Memory Ordering Bugs Are Bugs in What Other CPUs Are Allowed to See(排查内存顺序 bug 的核心是其他 CPU 被允许看到错误顺序)
Chapter 65: RCU Read-Copy-Update as a Kernel-Scale Synchronization Model
- 65.1 RCU as Read-Mostly Synchronization(分析 RCU 为何适合读多写少场景,让读侧减少锁、原子操作和共享写入)
- 65.2 Read-Side Critical Sections and Grace Periods(追踪
rcu_read_lock()、rcu_read_unlock()和 grace period 如何保证旧读者离开后再释放旧对象) - 65.3 Publishing, Replacing, and Reclaiming RCU-Protected Objects(分析 RCU 发布、读取、替换和回收 API 的协作关系)
- 65.4 RCU Lists, Hash Tables, and Lockless Lookup Patterns(追踪 RCU 如何保护读多写少链表、哈希表和查找路径,并降低读侧锁竞争)
- 65.5 Engineering Insight: RCU Separates Visibility from Reclamation(判断 RCU 的顿悟点是把“让新读者看不到旧对象”和“等旧读者用完再释放旧对象”拆成两个阶段)
Part 14: Virtual Memory, Address Spaces, and Page Tables
Chapter 66: Virtual Address Spaces and mm_struct
- 66.1 Virtual Address Space as a Per-Process Illusion(分析每个进程如何看到独立连续地址空间,并由内核映射到真实物理内存)
- 66.2
mm_structas the Process Memory Descriptor(追踪mm_struct如何描述进程地址空间、页表根、VMA 集合和内存统计) - 66.3
active_mm, Lazy TLB, and Kernel Threads(分析内核线程没有普通用户地址空间时,为何仍然需要借用 active mm) - 66.4 Address Space Sharing Across Threads(追踪线程共享同一个
mm_struct时,地址空间、映射、缺页和退出路径如何互相影响) - 66.5 Engineering Insight: A Process Address Space Is a Kernel Object(梳理地址空间是由映射、页表、权限、引用和生命周期共同组成的内核对象)
Chapter 67: Page Tables, Page Table Walks, and TLBs
- 67.1 Page Tables as Virtual-to-Physical Translation Structures(追踪页表如何把虚拟地址映射到物理页框,以及为何 Linux 把页表定义成层级结构)
- 67.2 Multi-Level Page Tables and Architecture Mapping(追踪 PGD、P4D、PUD、PMD、PTE 等层级如何被不同架构映射到真实硬件页表)
- 67.3 Page Table Walks and Permission Checks(追踪 CPU 或内核软件 walk 如何逐级解析地址,并检查 present、writable、executable、user 等权限)
- 67.4 TLB as Cached Address Translation(追踪 TLB 如何缓存虚拟地址到物理地址的转换,以及为何切换地址空间或修改页表需要 TLB 失效)
- 67.5 Engineering Insight: Page Tables Are the Hardware-Visible Form of Kernel Memory Policy(判断内核关于隔离、权限、共享和映射的决策,最终都要落实为硬件能执行的页表项)
Chapter 68: User Address Space vs Kernel Address Space
- 68.1 User-Space Virtual Memory Layout(分析代码段、数据段、堆、栈、mmap 区域、共享库和 guard page 在用户地址空间中的位置)
- 68.2 Kernel Virtual Address Space and Direct Mapping(分析内核地址空间、直接映射区、vmalloc 区、ioremap 区和架构相关布局)
- 68.3 Split Address Space and Privilege Protection(区分用户地址与内核地址的权限边界,并追踪 CPU 如何阻止用户态直接访问内核映射)
- 68.4 ASLR and Randomized Memory Layouts(追踪地址空间随机化如何改变映射位置,以提高攻击难度和降低地址预测性)
- 68.5 Engineering Insight: Numeric Addresses Need Address-Space Context(判断地址值如何结合所属地址空间、页表和权限才能解释)
Chapter 69: VMA, mmap, and Address Space Layout
- 69.1 VMA as a Range-Based Memory Policy Object(追踪
vm_area_struct如何描述一段虚拟地址范围的权限、后端文件、匿名属性和操作函数) - 69.2
mmapas Mapping Creation with Lazy Allocation(分析mmap如何创建虚拟地址映射关系,并让物理页分配延迟到缺页等路径) - 69.3 VMA Merge, Split, and Lookup(追踪 VMA 如何因为
mprotect、munmap、缺页、文件映射等操作发生合并、拆分和查找) - 69.4 File-Backed vs Anonymous Mappings(区分文件映射和匿名映射在缺页、回写、共享、COW 和回收路径上的不同)
- 69.5 Engineering Insight: VMA Describes What an Address Range Means Before a Page Exists(判断 VMA 的关键作用是在物理页出现前,就定义该地址范围的权限、来源和故障处理方式)
Chapter 70: Page Table Debugging and Address Translation Evidence
- 70.1 Reading
/proc/<pid>/mapsand/proc/<pid>/smaps(通过进程映射信息观察 VMA 布局、权限、后端文件、RSS、PSS 和匿名/文件页占用) - 70.2 Inspecting
/proc/<pid>/pagemapand PFN Information(追踪 pagemap 如何暴露虚拟页是否 present、是否 swapped、PFN、soft-dirty 等页级信息) - 70.3 Correlating Page Faults with Mapping State(把 major/minor fault、VMA 权限、页表 present 状态和后端文件联系起来分析缺页原因)
- 70.4 Debugging Bad Addresses, Permission Faults, and SIGSEGV(通过 fault address、错误码、VMA 查找和页表状态定位非法访问、权限错误和段错误)
- 70.5 Engineering Insight: Virtual Memory Bugs Become Clear When You Separate Address, Mapping, and Page(排查虚拟内存问题的关键是拆开地址值、VMA 语义、页表项和物理页这四层)
Part 15: Physical Memory, Zones, NUMA, and Page Allocator
Chapter 71: Physical Pages, struct page, and Memory Models
- 71.1 Physical Page Frames as the Kernel’s Basic Memory Units(追踪物理内存如何被切分成 page frame,并作为内核管理真实内存的基本单位)
- 71.2
struct pageas the Descriptor of Physical Memory(追踪每个物理页框如何通过struct page记录引用、状态、映射、LRU、复合页和缓存关系) - 71.3 PFN, Page Frame Number, and Address Conversion(追踪 PFN 如何作为物理页编号连接物理地址、
struct page和页表映射) - 71.4 Flat Memory, Sparse Memory, and Memory Model Variants(追踪不同内存模型如何在大内存、热插拔和稀疏物理地址空间中组织
struct page) - 71.5 Engineering Insight: Physical Memory Is Managed Through Metadata Before It Is Used as Storage(判断内核是先通过
struct page等元数据把物理页纳入可管理对象体系)
Chapter 72: Zones, Watermarks, and Allocation Constraints
- 72.1 Physical Memory Zones and Hardware Constraints(追踪 DMA、DMA32、Normal、HighMem、Movable 等 zone 如何表达硬件寻址能力和迁移约束)
- 72.2 Zone Watermarks and Allocation Safety Margins(追踪 min、low、high watermark 如何保护系统在内存压力下仍有保留页可用)
- 72.3 GFP Flags and Allocation Intent(追踪
GFP_KERNEL、GFP_ATOMIC、GFP_DMA、__GFP_RECLAIM等标志如何告诉分配器调用者的上下文和约束) - 72.4 Fallback Rules and Zone Selection(追踪一次页分配如何根据节点、zone、watermark、迁移类型和 fallback 规则选择可用页)
- 72.5 Engineering Insight: Page Allocation Is Constraint Solving(判断物理页分配是在硬件限制、上下文、保留水位和迁移策略之间求解)
Chapter 73: Buddy Allocator and Page Allocation Paths
- 73.1 Buddy Allocator as the Core Contiguous Page Allocator(追踪 buddy allocator 如何按 2 的幂次 order 管理连续物理页块)
- 73.2 Splitting and Coalescing Page Blocks(追踪高阶空闲块如何被拆分成低阶块,释放时又如何与 buddy 合并减少碎片)
- 73.3 Per-CPU Pagesets and Fast Page Allocation(追踪 PCP 如何让频繁的单页分配和释放尽量在 CPU 本地完成,减少全局 zone 锁竞争)
- 73.4 Slow Path Allocation, Reclaim, Compaction, and Retry(追踪快速路径失败后,分配器如何进入回收、压缩、等待、重试和最终失败路径)
- 73.5 Engineering Insight: The Page Allocator Is Where Performance Meets Scarcity(判断页分配器同时承载高频性能需求和稀缺资源约束,是内存管理最工程化的交汇点)
Chapter 74: NUMA Nodes, Locality, and Memory Policy
- 74.1 NUMA as Non-Uniform Physical Memory Topology(分析多路系统中不同 CPU 访问不同内存节点的延迟和带宽不一致)
- 74.2 Node-Local Allocation and Fallback to Remote Nodes(追踪内核为何倾向从当前 CPU 本地节点分配内存,以及本地节点不足时如何回退到远端节点)
- 74.3 NUMA Balancing and Page Migration(追踪自动 NUMA balancing 如何根据访问模式迁移页,改善 CPU 与内存的局部性)
- 74.4 Memory Policy, cpuset, and Application-Level Placement Control(追踪
mbind、numactl、cpuset 等机制如何影响内存分布和运行性能) - 74.5 Engineering Insight: On NUMA Systems, Memory Location Is a Performance Property(排查 NUMA 机器上的内存位置、容量、访问代价和拓扑关系如何共同影响性能)
Chapter 75: Diagnosing Physical Memory Fragmentation and Pressure
- 75.1 Reading
/proc/buddyinfo,/proc/zoneinfo, and Watermark State(通过 buddyinfo、zoneinfo 观察空闲页 order 分布、zone 水位和分配压力) - 75.2 High-Order Allocation Failures and Fragmentation Evidence(分析系统还有空闲内存却无法分配连续高阶页的原因)
- 75.3 Compaction, Movable Pages, and Fragmentation Recovery(追踪内存压缩如何迁移可移动页以制造更大的连续空闲块)
- 75.4 Allocation Failure Logs and GFP Context Reconstruction(从内核分配失败日志中还原 order、GFP flags、zone、节点和上下文约束)
- 75.5 Engineering Insight: Allocatable Memory Depends on Shape and Constraints(判断某次分配需求如何受 zone、水位、order、迁移类型和上下文共同约束)
Part 16: Kernel Memory Allocation Slab, Slub, Vmalloc, and Per-CPU Memory
Chapter 76: Kernel Allocator Families and Allocation Context
- 76.1 Page Allocator vs Object Allocator(区分页级分配器和对象级分配器:buddy allocator 适合分配物理页,内核对象分配需要更细粒度机制)
- 76.2 Frequent Small Allocations in Kernel Subsystems(分析
dentry、inode、task_struct、file、网络包元数据等对象为何会频繁创建和释放) - 76.3 Fragmentation, Cache Locality, and Allocation Cost(分析小对象直接使用页分配器会造成内部碎片、缓存局部性差和分配路径过重)
- 76.4 Type-Aware Object Caches(追踪对象缓存如何保留大小、对齐、构造函数、调试信息和复用策略)
- 76.5 Engineering Insight: Kernel Allocation Is Specialized Because Kernel Objects Are Specialized(判断内核分配器是服务不同对象生命周期、上下文和性能路径的专门机制)
Chapter 77: kmalloc, kfree, and Allocation Flags
- 77.1
kmallocas the General Small-Object Allocation Interface(追踪kmalloc如何为普通内核代码提供连续虚拟地址且通常物理连续的小对象分配) - 77.2 Size Classes and Generic Slab Caches(追踪
kmalloc如何映射到不同大小等级的通用缓存,并减少直接向 buddy allocator 要页) - 77.3 GFP Flags and Context-Aware Allocation(追踪
GFP_KERNEL、GFP_ATOMIC、GFP_NOWAIT、GFP_NOIO、GFP_NOFS等标志如何表达调用上下文和回收限制) - 77.4 Zeroed, Aligned, and Array Allocation Helpers(追踪
kzalloc、kcalloc、kmalloc_array、krealloc等辅助接口如何降低常见错误) - 77.5 Engineering Insight: Allocation Flags Are Part of the Caller's Contract(判断分配标志是在声明调用者能否睡眠、能否回收、能否触发 I/O 或文件系统路径)
Chapter 78: Slab and Slub Object Caches
- 78.1 Slab Cache as a Pool of Same-Sized Objects(追踪 slab cache 如何把一组页切分成同类对象,并维护已用、空闲和部分使用状态)
- 78.2 Dedicated Caches for Hot Kernel Objects(分析内核为何为 VMA、inode、dentry、task 相关结构等常用对象建立专用缓存)
- 78.3 SLUB Fast Path and Per-CPU Allocation Behavior(追踪 SLUB 如何通过 per-CPU 快速路径降低锁竞争和跨 CPU 同步成本)
- 78.4 Constructors, Debugging, Red Zones, Poisoning, and KASAN(追踪对象构造、红区、poison、sanitizer 如何帮助发现越界、UAF 和未初始化访问)
- 78.5 Engineering Insight: Slab Allocation Optimizes Object Reuse(判断 slab/slub 如何让对象分配、初始化、缓存局部性和调试能力一起优化)
Chapter 79: vmalloc and Non-Contiguous Kernel Virtual Memory
- 79.1
vmallocand Non-Contiguous Physical Pages(分析kmalloc通常要求物理连续,而vmalloc可以用不连续物理页拼接出连续内核虚拟地址) - 79.2 Page Table Mapping for
vmallocAreas(追踪vmalloc如何分配多个物理页并建立内核页表映射) - 79.3 Allocation Cost, TLB Pressure, and Access Locality(分析
vmalloc比kmalloc更灵活但更重,可能带来页表、TLB 和访问局部性成本) - 79.4 Use Cases: Large Buffers, Module Memory, and Dynamic Kernel Areas(分析大块缓冲区、模块加载、动态映射区域为何常使用 vmalloc 类机制)
- 79.5 Engineering Insight: Virtual and Physical Contiguity Are Separate Guarantees(判断选择
vmalloc时如何同时分析虚拟连续性、硬件访问、DMA 和性能约束)
Chapter 80: Per-CPU Memory and Scalable Allocation Patterns
- 80.1 Shared Global Memory Scalability Bottleneck(分析多 CPU 同时更新全局变量、统计计数器和缓存结构时为何会产生锁竞争和 cache line bouncing)
- 80.2 Per-CPU Variables and Locality(追踪 per-CPU 变量如何让每个 CPU 拥有本地副本,降低共享写入和跨 CPU 同步)
- 80.3 Dynamic Per-CPU Allocation(追踪运行时 per-CPU 内存分配如何服务模块、子系统和动态对象)
- 80.4 Aggregation, Consistency, and Reading Per-CPU State(追踪读取 per-CPU 数据时如何在快速本地更新和全局一致视图之间权衡)
- 80.5 Engineering Insight: Scalability Often Comes from Reducing Sharing(判断高扩展性如何通过让每个 CPU 在本地工作来减少共享状态)
Part 17: Page Cache, Writeback, Reclaim, Compaction, and OOM
Chapter 81: Page Cache as the Center of File IO
- 81.1 Page Cache as Memory-Resident File Data(追踪 page cache 如何把磁盘文件内容缓存在内存中,减少重复 I/O)
- 81.2 Clean Pages, Dirty Pages, and Uptodate State(区分干净缓存页、脏页、正在回写页和已同步页在文件 I/O 中的状态变化)
- 81.3 Buffered Reads and Cache Hits(追踪普通
read如何优先查询 page cache,命中时无需访问磁盘) - 81.4 Buffered Writes and Dirtying Cache Pages(分析普通
write如何先修改 page cache 并标记 dirty,再由回写路径同步到设备) - 81.5 Engineering Insight: Most File I/O First Talks to Memory(判断普通文件 I/O 的第一站通常是 page cache,并把磁盘 I/O 放回缓存缺失、回写或同步语义中解释)
Chapter 82: Dirty Pages, Writeback, and Flusher Threads
- 82.1 Dirty Pages as Deferred Storage Writes(分析 dirty page 表示内存中已有新数据,但后端存储尚未完成持久化)
- 82.2 Writeback Triggers: Time, Thresholds, Sync, and Memory Pressure(追踪周期性回写、脏页比例阈值、
fsync、内存压力如何触发 writeback) - 82.3 Per-BDI Writeback and Flusher Workers(追踪回写如何按 backing device 组织,并由内核工作线程把脏页提交给文件系统和块层)
- 82.4 Writeback Congestion, Throttling, and Latency Spikes(追踪脏页积累、设备拥塞、回写限速如何导致应用写入延迟突然升高)
- 82.5 Engineering Insight: Write Performance Often Depends on When the Kernel Chooses to Pay the I/O Cost(排查写入路径如何把 I/O 成本延后到回写、同步或内存压力时支付)
Chapter 83: Memory Reclaim, LRU Lists, and kswapd
- 83.1 Reclaimable vs Unreclaimable Pages(区分 page cache、匿名页、文件系统元数据、内核固定页、DMA 页等在回收中的不同命运)
- 83.2 Active and Inactive LRU Lists(追踪 LRU 近似模型如何把最近使用和较少使用的页分开,用于选择回收候选)
- 83.3
kswapdand Asynchronous Background Reclaim(追踪当空闲页低于阈值时,kswapd如何在后台扫描并释放或换出可回收页) - 83.4 Direct Reclaim and Allocation-Path Stalls(判断当后台回收不足时,分配者为何会被迫进入 direct reclaim,并造成业务线程卡顿)
- 83.5 Engineering Insight: Reclaim Is the Kernel Negotiating Between Cache Reuse and Allocation Urgency(判断内存回收的核心是在缓存复用收益和新分配需求之间做实时取舍)
Chapter 84: Compaction, Fragmentation, and Huge Page Pressure
- 84.1 External Fragmentation and High-Order Allocation Failure(分析总空闲内存充足时,仍可能因为连续物理页不足导致高阶分配失败)
- 84.2 Memory Compaction by Moving Pages(追踪内存压缩如何迁移可移动页,把分散空闲页聚合成更大的连续区域)
- 84.3
kcompactdand Synchronous Compaction(区分后台kcompactd压缩和分配路径中同步压缩的触发条件与延迟影响) - 84.4 THP, HugeTLB, DMA, and Contiguous Memory Demand(判断透明大页、HugeTLB、DMA 缓冲区为何会增加高阶连续页需求)
- 84.5 Engineering Insight: Fragmentation Is a Shape Problem(排查内存碎片问题时判断空闲内存是否具有所需的连续形状)
Chapter 85: OOM Killer, Memory Death, and Survival Diagnostics
- 85.1 When Reclaim Cannot Save the System(分析在回收、回写、换出、压缩仍无法满足分配时,内核为何必须选择牺牲进程)
- 85.2 OOM Scoring and Victim Selection(追踪 OOM killer 如何根据内存占用、调整值、权限和系统保护策略选择被杀进程)
- 85.3 Memcg OOM vs Global OOM(区分 cgroup 内存限制触发的局部 OOM 和整个系统内存耗尽触发的全局 OOM)
- 85.4 Reading OOM Logs, Allocation Context, and Memory State(从 OOM 日志中读取 gfp flags、order、memcg、zone 状态、进程内存和回收失败原因)
- 85.5 Engineering Insight: OOM Is the Final Symptom of Memory Trouble(排查 OOM 如何来自长时间压力、回收失败、限制配置或泄漏积累)
Part 18: Memory Mapping, Page Faults, Copy-on-Write, and Huge Pages
Chapter 86: Page Fault Entry and Fault Classification
- 86.1 Page Fault as Hardware-Reported Missing Translation(分析 page fault 是 CPU/MMU 在地址翻译、权限检查或页表状态异常时触发的同步异常)
- 86.2 Valid Faults vs Invalid Faults(区分合法缺页、权限升级、COW 触发、栈增长和非法访问导致的 SIGSEGV)
- 86.3 Minor Faults and Major Faults(分析 minor fault 与 major fault 在页表修复、后端存储访问和交换区读入上的差异)
- 86.4 Fault Handling Through VMA and
vm_ops(追踪缺页路径如何先定位 VMA,再根据匿名映射、文件映射、特殊映射进入不同 fault handler) - 86.5 Engineering Insight: Page Faults Can Be Lazy Memory Construction Events(判断缺页异常如何服务 Linux 延迟构建内存映射和物理页)
Chapter 87: Anonymous Memory and File-Backed Mapping
- 87.1 Anonymous Mapping as Demand-Backed Memory(追踪堆、栈、匿名
mmap等区域如何以零页、按需分配和 swap 作为后端) - 87.2 File-Backed Mapping as Addressable File Content(追踪文件映射如何把文件页通过 page cache 映射到进程虚拟地址空间)
- 87.3 Private vs Shared Mapping Semantics(区分
MAP_PRIVATE和MAP_SHARED在写入可见性、COW、回写和进程间共享上的差异) - 87.4 Demand Paging and Lazy Population(分析
mmap如何先建立地址范围和权限语义,并把文件页读入或匿名页分配延迟到首次访问) - 87.5 Engineering Insight:
mmapCreates Meaning Before It Creates Memory(判断mmap的核心是先让一段虚拟地址“有语义”,物理页和文件内容可以之后按需出现)
Chapter 88: Copy-on-Write After fork
- 88.1
forkwith Deferred Memory Copy(分析fork如何先复制页表和 VMA 关系,再通过 COW 延迟物理页复制) - 88.2 Read-Shared Pages and Write-Protected PTEs(追踪父子进程如何暂时共享同一批物理页,并通过只读页表项捕获后续写入)
- 88.3 Write Fault as the Moment of Real Copy(追踪当父进程或子进程第一次写共享页时,缺页路径如何分配新页、复制内容并更新页表)
- 88.4 COW Costs, Fork-Heavy Workloads, and Dirty Memory(分析 COW 在 fork-heavy 程序、数据库、语言运行时和大量脏页场景中的成本)
- 88.5 Engineering Insight:
forkIs Cheap Until Memory Diverges(判断fork的低成本如何来自共享和延迟复制,以及父子地址空间大量写入后成本如何出现)
Chapter 89: Transparent Huge Pages and HugeTLB
- 89.1 Huge Page Translation Cost Reduction(追踪大页如何减少页表项数量、降低 TLB 压力,并改善大内存工作集性能)
- 89.2 Transparent Huge Pages as Automatic Huge-Page Backing(追踪 THP 如何在普通匿名内存路径中自动使用大页,并降低应用显式管理负担)
- 89.3 HugeTLB as Explicit Reserved Huge Page Management(区分 HugeTLB 的预留、挂载、显式映射和资源管理方式)
- 89.4 Splitting, Collapsing, and Fallback Behavior(追踪大页如何被拆分、合并、回退到普通页,以及这些行为对延迟和碎片的影响)
- 89.5 Engineering Insight: Huge Pages Trade Fine-Grained Flexibility for Translation Efficiency(判断大页用更粗粒度的内存管理换取更少地址翻译开销,但也可能带来复制、碎片、回收和延迟成本)
Chapter 90: Debugging Major Faults, Minor Faults, and Memory Surprises
- 90.1 Reading Page Fault Counters and Runtime Symptoms(通过
perf、/proc/<pid>/stat、vmstat等观察 major/minor fault、缺页频率和运行时抖动) - 90.2 Correlating Faults with VMA Layout and Page Cache State(把 fault 地址、
/proc/<pid>/maps、文件映射、page cache 命中和磁盘 I/O 关联起来) - 90.3 Detecting COW Amplification and Fork-Related Memory Growth(分析 fork 后写入导致的 RSS 增长、COW fault 增多和内存复制成本)
- 90.4 Diagnosing THP Latency, Splits, and Compaction Pressure(观察 THP 是否导致分配、压缩、拆分、回收或 COW 路径上的延迟尖刺)
- 90.5 Engineering Insight: Memory Surprises Usually Come from Deferred Costs Becoming Immediate(排查内存问题常常来自延迟分配、延迟复制、延迟读入或大页整理成本在某个时刻集中爆发)
Part 19: File Descriptors, VFS, Inode, Dentry, and Superblock
Chapter 91: File Descriptors and the Process File Table
- 91.1 File Descriptor as a Per-Process Integer Handle(分析 fd 作为进程文件描述符表中的整数索引如何引用底层打开对象)
- 91.2 From fd to
struct file(追踪系统调用如何通过当前进程的 fd table 找到内核中的struct file对象) - 91.3 Open File Descriptions vs File Descriptor Entries(区分文件描述符表项和打开文件描述对象,判断
dup、fork、共享 offset 的行为) - 91.4 Close, Reference Counts, and Object Lifetime(分析
close只是释放当前 fd 引用,底层 file、inode 或 socket 对象可能仍被其他路径持有) - 91.5 Engineering Insight: fd Is a Handle to a Kernel Object Relationship(判断 fd 的核心是用户态通过进程局部整数引用内核对象关系的方式)
Chapter 92: VFS as the Filesystem Abstraction Layer
- 92.1 VFS as the Common Interface Above Filesystem Implementations(追踪 VFS 如何为 ext4、XFS、Btrfs、tmpfs、procfs 等不同文件系统提供统一访问层)
- 92.2 VFS System Calls and Process Context(分析
open、stat、read、write、chmod等 VFS 系统调用通常从进程上下文进入内核) - 92.3 Operation Tables as Filesystem Polymorphism(通过
file_operations、inode_operations、super_operations分析 VFS 如何用回调表实现不同文件系统行为) - 92.4 VFS Caches and Path Resolution Performance(追踪 dcache、inode cache、mount cache 如何降低路径查找和元数据访问成本)
- 92.5 Engineering Insight: VFS Presents One Interface over Different Filesystems(判断 VFS 如何通过统一接口保留各文件系统自己的实现策略)
Chapter 93: inode, dentry, file, and super_block
- 93.1
inodeas Filesystem Object Metadata(追踪 inode 如何表示文件对象的元数据、权限、大小、时间戳和底层文件系统状态) - 93.2
dentryas a Name-to-Inode Cache Entry(追踪 dentry 如何缓存路径名组件到 inode 的映射,包括 negative dentry) - 93.3
struct fileas an Open Instance(分析struct file表示一次打开实例,包含当前位置、打开标志、操作表和私有数据) - 93.4
super_blockas Mounted Filesystem Instance(追踪 superblock 如何表示一个已挂载文件系统实例,并保存全局状态、操作和根目录) - 93.5 Engineering Insight: File Access Is a Relationship Between Name, Object, Open Instance, and Mounted Filesystem(梳理一次文件访问是 dentry、inode、file、superblock 多个对象协同表达)
Chapter 94: Path Lookup, Mounts, and Namespace-Aware Resolution
- 94.1 Pathname Lookup as Component-by-Component Resolution(追踪路径解析如何逐级处理目录组件并维护查找状态)
- 94.2 Dentry Cache and Missed Lookup Results(追踪 dcache 如何缓存已存在名字和未命中结果,从而加速重复路径查找)
- 94.3 Mount Points, Mount Namespaces, and Path Meaning(分析相同路径字符串在不同 mount namespace 中可能指向不同对象)
- 94.4 Symlinks,
.., Bind Mounts, and Lookup Complexity(追踪符号链接、父目录、bind mount 如何让路径解析变成状态相关过程) - 94.5 Engineering Insight: A Path Is a Resolution Procedure(判断路径是在命名空间、挂载树和 dentry cache 中执行的一次解析过程)
Chapter 95: VFS Failure Modes and Filesystem-Level Evidence
- 95.1
ENOENT,EACCES,EBUSY,ESTALE, and What They Reveal(从常见 VFS 错误码推断路径查找、权限、挂载、远程文件系统和对象生命周期问题) - 95.2 Leaked File Descriptors and Busy Mounts(追踪 fd 泄漏、当前工作目录、打开文件和 mmap 如何导致文件系统或挂载点无法卸载)
- 95.3 Dentry and Inode Cache Pressure(通过 slab 统计、dcache 状态和 inode cache 观察元数据缓存压力)
- 95.4 Observing File Paths with
strace,lsof,/proc/<pid>/fd, and ftrace(结合用户态 syscall 轨迹、打开文件列表、procfs fd 链接和 VFS trace 还原文件访问路径) - 95.5 Engineering Insight: Filesystem Bugs Often Hide in the Gap Between Names and Objects(梳理文件系统问题经常是路径名、挂载命名空间、缓存对象和打开实例之间的关系错位)
Part 20: Filesystem Implementations ext4, XFS, Btrfs, and Pseudo Filesystems
Chapter 96: How Real Filesystems Plug into VFS
- 96.1 Filesystem Type Registration and Mount Entry Points(追踪具体文件系统如何注册
file_system_type,并在 mount 时创建 superblock、根 dentry 和内部状态) - 96.2 VFS Operation Tables and Filesystem-Specific Behavior(通过 operation tables 分析具体文件系统如何接入 VFS)
- 96.3 On-Disk Metadata vs In-Memory VFS Objects(区分磁盘上的 inode、目录项、extent、journal 与内存中的 inode、dentry、page cache、superblock)
- 96.4 Mount Options and Runtime Policy(追踪挂载参数如何改变日志模式、写入策略、权限行为、压缩、校验和性能特征)
- 96.5 Engineering Insight: VFS Defines the Contract, Filesystems Define the Reality(排查 VFS 规定统一接口,但持久化语义、崩溃一致性和性能行为最终由具体文件系统实现)
Chapter 97: ext4 Journaling, Extents, and Metadata Consistency
- 97.1 ext4 as a Journaling Filesystem Evolved from ext2/ext3(追踪 ext4 如何在传统 Unix 文件系统模型上加入日志、extent、延迟分配等现代能力)
- 97.2 Extents, Block Groups, and Allocation Locality(追踪 extent 如何替代传统块映射,block group 如何帮助局部性和空间管理)
- 97.3 JBD2 and Metadata Journaling(追踪 ext4 如何通过 JBD2 journal 保护元数据一致性,并在崩溃后恢复到可解释状态)
- 97.4 Ordered, Writeback, and Journal Data Modes(比较不同数据模式如何在性能、数据一致性和写入放大之间做权衡)
- 97.5 Engineering Insight: ext4 Optimizes for Compatibility, Predictability, and Practical Recovery(判断 ext4 如何围绕兼容性、可恢复性、稳定语义和工程可预期性组织设计)
Chapter 98: XFS Scalability, Allocation Groups, and Large Filesystems
- 98.1 XFS as a Filesystem Built for Large-Scale Parallelism(分析 XFS 为何适合大文件、大目录、高并发和大型存储系统)
- 98.2 Allocation Groups as Parallel Metadata Domains(追踪 allocation group 如何把大文件系统拆成多个相对独立的分配和元数据区域)
- 98.3 B+ Trees for Space, Inode, and Extent Management(追踪 XFS 如何大量使用 B+ tree 管理空闲空间、inode、extent 和反向映射)
- 98.4 Delayed Allocation, Logging, and Metadata Recovery(追踪 XFS 的延迟分配、元数据日志和崩溃恢复如何服务吞吐与一致性)
- 98.5 Engineering Insight: XFS Treats Filesystem Scalability as a First-Class Design Goal(判断 XFS 的核心是把大规模并发和元数据扩展性作为主要设计目标)
Chapter 99: Btrfs Copy-on-Write, Checksums, and Subvolumes
- 99.1 Btrfs as a Copy-on-Write Filesystem(分析 Btrfs 如何用 COW 语义组织元数据和数据更新)
- 99.2 Checksums and End-to-End Data Integrity(追踪校验和如何帮助发现数据损坏,并与镜像、RAID、scrub 等机制配合)
- 99.3 Subvolumes, Snapshots, and Send/Receive(追踪子卷、快照和 send/receive 如何把文件系统变成可版本化、可复制的状态树)
- 99.4 Compression, RAID Profiles, and Space Accounting(分析压缩、不同 RAID profile 和空间统计为何会让 Btrfs 行为比传统文件系统更复杂)
- 99.5 Engineering Insight: Btrfs Turns the Filesystem into a Versioned Storage System(追踪 Btrfs 的重点是整个存储状态如何被 COW、校验和、快照共同管理)
Chapter 100: Pseudo Filesystems as Kernel Interfaces
- 100.1 procfs, sysfs, debugfs, tmpfs, devtmpfs, and Their Different Roles(区分伪文件系统中哪些用于进程和内核状态,哪些用于设备模型、调试、临时内存和设备节点)
- 100.2 Filesystem Semantics over Dynamic Kernel Data(分析伪文件系统为何也走 VFS 接口,但数据可能来自内核对象、内存页或动态生成内容)
- 100.3 Stable ABI vs Debug-Only Interface(区分 procfs/sysfs 中相对稳定的用户接口和 debugfs 中不承诺长期兼容的开发接口)
- 100.4 Mount Namespaces and Virtual Filesystem Views(分析伪文件系统在容器、namespace、chroot 和早期用户空间中的特殊作用)
- 100.5 Engineering Insight: In Linux, “Everything Is a File” Often Means “Everything Can Expose a VFS Interface”(判断 Linux 的“一切皆文件”是许多内核对象可以通过 VFS 语义暴露给用户空间)
Part 21: Page Cache IO, Direct IO, Async IO, and io_uring
Chapter 101: Buffered IO and the Page Cache Path
- 101.1 Buffered I/O as the Default File Access Path(分析普通
read/write如何默认经过 page cache,再按缓存命中、回写和同步语义访问设备) - 101.2 Read Path: From File Offset to Cached Page(追踪读取路径如何根据文件 offset 查找 page cache、触发缺页或提交底层 I/O)
- 101.3 Write Path: Dirtying Pages Before Storage Persistence(分析写入通常先修改内存中的缓存页并标记 dirty,落盘时机由 writeback 或同步语义决定)
- 101.4 Cache Benefits, Cache Pollution, and Reclaim Pressure(追踪 page cache 如何提升重复访问性能,同时也可能污染缓存并增加内存回收压力)
- 101.5 Engineering Insight: Buffered I/O Optimizes for Reuse and Integration(判断 buffered I/O 如何把文件数据纳入内存缓存、回写和回收体系)
Chapter 102: Direct IO and Bypassing the Page Cache
- 102.1
O_DIRECTas a Request to Avoid Page Cache(分析 direct I/O 为何试图绕过 page cache,让用户缓冲区和存储路径直接交互) - 102.2 Alignment, Buffer, and Filesystem Constraints(分析 direct I/O 对地址、长度、文件 offset、设备块大小和文件系统实现的约束)
- 102.3 Direct I/O vs Buffered I/O Consistency(分析同一文件混用 direct I/O 与 buffered I/O 时,缓存一致性和同步顺序为何变复杂)
- 102.4 When Direct I/O Helps and When It Hurts(区分数据库、大文件流式处理、一次性扫描等适合场景,以及小 I/O、重复访问、未对齐访问中的代价)
- 102.5 Engineering Insight: Bypassing the Cache Means Owning the Consequences(判断绕过 page cache 可以降低缓存污染和复制成本,但应用必须承担对齐、调度、复用和一致性复杂度)
Chapter 103: Asynchronous IO and Completion Models
- 103.1 Blocking I/O vs Asynchronous Submission(分析同步阻塞 I/O 会让调用线程等待完成,而异步 I/O 把提交和完成解耦)
- 103.2 Completion Notification as a First-Class Design Problem(分析异步 I/O 为何必须设计完成队列、事件通知、回调或轮询机制)
- 103.3 Legacy Linux AIO and Its Limitations(分析传统 Linux AIO 的适用范围、direct I/O 倾向和接口限制)
- 103.4 Thread Pools, Event Loops, and Kernel Async Paths(比较用户态线程池模拟异步、事件循环和内核原生异步路径的差异)
- 103.5 Engineering Insight: Async I/O Is About Managing Outstanding Work(判断异步 I/O 的核心是管理大量未完成请求、完成顺序、背压和错误处理)
Chapter 104: io_uring as a Modern Linux IO Interface
- 104.1 Shared Submission and Completion Rings(追踪
io_uring如何通过用户态和内核共享的提交队列、完成队列减少系统调用和数据复制开销) - 104.2 SQE, CQE, and the Request Lifecycle(追踪一次 I/O 如何从 submission queue entry 进入内核,再以 completion queue entry 返回结果)
- 104.3 Registered Buffers, Registered Files, and Fixed Resources(追踪预注册 buffer、file、资源表如何减少每次 I/O 的查找、pin 和引用成本)
- 104.4 Polling, Linked Operations, and Advanced Submission Patterns(追踪 polling、linked SQE、批量提交、超时和取消如何让
io_uring支持复杂 I/O 工作流) - 104.5 Engineering Insight:
io_uringTurns I/O into a Shared Queue Protocol Between User Space and Kernel(判断io_uring的关键是把用户态和内核态之间的 I/O 交互改造成共享队列协议)
Chapter 105: IO Path Selection and Performance Tradeoffs
- 105.1 Choosing Buffered, Direct, Async, or
io_uringPaths(根据访问模式、缓存复用、延迟、吞吐、内存压力和实现复杂度选择 I/O 路径) - 105.2 Latency vs Throughput in File I/O(梳理单次 I/O 延迟、批量提交吞吐、队列深度、回写延迟和设备并行度之间的关系)
- 105.3 Copy Cost, Cache Pollution, and Page Pinning(分析用户态复制、page cache 污染、DMA、page pinning 和内存回收之间的隐藏代价)
- 105.4 Observing I/O Path Behavior with
strace,perf, ftrace, and blktrace(结合 syscall、CPU 采样、内核 trace 和块层事件判断请求实际走了哪条路径) - 105.5 Engineering Insight: I/O Performance Problems Are Usually Path Selection Problems(排查 I/O 性能问题往往是访问模式、缓存策略、异步模型和设备能力没有匹配)
Part 22: Block Layer, Bio, Request Queues, Schedulers, and Multi-Queue
Chapter 106: From Filesystem Requests to Block IO
- 106.1 Generic Block Layer Role(追踪块层如何作为文件系统、direct I/O、swap、device mapper 和底层块设备驱动之间的统一中间层)
- 106.2 Logical File Offsets vs Block Device Sectors(区分文件 offset、文件系统逻辑块、块设备 sector 和物理设备地址之间的映射关系)
- 106.3 Filesystem Submission into the Block Layer(追踪文件系统如何把 page cache 回写、读缺页、元数据更新或 direct I/O 转换成块层请求)
- 106.4 Block Devices as Random-Access Sector Devices(分析块设备为何以固定大小的扇区或逻辑块提供随机访问接口)
- 106.5 Engineering Insight: Block I/O Is Where File Semantics Become Device-Sized Work(判断块层的核心是把文件系统语义转换成设备能够分析和调度的扇区级工作)
Chapter 107: bio Request and the Block IO Data Model
- 107.1
bioas the Basic Block I/O Description(追踪bio如何描述一次块 I/O 的方向、起始扇区、长度、目标设备和内存页片段) - 107.2
bio_vecand Page-Based I/O Segments(追踪bio_vec如何把内存页、页内偏移和长度组织成设备 I/O 的数据来源或目的地) - 107.3 Merging, Splitting, and Cloning
bio(分析块层为何需要合并相邻 I/O、拆分超过设备限制的 I/O,以及在 device mapper 等层克隆请求) - 107.4 Request as a Driver-Facing I/O Unit(追踪多个 bio 如何可能被合并成 request,并最终交给驱动或硬件队列处理)
- 107.5 Engineering Insight:
bioDescribes Data Movement Before the Device Knows How to Execute It(判断bio表达的是数据移动需求,而 request 才更接近驱动和设备执行单位)
Chapter 108: Request Queues and IO Schedulers
- 108.1 Request Queue as the Block Device Submission Boundary(分析每个块设备为何需要请求队列来承接、排序、合并和分发 I/O)
- 108.2 Merging Adjacent Requests and Reducing Device Work(追踪请求合并如何减少设备命令数量,尤其对旋转磁盘和顺序访问模式有意义)
- 108.3 I/O Scheduler Goals: Fairness, Latency, and Throughput(追踪 I/O 调度器如何在公平性、延迟、吞吐、顺序性和设备特性之间做权衡)
- 108.4 Deadline, BFQ, Kyber, and Scheduler Selection(比较不同 I/O 调度策略在桌面交互、服务器吞吐、低延迟和多租户场景中的目标差异)
- 108.5 Engineering Insight: I/O Scheduling Is About Controlling When Work Reaches the Device(判断 I/O 调度器是决定哪些请求以什么顺序、什么节奏进入设备)
Chapter 109: blk-mq and Multi-Queue Scalability
- 109.1 Single-Queue Block I/O Bottleneck(追踪传统单队列模型如何在高速 SSD、多核 CPU 和高 IOPS 场景下遇到锁竞争和缓存一致性开销)
- 109.2 Software Queues and Hardware Dispatch Queues(追踪 blk-mq 如何用软件提交队列和硬件分发队列分离 CPU 本地提交与设备并行执行)
- 109.3 Mapping CPUs, Hardware Queues, and Device Capabilities(追踪 CPU、NUMA 拓扑、硬件队列数量、tag 分配和驱动能力如何共同影响 blk-mq 映射)
- 109.4 Tags, In-Flight Requests, and Completion Paths(追踪 tag 如何标识在途请求,设备完成后如何把 completion 映射回原 request)
- 109.5 Engineering Insight: blk-mq Makes Storage I/O a Multi-Core Queueing Problem(判断现代块 I/O 如何围绕跨 CPU、跨硬件队列、跨 NUMA 的并行排队与完成展开)
Chapter 110: Tracing Block Latency and Queueing Behavior
- 110.1 Observing Block Devices with
/sys/blockand Queue Attributes(通过/sys/block/<dev>/queue观察队列深度、调度器、sector size、rotational、discard 等设备能力) - 110.2 Block Tracepoints and Request Lifecycle Events(使用 block tracepoints 观察 bio 提交、request 插入、合并、派发、完成等生命周期事件)
- 110.3 Queueing Delay vs Device Service Time(区分请求在内核队列里等待的时间和设备执行 I/O 的服务时间)
- 110.4 Diagnosing High Latency with
iostat,blktrace, ftrace, and perf(结合系统工具、块层 trace、CPU 采样和设备统计定位延迟来源) - 110.5 Engineering Insight: Slow Storage Is Often Slow Queueing Before It Is Slow Hardware(判断存储慢如何来自排队、合并、调度、回写或上层提交模式造成的等待)
Part 23: Storage Devices, NVMe, SCSI, Device Mapper, and Filesystem Reliability
Chapter 111: Storage Stack from Block Layer to Device
- 111.1 The Storage Stack as Layered Block Translation(追踪一次块 I/O 如何从文件系统、块层、device mapper、驱动队列一路到真实设备)
- 111.2 Physical Devices vs Virtual Block Devices(区分真实 NVMe/SCSI/SATA 设备和 dm-crypt、LVM、RAID、loop、nbd 等虚拟块设备)
- 111.3 Caches Along the Storage Path(追踪 page cache、block queue、controller cache 和 device cache 对性能与持久化的影响)
- 111.4 Errors, Timeouts, Resets, and Retry Paths(分析存储路径中的 I/O 错误、设备超时、控制器 reset、路径切换和重试机制)
- 111.5 Engineering Insight: Storage Is a Stack of Promises About Ordering and Durability(判断存储系统的核心是每一层对顺序、完成和持久化作出的承诺)
Chapter 112: SCSI and the Legacy Storage Model
- 112.1 SCSI as a Command-Based Storage Architecture(分析 SCSI 为何以命令、目标、LUN、队列和 sense data 组织存储访问)
- 112.2 SCSI Midlayer, Low-Level Drivers, and Device Discovery(追踪 Linux SCSI midlayer 如何连接上层块层和下层 HBA / 传输驱动)
- 112.3 Request Sense, Error Handling, and Recovery Semantics(追踪 SCSI 错误如何通过 sense data 表达,并如何触发重试、reset 或设备离线)
- 112.4 Multipath, SAN, and Enterprise Storage Assumptions(追踪多路径、外部阵列、光纤通道/iSCSI 等企业存储场景如何影响 I/O 语义)
- 112.5 Engineering Insight: SCSI Is Old Because Its Abstractions Still Fit Many Storage Systems(判断 SCSI 的命令和错误模型如何覆盖大量企业存储设备)
Chapter 113: NVMe Queues, Commands, and High-Performance Storage
- 113.1 NVMe as a PCIe-Native Queue-Based Storage Protocol(分析 NVMe 为何围绕 submission queue、completion queue 和 PCIe 并行能力设计)
- 113.2 Admin Queues and I/O Queues(区分管理命令队列和数据 I/O 队列,以及它们在初始化、配置和正常读写中的作用)
- 113.3 Queue Depth, Interrupts, Polling, and CPU Affinity(追踪队列深度、中断分布、轮询模式和 CPU 亲和性如何影响 NVMe 延迟与吞吐)
- 113.4 NVMe Error Handling, Reset, and Controller State(分析控制器超时、abort、reset、namespace 状态和设备不可用时的恢复路径)
- 113.5 Engineering Insight: NVMe Turns Storage Performance into Queue Topology Engineering(梳理 NVMe 的高性能是协议、队列、CPU 亲和性和并发提交共同形成的结果)
Chapter 114: Device Mapper, LVM, RAID, and Layered Block Devices
- 114.1 Device Mapper as a Virtual Block Device Framework(追踪 device mapper 如何把一个或多个底层块设备映射成新的虚拟块设备)
- 114.2 Linear, Striped, Mirror, Snapshot, Thin, Cache, and Crypt Targets(比较常见 dm target 如何改变地址映射、冗余、快照、缓存、精简配置和加密语义)
- 114.3 LVM as Policy and Metadata on Top of Device Mapper(追踪 LVM 如何在 device mapper 之上管理物理卷、卷组、逻辑卷和在线扩展)
- 114.4 Layered Failure and Performance Amplification(追踪多层块设备如何放大延迟、错误传播、flush 成本、队列限制和写放大)
- 114.5 Engineering Insight: Virtual Block Devices Compose Power and Complexity Together(判断虚拟块设备让存储能力可组合,但每增加一层也增加了语义、性能和故障分析复杂度)
Chapter 115: Reliability, Flush, FUA, Barriers, and Crash Consistency
- 115.1 Volatile Write Caches and the Durability Gap(分析设备写缓存为何可能让“写完成”和“断电后仍存在”之间产生差距)
- 115.2 Flush and FUA as Explicit Durability Controls(追踪
REQ_PREFLUSH和REQ_FUA如何让文件系统向块层表达写缓存刷新和强制单次写入持久化需求) - 115.3 Filesystem Journal Commit and Storage Ordering(追踪日志提交、元数据写入、数据写入、flush/FUA 顺序如何共同保证崩溃后一致性)
- 115.4 Barriers Through Device Mapper and RAID Layers(分析 flush/FUA/ordering 语义穿过 dm、RAID、缓存层时为何必须被正确传递或模拟)
- 115.5 Engineering Insight: Crash Consistency Is About What Survives After the Last Completed Promise(排查崩溃一致性时判断存储栈已经承诺完成并持久化了哪些内容)
Part 24: Device Model, Kobject, Sysfs, Driver Core, and Device Lifetime
Chapter 116: Linux Device Model as a Kernel Object Hierarchy
- 116.1 Unified Device Model Role(分析 Linux 如何统一描述设备、驱动、总线、类别和电源状态,减少驱动各自管理硬件的碎片化)
- 116.2 Devices, Drivers, Buses, and Classes(区分
struct device、struct device_driver、struct bus_type、struct class在设备模型中的职责) - 116.3 Device Hierarchy and Parent-Child Relationships(追踪设备树状层级如何表达真实硬件拓扑、虚拟设备关系和电源依赖)
- 116.4 Uevents, Userspace Discovery, and Hotplug Integration(追踪内核如何通过 uevent 通知用户空间设备新增、移除和状态变化)
- 116.5 Engineering Insight: The Device Model Turns Hardware Chaos into Object Relationships(判断设备模型如何把复杂硬件世界转化成可枚举、可绑定、可观察、可释放的内核对象关系)
Chapter 117: kobject, kset, ktype, and Reference Lifetime
- 117.1
kobjectas the Minimal Kernel Object Infrastructure(追踪kobject如何提供名称、引用计数、父子层级、类型和 sysfs 表示) - 117.2 Embedded
kobjectand Container Objects(分析kobject如何嵌入在更大的对象中,并由宿主结构体保存业务状态) - 117.3
ksetas Object Collection and Event Context(追踪kset如何组织同类对象集合,并影响对象在 sysfs 中的位置和事件行为) - 117.4
ktype, Release Callback, and Safe Destruction(追踪ktype如何定义属性、sysfs 操作和 release 回调,确保对象引用归零后正确释放) - 117.5 Engineering Insight: kobject Is Mostly About Lifetime and Visibility(排查
kobject如何解决对象命名、层级、引用和可见性问题)
Chapter 118: Device, Driver, Bus, and Class Relationships
- 118.1 Bus as the Matching Domain Between Devices and Drivers(追踪 bus 如何定义设备和驱动匹配规则,例如 platform、PCI、USB、I2C、SPI 的差异)
- 118.2 Driver Binding and the
probeEntry Point(追踪 driver core 匹配成功后如何调用probe,让驱动申请资源、初始化硬件并注册功能接口) - 118.3
remove, Shutdown, Suspend, and Resume Paths(追踪设备移除、系统关机、挂起恢复和运行时电源管理如何进入驱动回调) - 118.4 Class Devices and User-Space Meaning(追踪 class 如何按用户空间语义组织设备,例如 block、net、input、tty,并和物理拓扑分层对应)
- 118.5 Engineering Insight: Driver Binding Is a Contract Between Description, Matching, and Lifetime(判断驱动绑定是硬件描述、匹配规则、资源生命周期和用户可见接口之间的契约)
Chapter 119: Sysfs Representation of Kernel Devices
- 119.1
/sys/devicesas the Physical and Logical Device Tree(追踪/sys/devices如何展示内核设备层级、父子关系和拓扑结构) - 119.2
/sys/bus,/sys/class, and Cross-Linked Views(追踪 sysfs 如何通过 bus、class、device 等多个视角暴露同一批内核对象) - 119.3 Device Attributes, Attribute Groups, and One-Value Files(追踪设备属性如何通过 show/store 暴露,为何 sysfs 通常强调一个文件表达一个属性)
- 119.4 Module, Driver, and Device Links in sysfs(通过 sysfs 链接观察模块、驱动、设备、总线和 class 之间的绑定关系)
- 119.5 Engineering Insight: sysfs Is a Projection of Kernel Object Relationships(判断
sysfs的核心是设备模型对象关系的用户态投影,并据此区分属性接口和配置文件树)
Chapter 120: Device Lifetime Bugs and Driver Core Diagnostics
- 120.1 Probe Failure and Partial Initialization Cleanup(分析
probe失败时为何必须按资源申请顺序反向释放,保证半初始化设备资源完整回收) - 120.2 Remove Races, Open Handles, and In-Flight Work(分析设备移除时仍有打开文件、异步 work、中断、DMA 或网络包在使用设备的风险)
- 120.3 Reference Leaks and Use-After-Free in Device Objects(追踪 device、driver、kobject 引用计数错误如何导致泄漏、悬空指针和 sysfs 残留对象)
- 120.4 Diagnosing Driver Core State with sysfs, dmesg, and Dynamic Debug(结合 sysfs 拓扑、内核日志、driver core 调试输出定位绑定、probe、remove 和电源管理问题)
- 120.5 Engineering Insight: Device Lifetime Is Hard Because Hardware Can Disappear While Software Still Holds References(判断设备生命周期难点在于硬件可能被拔掉、关闭或重置,而软件路径仍可能持有对象引用或未完成工作)
Part 25: Bus Frameworks Platform, PCI, USB, I2C, SPI, ACPI, and Device Tree
Chapter 121: Bus Frameworks as Driver Matching and Resource Models
- 121.1 Bus as the Discovery and Matching Domain(追踪 bus framework 如何定义设备从哪里来、如何被枚举、如何和驱动匹配)
- 121.2 Common Driver Core, Different Bus Semantics(判断同样接入 driver core,但 PCI、USB、I2C、SPI、platform 在发现方式、地址模型和热插拔能力上完全不同)
- 121.3 Device IDs, Match Tables, and Modalias(追踪设备 ID 表、compatible 字符串、modalias 如何让内核和用户空间自动选择合适驱动)
- 121.4 Resource Description Before Driver Binding(判断驱动 probe 之前,bus framework 需要先描述 MMIO、IRQ、DMA、时钟、GPIO、电源等资源)
- 121.5 Engineering Insight: A Bus Is a Kernel-Level Matching and Resource Model(判断总线是 Linux 用来表达设备发现、匹配、资源和生命周期的抽象)
Chapter 122: Platform Devices and Board-Level Description
- 122.1 Platform Bus for Non-Discoverable Devices(分析 platform device 如何服务需要固件或板级代码描述的设备)
- 122.2
platform_device,platform_driver, andprobe(追踪 platform 设备如何通过 name、compatible、资源表和 driver match 进入 probe) - 122.3 MMIO, IRQ, Clock, Reset, Regulator, and GPIO Resources(追踪平台设备常见资源如何由 firmware description 提供,并由驱动在 probe 中获取)
- 122.4 Board Files, Device Tree, and ACPI Evolution(分析从板级硬编码到 Device Tree / ACPI 描述硬件的工程演进)
- 122.5 Engineering Insight: Platform Devices Give Board-Described Hardware an Identity(判断 platform bus 的核心是为片上设备和板级外设建立内核可识别身份)
Chapter 123: PCI Enumeration, BARs, MSI, and Configuration Space
- 123.1 PCI as a Self-Discoverable Bus(追踪 PCI/PCIe 设备如何通过配置空间被枚举,并和静态板级描述形成互补)
- 123.2 Vendor ID, Device ID, Class Code, and Match Tables(追踪 PCI 驱动如何通过厂商 ID、设备 ID、class code 等信息匹配硬件)
- 123.3 BARs and MMIO Resource Assignment(追踪 BAR 如何描述设备 MMIO 或 I/O 空间需求,以及内核如何分配和映射这些资源)
- 123.4 MSI, MSI-X, and Interrupt Delivery(追踪现代 PCIe 设备如何使用 MSI/MSI-X 替代传统线中断,并支持多队列和中断分布)
- 123.5 Engineering Insight: PCI Drivers Start from Enumeration but Live in Resource Management(判断 PCI 设备自枚举之后,驱动如何处理资源启用、DMA、IRQ、错误恢复和电源状态管理)
Chapter 124: USB, I2C, and SPI Device Models
- 124.1 USB as Hotplug-Oriented Hierarchical Device Discovery(追踪 USB 如何通过 hub、descriptor、interface、endpoint 支持动态插拔和多接口设备)
- 124.2 I2C as Addressed Low-Speed Device Communication(分析 I2C/SMBus 设备通常通过总线地址、adapter、client 和板级描述建立设备模型)
- 124.3 SPI as Controller-Driven Synchronous Peripheral Access(追踪 SPI 设备如何依赖 controller、chip select、mode、clock 和 full-duplex transfer 描述通信)
- 124.4 Protocol Bus vs Register Bus vs Packet Bus(比较 USB、I2C、SPI 在通信模型、驱动结构、传输粒度和错误处理上的差异)
- 124.5 Engineering Insight: The Bus Determines the Shape of the Driver(判断驱动结构往往是由总线的发现方式、传输模型和资源语义塑造)
Chapter 125: ACPI and Device Tree as Hardware Description Mechanisms
- 125.1 Firmware Hardware Description Role(分析操作系统为何需要固件提供硬件拓扑、设备资源、电源状态和平台约束)
- 125.2 Device Tree Nodes, Properties, and
compatibleMatching(追踪 Device Tree 如何用节点、属性和 compatible 字符串描述不可自枚举硬件) - 125.3 ACPI Tables, Device Objects, and Platform Control(追踪 ACPI 如何通过表、命名空间、方法和电源管理语义向操作系统描述平台)
- 125.4 Device Tree Bindings and Schema Validation(追踪 bindings 如何约束设备节点应该有哪些属性,并把硬件描述收敛成可维护的结构化文本)
- 125.5 Engineering Insight: Firmware Description Is the Boundary Between Hardware Reality and Kernel Abstraction(判断 Device Tree 和 ACPI 的核心,是把真实硬件连接关系翻译成内核可以匹配、管理和调试的对象模型)
Part 26: Character Devices, Block Devices, Network Devices, and Misc Drivers
Chapter 126: Character Device Registration and file_operations
- 126.1 Character Devices as Byte-Stream or Command-Oriented Interfaces(分析字符设备为何适合串口、传感器、控制接口、简单硬件通道等非块式访问场景)
- 126.2 Device Numbers,
cdev, and/devNodes(梳理 major/minor 设备号、struct cdev、设备节点和用户态打开路径之间的关系) - 126.3
file_operationsas the Driver’s User-Space Contract(通过open、read、write、poll、mmap、ioctl分析字符设备如何接入 VFS) - 126.4
ioctl, Private Commands, and ABI Responsibility(追踪ioctl如何承载设备私有控制命令,以及一旦暴露给用户态就必须维护 ABI 稳定性) - 126.5 Engineering Insight: A Character Driver Is a Kernel Object Exposed Through File Semantics(判断字符驱动是把内核对象用文件语义安全暴露给用户态)
Chapter 127: Block Device Driver Model and Request Handling
- 127.1 Block Devices as Random-Access Fixed-Size Storage(分析块设备为何以 sector、block、request 为核心单位)
- 127.2
gendisk, Block Device Registration, and Partitions(追踪gendisk如何表示磁盘级对象,并和分区、设备节点、sysfs 以及块层队列关联) - 127.3 Request Queue,
bio, and Driver Dispatch(追踪块设备驱动如何接收块层构造的 request 或 bio,并把它们提交给硬件或虚拟后端) - 127.4 Completion, Error Handling, and Media Change(追踪块 I/O 完成、错误上报、设备移除、介质变化和重试路径如何影响上层文件系统)
- 127.5 Engineering Insight: Block Drivers Serve the Storage Stack(判断块驱动的入口是经过 VFS、文件系统、页缓存和块层重塑后的 I/O 工作)
Chapter 128: Network Device Registration and net_device Operations
- 128.1 Network Devices as Packet-Oriented Interfaces(分析网卡驱动如何围绕 packet 和队列组织处理路径)
- 128.2
struct net_deviceandnet_device_ops(追踪网络设备如何通过net_device描述接口状态、队列、MTU、地址、统计和操作回调) - 128.3 TX Path: From
ndo_start_xmitto Hardware Ring(追踪发送路径如何把sk_buff放入 TX ring、映射 DMA 并通知硬件发送) - 128.4 RX Path: Interrupts, NAPI, and Packet Delivery(追踪接收路径如何从中断转入 NAPI poll,再把 packet 交给协议栈)
- 128.5 Engineering Insight: Network Drivers Are Queue and Packet Engines(判断网络驱动的核心是 packet 生命周期、队列管理、DMA 和协议栈交接)
Chapter 129: Misc Drivers and Simple Kernel Interfaces
- 129.1
miscdeviceas Simple Character Device Path(追踪 misc driver 如何为简单字符设备减少样板代码,并降低手动管理复杂 major 分配的成本) - 129.2 Minor Allocation, Registration, and
/devExposure(追踪 misc 设备如何注册 minor、生成设备节点,并暴露给用户态程序) - 129.3 Typical Uses: Control Devices, Debug Channels, and Small Hardware Blocks(分析 misc driver 适合小型控制接口、管理节点、简单硬件功能和调试通道)
- 129.4 Limits of the Misc Driver Abstraction(判断 misc driver 的适用边界:复杂拓扑、多个队列、子设备、电源管理或总线语义通常需要专用子系统)
- 129.5 Engineering Insight: Simple Driver Interfaces Are Useful Until They Hide the Real Device Model(判断 misc driver 如何快速暴露简单接口,同时保留真实设备生命周期和资源关系)
Chapter 130: Choosing the Correct Driver Abstraction
- 130.1 Interface Shape: Stream, Block, Packet, Control, or Memory Mapping(根据设备对外表现是字节流、块存储、网络包、控制命令还是映射内存选择抽象)
- 130.2 Subsystem Integration vs Standalone Device Node(判断设备是否应该接入 input、tty、drm、media、hwmon、iio、netdev 等已有子系统,并说明对应数据模型和用户接口)
- 130.3 User-Space ABI and Long-Term Maintenance(分析驱动暴露的
/dev、sysfs、ioctl、netlink、configfs 接口都会成为长期维护负担) - 130.4 Performance, Security, and Observability Tradeoffs(判断不同驱动抽象在吞吐、延迟、权限控制、调试工具和可观测性上的差异)
- 130.5 Engineering Insight: The Right Driver Type Is Determined by the Data Model(判断驱动类型如何由设备数据模型和内核子系统关系决定)
Part 27: IRQ, DMA, MMIO, IOMMU, Cache Coherency, and Hardware Resources
Chapter 131: MMIO and Register-Level Hardware Control
- 131.1 MMIO as Device Registers Mapped into CPU Address Space(追踪 MMIO 如何把设备寄存器映射到 CPU 可访问地址范围,让驱动通过读写内存语义控制硬件)
- 131.2
ioremap,__iomem, and Accessor Functions(分析驱动使用ioremap、readl、writel等专门接口访问设备寄存器的原因和 MMIO 语义边界) - 131.3 Register Ordering, Posted Writes, and Read-Back Rules(分析 MMIO 写入可能被总线或设备延迟,为何某些路径需要 read-back 或 barrier 确保顺序)
- 131.4 Resource Reservation and Managed MMIO Mapping(追踪
platform_get_resource、pci_iomap、devm_ioremap_resource等接口如何把资源申请、映射和释放绑定到设备生命周期) - 131.5 Engineering Insight: MMIO Looks Like Memory Access but Behaves Like Hardware Protocol(判断 MMIO 表面像读写地址,核心是在和设备寄存器协议、总线顺序和硬件状态机交互)
Chapter 132: IRQ Request, Handling, Affinity, and Teardown
- 132.1 Requesting IRQs and Binding Handlers to Hardware Events(追踪驱动如何通过
request_irq、devm_request_irq或 threaded IRQ 把硬件中断绑定到处理函数) - 132.2 Shared IRQs, Trigger Types, and Interrupt Acknowledgement(梳理共享中断、边沿触发、水平触发、设备侧清中断和控制器侧 EOI 之间的关系)
- 132.3 IRQ Affinity, Multi-Queue Devices, and CPU Locality(追踪网卡、NVMe 等多队列设备如何通过 IRQ affinity 把中断分布到合适 CPU)
- 132.4 Freeing IRQs Under In-Flight Interrupts(追踪设备移除或驱动卸载时,如何处理正在执行或即将执行的中断处理路径)
- 132.5 Engineering Insight: IRQ Teardown Is Harder Than IRQ Registration(判断释放中断必须完成设备触发停止、处理函数退出、共享资源访问结束和并发路径收束)
Chapter 133: DMA Mapping, Streaming DMA, and Consistent DMA
- 133.1 DMA as Device-Initiated Memory Access(追踪 DMA 如何让设备绕过 CPU 直接读写内存,从而降低数据搬运成本)
- 133.2 CPU Address, Physical Address, and DMA Address(区分 CPU 虚拟地址、CPU 物理地址和设备可见 DMA 地址,建立三者的转换和可见性边界)
- 133.3 Streaming DMA Mapping and Sync Points(追踪
dma_map_single、dma_unmap_single、dma_sync_*如何为一次性或短期 DMA 传输建立设备可见映射) - 133.4 Consistent DMA Memory for Descriptor Rings and Shared State(分析
dma_alloc_coherent适合描述符 ring、队列、doorbell 相关共享状态,因为 CPU 和设备需要持续观察同一块内存) - 133.5 Engineering Insight: DMA Correctness Is About Who Can See Which Memory, When(判断 DMA 的核心是 CPU、设备、IOMMU 和 cache 在什么时间看到哪一份数据)
Chapter 134: IOMMU, Address Translation, and Device Isolation
- 134.1 IOMMU as the MMU for Devices(追踪 IOMMU 如何为设备 DMA 请求提供地址翻译、权限控制和隔离能力)
- 134.2 DMA Domains, Device Attachment, and Mapping Windows(追踪设备如何被附加到 IOMMU domain,DMA API 如何在 domain 中建立设备可访问映射)
- 134.3 Isolation, Virtualization, and Passthrough(分析 IOMMU 在设备直通、虚拟机隔离、安全边界和错误 DMA 限制中的作用)
- 134.4 IOMMU Faults and Debugging Misconfigured DMA(通过 IOMMU fault 日志、DMA mapping 错误和设备异常定位错误地址、越界访问或未映射访问)
- 134.5 Engineering Insight: IOMMU Makes Device Memory Access Explicitly Governed(判断没有 IOMMU 时设备访问内存更接近物理能力,有 IOMMU 后设备 DMA 变成受权限和映射控制的地址空间行为)
Chapter 135: Cache Coherency Problems in Real Hardware Interaction
- 135.1 CPU Caches vs Device DMA Visibility(分析 CPU cache、设备 DMA 和内存可见性之间需要同步维护的原因)
- 135.2 Coherent vs Non-Coherent DMA Architectures(区分硬件自动维护 cache 一致性的架构和需要驱动显式同步的非一致性架构)
- 135.3 Direction Flags and Cache Maintenance Semantics(追踪
DMA_TO_DEVICE、DMA_FROM_DEVICE、DMA_BIDIRECTIONAL如何影响 cache 清理、失效和同步方向) - 135.4 Common Bugs: Stale Data, Overwritten Buffers, and Missing Sync(分析漏掉 sync、方向写错、过早复用 buffer、设备仍在 DMA 时释放内存会导致的数据损坏)
- 135.5 Engineering Insight: Hardware Bugs Often Start as Memory Visibility Bugs(排查很多看似设备随机错误的问题,核心是 CPU、cache、设备和 DMA 映射之间的数据可见性规则被破坏)
Part 28: Power Management, Hotplug, Firmware Loading, and Runtime PM
Chapter 136: System Sleep, Suspend, Resume, and Wakeup
- 136.1 System Sleep States and Global Power Transitions(追踪 suspend-to-idle、suspend-to-RAM、hibernate 等系统级睡眠状态如何改变 CPU、内存、设备和平台固件状态)
- 136.2 Device Suspend and Resume Callback Ordering(追踪系统 suspend/resume 过程中,driver core 如何按设备依赖和父子关系调用驱动回调)
- 136.3 Wakeup Sources and Resume Reasons(追踪哪些设备可以作为 wakeup source,以及内核如何记录和处理唤醒事件)
- 136.4 Freezing Tasks and Quiescing I/O(说明系统睡眠前冻结用户态任务、停止新 I/O、同步设备状态并让驱动进入可控静止状态)
- 136.5 Engineering Insight: System Suspend Is a Coordinated Stop-the-World Across Devices(梳理系统睡眠是内核、驱动、设备、固件和用户态共同完成的一次全局状态保存与恢复)
Chapter 137: Runtime Power Management and Device Idle States
- 137.1 Runtime PM as Per-Device Power Control While the System Runs(追踪 runtime PM 如何在系统仍运行时,让单个空闲设备进入低功耗状态)
- 137.2 Usage Counters, Autosuspend, and PM Core State(追踪 usage counter、autosuspend delay、runtime status 如何控制设备何时可以 suspend 或 resume)
- 137.3
dev_pm_opsRuntime Callbacks(追踪runtime_suspend、runtime_resume、runtime_idle回调如何由 PM core 调用并和驱动状态协同) - 137.4 Parent-Child Dependencies and Power Domains(追踪设备父子关系、电源域、时钟、regulator 如何影响单个设备是否真的能断电)
- 137.5 Engineering Insight: Runtime PM Is About Proving a Device Is Idle Enough to Disappear Temporarily(判断 Runtime PM 的关键是证明设备当前没有未完成工作、没有外部依赖、可以安全暂时不可用)
Chapter 138: CPU Hotplug, Memory Hotplug, and Device Hotplug
- 138.1 Hotplug as Runtime Topology Mutation(分析热插拔意味着系统拓扑在运行时变化,内核必须动态调整 CPU、内存、设备和相关数据结构)
- 138.2 CPU Hotplug and Scheduler/IRQ Reconfiguration(追踪 CPU 上线下线时,调度域、runqueue、timer、中断亲和性和 per-CPU 数据如何调整)
- 138.3 Memory Hotplug and Online/Offline Page Management(追踪内存热插拔如何把新增物理内存纳入 zone/node,或在下线前迁移、隔离和释放页)
- 138.4 Device Hotplug and Driver Rebinding(追踪 USB、PCIe、Thunderbolt、平台设备等热插拔路径如何触发设备创建、驱动匹配、probe/remove 和用户态事件)
- 138.5 Engineering Insight: Hotplug Turns Static Kernel Assumptions into Runtime Failure Points(判断热插拔让“CPU 一直在、内存一直在、设备一直在”的假设失效,因此生命周期和并发退出路径必须成为一等设计)
Chapter 139: Firmware Loading and Device Initialization Dependencies
- 139.1 Driver Probe Firmware Loading(分析某些设备需要驱动在 probe 或初始化阶段从文件系统加载固件,才能启动内部控制器或微码)
- 139.2
request_firmwareand the Kernel Firmware Loader(追踪内核 firmware loader 如何通过文件系统和用户态配合把固件 blob 交给驱动) - 139.3 Built-In Firmware, initramfs, and Early Boot Devices(追踪根文件系统尚未可用时,驱动如何通过内建固件或 initramfs 满足早期设备初始化需求)
- 139.4 Firmware Versioning, Licensing, and Failure Handling(追踪固件缺失、版本不匹配、加载失败和许可证约束如何影响设备可用性)
- 139.5 Engineering Insight: Firmware Completes Some Hardware(判断现代设备如何通过软件、固件和硬件三方协商完成初始化)
Chapter 140: Power Management Failure Modes in Drivers
- 140.1 Resume Failures and Lost Device State(分析驱动恢复时遗漏寄存器、队列、DMA、IRQ 或固件状态重建后,设备为何会进入半恢复状态)
- 140.2 Runtime PM Races with I/O Submission(分析设备刚进入低功耗时又有 I/O 到达,或 I/O 未完成却被 suspend,会导致超时、数据丢失或崩溃)
- 140.3 Wakeup Bugs, Spurious Wakeups, and Missed Wake Events(追踪设备错误配置 wakeup source 如何导致系统无法睡眠、频繁唤醒或无法被正确唤醒)
- 140.4 Debugging PM with sysfs, dmesg, ftrace, and PM Debug Options(通过
/sys/power、设备 power 属性、内核日志、PM trace 和 ftrace 还原电源状态转换) - 140.5 Engineering Insight: Power Bugs Are State Machine Bugs with Time Gaps(排查电源管理问题通常是设备在 suspend、resume、idle、active 之间状态迁移不完整或时序错误)
Part 29: Socket Layer, sk_buff, Routing, Netfilter, and TCP IP Stack
Chapter 141: Socket API and Kernel Socket Objects
- 141.1 Socket as the User-Space Entry to the Network Stack(追踪用户态
socket、bind、listen、connect、send、recv如何进入内核网络栈) - 141.2
struct socket,struct sock, and Protocol-Specific State(区分 VFS 层 socket 对象、协议无关 socket 状态和 TCP/UDP 等协议私有状态) - 141.3 Socket Buffers, Queues, and Backpressure(追踪发送队列、接收队列、内存限额和拥塞反馈如何影响应用层读写行为)
- 141.4 Blocking, Nonblocking, Polling, and Wakeups(追踪 socket I/O 如何通过阻塞、非阻塞、
poll、epoll和等待队列与应用事件循环交互) - 141.5 Engineering Insight: A Socket Is a File Descriptor Backed by a Protocol State Machine(判断 socket 表面是 fd,内部却是协议状态机、队列、内存记账和网络路径的组合)
Chapter 142: sk_buff as the Network Packet Object
- 142.1
sk_buffas Packet Metadata and Buffer Reference(分析sk_buff保存 packet 元数据、指针、长度、协议状态和引用关系的方式) - 142.2 Headroom, Tailroom, Linear Data, and Fragments(追踪 skb 的 head buffer、headroom、tailroom、线性区和分片区如何支持协议头增删和零拷贝)
- 142.3 Protocol Header Pointers and Layer Transitions(追踪 MAC、network、transport header 指针如何让同一个 skb 在链路层、IP 层和传输层之间移动)
- 142.4 Cloning, Sharing, Copying, and Ownership(追踪 skb clone、copy、shared data、引用计数和修改前复制如何影响性能与正确性)
- 142.5 Engineering Insight:
sk_buffIs the Passport a Packet Carries Through the Kernel(判断 skb 是 packet 在内核各层流动时携带的身份、位置、状态和处理历史)
Chapter 143: Receive Path and Transmit Path Through the Stack
- 143.1 RX Path from NIC Ring to Protocol Stack(追踪网卡 DMA、RX ring、NAPI poll、skb 构造、协议分发如何组成接收路径)
- 143.2 TX Path from Socket Send to Device Queue(追踪用户态发送如何经过 socket buffer、TCP/UDP/IP、qdisc、netdev queue 和驱动 TX ring)
- 143.3 Checksum, Segmentation, GRO, GSO, and Offload Interaction(追踪校验和、分段、聚合和硬件 offload 如何改变 skb 在协议栈中的形态)
- 143.4 Packet Drops Along the Path(分析接收队列溢出、内存压力、路由失败、Netfilter 丢弃、qdisc 丢弃和驱动丢包等不同位置)
- 143.5 Engineering Insight: Network Performance Depends on Where Work Is Done and Where Packets Queue(梳理协议处理、排队位置、offload 和 CPU 分布如何共同决定网络性能)
Chapter 144: Routing, Neighbor Tables, and Netfilter Hooks
- 144.1 Routing Lookup and Forwarding Decisions(追踪内核如何根据路由表、策略路由、VRF 和网络命名空间决定 packet 下一跳)
- 144.2 Neighbor Tables, ARP, NDISC, and Link-Layer Resolution(追踪 IP 下一跳如何通过邻居表解析成链路层地址,并影响发送路径)
- 144.3 Netfilter Hook Points Across Packet Traversal(分析 Netfilter 在 prerouting、input、forward、output、postrouting 等位置插入过滤和修改逻辑)
- 144.4 Conntrack, NAT, and Stateful Packet Processing(追踪连接跟踪和 NAT 如何让无状态 packet 流被内核组织成连接级状态)
- 144.5 Engineering Insight: Routing Decides Where Packets Go; Netfilter Decides What Packets Are Allowed to Become(判断路由决定 packet 去向,Netfilter 则在路径上改变、过滤和赋予状态语义)
Chapter 145: TCP IP State, Congestion, and Packet Diagnostics
- 145.1 TCP Socket State Machine and Connection Lifecycle(追踪 LISTEN、SYN-SENT、ESTABLISHED、FIN-WAIT、TIME-WAIT 等状态如何表达连接生命周期)
- 145.2 Send Window, Receive Window, Congestion Window, and Flow Control(区分接收端流控、发送端拥塞控制和网络路径容量估计)
- 145.3 Retransmission, RTO, SACK, and Loss Recovery(追踪 TCP 如何通过重传超时、选择确认和丢包恢复维持可靠传输)
- 145.4 Observing Network State with
ss,/proc/sys/net, tcpdump, ftrace, and perf(结合 socket 统计、net sysctl、抓包、tracepoint 和采样工具定位协议栈问题) - 145.5 Engineering Insight: TCP Performance Is a Conversation Between Local Queues and Remote Feedback(梳理 TCP 性能是本地 socket 队列、内核拥塞控制、对端 ACK 和网络路径共同反馈的结果)
Part 30: Network Device Drivers, NAPI, Queues, Offloads, and Packet Scheduling
Chapter 146: Network Device Driver Registration and netdev_ops
- 146.1
struct net_deviceas the Kernel Network Interface Object(追踪网络设备如何用net_device表达接口名称、MTU、MAC 地址、队列、统计信息、feature flags 和运行状态) - 146.2
net_device_opsand Driver Entry Points(通过ndo_open、ndo_stop、ndo_start_xmit、ndo_set_rx_mode、ndo_change_mtu分析驱动如何接入网络栈) - 146.3 Device Registration, Carrier State, and Link Events(梳理
register_netdev、carrier on/off、link change、PHY 状态和用户态可见接口之间的关系) - 146.4 Feature Negotiation and
ethtoolVisibility(追踪 checksum offload、TSO、GSO、GRO、RSS、ring size、coalescing 等能力如何暴露给用户态) - 146.5 Engineering Insight: A Network Interface Is a Queueing Object Before It Is a Device Node(判断网卡接口的核心在于协议栈与硬件队列之间的调度边界)
Chapter 147: RX and TX Rings, Descriptors, and DMA
- 147.1 Descriptor Rings as the Contract Between Driver and NIC(追踪 RX/TX ring 如何用描述符数组表达 buffer 地址、长度、状态和所有权)
- 147.2 RX Buffer Posting and Packet Reception(追踪驱动如何提前分配 RX buffer、映射 DMA、交给网卡填充,并在完成后构造 skb)
- 147.3 TX Submission and Completion(追踪发送路径如何把 skb 映射成 DMA segment、写入 TX descriptor、通知设备,并在 completion 后释放资源)
- 147.4 Ring Full, Queue Stop, and Backpressure(分析 TX ring 满时为何要 stop queue,completion 后再 wake queue,以形成背压)
- 147.5 Engineering Insight: NIC Performance Is Mostly Ring Ownership and DMA Lifetime Discipline(判断网卡性能和正确性很大程度取决于描述符所有权、DMA 映射生命周期和队列回收是否正确)
Chapter 148: NAPI Polling and Interrupt Mitigation
- 148.1 Per-Packet Interrupt Scalability Cost(分析高速网卡每个 packet 都触发硬中断时,CPU 如何被中断风暴拖垮)
- 148.2 Interrupt Handler Schedules NAPI Poll(追踪驱动中断处理函数如何禁用或缓解后续中断,并调用
napi_schedule()把处理转移到 NAPI poll) - 148.3 NAPI Budget and Batch Packet Processing(追踪 NAPI poll 如何在 budget 限制下批量处理 RX/TX completion,并控制单次处理的 CPU 占用)
- 148.4
ksoftirqd, Busy Polling, and Overload Behavior(追踪当 softirq 处理不过来时,NAPI 工作如何落到ksoftirqd,以及 busy polling 如何改变延迟模型) - 148.5 Engineering Insight: NAPI Trades Immediate Interrupt Response for Controlled Batch Processing(判断 NAPI 的核心权衡是牺牲逐包立即响应,换取批处理吞吐、可控中断率和更低系统开销)
Chapter 149: Checksum, TSO, GRO, GSO, and Hardware Offloads
- 149.1 Checksum Offload and CPU Work Reduction(追踪网卡如何承担校验和计算或验证,减少 CPU 在协议栈中的重复工作)
- 149.2 TSO and GSO as Segmentation Deferral(追踪大 TCP 数据如何先以大 skb 在栈内流动,最后由软件或硬件切成 MTU 大小的 packet)
- 149.3 GRO as Receive-Side Packet Coalescing(追踪接收端如何把多个相关小包合并成更大的 skb,减少协议栈处理次数)
- 149.4 Offload Correctness, Feature Flags, and Fallback Paths(分析 offload 能力声明错误、隧道封装、VLAN、checksum 状态不一致时为何会造成丢包或数据错误)
- 149.5 Engineering Insight: Offload Moves Work Across the Kernel-Hardware Boundary(判断 offload 会把协议栈部分工作移动到硬件或更晚的软件阶段,并要求边界语义正确)
Chapter 150: Queue Disciplines, Traffic Control, and Packet Scheduling
- 150.1 qdisc as the Egress Packet Scheduling Layer(分析发送 packet 在进入驱动队列之前,通常会经过 qdisc 进行排队、分类、整形或丢弃)
- 150.2 FIFO, FQ, fq_codel, HTB, and Scheduling Goals(比较不同 qdisc 在公平性、延迟控制、带宽整形和 bufferbloat 缓解上的目标差异)
- 150.3 Traffic Classes, Filters, and Actions(追踪
tc如何通过 class、filter、action 对流量进行分类、标记、限速、重定向或丢弃) - 150.4 Queue Buildup, Bufferbloat, and Drop Policy(追踪队列积压如何增加延迟,以及主动队列管理为何通过早丢包控制排队时间)
- 150.5 Engineering Insight: Packet Scheduling Decides Latency After the Protocol Stack Has Done Its Work(判断协议栈生成 packet 之后,qdisc、队列长度和驱动队列状态如何影响发送延迟和排队行为)
Part 31: High-Performance Networking XDP, eBPF, Zero-Copy, and AF_XDP
Chapter 151: Traditional Network Stack Cost Model
- 151.1 The Cost of Generic Packet Processing(分析传统网络栈为了通用性、安全性、协议完整性和可观测性付出的 skb、路由、Netfilter、qdisc 等处理成本)
- 151.2 Per-Packet Allocation, Metadata, and Cache Pressure(追踪高包率下 skb 分配、元数据初始化、cache miss 和跨 CPU 访问如何累积成瓶颈)
- 151.3 Queueing, Context Switching, and Softirq Pressure(追踪 RX/TX 队列、softirq、
ksoftirqd、应用线程唤醒如何形成延迟和调度压力) - 151.4 When Full TCP/IP Semantics Are Too Much(区分普通应用需要完整协议栈,和 DDoS 过滤、L4 转发、负载均衡、telemetry 等场景只需要早期 packet 决策)
- 151.5 Engineering Insight: High-Performance Networking Starts from Stack Scope(判断当前场景需要完整协议栈、早期包处理还是零拷贝路径)
Chapter 152: XDP and Early Packet Processing
- 152.1 XDP as Packet Processing Before
sk_buffAllocation(分析 XDP 为何在驱动接收路径的早期运行,用早期处理降低 skb 分配和完整协议栈成本) - 152.2 XDP Actions: PASS, DROP, TX, REDIRECT, and ABORTED(追踪 XDP 程序如何通过不同 action 决定 packet 继续进入协议栈、丢弃、反射、重定向或异常终止)
- 152.3 Driver Mode, Generic Mode, and Hardware Offload Mode(比较 XDP 在驱动层、通用网络层和硬件 offload 中运行的位置与性能差异)
- 152.4 XDP Metadata and Hardware Context(追踪 XDP 如何访问 packet 边界、队列信息、RX timestamp 和硬件 metadata)
- 152.5 Engineering Insight: XDP Moves the Decision Point Closer to the NIC(判断 XDP 的核心是把 packet 命运的决定点前移到最接近网卡的位置)
Chapter 153: eBPF Programs, Maps, Verifier, and Attach Points
- 153.1 eBPF as Safe In-Kernel Programmability(追踪 eBPF 如何允许用户提供受限制程序,在内核指定 hook 点执行,并通过 verifier 和 hook 边界管理扩展风险)
- 153.2 Program Types and Attach Points(区分 XDP、tc、socket filter、kprobe、tracepoint、cgroup 等不同 BPF program type 和 attach 位置)
- 153.3 BPF Maps as Shared State Between Kernel and User Space(追踪 map 如何作为 eBPF 程序与用户态控制面之间的共享状态、计数器、表项和策略存储)
- 153.4 Verifier, Safety, and Bounded Execution(追踪 verifier 如何检查寄存器、栈、指针、初始化状态和 helper 调用)
- 153.5 Engineering Insight: eBPF Is Kernel Extension by Verification(判断 eBPF 如何通过 verifier、类型、helper、map 和 attach 点把扩展限制在可证明安全的边界内)
Chapter 154: Zero-Copy Paths and AF_XDP
- 154.1 Packet Data Copy Cost(追踪高包率场景下,数据拷贝、cache 污染和用户态/内核态往返如何成为主要成本)
- 154.2 AF_XDP Socket and UMEM(追踪 AF_XDP 如何通过用户态 UMEM 区域、fill/completion ring、RX/TX ring 管理 packet buffer)
- 154.3 XSKMAP and Redirecting Frames to User Space(追踪 XSKMAP 如何把特定队列的 raw XDP frame 送到 AF_XDP socket)
- 154.4 Copy Mode vs Zero-Copy Mode(比较 AF_XDP copy mode 和 zero-copy mode 对驱动支持、内存注册、buffer 生命周期和性能的要求)
- 154.5 Engineering Insight: Zero-Copy Is a Memory Ownership Protocol(判断零拷贝如何通过 buffer 所有权、ring 状态、DMA 可见性和用户态/内核态生命周期协议实现)
Chapter 155: Observing and Optimizing High-Performance Packet Pipelines
- 155.1 Measuring Packet Rate, Drop Points, and CPU Cost(通过网卡统计、
ethtool、ip -s link、perf、BPF 计数器观察包率、丢包点和 CPU 消耗) - 155.2 Profiling XDP and eBPF Execution(使用 BPF map 统计、bpftool、tracepoint、perf 观察 eBPF 程序执行路径和热点)
- 155.3 Queue Affinity, RSS, RPS/XPS, and NUMA Locality(分析队列、CPU、IRQ、应用线程和内存节点是否对齐会直接影响高性能网络表现)
- 155.4 Failure Modes: Verifier Rejection, Map Pressure, Ring Exhaustion, and Packet Loss(分析 BPF verifier 拒绝、map 容量不足、AF_XDP ring 耗尽、UMEM buffer 不够、用户态处理不过来导致的故障)
- 155.5 Engineering Insight: High-Performance Networking Is Mostly About Moving Less Work Across Better Boundaries(判断高性能网络的核心在于减少不必要路径、减少拷贝、减少排队,并把工作放到正确边界上)
Part 32: Namespaces, Cgroups, Resource Control, and Container Internals
Chapter 156: Namespaces as Kernel-Level Views of the System
- 156.1 Namespace as a Resource View(分析 namespace 如何让进程看到不同的系统资源视图)
- 156.2 Namespace Membership and
/proc/<pid>/ns(通过/proc/<pid>/ns观察进程所属 namespace,并判断相同 namespace inode 表示共享同一视图) - 156.3
clone,unshare, andsetnsas Namespace Control Points(分析创建、脱离和加入 namespace 的系统调用入口) - 156.4 Namespace Lifetime and Open File References(分析 namespace 对象可能因为进程、bind mount 或打开的 namespace fd 而继续存活)
- 156.5 Engineering Insight: Namespaces Change What a Process Can See(判断 namespace 的核心在于改变进程对全局内核对象的可见视图)
Chapter 157: PID, Mount, Network, User, IPC, UTS, and Time Namespaces
- 157.1 PID Namespace and Process Identity Translation(分析同一个 task 在不同 PID namespace 中可能拥有不同 PID,并形成容器内外不同进程视图)
- 157.2 Mount Namespace and Filesystem View Isolation(追踪 mount namespace 如何让进程拥有独立挂载树,从而形成独立 rootfs 和路径关系)
- 157.3 Network Namespace and Independent Network Stacks(追踪 network namespace 如何隔离网络设备、IP 地址、路由表、Netfilter 规则和 socket 空间)
- 157.4 User Namespace and Credential Mapping(追踪 user namespace 如何让容器内 root 映射到宿主机非 root,并改变 capability 的作用范围)
- 157.5 Engineering Insight: Each Namespace Type Is a Different Answer to “Separate Which Global View?”(追踪不同 namespace 如何分别回答进程号、挂载树、网络、用户身份、IPC、主机名和时间视图的隔离问题)
Chapter 158: Cgroups as Resource Accounting and Control
- 158.1 Cgroup Hierarchies and Process Membership(追踪 cgroup 如何把进程组织成层级结构,并让资源控制以组为单位生效)
- 158.2 Controllers as Resource-Specific Policies(追踪 CPU、memory、io、pids、cpuset 等 controller 如何分别实现不同资源的统计、限制和分配)
- 158.3 Cgroup v1 vs Cgroup v2 Unified Hierarchy(分析 v2 为何强调统一层级、统一规则和更一致的资源控制模型)
- 158.4 cgroupfs Interface and Runtime Control Files(通过 cgroupfs 文件读写资源限制、统计数据、事件通知和进程迁移)
- 158.5 Engineering Insight: Cgroups Control Resource Consumption for Process Groups(判断 cgroup 和 namespace 的分工:namespace 管可见性,cgroup 管资源使用和统计)
Chapter 159: Container Runtime Interaction with Kernel Primitives
- 159.1 Container Creation as a Sequence of Kernel Primitive Operations(追踪容器 runtime 如何组合 clone/unshare、mount、pivot_root、cgroup、capability、seccomp 等操作)
- 159.2 Root Filesystem, Mount Propagation, and
pivot_root(追踪容器 rootfs 如何通过 mount namespace、bind mount、overlayfs 和 root 切换建立) - 159.3 Cgroup Placement and Resource Limits Before Exec(分析 runtime 为何要在执行容器进程前设置 cgroup、资源限制和控制器参数)
- 159.4 OCI Runtime Model and Kernel Boundary(追踪 OCI runtime 规范如何把高层容器配置转化为 Linux 内核原语调用)
- 159.5 Engineering Insight: A Container Is a Carefully Assembled Process Environment(判断容器是 runtime 把多个隔离、资源和安全原语装配成的进程环境)
Chapter 160: Debugging Isolation and Resource Limit Problems
- 160.1 Inspecting Namespaces with
/proc/<pid>/ns,lsns, andnsenter(通过 procfs、lsns、nsenter观察和进入目标进程 namespace) - 160.2 Inspecting Cgroups with cgroupfs and
/proc/<pid>/cgroup(通过 cgroupfs、/proc/<pid>/cgroup、systemd slice 信息判断进程资源控制位置) - 160.3 Diagnosing Memory, CPU, PIDs, and I/O Limits(追踪 memory max、CPU quota、pids max、I/O throttle 等限制如何导致 OOM、卡顿、fork 失败或吞吐下降)
- 160.4 Debugging Permission Surprises in User Namespaces(分析容器内 root 为何仍可能无法 mount、访问设备、加载模块或执行特权操作)
- 160.5 Engineering Insight: Container Bugs Usually Come from Mismatched Views, Limits, and Permissions(排查容器问题时检查 namespace 可见性、cgroup 限制和安全权限三者之间的匹配关系)
Part 33: Credentials, Capabilities, Permissions, LSM, Seccomp, and Audit
Chapter 161: Credentials, UID GID, and Permission Checks
- 161.1
credas the Kernel’s Security Identity Object(追踪struct cred如何保存 UID、GID、supplementary groups、capabilities、security blob 等安全身份信息) - 161.2 Real, Effective, Saved, and Filesystem IDs(区分 real/effective/saved UID/GID 与 fsuid/fsgid 在进程身份、权限检查和文件访问中的不同作用)
- 161.3 Permission Checks at Object Access Points(分析权限检查如何分布在文件、进程、socket、IPC、设备等对象访问路径上)
- 161.4 Credential Copy, Commit, and RCU Safety(分析凭证修改为何采用 copy-and-replace 模型,并通过 RCU 保护并发读取)
- 161.5 Engineering Insight: Linux Security Starts by Asking “Who Is Acting on Which Object?”(判断 Linux 权限判断的起点是“哪个凭证正在对哪个内核对象执行什么动作”)
Chapter 162: Capabilities and Privilege Decomposition
- 162.1 From Root Privilege to Fine-Grained Capabilities(追踪 capabilities 如何把传统 root 特权拆成
CAP_NET_ADMIN、CAP_SYS_ADMIN、CAP_DAC_OVERRIDE等更细粒度权限) - 162.2 Permitted, Effective, Inheritable, Bounding, and Ambient Sets(区分 capability 的不同集合,以及它们如何影响 exec、继承、限制和当前权限生效)
- 162.3 File Capabilities and Executable-Based Privilege(追踪文件 capability 如何让特定可执行文件获得有限特权,并减少对 setuid root 的依赖)
- 162.4 Capability Checks Across Kernel Subsystems(追踪网络管理、mount、设备访问、BPF、raw socket 等路径如何检查特定 capability)
- 162.5 Engineering Insight: Capabilities Reduce Root While Preserving Authority Risk(判断 capability 如何细化特权,并说明每个 capability 仍代表真实内核权力)
Chapter 163: LSM Hooks and Kernel Security Policy
- 163.1 LSM as Hook-Based Mandatory Access Control Infrastructure(追踪 LSM 如何在文件、进程、socket、IPC、key、BPF 等访问点插入安全策略检查)
- 163.2 SELinux, AppArmor, Smack, TOMOYO, Landlock, and Stacking(比较主要 LSM 如何从标签、路径、规则、沙箱等角度表达不同安全模型)
- 163.3 Security Blobs and Object Labeling(追踪 LSM 如何把安全标签或策略状态附着到 cred、inode、file、task、socket 等内核对象上)
- 163.4 DAC, Capabilities, and LSM Ordering(追踪传统自主访问控制、capability 检查和 LSM hook 如何共同决定一次访问是否允许)
- 163.5 Engineering Insight: LSM Lets Security Policy Follow Kernel Objects Instead of User-Space Assumptions(判断 LSM 如何把安全策略绑定到内核对象访问点,并减少对用户态路径名、进程名或外部约定的依赖)
Chapter 164: Seccomp and System Call Filtering
- 164.1 Seccomp as a System Call Surface Reduction Mechanism(分析 seccomp 主要用于限制进程能够发起的系统调用,从而减少攻击面)
- 164.2 Strict Mode vs Filter Mode(区分最早的 strict seccomp 和现代基于 BPF filter 的 seccomp-bpf 模式)
- 164.3 Seccomp Actions: Allow, Kill, Trap, Errno, Trace, Log, and Notify(追踪 seccomp filter 如何根据 syscall number 和参数返回不同处置动作)
- 164.4 Seccomp in Containers and Sandboxes(追踪容器 runtime、浏览器、服务沙箱如何用 seccomp 禁止危险或不需要的 syscall)
- 164.5 Engineering Insight: Seccomp Controls the Shape of the Syscall Interface(判断 seccomp 如何缩小 syscall 入口面,并说明它和 LSM 对象级权限策略的分工)
Chapter 165: Audit, Attack Surface, and Security Observability
- 165.1 Audit as Security Event Evidence(追踪 audit 如何记录权限拒绝、LSM 决策、seccomp 动作、系统调用和安全相关事件)
- 165.2 Audit Rules, Filters, and LSM Labels(追踪 audit rule 如何根据 syscall、路径、UID、对象标签、LSM 字段等过滤安全事件)
- 165.3 Reading Denials and Reconstructing Access Decisions(通过 audit log 还原是哪一个主体、访问哪个对象、触发哪个权限检查、被哪个策略拒绝)
- 165.4 Attack Surface Reduction by Combining Mechanisms(追踪最小权限、capability drop、seccomp profile、LSM policy、namespace/cgroup 隔离如何共同减少攻击面)
- 165.5 Engineering Insight: Security Needs Observability(判断安全机制如何借助 audit、日志、trace 和可解释拒绝原因完成调试、验证和长期维护)
Part 34: Kernel Parameters, Sysctl, Control Interfaces, and Runtime Tuning
Chapter 166: Kernel Command Line Parameters and Early Runtime Control
- 166.1 Kernel Command Line as Pre-Userspace Control Plane(追踪内核启动参数如何在用户态出现之前影响启动、调试、内存、CPU、驱动和安全行为)
- 166.2
early_param,__setup,core_param, andmodule_param(区分早期参数、普通 setup 参数、核心参数和模块参数的解析时机与作用范围) - 166.3 Boot Parameters for Debugging and Recovery(追踪
earlycon、loglevel、initcall_debug、panic=、nomodeset等参数如何帮助启动期诊断和恢复) - 166.4 Architecture-Specific and Driver-Specific Parameters(追踪 x86、ARM64、ACPI、PCI、IOMMU、GPU、存储、网络等参数如何影响特定平台和设备路径)
- 166.5 Engineering Insight: Some Kernel Behavior Must Be Controlled Before the Kernel Is Fully Alive(判断某些行为必须在内核完整初始化前决定,因此启动参数是最早的工程控制面)
Chapter 167: Module Parameters and Driver-Specific Tuning
- 167.1 Module Parameters as Load-Time Policy Inputs(追踪模块参数如何在驱动加载时影响队列大小、调试开关、功能启用和硬件工作模式)
- 167.2 Built-In Driver Parameters vs Loadable Module Parameters(区分内建驱动通过内核命令行传参,和可加载模块通过
modprobe、insmod、配置文件传参的方式) - 167.3 Parameter Types, Permissions, and sysfs Exposure(分析模块参数的类型、权限位和
/sys/module/<module>/parameters/可见性) - 167.4 Tuning Driver Behavior with Hardware State Awareness(追踪错误模块参数如何导致设备初始化失败、性能下降、队列异常或调试噪声过大)
- 167.5 Engineering Insight: Module Parameters Are Small Interfaces with Large Hardware Consequences(判断模块参数看似只是字符串和整数,但可能直接改变驱动与硬件交互方式)
Chapter 168: sysctl as a Runtime Kernel Control Interface
- 168.1
/proc/sysas the sysctl Filesystem View(追踪 sysctl 如何通过/proc/sys暴露 kernel、vm、fs、net 等运行时可调参数) - 168.2 Kernel, VM, FS, and Net sysctl Families(区分
/proc/sys/kernel、/proc/sys/vm、/proc/sys/fs、/proc/sys/net分别控制哪些子系统行为) - 168.3 Immediate Effects and Persistence Across Reboot(分析通过
sysctl或写/proc/sys修改通常立即生效,但需要配置文件才能跨重启持久化) - 168.4 Reading Documentation Before Tuning(判断 sysctl 风险提示、文档边界和源码依据如何约束调优)
- 168.5 Engineering Insight: sysctl Is Runtime Policy Injection into Live Kernel Subsystems(判断 sysctl 的核心是在系统运行中向内核子系统注入策略参数,因此必须结合负载、源码和观测数据使用)
Chapter 169: procfs, sysfs, and debugfs Control Surfaces
- 169.1 procfs Control Files and Process/System State(分析 procfs 中可读写文件如何通过写入触发内核状态改变或策略调整)
- 169.2 sysfs Attributes as Object-Scoped Control Points(分析 sysfs 控制通常绑定到具体 device、driver、module、class 或 bus 对象,并据此区分对象级控制和全局策略)
- 169.3 debugfs Knobs for Development and Diagnostics(分析 debugfs 如何服务开发调试开关、内部统计和实验性控制,并说明稳定 ABI 边界)
- 169.4 Stable ABI vs Debug Interface vs Administrative Tuning(区分面向长期用户态兼容的 ABI、仅供调试的接口和管理员运行时调优入口)
- 169.5 Engineering Insight: Kernel Control Interfaces Reflect Object Scope(判断控制接口的位置通常反映它控制的是全局内核策略、某类子系统、某个模块还是某个具体设备对象)
Chapter 170: Tuning Safely on a Live System
- 170.1 Measure Before Changing Kernel Tunables(判断调优前先收集负载、延迟、吞吐、内存、I/O、网络和错误证据,用证据驱动参数修改)
- 170.2 Change One Variable at a Time(判断一次只修改一个关键参数,记录修改前后行为,让多个 tunable 的影响保持可分辨)
- 170.3 Understand Scope, Lifetime, and Rollback Path(确认参数是启动期、模块加载期还是运行时生效,是否能回滚,是否影响所有进程或特定对象)
- 170.4 Validate with Logs, Tracepoints, and Subsystem Statistics(通过 dmesg、tracefs、perf、procfs/sysfs 统计验证参数是否真的改变了目标路径)
- 170.5 Engineering Insight: Kernel Tuning Is Controlled Experimentation on a Live System(判断内核调优是在可观测证据、最小变更和可回滚策略下做受控实验)
Part 35: Kernel Debugging printk, Dynamic Debug, ftrace, perf, kdump, and crash
Chapter 171: printk, pr_debug, and Dynamic Debug
- 171.1
printkas the Kernel’s Fundamental Logging Primitive(追踪printk如何把内核日志写入 ring buffer,并通过控制台、dmesg、journald 等路径暴露出来) - 171.2 Log Levels,
pr_*Helpers, and Message Discipline(判断 kernel log level、pr_*helper 和 message discipline 的使用边界) - 171.3 Dynamic Debug and Callsite-Level Control(追踪 Dynamic Debug 如何按 source file、function、line、module、format string、class 精确打开某些 debug 输出)
- 171.4 Rate Limiting and Log Storm Control(追踪高频路径中日志如何造成性能下降、锁竞争、ring buffer 覆盖和问题现场污染)
- 171.5 Engineering Insight: Logging Is Evidence Collection Under Runtime Pressure(判断内核日志是在不破坏系统行为的前提下保存最小可用证据)
Chapter 172: ftrace, Function Graph Tracing, and Tracepoints
- 172.1 ftrace as Runtime Kernel Path Observation(追踪 ftrace 如何在不重新编译内核的情况下观察函数调用、事件、延迟和关键路径)
- 172.2 Function Tracer and Function Graph Tracer(区分函数进入记录和函数调用图记录,判断调用嵌套、耗时和返回路径如何被呈现)
- 172.3 Static Tracepoints and Event Tracing(追踪内核各子系统预置 tracepoint 如何暴露调度、块层、网络、内存、电源等关键事件)
- 172.4 Filters, Triggers, Instances, and Boot-Time Tracing(追踪过滤器、触发器、trace instance 和 boot-time tracing 如何缩小观测范围并捕捉启动期问题)
- 172.5 Engineering Insight: ftrace Lets You Replace Guessing with Runtime Path Evidence(判断 ftrace 如何在运行时证明某条内核路径是否真的发生)
Chapter 173: perf for CPU, Scheduler, and Kernel Hot Paths
- 173.1
perfas Sampling, Counting, and Event Correlation Tool(追踪perf如何通过采样、计数器、tracepoint 和 call graph 观察 CPU 与内核路径) - 173.2 CPU Hotspots, Call Graphs, and Kernel Symbols(分析如何用
perf record/report/top找到内核热点函数、调用来源和符号解析问题) - 173.3 Scheduler, Lock, and Tracepoint-Based Profiling(追踪
perf sched、lock 事件、tracepoint 事件如何用于分析调度延迟、锁竞争和上下文切换) - 173.4 Hardware PMU Events and Microarchitectural Evidence(通过 cache miss、branch miss、cycles、instructions 等 PMU 事件观察内核路径的硬件成本)
- 173.5 Engineering Insight: perf Shows Where Time Went(判断
perf如何指出时间和事件集中位置,并结合源码、上下文和系统状态解释原因)
Chapter 174: kdump and vmcore Collection
- 174.1 Crash-Time Evidence Preservation(分析 panic、hard lockup、内存破坏发生后,普通日志可能不足以还原现场)
- 174.2 kexec, Crash Kernel, and Reserved Memory(追踪 kdump 如何通过 kexec 启动 dump-capture kernel,并使用预留内存保存崩溃内核镜像)
- 174.3 Capturing
vmcoreLocally or Remotely(追踪崩溃后如何通过本地磁盘、网络或工具链保存内存镜像) - 174.4
pstore, Ramoops, and Persistent Crash Logs(追踪 pstore、ramoops 如何在重启后保留 Oops、panic、console 或 ftrace 记录) - 174.5 Engineering Insight: Post-Mortem Debugging Starts Before the Crash Happens(排查崩溃后的可分析性如何取决于 crashkernel、pstore、符号和收集路径的预先配置)
Chapter 175: crash Utility and Post-Mortem Kernel Analysis
- 175.1
vmcoreplusvmlinuxas the Debugging Pair(分析崩溃内存镜像必须配合带符号的vmlinux才能还原结构体、调用栈和对象状态) - 175.2 Inspecting Tasks, Stacks, Locks, and Memory State(分析如何从崩溃现场查看 task、backtrace、runqueue、锁、slab、page、文件和网络对象)
- 175.3 Reconstructing the Last Failing Path(通过 panic 日志、调用栈、寄存器、当前 task、CPU 状态和关键对象还原失败路径)
- 175.4 Limitations of Post-Mortem Evidence(分析崩溃镜像是某一时刻的冻结现场,无法直接展示崩溃前所有事件顺序)
- 175.5 Engineering Insight: Crash Analysis Is Forensics on a Frozen Kernel State(判断 crash 分析是在冻结的内核世界中还原对象关系、控制流和最后的错误条件)
Part 36: Kernel Performance Engineering for CPU Memory IO Network and Lock Contention
Chapter 176: Building a Kernel Performance Investigation Model
- 176.1 Symptom, Hypothesis, Measurement, and Fix(把性能分析拆成症状描述、路径假设、证据采集和最小修复,先建立证据再调整参数)
- 176.2 Latency, Throughput, Utilization, and Saturation(区分延迟、吞吐、利用率和饱和度,把“CPU 高”“I/O 高”“系统慢”拆成可定位指标)
- 176.3 On-CPU vs Off-CPU Time(分析程序慢可能是正在 CPU 上执行慢,也可能是长期等待调度、锁、I/O、内存回收或网络事件)
- 176.4 Correlating User-Space, Kernel, and Hardware Evidence(把应用日志、syscall、tracepoint、perf 采样、硬件 PMU、内核日志组合成证据链)
- 176.5 Engineering Insight: Performance Work Begins by Finding Where Time Stops Moving(判断性能工程的第一步是找出时间消耗在执行、等待、排队还是重试)
Chapter 177: CPU Hot Paths, Scheduler Latency, and Runqueue Pressure
- 177.1 CPU Hot Paths and Kernel Function Attribution(使用
perf top、perf record/report、调用图和符号表定位 CPU 时间集中在哪些内核路径) - 177.2 Cycles, Instructions, Cache Misses, and Branch Misses(通过硬件事件区分算力消耗、缓存缺失、分支预测失败和微架构停顿)
- 177.3 Runqueue Pressure and Runnable Waiting Tasks(追踪任务处于 runnable 但未获得 CPU 的状态,如何表现为延迟升高与热点函数证据分离)
- 177.4 Scheduler Tracepoints and Context Switch Analysis(通过
sched_switch、sched_wakeup、perf sched、ftrace 观察任务何时被唤醒、排队、切走和运行) - 177.5 Engineering Insight: High CPU Usage and CPU Starvation Are Different Problems(判断 CPU 忙表示执行资源被消耗,CPU 饥饿表示任务等待执行资源,两者需要完全不同的修复策略)
Chapter 178: Memory Pressure, Reclaim, Cache Misses, and NUMA Effects
- 178.1 Memory Pressure as Reclaim and Allocation Latency(分析内存压力如何表现为分配路径进入 reclaim、compaction、writeback 或 OOM 边缘)
- 178.2 Page Faults, Major Faults, and Working Set Misses(通过 major/minor fault、RSS、PSS、page cache 状态判断工作集是否频繁缺页或从存储读入)
- 178.3 Cache Misses and Microarchitectural Memory Stalls(通过 PMU 事件观察 L1/L2/LLC miss、内存带宽和 CPU stall 是否成为瓶颈)
- 178.4 NUMA Locality and Remote Memory Access(分析任务运行 CPU、内存所在 node、自动 NUMA balancing、远端访问和 page migration 对延迟的影响)
- 178.5 Engineering Insight: Memory Performance Is About Locality, Reclaim, and Translation Together(梳理局部性、回收、页表翻译、cache 行为和 NUMA 拓扑如何共同决定内存性能)
Chapter 179: IO Latency, Queueing, Writeback, and Storage Bottlenecks
- 179.1 Separating Application Wait from Block Device Service Time(区分应用阻塞时间、文件系统等待、块层排队和设备实际服务时间)
- 179.2 Buffered Write Latency and Delayed Writeback Costs(分析 buffered write 可能先很快返回,但后续回写、脏页限制和内存压力会把成本推迟暴露)
- 179.3 Queue Depth, Request Merging, and blk-mq Behavior(追踪队列深度、request 合并、硬件队列映射和 completion 延迟如何影响吞吐与尾延迟)
- 179.4 Observing I/O with
iostat, ftrace, blktrace, and perf(结合设备统计、块层 tracepoint、CPU 采样和文件系统事件还原 I/O 路径) - 179.5 Engineering Insight: Storage Latency Is Often Queueing Latency Wearing a Device Mask(梳理存储慢如何由上层提交、回写、排队、限速和设备调度共同造成)
Chapter 180: Network Throughput, Packet Loss, Lock Contention, and Scalability
- 180.1 Network Bottlenecks Across NIC, Driver, Stack, and Application(把网络瓶颈拆成网卡队列、驱动 NAPI、协议栈、qdisc、socket buffer 和应用消费速度)
- 180.2 Packet Drops, Retransmits, and Queue Overruns(通过网卡统计、
ss、netstat、tcpdump、tracepoint 判断丢包发生在驱动、协议栈、队列还是远端路径) - 180.3 Lock Contention and Serialization Bottlenecks(分析多核扩展性下降常常来自热点锁、共享 cache line、全局队列和串行化路径)
- 180.4 perf, ftrace, eBPF, and Lock/Network Tracepoints(使用 perf、ftrace 和 eBPF 观察锁等待、上下文切换、网络事件和热点函数)
- 180.5 Engineering Insight: Scalability Fails When Many CPUs Must Agree Too Often(排查可扩展性问题的核心通常是太多 CPU 频繁争用同一把锁、同一条 cache line 或同一个队列)
Part 37: Kernel Testing KUnit, Kselftest, LTP, Fuzzing, Sanitizers, and Fault Injection
Chapter 181: Kernel Testing Boundary and Failure Model
- 181.1 The Kernel Has No Process-Level Safety Net(分析内核代码出错如何影响整个系统,并说明内核缺少进程级安全网)
- 181.2 Testing Context, Timing, and Hardware-Dependent Behavior(判断内核测试必须考虑中断、调度、并发、设备状态、架构差异和不可复现时序)
- 181.3 Unit, Integration, System, and Regression Layers(区分单元测试、子系统集成测试、完整系统测试和回归测试在内核中的职责)
- 181.4 Testability as a Kernel Design Property(分析可测试性会反过来影响接口设计、模块边界、错误路径和调试能力)
- 181.5 Engineering Insight: Kernel Testing Is About Preserving System Trust Under Unsafe Conditions(判断内核测试的核心是在危险条件下仍然保持系统可信)
Chapter 182: KUnit for In-Kernel Unit Testing
- 182.1 KUnit as Lightweight Kernel Unit Testing Framework(追踪 KUnit 如何在内核内部定义 test case、test suite,并直接测试内核函数和数据结构)
- 182.2 Test Cases, Expectations, and Assertions(通过
KUNIT_EXPECT_*、KUNIT_ASSERT_*分析测试如何表达预期行为和失败条件) - 182.3 Running KUnit Built-In, as Modules, or under UML(分析 KUnit 测试可以内建启动时运行、作为模块加载运行,或通过 UML 快速执行)
- 182.4 Mocking, Resource Management, and Subsystem-Specific Test Helpers(追踪 KUnit 如何支持资源自动清理、函数替换和 driver/device tree/platform device 等专用测试辅助 API)
- 182.5 Engineering Insight: KUnit Lets Kernel Code Be Tested Before It Meets Real Hardware(判断 KUnit 如何尽早验证纯逻辑、边界条件和局部机制,并降低完整系统负载或真实设备依赖)
Chapter 183: kselftest and User-Space Driven Kernel Tests
- 183.1 kselftest as Tests for Kernel User-Facing Behavior(追踪 kselftest 如何从用户态驱动测试,验证 syscall、接口、子系统行为和回归场景)
- 183.2
tools/testing/selftests/Structure and Test Organization(分析 kselftest 测试位于内核源码树tools/testing/selftests/,通常按子系统组织) - 183.3 Building, Installing, and Running Selftests(执行构建、安装、选择性运行 selftests 的工作流,以及为何它们通常在启动目标内核后运行)
- 183.4 TAP/KTAP Output and CI Integration(追踪测试结果格式如何帮助自动化系统收集、解析和报告内核测试结果)
- 183.5 Engineering Insight: kselftest Verifies the Contract Between Kernel and User Space(判断 kselftest 如何验证用户态可见行为和内核对外契约)
Chapter 184: Fuzzing, syzkaller, and Bug Discovery
- 184.1 Fuzzing as Automated Exploration of Invalid and Unexpected Inputs(追踪 fuzzing 如何通过大量随机、变异或覆盖引导输入触发边界条件和崩溃)
- 184.2 Syscall Fuzzing and Kernel Attack Surface(分析为何系统调用序列特别适合 fuzz 内核,因为它们代表用户态进入内核的主要攻击面)
- 184.3 syzkaller, Reproducers, and Coverage-Guided Feedback(追踪 syzkaller 如何生成 syscall 程序、收集覆盖率、归纳崩溃并生成复现用例)
- 184.4 Fuzzing Specialized Subsystems such as eBPF and Filesystems(分析 eBPF、文件系统、网络、驱动 ioctl 等复杂接口为何需要更语义化的 fuzz 输入)
- 184.5 Engineering Insight: Fuzzing Finds Bugs by Exercising Unplanned Paths(判断 fuzzing 如何系统性探索异常组合、非法顺序和边界状态)
Chapter 185: Sanitizers, Fault Injection, and Regression Prevention
- 185.1 KASAN, UBSAN, KCSAN, KFENCE, and Runtime Bug Detection(追踪内核 sanitizers 如何检测越界访问、未定义行为、数据竞争、内存破坏和 use-after-free)
- 185.2 Lockdep, Refcount Warnings, and Lifetime Checkers(追踪 lockdep、refcount 检查、RCU 检查如何发现死锁、引用错误和生命周期违规)
- 185.3 Fault Injection for Allocation, I/O, and Driver Failure Paths(通过内存分配失败、I/O 错误、设备 probe 失败、超时等故障注入主动测试错误路径)
- 185.4 Regression Tests and Bug Fix Verification(分析每个修复最好配套一个能复现旧 bug、验证新行为的回归测试)
- 185.5 Engineering Insight: A Kernel Fix Is Complete When the Failure Mode Becomes Testable(排查内核修复如何把失败模式变成可以自动验证的测试资产)
Part 38: Kernel Patch Workflow, Maintainers, Reviews, Regressions, and Upstream Contribution
Chapter 186: Understanding the Linux Kernel Development Process
- 186.1 Mainline, Subsystem Trees, and Maintainer Routing(分析补丁通常是先进入子系统维护者树,再通过 pull request 汇入 mainline)
- 186.2 Merge Window, Release Candidates, and Development Rhythm(分析 merge window、rc 阶段、稳定发布之间的节奏,以及不同阶段适合合入的改动类型)
- 186.3 Mailing Lists, Lore Archives, and Public Review Culture(分析 Linux 内核以邮件列表和公开归档为核心评审基础的工程原因,并比较网页 PR 工作流的边界)
- 186.4 Subsystem Rules and Maintainer Expectations(判断不同子系统对代码风格、测试、分支基线、补丁前缀、review 标签可能有自己的补充要求)
- 186.5 Engineering Insight: Kernel Development Is Distributed Engineering with Public Memory(判断内核开发的核心是在公开邮件、维护者树、归档和版本历史中形成长期工程记忆)
Chapter 187: Preparing Patches, Commit Messages, and Signed-off-by
- 187.1 One Logical Change per Patch(分析一个补丁应表达一个逻辑变更,把修复、重构、格式化和新功能拆成独立补丁)
- 187.2 Commit Subject, Body, and Problem Explanation(排查提交说明应清楚解释问题、原因、解决方式和影响,并把文件改动放进工程论证)
- 187.3
Signed-off-byand Developer Certificate of Origin(分析Signed-off-by表示贡献者按照 DCO 规则声明自己有权提交该改动) - 187.4 Tags:
Fixes,Reported-by,Tested-by,Reviewed-by,Acked-by,Link, andCloses(追踪常见补丁标签如何记录问题来源、修复目标、评审状态、测试证据和报告链接) - 187.5 Engineering Insight: A Patch Is Code Plus a Traceable Engineering Argument(判断内核补丁同时包含 diff 和可追踪、可评审、可回归分析的工程论证)
Chapter 188: MAINTAINERS, Mailing Lists, and Review Etiquette
- 188.1 Finding the Right Maintainers and Lists(通过
MAINTAINERS、scripts/get_maintainer.pl、git history 和子系统文档找到正确收件人) - 188.2 Sending Patches with
git format-patchandgit send-email(分析内核邮件式补丁工作流中的纯文本格式、线程关系和版本标记) - 188.3 Cover Letters and Patch Series Structure(追踪多补丁 series 如何通过 cover letter 说明整体背景、设计取舍、测试结果和版本变化)
- 188.4 Review Etiquette, Reply Style, and Version Iteration(分析如何回复 review、保留上下文、解释不同意的地方、发送 v2/v3 并记录 changelog)
- 188.5 Engineering Insight: Review Is Part of the Design Process(判断内核 review 是设计被社区验证和长期维护化的过程)
Chapter 189: Handling Review Feedback, Revisions, and Regressions
- 189.1 Review Comments as Design Pressure(分析 review 评论通常是在检查 ABI、并发、错误路径、兼容性、测试和维护成本)
- 189.2 Revising Patch Series While Preserving History(追踪发送新版 patch 时如何保留版本变化、回应评审点,并保持已 review 逻辑可追踪)
- 189.3 Regressions,
git bisect, and Culprit Identification(分析回归为何必须能被二分定位,以及为何每个 patch 都应保持可构建、可运行) - 189.4
Closes,Link, and regzbot Tracking(判断修复回归时通过Closes:、Link:和 regzbot 相关流程把补丁与报告关联起来) - 189.5 Engineering Insight: A Regression Is a Broken Promise to Existing Users(排查回归是破坏了以前可工作的行为,因此处理优先级和沟通要求更高)
Chapter 190: From Local Fix to Upstream Contribution
- 190.1 Local Hack vs Upstreamable Fix(区分只解决本地问题的临时改法和能被主线接受、可维护、可测试、适合所有用户的修复)
- 190.2 Testing Before Submission(判断提交前需要完成构建测试、相关 selftests/KUnit、运行验证、静态检查和子系统特定测试)
- 190.3 Stable Backports and Long-Term Maintenance(追踪哪些修复适合进入 stable tree,以及如何通过
Cc: stable@vger.kernel.org等方式触发后续回合) - 190.4 Following Through After Posting(判断发出补丁只是进入下一阶段,还需要跟进 review、测试反馈、机器人报告、maintainer 决策和可能的重投)
- 190.5 Engineering Insight: Upstream Contribution Means Taking Responsibility Beyond the Diff(判断上游贡献如何承担解释、测试、修复回归和长期维护影响的责任)
Part 39: Modern Kernel Evolution PREEMPT_RT, Livepatching, Rust, Confidential Computing, and Future Directions
Chapter 191: PREEMPT_RT and the Push Toward Deterministic Latency
- 191.1 From Throughput-Oriented Kernel to Latency-Aware Kernel(分析传统 Linux 更偏通用吞吐与公平性,而实时场景需要控制最坏情况延迟)
- 191.2 Threaded IRQs, Preemptible Sections, and Sleeping Locks(追踪 PREEMPT_RT 如何通过中断线程化、减少不可抢占区、调整锁语义来降低延迟尖峰)
- 191.3 Priority Inheritance and Real-Time Locking Semantics(追踪实时系统中 priority inversion 为何危险,以及 PI mutex 等机制如何降低高优先级任务被低优先级任务间接阻塞的风险)
- 191.4 Measuring Real-Time Latency with Tracing and Cyclic Tests(通过 ftrace、scheduler tracepoints、cyclictest 等工具观察 wakeup latency、IRQ latency 和调度抖动)
- 191.5 Engineering Insight: Real-Time Linux Bounds the Worst Case(判断实时内核的目标是让最坏情况延迟变得可预测和可解释)
Chapter 192: Livepatching and Updating a Running Kernel
- 192.1 Runtime Patching for Production Kernels(分析生产系统为何希望在不重启的情况下修复安全漏洞、严重 bug 或关键路径缺陷)
- 192.2 Function Replacement and Patch Consistency Model(追踪 livepatch 如何替换正在运行内核中的函数,并需要保证 task 不会在新旧语义之间处于不一致状态)
- 192.3 Per-Task Transition and Safe Patch Activation(分析 livepatch 为何需要跟踪任务状态、调用栈或一致性点,确保补丁激活时没有执行路径处于危险位置)
- 192.4 Risks, Scope Limits, and Rollback Strategy(分析 livepatch 适合小范围修复,不适合任意重构;补丁设计必须考虑回滚、依赖、验证和审计)
- 192.5 Engineering Insight: Livepatching Is Runtime Surgery on a Shared Kernel State(判断 livepatch 的核心是在运行中的共享内核状态上做受控手术)
Chapter 193: Rust for Linux and Memory-Safe Kernel Components
- 193.1 Kernel Memory Safety Risk Model(分析 use-after-free、越界访问、双重释放、未初始化内存等问题为何在内核中代价极高)
- 193.2 Rust as a Second Language for Selected Kernel Code(分析 Rust 在部分新驱动、抽象层和安全敏感组件中提供更强类型与所有权约束的适用边界)
- 193.3 Ownership, Lifetimes, Pinning, and Kernel Object Wrappers(追踪 Rust 如何用所有权、生命周期、Pin、引用封装表达内核对象生命周期和并发约束)
- 193.4 Unsafe Boundaries and C Interoperability(分析 Rust for Linux 仍然需要在 FFI、硬件访问、底层指针和已有 C API 边界上使用受控 unsafe)
- 193.5 Engineering Insight: Rust Changes the Shape of Kernel Bugs by Moving Some Invariants into the Type System(判断 Rust 如何把一部分内存安全和生命周期错误提前转化为编译期约束)
Chapter 194: Confidential Computing and Hardware-Assisted Isolation
- 194.1 Confidential Computing as Protection Against More Powerful Adversaries(分析机密计算为何要防护宿主机、hypervisor、固件或云平台中更高权限实体的窥探)
- 194.2 Memory Encryption, Attestation, and Trusted Execution Environments(追踪内存加密、远程证明、TEE 如何共同建立“代码在受保护环境中运行”的信任模型)
- 194.3 AMD SEV, Intel TDX, Arm CCA, and Architecture-Specific Support(比较不同架构下机密虚拟机、受保护 guest 和隔离内存模型的内核支持方向)
- 194.4 I/O, DMA, Devices, and the Confidential Boundary(追踪设备 DMA、共享缓冲区、virtio、bounce buffer、IOMMU 如何成为机密计算中的关键边界问题)
- 194.5 Engineering Insight: Confidential Computing Moves the Trust Boundary Below the Operating System(判断机密计算把操作系统职责从权限管理扩展到硬件协助下的信任边界定义)
Chapter 195: Future Directions of Linux Kernel Engineering
- 195.1 Scaling Across More CPUs, More Memory, and More Devices(分析未来内核仍会被 CPU 数量、NUMA 拓扑、CXL 内存、超高速网络和存储设备继续拉伸)
- 195.2 Safer Extensibility with eBPF, Rust, and Verified Interfaces(追踪 eBPF、Rust、verifier、类型化接口如何让内核扩展在安全性和灵活性之间寻找新平衡)
- 195.3 More Runtime Observability and Automated Debugging(追踪 trace、BPF、perf、crash、CI、fuzzing、机器人回归追踪如何让内核工程越来越依赖证据自动化)
- 195.4 Kernel Engineering in Cloud, Edge, Mobile, and Embedded Systems(比较云服务器、边缘节点、手机、嵌入式、实时设备对内核延迟、功耗、安全和可维护性的不同压力)
- 195.5 Engineering Insight: The Linux Kernel Evolves by Turning Production Pain into Infrastructure(排查 Linux 的长期演进往往来自真实生产问题:延迟不可控、bug 难复现、安全边界不足、硬件太复杂,然后这些痛点逐渐变成新的内核基础设施)