[PATCH 4/5] x86/xen: Don't register Xen IPIs when they aren't going to be used

David Woodhouse posted 5 patches 5 years, 1 month ago
There is a newer version of this series
[PATCH 4/5] x86/xen: Don't register Xen IPIs when they aren't going to be used
Posted by David Woodhouse 5 years, 1 month ago
From: David Woodhouse <dwmw@amazon.co.uk>

In the case where xen_have_vector_callback is false, we still register
the IPI vectors in xen_smp_intr_init() for the secondary CPUs even
though they aren't going to be used. Stop doing that.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
---
 arch/x86/xen/enlighten_hvm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/xen/enlighten_hvm.c b/arch/x86/xen/enlighten_hvm.c
index a1c07e0c888e..7a6ef517e81a 100644
--- a/arch/x86/xen/enlighten_hvm.c
+++ b/arch/x86/xen/enlighten_hvm.c
@@ -164,10 +164,10 @@ static int xen_cpu_up_prepare_hvm(unsigned int cpu)
 	else
 		per_cpu(xen_vcpu_id, cpu) = cpu;
 	rc = xen_vcpu_setup(cpu);
-	if (rc)
+	if (rc || !xen_have_vector_callback)
 		return rc;
 
-	if (xen_have_vector_callback && xen_feature(XENFEAT_hvm_safe_pvclock))
+	if (xen_feature(XENFEAT_hvm_safe_pvclock))
 		xen_setup_timer(cpu);
 
 	rc = xen_smp_intr_init(cpu);
-- 
2.26.2


Re: [PATCH 4/5] x86/xen: Don't register Xen IPIs when they aren't going to be used
Posted by boris.ostrovsky@oracle.com 5 years, 1 month ago
On 12/24/20 6:53 AM, David Woodhouse wrote:
> From: David Woodhouse <dwmw@amazon.co.uk>
>
> In the case where xen_have_vector_callback is false, we still register
> the IPI vectors in xen_smp_intr_init() for the secondary CPUs even
> though they aren't going to be used. Stop doing that.
>
> Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
> ---
>  arch/x86/xen/enlighten_hvm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/xen/enlighten_hvm.c b/arch/x86/xen/enlighten_hvm.c
> index a1c07e0c888e..7a6ef517e81a 100644
> --- a/arch/x86/xen/enlighten_hvm.c
> +++ b/arch/x86/xen/enlighten_hvm.c
> @@ -164,10 +164,10 @@ static int xen_cpu_up_prepare_hvm(unsigned int cpu)
>  	else
>  		per_cpu(xen_vcpu_id, cpu) = cpu;
>  	rc = xen_vcpu_setup(cpu);


Without vector callback we will not be calling xen_vcpu_setup(0) so why should we still call it here for APs?


-boris


> -	if (rc)
> +	if (rc || !xen_have_vector_callback)
>  		return rc;
>  
> -	if (xen_have_vector_callback && xen_feature(XENFEAT_hvm_safe_pvclock))
> +	if (xen_feature(XENFEAT_hvm_safe_pvclock))
>  		xen_setup_timer(cpu);
>  
>  	rc = xen_smp_intr_init(cpu);

Re: [PATCH 4/5] x86/xen: Don't register Xen IPIs when they aren't going to be used
Posted by David Woodhouse 5 years, 1 month ago
On Mon, 2021-01-04 at 11:50 -0500, boris.ostrovsky@oracle.com wrote:
> > diff --git a/arch/x86/xen/enlighten_hvm.c
> > b/arch/x86/xen/enlighten_hvm.c
> > index a1c07e0c888e..7a6ef517e81a 100644
> > --- a/arch/x86/xen/enlighten_hvm.c
> > +++ b/arch/x86/xen/enlighten_hvm.c
> > @@ -164,10 +164,10 @@ static int xen_cpu_up_prepare_hvm(unsigned
> > int cpu)
> >        else
> >                per_cpu(xen_vcpu_id, cpu) = cpu;
> >        rc = xen_vcpu_setup(cpu);
> 
> 
> Without vector callback we will not be calling xen_vcpu_setup(0) so
> why should we still call it here for APs?

Good point. I didn't spot that because it wasn't one of the things that
actually crashed. I'll stop it doing so and retest.