Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751250AbdIJGJ7 (ORCPT ); Sun, 10 Sep 2017 02:09:59 -0400 Received: from a2nlsmtp01-05.prod.iad2.secureserver.net ([198.71.225.49]:44388 "EHLO a2nlsmtp01-05.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751082AbdIJGJz (ORCPT ); Sun, 10 Sep 2017 02:09:55 -0400 x-originating-ip: 107.180.71.197 From: kys@exchange.microsoft.com To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com, vkuznets@redhat.com, jasowang@redhat.com, leann.ogasawara@canonical.com, marcelo.cerri@canonical.com, sthemmin@microsoft.com Cc: Stephen Hemminger , "K . Y . Srinivasan" Subject: [PATCH 5/5] Drivers: hv: vmbus: Expose per-channel event counters Date: Sat, 9 Sep 2017 23:08:49 -0700 Message-Id: <20170910060849.31898-5-kys@exchange.microsoft.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170910060849.31898-1-kys@exchange.microsoft.com> References: <20170910055318.31655-1-kys@exchange.microsoft.com> <20170910060849.31898-1-kys@exchange.microsoft.com> Reply-To: kys@microsoft.com X-CMAE-Envelope: MS4wfIhQlSqd2EBQ+sdebqDnhB5tjQKh0ivzC2HNAtSa1lTdubPzSDGOYbseEwEZ9s/IqzYezj5taOQJB7tAl1iu0D60I9kU/o7Jg5LUntDdVBB1yEP/hKG2 iqacpJLuHheL7FR2ot4xZgs3qVrxRCEtqFmrBVjIWr2/MOgy8MR5uQj8hE8BMjliTv+F95QDxULINbl4JqAjgC3G3UYQ7ffARiyAPMbMCQvi0RSIuscgVE9Y l0aVexlFxAtzjV43BrW6J8Tqxnv90RCJH5+WtUs9E5utwPyVr9d4EheRKjgnFjlZ8HGGLWJsumk6+RB1S7Kj3BhaYAYaracvTKidaRg1uG/LrFFOoKY19x91 TNSVGl9Or5qQoFVJaHCPMtQCt9DimVPMtEIiqZdWM3PqUOLCYzgeuoFBieCFI03WQ695YfwEYqbROfn5GxOM66RCf7XeNLL0AzSZG1BpRpCf1kVdI1iyW7qj 66GPBfCLHRKh3xhdeNoCIdFXb0cB2f+FkVDgYSJW2veELctTK4Y81eNa0lFxj+hrkCVw+4ZVjsatWTZ/UiWXlUQQ0BZx72H03z3aZw== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3786 Lines: 110 From: Stephen Hemminger When investigating performance, it is useful to be able to look at the number of host and guest events per-channel. This is equivalent to per-device interrupt statistics. Signed-off-by: Stephen Hemminger Signed-off-by: K. Y. Srinivasan --- Documentation/ABI/stable/sysfs-bus-vmbus | 14 ++++++++++++++ drivers/hv/connection.c | 2 ++ drivers/hv/vmbus_drv.c | 18 ++++++++++++++++++ include/linux/hyperv.h | 4 ++++ 4 files changed, 38 insertions(+) diff --git a/Documentation/ABI/stable/sysfs-bus-vmbus b/Documentation/ABI/stable/sysfs-bus-vmbus index 0ebd8a1537a0..d4eca1717adb 100644 --- a/Documentation/ABI/stable/sysfs-bus-vmbus +++ b/Documentation/ABI/stable/sysfs-bus-vmbus @@ -97,3 +97,17 @@ KernelVersion: 4.14 Contact: Stephen Hemminger Description: Bytes availabble to write Users: Debuggig tools + +What: /sys/bus/vmbus/devices/vmbus_*/channels/relid/events +Date: September. 2017 +KernelVersion: 4.14 +Contact: Stephen Hemminger +Description: Number of times we have signaled the host +Users: Debuggig tools + +What: /sys/bus/vmbus/devices/vmbus_*/channels/relid/interrupts +Date: September. 2017 +KernelVersion: 4.14 +Contact: Stephen Hemminger +Description: Number of times we have taken an interrupt (incoming) +Users: Debuggig tools diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c index 59c11ff90d12..2bb0d03c5212 100644 --- a/drivers/hv/connection.c +++ b/drivers/hv/connection.c @@ -406,6 +406,8 @@ void vmbus_set_event(struct vmbus_channel *channel) if (!channel->is_dedicated_interrupt) vmbus_send_interrupt(child_relid); + ++channel->sig_events; + hv_do_hypercall(HVCALL_SIGNAL_EVENT, channel->sig_event, NULL); } EXPORT_SYMBOL_GPL(vmbus_set_event); diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index a2986aac730d..2a329a2f286b 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -945,6 +945,8 @@ static void vmbus_chan_sched(struct hv_per_cpu_context *hv_cpu) if (channel->rescind) continue; + ++channel->interrupts; + switch (channel->callback_mode) { case HV_CALL_ISR: vmbus_channel_isr(channel); @@ -1238,6 +1240,20 @@ static ssize_t channel_latency_show(const struct vmbus_channel *channel, } VMBUS_CHAN_ATTR(latency, S_IRUGO, channel_latency_show, NULL); +static ssize_t channel_interrupts_show(const struct vmbus_channel *channel, char *buf) +{ + return sprintf(buf, "%u\n", channel->interrupts); +} +VMBUS_CHAN_ATTR(interrupts, S_IRUGO, channel_interrupts_show, NULL); + +static ssize_t channel_events_show(const struct vmbus_channel *channel, char *buf) +{ + return sprintf(buf, "%u\n", channel->sig_events); +} +VMBUS_CHAN_ATTR(events, S_IRUGO, channel_events_show, NULL); + + + static struct attribute *vmbus_chan_attrs[] = { &chan_attr_out_mask.attr, &chan_attr_in_mask.attr, @@ -1246,6 +1262,8 @@ static struct attribute *vmbus_chan_attrs[] = { &chan_attr_cpu.attr, &chan_attr_pending.attr, &chan_attr_latency.attr, + &chan_attr_interrupts.attr, + &chan_attr_events.attr, NULL }; diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index 91c88e0e771e..d7c85a475c46 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -731,6 +731,10 @@ struct vmbus_channel { struct vmbus_close_msg close_msg; + /* Statistics */ + unsigned int interrupts; /* Host to Guest interrupts */ + unsigned int sig_events; /* Guest to Host events */ + /* Channel callback's invoked in softirq context */ struct tasklet_struct callback_event; void (*onchannel_callback)(void *context); -- 2.14.1