Date: Tue, 18 Nov 2025 15:02:56 +0000 From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 55096ebddc15 - stable/15 - arm64/vmm: Move the vgic_max_cpu_count() check Message-ID: <691c8aa0.379aa.7d985f2a@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/15 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=55096ebddc1557b7f0e4cb294878fcc8621de37b commit 55096ebddc1557b7f0e4cb294878fcc8621de37b Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2025-11-04 16:58:25 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2025-11-18 14:57:42 +0000 arm64/vmm: Move the vgic_max_cpu_count() check vm_alloc_vcpu() is called quite frequently, and we don't need to apply the vgic limit unless we're actually allocating a vcpu structure for the first time. No functional change intended. Reviewed by: andrew MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D53580 (cherry picked from commit f3a7ed2047dffaebbfbb3920e993e9df424be728) --- sys/arm64/vmm/vmm.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/arm64/vmm/vmm.c b/sys/arm64/vmm/vmm.c index dfaba058e205..5225b995a75d 100644 --- a/sys/arm64/vmm/vmm.c +++ b/sys/arm64/vmm/vmm.c @@ -394,10 +394,6 @@ vm_alloc_vcpu(struct vm *vm, int vcpuid) if (vcpuid < 0 || vcpuid >= vm_get_maxcpus(vm)) return (NULL); - /* Some interrupt controllers may have a CPU limit */ - if (vcpuid >= vgic_max_cpu_count(vm->cookie)) - return (NULL); - vcpu = (struct vcpu *) atomic_load_acq_ptr((uintptr_t *)&vm->vcpu[vcpuid]); if (__predict_true(vcpu != NULL)) @@ -406,6 +402,12 @@ vm_alloc_vcpu(struct vm *vm, int vcpuid) sx_xlock(&vm->vcpus_init_lock); vcpu = vm->vcpu[vcpuid]; if (vcpu == NULL && !vm->dying) { + /* Some interrupt controllers may have a CPU limit */ + if (vcpuid >= vgic_max_cpu_count(vm->cookie)) { + sx_xunlock(&vm->vcpus_init_lock); + return (NULL); + } + vcpu = vcpu_alloc(vm, vcpuid); vcpu_init(vcpu);help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?691c8aa0.379aa.7d985f2a>
