2016-03-11 10:53:15

by Anna-Maria Behnsen

[permalink] [raw]
Subject: [PATCH 0/2] s390: Hotplug notifier transitions

The following patches fix missing error handling of hotplug notifier
transitions.

Thanks,
Anna-Maria

---
perf_cpum_cf.c | 1 +
perf_cpum_sf.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)




2016-03-11 10:53:27

by Anna-Maria Behnsen

[permalink] [raw]
Subject: [PATCH 1/2] s390/cpum_cf: Fix missing cpu hotplug notifier transition

The cpumf_pmu_notfier() hotplug callback lacks handling of the
CPU_DOWN_FAILED case. That means, if CPU_DOWN_PREPARE failes, the PMC
of the CPU is not setup again.

Add handling for CPU_DOWN_FAILED transition to setup the PMC of the
CPU.

Cc: Martin Schwidefsky <[email protected]>
Cc: Heiko Carstens <[email protected]>
Cc: [email protected]
Signed-off-by: Anna-Maria Gleixner <[email protected]>
---
arch/s390/kernel/perf_cpum_cf.c | 1 +
1 file changed, 1 insertion(+)

--- a/arch/s390/kernel/perf_cpum_cf.c
+++ b/arch/s390/kernel/perf_cpum_cf.c
@@ -670,6 +670,7 @@ static int cpumf_pmu_notifier(struct not

switch (action & ~CPU_TASKS_FROZEN) {
case CPU_ONLINE:
+ case CPU_DOWN_FAILED:
flags = PMC_INIT;
smp_call_function_single(cpu, setup_pmc_cpu, &flags, 1);
break;

2016-03-11 10:53:37

by Anna-Maria Behnsen

[permalink] [raw]
Subject: [PATCH 2/2] s390/cpum_sf: Fix cpu hotplug notifier transitions

The cpumf_pmu_notfier() hotplug callback lacks handling of the
CPU_DOWN_FAILED case. That means, if CPU_DOWN_PREPARE failes, the PMC
of the CPU is not setup again. Furthermore the CPU_ONLINE_FROZEN case
will never be processed because of masking the switch expression with
CPU_TASKS_FROZEN.

Add handling for CPU_DOWN_FAILED transition to setup the PMC of the
CPU. Remove CPU_ONLINE_FROZEN case.

Cc: Martin Schwidefsky <[email protected]>
Cc: Heiko Carstens <[email protected]>
Cc: [email protected]
Signed-off-by: Anna-Maria Gleixner <[email protected]>
---
arch/s390/kernel/perf_cpum_sf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/s390/kernel/perf_cpum_sf.c
+++ b/arch/s390/kernel/perf_cpum_sf.c
@@ -1518,7 +1518,7 @@ static int cpumf_pmu_notifier(struct not

switch (action & ~CPU_TASKS_FROZEN) {
case CPU_ONLINE:
- case CPU_ONLINE_FROZEN:
+ case CPU_DOWN_FAILED:
flags = PMC_INIT;
smp_call_function_single(cpu, setup_pmc_cpu, &flags, 1);
break;

2016-03-14 08:52:08

by Heiko Carstens

[permalink] [raw]
Subject: Re: [PATCH 2/2] s390/cpum_sf: Fix cpu hotplug notifier transitions

On Fri, Mar 11, 2016 at 11:52:38AM +0100, Anna-Maria Gleixner wrote:
> The cpumf_pmu_notfier() hotplug callback lacks handling of the
> CPU_DOWN_FAILED case. That means, if CPU_DOWN_PREPARE failes, the PMC
> of the CPU is not setup again. Furthermore the CPU_ONLINE_FROZEN case
> will never be processed because of masking the switch expression with
> CPU_TASKS_FROZEN.
>
> Add handling for CPU_DOWN_FAILED transition to setup the PMC of the
> CPU. Remove CPU_ONLINE_FROZEN case.
>
> Cc: Martin Schwidefsky <[email protected]>
> Cc: Heiko Carstens <[email protected]>
> Cc: [email protected]
> Signed-off-by: Anna-Maria Gleixner <[email protected]>
> ---
> arch/s390/kernel/perf_cpum_sf.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- a/arch/s390/kernel/perf_cpum_sf.c
> +++ b/arch/s390/kernel/perf_cpum_sf.c
> @@ -1518,7 +1518,7 @@ static int cpumf_pmu_notifier(struct not
>
> switch (action & ~CPU_TASKS_FROZEN) {
> case CPU_ONLINE:
> - case CPU_ONLINE_FROZEN:
> + case CPU_DOWN_FAILED:
> flags = PMC_INIT;
> smp_call_function_single(cpu, setup_pmc_cpu, &flags, 1);
> break;

This is a bit odd, but independent from your patch: setup_pmc_cpu() will
only deallocate buffers but not allocate them.

Looking at the code a bit further this seems to imply that sampling will
not work on cpus that were added later.

Hendrik, could you please have a look?

2016-03-14 14:44:57

by Hendrik Brueckner

[permalink] [raw]
Subject: Re: [PATCH 2/2] s390/cpum_sf: Fix cpu hotplug notifier transitions

On Mon, Mar 14, 2016 at 09:51:50AM +0100, Heiko Carstens wrote:
> On Fri, Mar 11, 2016 at 11:52:38AM +0100, Anna-Maria Gleixner wrote:
> > The cpumf_pmu_notfier() hotplug callback lacks handling of the
> > CPU_DOWN_FAILED case. That means, if CPU_DOWN_PREPARE failes, the PMC
> > of the CPU is not setup again. Furthermore the CPU_ONLINE_FROZEN case
> > will never be processed because of masking the switch expression with
> > CPU_TASKS_FROZEN.
> >
> > Add handling for CPU_DOWN_FAILED transition to setup the PMC of the
> > CPU. Remove CPU_ONLINE_FROZEN case.
> >
> > Cc: Martin Schwidefsky <[email protected]>
> > Cc: Heiko Carstens <[email protected]>
> > Cc: [email protected]
> > Signed-off-by: Anna-Maria Gleixner <[email protected]>
> > ---
> > arch/s390/kernel/perf_cpum_sf.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > --- a/arch/s390/kernel/perf_cpum_sf.c
> > +++ b/arch/s390/kernel/perf_cpum_sf.c
> > @@ -1518,7 +1518,7 @@ static int cpumf_pmu_notifier(struct not
> >
> > switch (action & ~CPU_TASKS_FROZEN) {
> > case CPU_ONLINE:
> > - case CPU_ONLINE_FROZEN:
> > + case CPU_DOWN_FAILED:

The change looks ok for me.

Acked-by: Hendrik Brueckner <[email protected]>

> > flags = PMC_INIT;
> > smp_call_function_single(cpu, setup_pmc_cpu, &flags, 1);
> > break;
>
> This is a bit odd, but independent from your patch: setup_pmc_cpu() will
> only deallocate buffers but not allocate them.

That's right. Allocation is done when an perf event is about to be scheduled
on a CPU.

>
> Looking at the code a bit further this seems to imply that sampling will
> not work on cpus that were added later.

That might be a problem for task-based perf events. I will have a closer
look into that issue.

Many thanks.

Kind regards,
Hendrik

2016-03-14 15:48:06

by Heiko Carstens

[permalink] [raw]
Subject: Re: [PATCH 0/2] s390: Hotplug notifier transitions

On Fri, Mar 11, 2016 at 11:52:36AM +0100, Anna-Maria Gleixner wrote:
> The following patches fix missing error handling of hotplug notifier
> transitions.
>
> Thanks,
> Anna-Maria
>
> ---
> perf_cpum_cf.c | 1 +
> perf_cpum_sf.c | 2 +-
> 2 files changed, 2 insertions(+), 1 deletion(-)

Applied, thanks!