Drivers: hv: vmbus: Implement multi-channel support
v2 cover Drivers: hv: vmbus: Implement multi-channel support
This patch-set implements multi-channel support for Hyper-V devices.
Earlier, these two patches were sent out as part of a larger patch-set that included relevant changes in the storage driver.
In this version of the patch, I have fixed a race condition in the code that opens the sub-channels.
K. Y. Srinivasan (2):
Drivers: hv: vmbus: Implement multi-channel support
Drivers: hv: Add the GUID fot synthetic fibre channel device
drivers/hv/channel.c | 50 +++++++++++++++++-- drivers/hv/channel_mgmt.c | 119 +++++++++++++++++++++++++++++++++++++++++++-- drivers/hv/connection.c | 14 +++++ include/linux/hyperv.h | 70 ++++++++++++++++++++++++++ 4 files changed, 245 insertions(+), 8 deletions(-)
Signature · 1 line
1.7.4.1
PATCH v2 1/2 Drivers: hv: vmbus: Implement multi-channel support
Starting with Win8, the host supports multiple sub-channels for a given device. As in the past, the initial channel offer specifies the device and is associated with both the type and the instance GUIDs. For performance critical devices, the host may support multiple sub-channels. The sub-channels share the same type and instance GUID as the primary channel. The number of sub-channels offerrred to the guest depends on the number of virtual CPUs assigned to the guest. The guest can request the creation of these sub-channels and once created and opened, the guest can distribute the traffic across all the channels (the primary and the sub-channels). A request sent on a sub-channel will have the response delivered on the same sub-channel.
At channel (sub-channel) creation we bind the channel interrupt to a CPU and with this sub-channel support we will be able to spread the interrupt load of a given device across all available CPUs.
--- drivers/hv/channel.c | 50 +++++++++++++++++-- drivers/hv/channel_mgmt.c | 119 +++++++++++++++++++++++++++++++++++++++++++-- drivers/hv/connection.c | 14 +++++ include/linux/hyperv.h | 62 +++++++++++++++++++++++- 4 files changed, 236 insertions(+), 9 deletions(-)
drivers/hv/channel.c +46 -4
@@ -116,6 +116,15 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,unsigned long flags;int ret, t, err =0 ; +spin_lock_irqsave (&newchannel->sc_lock, flags); +if (newchannel->state ==CHANNEL_OPEN_STATE ) { + newchannel->state =CHANNEL_OPENING_STATE ; + }else { +spin_unlock_irqrestore (&newchannel->sc_lock, flags); +return -EINVAL ; + } +spin_unlock_irqrestore (&newchannel->sc_lock, flags); + newchannel->onchannel_callback = onchannelcallback; newchannel->channel_callback_context = context;
@@ -216,6 +225,9 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,list_del (&open_info->msglistentry);spin_unlock_irqrestore (&vmbus_connection.channelmsg_lock, flags); +if (err ==0 ) + newchannel->state =CHANNEL_OPENED_STATE ; +kfree (open_info);return err;
@@ -500,15 +512,14 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle) }EXPORT_SYMBOL_GPL (vmbus_teardown_gpadl); -/* -* vmbus_close - Close the specified channel -*/ -void vmbus_close (struct vmbus_channel *channel) +static void vmbus_close_internal (struct vmbus_channel *channel) {struct vmbus_channel_close_channel *msg;int ret;unsigned long flags; + channel->state =CHANNEL_OPEN_STATE ; + channel->sc_creation_callback =NULL ;/* Stop callback and cancel the timer asap */ spin_lock_irqsave (&channel->inbound_lock, flags); channel->onchannel_callback =NULL ;
@@ -538,6 +549,37 @@ void vmbus_close(struct vmbus_channel *channel) } + +/* +* vmbus_close - Close the specified channel +*/ +void vmbus_close (struct vmbus_channel *channel) +{ +struct list_head *cur, *tmp; +struct vmbus_channel *cur_channel; + +if (channel->primary_channel !=NULL ) { +/* +* We will only close sub-channels when +* the primary is closed. +*/ +return ; + } +/* +* Close all the sub-channels first and then close the +* primary channel. +*/ +list_for_each_safe (cur, tmp, &channel->sc_list) { + cur_channel = list_entry(cur, struct vmbus_channel, sc_list); +if (cur_channel->state !=CHANNEL_OPENED_STATE ) +continue ; +vmbus_close_internal (cur_channel); + } +/* +* Now close the primary. +*/ +vmbus_close_internal (channel); +}EXPORT_SYMBOL_GPL (vmbus_close);/**
drivers/hv/channel_mgmt.c +115 -4
146 lines not on this page · raw message
drivers/hv/connection.c +14 -0
@@ -246,12 +246,26 @@ struct vmbus_channel *relid2channel(u32 relid)struct vmbus_channel *channel;struct vmbus_channel *found_channel =NULL ;unsigned long flags; +struct list_head *cur, *tmp; +struct vmbus_channel *cur_sc;spin_lock_irqsave (&vmbus_connection.channel_lock, flags);list_for_each_entry (channel, &vmbus_connection.chn_list, listentry) {if (channel->offermsg.child_relid == relid) { found_channel = channel;break ; + }else if (!list_empty (&channel->sc_list)) { +/* +* Deal with sub-channels. +*/ +list_for_each_safe (cur, tmp, &channel->sc_list) { + cur_sc = list_entry(cur, struct vmbus_channel, + sc_list); +if (cur_sc->offermsg.child_relid == relid) { + found_channel = cur_sc; +break ; + } + } } }spin_unlock_irqrestore (&vmbus_connection.channel_lock, flags);
include/linux/hyperv.h +61 -1
86 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH v2 2/2 Drivers: hv: Add the GUID fot synthetic fibre channel device
In preparation for supporting synthetic Fiber Channel device, add the GUID for this service.
--- include/linux/hyperv.h | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)
include/linux/hyperv.h +10 -0
@@ -1389,6 +1389,16 @@ void vmbus_driver_unregister(struct hv_driver *hv_driver); }/* +* Synthetic FC GUID +* {2f9bcc4a-0069-4af3-b76b-6fd0be528cda} +*/ +#define HV_SYNTHFC_GUID \ + .guid = { \ + 0x4A, 0xCC, 0x9B, 0x2F, 0x69, 0x00, 0xF3, 0x4A, \ + 0xB7, 0x6B, 0x6F, 0xD0, 0xBE, 0x52, 0x8C, 0xDA \ + } + +/* * Common header for Hyper-V ICs */
Signature · 1 line
1.7.4.1
Quoted 23 lines
-----Original Message-----
From: K. Y. Srinivasan [mailto:[email protected]]
Sent: Thursday, May 23, 2013 3:02 PM
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: KY Srinivasan
Subject: [PATCH V2 0/2] Drivers: hv: vmbus: Implement multi-channel supportThis patch-set implements multi-channel support for Hyper-V devices.
Earlier, these two patches were sent out as part of a larger patch-set that included relevant changes in the storage driver.
In this version of the patch, I have fixed a race condition in the code that opens the sub-channels.
K. Y. Srinivasan (2):
Drivers: hv: vmbus: Implement multi-channel support
Drivers: hv: Add the GUID fot synthetic fibre channel device
Quoted 6 lines
drivers/hv/channel.c | 50 +++++++++++++++++-- drivers/hv/channel_mgmt.c | 119 +++++++++++++++++++++++++++++++++++++++++++-- drivers/hv/connection.c | 14 +++++ include/linux/hyperv.h | 70 ++++++++++++++++++++++++++ 4 files changed, 245 insertions(+), 8 deletions(-)
Greg,
You had acked the previous version of these patches that I had sent along with the storage driver patches that used this infrastructure. We are going to be submitting network driver patches that will use this infrastructure to implement VRSS (virtual receive side scaling) and that is the reason I chose to not tie up these vmbus patches with the storvsc patches. Please let me know if you are ok with the changes I have made in this version. Once these patches are committed, we will submit both storage and networking patches that use this infrastructure.
Regards,
K. Y
Quoted 5 lines
--
1.7.4.1