linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Eliad Peller <eliad@wizery.com>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH 2/2] mac80211: use call_rcu() on sta deletion
Date: Thu, 06 Sep 2012 17:41:10 +0200	[thread overview]
Message-ID: <1346946070.5469.23.camel@jlt4.sipsolutions.net> (raw)
In-Reply-To: <1346865837-32265-3-git-send-email-eliad@wizery.com> (sfid-20120905_192355_860789_FC09B61A)

On Wed, 2012-09-05 at 20:23 +0300, Eliad Peller wrote:

> +++ b/net/mac80211/iface.c
> @@ -774,6 +774,10 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
>  		 * frames at this very time on another CPU.
>  		 */
>  		synchronize_rcu();
> +
> +		/* flush any remaining cleanup work */
> +		flush_workqueue(local->workqueue);

I have a feeling we need rcu_barrier() here instead of synchronize_rcu()
now to guarantee that all the potentially pending call_rcu() functions
from the sta_info_flush() above have actually completed and queued the
work items that we want to flush here. Right? That's a bit unfortunate,
but I guess the best way of handling it and ifdown should be rare anyway
compared to everything else.

I think it'd also be good to make the comment more verbose and explain
which cleanup work.

> +static void free_sta_work(struct work_struct *wk)
> +{
> +	struct sta_info *sta = container_of(wk, struct sta_info, free_sta_wk);
> +	int ac, i;
> +	struct tid_ampdu_tx *tid_tx;
> +	struct ieee80211_sub_if_data *sdata = sta->sdata;
> +	struct ieee80211_local *local = sdata->local;
> +
> +	/*
> +	 * At this point, after we wait for an RCU grace period,
> +	 * neither mac80211 nor the driver can reference this
> +	 * sta struct any more except by still existing timers
> +	 * associated with this station that we clean up below.
> +	 */

Should probably rewrite the comment a bit to indicate that we have in
fact waited since we get called via call_rcu().

> +	cancel_work_sync(&sta->drv_unblock_wk);

This will deadlock now, but cancel_work() will be safe without the sync
since the workqueue is single-threaded.

johannes


  reply	other threads:[~2012-09-06 15:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-05 17:23 [PATCH 0/2] make roaming a bit faster Eliad Peller
2012-09-05 17:23 ` [PATCH 1/2] mac80211: use synchronize_net() on key destroying Eliad Peller
2012-09-06 15:38   ` Johannes Berg
2012-09-05 17:23 ` [PATCH 2/2] mac80211: use call_rcu() on sta deletion Eliad Peller
2012-09-06 15:41   ` Johannes Berg [this message]
2012-09-06 21:17     ` Eliad Peller
2012-09-07  7:34       ` Johannes Berg

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=1346946070.5469.23.camel@jlt4.sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=eliad@wizery.com \
    --cc=linux-wireless@vger.kernel.org \
    /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).