mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Suzuki K Poulose <suzuki.poulose@arm.com>
To: Fuad Tabba <fuad.tabba@linux.dev>
Cc: Marc Zyngier <maz@kernel.org>, Oliver Upton <oupton@kernel.org>,
	Joey Gouly <joey.gouly@arm.com>,
	Steffen Eiden <seiden@linux.ibm.com>,
	Zenghui Yu <yuzenghui@huawei.com>, Will Deacon <will@kernel.org>,
	Lorenzo Stoakes <ljs@kernel.org>,
	Jack Thomson <jackabt@amazon.com>,
	Congkai Tan <congkai@amazon.com>,
	kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 1/2] KVM: arm64: Clear the VM's feature bitmap when kvm_setup_vcpu() fails
Date: Mon, 2 Nov 2026 09:48:30 +0000	[thread overview]
Message-ID: <2458da32-5235-4dfb-a817-7557230b9885@arm.com> (raw)
In-Reply-To: <CA+EHjTwNSxBa8-_0Q6zmgqW0RGyVhpUU3xnFg3-sqqmsdL4s8A@mail.gmail.com>

On 02/11/2026 09:42, Fuad Tabba wrote:
> Hi Suzuki,
> 
> On Mon, 02 Nov 2026 09:24:15 +0000, Suzuki K Poulose
> <suzuki.poulose@arm.com> wrote:
> [...]
>>> diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
> [...]
>>> @@ -1856,8 +1856,13 @@ static int __kvm_vcpu_set_target(struct kvm_vcpu *vcpu,
>>>           bitmap_copy(kvm->arch.vcpu_features, &features, KVM_VCPU_MAX_FEATURES);
>>>
>>>           ret = kvm_setup_vcpu(vcpu);
>>> -        if (ret)
>>> +        if (ret) {
>>> +                /* Clear the bitmap if setup fails on the first vCPU to be initialized. */
>>> +                if (!test_bit(KVM_ARCH_FLAG_VCPU_FEATURES_CONFIGURED, &kvm->arch.flags))
>>
>> Is this check necessary ? We go into kvm_setup_vcpu() only if the bit is
>> cleared and we do this under the config_lock mutex. The flag is only set
>> after we have finished the kvm_setup_vcpu() successfully, later down.
> 
> It is. An INIT on a second vCPU with the same features also calls
> kvm_setup_vcpu(), with the flag already set, and
> kvm_vcpu_init_nested() can return -ENOMEM there.


Sorry, my bad. I missed the second condition after the flag check
in.

Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>



/me Where's coffee!

> 
> Thanks,
> /fuad


  reply	other threads:[~2026-11-02  9:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02  7:58 [PATCH v4 0/2] KVM: arm64: Clear VM-wide state " Fuad Tabba
2026-11-02  7:58 ` [PATCH v4 1/2] KVM: arm64: Clear the VM's feature bitmap " Fuad Tabba
2026-11-02  9:24   ` Suzuki K Poulose
2026-11-02  9:42     ` Fuad Tabba
2026-11-02  9:48       ` Suzuki K Poulose [this message]
2026-11-02  7:58 ` [PATCH v4 2/2] KVM: arm64: Clear the default PMU " Fuad Tabba
2026-11-02  9:56   ` Suzuki K Poulose

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=2458da32-5235-4dfb-a817-7557230b9885@arm.com \
    --to=suzuki.poulose@arm.com \
    --cc=congkai@amazon.com \
    --cc=fuad.tabba@linux.dev \
    --cc=jackabt@amazon.com \
    --cc=joey.gouly@arm.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ljs@kernel.org \
    --cc=maz@kernel.org \
    --cc=oupton@kernel.org \
    --cc=seiden@linux.ibm.com \
    --cc=will@kernel.org \
    --cc=yuzenghui@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

all inboxes | Powered by JetHome®