From: David Vrabel <david.vrabel@citrix.com>
To: Wei Liu <wei.liu2@citrix.com>
Cc: <xen-devel@lists.xen.org>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>,
Ian Campbell <ian.campbell@citrix.com>, <netdev@vger.kernel.org>,
<msw@amazon.com>, <annie.li@oracle.com>
Subject: Re: [PATCH] xen-netback: count number required slots for an skb more carefully
Date: Wed, 4 Sep 2013 12:48:15 +0100 [thread overview]
Message-ID: <52271DFF.3070008@citrix.com> (raw)
In-Reply-To: <20130903215328.GA13465@zion.uk.xensource.com>
On 03/09/13 22:53, Wei Liu wrote:
> On Tue, Sep 03, 2013 at 06:29:50PM +0100, David Vrabel wrote:
>> From: David Vrabel <david.vrabel@citrix.com>
>>
>> When a VM is providing an iSCSI target and the LUN is used by the
>> backend domain, the generated skbs for direct I/O writes to the disk
>> have large, multi-page skb->data but no frags.
>>
>> With some lengths and starting offsets, xen_netbk_count_skb_slots()
>> would be one short because the simple calculation of
>> DIV_ROUND_UP(skb_headlen(), PAGE_SIZE) was not accounting for the
>> decisions made by start_new_rx_buffer() which does not guarantee
>> responses are fully packed.
>>
>> For example, a skb with length < 2 pages but which spans 3 pages would
>> be counted as requiring 2 slots but would actually use 3 slots.
>>
>> skb->data:
>>
>> | 1111|222222222222|3333 |
>>
>> Fully packed, this would need 2 slots:
>>
>> |111122222222|22223333 |
>>
>> But because the 2nd page wholy fits into a slot it is not split across
>> slots and goes into a slot of its own:
>>
>> |1111 |222222222222|3333 |
>>
>> Miscounting the number of slots means netback may push more responses
>> than the number of available requests. This will cause the frontend
>> to get very confused and report "Too many frags/slots". The frontend
>> never recovers and will eventually BUG.
>>
>> Fix this by counting the number of required slots more carefully. In
>> xen_netbk_count_skb_slots(), more closely follow the algorithm used by
>> xen_netbk_gop_skb() by introducing xen_netbk_count_frag_slots() which
>> is the dry-run equivalent of netbk_gop_frag_copy().
>>
>
> Phew! So this is backend miscounting bug. I thought it was a frontend
> bug so it didn't ring a bell when we had our face-to-face discussion,
> sorry. :-(
>
> This bug was discussed back in July among Annie, Matt, Ian and I. We
> finally agreed to take Matt's solution. Matt agreed to post final
> version within a week but obviously he's too busy to do so. I was away
> so I didn't follow closely. Eventually it fell through the crack. :-(
I think I prefer fixing the counting for backporting to stable kernels.
Xi's approach of packing the ring differently is a change in frontend
visible behaviour and seems more risky. e.g., possible performance
impact so I would like to see some performance analysis of that approach.
David
next prev parent reply other threads:[~2013-09-04 11:48 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-03 17:29 [PATCH] xen-netback: count number required slots for an skb more carefully David Vrabel
2013-09-03 21:53 ` Wei Liu
2013-09-04 2:25 ` annie li
2013-09-04 6:04 ` Matt Wilson
2013-09-04 6:56 ` [Xen-devel] " annie li
2013-09-04 7:38 ` Wei Liu
2013-09-04 8:06 ` annie li
2013-09-04 8:20 ` Wei Liu
2013-09-04 8:36 ` Ian Campbell
2013-09-04 8:41 ` Wei Liu
2013-09-04 11:48 ` David Vrabel [this message]
2013-09-04 12:41 ` [PATCH] " Ian Campbell
2013-09-04 13:35 ` Wei Liu
2013-09-09 9:20 ` Wei Liu
2013-09-04 13:14 ` Wei Liu
2013-09-04 14:02 ` David Vrabel
2013-09-04 15:44 ` Wei Liu
2013-09-05 10:12 ` David Vrabel
2013-09-05 10:27 ` Wei Liu
2013-09-04 18:48 ` David Miller
2013-09-05 7:35 ` Ian Campbell
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=52271DFF.3070008@citrix.com \
--to=david.vrabel@citrix.com \
--cc=annie.li@oracle.com \
--cc=boris.ostrovsky@oracle.com \
--cc=ian.campbell@citrix.com \
--cc=konrad.wilk@oracle.com \
--cc=msw@amazon.com \
--cc=netdev@vger.kernel.org \
--cc=wei.liu2@citrix.com \
--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).