From: Wei Liu Subject: Re: [PATCH net] xen-netback: fix guest-receive-side array sizes Date: Fri, 20 Dec 2013 18:08:51 +0000 Message-ID: <20131220180851.GL25969@zion.uk.xensource.com> References: <1387545367-30072-1-git-send-email-paul.durrant@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1387545367-30072-1-git-send-email-paul.durrant@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Paul Durrant Cc: David Vrabel , Wei Liu , Ian Campbell , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Fri, Dec 20, 2013 at 01:16:07PM +0000, Paul Durrant wrote: > The sizes chosen for the metadata and grant_copy_op arrays on the guest > receive size are wrong; > > - The meta array is needlessly twice the ring size, when we only ever > consume a single array element per RX ring slot This makes sense. > - The grant_copy_op array is way too small. It's sized based on a bogus > assumption: that at most two copy ops will be used per ring slot. This > may have been true at some point in the past but it's clear from looking > at start_new_rx_buffer() that a new ring slot is only consumed if a frag > would overflow the current slot (plus some other conditions) so the actual > limit is MAX_SKB_FRAGS grant_copy_ops per ring slot. > It takes me quite some time to get the idea straight. I think you're correct on this. This gigantic array makes me think if we should ditch the idea to consolidate data into a single slot, just to make all the counting in netback a bit easier to understand and less error-prone. We can instead use multiple page ring if the size of the ring becomes a problem. In any case switching the scheme is still just a vague thought and should be material for net-next so: Acked-by: Wei Liu Thanks Wei.