Page that offlined can report CE/UE event due to speculation access. Delete kernel 1:1 linner mapping after soft/hard offline to avoid it. Signed-off-by: Ruidong Tian <tianruidong@xxxxxxxxxxxxxxxxx> --- drivers/base/memory.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 67858eeb92ed..502ee1107ac6 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -22,6 +22,7 @@ #include <linux/stat.h> #include <linux/slab.h> #include <linux/xarray.h> +#include <linux/set_memory.h> #include <linux/atomic.h> #include <linux/uaccess.h> @@ -600,6 +601,8 @@ static ssize_t soft_offline_page_store(struct device *dev, return -EINVAL; pfn >>= PAGE_SHIFT; ret = soft_offline_page(pfn, 0); + if (!ret) + set_mce_nospec(pfn); return ret == 0 ? count : ret; } @@ -616,6 +619,8 @@ static ssize_t hard_offline_page_store(struct device *dev, return -EINVAL; pfn >>= PAGE_SHIFT; ret = memory_failure(pfn, MF_SW_SIMULATED); + if (!ret) + set_mce_nospec(pfn); if (ret == -EOPNOTSUPP) ret = 0; return ret ? ret : count; -- 2.39.3