All of lore.kernel.org
 help / color / mirror / Atom feed
From: julien.grall@citrix.com (Julien Grall)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 3/3] xen/arm: don't try to re-register vcpu_info on cpu_hotplug.
Date: Mon, 19 Oct 2015 18:01:47 +0100	[thread overview]
Message-ID: <562521FB.10301@citrix.com> (raw)
In-Reply-To: <1445273735-15758-3-git-send-email-stefano.stabellini@eu.citrix.com>

Hi Stefano,

On 19/10/15 17:55, Stefano Stabellini wrote:
> diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
> index 6c09cc4..074b1a2 100644
> --- a/arch/arm/xen/enlighten.c
> +++ b/arch/arm/xen/enlighten.c
> @@ -93,6 +93,17 @@ static void xen_percpu_init(void)
>  	int err;
>  	int cpu = get_cpu();
>  
> +	/* 
> +	 * VCPUOP_register_vcpu_info cannot be called twice for the same
> +	 * vcpu, so if vcpu_info is already registered, just get out. This
> +	 * can happen with cpu-hotplug.
> +	 */
> +	if (per_cpu(xen_vcpu, cpu) != NULL) {
> +		enable_percpu_irq(xen_events_irq, 0);
> +		put_cpu();
> +		return;

I might be too picky, but this function can be reworked to avoid
duplicating the code. Something like:

if (per_cpu(xen_vcpu, cpu) != NULL)
  goto skip_register_vcpu;

> +	}
> +
>  	pr_info("Xen: initializing cpu%d\n", cpu);
>  	vcpup = per_cpu_ptr(xen_vcpu_info, cpu);
>  
> @@ -131,6 +142,9 @@ static int xen_cpu_notification(struct notifier_block *self,
>  	case CPU_STARTING:
>  		xen_percpu_init();
>  		break;
> +	case CPU_DYING:
> +		disable_percpu_irq(xen_events_irq);
> +		break;
>  	default:
>  		break;
>  	}
> 


-- 
Julien Grall

WARNING: multiple messages have this Message-ID (diff)
From: Julien Grall <julien.grall@citrix.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	xen-devel@lists.xensource.com
Cc: linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 3/3] xen/arm: don't try to re-register vcpu_info on cpu_hotplug.
Date: Mon, 19 Oct 2015 18:01:47 +0100	[thread overview]
Message-ID: <562521FB.10301@citrix.com> (raw)
In-Reply-To: <1445273735-15758-3-git-send-email-stefano.stabellini@eu.citrix.com>

Hi Stefano,

On 19/10/15 17:55, Stefano Stabellini wrote:
> diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
> index 6c09cc4..074b1a2 100644
> --- a/arch/arm/xen/enlighten.c
> +++ b/arch/arm/xen/enlighten.c
> @@ -93,6 +93,17 @@ static void xen_percpu_init(void)
>  	int err;
>  	int cpu = get_cpu();
>  
> +	/* 
> +	 * VCPUOP_register_vcpu_info cannot be called twice for the same
> +	 * vcpu, so if vcpu_info is already registered, just get out. This
> +	 * can happen with cpu-hotplug.
> +	 */
> +	if (per_cpu(xen_vcpu, cpu) != NULL) {
> +		enable_percpu_irq(xen_events_irq, 0);
> +		put_cpu();
> +		return;

I might be too picky, but this function can be reworked to avoid
duplicating the code. Something like:

if (per_cpu(xen_vcpu, cpu) != NULL)
  goto skip_register_vcpu;

> +	}
> +
>  	pr_info("Xen: initializing cpu%d\n", cpu);
>  	vcpup = per_cpu_ptr(xen_vcpu_info, cpu);
>  
> @@ -131,6 +142,9 @@ static int xen_cpu_notification(struct notifier_block *self,
>  	case CPU_STARTING:
>  		xen_percpu_init();
>  		break;
> +	case CPU_DYING:
> +		disable_percpu_irq(xen_events_irq);
> +		break;
>  	default:
>  		break;
>  	}
> 


-- 
Julien Grall

  reply	other threads:[~2015-10-19 17:01 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-19 16:54 [PATCH v3] xen,arm: enable cpu_hotplug Stefano Stabellini
2015-10-19 16:54 ` Stefano Stabellini
2015-10-19 16:55 ` [PATCH v3 1/3] xen/arm: Enable cpu_hotplug.c Stefano Stabellini
2015-10-19 16:55   ` Stefano Stabellini
2015-10-19 16:55 ` [PATCH v3 2/3] xen, cpu_hotplug: call device_offline instead of cpu_down Stefano Stabellini
2015-10-19 16:55   ` Stefano Stabellini
2015-10-19 18:24   ` Boris Ostrovsky
2015-10-19 18:24     ` Boris Ostrovsky
2015-10-20 10:28     ` Stefano Stabellini
2015-10-20 10:28       ` Stefano Stabellini
2015-10-20 12:55       ` Boris Ostrovsky
2015-10-20 12:55         ` Boris Ostrovsky
2015-10-19 16:55 ` [PATCH v3 3/3] xen/arm: don't try to re-register vcpu_info on cpu_hotplug Stefano Stabellini
2015-10-19 16:55   ` Stefano Stabellini
2015-10-19 17:01   ` Julien Grall [this message]
2015-10-19 17:01     ` Julien Grall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=562521FB.10301@citrix.com \
    --to=julien.grall@citrix.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.