xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Wei Liu <wei.liu2@citrix.com>
Cc: Jan Beulich <JBeulich@suse.com>,
	Ian Campbell <Ian.Campbell@citrix.com>,
	"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [Xen-devel] [RFC PATCH V3 12/16] netback: multi-page ring support
Date: Tue, 31 Jan 2012 09:48:20 -0500	[thread overview]
Message-ID: <20120131144820.GE3244@phenom.dumpdata.com> (raw)
In-Reply-To: <1328016770.5553.87.camel@leeds.uk.xensource.com>

On Tue, Jan 31, 2012 at 01:32:50PM +0000, Wei Liu wrote:
> On Tue, 2012-01-31 at 13:24 +0000, Jan Beulich wrote:
> > >>> On 31.01.12 at 12:09, Wei Liu <wei.liu2@citrix.com> wrote:
> > > On Tue, 2012-01-31 at 09:01 +0000, Jan Beulich wrote:
> > >> >>> On 30.01.12 at 18:10, Wei Liu <wei.liu2@citrix.com> wrote:
> > >> > On Mon, 2012-01-30 at 16:35 +0000, Jan Beulich wrote:
> > >> >> >>> On 30.01.12 at 15:45, Wei Liu <wei.liu2@citrix.com> wrote:
> > >> >> > -int xenvif_map_frontend_rings(struct xenvif *vif,
> > >> >> > -			      grant_ref_t tx_ring_ref,
> > >> >> > -			      grant_ref_t rx_ring_ref)
> > >> >> > +int xenvif_map_frontend_rings(struct xen_comms *comms,
> > >> >> > +			      int domid,
> > >> >> > +			      unsigned long ring_ref[],
> > >> >> > +			      unsigned int  ring_ref_count)
> > >> >> >  {
> > >> >> > -	void *addr;
> > >> >> > -	struct xen_netif_tx_sring *txs;
> > >> >> > -	struct xen_netif_rx_sring *rxs;
> > >> >> > -
> > >> >> > -	int err = -ENOMEM;
> > >> >> > +	struct gnttab_map_grant_ref op[NETBK_MAX_RING_PAGES];
> > >> >> > +	unsigned int i;
> > >> >> > +	int err = 0;
> > >> >> >  
> > >> >> > -	err = xenbus_map_ring_valloc(xenvif_to_xenbus_device(vif),
> > >> >> > -				     tx_ring_ref, &addr);
> > >> >> 
> > >> >> Any reason why you don't just extend this function (in a prerequisite
> > >> >> patch) rather than open coding a common utility function (twice) here,
> > >> >> so that other backends (blkback!) can benefit later as well.
> > >> >> 
> > >> >> Jan
> > >> >> 
> > >> > 
> > >> > I'm mainly focusing on netback stuffs, so the code is slightly coupled
> > >> > with netback -- NETBK_MAX_RING_PAGES.
> > >> > 
> > >> > To extend xenbus_map_ring_valloc and make more generic, it requires
> > >> > setting a global maximum page number limits on rings, I think it will
> > >> > require further investigation and code refactor -- which I have no time
> > >> > to attend to at the moment. :-/
> > >> 
> > >> Why? You can simply pass in the number of pages, there's no need
> > >> for a global maximum.
> > >> 
> > > 
> > > I mean the gnttab_map_gran_ref array, it is statically allocated at the
> > > moment. Of course we can make it dynamically allocated, but why bother
> > > taking the risk of allocation failure.
> > 
> > There's so many other allocations, why would you worry about this
> > one.
> > 
> 
> IMHO, this is not a critical part of the code, so failing this one thus
> making all other pieces not workable is very strange.
> 
> > But of course you can undo what a recent change did, and then
> > subsequently someone else will have to clean up again after you.
> > I'm just asking to follow good programming practices and write
> > re-usable code where potential for re-use is obvious (after all,
> > multi-page block interface patches have been floating around for
> > much longer than yours for the net interface).
> > 
> 
> I understand your concern. If the changes required will not make this
> series longer and involves major changes in block interface, I'm happy
> to refactor the xenbus interface.

