* [PATCH v2] hvm: vmx/svm_cpu_up_prepare should be called only once
@ 2017-08-17 16:51 Boris Ostrovsky
2017-08-17 18:07 ` Andrew Cooper
0 siblings, 1 reply; 3+ messages in thread
From: Boris Ostrovsky @ 2017-08-17 16:51 UTC (permalink / raw)
To: xen-devel
Cc: kevin.tian, suravee.suthikulpanit, andrew.cooper3, jbeulich,
jun.nakajima, Boris Ostrovsky
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.
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
V2:
* Call *cpu_up_prepare() on BSP from start_svm/vmx()
xen/arch/x86/hvm/svm/svm.c | 6 +-----
xen/arch/x86/hvm/vmx/vmcs.c | 3 ---
xen/arch/x86/hvm/vmx/vmx.c | 2 +-
3 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 0dc9442..2b51e4d 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -1526,7 +1526,6 @@ static int svm_handle_osvw(struct vcpu *v, uint32_t msr, uint64_t *val, bool_t r
static int _svm_cpu_up(bool bsp)
{
uint64_t msr_content;
- int rc;
unsigned int cpu = smp_processor_id();
const struct cpuinfo_x86 *c = &cpu_data[cpu];
@@ -1538,9 +1537,6 @@ static int _svm_cpu_up(bool bsp)
return -EINVAL;
}
- if ( (rc = svm_cpu_up_prepare(cpu)) != 0 )
- return rc;
-
write_efer(read_efer() | EFER_SVME);
/* Initialize the HSA for this core. */
@@ -1589,7 +1585,7 @@ const struct hvm_function_table * __init start_svm(void)
svm_host_osvw_reset();
- if ( _svm_cpu_up(true) )
+ if ( svm_cpu_up_prepare(smp_processor_id()) || _svm_cpu_up(true) )
{
printk("SVM: failed to initialise.\n");
return NULL;
diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 7854802..73b4731 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -652,9 +652,6 @@ int vmx_cpu_up(void)
INIT_LIST_HEAD(&this_cpu(active_vmcs_list));
- if ( (rc = vmx_cpu_up_prepare(cpu)) != 0 )
- return rc;
-
switch ( __vmxon(this_cpu(vmxon_region)) )
{
case -2: /* #UD or #GP */
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 67fc85b..f8c2d01 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2433,7 +2433,7 @@ const struct hvm_function_table * __init start_vmx(void)
{
set_in_cr4(X86_CR4_VMXE);
- if ( vmx_cpu_up() )
+ if ( vmx_cpu_up_prepare(smp_processor_id()) || vmx_cpu_up() )
{
printk("VMX: failed to initialise.\n");
return NULL;
--
1.8.3.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] hvm: vmx/svm_cpu_up_prepare should be called only once
2017-08-17 16:51 [PATCH v2] hvm: vmx/svm_cpu_up_prepare should be called only once Boris Ostrovsky
@ 2017-08-17 18:07 ` Andrew Cooper
2017-08-18 15:05 ` Boris Ostrovsky
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cooper @ 2017-08-17 18:07 UTC (permalink / raw)
To: Boris Ostrovsky, xen-devel
Cc: jun.nakajima, kevin.tian, suravee.suthikulpanit, jbeulich
On 17/08/17 17:51, Boris Ostrovsky wrote:
> @@ -1589,7 +1585,7 @@ const struct hvm_function_table * __init start_svm(void)
>
> svm_host_osvw_reset();
>
> - if ( _svm_cpu_up(true) )
> + if ( svm_cpu_up_prepare(smp_processor_id()) || _svm_cpu_up(true) )
Both of these could pass 0 rather than smp_processor_id(), but either
way, Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
> {
> printk("SVM: failed to initialise.\n");
> return NULL;
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] hvm: vmx/svm_cpu_up_prepare should be called only once
2017-08-17 18:07 ` Andrew Cooper
@ 2017-08-18 15:05 ` Boris Ostrovsky
0 siblings, 0 replies; 3+ messages in thread
From: Boris Ostrovsky @ 2017-08-18 15:05 UTC (permalink / raw)
To: Andrew Cooper, xen-devel
Cc: jun.nakajima, kevin.tian, suravee.suthikulpanit, jbeulich
On 08/17/2017 02:07 PM, Andrew Cooper wrote:
> On 17/08/17 17:51, Boris Ostrovsky wrote:
>> @@ -1589,7 +1585,7 @@ const struct hvm_function_table * __init start_svm(void)
>>
>> svm_host_osvw_reset();
>>
>> - if ( _svm_cpu_up(true) )
>> + if ( svm_cpu_up_prepare(smp_processor_id()) || _svm_cpu_up(true) )
> Both of these could pass 0 rather than smp_processor_id(), but either
> way, Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
This patch breaks VMX on Intel, let me rework it.
-boris
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-08-18 15:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-17 16:51 [PATCH v2] hvm: vmx/svm_cpu_up_prepare should be called only once Boris Ostrovsky
2017-08-17 18:07 ` Andrew Cooper
2017-08-18 15:05 ` Boris Ostrovsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).