Public bug reported: The following fix has been submitted upstream, but has high enough severity that we would like early inclusion into the Ubuntu kernel. Please consider for wily, vivid, and trusty (and the HWE kernels for the same).
Patch follows: Currently we have two policies for deciding when to signal the host: One based on the ring buffer state and the other based on what the VMBUS client driver wants to do. Consider the case when the client wants to explicitly control when to signal the host. In this case, if the client were to defer signaling, we will not be able to signal the host subsequently when the client does want to signal since the ring buffer state will prevent the signaling. Implement logic to have only one signaling policy in force for a given channel. Signed-off-by: K. Y. Srinivasan <k...@microsoft.com> Reviewed-by: Haiyang Zhang <haiya...@microsoft.com> Tested-by: Haiyang Zhang <haiya...@microsoft.com> Cc: <sta...@vger.kernel.org> # v4.2+ --- drivers/hv/channel.c | 18 ++++++++++++++++++ include/linux/hyperv.h | 12 ++++++++++++ 2 files changed, 30 insertions(+), 0 deletions(-) diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c index 77d2579..c6278c7 100644 --- a/drivers/hv/channel.c +++ b/drivers/hv/channel.c @@ -653,10 +653,19 @@ int vmbus_sendpacket_ctl(struct vmbus_channel *channel, void *buffer, * on the ring. We will not signal if more data is * to be placed. * + * Based on the channel signal state, we will decide + * which signaling policy will be applied. + * * If we cannot write to the ring-buffer; signal the host * even if we may not have written anything. This is a rare * enough condition that it should not matter. */ + + if (channel->signal_state) + signal = true; + else + kick_q = true; + if (((ret == 0) && kick_q && signal) || (ret)) vmbus_setevent(channel); @@ -756,10 +765,19 @@ int vmbus_sendpacket_pagebuffer_ctl(struct vmbus_channel *channel, * on the ring. We will not signal if more data is * to be placed. * + * Based on the channel signal state, we will decide + * which signaling policy will be applied. + * * If we cannot write to the ring-buffer; signal the host * even if we may not have written anything. This is a rare * enough condition that it should not matter. */ + + if (channel->signal_state) + signal = true; + else + kick_q = true; + if (((ret == 0) && kick_q && signal) || (ret)) vmbus_setevent(channel); diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index 437c9c8..7b1af52 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -756,8 +756,20 @@ struct vmbus_channel { * link up channels based on their CPU affinity. */ struct list_head percpu_list; + /* + * Host signaling policy: The default policy will be + * based on the ring buffer state. We will also support + * a policy where the client driver can have explicit + * signaling control. + */ + bool signal_state; }; +static inline void set_channel_signal_state(struct vmbus_channel *c, +bool state) { + c->signal_state = state; +} + static inline void set_channel_read_state(struct vmbus_channel *c, bool state) { c->batched_reading = state; -- 1.7.4.1 ** Affects: linux (Ubuntu) Importance: Undecided Status: Incomplete ** Summary changed: - [Hyper- + [Hyper-V] hv: vmbus: Fix a host signaling bug ** Description changed: + The following fix has been submitted upstream, but has high enough + severity that we would like early inclusion into the Ubuntu kernel. + Please consider for wily, vivid, and trusty (and the HWE kernels for the + same). + + Patch follows: + Currently we have two policies for deciding when to signal the host: One based on the ring buffer state and the other based on what the VMBUS client driver wants to do. Consider the case when the client wants to explicitly control when to signal the host. In this case, if the client were to defer signaling, we will not be able to signal the host subsequently when the client does want to signal since the ring buffer state will prevent the signaling. Implement logic to have only one signaling policy in force for a given channel. Signed-off-by: K. Y. Srinivasan <k...@microsoft.com> Reviewed-by: Haiyang Zhang <haiya...@microsoft.com> Tested-by: Haiyang Zhang <haiya...@microsoft.com> Cc: <sta...@vger.kernel.org> # v4.2+ --- - drivers/hv/channel.c | 18 ++++++++++++++++++ - include/linux/hyperv.h | 12 ++++++++++++ - 2 files changed, 30 insertions(+), 0 deletions(-) + drivers/hv/channel.c | 18 ++++++++++++++++++ + include/linux/hyperv.h | 12 ++++++++++++ + 2 files changed, 30 insertions(+), 0 deletions(-) diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c index 77d2579..c6278c7 100644 --- a/drivers/hv/channel.c +++ b/drivers/hv/channel.c @@ -653,10 +653,19 @@ int vmbus_sendpacket_ctl(struct vmbus_channel *channel, void *buffer, - * on the ring. We will not signal if more data is - * to be placed. - * + * on the ring. We will not signal if more data is + * to be placed. + * + * Based on the channel signal state, we will decide + * which signaling policy will be applied. + * - * If we cannot write to the ring-buffer; signal the host - * even if we may not have written anything. This is a rare - * enough condition that it should not matter. - */ + * If we cannot write to the ring-buffer; signal the host + * even if we may not have written anything. This is a rare + * enough condition that it should not matter. + */ + + if (channel->signal_state) + signal = true; + else + kick_q = true; + - if (((ret == 0) && kick_q && signal) || (ret)) - vmbus_setevent(channel); - + if (((ret == 0) && kick_q && signal) || (ret)) + vmbus_setevent(channel); + @@ -756,10 +765,19 @@ int vmbus_sendpacket_pagebuffer_ctl(struct vmbus_channel *channel, - * on the ring. We will not signal if more data is - * to be placed. - * + * on the ring. We will not signal if more data is + * to be placed. + * + * Based on the channel signal state, we will decide + * which signaling policy will be applied. + * - * If we cannot write to the ring-buffer; signal the host - * even if we may not have written anything. This is a rare - * enough condition that it should not matter. - */ + * If we cannot write to the ring-buffer; signal the host + * even if we may not have written anything. This is a rare + * enough condition that it should not matter. + */ + + if (channel->signal_state) + signal = true; + else + kick_q = true; + - if (((ret == 0) && kick_q && signal) || (ret)) - vmbus_setevent(channel); - + if (((ret == 0) && kick_q && signal) || (ret)) + vmbus_setevent(channel); + diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index 437c9c8..7b1af52 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -756,8 +756,20 @@ struct vmbus_channel { - * link up channels based on their CPU affinity. - */ - struct list_head percpu_list; + * link up channels based on their CPU affinity. + */ + struct list_head percpu_list; + /* + * Host signaling policy: The default policy will be + * based on the ring buffer state. We will also support + * a policy where the client driver can have explicit + * signaling control. + */ + bool signal_state; - }; - - +static inline void set_channel_signal_state(struct vmbus_channel *c, + }; + + +static inline void set_channel_signal_state(struct vmbus_channel *c, +bool state) { + c->signal_state = state; +} + - static inline void set_channel_read_state(struct vmbus_channel *c, bool state) { - c->batched_reading = state; + static inline void set_channel_read_state(struct vmbus_channel *c, bool state) { + c->batched_reading = state; -- 1.7.4.1 -- You received this bug notification because you are a member of Kernel Packages, which is subscribed to linux in Ubuntu. https://bugs.launchpad.net/bugs/1519897 Title: [Hyper-V] hv: vmbus: Fix a host signaling bug Status in linux package in Ubuntu: Incomplete Bug description: The following fix has been submitted upstream, but has high enough severity that we would like early inclusion into the Ubuntu kernel. Please consider for wily, vivid, and trusty (and the HWE kernels for the same). Patch follows: Currently we have two policies for deciding when to signal the host: One based on the ring buffer state and the other based on what the VMBUS client driver wants to do. Consider the case when the client wants to explicitly control when to signal the host. In this case, if the client were to defer signaling, we will not be able to signal the host subsequently when the client does want to signal since the ring buffer state will prevent the signaling. Implement logic to have only one signaling policy in force for a given channel. Signed-off-by: K. Y. Srinivasan <k...@microsoft.com> Reviewed-by: Haiyang Zhang <haiya...@microsoft.com> Tested-by: Haiyang Zhang <haiya...@microsoft.com> Cc: <sta...@vger.kernel.org> # v4.2+ --- drivers/hv/channel.c | 18 ++++++++++++++++++ include/linux/hyperv.h | 12 ++++++++++++ 2 files changed, 30 insertions(+), 0 deletions(-) diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c index 77d2579..c6278c7 100644 --- a/drivers/hv/channel.c +++ b/drivers/hv/channel.c @@ -653,10 +653,19 @@ int vmbus_sendpacket_ctl(struct vmbus_channel *channel, void *buffer, * on the ring. We will not signal if more data is * to be placed. * + * Based on the channel signal state, we will decide + * which signaling policy will be applied. + * * If we cannot write to the ring-buffer; signal the host * even if we may not have written anything. This is a rare * enough condition that it should not matter. */ + + if (channel->signal_state) + signal = true; + else + kick_q = true; + if (((ret == 0) && kick_q && signal) || (ret)) vmbus_setevent(channel); @@ -756,10 +765,19 @@ int vmbus_sendpacket_pagebuffer_ctl(struct vmbus_channel *channel, * on the ring. We will not signal if more data is * to be placed. * + * Based on the channel signal state, we will decide + * which signaling policy will be applied. + * * If we cannot write to the ring-buffer; signal the host * even if we may not have written anything. This is a rare * enough condition that it should not matter. */ + + if (channel->signal_state) + signal = true; + else + kick_q = true; + if (((ret == 0) && kick_q && signal) || (ret)) vmbus_setevent(channel); diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index 437c9c8..7b1af52 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -756,8 +756,20 @@ struct vmbus_channel { * link up channels based on their CPU affinity. */ struct list_head percpu_list; + /* + * Host signaling policy: The default policy will be + * based on the ring buffer state. We will also support + * a policy where the client driver can have explicit + * signaling control. + */ + bool signal_state; }; +static inline void set_channel_signal_state(struct vmbus_channel *c, +bool state) { + c->signal_state = state; +} + static inline void set_channel_read_state(struct vmbus_channel *c, bool state) { c->batched_reading = state; -- 1.7.4.1 To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1519897/+subscriptions -- Mailing list: https://launchpad.net/~kernel-packages Post to : kernel-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~kernel-packages More help : https://help.launchpad.net/ListHelp