[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240628033509.27612-1-tianruidong@linux.alibaba.com>
Date: Fri, 28 Jun 2024 11:35:09 +0800
From: Ruidong Tian <tianruidong@...ux.alibaba.com>
To: linux-kernel@...r.kernel.org
Cc: linux-mm@...ck.org,
akpm@...ux-foundation.org,
nao.horiguchi@...il.com,
linmiaohe@...wei.com,
tianruidong@...baba.linux.com,
xueshuai@...ux.alibaba.com,
Ruidong Tian <tianruidong@...ux.alibaba.com>
Subject: [PATCH] mm/hwpoison: avoid speculation access after soft/hard offline
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@...ux.alibaba.com>
---
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
Powered by blists - more mailing lists