Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

cxl/events: Add extra validity checks for CVME count in DRAM Event Record

According to the CXL Specification Revision 3.2, Section 8.2.10.2.1.2,
Table 8-58 (DRAM Event Record), the CVME (Corrected Volatile Memory Error)
Count field is valid under the following conditions:
1. The Threshold Event bit is set in the Memory Event Descriptor field,
and
2. The CVME Count must be greater than 0 for events where the Advanced
Programmable Threshold Counter has expired.

Additionally, if the Advanced Programmable Corrected Memory Error Counter
Expire bit in the Memory Event Type field is set, then the Threshold Event
bit in the Memory Event Descriptor field shall also be set.

Add validity checks for the above conditions while reporting the event to
the userspace.

Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Shiju Jose <shiju.jose@huawei.com>
Link: https://patch.msgid.link/20250717101817.2104-4-shiju.jose@huawei.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>

authored by

Shiju Jose and committed by
Dave Jiang
d8145bb8 cd3b36cf

+13 -1
+9
drivers/cxl/core/mbox.c
··· 941 941 if (cxl_store_rec_dram((struct cxl_memdev *)cxlmd, evt)) 942 942 dev_dbg(&cxlmd->dev, "CXL store rec_dram failed\n"); 943 943 944 + if (evt->dram.media_hdr.descriptor & 945 + CXL_GMER_EVT_DESC_THRESHOLD_EVENT) 946 + WARN_ON_ONCE((evt->dram.media_hdr.type & 947 + CXL_DER_MEM_EVT_TYPE_AP_CME_COUNTER_EXPIRE) && 948 + !get_unaligned_le24(evt->dram.cvme_count)); 949 + else 950 + WARN_ON_ONCE(evt->dram.media_hdr.type & 951 + CXL_DER_MEM_EVT_TYPE_AP_CME_COUNTER_EXPIRE); 952 + 944 953 trace_cxl_dram(cxlmd, type, cxlr, hpa, hpa_alias, 945 954 &evt->dram); 946 955 }
+4 -1
drivers/cxl/core/trace.h
··· 661 661 CXL_EVENT_GEN_MED_COMP_ID_SIZE); 662 662 __entry->sub_channel = rec->sub_channel; 663 663 __entry->cme_threshold_ev_flags = rec->cme_threshold_ev_flags; 664 - __entry->cvme_count = get_unaligned_le24(rec->cvme_count); 664 + if (rec->media_hdr.descriptor & CXL_GMER_EVT_DESC_THRESHOLD_EVENT) 665 + __entry->cvme_count = get_unaligned_le24(rec->cvme_count); 666 + else 667 + __entry->cvme_count = 0; 665 668 ), 666 669 667 670 CXL_EVT_TP_printk("dpa=%llx dpa_flags='%s' descriptor='%s' type='%s' sub_type='%s' " \