qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: zhukeqian <zhukeqian1@huawei.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: Re: 答复: [PATCH v1 2/2] system/cpus: Fix resume_all_vcpus() under vCPU hotplug condition
Date: Tue, 19 Mar 2024 10:25:32 +0100	[thread overview]
Message-ID: <5a997b02-207b-4d8d-b9e1-8c85ae468cfb@redhat.com> (raw)
In-Reply-To: <60ed0bd01fc346088f48bcce1c92a6d3@huawei.com>

On 19.03.24 06:11, zhukeqian wrote:
> 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.

Okay, got it. As just replied to #1, please see if you can avoid messing 
with pause_all_vcpus() by inhibiting KVM IOCTLs like KVM does. That 
would be preferable.

-- 
Cheers,

David / dhildenb



      reply	other threads:[~2024-03-19  9:25 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
2024-03-19  9:25       ` David Hildenbrand [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=5a997b02-207b-4d8d-b9e1-8c85ae468cfb@redhat.com \
    --to=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=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).