Drivers: hv: vmbus: Add additional per-channel sysfs info
cover Drivers: hv: vmbus: Add additional per-channel sysfs info
From: "K. Y. Srinivasan" <[email protected]>
Add additional per-channel sysfs information to help debug performance issues.
Greg, please apply this patch-set to 4.15-rc1.
Stephen Hemminger (2):
vmbus: add per-channel sysfs info
Drivers: hv: vmbus: Expose per-channel interrupts and events counters
Documentation/ABI/stable/sysfs-bus-vmbus | 70 +++++++++++ drivers/hv/channel_mgmt.c | 10 +- drivers/hv/connection.c | 2 + drivers/hv/hyperv_vmbus.h | 2 + drivers/hv/vmbus_drv.c | 203 +++++++++++++++++++++++++++++-- include/linux/hyperv.h | 10 ++ 6 files changed, 284 insertions(+), 13 deletions(-)
Signature · 1 line
2.14.1
PATCH 1/2 vmbus: add per-channel sysfs info
From: Stephen Hemminger <[email protected]>
This extends existing vmbus related sysfs structure to provide per-channel state information. This is useful when diagnosing issues with multiple queues in networking and storage.
The existing sysfs only displayed information about the primary channel. The one place it reported multiple channels was the channel_vp_mapping file which violated the sysfs convention of one value per file.
--- Documentation/ABI/stable/sysfs-bus-vmbus | 56 ++++++++++ drivers/hv/channel_mgmt.c | 10 +- drivers/hv/hyperv_vmbus.h | 2 + drivers/hv/vmbus_drv.c | 185 +++++++++++++++++++++++++++++-- include/linux/hyperv.h | 6 + 5 files changed, 246 insertions(+), 13 deletions(-)
Documentation/ABI/stable/sysfs-bus-vmbus +56 -0
@@ -41,3 +41,59 @@ KernelVersion: 4.5 Contact: K. Y. Srinivasan <[email protected]> Description: The 16 bit vendor ID of the device Users: tools/hv/lsvmbus and user level RDMA libraries + +What: /sys/bus/vmbus/devices/vmbus_*/channels/relid/cpu +Date: September. 2017 +KernelVersion: 4.14 +Contact: Stephen Hemminger <[email protected]> +Description: VCPU (sub)channel is affinitized to +Users: tools/hv/lsvmbus and other debuggig tools + +What: /sys/bus/vmbus/devices/vmbus_*/channels/relid/cpu +Date: September. 2017 +KernelVersion: 4.14 +Contact: Stephen Hemminger <[email protected]> +Description: VCPU (sub)channel is affinitized to +Users: tools/hv/lsvmbus and other debuggig tools + +What: /sys/bus/vmbus/devices/vmbus_*/channels/relid/in_mask +Date: September. 2017 +KernelVersion: 4.14 +Contact: Stephen Hemminger <[email protected]> +Description: Inbound channel signaling state +Users: Debuggig tools + +What: /sys/bus/vmbus/devices/vmbus_*/channels/relid/latency +Date: September. 2017 +KernelVersion: 4.14 +Contact: Stephen Hemminger <[email protected]> +Description: Channel signaling latency +Users: Debuggig tools + +What: /sys/bus/vmbus/devices/vmbus_*/channels/relid/out_mask +Date: September. 2017 +KernelVersion: 4.14 +Contact: Stephen Hemminger <[email protected]> +Description: Outbound channel signaling state +Users: Debuggig tools + +What: /sys/bus/vmbus/devices/vmbus_*/channels/relid/pending +Date: September. 2017 +KernelVersion: 4.14 +Contact: Stephen Hemminger <[email protected]> +Description: Channel interrupt pending state +Users: Debuggig tools + +What: /sys/bus/vmbus/devices/vmbus_*/channels/relid/read_avail +Date: September. 2017 +KernelVersion: 4.14 +Contact: Stephen Hemminger <[email protected]> +Description: Bytes availabble to read +Users: Debuggig tools + +What: /sys/bus/vmbus/devices/vmbus_*/channels/relid/write_avail +Date: September. 2017 +KernelVersion: 4.14 +Contact: Stephen Hemminger <[email protected]> +Description: Bytes availabble to write +Users: Debuggig tools
drivers/hv/channel_mgmt.c +9 -1
@@ -350,7 +350,7 @@ static void free_channel(struct vmbus_channel *channel) {tasklet_kill (&channel->callback_event); -kfree_rcu (channel, rcu); +kobject_put (&channel->kobj); }static void percpu_channel_enq (void *arg)
@@ -513,6 +513,14 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel) newchannel->state =CHANNEL_OPEN_STATE ;if (!fnew) { +struct hv_device *dev + = newchannel->primary_channel->device_obj; + +if (vmbus_add_channel_kobj (dev, newchannel)) { +atomic_dec (&vmbus_connection.offer_in_progress); + goto err_free_chan; + } +if (channel->sc_creation_callback !=NULL ) channel->sc_creation_callback (newchannel);return ;
drivers/hv/hyperv_vmbus.h +2 -0
@@ -384,6 +384,8 @@ struct hv_device *vmbus_device_create(const uuid_le *type,int vmbus_device_register (struct hv_device *child_device_obj);void vmbus_device_unregister (struct hv_device *device_obj); +int vmbus_add_channel_kobj (struct hv_device *device_obj, +struct vmbus_channel *channel);struct vmbus_channel *relid2channel (u32 relid);
drivers/hv/vmbus_drv.c +173 -12
227 lines not on this page · raw message
include/linux/hyperv.h +6 -0
@@ -841,6 +841,11 @@ struct vmbus_channel {*/ struct rcu_head rcu; +/* +* For sysfs per-channel properties. +*/ +struct kobject kobj; +/* * For performance critical channels (storage, networking * etc,), Hyper-V has a mechanism to enhance the throughput
@@ -1123,6 +1128,7 @@ struct hv_device {struct device device;struct vmbus_channel *channel; +struct kset *channels_kset; };
Signature · 1 line
2.14.1
PATCH 2/2 Drivers: hv: vmbus: Expose per-channel interrupts and events counters
From: Stephen Hemminger <[email protected]>
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.
--- 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(+)
Documentation/ABI/stable/sysfs-bus-vmbus +14 -0
@@ -97,3 +97,17 @@ KernelVersion: 4.14 Contact: Stephen Hemminger <[email protected]> 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 <[email protected]> +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 <[email protected]> +Description: Number of times we have taken an interrupt (incoming) +Users: Debuggig tools
drivers/hv/connection.c +2 -0
@@ -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);
drivers/hv/vmbus_drv.c +18 -0
@@ -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 };
include/linux/hyperv.h +4 -0
@@ -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);
Signature · 1 line
2.14.1
Re: [PATCH 2/2] Drivers: hv: vmbus: Expose per-channel interrupts and events counters
Quoted 6 lines · On Thu, Sep 21, 2017 at 08:58:50PM -0700, [email protected] wrote:
From: Stephen Hemminger <[email protected]>
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.
Quoted 8 lines
Signed-off-by Stephen Hemminger <[email protected]>Signed-off-by K. Y. Srinivasan <[email protected]>--- 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(+)
This patch didn't apply to my tree, can you rebase and resend it?
thanks,
greg k-h
RE: [PATCH 2/2] Drivers: hv: vmbus: Expose per-channel interrupts and events counters
Quoted 31 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Wednesday, October 4, 2017 1:49 AM
To: KY Srinivasan <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Stephen Hemminger <[email protected]>
Subject: Re: [PATCH 2/2] Drivers: hv: vmbus: Expose per-channel interrupts and events countersQuoted 6 lines · On Thu, Sep 21, 2017 at 08:58:50PM -0700, [email protected] wrote:
From: Stephen Hemminger <[email protected]>
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.
Quoted 8 lines
Signed-off-by Stephen Hemminger <[email protected]>Signed-off-by K. Y. Srinivasan <[email protected]>--- 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(+)
Quoted 1 line
This patch didn't apply to my tree, can you rebase and resend it?
Will do.
K. Y
Quoted 4 lines
thanks,
greg k-h