linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luca Coelho <luca@coelho.fi>
To: Michal Kazior <michal.kazior@tieto.com>
Cc: linux-wireless <linux-wireless@vger.kernel.org>,
	Johannes Berg <johannes@sipsolutions.net>,
	sw@simonwunderlich.de, "Otcheretianski,
	Andrei" <andrei.otcheretianski@intel.com>
Subject: Re: [PATCH v7 3/4] mac80211: implement chanctx reservation
Date: Wed, 12 Mar 2014 16:21:30 +0200	[thread overview]
Message-ID: <1394634090.16246.2.camel@dubbel> (raw)
In-Reply-To: <CA+BoTQkSqEVVKgK3rD26ECqnJPQo57M+4NNoifH1Wu+EBYvqwA@mail.gmail.com>

On Wed, 2014-03-12 at 14:21 +0100, Michal Kazior wrote:
> On 12 March 2014 14:06, Luciano Coelho <luciano.coelho@intel.com> wrote:
> 
> [...]
> 
> > +       if (old_ctx == ctx) {
> > +               /* This is our own context, just change it */
> > +               ret = __ieee80211_vif_change_channel(sdata, old_ctx,
> > +                                                    &tmp_changed);
> > +               if (ret)
> > +                       goto out;
> > +       } else {
> > +               if (sdata->vif.bss_conf.chandef.width !=
> > +                   sdata->reserved_chandef.width)
> > +                       tmp_changed |= BSS_CHANGED_BANDWIDTH;
> > +
> > +               sdata->vif.bss_conf.chandef = sdata->reserved_chandef;
> > +
> > +               ret = ieee80211_assign_vif_chanctx(sdata, ctx);
> > +               if (old_ctx->refcount == 0)
> > +                       ieee80211_free_chanctx(local, old_ctx);
> > +               if (ret) {
> > +                       /* if assign fails refcount stays the same */
> > +                       if (ctx->refcount == 0)
> > +                               ieee80211_free_chanctx(local, ctx);
> > +                       goto out;
> > +               }
> > +
> > +               *changed = tmp_changed;
> > +
> > +               ieee80211_vif_copy_chanctx_to_vlans(sdata, false);
> 
> Ah, you can't call it like that. This will deadlock because the
> function tries to grab chanctx_mtx but you're already holding it. You
> need to first split the vif_copy_chanctx() into 2 variants - with and
> without grabbing the chanctx_mtx.

Grrrr! Concentrate, Luca, concentrate!


> > +               ieee80211_recalc_chanctx_chantype(local, ctx);
> > +               ieee80211_recalc_smps_chanctx(local, ctx);
> > +               ieee80211_recalc_radar_chanctx(local, ctx);
> > +               ieee80211_recalc_chanctx_min_def(local, ctx);
> 
> It seems you need to call these recalc* regardless what if() branch is
> taken so calling them in this branch is pointless, no?
> 
> > +       }
> > +
> > +       *changed = tmp_changed;
> > +
> > +       ieee80211_recalc_chanctx_chantype(local, ctx);
> > +       ieee80211_recalc_smps_chanctx(local, ctx);
> > +       ieee80211_recalc_radar_chanctx(local, ctx);
> > +       ieee80211_recalc_chanctx_min_def(local, ctx);

More stuff I screwed up in my rebases...

--
Luca.


  reply	other threads:[~2014-03-12 14:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-12 13:06 [PATCH v7 0/4] mac802111: channel context reservation Luciano Coelho
2014-03-12 13:06 ` [PATCH v7 1/4] mac80211: split ieee80211_vif_change_channel in two Luciano Coelho
2014-03-12 13:06 ` [PATCH v7 2/4] mac80211: refactor ieee80211_assign/unassign_vif_chanctx into one Luciano Coelho
2014-03-12 13:06 ` [PATCH v7 3/4] mac80211: implement chanctx reservation Luciano Coelho
2014-03-12 13:21   ` Michal Kazior
2014-03-12 14:21     ` Luca Coelho [this message]
2014-03-12 13:26   ` Michal Kazior
2014-03-12 14:02     ` Luca Coelho
2014-03-12 13:06 ` [PATCH v7 4/4] mac80211: allow reservation of a running chanctx Luciano Coelho
2014-03-12 13:24   ` Michal Kazior
2014-03-12 14:33     ` Luca Coelho

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=1394634090.16246.2.camel@dubbel \
    --to=luca@coelho.fi \
    --cc=andrei.otcheretianski@intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=michal.kazior@tieto.com \
    --cc=sw@simonwunderlich.de \
    /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).