v6
2026-10-16
HWPoison 跨 kexec 隔离 · v6
EFI毒化内存系列传递毒化表,启动时标记并预留硬件毒化页,内存块创建时计入毒化。
原始补丁链接
子 Patch(7)
1/7
mm/memory-failure: efi: add the LINUX_EFI_POISONED_MEMORY configuration table
新增 EFI 配置表,用 2MiB/位位图从 phys_base 记录硬毒页,随系统表跨 kexec;x86 放 efi_tables[] 使 SME 非加密,避免下个内核再踩。
2/7
mm/memory-failure: libstub: install the poisoned-memory EFI table
EFI stub 用 efi_get_ram_range() 按 UEFI 内存描述跨度分配并安装位图表,bit0 对齐 phys_base,只覆盖 writeback/unaccepted,排除 MMIO;运行内核只能改位。
3/7
mm/memory-failure: add hwpoison_boot_page() to flag an inherited frame
新增 hwpoison_boot_page(),在 memmap 初始化早期给继承帧置 PG_hwpoison、hw_memory_failure,并自增 num_poisoned_pages;绕过未就绪的 memblk_nr_poison_inc,避免 unpoison 释放坏页及离线计数错误。
4/7
mm/memblock: add a reserved-region flag for poisoned frames
新增 MEMBLOCK_RSRV_HWPOISON 保留毒帧区间,memblock 不分配也不释放;memmap_init_reserved_pages() 对 RAM 帧置 PG_hwpoison 并清 PG_reserved,使含毒块仍能离线。
5/7
drivers/base/memory: count the poison a block already holds when creating it
创建 memory_block 时遍历已置 PG_hwpoison 的帧累加毒页计数,弥补 memblk_nr_poison_inc() 依赖未初始化的 sections_per_block,防止 memory_block_online() 误放行含毒块。
6/7
mm/memory-failure: efi: reserve the inherited poisoned-memory units
efi_config_parse_tables() 校验跨 kexec 位图表头后,保留表页但不加入 memblock.memory,并在镜像/initrd 预留后按位调用 memblock_reserve_hwpoison() 预留毒页单元。
7/7
mm/memory-failure: efi: record hardware-poisoned frames into the poisoned-memory table
在 action_result() 统计前把硬离线毒帧对应 2MiB 位写入 EFI 位图,覆盖 MF_MSG_ALREADY_POISONED;用 memremap 映射避免 direct map 缺页,SME 主机暂跳过,只置位不清理。