2016-04-04 12:32:33

by Anna-Maria Behnsen

[permalink] [raw]
Subject: [PATCH] xen: Add comment for missing FROZEN notifier transitions

Xen guests do not offline/online CPUs during suspend/resume and
therefore FROZEN notifier transitions are not required. Add this
explanation as a comment in the code to get not confused why
CPU_TASKS_FROZEN masked transitions are not considered.

Cc: David Vrabel <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: [email protected]
Signed-off-by: Anna-Maria Gleixner <[email protected]>
---
arch/arm/xen/enlighten.c | 6 ++++++
arch/x86/xen/enlighten.c | 7 +++++++
drivers/xen/events/events_fifo.c | 6 ++++++
3 files changed, 19 insertions(+)

--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -213,6 +213,12 @@ static int xen_cpu_notification(struct n
unsigned long action,
void *hcpu)
{
+ /*
+ * Xen guests do not offline/online CPUs during
+ * suspend/resume, thus CPU_TASKS_FROZEN masked transitions
+ * are not considered.
+ */
+
switch (action) {
case CPU_STARTING:
xen_percpu_init();
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1788,6 +1788,13 @@ static int xen_hvm_cpu_notify(struct not
void *hcpu)
{
int cpu = (long)hcpu;
+
+ /*
+ * Xen guests do not offline/online CPUs during
+ * suspend/resume, thus CPU_TASKS_FROZEN masked transitions
+ * are not considered.
+ */
+
switch (action) {
case CPU_UP_PREPARE:
xen_vcpu_setup(cpu);
--- a/drivers/xen/events/events_fifo.c
+++ b/drivers/xen/events/events_fifo.c
@@ -425,6 +425,12 @@ static int evtchn_fifo_cpu_notification(
int cpu = (long)hcpu;
int ret = 0;

+ /*
+ * Xen guests do not offline/online CPUs during
+ * suspend/resume, thus CPU_TASKS_FROZEN masked transitions
+ * are not considered.
+ */
+
switch (action) {
case CPU_UP_PREPARE:
if (!per_cpu(cpu_control_block, cpu))


2016-04-04 16:21:50

by Julien Grall

[permalink] [raw]
Subject: Re: [Xen-devel] [PATCH] xen: Add comment for missing FROZEN notifier transitions

(CC Stefano new e-mail address)

Hello Anna-Maria,

On 04/04/2016 13:32, Anna-Maria Gleixner wrote:
> Xen guests do not offline/online CPUs during suspend/resume and
> therefore FROZEN notifier transitions are not required. Add this
> explanation as a comment in the code to get not confused why
> CPU_TASKS_FROZEN masked transitions are not considered.
>
> Cc: David Vrabel <[email protected]>
> Cc: Stefano Stabellini <[email protected]>
> Cc: [email protected]
> Signed-off-by: Anna-Maria Gleixner <[email protected]>
> ---
> arch/arm/xen/enlighten.c | 6 ++++++
> arch/x86/xen/enlighten.c | 7 +++++++
> drivers/xen/events/events_fifo.c | 6 ++++++
> 3 files changed, 19 insertions(+)
>
> --- a/arch/arm/xen/enlighten.c
> +++ b/arch/arm/xen/enlighten.c
> @@ -213,6 +213,12 @@ static int xen_cpu_notification(struct n
> unsigned long action,
> void *hcpu)
> {
> + /*
> + * Xen guests do not offline/online CPUs during
> + * suspend/resume, thus CPU_TASKS_FROZEN masked transitions
> + * are not considered.
> + */
> +
> switch (action) {
> case CPU_STARTING:
> xen_percpu_init();
> --- a/arch/x86/xen/enlighten.c
> +++ b/arch/x86/xen/enlighten.c
> @@ -1788,6 +1788,13 @@ static int xen_hvm_cpu_notify(struct not
> void *hcpu)
> {
> int cpu = (long)hcpu;
> +
> + /*
> + * Xen guests do not offline/online CPUs during
> + * suspend/resume, thus CPU_TASKS_FROZEN masked transitions
> + * are not considered.
> + */
> +
> switch (action) {
> case CPU_UP_PREPARE:
> xen_vcpu_setup(cpu);
> --- a/drivers/xen/events/events_fifo.c
> +++ b/drivers/xen/events/events_fifo.c
> @@ -425,6 +425,12 @@ static int evtchn_fifo_cpu_notification(
> int cpu = (long)hcpu;
> int ret = 0;
>
> + /*
> + * Xen guests do not offline/online CPUs during
> + * suspend/resume, thus CPU_TASKS_FROZEN masked transitions
> + * are not considered.
> + */

NIT: The '*' is not aligned with the others.

> +
> switch (action) {
> case CPU_UP_PREPARE:
> if (!per_cpu(cpu_control_block, cpu))
>

Regards,

--
Julien Grall

2016-04-04 16:32:24

by David Vrabel

[permalink] [raw]
Subject: Re: [Xen-devel] [PATCH] xen: Add comment for missing FROZEN notifier transitions

On 04/04/16 17:21, Julien Grall wrote:
> (CC Stefano new e-mail address)
>
> Hello Anna-Maria,
>
> On 04/04/2016 13:32, Anna-Maria Gleixner wrote:
>> Xen guests do not offline/online CPUs during suspend/resume and
>> therefore FROZEN notifier transitions are not required. Add this
>> explanation as a comment in the code to get not confused why
>> CPU_TASKS_FROZEN masked transitions are not considered.

Alternatively, these could be added even if they are not encountered.
This might be more future-proof but the documentation might be clearer.

Boris, Juergen, any opinion?

David>> --- a/drivers/xen/events/events_fifo.c
>> +++ b/drivers/xen/events/events_fifo.c
>> @@ -425,6 +425,12 @@ static int evtchn_fifo_cpu_notification(
>> int cpu = (long)hcpu;
>> int ret = 0;
>>
>> + /*
>> + * Xen guests do not offline/online CPUs during
>> + * suspend/resume, thus CPU_TASKS_FROZEN masked transitions
>> + * are not considered.
>> + */
>
> NIT: The '*' is not aligned with the others.

If this doesn't need any other changes, I'll fix this on commit.

David

2016-04-04 16:48:27

by Boris Ostrovsky

[permalink] [raw]
Subject: Re: [Xen-devel] [PATCH] xen: Add comment for missing FROZEN notifier transitions

On 04/04/2016 12:30 PM, David Vrabel wrote:
> On 04/04/16 17:21, Julien Grall wrote:
>> (CC Stefano new e-mail address)
>>
>> Hello Anna-Maria,
>>
>> On 04/04/2016 13:32, Anna-Maria Gleixner wrote:
>>> Xen guests do not offline/online CPUs during suspend/resume and
>>> therefore FROZEN notifier transitions are not required. Add this
>>> explanation as a comment in the code to get not confused why
>>> CPU_TASKS_FROZEN masked transitions are not considered.
> Alternatively, these could be added even if they are not encountered.
> This might be more future-proof but the documentation might be clearer.
>
> Boris, Juergen, any opinion?

Wouldn't the same comment need to be added to xen_hvm_cpu_notify()?


-boris


>
> David>> --- a/drivers/xen/events/events_fifo.c
>>> +++ b/drivers/xen/events/events_fifo.c
>>> @@ -425,6 +425,12 @@ static int evtchn_fifo_cpu_notification(
>>> int cpu = (long)hcpu;
>>> int ret = 0;
>>>
>>> + /*
>>> + * Xen guests do not offline/online CPUs during
>>> + * suspend/resume, thus CPU_TASKS_FROZEN masked transitions
>>> + * are not considered.
>>> + */
>> NIT: The '*' is not aligned with the others.
> If this doesn't need any other changes, I'll fix this on commit.
>
> David

2016-04-05 04:22:20

by Juergen Gross

[permalink] [raw]
Subject: Re: [Xen-devel] [PATCH] xen: Add comment for missing FROZEN notifier transitions

On 04/04/16 18:48, Boris Ostrovsky wrote:
> On 04/04/2016 12:30 PM, David Vrabel wrote:
>> On 04/04/16 17:21, Julien Grall wrote:
>>> (CC Stefano new e-mail address)
>>>
>>> Hello Anna-Maria,
>>>
>>> On 04/04/2016 13:32, Anna-Maria Gleixner wrote:
>>>> Xen guests do not offline/online CPUs during suspend/resume and
>>>> therefore FROZEN notifier transitions are not required. Add this
>>>> explanation as a comment in the code to get not confused why
>>>> CPU_TASKS_FROZEN masked transitions are not considered.
>> Alternatively, these could be added even if they are not encountered.
>> This might be more future-proof but the documentation might be clearer.
>>
>> Boris, Juergen, any opinion?

I'd rather do more than a comment:

Either mask CPU_TASKS_FROZEN from action if it really doesn't matter
whether the flag is set or not (which IMHO is the case here), or
BUG_ON(action & CPU_TASKS_FROZEN) if this really should never happen.

> Wouldn't the same comment need to be added to xen_hvm_cpu_notify()?

The patch of Anna-Maria does that.


Juergen

>
>
> -boris
>
>
>>
>> David>> --- a/drivers/xen/events/events_fifo.c
>>>> +++ b/drivers/xen/events/events_fifo.c
>>>> @@ -425,6 +425,12 @@ static int evtchn_fifo_cpu_notification(
>>>> int cpu = (long)hcpu;
>>>> int ret = 0;
>>>>
>>>> + /*
>>>> + * Xen guests do not offline/online CPUs during
>>>> + * suspend/resume, thus CPU_TASKS_FROZEN masked transitions
>>>> + * are not considered.
>>>> + */
>>> NIT: The '*' is not aligned with the others.
>> If this doesn't need any other changes, I'll fix this on commit.
>>
>> David
>
>

2016-04-06 13:09:57

by David Vrabel

[permalink] [raw]
Subject: Re: [Xen-devel] [PATCH] xen: Add comment for missing FROZEN notifier transitions

On 04/04/16 13:32, Anna-Maria Gleixner wrote:
> Xen guests do not offline/online CPUs during suspend/resume and
> therefore FROZEN notifier transitions are not required. Add this
> explanation as a comment in the code to get not confused why
> CPU_TASKS_FROZEN masked transitions are not considered.
>
> Cc: David Vrabel <[email protected]>
> Cc: Stefano Stabellini <[email protected]>
> Cc: [email protected]
> Signed-off-by: Anna-Maria Gleixner <[email protected]>
> ---
> arch/arm/xen/enlighten.c | 6 ++++++
> arch/x86/xen/enlighten.c | 7 +++++++
> drivers/xen/events/events_fifo.c | 6 ++++++
> 3 files changed, 19 insertions(+)
>
> --- a/arch/arm/xen/enlighten.c
> +++ b/arch/arm/xen/enlighten.c
> @@ -213,6 +213,12 @@ static int xen_cpu_notification(struct n
> unsigned long action,
> void *hcpu)
> {
> + /*
> + * Xen guests do not offline/online CPUs during
> + * suspend/resume, thus CPU_TASKS_FROZEN masked transitions
> + * are not considered.
> + */

This may not be true for arm guests.

David

2016-04-06 14:09:04

by Anna-Maria Behnsen

[permalink] [raw]
Subject: Re: [PREEMPT-RT] [Xen-devel] [PATCH] xen: Add comment for missing FROZEN notifier transitions

On Wed, 6 Apr 2016, David Vrabel wrote:

> On 04/04/16 13:32, Anna-Maria Gleixner wrote:
> > Xen guests do not offline/online CPUs during suspend/resume and
> > therefore FROZEN notifier transitions are not required. Add this
> > explanation as a comment in the code to get not confused why
> > CPU_TASKS_FROZEN masked transitions are not considered.
> >
> > Cc: David Vrabel <[email protected]>
> > Cc: Stefano Stabellini <[email protected]>
> > Cc: [email protected]
> > Signed-off-by: Anna-Maria Gleixner <[email protected]>
> > ---
> > arch/arm/xen/enlighten.c | 6 ++++++
> > arch/x86/xen/enlighten.c | 7 +++++++
> > drivers/xen/events/events_fifo.c | 6 ++++++
> > 3 files changed, 19 insertions(+)
> >
> > --- a/arch/arm/xen/enlighten.c
> > +++ b/arch/arm/xen/enlighten.c
> > @@ -213,6 +213,12 @@ static int xen_cpu_notification(struct n
> > unsigned long action,
> > void *hcpu)
> > {
> > + /*
> > + * Xen guests do not offline/online CPUs during
> > + * suspend/resume, thus CPU_TASKS_FROZEN masked transitions
> > + * are not considered.
> > + */
>
> This may not be true for arm guests.

Ok. Should the frozen transitions be handled the same way than the
corresponding non frozen transitions? If yes and if it doesn't matter
to mask action with ~CPU_TASKS_FROZEN in arch/x86/xen/enlighten.c and
drivers/xen/events/events_fifo.c like Juergen sugessts, I could change
the patch by masking action.

Anna-Maria

2016-04-06 23:52:43

by Stefano Stabellini

[permalink] [raw]
Subject: Re: [Xen-devel] [PATCH] xen: Add comment for missing FROZEN notifier transitions

On Tue, 5 Apr 2016, Juergen Gross wrote:
> On 04/04/16 18:48, Boris Ostrovsky wrote:
> > On 04/04/2016 12:30 PM, David Vrabel wrote:
> >> On 04/04/16 17:21, Julien Grall wrote:
> >>> (CC Stefano new e-mail address)
> >>>
> >>> Hello Anna-Maria,
> >>>
> >>> On 04/04/2016 13:32, Anna-Maria Gleixner wrote:
> >>>> Xen guests do not offline/online CPUs during suspend/resume and
> >>>> therefore FROZEN notifier transitions are not required. Add this
> >>>> explanation as a comment in the code to get not confused why
> >>>> CPU_TASKS_FROZEN masked transitions are not considered.
> >> Alternatively, these could be added even if they are not encountered.
> >> This might be more future-proof but the documentation might be clearer.
> >>
> >> Boris, Juergen, any opinion?
>
> I'd rather do more than a comment:
>
> Either mask CPU_TASKS_FROZEN from action if it really doesn't matter
> whether the flag is set or not (which IMHO is the case here), or
> BUG_ON(action & CPU_TASKS_FROZEN) if this really should never happen.

I agree

2016-04-06 23:53:58

by Stefano Stabellini

[permalink] [raw]
Subject: Re: [Xen-devel] [PATCH] xen: Add comment for missing FROZEN notifier transitions

On Wed, 6 Apr 2016, David Vrabel wrote:
> On 04/04/16 13:32, Anna-Maria Gleixner wrote:
> > Xen guests do not offline/online CPUs during suspend/resume and
> > therefore FROZEN notifier transitions are not required. Add this
> > explanation as a comment in the code to get not confused why
> > CPU_TASKS_FROZEN masked transitions are not considered.
> >
> > Cc: David Vrabel <[email protected]>
> > Cc: Stefano Stabellini <[email protected]>
> > Cc: [email protected]
> > Signed-off-by: Anna-Maria Gleixner <[email protected]>
> > ---
> > arch/arm/xen/enlighten.c | 6 ++++++
> > arch/x86/xen/enlighten.c | 7 +++++++
> > drivers/xen/events/events_fifo.c | 6 ++++++
> > 3 files changed, 19 insertions(+)
> >
> > --- a/arch/arm/xen/enlighten.c
> > +++ b/arch/arm/xen/enlighten.c
> > @@ -213,6 +213,12 @@ static int xen_cpu_notification(struct n
> > unsigned long action,
> > void *hcpu)
> > {
> > + /*
> > + * Xen guests do not offline/online CPUs during
> > + * suspend/resume, thus CPU_TASKS_FROZEN masked transitions
> > + * are not considered.
> > + */
>
> This may not be true for arm guests.

ARM guests behave like x86 PV guests in this regard. I expect the
comment to be appropriate for both archs or none.