mbox series

[ndctl,v3,0/3] Fix accessors for negative fields and error checking for health info

Message ID 20230810082354.5992-1-jehoon.park@samsung.com (mailing list archive)
Headers show
Series Fix accessors for negative fields and error checking for health info | expand

Message

Jehoon Park Aug. 10, 2023, 8:23 a.m. UTC
In CXL 3.0 SPEC, 8.2.9.8.3.1 and 8.2.9.8.3.2 define temperature fields
as a 2's complement value. However, they are retrieved by the same accessor
for unsigned value. This causes inaccuracy when the value is negative.

The first patch updates the pre-defined value for device temperature field of
the Get Health Info command when it is not implemented. (CXL 2.0 Errata F38)

The second patch fixes accessors for temperature fields.
Add a new payload accessor for a signed value, then use it for retrieving
temperature properly. INT_MAX is used to indicate errors because negative
errno codes are not distinguishable from the retrieved values when they are
negative. Caller should check errno to know what kind of error occurs.

The third patch fixes the error checking logic when listing device's health
info.

Changes in v3:
- Correct the revision history in the patch description (Jonathan)
- Add review tag (Jonathan)
- Revert unrelated change (Jonathan)
- Move caller side change to proper patch (Jonathan)
- Link to v2: https://lore.kernel.org/r/20230807063549.5942-1-jehoon.park@samsung.com/

Changes in v2:
- Rebase on the latest pending branch
- Remove dbg() messages in libcxl accessors (Vishal)
- Make signed value accessors to return INT_MAX when error occurs and set
  errno as proper errno codes (Vishal)
- Use proper value for checking "life_used" and "device_temperature" fields
  are implemented
- Link to v1: https://lore.kernel.org/r/20230717062908.8292-1-jehoon.park@samsung.com/

Jehoon Park (3):
  libcxl: Update a outdated value to the latest revision
  libcxl: Fix accessors for temperature field to support negative value
  cxl/json.c: Fix the error checking logic when listing device's health
    info

 cxl/json.c        |  9 +++++----
 cxl/lib/libcxl.c  | 30 +++++++++++++++++++++---------
 cxl/lib/private.h |  2 +-
 3 files changed, 27 insertions(+), 14 deletions(-)


base-commit: a871e6153b11fe63780b37cdcb1eb347b296095c