All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marc-André Lureau" <marcandre.lureau@gmail.com>
To: Peter Xu <peterx@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>, QEMU <qemu-devel@nongnu.org>,
	Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 6/9] terminal3270: do not use backend timer sources
Date: Tue, 28 Aug 2018 12:40:19 +0200	[thread overview]
Message-ID: <CAJ+F1CLnBd_dfhdARaD-qzC5qhb-tw-ZMgBur9=2u9Bx_M31SQ@mail.gmail.com> (raw)
In-Reply-To: <20180828102051.GF4446@xz-x1>

Hi

On Tue, Aug 28, 2018 at 12:20 PM Peter Xu <peterx@redhat.com> wrote:
>
> On Tue, Aug 28, 2018 at 11:09:28AM +0200, Marc-André Lureau wrote:
> > Hi
> >
> > On Tue, Aug 28, 2018 at 5:52 AM Peter Xu <peterx@redhat.com> wrote:
> > >
> > > On Tue, Aug 28, 2018 at 12:23:19AM +0200, Marc-André Lureau wrote:
> > > > terminal3270 is uses the front-end side of the chardev. It shouldn't
> > > > create sources from backend side context. Fwiw, send_timing_mark_cb
> > > > calls qemu_chr_fe_write_all() which should be thread safe.
> > > >
> > > > This partially reverts changes from commit
> > > > 2c716ba1506769c9be2caa02f0f6d6e7c00f4304.
> > >
> > > I don't fully understand too on why "It shouldn't create sources from
> > > backend side context".  Could you explain a bit?
> >
> > A frontend shouldn't use a backend function, and doesn't have to use
> > the backend gmaincontext.
> >
> > >
> > > If you don't want the backend gcontext to be exposed to the frontend,
> > > IMHO the simplest thing is just to use the NULL gcontext in
> > > qemu_chr_timeout_add_ms() which is a one-liner change. I don't see
> > > much point on re-using the GSource tags since IMHO GSource pointer is
> > > always superior to the old tag system.
> >
> > Using the tag or the GSource * doesn't change much afaik.
>
> I did some convertions in the past year to convert tag -> GSource and
> that shows some differences when we want non-default gcontexts...
> Otherwise I won't bother. :)

It doesn't need a specific context here, does it?

>
> > Not only
> > this is not a hot path, but glib gmain code does create the tag on
> > attach anyway. You may be marginally faster on remove/detach by
> > avoiding one lookup.
> >
> > (btw, I think both tag and GSource* are as old)
>
> I am not strong on this, but my rule is that if I don't have explicit
> reason to change a code I keep it there.  Here I don't see an obvious
> reason to switch back to the tag things (not to mention that I still
> think GSource is better, always).

As I explained, you shouldn't use backend fonctions in the frontend,
and there is no reason to use the backend context. I try to keep all
the sources created around chardev under control, and this one is
incorrect imho.

Using g_timeout_add() is convenient, since it does all the work you do
manually by creating a source, setting callback, attaching, unref etc.
And it uses the default context, which is in general the right thing.

I can do all the manual work and keep the GSource* around, but I don't
think that helps in any way here.


>
> Thanks,
>
> --
> Peter Xu



-- 
Marc-André Lureau

  reply	other threads:[~2018-08-28 10:43 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-27 22:23 [Qemu-devel] [PATCH 0/9] chardev: various cleanups and improvements Marc-André Lureau
2018-08-27 22:23 ` [Qemu-devel] [PATCH 1/9] char.h: fix gtk-doc comment style Marc-André Lureau
2018-08-29 16:44   ` Daniel P. Berrangé
2018-08-30 14:38   ` Markus Armbruster
2018-08-27 22:23 ` [Qemu-devel] [PATCH 2/9] chardev: mark the calls that allow an implicit mux monitor Marc-André Lureau
2018-08-30 14:55   ` Markus Armbruster
2018-08-30 16:16     ` Marc-André Lureau
2018-08-27 22:23 ` [Qemu-devel] [PATCH 3/9] chardev: use a child source for qio input source Marc-André Lureau
2018-08-29 16:48   ` Daniel P. Berrangé
2019-04-04 15:18   ` KONRAD Frederic
2019-04-04 15:44     ` Marc-André Lureau
2019-04-04 15:49       ` KONRAD Frederic
2019-04-05  7:46         ` KONRAD Frederic
2019-04-05  7:46           ` KONRAD Frederic
2018-08-27 22:23 ` [Qemu-devel] [PATCH 4/9] char: update the mux hanlders in class callback Marc-André Lureau
2018-08-30 14:57   ` Markus Armbruster
2018-08-30 16:18     ` Marc-André Lureau
2018-08-31  6:14       ` Markus Armbruster
2018-08-27 22:23 ` [Qemu-devel] [PATCH 5/9] char-fe: set_handlers() needs an associted chardev Marc-André Lureau
2018-08-30 14:57   ` Markus Armbruster
2018-08-30 16:20     ` Marc-André Lureau
2018-08-27 22:23 ` [Qemu-devel] [PATCH 6/9] terminal3270: do not use backend timer sources Marc-André Lureau
2018-08-28  3:52   ` Peter Xu
2018-08-28  9:09     ` Marc-André Lureau
2018-08-28 10:20       ` Peter Xu
2018-08-28 10:40         ` Marc-André Lureau [this message]
2018-08-27 22:23 ` [Qemu-devel] [PATCH 7/9] chardev: add a note about frontend sources and context switch Marc-André Lureau
2018-08-27 22:23 ` [Qemu-devel] [PATCH 8/9] char-pty: remove check for connection on write Marc-André Lureau
2018-08-27 22:23 ` [Qemu-devel] [PATCH 9/9] char-pty: remove write_lock usage Marc-André Lureau

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='CAJ+F1CLnBd_dfhdARaD-qzC5qhb-tw-ZMgBur9=2u9Bx_M31SQ@mail.gmail.com' \
    --to=marcandre.lureau@gmail.com \
    --cc=armbru@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.