All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Eric Dumazet' <eric.dumazet@gmail.com>,
	Tom Herbert <therbert@google.com>
Cc: "Jesper Dangaard Brouer" <brouer@redhat.com>,
	"Linux Netdev List" <netdev@vger.kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	"Alexander Duyck" <alexander.h.duyck@intel.com>,
	"Toke Høiland-Jørgensen" <toke@toke.dk>,
	"Florian Westphal" <fw@strlen.de>,
	"Jamal Hadi Salim" <jhs@mojatatu.com>,
	"Dave Taht" <dave.taht@gmail.com>,
	"John Fastabend" <john.r.fastabend@intel.com>,
	"Daniel Borkmann" <dborkman@redhat.com>,
	"Hannes Frederic Sowa" <hannes@stressinduktion.org>
Subject: RE: [net-next PATCH 1/1 V4] qdisc: bulk dequeue support for qdiscs with TCQ_F_ONETXQUEUE
Date: Fri, 26 Sep 2014 09:23:57 +0000	[thread overview]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6D1749E380@AcuExch.aculab.com> (raw)
In-Reply-To: <1411688409.16953.64.camel@edumazet-glaptop2.roam.corp.google.com>

From: Eric Dumazet
> On Wed, 2014-09-24 at 19:12 -0700, Eric Dumazet wrote:
...
> It turned out the problem I noticed was caused by compiler trying to be
> smart, but involving a bad MESI transaction.
> 
>   0.05   mov    0xc0(%rax),%edi    // LOAD dql->num_queued
>   0.48   mov    %edx,0xc8(%rax)    // STORE dql->last_obj_cnt = count
>  58.23   add    %edx,%edi
>   0.58   cmp    %edi,0xc4(%rax)
>   0.76   mov    %edi,0xc0(%rax)    // STORE dql->num_queued += count
>   0.72   js     bd8
> 
> 
> I get an incredible 10 % gain by making sure cpu wont get the cache line
> in Shared mode.

That is a stunning difference between requesting 'exclusive' access
and upgrading 'shared' to exclusive.
Stinks of a cpu bug?

Or is the reported stall a side effect of waiting for the earlier
'cache line read' to complete in order to issue the 'upgrade to exclusive'.
In which case gcc's instruction scheduler probably needs to be taught
to schedule writes before reads.

> (I also tried a barrier() in netdev_tx_sent_queue() between the
> 
> 	dql_queued(&dev_queue->dql, bytes);
> -
> +	barrier();
>  	if (likely(dql_avail(&dev_queue->dql) >= 0))
> 
> But following patch seems cleaner
> 
> diff --git a/include/linux/dynamic_queue_limits.h b/include/linux/dynamic_queue_limits.h
> index 5621547d631b..978fbe332090 100644
> --- a/include/linux/dynamic_queue_limits.h
> +++ b/include/linux/dynamic_queue_limits.h
> @@ -80,7 +80,7 @@ static inline void dql_queued(struct dql *dql, unsigned int count)
>  /* Returns how many objects can be queued, < 0 indicates over limit. */
>  static inline int dql_avail(const struct dql *dql)
>  {
> -	return dql->adj_limit - dql->num_queued;
> +	return ACCESS_ONCE(dql->adj_limit) - ACCESS_ONCE(dql->num_queued);

Dunno, that could have an impact on other calls where the values
are already in registers - I suspect ACCESS_ONCE() forces an access.

	David


  parent reply	other threads:[~2014-09-26  9:25 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-24 16:10 [net-next PATCH 0/1 V4] qdisc bulk dequeuing and utilizing delayed tailptr updates Jesper Dangaard Brouer
2014-09-24 16:12 ` [net-next PATCH 1/1 V4] qdisc: bulk dequeue support for qdiscs with TCQ_F_ONETXQUEUE Jesper Dangaard Brouer
2014-09-24 17:23   ` Eric Dumazet
2014-09-24 17:58     ` Jesper Dangaard Brouer
2014-09-24 18:34       ` Tom Herbert
2014-09-24 19:22         ` Eric Dumazet
2014-09-25  2:12           ` Eric Dumazet
2014-09-25  2:38             ` Tom Herbert
2014-09-25  2:58               ` Dave Taht
2014-09-26 18:06                 ` Eric Dumazet
2014-09-25 23:40             ` Eric Dumazet
2014-09-26  6:04               ` [PATCH net-next] dql: dql_queued() should write first to reduce bus transactions Eric Dumazet
2014-09-26  8:47                 ` Jesper Dangaard Brouer
2014-09-26 11:06                 ` Hannes Frederic Sowa
2014-09-26 12:02                   ` Eric Dumazet
2014-09-28 21:43                 ` David Miller
2014-09-26  9:23               ` David Laight [this message]
2014-09-26 13:16                 ` [net-next PATCH 1/1 V4] qdisc: bulk dequeue support for qdiscs with TCQ_F_ONETXQUEUE David Laight
2014-09-26 13:38                   ` Eric Dumazet
2014-09-24 22:13       ` Jamal Hadi Salim
2014-09-25  8:25         ` Jesper Dangaard Brouer
2014-09-25 12:48           ` Jamal Hadi Salim
2014-09-25 14:40             ` Tom Herbert
2014-09-25 14:57               ` Jesper Dangaard Brouer
2014-09-25 15:05                 ` Tom Herbert
2014-09-25 15:23                   ` Jesper Dangaard Brouer
2014-09-25 15:58                     ` Tom Herbert
2014-09-29 20:23                       ` Jesper Dangaard Brouer
2014-09-29 20:14                     ` Jesper Dangaard Brouer
2014-09-25 15:12                 ` Eric Dumazet
2014-09-25 13:52           ` Dave Taht

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=063D6719AE5E284EB5DD2968C1650D6D1749E380@AcuExch.aculab.com \
    --to=david.laight@aculab.com \
    --cc=alexander.h.duyck@intel.com \
    --cc=brouer@redhat.com \
    --cc=dave.taht@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dborkman@redhat.com \
    --cc=eric.dumazet@gmail.com \
    --cc=fw@strlen.de \
    --cc=hannes@stressinduktion.org \
    --cc=jhs@mojatatu.com \
    --cc=john.r.fastabend@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=therbert@google.com \
    --cc=toke@toke.dk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.