qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: liu ping fan <qemulist@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Anthony Liguori <aliguori@us.ibm.com>,
	qemu-devel@nongnu.org, mdroth <mdroth@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [RFC PATCH v2 1/4] net: port tap onto glib
Date: Thu, 11 Apr 2013 11:09:11 +0200	[thread overview]
Message-ID: <20130411090911.GC8904@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <CAJnKYQkzH7QGYbaxkDcOrC56ayZorF177Gjn5_Mk-VV0rr2xCw@mail.gmail.com>

On Tue, Apr 09, 2013 at 01:12:39PM +0800, liu ping fan wrote:
> On Mon, Apr 8, 2013 at 7:44 PM, Stefan Hajnoczi <stefanha@gmail.com> wrote:
> > On Wed, Apr 03, 2013 at 05:28:39PM +0800, liu ping fan wrote:
> >> On Thu, Mar 28, 2013 at 10:32 PM, Stefan Hajnoczi <stefanha@gmail.com> wrote:
> >> > On Thu, Mar 28, 2013 at 03:55:52PM +0800, Liu Ping Fan wrote:
> >> >> From: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
> >> >>
> >> >> Bind each NetClientState with a GSource(ie,NetClientSource). Currently,
> >> >> these GSource attached with default context, but in future, after
> >> >> resolving the race between handlers and the interface exposed by NetClientInfo
> >> >> and other re-entrant issue,  we can run NetClientState on different threads
> >> >>
> >> >> Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
> >> >> ---
> >> >>  include/net/net.h |   27 +++++++++++++++
> >> >>  net/net.c         |   96 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> >> >>  net/tap.c         |   57 +++++++++++++++++++++++++------
> >> >>  3 files changed, 169 insertions(+), 11 deletions(-)
> >> >
> >> > Please split this into two patches:
> >> >
> >> > 1. NetClientSource
> >> > 2. Convert tap to NetClientSource
> >> >
> >> > Once you do that it turns out that NetClientSource has nothing to do
> >> > with the net subsystem, it's a generic file descriptor GSource (weird
> >> > that glib doesn't already provide this abstraction).
> >> >
> >> > Each net client needs to reimplement .bind_ctx() anyway, so I don't see
> >> > much point in having NetClientSource.nsrc[].  We might as well let net
> >> > clients have that field themselves and destroy the GSource in their
> >> > destructor function.
> >> >
> >> The only way to detach the GSource from GMainContext is
> >> g_source_destroy, so if we want to re-bind nc from threadA to threadB,
> >>  we should destroy the old one and create a new. Is that meaningful?
> >
> > I guess that can be done.
> >
> > What I was really thinking when I suggested getting rid of nsrc[] is
> > that it's a little ugly to have the array with 2 GSources.  Different
> > net clients have different numbers of GSources - 0 for NICs, 1 for most
> > backends, 2 for ioeventfd for virtio-net data plane with separate rx/tx.
> >
> > So my thought was to leave the number of GSources in the layer that uses
> > them - each specific net client.
> >
> OK, see. What about nsrc[0] at the end of struct or **nsrc ?

The net core code doesn't need to know about nsrc at all.  I think
nsrc[] should be dropped completely.  The net backends should manage
their GSource (if they need one).

Stefan

  reply	other threads:[~2013-04-11  9:09 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-28  7:55 [Qemu-devel] [RFC PATCH v2 0/4] port network layer onto glib Liu Ping Fan
2013-03-28  7:55 ` [Qemu-devel] [RFC PATCH v2 1/4] net: port tap " Liu Ping Fan
2013-03-28 14:32   ` Stefan Hajnoczi
2013-04-03  9:28     ` liu ping fan
2013-04-08 11:44       ` Stefan Hajnoczi
2013-04-09  5:12         ` liu ping fan
2013-04-11  9:09           ` Stefan Hajnoczi [this message]
2013-03-28  7:55 ` [Qemu-devel] [RFC PATCH v2 2/4] net: resolve race of tap backend and its peer Liu Ping Fan
2013-03-28 14:34   ` Stefan Hajnoczi
2013-03-29  7:21     ` liu ping fan
2013-03-29 14:38       ` Stefan Hajnoczi
2013-03-28  7:55 ` [Qemu-devel] [RFC PATCH v2 3/4] net: port hub onto glib Liu Ping Fan
2013-03-28 14:47   ` Stefan Hajnoczi
2013-03-29  7:21     ` liu ping fan
2013-03-28  7:55 ` [Qemu-devel] [RFC PATCH v2 4/4] net: port virtio net " Liu Ping Fan
2013-03-28  8:42 ` [Qemu-devel] [RFC PATCH v2 0/4] port network layer " Paolo Bonzini
2013-03-28 13:40   ` Stefan Hajnoczi
2013-04-02  9:49     ` liu ping fan
2013-04-08 11:46       ` Stefan Hajnoczi
2013-04-09  5:10         ` liu ping fan
2013-04-11  9:19           ` Stefan Hajnoczi
2013-03-28 14:55 ` Stefan Hajnoczi
2013-03-28 17:41   ` mdroth
2013-04-01  8:15   ` liu ping fan
2013-04-08 11:49     ` Stefan Hajnoczi
2013-04-09  5:10       ` liu ping fan

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=20130411090911.GC8904@stefanha-thinkpad.redhat.com \
    --to=stefanha@gmail.com \
    --cc=aliguori@us.ibm.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemulist@gmail.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).