qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@gmail.com>
Cc: Cornelia Huck <cohuck@redhat.com>, QEMU <qemu-devel@nongnu.org>,
	Halil Pasic <pasic@linux.ibm.com>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	"open list:S390" <qemu-s390x@nongnu.org>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 3/6] terminal3270: do not use backend timer sources
Date: Mon, 11 Feb 2019 18:27:13 +0800	[thread overview]
Message-ID: <20190211102713.GG1011@xz-x1> (raw)
In-Reply-To: <CAJ+F1CJ_ND3u4jZTOJSbsS=ZwvzR-y9NYYkCX5HdoKDDRKwKvw@mail.gmail.com>

On Mon, Feb 11, 2019 at 10:57:01AM +0100, Marc-André Lureau wrote:
> Hi
> 
> On Mon, Feb 11, 2019 at 8:13 AM Peter Xu <peterx@redhat.com> wrote:
> >
> > On Thu, Feb 07, 2019 at 06:14:15PM +0100, Cornelia Huck wrote:
> > > On Wed,  6 Feb 2019 18:43:25 +0100
> > > Marc-André Lureau <marcandre.lureau@redhat.com> wrote:
> > >
> > > > terminal3270 uses the front-end side of the chardev. It shouldn't
> > > > create sources from backend side context (with backend
> > > > functions).
> > > >
> > > > send_timing_mark_cb calls qemu_chr_fe_write_all() which should be
> > > > thread safe.
> > > >
> > > > This partially reverts changes from commit
> > > > 2c716ba1506769c9be2caa02f0f6d6e7c00f4304.
> > > >
> > > > CC: Peter Xu <peterx@redhat.com>
> > > > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > > > ---
> > > >  hw/char/terminal3270.c | 15 ++++++---------
> > > >  1 file changed, 6 insertions(+), 9 deletions(-)
> > >
> > > I've verified that 3270 continues to work as before.
> > >
> > > Acked-by: Cornelia Huck <cohuck@redhat.com>
> >
> > A pure question: is it broken before this patch?
> 
> No
> 
> >
> > Asked since I don't understand this patch and what it tries to fix...
> 
> A front-end shouldn't use backend functions.
> 
> > E.g., in terminal_init(), qemu_chr_fe_set_handlers() is always passing
> > NULL as chardev context so AFAICT this patch changes nothing from
> > functional-wise for now.  Meanwhile, if we pass in some non-NULL into
> > it in the future, IMHO this patch would break it instead of fixing
> > anything... anything I've missed?
> >
> 
> If the frontend switches the context and creates timers with this
> context, it should do it without using the backend functions.

I see your point (assuming that concurrent writes are safe).  But IMHO
we should first discuss on how to fix the existing multi-threading
issues (since it's not really safe yet).  After all this patch offers
nothing real for us for now, and if one day we want to run the chardev
in a single thread again then this will just break again unnoticed.

Frankly speaking I don't think making the chardev to be completely
multi-threading is very attractive to me - chardevs are mostly slow,
otherwise imho better techniques should be used (e.g., virtio).  OOB
did that majorly for only isolating chardev IOs out of main thread so
that chardevs won't be blocked by other unpredictable behaviors (like
userfaults), but it still wants to keep the old code running with as
less change as possible.  For this we can discuss in the other
thread too for sure...

Thanks,

-- 
Peter Xu

  reply	other threads:[~2019-02-11 10:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-06 17:43 [Qemu-devel] [PATCH v2 0/6] chardev: various cleanups and improvements (resend) Marc-André Lureau
2019-02-06 17:43 ` [Qemu-devel] [PATCH v2 1/6] char: update the mux handlers in class callback Marc-André Lureau
2019-02-06 17:43 ` [Qemu-devel] [PATCH v2 2/6] char-fe: set_handlers() needs an associated chardev Marc-André Lureau
2019-02-06 17:43 ` [Qemu-devel] [PATCH v2 3/6] terminal3270: do not use backend timer sources Marc-André Lureau
2019-02-07 17:14   ` Cornelia Huck
2019-02-11  7:12     ` Peter Xu
2019-02-11  9:57       ` Marc-André Lureau
2019-02-11 10:27         ` Peter Xu [this message]
2019-02-11 10:35           ` Marc-André Lureau
2019-02-06 17:43 ` [Qemu-devel] [PATCH v2 4/6] chardev: add a note about frontend sources and context switch Marc-André Lureau
2019-02-06 17:43 ` [Qemu-devel] [PATCH v2 5/6] char-pty: remove the check for connection on write Marc-André Lureau
2019-02-06 17:43 ` [Qemu-devel] [PATCH v2 6/6] char-pty: remove write_lock usage Marc-André Lureau
2019-02-13 14:35 ` [Qemu-devel] [PATCH v2 0/6] chardev: various cleanups and improvements (resend) Paolo Bonzini

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=20190211102713.GG1011@xz-x1 \
    --to=peterx@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=marcandre.lureau@gmail.com \
    --cc=pasic@linux.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@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 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).