From: "Alex Bennée" <alex.bennee@linaro.org>
To: Yohei Kojima <y-koj@outlook.jp>
Cc: "Markus Armbruster" <armbru@redhat.com>,
qemu-devel@nongnu.org, "Daniel P.Berrangé" <berrange@redhat.com>
Subject: Re: [PATCH v3 1/4] util: Add thread-safe qemu_strerror() function
Date: Thu, 06 Apr 2023 09:57:07 +0100 [thread overview]
Message-ID: <87mt3ljslb.fsf@linaro.org> (raw)
In-Reply-To: <TYZPR06MB5418A3EB07F30B8AEC1A28229D8F9@TYZPR06MB5418.apcprd06.prod.outlook.com>
Yohei Kojima <y-koj@outlook.jp> writes:
> On 2023/03/31 4:06, Markus Armbruster wrote:
>> Yohei Kojima <y-koj@outlook.jp> writes:
>>
>>> Add qemu_strerror() which follows the POSIX specification for
>>> strerror(). While strerror() is not guaranteed to be thread-safe, this
>>> function is thread-safe.
>>
>> Why not g_strerror()?
>>
>
> Because g_strerror() uses mutex in its implementation and there is a
> risk to occur the deadlock. If one thread enters g_strerror() (soon the
> mutex is locked), then another thread calls fork(), and the forked
> child process try to call g_strerror(), then deadlock occurs.
I think we should mention this avoids the deadlock in the commit
message. With that:
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
>
>>> This function is added to solve the following issue:
>>> https://gitlab.com/qemu-project/qemu/-/issues/416
>>
>> The issue even asks for it...
>>
>
> Originally yes, but Daniel told the deadlock (or a mutex starvation)
> risk for g_strerror() in the later discussion of the issue. Probably I
> should have mention that in the commit message or the cover letter.
>
>>> Signed-off-by: Yohei Kojima <y-koj@outlook.jp>
>>
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
next prev parent reply other threads:[~2023-04-06 8:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-30 17:07 [PATCH v3 0/4] util: Add thread-safe qemu_strerror() function Yohei Kojima
2023-03-30 17:13 ` [PATCH v3 1/4] " Yohei Kojima
2023-03-30 19:06 ` Markus Armbruster
2023-03-31 4:00 ` Yohei Kojima
2023-04-06 8:57 ` Alex Bennée [this message]
2023-04-06 12:39 ` Yohei Kojima
2023-03-30 17:13 ` [PATCH v3 2/4] linux-user: replace strerror() function to the thread safe qemu_strerror() Yohei Kojima
2023-03-30 17:13 ` [PATCH v3 3/4] accel: " Yohei Kojima
2023-03-30 17:13 ` [PATCH v3 4/4] target/i386: " Yohei Kojima
2023-04-02 9:57 ` [PATCH v3 0/4] util: Add thread-safe qemu_strerror() function Yohei Kojima
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=87mt3ljslb.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=y-koj@outlook.jp \
/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.