hvm: vmx/svm_cpu_up_prepare should be called only once
PATCH 1/1 hvm: vmx/svm_cpu_up_prepare should be called only once
These routines are first called via CPU_UP_PREPARE notifier by the BSP and then by the booting ASP from vmx_cpu_up()/_svm_cpu_up().
Avoid the unnecessary second call.
--- xen/arch/x86/hvm/svm/svm.c | 2 +- xen/arch/x86/hvm/vmx/vmcs.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
xen/arch/x86/hvm/svm/svm.c +1 -1
@@ -1538,7 +1538,7 @@ static int _svm_cpu_up(bool bsp)return -EINVAL ; } -if ( (rc =svm_cpu_up_prepare (cpu)) !=0 ) +if ( bsp && (rc =svm_cpu_up_prepare (cpu)) !=0 )return rc;write_efer (read_efer () |EFER_SVME );
xen/arch/x86/hvm/vmx/vmcs.c +1 -1
@@ -652,7 +652,7 @@ int vmx_cpu_up(void)INIT_LIST_HEAD (&this_cpu (active_vmcs_list)); -if ( (rc =vmx_cpu_up_prepare (cpu)) !=0 ) +if ( (cpu ==0 ) && (rc =vmx_cpu_up_prepare (cpu)) !=0 )return rc; switch ( __vmxon(this_cpu(vmxon_region)) )
Signature · 7 lines
1.8.3.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
xen/arch/x86/hvm/vmx/vmcs.c int vmx_cpu_up(void) · line 655
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 17.08.17 at 16:19, <[email protected]> wrote:
xen/arch/x86/hvm/vmx/vmcs.c +1
-1@@ -652,7 +652,7 @@ int vmx_cpu_up(void)INIT_LIST_HEAD (&this_cpu (active_vmcs_list)); -if ( (rc =vmx_cpu_up_prepare (cpu)) !=0 ) +if ( (cpu ==0 ) && (rc =vmx_cpu_up_prepare (cpu)) !=0 )
Let's please not introduce any further "CPU0 is always to BSP" assumptions - we ought to get to the point where CPU0 can be hot-unplugged and then hot-plugged again.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 5 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 17.08.17 at 16:19, <[email protected]> wrote:
xen/arch/x86/hvm/vmx/vmcs.c +0
-0@@ -652,7 +652,7 @@ int vmx_cpu_up(void)
Quoted 7 lines
xen/arch/x86/hvm/vmx/vmcs.c int vmx_cpu_up(void) · line 655
Quoted 4 lines
xen/arch/x86/hvm/vmx/vmcs.c +1
-1INIT_LIST_HEAD (&this_cpu (active_vmcs_list)); -if ( (rc =vmx_cpu_up_prepare (cpu)) !=0 ) +if ( (cpu ==0 ) && (rc =vmx_cpu_up_prepare (cpu)) !=0 )Let's please not introduce any further "CPU0 is always to BSP" assumptions - we ought to get to the point where CPU0 can be hot-unplugged and then hot-plugged again.
Pass bool bsp to (added) _vmx_cpu_up(), just like we do for SVM?
-boris
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 17.08.17 at 17:04, <[email protected]> wrote:
Quoted 7 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 17.08.17 at 16:19, <[email protected]> wrote:
xen/arch/x86/hvm/vmx/vmcs.c +0
-0@@ -652,7 +652,7 @@ int vmx_cpu_up(void)INIT_LIST_HEAD (&this_cpu (active_vmcs_list));
Quoted 7 lines
Quoted 5 lines
xen/arch/x86/hvm/vmx/vmcs.c int vmx_cpu_up(void) · line 655
Quoted 2 lines
xen/arch/x86/hvm/vmx/vmcs.c +1
-1-if ( (rc =vmx_cpu_up_prepare (cpu)) !=0 ) +if ( (cpu ==0 ) && (rc =vmx_cpu_up_prepare (cpu)) !=0 )Let's please not introduce any further "CPU0 is always to BSP" assumptions - we ought to get to the point where CPU0 can be hot-unplugged and then hot-plugged again.
Pass bool bsp to (added)
_vmx_cpu_up(), just like we do for SVM?
That's the best you can do, I suppose.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
xen/arch/x86/hvm/svm/svm.c static int _svm_cpu_up(bool bsp) · line 1542
Quoted 11 lines · Boris Ostrovsky
xen/arch/x86/hvm/svm/svm.c +1
-1@@ -1538,7 +1538,7 @@ static int _svm_cpu_up(bool bsp)return -EINVAL ; } -if ( (rc =svm_cpu_up_prepare (cpu)) !=0 ) +if ( bsp && (rc =svm_cpu_up_prepare (cpu)) !=0 )return rc;
Why not call svm_cpu_up_prepare(cpu) in the caller of the bsp path, dropping this clause entirely?
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel