From: David L Stevens <david.stevens@oracle.com>
To: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net-next v2 2/2] Re-check for a VIO_DESC_READY data descriptor after short udelay()
Date: Tue, 02 Sep 2014 12:27:19 -0400 [thread overview]
Message-ID: <5405EFE7.4090302@oracle.com> (raw)
In-Reply-To: <20140902162029.GC31516@oracle.com>
Sowmini,
One of the things I found while looking at the code is that the
write memory barrier is in the wrong place. I have a patch to fix it, but
it means the last descriptor will NOT be marked as ready until the cache
is flushed, which may be delayed.
That fix may make this one moot. Maybe not, but certainly there is
an unnecessary delay in notifying the peer because of that bug. The fix is
simply to move the "wmb()" after, instead of before, setting VIO_DESC_READY.
I mentioned it in our stand-up last week, which you couldn't attend, because
I pointed it out for the VDC driver, which also has the same problem.
You may want to retry with that change to see if the delay still
helps.
+-DLS
On 09/02/2014 12:20 PM, Sowmini Varadhan wrote:
>
> Upon encountering the first !VIO_DESC_READY in vnet_walk_rx(),
> it is frequently worthwhile to re-check the descriptor status
> after a short microsecond delay, as a bursty sender could
> be actively populating the descriptors, and the short udelay()
> is far less expensive than rolling back to ldc_rx() and having
> to wake up and read data on another LDC message.
>
> Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
> Acked-by: Raghuram Kothakota <raghuram.kothakota@oracle.com>
> ---
> changes since v1: moved label `again', variable `retries' to this patchset.
>
> drivers/net/ethernet/sun/sunvnet.c | 23 ++++++++++++++++++++---
> 1 file changed, 20 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c
> index 8f90b57..7b1f320 100644
> --- a/drivers/net/ethernet/sun/sunvnet.c
> +++ b/drivers/net/ethernet/sun/sunvnet.c
> @@ -390,11 +390,28 @@ static int vnet_walk_rx(struct vnet_port *port, struct vio_dring_state *dr,
> viodbg(DATA, "vnet_walk_rx start[%08x] end[%08x]\n", start, end);
>
> while (start != end) {
> - int ack = 0, err = vnet_walk_rx_one(port, dr, start, &ack);
> + int retries;
> + int ack = 0, err;
> +
> + retries = 0;
> +again:
> + err = vnet_walk_rx_one(port, dr, start, &ack);
> if (err == -ECONNRESET)
> return err;
> - if (err != 0)
> - break;
> + if (err != 0) {
> + /* The descriptor was not READY. Retry with a
> + * small delay, in case we have a bursty sender
> + * that is actively populating the descriptors, to
> + * reduce the overhead of stopping and re-entering
> + * which would involve expensive LDC messages.
> + */
> + if (retries++ < 3) {
> + udelay(4);
> + goto again;
> + } else {
> + break;
> + }
> + }
> if (ack_start == -1)
> ack_start = start;
> ack_end = start;
>
next prev parent reply other threads:[~2014-09-02 16:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-02 16:20 [PATCH net-next v2 2/2] Re-check for a VIO_DESC_READY data descriptor after short udelay() Sowmini Varadhan
2014-09-02 16:27 ` David L Stevens [this message]
2014-09-02 16:32 ` Sowmini Varadhan
2014-09-05 5:36 ` David Miller
2014-09-05 13:47 ` Sowmini Varadhan
2014-09-06 21:02 ` Sowmini Varadhan
[not found] ` <20140907181510.GA23753@oracle.com>
2014-09-07 19:36 ` Raghuram Kothakota
2014-09-07 23:19 ` David Miller
2014-09-08 13:45 ` David L Stevens
2014-09-08 14:03 ` Sowmini Varadhan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5405EFE7.4090302@oracle.com \
--to=david.stevens@oracle.com \
--cc=netdev@vger.kernel.org \
--cc=sowmini.varadhan@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).