qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Keqian Zhu <zhukeqian1@huawei.com>,
	qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>,
	Igor Mammedov <imammedo@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Cc: wanghaibin.wang@huawei.com, Zenghui Yu <yuzenghui@huawei.com>,
	jiangkunkun@huawei.com, salil.mehta@huawei.com
Subject: Re: [PATCH v1 2/2] system/cpus: Fix resume_all_vcpus() under vCPU hotplug condition
Date: Mon, 18 Mar 2024 11:14:30 +0100	[thread overview]
Message-ID: <57c8506e-3f6a-4d1d-9720-c9b030781109@redhat.com> (raw)
In-Reply-To: <20240317083704.23244-3-zhukeqian1@huawei.com>

On 17.03.24 09:37, Keqian Zhu via wrote:
> For vCPU being hotplugged, qemu_init_vcpu() is called. In this
> function, we set vcpu state as stopped, and then wait vcpu thread
> to be created.
> 
> As the vcpu state is stopped, it will inform us it has been created
> and then wait on halt_cond. After we has realized vcpu object, we
> will resume the vcpu thread.
> 
> However, during we wait vcpu thread to be created, the bql is
> unlocked, and other thread is allowed to call resume_all_vcpus(),
> which will resume the un-realized vcpu.
> 
> This fixes the issue by filter out un-realized vcpu during
> resume_all_vcpus().

Similar question: is there a reproducer?

How could we currently hotplug a VCPU, and while it is being created, 
see pause_all_vcpus()/resume_all_vcpus() getting claled.

If I am not getting this wrong, there seems to be some other mechanism 
missing that makes sure that this cannot happen. Dropping the BQL 
half-way through creating a VCPU might be the problem.

-- 
Cheers,

David / dhildenb



  reply	other threads:[~2024-03-18 10:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-17  8:37 [PATCH v1 0/2] Some fixes for pause and resume all vcpus Keqian Zhu via
2024-03-17  8:37 ` [PATCH v1 1/2] system/cpus: Fix pause_all_vcpus() under concurrent environment Keqian Zhu via
2024-03-18 10:10   ` David Hildenbrand
2024-03-19  5:06     ` 答复: " zhukeqian via
2024-03-19  9:24       ` David Hildenbrand
2024-03-19 13:23         ` David Hildenbrand
2024-03-19 14:23         ` Peter Maydell
2024-03-19 14:46           ` David Hildenbrand
2024-03-19 14:56             ` Peter Maydell
2024-03-17  8:37 ` [PATCH v1 2/2] system/cpus: Fix resume_all_vcpus() under vCPU hotplug condition Keqian Zhu via
2024-03-18 10:14   ` David Hildenbrand [this message]
2024-03-19  5:11     ` 答复: " zhukeqian via
2024-03-19  9:25       ` David Hildenbrand

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=57c8506e-3f6a-4d1d-9720-c9b030781109@redhat.com \
    --to=david@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=jiangkunkun@huawei.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=salil.mehta@huawei.com \
    --cc=stefanha@redhat.com \
    --cc=wanghaibin.wang@huawei.com \
    --cc=yuzenghui@huawei.com \
    --cc=zhukeqian1@huawei.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).