From: Peter Xu <peterx@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
qemu-devel@nongnu.org, "Stefan Hajnoczi" <stefanha@redhat.com>,
"Dr . David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v5 4/4] monitor: add lock to protect mon_fdsets
Date: Wed, 23 May 2018 16:52:08 +0800 [thread overview]
Message-ID: <20180523085208.GB2540@xz-mi> (raw)
In-Reply-To: <87fu2iix53.fsf@dusky.pond.sub.org>
On Wed, May 23, 2018 at 10:39:20AM +0200, Markus Armbruster wrote:
> Peter Xu <peterx@redhat.com> writes:
>
> > On Fri, May 18, 2018 at 02:27:00PM +0200, Markus Armbruster wrote:
> >> Peter Xu <peterx@redhat.com> writes:
> >>
> >> > On Thu, May 17, 2018 at 03:03:02PM +0200, Markus Armbruster wrote:
> >> >
> >> > [...]
> >> >
> >> >> > @@ -2502,7 +2525,9 @@ int monitor_fdset_get_fd(int64_t fdset_id, int flags)
> >> >> > MonFdset *mon_fdset;
> >> >> > MonFdsetFd *mon_fdset_fd;
> >> >> > int mon_fd_flags;
> >> >> > + int ret = -1;
> >> >>
> >> >> Suggest not to initialize ret, and instead ret = -1 on both failure
> >> >> paths.
> >> >
> >> > [1]
> >> >
> >> > But there is a third hidden failure path that we failed to find the fd
> >> > specified? In that case we still need that initial value.
> >>
> >> You're right. However, that failure path could be made explicit easily:
> >>
> >> QLIST_FOREACH(mon_fdset, &mon_fdsets, next) {
> >> [got out on error and on finding the right one...]
> >> }
> >> ret = -1;
> >> errno = ENOENT;
> >>
> >> out:
> >> qemu_mutex_unlock(&mon_fdsets_lock);
> >> return ret;
> >>
> >> I find this clearer. Your choice.
> >
> > Yes this works too. Considering that I just posted v6, I'll
> > temporarily just keep the old way.
>
> Your v6 raced with my review of v5. Do you intend to post v7? If not,
> I need to figure out what I can and want to do to v6 on commit to my
> tree.
I can repost v7 after we finish the discussion in the other thread:
[PATCH v5 3/4] monitor: more comments on lock-free fleids/funcs
Message-ID: <87muwqixla.fsf@dusky.pond.sub.org>
I think there is a comment to be refined, meanwhile I can at least
pick up the qemu_open() suggestion too.
Regards,
--
Peter Xu
prev parent reply other threads:[~2018-05-23 8:52 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-09 4:17 [Qemu-devel] [PATCH v5 0/4] monitor: let Monitor be thread safe Peter Xu
2018-05-09 4:17 ` [Qemu-devel] [PATCH v5 1/4] monitor: rename out_lock to mon_lock Peter Xu
2018-05-17 12:32 ` Markus Armbruster
2018-05-18 10:15 ` Peter Xu
2018-05-09 4:17 ` [Qemu-devel] [PATCH v5 2/4] monitor: protect mon->fds with mon_lock Peter Xu
2018-05-10 10:11 ` Stefan Hajnoczi
2018-05-17 12:47 ` Markus Armbruster
2018-05-09 4:17 ` [Qemu-devel] [PATCH v5 3/4] monitor: more comments on lock-free fleids/funcs Peter Xu
2018-05-10 10:12 ` Stefan Hajnoczi
2018-05-17 12:46 ` Markus Armbruster
2018-05-18 10:21 ` Peter Xu
2018-05-23 8:29 ` Markus Armbruster
2018-05-23 8:47 ` Peter Xu
2018-05-23 15:15 ` Markus Armbruster
2018-05-24 4:37 ` Peter Xu
2018-05-09 4:17 ` [Qemu-devel] [PATCH v5 4/4] monitor: add lock to protect mon_fdsets Peter Xu
2018-05-17 13:03 ` Markus Armbruster
2018-05-18 10:53 ` Peter Xu
2018-05-18 12:27 ` Markus Armbruster
2018-05-21 5:18 ` Peter Xu
2018-05-23 8:39 ` Markus Armbruster
2018-05-23 8:52 ` 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=20180523085208.GB2540@xz-mi \
--to=peterx@redhat.com \
--cc=armbru@redhat.com \
--cc=dgilbert@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=qemu-devel@nongnu.org \
--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).