From: Paolo Bonzini <pbonzini@redhat.com>
To: "bauerchen(陈蒙蒙)" <bauerchen@tencent.com>,
qemu-devel <qemu-devel@nongnu.org>
Subject: Re: Requesting review about a bugfix in touch_all_pages
Date: Mon, 6 Apr 2020 11:48:54 +0200 [thread overview]
Message-ID: <170eef43-9c08-4d68-78b1-85bc6eaf8f2c@redhat.com> (raw)
In-Reply-To: <cfc67cbb15584a25bf44b3a644f44abc@tencent.com>
On 06/04/20 05:13, bauerchen(陈蒙蒙) wrote:
>
> From faf903f7b8892179e64bd1a37fe3585a6441bc51 Mon Sep 17 00:00:00 2001
> From: Bauerchen <bauerchen@tencent.com>
> Date: Mon, 6 Apr 2020 10:36:54 +0800
> Subject: [PATCH] Fix: In touch_all_pages, maybe we need a lock to protect
> qemu_cond_boardcast, or qemu_cond_boardcast may be called before all touch
> page threads enter qemu_cond_wait. In this case, main thread waits touch
> page threads return, touch page threads wait main thread waking up, that is a
> dead lock ,vm will be in pause state forever;
>
> Signed-off-by: Bauerchen <bauerchen@tencent.com>
> ---
> util/oslib-posix.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/util/oslib-posix.c b/util/oslib-posix.c
> index 4dd6d7d..062236a 100644
> --- a/util/oslib-posix.c
> +++ b/util/oslib-posix.c
> @@ -492,8 +492,11 @@ static bool touch_all_pages(char *area, size_t hpagesize, size_t numpages,
> QEMU_THREAD_JOINABLE);
> addr += memset_thread[i].numpages * hpagesize;
> }
> +
> + qemu_mutex_lock(&page_mutex);
> threads_created_flag = true;
> qemu_cond_broadcast(&page_cond);
> + qemu_mutex_unlock(&page_mutex);
>
> for (i = 0; i < memset_num_threads; i++) {
> qemu_thread_join(&memset_thread[i].pgthread);
> --
> 1.8.3.1
>
Queued, thanks.
Paolo
prev parent reply other threads:[~2020-04-06 10:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-06 3:13 Requesting review about a bugfix in touch_all_pages bauerchen(陈蒙蒙)
2020-04-06 9:48 ` Paolo Bonzini [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=170eef43-9c08-4d68-78b1-85bc6eaf8f2c@redhat.com \
--to=pbonzini@redhat.com \
--cc=bauerchen@tencent.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).