rasdaemon: Add page offline support for cxl memory
RFC PATCH 1/1 rasdaemon: Add page offline support for cxl memory
From: Srinivasulu Thanneeru <[email protected]>
CXL Type 3 device implements a threshold for corrected errors as described in CXL 3.1 specification section 8.2.9.9.11.3. Device can set the threshold field in the DRAM event descriptor when it detects corrected errors that meet or exceed the threshold value.
This patch is intended to offline pages for corrected memory errors when the device sets the threshold in the DRAM event descriptor.
This helps prevent corrected errors from becoming uncorrected.
Record the hpa for given dpa, then do page offline for hpa when corrected errors threshold is set.
--- ras-cxl-handler.c | 14 ++++++++++++++ ras-page-isolation.c | 7 +++++++ ras-page-isolation.h | 1 + ras-record.h | 1 + 4 files changed, 23 insertions(+)
ras-cxl-handler.c +14 -0
@@ -13,6 +13,7 @@#include "ras-cxl-handler.h" #include "ras-logger.h" +#include "ras-page-isolation.h" #include "ras-record.h" #include "ras-report.h" #include "types.h"
@@ -897,6 +898,12 @@ int ras_cxl_dram_event_handler(struct trace_seq *s,if (trace_seq_printf (s,"dpa:0x%llx " , (unsigned long long )ev.dpa) <=0 )return -1 ; +if (tep_get_field_val (s, event,"hpa" , record, &val,1 ) <0 ) +return -1 ; + ev.hpa = val; +if (trace_seq_printf (s,"hpa:0x%llx " , (unsigned long long )ev.hpa) <=0 ) +return -1 ; +if (tep_get_field_val (s, event,"dpa_flags" , record, &val,1 ) <0 )return -1 ; ev.dpa_flags = val;
@@ -1005,6 +1012,13 @@ int ras_cxl_dram_event_handler(struct trace_seq *s, } } +#ifdef HAVE_MEMORY_CE_PFA +/* Page offline for CE when threeshold is set */ +if (!(ev.descriptor &CXL_GMER_EVT_DESC_UNCORECTABLE_EVENT ) && + (ev.descriptor &CXL_GMER_EVT_DESC_THRESHOLD_EVENT )) +ras_hw_threshold_pageoffline (ev.hpa); +#endif +/* Insert data into the SGBD */ #ifdef HAVE_SQLITE3 ras_store_cxl_dram_event (ras, &ev);
ras-page-isolation.c +7 -0
@@ -338,3 +338,10 @@ void ras_record_page_error(unsigned long long addr, unsigned int count, time_t tpage_record (pr, count, time); } } + +void ras_hw_threshold_pageoffline (unsigned long long addr) +{ +time_t now =time (NULL ); + +ras_record_page_error (addr, threshold.val, now); +}
ras-page-isolation.h +1 -0
@@ -57,5 +57,6 @@ struct isolation {void ras_page_account_init (void );void ras_record_page_error (unsigned long long addr,unsigned int count,time_t time); +void ras_hw_threshold_pageoffline (unsigned long long addr);#endif
ras-record.h +1 -0
@@ -203,6 +203,7 @@ struct ras_cxl_general_media_event {struct ras_cxl_dram_event {struct ras_cxl_event_common_hdr hdr;uint64_t dpa; +uint64_t hpa;uint8_t dpa_flags;uint8_t descriptor;uint8_t type;
Signature · 1 line
2.46.2
Hi Srinivas,
Please see few comments inline,
Quoted 10 lines
-----Original Message-----
From: Srinivasulu Opensrc <[email protected]>
Sent: 14 October 2024 11:11
To: [email protected]; [email protected]; linux- [email protected]
Cc: Srinivasulu Thanneeru <[email protected]>; Ajay Joshi <[email protected]>; Senthil Thangaraj <[email protected]>; Vandana Salve <[email protected]>
Subject: [RFC PATCH] rasdaemon: Add page offline support for cxl memory
Quoted 6 lines
From: Srinivasulu Thanneeru <[email protected]>
CXL Type 3 device implements a threshold for corrected errors as described in CXL 3.1 specification section 8.2.9.9.11.3. Device can set the threshold field in the DRAM event descriptor when it detects corrected errors that meet or exceed the threshold value.
1. Better mentioning Spec section and table for DRAM Event Record.
2. Section 8.2.9.2.1.1 Table 8-45 General Media Event Record has threshold event bit in memory event descriptor field. May need similar page offline support for General Media Event Record too?
3. General question, Is the threshold check for the corrected errors in a CXL device always supported/enabled? If yes, please ignore following question.
If not,
1. Do we need to store the corrected errors reported using ras_record_page_error() when threshold check is not enabled? and page would be offline when the total CE count exceeds threshold.val by the ras-page-isolation.
Not sure how rasdaemon get information whether threshold check is enabled/supported? May be from Advanced Programmable Corrected Volatile Memory Error Threshold Feature?
Quoted 28 lines
This patch is intended to offline pages for corrected memory errors when the device sets the threshold in the DRAM event descriptor.
This helps prevent corrected errors from becoming uncorrected.Record the hpa for given dpa, then do page offline for hpa when corrected errors threshold is set.
Signed-off-by Srinivasulu Thanneeru <[email protected]>---
ras-cxl-handler.c | 14 ++++++++++++++ ras-page-isolation.c | 7 +++++++ ras-page-isolation.h | 1 + ras-record.h | 1 + 4 files changed, 23 insertions(+)ras-cxl-handler.c +1
-0@@ -13,6 +13,7 @@#include "ras-cxl-handler.h" #include "ras-logger.h" +#include "ras-page-isolation.h" #include "ras-record.h" #include "ras-report.h" #include "types.h"
ras-cxl-handler.c int ras_cxl_dram_event_handler(struct trace_seq *s, · line 906
Quoted 9 lines
ras-cxl-handler.c +6
-0@@ -897,6 +898,12 @@ int ras_cxl_dram_event_handler(struct trace_seq *s,if (trace_seq_printf (s,"dpa:0x%llx " , (unsigned long long )ev.dpa) <=0 )return -1 ; +if (tep_get_field_val (s, event,"hpa" , record, &val,1 ) <0 ) +return -1 ; + ev.hpa = val; +if (trace_seq_printf (s,"hpa:0x%llx " , (unsigned long long )ev.hpa) <=0 ) +return -1 ; +
Support for the new fields in cxl_general_media and cxl_dram events including 'hpa' had submitted in August in the following pull request.
https://github.com/mchehab/rasdaemon/pull/178
https://github.com/mchehab/rasdaemon/pull/178/commits/0b396b47d740c88fbd890213f2d9d56e566e0671
ras-cxl-handler.c int ras_cxl_dram_event_handler(struct trace_seq *s, · line 1018
Quoted 12 lines
ras-cxl-handler.c +3
-0if (tep_get_field_val (s, event,"dpa_flags" , record, &val,1 ) <0 )return -1 ; ev.dpa_flags = val;@@ -1005,6 +1012,13 @@ int ras_cxl_dram_event_handler(struct trace_seq *s, } } +#ifdef HAVE_MEMORY_CE_PFA +/* Page offline for CE when threeshold is set */ + if (!(ev.descriptor & CXL_GMER_EVT_DESC_UNCORECTABLE_EVENT)&&
ras-cxl-handler.c +1
-0+ (ev.descriptor & CXL_GMER_EVT_DESC_THRESHOLD_EVENT))
I think alignment should match open parenthesis.
Quoted 43 lines
ras-cxl-handler.c +3
-0+ras_hw_threshold_pageoffline (ev.hpa); +#endif +/* Insert data into the SGBD */ #ifdef HAVE_SQLITE3 ras_store_cxl_dram_event(ras, &ev);ras-page-isolation.c index bb6b777..6eb45d0 renamed from ras-page-isolation.c +0
-0100644
ras-page-isolation.c +0
-0@@ -338,3 +338,10 @@ void ras_record_page_error(unsigned long long addr,unsigned int count,
time_ttpage_record(pr, count, time); } }ras-page-isolation.c +5
-0+ +void ras_hw_threshold_pageoffline (unsigned long long addr) { +time_t now =time (NULL ); + +ras_record_page_error (addr, threshold.val, now); }ras-page-isolation.h index 73c9157..ed2f661 renamed from ras-page-isolation.h +0
-0100644
ras-page-isolation.h +1
-0@@ -57,5 +57,6 @@ struct isolation {void ras_page_account_init (void );void ras_record_page_error (unsigned long long addr,unsigned int count,time_t time); +void ras_hw_threshold_pageoffline (unsigned long long addr);#endif ras-record.h +1
-1@@ -203,6 +203,7 @@ struct ras_cxl_general_media_event { struct ras_cxl_dram_event {struct ras_cxl_event_common_hdr hdr;uint64_t dpa; +uint64_t hpa;uint8_t dpa_flags;uint8_t descriptor;uint8_t type; --
Quoted 2 lines
2.46.2
Thanks,
Shiju
Quoted 31 lines
-----Original Message-----
From: Shiju Jose <[email protected]>
Sent: Wednesday, October 16, 2024 4:16 PM
To: Srinivasulu Opensrc <[email protected]>; [email protected]; [email protected]; [email protected]
Cc: Srinivasulu Thanneeru <[email protected]>; Ajay Joshi <[email protected]>; Senthil Thangaraj <[email protected]>; Vandana Salve <[email protected]>
Subject: [EXT] RE: [RFC PATCH] rasdaemon: Add page offline support for cxl memoryCAUTION: EXTERNAL EMAIL. Do not click links or open attachments unless you recognize the sender and were expecting this message.
Hi Srinivas,
Please see few comments inline,
Quoted 10 lines
-----Original Message-----
From: Srinivasulu Opensrc <[email protected]>
Sent: 14 October 2024 11:11
To: [email protected]; [email protected]; linux- [email protected]
Cc: Srinivasulu Thanneeru <[email protected]>; Ajay Joshi <[email protected]>; Senthil Thangaraj <[email protected]>; Vandana Salve <[email protected]>
Subject: [RFC PATCH] rasdaemon: Add page offline support for cxl memory
Quoted 7 lines
Quoted 6 lines
From: Srinivasulu Thanneeru <[email protected]>
CXL Type 3 device implements a threshold for corrected errors as described in CXL 3.1 specification section 8.2.9.9.11.3. Device can set the threshold field in the DRAM event descriptor when it detects corrected errors that meet or exceed the threshold value.
1. Better mentioning Spec section and table for DRAM Event Record.
Sure, will add table information too.
Quoted 7 lines
2. Section 8.2.9.2.1.1 Table 8-45 General Media Event Record has threshold event bit
in memory event descriptor field. May need similar page offline support for General Media
Event Record too?
This patch mainly targeted for DRAM events, can be extended for Media Event in future if required.
Quoted 4 lines
3. General question, Is the threshold check for the corrected errors in a CXL device always supported/enabled? If yes, please ignore following question. If not,
1. Do we need to store the corrected errors reported using
Quoted 8 lines
ras_record_page_error()
when threshold check is not enabled? and page would be offline when the total
CE count
exceeds threshold.val by the ras-page-isolation.
Not sure how rasdaemon get information whether threshold check is
enabled/supported?
May be from Advanced Programmable Corrected Volatile Memory Error
Threshold Feature?
Yes, it uses ACVME threshold feature, if threshold enabled then flag is set in dram event record, Depending on the flag, the RASDAEMON can know whether feature is enabled or not. If enabled, then RASDAEMON will immediately try to page offline. If not enabled, then call to ras_record_page_error() wont takes place.
Quoted 115 lines
Quoted 28 lines
This patch is intended to offline pages for corrected memory errors when the device sets the threshold in the DRAM event descriptor.
This helps prevent corrected errors from becoming uncorrected.Record the hpa for given dpa, then do page offline for hpa when corrected errors threshold is set.
Signed-off-by Srinivasulu Thanneeru <[email protected]>---
ras-cxl-handler.c | 14 ++++++++++++++ ras-page-isolation.c | 7 +++++++ ras-page-isolation.h | 1 + ras-record.h | 1 + 4 files changed, 23 insertions(+)ras-cxl-handler.c +1
-0@@ -13,6 +13,7 @@#include "ras-cxl-handler.h" #include "ras-logger.h" +#include "ras-page-isolation.h" #include "ras-record.h" #include "ras-report.h" #include "types.h" ras-cxl-handler.c int ras_cxl_dram_event_handler(struct trace_seq *s, · line 906
Quoted 9 lines
ras-cxl-handler.c +6
-0@@ -897,6 +898,12 @@ int ras_cxl_dram_event_handler(struct trace_seq *s,if (trace_seq_printf (s,"dpa:0x%llx " , (unsigned long long )ev.dpa) <=0 )return -1 ; +if (tep_get_field_val (s, event,"hpa" , record, &val,1 ) <0 ) +return -1 ; + ev.hpa = val; +if (trace_seq_printf (s,"hpa:0x%llx " , (unsigned long long )ev.hpa) <=0 ) +return -1 ; +Support for the new fields in
cxl_general_mediaandcxl_dramevents including 'hpa' had
submitted in August in the following pull request.
https://github.co/
m%2Fmchehab%2Frasdaemon%2Fpull%2F178&data=05%7C02%7Csthanneeru.op ensrc%40micron.com%7C58611d95cc3244d1019b08dcedcfbd2d%7Cf38a5ecd281 34862b11bac1d563c806f%7C0%7C0%7C638646723730965866%7CUnknown%7C TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXV CI6Mn0%3D%7C0%7C%7C%7C&sdata=A%2B2H1gyx3njUG5U0p3p2IPzNkcPBfaKG QPfvcC%2BZRAQ%3D&reserved=0
https://github.co/
m%2Fmchehab%2Frasdaemon%2Fpull%2F178%2Fcommits%2F0b396b47d740c88 fbd890213f2d9d56e566e0671&data=05%7C02%7Csthanneeru.opensrc%40micron .com%7C58611d95cc3244d1019b08dcedcfbd2d%7Cf38a5ecd28134862b11bac1d 563c806f%7C0%7C0%7C638646723730965866%7CUnknown%7CTWFpbGZsb3d8 eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7 C0%7C%7C%7C&sdata=djrC%2BSZVrrxsZ8IiC2RJ3E5%2BwZs4QYtqulVBdgPrnyU% 3D&reserved=0Quoted 10 lines
ras-cxl-handler.c +3
-0if (tep_get_field_val (s, event,"dpa_flags" , record, &val,1 ) <0 )return -1 ; ev.dpa_flags = val;@@ -1005,6 +1012,13 @@ int ras_cxl_dram_event_handler(struct trace_seq *s, } } +#ifdef HAVE_MEMORY_CE_PFA +/* Page offline for CE when threeshold is set */ + if (!(ev.descriptor & CXL_GMER_EVT_DESC_UNCORECTABLE_EVENT)Quoted 2 lines
&&
+ (ev.descriptor &CXL_GMER_EVT_DESC_THRESHOLD_EVENT))I think alignment should match open parenthesis.
Quoted 43 lines
ras-cxl-handler.c +3
-0+ras_hw_threshold_pageoffline (ev.hpa); +#endif +/* Insert data into the SGBD */ #ifdef HAVE_SQLITE3 ras_store_cxl_dram_event(ras, &ev);ras-page-isolation.c index bb6b777..6eb45d0 renamed from ras-page-isolation.c +0
-0100644
ras-page-isolation.c +0
-0@@ -338,3 +338,10 @@ void ras_record_page_error(unsigned long long addr,unsigned int count,
time_ttpage_record(pr, count, time); } }ras-page-isolation.c +5
-0+ +void ras_hw_threshold_pageoffline (unsigned long long addr) { +time_t now =time (NULL ); + +ras_record_page_error (addr, threshold.val, now); }ras-page-isolation.h index 73c9157..ed2f661 renamed from ras-page-isolation.h +0
-0100644
ras-page-isolation.h +1
-0@@ -57,5 +57,6 @@ struct isolation {void ras_page_account_init (void );void ras_record_page_error (unsigned long long addr,unsigned int count,time_t time); +void ras_hw_threshold_pageoffline (unsigned long long addr);#endif ras-record.h +1
-1@@ -203,6 +203,7 @@ struct ras_cxl_general_media_event { struct ras_cxl_dram_event {struct ras_cxl_event_common_hdr hdr;uint64_t dpa; +uint64_t hpa;uint8_t dpa_flags;uint8_t descriptor;uint8_t type; --Quoted 2 lines
2.46.2
Thanks,
Shiju