public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 0/1] cxl/pmem: debug invalid serial number data
@ 2025-02-19  4:00 Yuquan Wang
  2025-02-19  4:00 ` [PATCH v5 1/1] " Yuquan Wang
  0 siblings, 1 reply; 6+ messages in thread
From: Yuquan Wang @ 2025-02-19  4:00 UTC (permalink / raw)
  To: dave, jonathan.cameron, dave.jiang, alison.schofield,
	vishal.l.verma, ira.weiny, dan.j.williams
  Cc: linux-cxl, linux-kernel, chenbaozi, Yuquan Wang

v4 -> v5:
- Put the info[i].offset assignment after the info[i].serial

v3 -> v4:
- Pull the info[i] assignment and check code up

v2 -> v3:
- Add an inline comment
- Debug serial number before its assignment

v1 -> v2:
- Change 'dev_dbg' to 'dev_err'

Background
==========
A device with missing or invalid serial number is not compliant with the
spec. But we could still use it to create a nvdimm pmem region and set a
non-zero cookie of nd_interleave_set, for example:
  1. create a cxl pmem region interleaved with 2 devices (one with
     serial number 0 and the other with serial number 1), and the cookie
     would be non-zero/valid.
  2. create the second cxl pmem region by 1 device with no serial number
     and this region would have a non-zero cookie because the offset of
     dpa is non-zero.

Problem
=======
In a nvdimm interleave-set each device with an invalid or zero
serial number may cause pmem region initialization to fail, but in
cxl case such device could still set cookies of nd_interleave_set
and create a nvdimm pmem region.

CXL Pmem Validation
===================
This patch adds the validation of serial number in cxl pmem region creation.
The event of no serial number would cause to fail to set the cookie
and pmem region.

cxl-test
========
A mock serial number is set from the platform device id and 0 is a valid
platform device id. For cxl-test to work properly, always +1 on mock
device's serial number.

Yuquan Wang (1):
  cxl/pmem: debug invalid serial number data

 drivers/cxl/pmem.c           | 12 ++++++++++--
 tools/testing/cxl/test/mem.c |  2 +-
 2 files changed, 11 insertions(+), 3 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-02-20 18:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-19  4:00 [PATCH v5 0/1] cxl/pmem: debug invalid serial number data Yuquan Wang
2025-02-19  4:00 ` [PATCH v5 1/1] " Yuquan Wang
2025-02-19 19:29   ` Alison Schofield
2025-02-19 21:20   ` Ira Weiny
2025-02-20 17:30   ` Jonathan Cameron
2025-02-20 18:57   ` Dave Jiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox