* [PATCH 0/1] net/hyperv: Use wait_event on outstanding sends during device removal
@ 2012-06-04 14:35 Haiyang Zhang
2012-06-04 14:35 ` [PATCH 1/1] " Haiyang Zhang
2012-06-04 15:51 ` [PATCH 0/1] " David Miller
0 siblings, 2 replies; 6+ messages in thread
From: Haiyang Zhang @ 2012-06-04 14:35 UTC (permalink / raw)
To: davem, netdev; +Cc: devel, haiyangz, olaf, linux-kernel
This patch is targeting net-next tree (when it's available for check in).
Haiyang Zhang (1):
net/hyperv: Use wait_event on outstanding sends during device removal
drivers/net/hyperv/hyperv_net.h | 1 +
drivers/net/hyperv/netvsc.c | 12 ++++++------
2 files changed, 7 insertions(+), 6 deletions(-)
--
1.7.4.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/1] net/hyperv: Use wait_event on outstanding sends during device removal
2012-06-04 14:35 [PATCH 0/1] net/hyperv: Use wait_event on outstanding sends during device removal Haiyang Zhang
@ 2012-06-04 14:35 ` Haiyang Zhang
2012-06-04 15:48 ` David Miller
2012-06-04 15:51 ` [PATCH 0/1] " David Miller
1 sibling, 1 reply; 6+ messages in thread
From: Haiyang Zhang @ 2012-06-04 14:35 UTC (permalink / raw)
To: davem, netdev; +Cc: haiyangz, kys, olaf, linux-kernel, devel
Change the busy-waiting/udelay to wait_event on outstanding sends.
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>
---
drivers/net/hyperv/hyperv_net.h | 1 +
drivers/net/hyperv/netvsc.c | 12 ++++++------
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
index 4ffcd57..2857ab0 100644
--- a/drivers/net/hyperv/hyperv_net.h
+++ b/drivers/net/hyperv/hyperv_net.h
@@ -478,6 +478,7 @@ struct netvsc_device {
u32 nvsp_version;
atomic_t num_outstanding_sends;
+ wait_queue_head_t wait_drain;
bool start_remove;
bool destroy;
/*
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
index 8b91947..dee7b23e 100644
--- a/drivers/net/hyperv/netvsc.c
+++ b/drivers/net/hyperv/netvsc.c
@@ -42,6 +42,7 @@ static struct netvsc_device *alloc_net_device(struct hv_device *device)
if (!net_device)
return NULL;
+ init_waitqueue_head(&net_device->wait_drain);
net_device->start_remove = false;
net_device->destroy = false;
net_device->dev = device;
@@ -387,12 +388,8 @@ int netvsc_device_remove(struct hv_device *device)
spin_unlock_irqrestore(&device->channel->inbound_lock, flags);
/* Wait for all send completions */
- while (atomic_read(&net_device->num_outstanding_sends)) {
- dev_info(&device->device,
- "waiting for %d requests to complete...\n",
- atomic_read(&net_device->num_outstanding_sends));
- udelay(100);
- }
+ wait_event(net_device->wait_drain,
+ atomic_read(&net_device->num_outstanding_sends) == 0);
netvsc_disconnect_vsp(net_device);
@@ -486,6 +483,9 @@ static void netvsc_send_completion(struct hv_device *device,
num_outstanding_sends =
atomic_dec_return(&net_device->num_outstanding_sends);
+ if (net_device->destroy && num_outstanding_sends == 0)
+ wake_up(&net_device->wait_drain);
+
if (netif_queue_stopped(ndev) && !net_device->start_remove &&
(hv_ringbuf_avail_percent(&device->channel->outbound)
> RING_AVAIL_PERCENT_HIWATER ||
--
1.7.4.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] net/hyperv: Use wait_event on outstanding sends during device removal
2012-06-04 14:35 ` [PATCH 1/1] " Haiyang Zhang
@ 2012-06-04 15:48 ` David Miller
2012-06-04 16:14 ` Haiyang Zhang
0 siblings, 1 reply; 6+ messages in thread
From: David Miller @ 2012-06-04 15:48 UTC (permalink / raw)
To: haiyangz; +Cc: netdev, kys, olaf, linux-kernel, devel
From: Haiyang Zhang <haiyangz@microsoft.com>
Date: Mon, 4 Jun 2012 07:35:32 -0700
> + wait_event(net_device->wait_drain,
> + atomic_read(&net_device->num_outstanding_sends) == 0);
Please indent this properly. The goal is not to indent using only
TAB characters, the goal is to line things up to the proper column
using TAB and space characters as needed.
You must make the first character on the second line be at the
first column after the openning parenthesis on the previous line.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/1] net/hyperv: Use wait_event on outstanding sends during device removal
2012-06-04 14:35 [PATCH 0/1] net/hyperv: Use wait_event on outstanding sends during device removal Haiyang Zhang
2012-06-04 14:35 ` [PATCH 1/1] " Haiyang Zhang
@ 2012-06-04 15:51 ` David Miller
2012-06-04 16:20 ` Haiyang Zhang
1 sibling, 1 reply; 6+ messages in thread
From: David Miller @ 2012-06-04 15:51 UTC (permalink / raw)
To: haiyangz; +Cc: netdev, kys, olaf, linux-kernel, devel
From: Haiyang Zhang <haiyangz@microsoft.com>
Date: Mon, 4 Jun 2012 07:35:31 -0700
> This patch is targeting net-next tree (when it's available for check in).
>
> Haiyang Zhang (1):
> net/hyperv: Use wait_event on outstanding sends during device removal
Why in the world are you doing this?
This patch you are already asking me to apply to the 'net' tree, and
changes already will automatically propagate from 'net' to
'net-next' the next time I merge those trees.
So you never need to submit bug fixes twice, once for 'net' and
once for 'net-next' so please do not do it.
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH 1/1] net/hyperv: Use wait_event on outstanding sends during device removal
2012-06-04 15:48 ` David Miller
@ 2012-06-04 16:14 ` Haiyang Zhang
0 siblings, 0 replies; 6+ messages in thread
From: Haiyang Zhang @ 2012-06-04 16:14 UTC (permalink / raw)
To: David Miller
Cc: netdev@vger.kernel.org, KY Srinivasan, olaf@aepfle.de,
linux-kernel@vger.kernel.org, devel@linuxdriverproject.org
> -----Original Message-----
> From: David Miller [mailto:davem@davemloft.net]
> Sent: Monday, June 04, 2012 11:48 AM
> To: Haiyang Zhang
> Cc: netdev@vger.kernel.org; KY Srinivasan; olaf@aepfle.de; linux-
> kernel@vger.kernel.org; devel@linuxdriverproject.org
> Subject: Re: [PATCH 1/1] net/hyperv: Use wait_event on outstanding sends
> during device removal
>
> From: Haiyang Zhang <haiyangz@microsoft.com>
> Date: Mon, 4 Jun 2012 07:35:32 -0700
>
> > + wait_event(net_device->wait_drain,
> > + atomic_read(&net_device->num_outstanding_sends) == 0);
>
> Please indent this properly. The goal is not to indent using only
> TAB characters, the goal is to line things up to the proper column
> using TAB and space characters as needed.
>
> You must make the first character on the second line be at the
> first column after the openning parenthesis on the previous line.
Will do.
Thanks,
- Haiyang
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH 0/1] net/hyperv: Use wait_event on outstanding sends during device removal
2012-06-04 15:51 ` [PATCH 0/1] " David Miller
@ 2012-06-04 16:20 ` Haiyang Zhang
0 siblings, 0 replies; 6+ messages in thread
From: Haiyang Zhang @ 2012-06-04 16:20 UTC (permalink / raw)
To: David Miller
Cc: netdev@vger.kernel.org, KY Srinivasan, olaf@aepfle.de,
linux-kernel@vger.kernel.org, devel@linuxdriverproject.org
> -----Original Message-----
> From: David Miller [mailto:davem@davemloft.net]
> Sent: Monday, June 04, 2012 11:51 AM
> To: Haiyang Zhang
> Cc: netdev@vger.kernel.org; KY Srinivasan; olaf@aepfle.de; linux-
> kernel@vger.kernel.org; devel@linuxdriverproject.org
> Subject: Re: [PATCH 0/1] net/hyperv: Use wait_event on outstanding sends
> during device removal
>
> From: Haiyang Zhang <haiyangz@microsoft.com>
> Date: Mon, 4 Jun 2012 07:35:31 -0700
>
> > This patch is targeting net-next tree (when it's available for check
> in).
> >
> > Haiyang Zhang (1):
> > net/hyperv: Use wait_event on outstanding sends during device
> removal
>
> Why in the world are you doing this?
>
> This patch you are already asking me to apply to the 'net' tree, and
> changes already will automatically propagate from 'net' to
> 'net-next' the next time I merge those trees.
>
> So you never need to submit bug fixes twice, once for 'net' and
> once for 'net-next' so please do not do it.
A while ago, I was told the 'net' tree is only for urgent fixes, and I
should specify the target tree instead of letting you guess. But, that's
fine if you will apply it (after my updating the indentation) to 'net',
then merge it into 'net-next' tree automatically.
Thanks,
- Haiyang
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-06-04 16:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-04 14:35 [PATCH 0/1] net/hyperv: Use wait_event on outstanding sends during device removal Haiyang Zhang
2012-06-04 14:35 ` [PATCH 1/1] " Haiyang Zhang
2012-06-04 15:48 ` David Miller
2012-06-04 16:14 ` Haiyang Zhang
2012-06-04 15:51 ` [PATCH 0/1] " David Miller
2012-06-04 16:20 ` Haiyang Zhang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).