From: Zoltan Kiss <zoltan.kiss@citrix.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: <xen-devel@lists.xenproject.org>, <ian.campbell@citrix.com>,
<wei.liu2@citrix.com>, <linux@eikelenboom.it>,
<paul.durrant@citrix.com>, <netdev@vger.kernel.org>,
<david.vrabel@citrix.com>, <davem@davemloft.net>
Subject: Re: [PATCH net RFC] xen-netback: Fix grant ref resolution in RX path
Date: Wed, 14 May 2014 12:12:31 +0100 [thread overview]
Message-ID: <53734F9F.2010101@citrix.com> (raw)
In-Reply-To: <1399997635.7973.56.camel@edumazet-glaptop2.roam.corp.google.com>
On 13/05/14 17:13, Eric Dumazet wrote:
> On Tue, 2014-05-13 at 15:31 +0100, Zoltan Kiss wrote:
>> The original series for reintroducing grant mapping for netback had a patch [1]
>> to handle receiving of packets from an another VIF. Grant copy on the receiving
>> side needs the grant ref of the page to set up the op.
>> The original patch assumed (wrongly) that the frags array haven't changed. In
>> the case reported by Sander, the sending guest sent a packet where the linear
>> buffer and the first frag were under PKT_PROT_LEN (=128) bytes.
>> xenvif_tx_submit() then pulled up the linear area to 128 bytes, and ditched the
>> first frag. The receiving side had an off-by-one problem when gathered the grant
>> refs.
>> This patch fixes that by checking whether the actual frag's page pointer is the
>> same as the page in the original frag list. It can handle any kind of changes on
>> the original frags array, like:
>> - removing granted frags from the beginning or the end
>> - adding local pages to the frags list
>> To keep it optimized to the most common cases, it doesn't handle when the order
>> of the original frags changed. That would require ubuf to be reseted to the
>> beginning of the chain (skb_shinfo(skb)->destructor_arg), and reiterating
>> through the list every time.
>>
>> OPEN QUESTIONS:
>> - Is it a safe assumption that nothing changes the order of the original frags?
>> Removing them from the array or injecting new pages anywhere is not a problem.
>> - I used UINT_MAX as a kind of INVALID_GRANT_REF, however there is no such thing
>> in the grant mapping API. Should we codify this or is it better if we just
>> find another way to distinguish whether a frag is local or not?
>> - Should this fix go to David's net tree or directly to the mainline tree? Or
>> both?
>>
>> [1]: 3e2234: xen-netback: Handle foreign mapped pages on the guest RX path
>>
>> Reported-by: Sander Eikelenboom <linux@eikelenboom.it>
>> Signed-off-by: Zoltan Kiss <zoltan.kiss@citrix.com>
>> ---
>
>
> The 'cleanup' of stale ubufs should be right after __pskb_pull_tail().
We can't fix every place in the kernel where frags might be changed,
especially with a netback specific stuff, so unfortunately that won't work
>
> This is the function that can 'consume frags' after all.
>
> Its not clear that you catch all cases, like skbs being purged in case
> of device dismantle.
We need this list for two reason:
a) give back the pages to the sending guest (kfree/skb_copy_ubufs)
b) find out the grant refs when the skb is sent to another vif
b) is handled by this patch. For a) netback doesn't mind if granted
frags were removed and/or local ones were injected. It only needs to
give back the pages, it doesn't matter how the skb ended up.
The only other problematic point if frags are passed around between
skbs, I'll write a separate mail about it.
>
> I am not saying your patch is wrong, only that it adds yet an obscure
> thing with no comments. In two years, nobody will understand this.
I agree, in v3 there will be more comment lines than actual new code :)
next prev parent reply other threads:[~2014-05-14 11:12 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-13 14:31 [PATCH net RFC] xen-netback: Fix grant ref resolution in RX path Zoltan Kiss
2014-05-13 15:47 ` Ian Campbell
2014-05-13 20:18 ` Zoltan Kiss
2014-05-13 16:13 ` Eric Dumazet
2014-05-13 19:25 ` Sander Eikelenboom
2014-05-14 8:32 ` Ian Campbell
2014-05-14 13:37 ` David Vrabel
2014-05-14 11:12 ` Zoltan Kiss [this message]
2014-05-14 11:35 ` Eric Dumazet
2014-05-14 13:25 ` Zoltan Kiss
2014-05-14 16:40 ` Ian Campbell
2014-05-14 17:28 ` Sander Eikelenboom
2014-05-14 18:44 ` Zoltan Kiss
2014-05-15 8:41 ` Ian Campbell
2014-05-15 8:31 ` Ian Campbell
2014-05-15 10:14 ` Zoltan Kiss
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=53734F9F.2010101@citrix.com \
--to=zoltan.kiss@citrix.com \
--cc=davem@davemloft.net \
--cc=david.vrabel@citrix.com \
--cc=eric.dumazet@gmail.com \
--cc=ian.campbell@citrix.com \
--cc=linux@eikelenboom.it \
--cc=netdev@vger.kernel.org \
--cc=paul.durrant@citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.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).