Add toshiba plugin support
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
nvme-cli (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Bionic |
In Progress
|
Medium
|
Matthew Ruffell | ||
Eoan |
Fix Released
|
Undecided
|
Unassigned | ||
Focal |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
[Impact]
The version of nvme-cli in Bionic (1.5-ubuntu1) lacks support for functionality unique to Toshiba NVMe devices, provided by the toshiba-nvme plugin:
$ sudo nvme toshiba
nvme-1.5
usage: nvme toshiba <command> [<device>] [<args>]
The '<device>' may be either an NVMe character device (ex: /dev/nvme0) or an
nvme block device (ex: /dev/nvme0n1).
Toshiba NVME plugin
The following are all implemented sub-commands:
vs-smart-add-log Extended SMART information
vs-internal-log Get Internal Log
clear-
version Shows the program version
help Display this help
Several customers have asked for this plugin to be included, so they can see the internal logs from their Toshiba NVMe devices.
[Test Case]
You can find a test package for Bionic here:
https:/
Once that is installed, verify that the toshiba plugin exists:
$ sudo nvme toshiba
This will print plugin help, and a list of subcommands which are supported.
From there, you can run each of the plugin commands to test them:
$ for cmd in vs-smart-add-log vs-internal-log clear-pcie-
sudo nvme toshiba $cmd /dev/nvme0n1
done
I have tested the package without access to hardware, and the help commands work as expected:
https:/
[Regression Risk]
I believe that this SRU falls under the "Other safe cases" category under
https:/
This SRU fulfills the first three cases for applicability while also improving the user experience of those with Toshiba NVMe devices.
For case one:
(1) has an obviously safe patch: We are adding a standalone plugin separated completely from existing code, since it is implemented down the new "nvme toshiba" code path. The patch itself only reads hardware registers and prints the contents to the console, and does not do anything too serious.
(2) "affects an application" - changes are limited to nvme-cli only, as kernel support is already present.
For case two:
This SRU will enable the use of Toshiba NVMe devices, while not affecting any existing NVMe devices from other manufacturers, since the subcommand is implemented alongside other manufactures subcommands, and does not modify any existing code.
For case three:
The changes are unintrusive, again, to being limited to plugin which implements a new subcommand. The code itself is simplistic, and has not been dramatically modified since it first landed in upstream compared to the present day. The feature landed in nvme-cli version 1.6, which appears in cosmic onwards, meaning upgrading from bionic to a newer release will not cause upgrade regressions.
I did a diff of the proposed patch to the current upstream master branch, and the new changes are more or less cosmetic:
https:/
If you want to review each commit to current master branch, I have provided them below:
e5786ad argconfig: Remove unused paramters
1d37bc9 nvme-cli: Code cleanup
507ded5 nvme-vendor: fix c99 declarations in vendor plugins
f392181 Refactor plugins in a file hierarchy
We have included one fixup commit already in this SRU, check [Other Info] for details.
I will ask a customer to test the package on real hardware soon, and try and get a printout of their session.
As such, I believe this will not introduce any regressions. If a regression were to happen it would be limited to the "nvme toshiba" subcommand, and not any other nvme-cli functionality.
[Other Info]
The commits which add support for Toshiba devices are:
commit 3d52c76a74a5fe8
Author: Andrew Meir <email address hidden>
Date: Wed Mar 28 17:42:53 2018 +0200
Subject: Add toshiba plugin code and command documentation.
Link: https:/
commit daf7b2d2cb53d86
Author: Andrew Meir <email address hidden>
Date: Wed Mar 28 20:21:34 2018 +0200
Subject: Add toshiba plugin to makefile rules.
Link: https:/
There is also a fixup commit which is required, and is a part of this SRU:
commit 5e9239edb89dd75
Author: Andrew Meir <email address hidden>
Date: Fri Apr 13 14:51:17 2018 +0200
Subject: Fixes for log page access.
Link: https:/
All three commits landed in version 1.6 of nvme-cli, and bionic only needs the backport:
$ rmadison nvme-cli
nvme-cli | 1.5-1 | bionic/universe | amd64
nvme-cli | 1.5-1ubuntu1 | bionic-
nvme-cli | 1.7-1 | eoan/universe | amd64
nvme-cli | 1.9-1 | focal/universe | amd64
There was some minor backporting required. I merged the commit "Add toshiba plugin to makefile rules." into the primary Toshiba plugin patch, since it only changes the Makefile, which needed some context adjustment.
There was also a parameter change needed for nvme_set_feature() in clear_correctab
Cherry-picking the following commit causes a build failure:
3d52c76 Add toshiba plugin code and command documentation.
This is due to a change due to a since-added parameter to nvme_set_feature() in:
54f5e4a Add support for decoding IO Determinism features
Following the pattern of changes in that commit, I think we can just drop that parameter like so:
diff --git a/toshiba-nvme.c b/toshiba-nvme.c le_errors( int argc, char **argv, struct command *cmd, feature( fd, namespace_id, feature_id, value, cdw12, save,
fprintf( stderr, "%s: couldn't clear PCIe correctable errors \n", __func__);
index a3b6c13..4bd03b7 100644
--- a/toshiba-nvme.c
+++ b/toshiba-nvme.c
@@ -627,7 +627,7 @@ static int clear_correctab
const bool save = false;
__u32 result;
err = nvme_set_
- 0, NULL, &result);
+ NULL, &result);
if (err) {
}