From: Alexander Duyck <alexander.duyck@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Alexander Duyck <alexander.h.duyck@intel.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"davem@davemloft.net" <davem@davemloft.net>
Subject: Re: [RFC] move dma_head/dma_maps out of skb_shared_info and into sk_buff
Date: Thu, 05 Nov 2009 19:24:07 -0800 [thread overview]
Message-ID: <1257477847.14523.30.camel@localhost> (raw)
In-Reply-To: <4AF3868B.7070409@gmail.com>
On Fri, 2009-11-06 at 03:14 +0100, Eric Dumazet wrote:
> Alexander Duyck a écrit :
> > During testing we found issues with the use of skb_dma_map/unmap on
> > systems that had iommu enabled and were configured to use a bridge. The
> > issue is that if two ports are members of the same bridge, and a
> > broadcast packet is sent out on the bridge skb_clone will be used to
> > send a copy to all ports, but the clones run into issues because the
> > dma mappings for the cloned skbs all share the shared_info structure
> > where the dma mappings are stored.
> >
> > To resolve that this patch moves those dma mappings out of the
> > shared_info structure and into the sk_buff itself. This allows cloned
> > skbs to be mapped separately without causing dma unmapping errors.
> >
> > Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
>
> Hello Alexander
>
> You probably know such a change is a major one ;)
> 1) a diffstat -p1 -w70 for this kind of patch would be nice.
>
> 2) Your patch is garbled (tabulations were replaced by spaces
> by your mailer)
I kind of figured that might be the case. I didn't really intend the
patch to be applied to the tree and just meant it to get conversation
going. That is why I had tagged it as [RFC].
> 3) Are you sure we need to clear dma_maps[] array and dma_head
> in __alloc_skb() ? I guess not.
> MAX_SKB_FRAGS = 18 on x86 -> 152 bytes on x86_64.
> Previous implementation was not clearing them.
> Thats would be a major slow down.
>
> 4) 152 bytes more in skb -> 304 bytes more in skbuff_fclone_cache
> Do we really want two copies of dma_maps[] when skb are allocated
> from fclone cache ?
The main problem that this was meant to address is the fact that
skb_dma_map is called dma_maps and dma_head needed to be maintained
until skb_dma_unmap was called. This wasn't happening with them being
stored in the skb_shared_info structure due to the fact that if two
clones of the skb were mapped on 2 different devices the 2nd mapping
would overwrite the first, and then the skb_dma_unmap call was being
called on the 2nd dma mapping twice which would trigger a dma_unmapping
error followed by an error of mappings still being held for the first
device on driver unload.
> 5) It seems to me this stuff is needed for xmit only and few drivers,
> could we find a way to not have it for RX path and drivers that dont
> need it ? Maybe drivers themselves should allocate storage for this
> stuff so we can remove it both from shared_info *and* skb
I'm thinking the best solution may be to drop the skb_dma_map/unmap
calls entirely and move things back to the old approach in which devices
maintained their list of mappings. At least until something better can
be figured out.
Thanks,
Alex
prev parent reply other threads:[~2009-11-06 3:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-06 0:54 [RFC] move dma_head/dma_maps out of skb_shared_info and into sk_buff Alexander Duyck
2009-11-06 1:40 ` David Miller
2009-11-06 3:00 ` Alexander Duyck
2009-11-06 9:58 ` David Miller
2009-11-06 2:14 ` Eric Dumazet
2009-11-06 3:24 ` Alexander Duyck [this message]
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=1257477847.14523.30.camel@localhost \
--to=alexander.duyck@gmail.com \
--cc=alexander.h.duyck@intel.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=netdev@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).