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 v2 3/3] xen/arm: don't try to re-register vcpu_info on cpu_hotplug.
Date: Mon, 19 Oct 2015 11:27:30 +0100	[thread overview]
Message-ID: <5624C592.8000308@citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1510191109130.27957@kaball.uk.xensource.com>

On 19/10/15 11:10, Stefano Stabellini wrote:
> On Fri, 16 Oct 2015, Julien Grall wrote:
>> Hi Stefano,
>>
>> On 16/10/15 17:35, Stefano Stabellini wrote:
>>> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
>>> ---
>>>  arch/arm/xen/enlighten.c |   10 ++++++++++
>>>  1 file changed, 10 insertions(+)
>>>
>>> diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
>>> index 6c09cc4..b193811 100644
>>> --- a/arch/arm/xen/enlighten.c
>>> +++ b/arch/arm/xen/enlighten.c
>>> @@ -93,6 +93,16 @@ 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) {
>>> +		put_cpu();
>>> +		return;
>>> +	}
>>
>>
>> Not really related to this patch. By side effect this patch is also not
>> calling irq_percpu_enable.
>>
>> Looking around, all the caller of irq_percpu_enable will call
>> irq_percpu_disable when the CPU is dying. Is there any side effect to
>> not doing this?
> 
> Given that Xen won't inject any event irqs when a cpu is offline, I
> don't think there are any side effects.

I'm not talking about the behavior of Xen when the vCPU is down but any
side effect in Linux (i.e not re-enabling the IRQ or else).

All the other user of percpu IRQ is doing the call so there must be a
reason to do it.

Looking more closely to the code, the GIC driver will reset the vCPU
interface every time the vCPU is coming back online (see
gic_secondary_init).

Resetting the vCPU interface means all the PPIs will be disabled (see
gic_cpu_config). As the event channel IRQ is a PPI it won't be
re-enabled and the vCPU will never receive event channel.

So you have to re-enable this interrupt unconditionally. At the same
time, I'd like to see the irq_percpu_disable to match irq_percpu_enable
as the other users do.

Regards,

-- 
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>
Cc: xen-devel@lists.xensource.com, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 3/3] xen/arm: don't try to re-register vcpu_info on cpu_hotplug.
Date: Mon, 19 Oct 2015 11:27:30 +0100	[thread overview]
Message-ID: <5624C592.8000308@citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1510191109130.27957@kaball.uk.xensource.com>

On 19/10/15 11:10, Stefano Stabellini wrote:
> On Fri, 16 Oct 2015, Julien Grall wrote:
>> Hi Stefano,
>>
>> On 16/10/15 17:35, Stefano Stabellini wrote:
>>> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
>>> ---
>>>  arch/arm/xen/enlighten.c |   10 ++++++++++
>>>  1 file changed, 10 insertions(+)
>>>
>>> diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
>>> index 6c09cc4..b193811 100644
>>> --- a/arch/arm/xen/enlighten.c
>>> +++ b/arch/arm/xen/enlighten.c
>>> @@ -93,6 +93,16 @@ 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) {
>>> +		put_cpu();
>>> +		return;
>>> +	}
>>
>>
>> Not really related to this patch. By side effect this patch is also not
>> calling irq_percpu_enable.
>>
>> Looking around, all the caller of irq_percpu_enable will call
>> irq_percpu_disable when the CPU is dying. Is there any side effect to
>> not doing this?
> 
> Given that Xen won't inject any event irqs when a cpu is offline, I
> don't think there are any side effects.

I'm not talking about the behavior of Xen when the vCPU is down but any
side effect in Linux (i.e not re-enabling the IRQ or else).

All the other user of percpu IRQ is doing the call so there must be a
reason to do it.

Looking more closely to the code, the GIC driver will reset the vCPU
interface every time the vCPU is coming back online (see
gic_secondary_init).

Resetting the vCPU interface means all the PPIs will be disabled (see
gic_cpu_config). As the event channel IRQ is a PPI it won't be
re-enabled and the vCPU will never receive event channel.

So you have to re-enable this interrupt unconditionally. At the same
time, I'd like to see the irq_percpu_disable to match irq_percpu_enable
as the other users do.

Regards,

-- 
Julien Grall

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

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-16 16:33 [PATCH v2] xen,arm: enable cpu_hotplug Stefano Stabellini
2015-10-16 16:33 ` Stefano Stabellini
2015-10-16 16:34 ` [PATCH v2 1/3] xen/arm: Enable cpu_hotplug.c Stefano Stabellini
2015-10-16 16:34   ` Stefano Stabellini
2015-10-16 16:40   ` Julien Grall
2015-10-16 16:40     ` Julien Grall
2015-10-16 16:35 ` [PATCH v2 2/3] xen, cpu_hotplug: call device_offline instead of cpu_down Stefano Stabellini
2015-10-16 16:35   ` Stefano Stabellini
2015-10-16 16:35 ` [PATCH v2 3/3] xen/arm: don't try to re-register vcpu_info on cpu_hotplug Stefano Stabellini
2015-10-16 16:35   ` Stefano Stabellini
2015-10-16 16:49   ` Julien Grall
2015-10-16 16:49     ` Julien Grall
2015-10-19 10:10     ` Stefano Stabellini
2015-10-19 10:10       ` Stefano Stabellini
2015-10-19 10:27       ` Julien Grall [this message]
2015-10-19 10:27         ` Julien Grall
2015-10-19 16:50         ` Stefano Stabellini
2015-10-19 16:50           ` Stefano Stabellini

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=5624C592.8000308@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.