linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH 2/2] mac80211: protect skb_queue_len(&ps->bc_buf) by lock
Date: Wed, 19 Feb 2014 17:36:58 +0100	[thread overview]
Message-ID: <1392827818.4733.27.camel@jlt4.sipsolutions.net> (raw)
In-Reply-To: <20140219150937.GH1851@redhat.com>

On Wed, 2014-02-19 at 16:09 +0100, Stanislaw Gruszka wrote:
> On Wed, Feb 19, 2014 at 03:51:43PM +0100, Johannes Berg wrote:
> > On Wed, 2014-02-19 at 14:35 +0100, Stanislaw Gruszka wrote:
> > 
> > > > It ultimately makes no difference at all, it just makes this code more
> > > > difficult to read and understand.
> > > 
> > > It make difference when queue length value is modified on different CPU
> > > and read on different CPU. Without lock you can 'see' old length value
> > > on CPU that run ieee80211_tx_h_multicast_ps_buf() for undefined
> > > period of time (ok maybe not undefined on x86), and current oldest
> > > frame can be not necessarily dropped.
> > 
> > I don't see how that can be true, since the modifications of the queue
> > length are under spinlock with the implied memory barriers.
> 
> On processor that read value there is no memory barrier. If you do:
> 
> CPU1				CPU2
> 
> 				b = a;
> spin_lock(a_lock)
> a = 1;				...
> spin_unlock(a_lock)
> 
> 				b = a;
> 
> There is nothing that guarantee that on CPU2 b will be 1.

Well, OK, so there's some small window of time where the drop code isn't
perfect. Does it matter? I'd argue it doesn't - if you're getting close
to the drop case then the client is probably misbehaving anyway.

johannes


  reply	other threads:[~2014-02-19 16:37 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-19 12:28 [PATCH 1/2] mac80211: fix calling ieee80211_free_txskb with NULL skb Stanislaw Gruszka
2014-02-19 12:28 ` [PATCH 2/2] mac80211: protect skb_queue_len(&ps->bc_buf) by lock Stanislaw Gruszka
2014-02-19 13:14   ` Johannes Berg
2014-02-19 13:35     ` Stanislaw Gruszka
2014-02-19 14:51       ` Johannes Berg
2014-02-19 15:09         ` Stanislaw Gruszka
2014-02-19 16:36           ` Johannes Berg [this message]
2014-02-20  7:56             ` Stanislaw Gruszka
2014-02-20  7:59               ` Johannes Berg
2014-02-20  8:17               ` Stanislaw Gruszka
2014-02-19 12:33 ` [PATCH 1/2] mac80211: fix calling ieee80211_free_txskb with NULL skb Johannes Berg
2014-02-19 12:39   ` Grumbach, Emmanuel
2014-02-19 12:46   ` Grumbach, Emmanuel
2014-02-19 13:21   ` Stanislaw Gruszka
2014-02-19 14:48     ` Stanislaw Gruszka
2014-02-19 14:50       ` Johannes Berg
2014-02-19 15:00         ` Stanislaw Gruszka

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=1392827818.4733.27.camel@jlt4.sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=sgruszka@redhat.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).