From: Christian Lamparter <chunkeey@web.de>
To: Larry Finger <Larry.Finger@lwfinger.net>
Cc: "linux-wireless" <linux-wireless@vger.kernel.org>,
Johannes Berg <johannes@sipsolutions.net>
Subject: Re: [WIP] p54: deal with allocation failures in rx path
Date: Sun, 5 Jul 2009 15:59:32 +0200 [thread overview]
Message-ID: <200907051559.32958.chunkeey@web.de> (raw)
In-Reply-To: <4A4FC61A.30004@lwfinger.net>
On Saturday 04 July 2009 23:14:02 Larry Finger wrote:
> Larry Finger wrote:
> > @@ -224,6 +236,7 @@ static void p54_tx_qos_accounting_free(s
> > struct p54_tx_data *data = (void *) hdr->data;
> >
> > priv->tx_stats[data->hw_queue].len--;
> > + WARN_ON(priv->tx_stats[data->hw_queue].len < 0);
> > }
> > p54_wake_queues(priv);
> > }
> >
>
> The new WARN_ON did _NOT_ trigger when the len went negative.
Now that's what I call a really cool coincident!
The only _official_ codepath where the queue len actually could be
decremented is not really responsible for this -1!
maybe, after decreasing priv->tx_stats[data->hw_queue].len--;
we should override data->hw_queue (aka mark) and place WARN_ON
everywhere (e.g. p54_free_skb / p54_find_and_unlink_skb & p54_dump_tx_queue
whenever they spot the marker.
(OT: in there's a _wrong_ p54_tx_qos_accounting_free in p54_rx_eeprom_readback
which will be removed...
however its a bit unlikely this causes this havok as the eeprom_readback is a
control frame and therefore p54_tx_qos_accounting_free is a nop for those)
> The only other place where len could be decremented is through
> txhdr->backlog. I noticed that the p54common.c had
>
> txhdr->backlog = current_queue->len;
>
> This was replaced in txrx.c by
>
> txhdr->backlog = priv->tx_stats[queue].len - 1;
>
> Was this intentional?
the spec only says "Number of backlogged frames for given queue."
however there's no word about if this count is for the number of
frames which [are already(now)]/[or will be(old behaviour)]
in the device memory window...
and to add more confusion => there's even a third interpretation:
could be this the number of frames which are still buffered by the driver,
because they don't fit yet?
Now back to the lines:
I somehow fail to see how exactly tx_stats[queue].len gets
decremented here?
as the result of priv->tx_stats[queue].len - 1 will be written into
txhdr->backlog and not priv->tx_stats[queue].len?
it's really a txhdr->backlog = priv->tx_stats[queue].len - 1;
vs.
priv->tx_stats[queue].len = priv->tx_stats[queue].len - 1;
where as the second one is obviously wrong _here_...
> To test if this is the problem, I added the following hunk:
>
> @@ -840,6 +853,7 @@ int p54_tx_80211(struct ieee80211_hw *de
> txhdr->crypt_offset = crypt_offset;
> txhdr->hw_queue = queue;
> txhdr->backlog = priv->tx_stats[queue].len - 1;
> + WARN_ON(!priv->tx_stats[queue].len);
> memset(txhdr->durations, 0, sizeof(txhdr->durations));
> txhdr->tx_antenna = ((info->antenna_sel_tx == 0) ?
> 2 : info->antenna_sel_tx - 1) & priv->tx_diversity_mask;
>
> This WARN_ON did trigger just before txq[6].len went negative. I'm now
> testing with that changed as follows:
>
> @@ -839,7 +852,8 @@ int p54_tx_80211(struct ieee80211_hw *de
> }
> txhdr->crypt_offset = crypt_offset;
> txhdr->hw_queue = queue;
> - txhdr->backlog = priv->tx_stats[queue].len - 1;
> + txhdr->backlog = priv->tx_stats[queue].len;
> + WARN_ON(priv->tx_stats[queue].len < 0);
> memset(txhdr->durations, 0, sizeof(txhdr->durations));
> txhdr->tx_antenna = ((info->antenna_sel_tx == 0) ?
> 2 : info->antenna_sel_tx - 1) & priv->tx_diversity_mask;
>
> This WARN_ON did not trigger, but I still had the queue len go negative.
well, you have to change the WARN_ON to priv->tx_stats[queue].len <= 0 (or ==)
as priv->tx_stats[queue].len will never be 0 here, because it was just
incremented by p54_tx_qos_accounting_alloc.
>
> One other question: struct p54_burst is defined in lmac.h, but it
> doesn't seem to be used anywhere. Will it be needed later?
It's on the todo list...... somewhere.
However, the LMAC API needs to be updated for this.
As there is no description (TBD) about the flags.
Regards,
Chr
next prev parent reply other threads:[~2009-07-05 13:59 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-03 22:53 [WIP] p54: deal with allocation failures in rx path Christian Lamparter
2009-07-04 1:09 ` Larry Finger
2009-07-04 2:16 ` Larry Finger
2009-07-04 10:11 ` Christian Lamparter
2009-07-04 16:40 ` Larry Finger
2009-07-04 17:28 ` Christian Lamparter
2009-07-04 19:56 ` Larry Finger
2009-07-04 21:14 ` Larry Finger
2009-07-05 13:59 ` Christian Lamparter [this message]
2009-07-05 17:49 ` Larry Finger
2009-07-05 22:05 ` Christian Lamparter
2009-07-06 1:36 ` Larry Finger
2009-07-06 13:16 ` Christian Lamparter
2009-07-04 7:52 ` Johannes Berg
2009-07-05 0:56 ` Max Filippov
2009-07-05 14:00 ` Christian Lamparter
2009-07-05 19:16 ` Max Filippov
2009-07-05 22:46 ` Max Filippov
2009-07-06 13:11 ` Max Filippov
2009-07-06 14:00 ` Christian Lamparter
2009-07-06 14:18 ` Max Filippov
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=200907051559.32958.chunkeey@web.de \
--to=chunkeey@web.de \
--cc=Larry.Finger@lwfinger.net \
--cc=johannes@sipsolutions.net \
--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).