From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Jeuk Kim" <jeuk20.kim@samsung.com>,
"Hanna Reitz" <hreitz@redhat.com>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Laurent Vivier" <lvivier@redhat.com>,
qemu-block@nongnu.org, "Kevin Wolf" <kwolf@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Thomas Huth" <thuth@redhat.com>, "Fam Zheng" <fam@euphon.net>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Fabiano Rosas" <farosas@suse.de>,
"Stefan Hajnoczi" <stefanha@redhat.com>
Subject: [PULL 1/5] iothread: Set the GSource "name" field
Date: Thu, 7 Sep 2023 14:16:24 -0400 [thread overview]
Message-ID: <20230907181628.1594401-2-stefanha@redhat.com> (raw)
In-Reply-To: <20230907181628.1594401-1-stefanha@redhat.com>
From: Fabiano Rosas <farosas@suse.de>
Having a name in the source helps with debugging core dumps when one
might not have access to TLS data to cross-reference AioContexts with
their addresses.
Signed-off-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20230905180359.14083-1-farosas@suse.de
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
iothread.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/iothread.c b/iothread.c
index b41c305bd9..b753286414 100644
--- a/iothread.c
+++ b/iothread.c
@@ -138,12 +138,14 @@ static void iothread_instance_finalize(Object *obj)
qemu_sem_destroy(&iothread->init_done_sem);
}
-static void iothread_init_gcontext(IOThread *iothread)
+static void iothread_init_gcontext(IOThread *iothread, const char *thread_name)
{
GSource *source;
+ g_autofree char *name = g_strdup_printf("%s aio-context", thread_name);
iothread->worker_context = g_main_context_new();
source = aio_get_g_source(iothread_get_aio_context(iothread));
+ g_source_set_name(source, name);
g_source_attach(source, iothread->worker_context);
g_source_unref(source);
iothread->main_loop = g_main_loop_new(iothread->worker_context, TRUE);
@@ -180,7 +182,7 @@ static void iothread_init(EventLoopBase *base, Error **errp)
{
Error *local_error = NULL;
IOThread *iothread = IOTHREAD(base);
- char *thread_name;
+ g_autofree char *thread_name = NULL;
iothread->stopping = false;
iothread->running = true;
@@ -189,11 +191,14 @@ static void iothread_init(EventLoopBase *base, Error **errp)
return;
}
+ thread_name = g_strdup_printf("IO %s",
+ object_get_canonical_path_component(OBJECT(base)));
+
/*
* Init one GMainContext for the iothread unconditionally, even if
* it's not used
*/
- iothread_init_gcontext(iothread);
+ iothread_init_gcontext(iothread, thread_name);
iothread_set_aio_context_params(base, &local_error);
if (local_error) {
@@ -206,11 +211,8 @@ static void iothread_init(EventLoopBase *base, Error **errp)
/* This assumes we are called from a thread with useful CPU affinity for us
* to inherit.
*/
- thread_name = g_strdup_printf("IO %s",
- object_get_canonical_path_component(OBJECT(base)));
qemu_thread_create(&iothread->thread, thread_name, iothread_run,
iothread, QEMU_THREAD_JOINABLE);
- g_free(thread_name);
/* Wait for initialization to complete */
while (iothread->thread_id == -1) {
--
2.41.0
next prev parent reply other threads:[~2023-09-07 18:17 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-07 18:16 [PULL 0/5] Block patches Stefan Hajnoczi
2023-09-07 18:16 ` Stefan Hajnoczi [this message]
2023-09-07 18:16 ` [PULL 2/5] hw/ufs: Initial commit for emulated Universal-Flash-Storage Stefan Hajnoczi
2023-09-07 18:16 ` [PULL 3/5] hw/ufs: Support for Query Transfer Requests Stefan Hajnoczi
2023-09-14 14:40 ` Peter Maydell
2023-09-14 22:28 ` Jeuk Kim
2023-09-07 18:16 ` [PULL 4/5] hw/ufs: Support for UFS logical unit Stefan Hajnoczi
2023-09-14 14:27 ` Peter Maydell
2023-09-14 14:47 ` Peter Maydell
2023-09-14 17:31 ` Paolo Bonzini
2023-09-14 22:19 ` Jeuk Kim
2023-09-15 7:59 ` Paolo Bonzini
2023-09-18 4:41 ` Jeuk Kim
2023-09-18 4:52 ` Jeuk Kim
2023-09-21 8:38 ` Jeuk Kim
2023-10-04 1:18 ` Ping: " Jeuk Kim
2023-09-07 18:16 ` [PULL 5/5] tests/qtest: Introduce tests for UFS Stefan Hajnoczi
2023-09-08 15:55 ` [PULL 0/5] Block patches Stefan Hajnoczi
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=20230907181628.1594401-2-stefanha@redhat.com \
--to=stefanha@redhat.com \
--cc=berrange@redhat.com \
--cc=fam@euphon.net \
--cc=farosas@suse.de \
--cc=hreitz@redhat.com \
--cc=jeuk20.kim@samsung.com \
--cc=kwolf@redhat.com \
--cc=lvivier@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=thuth@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).