From: Marc Zyngier <maz@kernel.org>
To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
kvm@vger.kernel.org
Cc: James Morse <james.morse@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Oliver Upton <oliver.upton@linux.dev>,
Zenghui Yu <yuzenghui@huawei.com>,
Joey Gouly <joey.gouly@arm.com>,
Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>,
Xu Zhao <zhaoxu.35@bytedance.com>,
Eric Auger <eric.auger@redhat.com>
Subject: [PATCH v3 06/11] KVM: arm64: Use vcpu_idx for invalidation tracking
Date: Wed, 27 Sep 2023 10:09:06 +0100 [thread overview]
Message-ID: <20230927090911.3355209-7-maz@kernel.org> (raw)
In-Reply-To: <20230927090911.3355209-1-maz@kernel.org>
While vcpu_id isn't necessarily a bad choice as an identifier for
the currently running vcpu, it is provided by userspace, and there
is close to no guarantee that it would be unique.
Switch it to vcpu_idx instead, for which we have much stronger
guarantees.
Reviewed-by: Zenghui Yu <yuzenghui@huawei.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
---
arch/arm64/kvm/arm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
index fa21fb15e927..9379a1227501 100644
--- a/arch/arm64/kvm/arm.c
+++ b/arch/arm64/kvm/arm.c
@@ -438,9 +438,9 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
* We might get preempted before the vCPU actually runs, but
* over-invalidation doesn't affect correctness.
*/
- if (*last_ran != vcpu->vcpu_id) {
+ if (*last_ran != vcpu->vcpu_idx) {
kvm_call_hyp(__kvm_flush_cpu_context, mmu);
- *last_ran = vcpu->vcpu_id;
+ *last_ran = vcpu->vcpu_idx;
}
vcpu->cpu = cpu;
--
2.34.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-09-27 9:10 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-27 9:09 [PATCH v3 00/11] KVM: arm64: Accelerate lookup of vcpus by MPIDR values (and other fixes) Marc Zyngier
2023-09-27 9:09 ` [PATCH v3 01/11] KVM: arm64: vgic: Make kvm_vgic_inject_irq() take a vcpu pointer Marc Zyngier
2023-09-27 9:09 ` [PATCH v3 02/11] KVM: arm64: vgic-its: Treat the collection target address as a vcpu_id Marc Zyngier
2023-09-27 9:09 ` [PATCH v3 03/11] KVM: arm64: vgic-v3: Refactor GICv3 SGI generation Marc Zyngier
2023-09-27 9:09 ` [PATCH v3 04/11] KVM: arm64: vgic-v2: Use cpuid from userspace as vcpu_id Marc Zyngier
2023-09-27 9:09 ` [PATCH v3 05/11] KVM: arm64: vgic: Use vcpu_idx for the debug information Marc Zyngier
2023-09-27 9:09 ` Marc Zyngier [this message]
2023-09-27 9:09 ` [PATCH v3 07/11] KVM: arm64: Simplify kvm_vcpu_get_mpidr_aff() Marc Zyngier
2023-09-27 9:09 ` [PATCH v3 08/11] KVM: arm64: Build MPIDR to vcpu index cache at runtime Marc Zyngier
2023-09-27 9:09 ` [PATCH v3 09/11] KVM: arm64: Fast-track kvm_mpidr_to_vcpu() when mpidr_data is available Marc Zyngier
2023-09-27 9:09 ` [PATCH v3 10/11] KVM: arm64: vgic-v3: Optimize affinity-based SGI injection Marc Zyngier
2023-09-27 9:09 ` [PATCH v3 11/11] KVM: arm64: Clarify the ordering requirements for vcpu/RD creation Marc Zyngier
2023-09-30 18:27 ` [PATCH v3 00/11] KVM: arm64: Accelerate lookup of vcpus by MPIDR values (and other fixes) Oliver Upton
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=20230927090911.3355209-7-maz@kernel.org \
--to=maz@kernel.org \
--cc=eric.auger@redhat.com \
--cc=james.morse@arm.com \
--cc=joey.gouly@arm.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=oliver.upton@linux.dev \
--cc=shameerali.kolothum.thodi@huawei.com \
--cc=suzuki.poulose@arm.com \
--cc=yuzenghui@huawei.com \
--cc=zhaoxu.35@bytedance.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).