Martin George [Mon, 8 Jul 2024 16:03:58 +0000 (21:33 +0530)]
nvme: fix verbose logging
The -v verbose option for certain nvme commands like id-ctrl,
id-ns, smart-log, sanitize-log, etc. is practically a no-op since
it only prints latency info in addition to the regular output.
But at the same time, these commands already implement a -H human
readable option which prints additional useful info. So fix the
-v option to make it synonymous with the -H option here. And while
we are at it, move the latency info from current INFO level (i.e.
-v logging) to DEBUG level (i.e. -vv logging) since it is better
suited there.
Daniel Wagner [Mon, 1 Jul 2024 12:46:04 +0000 (14:46 +0200)]
nvme: strip newline when parsing TLS key files
When exporting a TLS keys from the kernel keyring a line might have a
newline. Strip the newline away as the nvme_import_tls_key is not
expecting it and thus fails to load an exported keyfile.
Oliver Upton [Thu, 4 Jul 2024 09:09:40 +0000 (09:09 +0000)]
common.h: Avoid using unsupported load/store instructions in arm64 VMs
Using nvme show-regs within a VM on arm64 can sometimes lead to VM
termination.
To answer why this happens: one of the deficiencies of the Arm
architecture is that there exists a range of load/store instructions
that have insufficient decode information for traps taken to the
hypervisor. KVM, for example, may raise an external abort or outright
terminate the VM depending on the configuration.
This is a known problem on the kernel side, and is fixed by using
assembly MMIO accessors w/ 'safe' load/store instructions. So do
exactly that, providing arm64-specific accessors and falling back to
plain old volatile pointer accesses for other architectures.
Reported-by: William Butler <wab@google.com> Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
This commit will provide the first phase of changes
needed for parsing of OCP 2.5 Telemetry Data Areas
1 and 2. It will decode the prefined classes,
statistics, and events.
Martin George [Sun, 30 Jun 2024 07:39:07 +0000 (13:09 +0530)]
nvme: update parse_args() return value handling
Treat non-zero return values from parse_args() as errors, and not
just negative return values. Also makes this consistent with other
functions in nvme.c where parse_args() is invoked.
Francis Pravin [Wed, 26 Jun 2024 06:35:39 +0000 (12:05 +0530)]
nvme: choose PIF from QPIF if QPIFS supports and PIF is QTYPE
As per TP4141a:
"If the Qualified Protection Information Format Support(QPIFS) bit is
set to 1 and the Protection Information Format(PIF) field is set to 11b
(i.e., Qualified Type), then the pif is as defined in the Qualified
Protection Information Format (QPIF) field."
So, choose PIF from QPIF if QPIFS supports and PIF is QTYPE.
Signed-off-by: Francis Pravin <francis.p@samsung.com> Reviewed-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
nvme ana-log currently uses libnvme's nvme{,_mi_admin}_get_log_ana()
function to fetch the ANA log page.
As described in the commit adding nvme_get_ana_log_atomic() to libnvme,
this has the potential to overread the ANA log page
and may result in a torn result if the log page changes concurrently.
Use nvme{,_mi_admin}_get_ana_log_atomic() to only fetch up to the end
of the ANA log page and protect against concurrent log page changes.
nvme ana-log only includes space for MNAN namespace IDs
in the allocated ANA log page buffer if bit 6 of ANACAP
in the Identify Controller structure isn't set.
But the specification says:
Bit 6 if set to '1', then the ANAGRPID field in the Identify Namespace
data structure (refer to the NVM Command Set Specification)
does not change while the namespace is attached to any controller
There is no suggestion that NSIDs won't be returned in the ANA log page.
However, we can exclude space for NSIDs from the allocated buffer
if the Get Log Page command is going to be sent with the RGO bit set,
i.e. the --groups argument is passed.
Therefore, use the libnvme helper nvme_get_ana_log_len_from_id_ctrl()
to calculate the maximum ANA log page length.
It ignores ANACAP and takes the RGO setting into account.
Brandon Paupore [Tue, 18 Jun 2024 15:33:04 +0000 (10:33 -0500)]
plugins/ocp: underflow + index fixes for telemetry
Printing the GUID was crashing due to the unsigned int never becoming
less than 0, and fixing that triggered a warning about an incorrect max
index when printing Event FIFO data.
Maurizio Lombardi [Wed, 22 May 2024 13:06:18 +0000 (15:06 +0200)]
nvme: telemetry: report the correct error if the ioctl() fails.
It's wrong to assume that if the ioctl() returns a non-zero number
then the errno variable is set.
The ioctl() might return an NVMe Status error to inform the caller
that the requested log page is not supported, in that case errno is left
untouched.
The original code didn't handle this case and returned "-errno" even when
the latter was zero. The caller interpreted this as a successful operation
and this might lead to improperly dereferencing the log page pointer.
$ nvme telemetry-log /dev/nvme0 --output-file=telemetry_log.bin
ERROR: get_telemetry_log: : write failed with error : Bad address
Fix this bug by returning the NVMe status if errno is zero:
$ nvme telemetry-log /dev/nvme0 --output-file=telemetry_log.bin
NVMe status: Invalid Log Page: The log page indicated is invalid(0x109)
Failed to acquire telemetry log 265!
Daniel Wagner [Fri, 14 Jun 2024 07:17:41 +0000 (09:17 +0200)]
build: reorder release commits
Previously, we updated the docs after the commit so that any version
string in the docs are correct. But there are none, thus we can update
the docs before doing the release. This makes the release look a bit
more natural.
Tomas Bzatek [Thu, 25 Apr 2024 13:54:53 +0000 (15:54 +0200)]
nbft: Skip SSNS records pointing to well-known discovery NQN
Depending on a pre-OS implementation, boot attempts pointing
to the well-known discovery NQN may get transformed in
an SSNS record (and marked as 'unavailable') in case
the discovery cannot be performed. Otherwise the NBFT
table should be populated by discovered records instead.
Tomas Bzatek [Wed, 24 Apr 2024 15:52:46 +0000 (17:52 +0200)]
nbft: Perform actual discovery
This adds actual discovery support for Discovery Descriptor records.
SSNS records are connected first. Discovery Descriptor records
are checked for any existing (back-)reference from SSNS records
and are skipped if so. It is assumed in such case that the pre-OS
driver has succeeded in discovery and filled SSNS records
accordingly.
In case no SSNS record references the particular Discovery
record, an actual discovery is performed.
Francis Pravin [Mon, 3 Jun 2024 10:55:45 +0000 (16:25 +0530)]
nvme-print-stdout: print MEM bit of CTRATT field
Print MDTS and Size Limits Exclude Metadata(MEM) bit of CTRATT field
which added in TP-4099.
Signed-off-by: Francis Pravin <francis.p@samsung.com> Reviewed-by: Steven Seungcheol Lee <sc108.lee@samsung.com> Reviewed-by: Minwoo Im <minwoo.im@samsung.com>
Israel Rukshin [Thu, 18 Apr 2024 14:24:36 +0000 (14:24 +0000)]
fabrics: Always pass hostid and hostnqn
After the kernel commit ae8bd606e09b ("nvme-fabrics: prevent overriding
of existing host"), kernel ensures hostid and hostnqn maintain 1:1
mapping. This makes 'nvme discover' and 'nvme connect' commands fail
when providing only hostid or only hostnqn. This issue happens when
the user only enters NQN which doesn't contain UUID, so the generation
of the hostid fails.
There are few more issues that this commit is fixing:
- When the user provides hostid and NQN, the hostid is overridden
by generating it from the NQN.
- hostid is generated from the NQN file instead of the NQN that
the user enters at the command line.
- The warning "use generated hostid instead of hostid file" is
wrong when the user provides hostid via the command line.
The commit fixes those issues by doing the following logic:
1. If user provided both via command line - pass them as-is
2. If user doesn't enter them via command line - try to get
them from files.
3. If one of them is not provided - generate it from the other.
Use the new functions nvmf_hostid_generate() when NQN doesn't
have UUID and use nvmf_hostnqn_generate_from_hostid(hostid) to
generate hostnqn from hostid.
4. If user provided none - generate them both. Before this commit,
nvme cli didn't do it.
Signed-off-by: Israel Rukshin <israelr@nvidia.com> Reviewed-by: Max Gurtovoy <mgurtovoy@nvidia.com> Signed-off-by: Daniel Wagner <dwagner@suse.de>
Leonardo da Cunha [Wed, 8 May 2024 18:24:44 +0000 (11:24 -0700)]
plugins/solidigm: Added log pages to vs-internal-logs
Added some Identify pages, and some standard log, and some VU logs.
Created abstract data type with common fields for internal logs.
Better string buffer overflow avoidance.
Signed-off-by: Leonardo da Cunha <leonardo.da.cunha@solidigm.com>