From: Zhu Yi <yi.zhu@intel.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: "John Linville" <linville@tuxdriver.com>,
"Tomas Winkler" <tomasw@gmail.com>,
"Chatre, Reinette" <reinette.chatre@intel.com>,
"Marcel Holtmann" <marcel@holtmann.org>,
"Luis R. Rodriguez" <mcgrof@gmail.com>,
"Rafael J. Wysocki" <rjw@sisk.pl>,
"Matt Mackall" <mpm@selenic.com>,
"Christophe Dumez" <dchris@gmail.com>,
"Jan Včelák" <vcelak.jan@seznam.cz>,
"Thomas Witt" <witt_th@gmx.de>,
linux-wireless <linux-wireless@vger.kernel.org>,
"Andres Freund" <andres@anarazel.de>
Subject: Re: [PATCH/RFT] iwlagn: fix RX skb alignment
Date: Tue, 18 Nov 2008 09:57:53 +0800 [thread overview]
Message-ID: <1226973473.2548.97.camel@debian.sh.intel.com> (raw)
In-Reply-To: <1226969241.4014.24.camel@johannes.berg>
On Tue, 2008-11-18 at 08:47 +0800, Johannes Berg wrote:
> [patch below, sorry for the long list of CCs]
>
> So I dug deeper into the DMA problems I had with iwlagn and a kind soul
> helped me in that he said something about pci-e alignment and mentioned
> the iwl_rx_allocate function to check for crossing 4KB boundaries. Since
> there's 8KB A-MPDU support, crossing 4k boundaries didn't seem like
> something the device would fail with, but when I looked into the
> function for a minute anyway I stumbled over this little gem:
>
> BUG_ON(rxb->dma_addr & (~DMA_BIT_MASK(36) & 0xff));
OK, it should be (~DMA_BIT_MASK(36) | 0xff). My bad.
> Clearly, that is a totally bogus check, one would hope the compiler
> removes it entirely. (Think about it)
Sure.
> After fixing it, I obviously ran into it, nothing guarantees the
> alignment the way you want it, because of the way skbs and their
> headroom are allocated. I won't explain that here nor double-check that
> I'm right, that goes beyond what most of the CC'ed people care about.
We do suspect the 256 alignment requirement will be an issue. Thus we do
let people can reproduce this problem check with it. See comment #21,
#22, #23 in bug
http://www.intellinuxwireless.org/bugzilla/show_bug.cgi?id=1703. The
result is people still see this problem even the DMA address is 256
bytes aligned.
> So then I came up with the patch below, and so far my system has
> survived minutes with 64K pages, when it would previously fail in
> seconds. And I haven't seen a single instance of the TX bug either. But
> when you see the patch it'll be pretty obvious to you why.
Good. Your patch is generally correct. At least, it helps to enforce our
alignment requirement. But whether it can resolve the problem (I really
hope so) or not, let's wait and see.
> This should fix the following reported kernel bugs:
>
> http://bugzilla.kernel.org/show_bug.cgi?id=11596
> http://bugzilla.kernel.org/show_bug.cgi?id=11393
> http://bugzilla.kernel.org/show_bug.cgi?id=11983
>
> I haven't checked if there are any elsewhere, but I suppose RHBZ will
> have a few instances too...
>
> I'd like to ask anyone who is CC'ed (those are people I know ran into
> the bug) to try this patch.
>
> I am convinced that this patch is correct in spirit, but I haven't
> understood why, for example, there are so many unmap calls. I'm not
> entirely convinced that this is the only bug leading to the TX reply
> errors.
>
> Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
[...]
> @@ -302,7 +305,7 @@ void iwl_rx_queue_free(struct iwl_priv *
> for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) {
> if (rxq->pool[i].skb != NULL) {
> pci_unmap_single(priv->pci_dev,
> - rxq->pool[i].dma_addr,
> + rxq->pool[i].real_dma_addr,
> priv->hw_params.rx_buf_size,
priv->hw_params.rx_buf_size + 256.
> PCI_DMA_FROMDEVICE);
> dev_kfree_skb(rxq->pool[i].skb);
> @@ -370,7 +373,7 @@ void iwl_rx_queue_reset(struct iwl_priv
> * to an SKB, so we need to unmap and free potential storage */
> if (rxq->pool[i].skb != NULL) {
> pci_unmap_single(priv->pci_dev,
> - rxq->pool[i].dma_addr,
> + rxq->pool[i].real_dma_addr,
> priv->hw_params.rx_buf_size,
> PCI_DMA_FROMDEVICE);
> priv->alloc_rxb_skb--;
ditto.
Thanks,
-yi
next prev parent reply other threads:[~2008-11-18 1:57 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-18 0:47 [PATCH/RFT] iwlagn: fix RX skb alignment Johannes Berg
2008-11-18 1:57 ` Zhu Yi [this message]
2008-11-18 2:05 ` Johannes Berg
2008-11-18 9:43 ` Johannes Berg
2008-11-18 14:13 ` Tomas Winkler
2008-11-18 15:25 ` Johannes Berg
2008-11-19 9:15 ` Tomas Winkler
2008-11-19 11:36 ` Johannes Berg
2008-11-19 12:22 ` Tomas Winkler
2008-11-19 12:33 ` Johannes Berg
2008-11-19 13:02 ` Tomas Winkler
2008-11-19 13:09 ` Johannes Berg
2008-11-19 13:12 ` Johannes Berg
2008-11-19 13:14 ` Johannes Berg
2008-11-19 0:48 ` Johannes Berg
2008-11-19 9:21 ` Tomas Winkler
2008-11-19 11:40 ` Johannes Berg
2008-11-19 12:24 ` Tomas Winkler
2008-11-19 12:28 ` Johannes Berg
2008-11-19 13:00 ` Tomas Winkler
2008-11-18 10:52 ` Johannes Berg
2008-11-18 23:20 ` Luis R. Rodriguez
2008-11-19 0:22 ` [PATCH] iwlagn: fix DMA sync Johannes Berg
2008-11-18 10:56 ` [PATCH/RFT] iwlagn: fix RX skb alignment Johannes Berg
2008-11-18 16:38 ` Thomas Witt
2008-11-19 1:58 ` Zhu Yi
2008-12-01 17:30 ` reinette chatre
2008-12-01 19:37 ` Johannes Berg
2008-12-01 23:30 ` reinette chatre
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=1226973473.2548.97.camel@debian.sh.intel.com \
--to=yi.zhu@intel.com \
--cc=andres@anarazel.de \
--cc=dchris@gmail.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=marcel@holtmann.org \
--cc=mcgrof@gmail.com \
--cc=mpm@selenic.com \
--cc=reinette.chatre@intel.com \
--cc=rjw@sisk.pl \
--cc=tomasw@gmail.com \
--cc=vcelak.jan@seznam.cz \
--cc=witt_th@gmx.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).