|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] x86/guest: move allocation of Xen upcall vector to init code
commit 731c47684ff7de39405c2ed3affc5f043225e543
Author: Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Mon Nov 24 11:25:08 2025 +0100
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Nov 24 11:25:08 2025 +0100
x86/guest: move allocation of Xen upcall vector to init code
There's no need to do this every time init_evtchn() is called. Just do it
once when setting up CPU0. Drop the assertion as well, as
alloc_hipriority_vector() (called by alloc_direct_apic_vector()) uses more
restrictive BUG_ON() anyway. Then evtchn_upcall_vector can also validly
become ro-after-init, just that it needs to move out of init_evtchn().
While touching the function, add a comment why other seemingly-BSP code
can't move out of there (into e.g. an __init one).
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
xen/arch/x86/guest/xen/xen.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/xen/arch/x86/guest/xen/xen.c b/xen/arch/x86/guest/xen/xen.c
index 5c9f393c75..77a3a8742a 100644
--- a/xen/arch/x86/guest/xen/xen.c
+++ b/xen/arch/x86/guest/xen/xen.c
@@ -233,16 +233,12 @@ static void cf_check xen_evtchn_upcall(void)
ack_APIC_irq();
}
+static uint8_t __ro_after_init evtchn_upcall_vector;
+
static int init_evtchn(void)
{
- static uint8_t evtchn_upcall_vector;
int rc;
- if ( !evtchn_upcall_vector )
- alloc_direct_apic_vector(&evtchn_upcall_vector, xen_evtchn_upcall);
-
- ASSERT(evtchn_upcall_vector);
-
rc = xen_hypercall_set_evtchn_upcall_vector(this_cpu(vcpu_id),
evtchn_upcall_vector);
if ( rc )
@@ -251,6 +247,10 @@ static int init_evtchn(void)
return rc;
}
+ /*
+ * HVM_PARAM_CALLBACK_IRQ is not moved on migrate, so has to be set up
+ * again on resume.
+ */
if ( smp_processor_id() == 0 )
{
struct xen_hvm_param a = {
@@ -293,6 +293,8 @@ static void __init cf_check setup(void)
XEN_LEGACY_MAX_VCPUS);
}
+ alloc_direct_apic_vector(&evtchn_upcall_vector, xen_evtchn_upcall);
+
BUG_ON(init_evtchn());
}
--
generated by git-patchbot for /home/xen/git/xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |