From nobody Thu Nov 16 04:14:07 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SW69X2nWQz517Tg; Thu, 16 Nov 2023 04:14:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SW69X0H5zz4bMR; Thu, 16 Nov 2023 04:14:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700108048; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sjZi1W0bwjHrVu5YebgJO268DgAE5bDbJ++4PV+97/M=; b=mU1oqBDlxtfuwGVR0DM1e/SaQ7vBK1IzgVn9WfokMiU2n85NcL5TkqQNAqqGpbAXw5ogzf Uv8/UkjZLwfajF2nWCWuAJtPU437nsvxf5JpNykEkwslgtvX/E6uSaDXLSzLZhR6SpuKdH VPReOK24x+ip2zyqvw7OgGCfTgoWnkLLHWIRIFyxbzXKYlRbf/KqN0ds3P13v2tAMOMUKX u+VWhungzpeJUrqYcZgMdDNLcS4TSAhX8OivGus2CHfjo+TBkYEucE+H5eVSRglyoTpavw FEm6643iwZAMxCoZAb/uBk/QpHgh1ypeU68CsdesC/3+cXpQwhoiRytilVwuww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700108048; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sjZi1W0bwjHrVu5YebgJO268DgAE5bDbJ++4PV+97/M=; b=A0pgtzAZMtUxsHbvP+CjNp+gKbE4+w411j8bkjEjlI+QbsmVGuWSI0PXfd1AUVZ4iUHd7u RuGdkKtDFYqu+v6tQZKtkOfYuuSJo4/AO5I/q4nYZLHe2uWSgrrLyCyFPP5eL/cAy1pNHR WODTL6x/pu9xgp5Usu9iGbxxIaHOUPfY77zVXwUz3CRyz8fAZ1MT6J3Pm8DvvkE4vlUsoa jb/DGhMaDkuQ/a2ajxKJ4veTkCCdeckMqi6EvHRvckkpjcC6AhC18K+heZmHVFChaKpJm0 Kwx9tvCMOHpXzqqTEBJfkbE6wYKTr2VCsi0bKjjskJDjUjdor3Hg3YOdjeLckA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1700108048; a=rsa-sha256; cv=none; b=kSWt5az/v7E4KKw8glEiPaXlURVc961UYFrK5OXmNv0YJAu/1ZO+WBTDkJvR2d+ojBZP9/ n81aaHPCUfL8XyfDDKULQtr6fwbEZksXNqeraL1NnqfjrqP0HFzTsfAc06p3INVB55YNVi OQTlqmpK8+sQufUD4dZUTT00P069tuavZAmU+w7cqaSr7kVUlWV1h3lM+pFk50Is4nWDHS oujZG8kP63G5MlXgfk+LCywiJpFG6tY4QZ1LBaNBf+BBnLFMqMLEjVKVyjKBHjcEhMNuSs 2aQarYShcEXk8jbNLx+mG90Sw7bvMyAVRZiCTDrsjMF9UcQGg3fT0pjBJkSlfQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SW69W6NDDzlfv; Thu, 16 Nov 2023 04:14:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3AG4E7gi083507; Thu, 16 Nov 2023 04:14:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3AG4E7fD083504; Thu, 16 Nov 2023 04:14:07 GMT (envelope-from git) Date: Thu, 16 Nov 2023 04:14:07 GMT Message-Id: <202311160414.3AG4E7fD083504@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: d282baddb0b0 - main - Add interface NVME to devstat List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d282baddb0b029ca8466d23ac51e95c918442535 Auto-Submitted: auto-generated The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=d282baddb0b029ca8466d23ac51e95c918442535 commit d282baddb0b029ca8466d23ac51e95c918442535 Author: Alexander Motin AuthorDate: 2023-11-16 04:03:40 +0000 Commit: Alexander Motin CommitDate: 2023-11-16 04:03:40 +0000 Add interface NVME to devstat This allows to list only NVMe devices in systat, iostat, vmstat, etc. Previously those were counted as OTHER. --- cddl/lib/libdtrace/io.d | 3 +++ lib/libdevstat/devstat.3 | 2 ++ lib/libdevstat/devstat.c | 1 + share/man/man9/devstat.9 | 1 + sys/cam/cam_ccb.h | 1 + sys/dev/nvd/nvd.c | 5 +++++ sys/sys/devicestat.h | 1 + usr.bin/vmstat/vmstat.8 | 2 ++ usr.sbin/iostat/iostat.8 | 2 ++ 9 files changed, 18 insertions(+) diff --git a/cddl/lib/libdtrace/io.d b/cddl/lib/libdtrace/io.d index fbce09e2fcf7..043291244a50 100644 --- a/cddl/lib/libdtrace/io.d +++ b/cddl/lib/libdtrace/io.d @@ -194,6 +194,8 @@ inline int DEVSTAT_TYPE_IF_IDE = 0x020; #pragma D binding "1.13" DEVSTAT_TYPE_IF_IDE inline int DEVSTAT_TYPE_IF_OTHER = 0x030; #pragma D binding "1.13" DEVSTAT_TYPE_IF_OTHER +inline int DEVSTAT_TYPE_IF_NVM = 0x040; +#pragma D binding "1.13" DEVSTAT_TYPE_IF_NVME inline int DEVSTAT_TYPE_IF_MASK = 0x0f0; #pragma D binding "1.13" DEVSTAT_TYPE_IF_MASK inline int DEVSTAT_TYPE_PASS = 0x100; @@ -228,6 +230,7 @@ inline string device_if_string[int type] = type == DEVSTAT_TYPE_IF_SCSI ? "SCSI" : type == DEVSTAT_TYPE_IF_IDE ? "IDE" : type == DEVSTAT_TYPE_IF_OTHER ? "OTHER" : + type == DEVSTAT_TYPE_IF_NVME ? "NVME" : strjoin("UNKNOWN(", strjoin(lltostr(type), ")")); #pragma D binding "1.13" device_if diff --git a/lib/libdevstat/devstat.3 b/lib/libdevstat/devstat.3 index 20f5fdd5649c..d0eaff359e15 100644 --- a/lib/libdevstat/devstat.3 +++ b/lib/libdevstat/devstat.3 @@ -428,6 +428,8 @@ Floppy devices Integrated Drive Electronics devices .It Li SCSI Small Computer System Interface devices +.It Li NVME +NVM Express Interface devices .It Li other Any other device interface .El diff --git a/lib/libdevstat/devstat.c b/lib/libdevstat/devstat.c index 7465613da4f1..7aca8c5733d0 100644 --- a/lib/libdevstat/devstat.c +++ b/lib/libdevstat/devstat.c @@ -75,6 +75,7 @@ struct devstat_match_table match_table[] = { {"scsi", DEVSTAT_TYPE_IF_SCSI, DEVSTAT_MATCH_IF}, {"ide", DEVSTAT_TYPE_IF_IDE, DEVSTAT_MATCH_IF}, {"other", DEVSTAT_TYPE_IF_OTHER, DEVSTAT_MATCH_IF}, + {"nvme", DEVSTAT_TYPE_IF_NVME, DEVSTAT_MATCH_IF}, {"worm", DEVSTAT_TYPE_WORM, DEVSTAT_MATCH_TYPE}, {"sa", DEVSTAT_TYPE_SEQUENTIAL,DEVSTAT_MATCH_TYPE}, {"pass", DEVSTAT_TYPE_PASS, DEVSTAT_MATCH_PASS}, diff --git a/share/man/man9/devstat.9 b/share/man/man9/devstat.9 index e474e3119418..3682ad024eae 100644 --- a/share/man/man9/devstat.9 +++ b/share/man/man9/devstat.9 @@ -414,6 +414,7 @@ typedef enum { DEVSTAT_TYPE_IF_SCSI = 0x010, DEVSTAT_TYPE_IF_IDE = 0x020, DEVSTAT_TYPE_IF_OTHER = 0x030, + DEVSTAT_TYPE_IF_NVME = 0x040, DEVSTAT_TYPE_IF_MASK = 0x0f0, DEVSTAT_TYPE_PASS = 0x100 } devstat_type_flags; diff --git a/sys/cam/cam_ccb.h b/sys/cam/cam_ccb.h index 9d52213e3952..66b374008aa5 100644 --- a/sys/cam/cam_ccb.h +++ b/sys/cam/cam_ccb.h @@ -306,6 +306,7 @@ typedef enum { !XPORT_IS_ATA(t) && !XPORT_IS_NVME(t)) #define XPORT_DEVSTAT_TYPE(t) (XPORT_IS_ATA(t) ? DEVSTAT_TYPE_IF_IDE : \ XPORT_IS_SCSI(t) ? DEVSTAT_TYPE_IF_SCSI : \ + XPORT_IS_NVME(t) ? DEVSTAT_TYPE_IF_NVME : \ DEVSTAT_TYPE_IF_OTHER) #define PROTO_VERSION_UNKNOWN (UINT_MAX - 1) diff --git a/sys/dev/nvd/nvd.c b/sys/dev/nvd/nvd.c index 6b83757aa938..26bc4ee36d50 100644 --- a/sys/dev/nvd/nvd.c +++ b/sys/dev/nvd/nvd.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -471,6 +472,10 @@ nvd_new_disk(struct nvme_namespace *ns, void *ctrlr_arg) disk->d_flags |= DISKFLAG_CANDELETE; if (nvme_ns_get_flags(ns) & NVME_NS_FLUSH_SUPPORTED) disk->d_flags |= DISKFLAG_CANFLUSHCACHE; + disk->d_devstat = devstat_new_entry(disk->d_name, disk->d_unit, + disk->d_sectorsize, DEVSTAT_ALL_SUPPORTED, + DEVSTAT_TYPE_DIRECT | DEVSTAT_TYPE_IF_NVME, + DEVSTAT_PRIORITY_DISK); /* * d_ident and d_descr are both far bigger than the length of either diff --git a/sys/sys/devicestat.h b/sys/sys/devicestat.h index 1b8db6f100c9..2583697f7515 100644 --- a/sys/sys/devicestat.h +++ b/sys/sys/devicestat.h @@ -125,6 +125,7 @@ typedef enum { DEVSTAT_TYPE_IF_SCSI = 0x010, DEVSTAT_TYPE_IF_IDE = 0x020, DEVSTAT_TYPE_IF_OTHER = 0x030, + DEVSTAT_TYPE_IF_NVME = 0x040, DEVSTAT_TYPE_IF_MASK = 0x0f0, DEVSTAT_TYPE_PASS = 0x100 } devstat_type_flags; diff --git a/usr.bin/vmstat/vmstat.8 b/usr.bin/vmstat/vmstat.8 index d1f0d4d60bcc..eead7a7ef9c3 100644 --- a/usr.bin/vmstat/vmstat.8 +++ b/usr.bin/vmstat/vmstat.8 @@ -173,6 +173,8 @@ Floppy devices Integrated Drive Electronics devices .It SCSI Small Computer System Interface devices +.It NVME +NVM Express Interface devices .It other Any other device interface .El diff --git a/usr.sbin/iostat/iostat.8 b/usr.sbin/iostat/iostat.8 index 863f8ab8466c..a08a62dc694d 100644 --- a/usr.sbin/iostat/iostat.8 +++ b/usr.sbin/iostat/iostat.8 @@ -206,6 +206,8 @@ Floppy devices Integrated Drive Electronics devices .It SCSI Small Computer System Interface devices +.It NVME +NVM Express Interface devices .It other Any other device interface .El