Please do. Patches are more than welcome to make it be more versatile.

  reply	other threads:[~2012-01-31 14:48 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-30 14:45 [RFC PATCH V3] Xen netback / netfront improvement Wei Liu
2012-01-30 14:45 ` [RFC PATCH V3 01/16] netback: page pool version 1 Wei Liu
2012-01-30 14:45 ` [RFC PATCH V3 02/16] netback: add module unload function Wei Liu
2012-01-30 14:45 ` [RFC PATCH V3 03/16] netback: switch to NAPI + kthread model Wei Liu
2012-01-30 14:45 ` [RFC PATCH V3 04/16] netback: switch to per-cpu scratch space Wei Liu
2012-01-30 16:49   ` Viral Mehta
2012-01-30 17:05     ` Wei Liu
2012-01-30 14:45 ` [RFC PATCH V3 05/16] netback: add module get/put operations along with vif connect/disconnect Wei Liu
2012-01-31 10:24   ` Ian Campbell
2012-01-31 10:39     ` Wei Liu
2012-01-30 14:45 ` [RFC PATCH V3 06/16] netback: melt xen_netbk into xenvif Wei Liu
2012-01-30 14:45 ` [RFC PATCH V3 07/16] netback: alter internal function/structure names Wei Liu
2012-01-30 14:45 ` [RFC PATCH V3 08/16] netback: remove unwanted notification generation during NAPI processing Wei Liu
2012-01-30 14:45 ` [RFC PATCH V3 09/16] netback: nuke xenvif_receive_skb Wei Liu
2012-01-30 14:45 ` [RFC PATCH V3 10/16] netback: rework of per-cpu scratch space Wei Liu
2012-01-30 21:53   ` Konrad Rzeszutek Wilk
2012-01-31 10:48     ` Wei Liu
2012-01-31  1:25   ` Eric Dumazet
2012-01-31 10:43     ` Wei Liu
2012-01-30 14:45 ` [RFC PATCH V3 11/16] netback: print alert and bail when scratch space is not available Wei Liu
2012-01-30 14:45 ` [RFC PATCH V3 12/16] netback: multi-page ring support Wei Liu
2012-01-30 16:35   ` [Xen-devel] " Jan Beulich
2012-01-30 17:10     ` Wei Liu
2012-01-31  9:01       ` Jan Beulich
2012-01-31 11:09         ` Wei Liu
2012-01-31 11:12           ` Ian Campbell
2012-01-31 13:24           ` Jan Beulich
2012-01-31 13:32             ` Wei Liu
2012-01-31 14:48               ` Konrad Rzeszutek Wilk [this message]
2012-01-30 14:45 ` [RFC PATCH V3 13/16] netback: stub for multi receive protocol support Wei Liu
2012-01-30 21:47   ` [Xen-devel] " Konrad Rzeszutek Wilk
2012-01-31 11:03     ` Wei Liu
2012-01-31 14:43       ` Konrad Rzeszutek Wilk
2012-01-30 14:45 ` [RFC PATCH V3 14/16] netback: split event channels support Wei Liu
2012-01-31 10:37   ` Ian Campbell
2012-01-31 11:57     ` Wei Liu
2012-01-30 14:45 ` [RFC PATCH V3 15/16] netfront: multi page ring support Wei Liu
2012-01-30 21:39   ` [Xen-devel] " Konrad Rzeszutek Wilk
2012-01-31  9:12     ` Ian Campbell
2012-01-31 11:17       ` Wei Liu
2012-01-31  9:53     ` Jan Beulich
2012-01-31 11:15       ` Wei Liu
2012-01-31 10:58     ` Wei Liu
2012-01-30 14:45 ` [RFC PATCH V3 16/16] netfront: split event channels support Wei Liu
2012-01-30 21:25   ` [Xen-devel] " Konrad Rzeszutek Wilk

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=20120131144820.GE3244@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=netdev@vger.kernel.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /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).