From owner-svn-src-all@freebsd.org Fri Dec 9 23:37:15 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 51579C6FC25; Fri, 9 Dec 2016 23:37:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 08903B86; Fri, 9 Dec 2016 23:37:14 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB9NbETF028215; Fri, 9 Dec 2016 23:37:14 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB9NbE7r028214; Fri, 9 Dec 2016 23:37:14 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201612092337.uB9NbE7r028214@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 9 Dec 2016 23:37:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r309777 - head/sbin/nvmecontrol X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2016 23:37:15 -0000 Author: imp Date: Fri Dec 9 23:37:14 2016 New Revision: 309777 URL: https://svnweb.freebsd.org/changeset/base/309777 Log: Implement Intel's log page 0xc1 (Read Command Latency Log) and page 0xc1 (Write Command Latency Log). Sponsored By: Netflix, Inc Modified: head/sbin/nvmecontrol/logpage.c Modified: head/sbin/nvmecontrol/logpage.c ============================================================================== --- head/sbin/nvmecontrol/logpage.c Fri Dec 9 23:37:11 2016 (r309776) +++ head/sbin/nvmecontrol/logpage.c Fri Dec 9 23:37:14 2016 (r309777) @@ -324,6 +324,47 @@ print_intel_temp_stats(void *buf, uint32 printf("Estimated Temperature Offset: %ju C/K\n", (uintmax_t)temp->est_offset); } +/* + * Format from Table 22, section 5.7 IO Command Latency Statistics. + * Read and write stats pages have identical encoding. + */ +static void +print_intel_read_write_lat_log(void *buf, uint32_t size __unused) +{ + const char *walker = buf; + int i; + + printf("Major: %d\n", le16dec(walker + 0)); + printf("Minor: %d\n", le16dec(walker + 2)); + for (i = 0; i < 32; i++) + printf("%4dus-%4dus: %ju\n", i * 32, (i + 1) * 32, (uintmax_t)le32dec(walker + 4 + i * 4)); + for (i = 1; i < 32; i++) + printf("%4dms-%4dms: %ju\n", i, i + 1, (uintmax_t)le32dec(walker + 132 + i * 4)); + for (i = 1; i < 32; i++) + printf("%4dms-%4dms: %ju\n", i * 32, (i + 1) * 32, (uintmax_t)le32dec(walker + 256 + i * 4)); +} + +static void +print_intel_read_lat_log(void *buf, uint32_t size) +{ + + printf("Intel Read Latency Log\n"); + printf("======================\n"); + print_intel_read_write_lat_log(buf, size); +} + +static void +print_intel_write_lat_log(void *buf, uint32_t size) +{ + + printf("Intel Write Latency Log\n"); + printf("=======================\n"); + print_intel_read_write_lat_log(buf, size); +} + +/* + * Table 19. 5.4 SMART Attributes + */ static void print_intel_add_smart(void *buf, uint32_t size __unused) { @@ -803,11 +844,15 @@ static struct logpage_function { sizeof(struct nvme_health_information_page)}, {NVME_LOG_FIRMWARE_SLOT, NULL, print_log_firmware, sizeof(struct nvme_firmware_page)}, + {HGST_INFO_LOG, "hgst", print_hgst_info_log, + DEFAULT_SIZE}, {INTEL_LOG_TEMP_STATS, "intel", print_intel_temp_stats, sizeof(struct intel_log_temp_stats)}, - {INTEL_LOG_ADD_SMART, "intel", print_intel_add_smart, + {INTEL_LOG_READ_LAT_LOG, "intel", print_intel_read_lat_log, DEFAULT_SIZE}, - {HGST_INFO_LOG, "hgst", print_hgst_info_log, + {INTEL_LOG_WRITE_LAT_LOG, "intel", print_intel_write_lat_log, + DEFAULT_SIZE}, + {INTEL_LOG_ADD_SMART, "intel", print_intel_add_smart, DEFAULT_SIZE}, {0, NULL, NULL, 0}, };