README 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. AF_VSOCK test suite
  2. -------------------
  3. These tests exercise net/vmw_vsock/ host<->guest sockets for VMware, KVM, and
  4. Hyper-V.
  5. The following tests are available:
  6. * vsock_test - core AF_VSOCK socket functionality
  7. * vsock_diag_test - vsock_diag.ko module for listing open sockets
  8. The following prerequisite steps are not automated and must be performed prior
  9. to running tests:
  10. 1. Build the kernel, make headers_install, and build these tests.
  11. 2. Install the kernel and tests on the host.
  12. 3. Install the kernel and tests inside the guest.
  13. 4. Boot the guest and ensure that the AF_VSOCK transport is enabled.
  14. Invoke test binaries in both directions as follows:
  15. # host=server, guest=client
  16. (host)# $TEST_BINARY --mode=server \
  17. --control-port=1234 \
  18. --peer-cid=3
  19. (guest)# $TEST_BINARY --mode=client \
  20. --control-host=$HOST_IP \
  21. --control-port=1234 \
  22. --peer-cid=2
  23. # host=client, guest=server
  24. (guest)# $TEST_BINARY --mode=server \
  25. --control-port=1234 \
  26. --peer-cid=2
  27. (host)# $TEST_BINARY --mode=client \
  28. --control-port=$GUEST_IP \
  29. --control-port=1234 \
  30. --peer-cid=3
  31. Some tests are designed to produce kernel memory leaks. Leaks detection,
  32. however, is deferred to Kernel Memory Leak Detector. It is recommended to enable
  33. kmemleak (CONFIG_DEBUG_KMEMLEAK=y) and explicitly trigger a scan after each test
  34. suite run, e.g.
  35. # echo clear > /sys/kernel/debug/kmemleak
  36. # $TEST_BINARY ...
  37. # echo "wait for any grace periods" && sleep 2
  38. # echo scan > /sys/kernel/debug/kmemleak
  39. # echo "wait for kmemleak" && sleep 5
  40. # echo scan > /sys/kernel/debug/kmemleak
  41. # cat /sys/kernel/debug/kmemleak
  42. For more information see Documentation/dev-tools/kmemleak.rst.
  43. vsock_perf utility
  44. -------------------
  45. 'vsock_perf' is a simple tool to measure vsock performance. It works in
  46. sender/receiver modes: sender connect to peer at the specified port and
  47. starts data transmission to the receiver. After data processing is done,
  48. it prints several metrics(see below).
  49. Usage:
  50. # run as sender
  51. # connect to CID 2, port 1234, send 1G of data, tx buf size is 1M
  52. ./vsock_perf --sender 2 --port 1234 --bytes 1G --buf-size 1M
  53. Output:
  54. tx performance: A Gbits/s
  55. Output explanation:
  56. A is calculated as "number of bits to send" / "time in tx loop"
  57. # run as receiver
  58. # listen port 1234, rx buf size is 1M, socket buf size is 1G, SO_RCVLOWAT is 64K
  59. ./vsock_perf --port 1234 --buf-size 1M --vsk-size 1G --rcvlowat 64K
  60. Output:
  61. rx performance: A Gbits/s
  62. total in 'read()': B sec
  63. POLLIN wakeups: C
  64. average in 'read()': D ns
  65. Output explanation:
  66. A is calculated as "number of received bits" / "time in rx loop".
  67. B is time, spent in 'read()' system call(excluding 'poll()')
  68. C is number of 'poll()' wake ups with POLLIN bit set.
  69. D is B / C, e.g. average amount of time, spent in single 'read()'.