Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 Feb 2025 00:25:44 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 2b1460110ec0 - main - nvmecontrol: Add more keys for CA page (Additional smart data)
Message-ID:  <202502220025.51M0PiR6094921@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=2b1460110ec0e991a7783a05005b94273bb9233a

commit 2b1460110ec0e991a7783a05005b94273bb9233a
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2025-02-22 00:20:42 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2025-02-22 00:23:44 +0000

    nvmecontrol: Add more keys for CA page (Additional smart data)
    
    Micron and Samsung also use this standard, though Micron is known to use
    a few different keys. Add the ones that public information say are the
    same among those the drives that have them.
    
    There's others, but either they aren't publicly documented in datasheets
    or nvme-cli code, or they vary betwen models and our code needs a fair
    amount of rework needed.
    
    Also print hex value for unknown keys. This allows scripts to more
    easily pick bytes out for those keys who have values that are encoded by
    packing multiple values into the 48-bit field.
    
    Sponsored by:           Netflix
---
 sbin/nvmecontrol/modules/intel/intel.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/sbin/nvmecontrol/modules/intel/intel.c b/sbin/nvmecontrol/modules/intel/intel.c
index c94fdb356608..4229a48e4153 100644
--- a/sbin/nvmecontrol/modules/intel/intel.c
+++ b/sbin/nvmecontrol/modules/intel/intel.c
@@ -118,6 +118,8 @@ print_intel_write_lat_log(const struct nvme_controller_data *cdata __unused, voi
 
 /*
  * Table 19. 5.4 SMART Attributes. Others also implement this and some extra data not documented.
+ * Note: different models implement the same key values to mean different things. To fix that,
+ * we'd need to index this to a vendor/device values.
  */
 void
 print_intel_add_smart(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size __unused)
@@ -138,11 +140,15 @@ print_intel_add_smart(const struct nvme_controller_data *cdata __unused, void *b
 		{ 0xe2, "Timed: Media Wear" },
 		{ 0xe3, "Timed: Host Read %" },
 		{ 0xe4, "Timed: Elapsed Time" },
+		{ 0xe7, "Lifetime Temperature" },
+		{ 0xe8, "Power" },
 		{ 0xea, "Thermal Throttle Status" },
 		{ 0xf0, "Retry Buffer Overflows" },
 		{ 0xf3, "PLL Lock Loss Count" },
 		{ 0xf4, "NAND Bytes Written" },
 		{ 0xf5, "Host Bytes Written" },
+		{ 0xf9, "NAND GiB Written" },
+		{ 0xfa, "NAND GiB Read" },
 	};
 
 	printf("Additional SMART Data Log\n");
@@ -170,11 +176,19 @@ print_intel_add_smart(const struct nvme_controller_data *cdata __unused, void *b
 		case 0xe2:
 			printf("%-32s: %3d %.3f%%\n", name, normalized, raw / 1024.0);
 			break;
+		case 0xe7:
+			printf("%-32s: %3d %#jx max: %dK min: %dK cur: %dK\n", name, normalized,
+			    (uintmax_t)raw, le16dec(walker+5), le16dec(walker+7), le16dec(walker+9));
+			break;
+		case 0xe8:
+			printf("%-32s: %3d %#jx max: %dW min: %dW cur: %dW\n", name, normalized,
+			    (uintmax_t)raw, le16dec(walker+5), le16dec(walker+7), le16dec(walker+9));
+			break;
 		case 0xea:
 			printf("%-32s: %3d %d%% %d times\n", name, normalized, walker[5], le32dec(walker+6));
 			break;
 		default:
-			printf("%-32s: %3d %ju\n", name, normalized, (uintmax_t)raw);
+			printf("%-32s: %3d %ju %#jx\n", name, normalized, (uintmax_t)raw, (uintmax_t)raw);
 			break;
 		}
 		walker += 12;
@@ -190,6 +204,6 @@ NVME_LOGPAGE(intel_rlat,
 NVME_LOGPAGE(intel_wlat,
     INTEL_LOG_WRITE_LAT_LOG,		"intel", "Write Latencies",
     print_intel_write_lat_log,		DEFAULT_SIZE);
-NVME_LOGPAGE(intel_smart,
+NVME_LOGPAGE(intel_smart,	/* Note: Samsung and Micron also use this */
     INTEL_LOG_ADD_SMART,		"intel", "Extra Health/SMART Data",
     print_intel_add_smart,		DEFAULT_SIZE);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202502220025.51M0PiR6094921>