Keith Busch [Mon, 12 Feb 2018 15:03:26 +0000 (08:03 -0700)]
Fix freeing wrong address
We increment the pointer for the firmware buffer as we read it, so we
can't free that value. This patch saves the original address so it may
be freed later.
Jeff Lien [Mon, 5 Feb 2018 16:35:59 +0000 (10:35 -0600)]
NVMe-CLI Fix fw_log Command json output
Currently, the json output for the fw_log command slot number
is zero based while the normal output is one based. This patch
will change the json output to one based. It will also only
print the revisions for the valid slots.
Signed-off-by: Jeff Lien <jeff.lien@wdc.com>
[fixed whitespace formatting] Signed-off-by: Keith Busch <keith.busch@intel.com>
Minwoo Im [Tue, 30 Jan 2018 10:36:49 +0000 (19:36 +0900)]
nvme-cli: update documentations to sync up with subcommands
Update all documentations to sync up with built-in plugin subcommands.
Not only options supported by subcommands, But few descriptions have not
been updated with implementations.
Sync-up documentation with subcommands implementations.
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Minwoo Im [Tue, 30 Jan 2018 10:11:42 +0000 (19:11 +0900)]
nvme-cli: convert iekey into a no_argument parameter
IEKEY(Ignore Existing Key) option is used widely in Reservation Acquire,
Reservation Register, and Reservation Release in a type of bool(1-bit).
Only resv_release() uses iekey field as a required_argument parameter.
It seems unnecessary because it will not be checked if this parameter
is given or not by a following condition because default value is 0.
if (cfg.iekey > 1)
So remove unnecessary if-statement and convert this field to a
no_argument type option.
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Minwoo Im [Tue, 30 Jan 2018 10:10:27 +0000 (19:10 +0900)]
nvme-cli: make return negative value in nvme_get_nsid() when not blkdev
If caller invokes get_nsid() with character device without checking
whether a given device is block device or not, ENOTBLK is returned from
nvme_get_nsid() which is a positive value, so that caller may treat this
value as a valid nsid.
Make it return a negative vaelue with -ENOTBLK and add error checking to
callers.
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Minwoo Im [Fri, 26 Jan 2018 15:35:44 +0000 (00:35 +0900)]
nvme-cli: add print for command name to effects-log
Commands Supported and Effects log page describes commands supported and
effects of commands. It would be better if command names are printed out
with their opcodes.
So, Add the command names following NVMe 1.3a specification to
effects-log command to both normal mode and json mode.
Minwoo Im [Wed, 17 Jan 2018 11:29:41 +0000 (20:29 +0900)]
nvme-cli: fix memory leak in dir_receive()
Fix memory leak for _buf_.
==10014== HEAP SUMMARY:
==10014== in use at exit: 16 bytes in 1 blocks
==10014== total heap usage: 52 allocs, 51 frees, 15,638 bytes
allocated
==10014==
==10014== Searching for pointers to 1 not-freed blocks
==10014== Checked 70,656 bytes
==10014==
==10014== 16 bytes in 1 blocks are definitely lost in loss record 1 of 1
==10014== at 0x4C2FFC6: memalign (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==10014== by 0x4C300D1: posix_memalign (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==10014== by 0x402733: dir_receive (nvme.c:3531)
==10014== by 0x4192A7: handle_plugin (plugin.c:150)
==10014== by 0x401890: main (nvme.c:3825)
==10014==
==10014== LEAK SUMMARY:
==10014== definitely lost: 16 bytes in 1 blocks
==10014== indirectly lost: 0 bytes in 0 blocks
==10014== possibly lost: 0 bytes in 0 blocks
==10014== still reachable: 0 bytes in 0 blocks
==10014== suppressed: 0 bytes in 0 blocks
==10014==
==10014== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Minwoo Im [Wed, 17 Jan 2018 11:26:37 +0000 (20:26 +0900)]
nvme-cli: fix memory leak in sec_recv()
Fix memory leak for _sec_buf_.
==7670== HEAP SUMMARY:
==7670== in use at exit: 4,096 bytes in 1 blocks
==7670== total heap usage: 31 allocs, 30 frees, 8,046 bytes allocated
==7670==
==7670== Searching for pointers to 1 not-freed blocks
==7670== Checked 70,656 bytes
==7670==
==7670== 4,096 bytes in 1 blocks are definitely lost in loss record 1 of
1
==7670== at 0x4C2FFC6: memalign (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==7670== by 0x4C300D1: posix_memalign (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==7670== by 0x4056F3: sec_recv (nvme.c:3391)
==7670== by 0x419587: handle_plugin (plugin.c:150)
==7670== by 0x401890: main (nvme.c:3799)
==7670==
==7670== LEAK SUMMARY:
==7670== definitely lost: 4,096 bytes in 1 blocks
==7670== indirectly lost: 0 bytes in 0 blocks
==7670== possibly lost: 0 bytes in 0 blocks
==7670== still reachable: 0 bytes in 0 blocks
==7670== suppressed: 0 bytes in 0 blocks
==7670==
==7670== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Minwoo Im [Wed, 17 Jan 2018 11:25:14 +0000 (20:25 +0900)]
nvme-cli: fix memory leak in dir_send()
Fix memory leak for _buf_.
==9566== HEAP SUMMARY:
==9566== in use at exit: 1,024 bytes in 1 blocks
==9566== total heap usage: 52 allocs, 51 frees, 16,681 bytes allocated
==9566==
==9566== Searching for pointers to 1 not-freed blocks
==9566== Checked 70,656 bytes
==9566==
==9566== 1,024 bytes in 1 blocks are definitely lost in loss record 1 of
1
==9566== at 0x4C2FFC6: memalign (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9566== by 0x4C300D1: posix_memalign (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9566== by 0x402174: dir_send (nvme.c:2535)
==9566== by 0x419317: handle_plugin (plugin.c:150)
==9566== by 0x401890: main (nvme.c:3818)
==9566==
==9566== LEAK SUMMARY:
==9566== definitely lost: 1,024 bytes in 1 blocks
==9566== indirectly lost: 0 bytes in 0 blocks
==9566== possibly lost: 0 bytes in 0 blocks
==9566== still reachable: 0 bytes in 0 blocks
==9566== suppressed: 0 bytes in 0 blocks
==9566==
==9566== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Minwoo Im [Wed, 17 Jan 2018 11:18:29 +0000 (20:18 +0900)]
nvme-cli: fix memory leak in sec_send()
Fix memory leak for _sec_buf_.
==9303== HEAP SUMMARY:
==9303== in use at exit: 0 bytes in 1 blocks
==9303== total heap usage: 31 allocs, 30 frees, 3,915 bytes allocated
==9303==
==9303== Searching for pointers to 1 not-freed blocks
==9303== Checked 70,664 bytes
==9303==
==9303== 0 bytes in 1 blocks are definitely lost in loss record 1 of 1
==9303== at 0x4C2FFC6: memalign (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9303== by 0x4C300D1: posix_memalign (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9303== by 0x405A4C: sec_send (nvme.c:2415)
==9303== by 0x419527: handle_plugin (plugin.c:150)
==9303== by 0x401890: main (nvme.c:3812)
==9303==
==9303== LEAK SUMMARY:
==9303== definitely lost: 0 bytes in 1 blocks
==9303== indirectly lost: 0 bytes in 0 blocks
==9303== possibly lost: 0 bytes in 0 blocks
==9303== still reachable: 0 bytes in 0 blocks
==9303== suppressed: 0 bytes in 0 blocks
==9303==
==9303== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Minwoo Im [Wed, 17 Jan 2018 11:15:17 +0000 (20:15 +0900)]
nvme-cli: fix memory leak in set_feature()
Fix memory leak for _buf_.
==9183== HEAP SUMMARY:
==9183== in use at exit: 1,024 bytes in 1 blocks
==9183== total heap usage: 52 allocs, 51 frees, 16,576 bytes allocated
==9183==
==9183== Searching for pointers to 1 not-freed blocks
==9183== Checked 70,688 bytes
==9183==
==9183== 1,024 bytes in 1 blocks are definitely lost in loss record 1 of 1
==9183== at 0x4C2FFC6: memalign (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9183== by 0x4C300D1: posix_memalign (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9183== by 0x407721: set_feature (nvme.c:2305)
==9183== by 0x419407: handle_plugin (plugin.c:150)
==9183== by 0x401890: main (nvme.c:3813)
==9183==
==9183== LEAK SUMMARY:
==9183== definitely lost: 1,024 bytes in 1 blocks
==9183== indirectly lost: 0 bytes in 0 blocks
==9183== possibly lost: 0 bytes in 0 blocks
==9183== still reachable: 0 bytes in 0 blocks
==9183== suppressed: 0 bytes in 0 blocks
==9183==
==9183== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Minwoo Im [Wed, 17 Jan 2018 11:08:24 +0000 (20:08 +0900)]
nvme-cli: fix memory leak in fw_download()
Fix memory leak for _fw_buf_ without any free.
==8786== HEAP SUMMARY:
==8786== in use at exit: 0 bytes in 1 blocks
==8786== total heap usage: 31 allocs, 30 frees, 3,810 bytes allocated
==8786==
==8786== Searching for pointers to 1 not-freed blocks
==8786== Checked 70,664 bytes
==8786==
==8786== 0 bytes in 1 blocks are definitely lost in loss record 1 of 1
==8786== at 0x4C2FFC6: memalign (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8786== by 0x4C300D1: posix_memalign (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8786== by 0x406963: fw_download (nvme.c:1767)
==8786== by 0x419407: handle_plugin (plugin.c:150)
==8786== by 0x401890: main (nvme.c:3810)
==8786==
==8786== LEAK SUMMARY:
==8786== definitely lost: 0 bytes in 1 blocks
==8786== indirectly lost: 0 bytes in 0 blocks
==8786== possibly lost: 0 bytes in 0 blocks
==8786== still reachable: 0 bytes in 0 blocks
==8786== suppressed: 0 bytes in 0 blocks
==8786==
==8786== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Minwoo Im [Wed, 17 Jan 2018 11:01:57 +0000 (20:01 +0900)]
nvme-cli: fix memory leak in ns_descs()
Memory has been allocated before parsing command options by
parse_and_open() and validate_output_format().
Make it after the setup of options.
_nsdescs_ changes to (void *) for usability.
_nsdescs_ has been allocated without any free.
Add free statement for _nsdescs_. Please refer below memory leak.
==8533== HEAP SUMMARY:
==8533== in use at exit: 4,096 bytes in 1 blocks
==8533== total heap usage: 31 allocs, 30 frees, 7,906 bytes allocated
==8533==
==8533== Searching for pointers to 1 not-freed blocks
==8533== Checked 70,624 bytes
==8533==
==8533== 4,096 bytes in 1 blocks are definitely lost in loss record 1 of 1
==8533== at 0x4C2FFC6: memalign (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8533== by 0x4C300D1: posix_memalign (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8533== by 0x409D2D: ns_descs (nvme.c:1466)
==8533== by 0x419567: handle_plugin (plugin.c:150)
==8533== by 0x401890: main (nvme.c:3803)
==8533==
==8533== LEAK SUMMARY:
==8533== definitely lost: 4,096 bytes in 1 blocks
==8533== indirectly lost: 0 bytes in 0 blocks
==8533== possibly lost: 0 bytes in 0 blocks
==8533== still reachable: 0 bytes in 0 blocks
==8533== suppressed: 0 bytes in 0 blocks
==8533==
==8533== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Minwoo Im [Wed, 17 Jan 2018 10:46:12 +0000 (19:46 +0900)]
nvme-cli: fix memory leak in list_ctrl()
Fix memory leak of _cntlist_ cause a memory leak below.
==7724== HEAP SUMMARY:
==7724== in use at exit: 4,096 bytes in 1 blocks
==7724== total heap usage: 31 allocs, 30 frees, 7,871 bytes allocated
==7724==
==7724== Searching for pointers to 1 not-freed blocks
==7724== Checked 70,624 bytes
==7724==
==7724== 4,096 bytes in 1 blocks are definitely lost in loss record 1 of 1
==7724== at 0x4C2FFC6: memalign (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==7724== by 0x4C300D1: posix_memalign (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==7724== by 0x408354: list_ctrl (nvme.c:573)
==7724== by 0x419587: handle_plugin (plugin.c:150)
==7724== by 0x401890: main (nvme.c:3799)
==7724==
==7724== LEAK SUMMARY:
==7724== definitely lost: 4,096 bytes in 1 blocks
==7724== indirectly lost: 0 bytes in 0 blocks
==7724== possibly lost: 0 bytes in 0 blocks
==7724== still reachable: 0 bytes in 0 blocks
==7724== suppressed: 0 bytes in 0 blocks
==7724== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Javier González [Mon, 30 Oct 2017 13:01:07 +0000 (14:01 +0100)]
lightnvm: enable to set OP on target creation
On target creation, allow to define the over-provision (OP). Since OP
area has a direct impact on write amplification, users can optimize the
OCSSD behavior for their workloads.
Support in the kernel has been upstreamed in 4.16
Signed-off-by: Javier González <javier@cnexlabs.com>
Update smart-log-add command documentation in intel plugin with
output-format parameter description.
In github issue #175, tim-oleksii reported that descriptions of
output-format whose implementation was added in Pull request #178 was
not added in documentation.
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Minwoo Im [Wed, 10 Jan 2018 15:13:33 +0000 (00:13 +0900)]
nvme-cli: lnvm: remove unnecessary force parameter of ns-id in lnvm
If identify geometry is failed, then nvme-cli is not to print out
information of namespace.
Also no one uses this _force_ flag in this subcommand.
So, remove this unnecessary parameter.
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Minwoo Im [Fri, 15 Dec 2017 16:12:06 +0000 (01:12 +0900)]
nvme-cli: add BPS bit field to CAP controller register
NVMe 1.3 spec introduced BPS(Boot Partition Support) bit field in CAP of
controller register.
Add this bit field to "struct nvme_bar_cap" by changing
"css_nssrs_dstrd" field to "bps_css_nssrs_dstrd".
Also add a print for BPS bit field to print CAP properly when show-regs
command with human-readable.
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>