Drivers: hv: vmbus: Expose counters for interrupts and full conditions
authorKimberly Brown <kimbrownkd@gmail.com>
Mon, 4 Feb 2019 07:13:09 +0000 (02:13 -0500)
committerSasha Levin <sashal@kernel.org>
Fri, 15 Feb 2019 01:56:10 +0000 (20:56 -0500)
commit396ae57ef1ef978d1d21cdb7586ba184a3f22453
tree28bdc8b7e25260feed3822e3bbc4f2fd1711cc7d
parent593db80390cf40f1b9dcc790020d2edae87183fb
Drivers: hv: vmbus: Expose counters for interrupts and full conditions

Counter values for per-channel interrupts and ring buffer full
conditions are useful for investigating performance.

Expose counters in sysfs for 2 types of guest to host interrupts:
1) Interrupts caused by the channel's outbound ring buffer transitioning
from empty to not empty
2) Interrupts caused by the channel's inbound ring buffer transitioning
from full to not full while a packet is waiting for enough buffer space to
become available

Expose 2 counters in sysfs for the number of times that write operations
encountered a full outbound ring buffer:
1) The total number of write operations that encountered a full
condition
2) The number of write operations that were the first to encounter a
full condition

Increment the outbound full condition counters in the
hv_ringbuffer_write() function because, for most drivers, a full
outbound ring buffer is detected in that function. Also increment the
outbound full condition counters in the set_channel_pending_send_size()
function. In the hv_sock driver, a full outbound ring buffer is detected
and set_channel_pending_send_size() is called before
hv_ringbuffer_write() is called.

I tested this patch by confirming that the sysfs files were created and
observing the counter values. The values seemed to increase by a
reasonable amount when the Hyper-v related drivers were in use.

Signed-off-by: Kimberly Brown <kimbrownkd@gmail.com>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Documentation/ABI/stable/sysfs-bus-vmbus
drivers/hv/ring_buffer.c
drivers/hv/vmbus_drv.c
include/linux/hyperv.h