* Use domain_vcpu() rather than opencoding the lookup. Amongst other things,
domain_vcpu() is spectre-v1-safe.
* Unlock the domain immediately after arch_set_info_guest() completes. There
is no need for free_vcpu_guest_context() to be within the critical region,
and moving the call simplifies the error case.
No practical change in functionaltiy.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Julien Grall <julien.grall@arm.com>
---
xen/arch/arm/vpsci.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/xen/arch/arm/vpsci.c b/xen/arch/arm/vpsci.c
index 9f4e5b8..c1e250b 100644
--- a/xen/arch/arm/vpsci.c
+++ b/xen/arch/arm/vpsci.c
@@ -33,7 +33,7 @@ static int do_common_cpu_on(register_t target_cpu, register_t entry_point,
vcpuid = vaffinity_to_vcpuid(target_cpu);
- if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL )
+ if ( (v = domain_vcpu(d, vcpuid)) == NULL )
return PSCI_INVALID_PARAMETERS;
/* THUMB set is not allowed with 64-bit domain */
@@ -82,14 +82,12 @@ static int do_common_cpu_on(register_t target_cpu, register_t entry_point,
domain_lock(d);
rc = arch_set_info_guest(v, ctxt);
+ domain_unlock(d);
+
free_vcpu_guest_context(ctxt);
if ( rc < 0 )
- {
- domain_unlock(d);
return PSCI_DENIED;
- }
- domain_unlock(d);
vcpu_wake(v);
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
Hi Andrew, On 24/04/2019 19:10, Andrew Cooper wrote: > * Use domain_vcpu() rather than opencoding the lookup. Amongst other things, > domain_vcpu() is spectre-v1-safe. > * Unlock the domain immediately after arch_set_info_guest() completes. There > is no need for free_vcpu_guest_context() to be within the critical region, > and moving the call simplifies the error case. > > No practical change in functionaltiy. s/functionaltiy/functionality/ > > Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Julien Grall <julien.grall@arm.com> I will fix up the typo and queue it in my next-4.13 branch. Cheers, -- Julien Grall _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
© 2016 - 2026 Red Hat, Inc.