From: Wei Liu <wei.liu2@citrix.com>
To: David Vrabel <david.vrabel@citrix.com>
Cc: Annie Li <Annie.li@oracle.com>, <xen-devel@lists.xen.org>,
<netdev@vger.kernel.org>, <wei.liu2@citrix.com>,
<ian.campbell@citrix.com>
Subject: Re: [Xen-devel] [PATCH net-next] xen-netfront: clean up code in xennet_release_rx_bufs
Date: Wed, 15 Jan 2014 11:42:09 +0000 [thread overview]
Message-ID: <20140115114208.GK5698@zion.uk.xensource.com> (raw)
In-Reply-To: <52D66F11.204@citrix.com>
On Wed, Jan 15, 2014 at 11:20:49AM +0000, David Vrabel wrote:
> On 09/01/14 22:48, Annie Li wrote:
> > Current netfront only grants pages for grant copy, not for grant transfer, so
> > remove corresponding transfer code and add receiving copy code in
> > xennet_release_rx_bufs.
>
> While netfront only supports a copying backend, I don't see anything
> preventing the backend from retaining mappings to netfront's Rx buffers...
>
Correct.
> > Signed-off-by: Annie Li <Annie.li@oracle.com>
> > ---
> > drivers/net/xen-netfront.c | 60 ++-----------------------------------------
> > 1 files changed, 3 insertions(+), 57 deletions(-)
> >
> > diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
> > index e59acb1..692589e 100644
> > --- a/drivers/net/xen-netfront.c
> > +++ b/drivers/net/xen-netfront.c
> > @@ -1134,78 +1134,24 @@ static void xennet_release_tx_bufs(struct netfront_info *np)
> >
> > static void xennet_release_rx_bufs(struct netfront_info *np)
> > {
> [...]
> > - mfn = gnttab_end_foreign_transfer_ref(ref);
> > + gnttab_end_foreign_access_ref(ref, 0);
>
> ... the gnttab_end_foreign_access_ref() may then fail and...
>
Oh, I see. Andrew was actually referencing this function. Yes, it can
fail. Since he omitted "_ref" I looked at the other function when I
replied to him...
> > gnttab_release_grant_reference(&np->gref_rx_head, ref);
> > np->grant_rx_ref[id] = GRANT_INVALID_REF;
> [...]
> > + kfree_skb(skb);
>
> ... this could then potentially free pages that the backend still has
> mapped. If the pages are then reused, this would leak information to
> the backend.
>
> Since only a buggy backend would result in this, leaking the skbs and
> grant refs would be acceptable here. I would also print an error.
>
How about using gnttab_end_foreign_access. The deferred queue looks like
a right solution -- pending page won't get freed until gref is
quiescent.
Wei.
> While checking blkfront for how it handles this, it also doesn't appear
> to do the right thing either.
>
> David
next prev parent reply other threads:[~2014-01-15 11:42 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-09 22:48 [Xen-devel][PATCH net-next] xen-netfront: clean up code in xennet_release_rx_bufs Annie Li
2014-01-14 23:28 ` David Miller
2014-01-16 6:04 ` [Xen-devel] [PATCH " annie li
2014-01-15 10:07 ` [Xen-devel][PATCH " Wei Liu
2014-01-15 11:02 ` [Xen-devel] [PATCH " Andrew Bennieston
2014-01-15 11:14 ` Wei Liu
2014-01-15 14:15 ` annie li
2014-01-15 15:35 ` Andrew Bennieston
2014-01-15 11:20 ` David Vrabel
2014-01-15 11:42 ` Wei Liu [this message]
2014-01-15 11:52 ` David Vrabel
2014-01-15 14:17 ` annie li
2014-01-15 14:32 ` Wei Liu
2014-01-15 15:13 ` David Vrabel
2014-01-16 5:59 ` annie li
2014-01-15 14:16 ` annie li
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=20140115114208.GK5698@zion.uk.xensource.com \
--to=wei.liu2@citrix.com \
--cc=Annie.li@oracle.com \
--cc=david.vrabel@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=netdev@vger.kernel.org \
--cc=xen-devel@lists.xen.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).