diff mbox

[3/3] xen/arm: don't try to re-register vcpu_info on cpu_hotplug.

Message ID 1444844997-27314-3-git-send-email-stefano.stabellini@eu.citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Stefano Stabellini Oct. 14, 2015, 5:49 p.m. UTC
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 arch/arm/xen/enlighten.c |    6 ++++++
 1 file changed, 6 insertions(+)

Comments

Julien Grall Oct. 14, 2015, 10:32 p.m. UTC | #1
Hi Stefano,

On 14/10/2015 18:49, Stefano Stabellini wrote:
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> ---
>   arch/arm/xen/enlighten.c |    6 ++++++
>   1 file changed, 6 insertions(+)
>
> diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
> index 6c09cc4..59f5421 100644
> --- a/arch/arm/xen/enlighten.c
> +++ b/arch/arm/xen/enlighten.c
> @@ -93,6 +93,12 @@ static void xen_percpu_init(void)
>   	int err;
>   	int cpu = get_cpu();
>
> +	/* vcpu_info already registered, can happen with cpu-hotplug */

Can you please add more comment and explain in the commit message why 
this is necessary for cpu-hotplug?

I had to look at the x86 code to fully understand that it's not possible 
to call VCPUOP_register_vcpu_info twice because there is no hypercall to 
remove the vcpu shared page.


> +	if (per_cpu(xen_vcpu, cpu) != NULL) {
> +		put_cpu();
> +		return;
> +	}
> +
>   	pr_info("Xen: initializing cpu%d\n", cpu);
>   	vcpup = per_cpu_ptr(xen_vcpu_info, cpu);
>
>

Regards,
Stefano Stabellini Oct. 16, 2015, 3:31 p.m. UTC | #2
On Wed, 14 Oct 2015, Julien Grall wrote:
> Hi Stefano,
> 
> On 14/10/2015 18:49, Stefano Stabellini wrote:
> > Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> > ---
> >   arch/arm/xen/enlighten.c |    6 ++++++
> >   1 file changed, 6 insertions(+)
> > 
> > diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
> > index 6c09cc4..59f5421 100644
> > --- a/arch/arm/xen/enlighten.c
> > +++ b/arch/arm/xen/enlighten.c
> > @@ -93,6 +93,12 @@ static void xen_percpu_init(void)
> >   	int err;
> >   	int cpu = get_cpu();
> > 
> > +	/* vcpu_info already registered, can happen with cpu-hotplug */
> 
> Can you please add more comment and explain in the commit message why this is
> necessary for cpu-hotplug?
> 
> I had to look at the x86 code to fully understand that it's not possible to
> call VCPUOP_register_vcpu_info twice because there is no hypercall to remove
> the vcpu shared page.

Sure


> 
> > +	if (per_cpu(xen_vcpu, cpu) != NULL) {
> > +		put_cpu();
> > +		return;
> > +	}
> > +
> >   	pr_info("Xen: initializing cpu%d\n", cpu);
> >   	vcpup = per_cpu_ptr(xen_vcpu_info, cpu);
> > 
> > 
> 
> Regards,
> 
> -- 
> Julien Grall
>
diff mbox

Patch

diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index 6c09cc4..59f5421 100644
--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -93,6 +93,12 @@  static void xen_percpu_init(void)
 	int err;
 	int cpu = get_cpu();
 
+	/* vcpu_info already registered, can happen with cpu-hotplug */
+	if (per_cpu(xen_vcpu, cpu) != NULL) {
+		put_cpu();
+		return;
+	}
+
 	pr_info("Xen: initializing cpu%d\n", cpu);
 	vcpup = per_cpu_ptr(xen_vcpu_info, cpu);