From: Markus Armbruster <armbru@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] qemu-error: remove dependency of stubs on monitor
Date: Mon, 24 Oct 2016 16:19:44 +0200 [thread overview]
Message-ID: <87ziltbzi7.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <477e068b-d445-2296-25c6-976be1e2e319@redhat.com> (Paolo Bonzini's message of "Mon, 24 Oct 2016 15:17:17 +0200")
Paolo Bonzini <pbonzini@redhat.com> writes:
> On 24/10/2016 15:08, Markus Armbruster wrote:
>> Paolo Bonzini <pbonzini@redhat.com> writes:
>>
>>> On 24/10/2016 12:34, Dr. David Alan Gilbert wrote:
>>>> * Paolo Bonzini (pbonzini@redhat.com) wrote:
>>>>> Leave the implementation of error_printf, error_printf_unless_qmp
>>>>> and error_vprintf to libqemustub.a and monitor.c, so that we can
>>>>> remove the monitor_printf and monitor_vprintf stubs.
>>>>>
>>>>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>>>>> ---
>>>>> This should help shutting up the vmstate unit tests.
>>>>
>>>> Why does this make it any easier than my patch?
>>>
>>>> You're still going to need to add something stub specific to turn
>>>> the output on and off.
>>>
>>> It makes it possible to override the functions independent of the rest
>>> of util/qemu-error.c. You can implement the functions in the test, simply as
>>>
>>> had_stderr_output = true;
>>>
>>> and then assert that had_stderr_output is false or true depending on the
>>> test.
>>
>> I buy that when I see a test using it :)
>
> Ok, so should I rewrite the test-vmstate patch to do this?
You need to rewrite an existing test or create a new one to demonstrate
your approach is worthwhile. Details are up to you.
>>> (It's also a useful starting point to fix the cur_mon race).
>>
>> Uh, the fix for the cur_mon race is making it thread-local, isn't it?
>
> Or just old-school mutex. There is monitor_lock, let's make it protect
> cur_mon.
cur_mon is semantically thread-local: it's non-null while we're
executing a monitor command. That's a property of the stack, thus the
thread. The fact that it's not actually thread-local now is a bug I
blame on inertia.
Further evidence: if a thread calls error_report(), it should honor
cur_mon *only* when *this* thread executes a monitor command. It should
not spew to some unrelated monitor just because some other thread
happens to execute a monitor command right now.
monitor_lock is different: it's for protecting data that's *shared*
among monitors, such as mon_list. I suspect it's not quite used that
way. But it should.
next prev parent reply other threads:[~2016-10-24 14:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-24 9:33 [Qemu-devel] [PATCH] qemu-error: remove dependency of stubs on monitor Paolo Bonzini
2016-10-24 10:34 ` Dr. David Alan Gilbert
2016-10-24 11:52 ` Paolo Bonzini
2016-10-24 13:08 ` Markus Armbruster
2016-10-24 13:17 ` Paolo Bonzini
2016-10-24 14:19 ` Markus Armbruster [this message]
2016-10-24 14:36 ` Paolo Bonzini
2016-10-24 13:19 ` Halil Pasic
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=87ziltbzi7.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=dgilbert@redhat.com \
--cc=pbonzini@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.