[Xen-devel] [PATCH] x86/guest/xen: only set HVM parameter on BSP

Wei Liu posted 1 patch 4 years, 2 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/xen tags/patchew/20200205180224.6525-1-wl@xen.org
xen/arch/x86/guest/xen/xen.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
[Xen-devel] [PATCH] x86/guest/xen: only set HVM parameter on BSP
Posted by Wei Liu 4 years, 2 months ago
There is no need for every CPU to set a guest property.

Signed-off-by: Wei Liu <wl@xen.org>
---
 xen/arch/x86/guest/xen/xen.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/guest/xen/xen.c b/xen/arch/x86/guest/xen/xen.c
index 1f868f2f8d..3cf8f667a1 100644
--- a/xen/arch/x86/guest/xen/xen.c
+++ b/xen/arch/x86/guest/xen/xen.c
@@ -206,11 +206,6 @@ static int init_evtchn(void)
 {
     static uint8_t evtchn_upcall_vector;
     int rc;
-    struct xen_hvm_param a = {
-        .domid = DOMID_SELF,
-        .index = HVM_PARAM_CALLBACK_IRQ,
-        .value = 1,
-    };
 
     if ( !evtchn_upcall_vector )
         alloc_direct_apic_vector(&evtchn_upcall_vector, xen_evtchn_upcall);
@@ -225,10 +220,19 @@ static int init_evtchn(void)
         return rc;
     }
 
-    /* Trick toolstack to think we are enlightened */
-    rc = xen_hypercall_hvm_op(HVMOP_set_param, &a);
-    if ( rc )
-        printk("Unable to set HVM_PARAM_CALLBACK_IRQ\n");
+    if ( smp_processor_id() == 0 )
+    {
+        struct xen_hvm_param a = {
+            .domid = DOMID_SELF,
+            .index = HVM_PARAM_CALLBACK_IRQ,
+            .value = 1,
+        };
+
+        /* Trick toolstack to think we are enlightened */
+        rc = xen_hypercall_hvm_op(HVMOP_set_param, &a);
+        if ( rc )
+            printk("Unable to set HVM_PARAM_CALLBACK_IRQ\n");
+    }
 
     return rc;
 }
-- 
2.20.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH] x86/guest/xen: only set HVM parameter on BSP
Posted by Roger Pau Monné 4 years, 2 months ago
On Wed, Feb 05, 2020 at 06:02:24PM +0000, Wei Liu wrote:
> There is no need for every CPU to set a guest property.
> 
> Signed-off-by: Wei Liu <wl@xen.org>

Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

I will send a patch shortly to introduce an IS_BSP macro, as it would
make the code clearer IMO.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH] x86/guest/xen: only set HVM parameter on BSP
Posted by Jan Beulich 4 years, 2 months ago
On 05.02.2020 19:02, Wei Liu wrote:
> There is no need for every CPU to set a guest property.
> 

Suggested-by: Roger?

> Signed-off-by: Wei Liu <wl@xen.org>

Reviewed-by: Jan Beulich <jbeulich@suse.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel