qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Fam Zheng <famz@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Stefan Hajnoczi <stefanha@gmail.com>,
	QEMU Devel Mailing List <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] A glib warning encountered with internal iothread
Date: Thu, 28 Sep 2017 10:43:27 +0800	[thread overview]
Message-ID: <20170928024327.GD17044@pxdev.xzpeter.org> (raw)
In-Reply-To: <49ed96f4-74e3-6e2b-72d1-0f6741ed2469@redhat.com>

On Wed, Sep 27, 2017 at 03:14:40PM +0200, Paolo Bonzini wrote:
> On 27/09/2017 14:36, Fam Zheng wrote:
> > On Wed, 09/27 13:17, Stefan Hajnoczi wrote:
> >> On Tue, Sep 26, 2017 at 07:13:43PM +0800, Fam Zheng wrote:
> >>> On Tue, 09/26 17:11, Peter Xu wrote:
> >>>  void aio_context_unref(AioContext *ctx)
> >>>  {
> >>> +    assert(ctx->refcnt > 0);
> >>> +    if (--ctx->refcnt == 0) {
> >>> +        aio_set_event_notifier(ctx, &ctx->notifier, false, NULL, NULL);
> >>> +    }
> >>
> >> This isn't a general solution because Linux AIO also has a file
> >> descriptor that is removed in aio_ctx_finalize().
> > 
> > Right. Another option is to move everything in aio_context_finalize() into the
> > "if (--ctx->refcnt == 0) { ... }" block, before calling g_source_unref().
> 
> I think I prefer Stefan's solution.  If the GSource has been ref'ed
> independent of the AioContext object, it may be a problem to free it early.

Stefan's patch works for me.  I'll put Stefan's patch into iothread
series and repost soon.

Thanks Stefan (and all)!

-- 
Peter Xu

      reply	other threads:[~2017-09-28  2:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-26  5:44 [Qemu-devel] A glib warning encountered with internal iothread Peter Xu
2017-09-26  8:43 ` Stefan Hajnoczi
2017-09-26  9:11   ` Peter Xu
2017-09-26 11:13     ` Fam Zheng
2017-09-27  4:09       ` Peter Xu
2017-09-27 12:17       ` Stefan Hajnoczi
2017-09-27 12:36         ` Fam Zheng
2017-09-27 13:14           ` Paolo Bonzini
2017-09-28  2:43             ` Peter Xu [this message]

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=20170928024327.GD17044@pxdev.xzpeter.org \
    --to=peterx@redhat.com \
    --cc=famz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    --cc=stefanha@redhat.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).