-
Notifications
You must be signed in to change notification settings - Fork 662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nvme: Add support for dsm command latency option #2149
Conversation
Now I am thinking to add the latency command option for all other nvme commands also. |
I am not so keen on adding performance and debugging code everywhere. Makes the code base bigger/... for small gain. Someone pointed out to me that we could try to make use of user trace libraries such as lttng-ust which then lives outside of the main code base. Haven't really spend time playing with this yet. But I think this would better for these cases someone really wants to trace things. |
The purpose is not for debugging but for adding performance statistics since currently the latency option is only added for (Add)
|
4186b1e
to
8dd1e71
Compare
The purpose to add is for adding performance statistics. Currently the latency option is only added for passthru() and submit_io(). So add for the dsm command also. Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
Also change passthru short option -T to -t as same with submit_io and dsm. Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
Since duplicated some other short options -t. Note: Changed get-log command lpo short option -L to -O also. Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
e0b7cba
to
e358f95
Compare
For the build check needed libnvme update to add |
Previously the latency is output by libnvme debug feature. So combine the nvme-cli and libnvme latency outputs. For the latency output added API in libnvme to split from debug. Note: Needed the libnvme update to add the API to output latency. Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
e358f95
to
5afbb7a
Compare
The latency flag set by parse_and_open() but not used by the commands. Since argconfig_parse() used instead so set the flag by the commands. Note: This fix sets the debugging flag also for the commands. Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
Since the nvme commands using NVME_ARGS() macro added the latency option. Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
Note: Commands using NVME_ARGS are added the option as default. Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
810197e
to
dfd6104
Compare
The functions are added in libnvme so merge the duplicated functions. Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
This includes some minor changes related. Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
As I pointed out, please try to figure out first if we can't do this without adding printf code on every single function. We have really great tools for gathering performance stats, no need for NIH. There are tracing frameworks and great tools like bpftrace for exactly this functionality. |
Thank you so much for your advice! Just confirmed the tool bpftrace works as expected as below.
root@tokunori-desktop:/home/tokunori/nvme-cli-2# .build/nvme dsm /dev/nvme0n1 -b 0x100000,0x100000,0x100000,0x100000 -s 0x0,0x100000,0x200000,0x300000 -L -d
ioctl: 4e40 (ID) latency: 3 us
IO Command opcode: 09 (Dataset Management) latency: 3480 us
NVMe DSM: success
root@tokunori-desktop:/home/tokunori# bpftrace -e 'kprobe:nvme_submit_user_cmd { @start = nsecs; } tracepoint:nvme:nvme_complete_rq /@start != 0/ { printf("latency: %u usec\n", (nsecs - @start) / 1e3); @start = 0; }'
Attaching 2 probes...
latency: 3456 usec
^C
@start: 0 Do you mean we can add the bpftrace tools bt script file for the latency checking instead of the option? By the way seems the tool depended on the kernel version environment but okay for using to check the nvme-cli latency? Also currently the latecny option is used by the commonds calling submit_io() and passthru() but okay to remain them? (Add) Note 2: The above bpftrace program possibly does not work corretly if other command tracepoint:nvme:nvme_complete_rq traced after the nvme-cli command kprobe:nvme_submit_user_cmd probed as incorrectly output the latency as short time. |
Yes, that is what I had in mind.
I know bpftrace has a bit of dependencies. But for who is this feature anyway? What is the use case? I don't think you need this feature for embedded device.
I assume this is primarily interesting for the device developers. I am pretty sure they have way better tools to measure their device latencies and measuring the ioctl includes the whole kernel stack with all the noise it introduces. Also, measuring admin commands is not so interesting. The read/writes commands are interesting ones and nvme-cli is the wrong tool for this. |
With #2234 merged, you can get this info with increasing the verbosity level. |
No description provided.