qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: zhukeqian via <qemu-devel@nongnu.org>
To: David Hildenbrand <david@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Peter Maydell <peter.maydell@linaro.org>,
	"Igor Mammedov" <imammedo@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Cc: "Wanghaibin (D)" <wanghaibin.wang@huawei.com>,
	yuzenghui <yuzenghui@huawei.com>,
	jiangkunkun <jiangkunkun@huawei.com>,
	Salil Mehta <salil.mehta@huawei.com>,
	Jonathan Cameron <jonathan.cameron@huawei.com>,
	"Zengtao (B)" <prime.zeng@hisilicon.com>
Subject: 答复: [PATCH v1 2/2] system/cpus: Fix resume_all_vcpus() under vCPU hotplug condition
Date: Tue, 19 Mar 2024 05:11:52 +0000	[thread overview]
Message-ID: <60ed0bd01fc346088f48bcce1c92a6d3@huawei.com> (raw)
In-Reply-To: <57c8506e-3f6a-4d1d-9720-c9b030781109@redhat.com>

Hi David,

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. 
>
I described the reason for this at patch 1.

>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.
>
When we add retry mechanism in pause_all_vcpus(), we can solve this problem. With the sematic unchanged for user, which means:
With bql, we can make sure all vcpus are paused after pause_all_vcpus() finish,  and all vcpus are resumed after resume_all_vcpus() finish.

Thanks,
Keqian

>
>
--
Cheers,

David / dhildenb


  reply	other threads:[~2024-03-19  5:12 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
2024-03-19  5:11     ` zhukeqian via [this message]
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=60ed0bd01fc346088f48bcce1c92a6d3@huawei.com \
    --to=qemu-devel@nongnu.org \
    --cc=david@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=jiangkunkun@huawei.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=peter.maydell@linaro.org \
    --cc=prime.zeng@hisilicon.com \
    --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).