From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Fei Li <fli@suse.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 5/5] Propagate qemu_thread_create's error to all callers to handle
Date: Tue, 4 Sep 2018 12:20:49 +0100 [thread overview]
Message-ID: <20180904112049.GE22349@redhat.com> (raw)
In-Reply-To: <20180904110822.12863-6-fli@suse.com>
On Tue, Sep 04, 2018 at 07:08:22PM +0800, Fei Li wrote:
> Let's propagate qemu_thread_create's error to make all callers check
> it. For those critical callers, just pass the &error_abort.
>
> Signed-off-by: Fei Li <fli@suse.com>
> ---
> cpus.c | 48 ++++++++++++++++++++++++++++++++++++++-------
> dump.c | 6 +++++-
> hw/misc/edu.c | 8 +++++++-
> hw/ppc/spapr_hcall.c | 9 ++++++++-
> hw/rdma/rdma_backend.c | 3 ++-
> hw/usb/ccid-card-emulated.c | 13 ++++++++++--
> io/task.c | 3 ++-
> iothread.c | 15 +++++++++-----
> migration/migration.c | 47 ++++++++++++++++++++++++++++++++------------
> migration/postcopy-ram.c | 11 ++++++++++-
> migration/ram.c | 32 ++++++++++++++++++++++++++----
> migration/savevm.c | 8 +++++++-
> tests/atomic_add-bench.c | 3 ++-
> tests/iothread.c | 2 +-
> tests/qht-bench.c | 3 ++-
> tests/rcutorture.c | 3 ++-
> tests/test-aio.c | 2 +-
> tests/test-rcu-list.c | 3 ++-
> ui/vnc-jobs.c | 11 +++++++++--
> util/compatfd.c | 8 +++++++-
> util/oslib-posix.c | 10 +++++++++-
> util/rcu.c | 3 ++-
> util/thread-pool.c | 4 +++-
> 23 files changed, 206 insertions(+), 49 deletions(-)
>
> diff --git a/cpus.c b/cpus.c
> index 41efddc218..24159af1e6 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -1904,6 +1904,7 @@ static void qemu_tcg_init_vcpu(CPUState *cpu, Error **errp)
> static QemuCond *single_tcg_halt_cond;
> static QemuThread *single_tcg_cpu_thread;
> static int tcg_region_inited;
> + Error *local_err = NULL;
>
> assert(tcg_enabled());
> /*
> @@ -1929,14 +1930,22 @@ static void qemu_tcg_init_vcpu(CPUState *cpu, Error **errp)
> cpu->cpu_index);
>
> qemu_thread_create(cpu->thread, thread_name, qemu_tcg_cpu_thread_fn,
> - cpu, QEMU_THREAD_JOINABLE);
> + cpu, QEMU_THREAD_JOINABLE, &local_err);
> + if (local_err) {
> + error_propagate(errp, local_err);
> + return;
> + }
Having to use a local error object & error_propagate calls is making this
patch larger than it needs.
I'd suggest changing qemu_thread_create() so that it returns a boolean,
so it can then do
if (!qemu_thread_create(cpu->thread, thread_name, qemu_tcg_cpu_thread_fn,
cpu, QEMU_THREAD_JOINABLE, errp) {
return;
}
avoiding the local error object & shortening the code.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
prev parent reply other threads:[~2018-09-04 11:20 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-04 11:08 [Qemu-devel] [PATCH 0/5] qemu_thread_create: propagate errors to callers to check Fei Li
2018-09-04 11:08 ` [Qemu-devel] [PATCH 1/5] Fix segmentation fault when qemu_signal_init fails Fei Li
2018-09-04 11:26 ` Daniel P. Berrangé
2018-09-05 4:17 ` Fei Li
2018-09-05 8:36 ` Daniel P. Berrangé
2018-09-05 11:20 ` Fei Li
2018-09-05 14:38 ` Fam Zheng
2018-09-06 6:31 ` Fei Li
2018-09-04 11:08 ` [Qemu-devel] [PATCH 2/5] ui/vnc.c: polish vnc_init_func Fei Li
2018-09-04 11:08 ` [Qemu-devel] [PATCH 3/5] qemu_init_vcpu: add a new Error paramater to propagate Fei Li
2018-09-04 11:22 ` Daniel P. Berrangé
2018-09-05 4:36 ` Fei Li
2018-09-05 17:15 ` Eric Blake
2018-09-06 6:52 ` Fei Li
2018-09-04 11:08 ` [Qemu-devel] [PATCH 4/5] qemu_thread_create: propagate the error to callers to check Fei Li
2018-09-04 11:18 ` Daniel P. Berrangé
2018-09-05 4:20 ` Fei Li
2018-09-04 11:08 ` [Qemu-devel] [PATCH 5/5] Propagate qemu_thread_create's error to all callers to handle Fei Li
2018-09-04 11:20 ` Daniel P. Berrangé [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=20180904112049.GE22349@redhat.com \
--to=berrange@redhat.com \
--cc=fli@suse.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 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).