Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1390413 > unrolled thread

Re: [PATCH] cpu/hotplug: handle unbalanced hotplug enable/disable

Started byLianwei Wang <lianwei.wang@gmail.com>
First post2016-04-28 19:30 +0200
Last post2016-05-12 10:10 +0200
Articles 9 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] cpu/hotplug: handle unbalanced hotplug enable/disable Lianwei Wang <lianwei.wang@gmail.com> - 2016-04-28 19:30 +0200
    Re: [PATCH] cpu/hotplug: handle unbalanced hotplug enable/disable Thomas Gleixner <tglx@linutronix.de> - 2016-04-29 02:50 +0200
      Re: [PATCH] cpu/hotplug: handle unbalanced hotplug enable/disable Lianwei Wang <lianwei.wang@gmail.com> - 2016-04-29 23:50 +0200
        Re: [PATCH] cpu/hotplug: handle unbalanced hotplug enable/disable Thomas Gleixner <tglx@linutronix.de> - 2016-05-02 10:20 +0200
          Re: [PATCH] cpu/hotplug: handle unbalanced hotplug enable/disable Lianwei Wang <lianwei.wang@gmail.com> - 2016-05-04 09:30 +0200
            Re: [PATCH] cpu/hotplug: handle unbalanced hotplug enable/disable Thomas Gleixner <tglx@linutronix.de> - 2016-05-05 14:20 +0200
              Re: [PATCH] cpu/hotplug: handle unbalanced hotplug enable/disable Lianwei Wang <lianwei.wang@gmail.com> - 2016-05-06 09:10 +0200
                Re: [PATCH] cpu/hotplug: handle unbalanced hotplug enable/disable Thomas Gleixner <tglx@linutronix.de> - 2016-05-06 09:30 +0200
                  Re: [PATCH] cpu/hotplug: handle unbalanced hotplug enable/disable Lianwei Wang <lianwei.wang@gmail.com> - 2016-05-12 10:10 +0200

#1390413 — Re: [PATCH] cpu/hotplug: handle unbalanced hotplug enable/disable

FromLianwei Wang <lianwei.wang@gmail.com>
Date2016-04-28 19:30 +0200
SubjectRe: [PATCH] cpu/hotplug: handle unbalanced hotplug enable/disable
Message-ID<rsXVg-7D9-3@gated-at.bofh.it>
On Wed, Apr 27, 2016 at 11:15 PM, Thomas Gleixner <tglx@linutronix.de> wrote:
> On Wed, 27 Apr 2016, Lianwei Wang wrote:
>> Yes. In our project, there is a kernel driver which register a pm
>> notifier. On some conditions this pm notifier will return an error and
>> abort the suspend process. The counter will be unbalanced in case it
>> happened.
>
> So what? You wreckaged your driver, so you fix it and be done with it.

Do you mean no pm_notifier callback can return an error or NOTIFY_BAD
to abort the suspend process?

It's not the driver issue. The driver return an error to abort the
suspend process on purpose. Why do you think it is not allowed to
return an error to abort suspend?

The issue is very clear as described below.
1. How the issue happened?
One of the pm notifier return error to abort suspend before
cpu_hotplug_disable() is called on PM_SUSPEND_PREPARE.

2. What's the result?
CPU hotplug work in a wrong way, or it doesn't work anymore. No way to
recover it.

3. The root cause is that there is no any handling for the unbalanced
cpu_hotplug_disable/enable calling. This patch add a protection for
such issue.

Anything not clear?

[toc] | [next] | [standalone]


#1390678

FromThomas Gleixner <tglx@linutronix.de>
Date2016-04-29 02:50 +0200
Message-ID<rt4N4-57S-13@gated-at.bofh.it>
In reply to#1390413
On Thu, 28 Apr 2016, Lianwei Wang wrote:
> On Wed, Apr 27, 2016 at 11:15 PM, Thomas Gleixner <tglx@linutronix.de> wrote:
> > On Wed, 27 Apr 2016, Lianwei Wang wrote:
> >> Yes. In our project, there is a kernel driver which register a pm
> >> notifier. On some conditions this pm notifier will return an error and
> >> abort the suspend process. The counter will be unbalanced in case it
> >> happened.
> >
> > So what? You wreckaged your driver, so you fix it and be done with it.
> 
> Do you mean no pm_notifier callback can return an error or NOTIFY_BAD
> to abort the suspend process?
> 
> It's not the driver issue. The driver return an error to abort the
> suspend process on purpose. Why do you think it is not allowed to
> return an error to abort suspend?
> 
> The issue is very clear as described below.
> 1. How the issue happened?
> One of the pm notifier return error to abort suspend before
> cpu_hotplug_disable() is called on PM_SUSPEND_PREPARE.
> 
> 2. What's the result?
> CPU hotplug work in a wrong way, or it doesn't work anymore. No way to
> recover it.
> 
> 3. The root cause is that there is no any handling for the unbalanced
> cpu_hotplug_disable/enable calling. This patch add a protection for
> such issue.

Wrong. This is the symptom. The root cause is in #1. Therefor you are trying
to fix the symptom and not the root cause
 
> Anything not clear?

No. 

I completely understand that you are tyring to put the cart before the horse.

Thanks,

	tglx

[toc] | [prev] | [next] | [standalone]


#1391456

FromLianwei Wang <lianwei.wang@gmail.com>
Date2016-04-29 23:50 +0200
Message-ID<rtosp-4Cn-9@gated-at.bofh.it>
In reply to#1390678
On Thu, Apr 28, 2016 at 5:44 PM, Thomas Gleixner <tglx@linutronix.de> wrote:
> On Thu, 28 Apr 2016, Lianwei Wang wrote:
>> On Wed, Apr 27, 2016 at 11:15 PM, Thomas Gleixner <tglx@linutronix.de> wrote:
>> > On Wed, 27 Apr 2016, Lianwei Wang wrote:
>> >> Yes. In our project, there is a kernel driver which register a pm
>> >> notifier. On some conditions this pm notifier will return an error and
>> >> abort the suspend process. The counter will be unbalanced in case it
>> >> happened.
>> >
>> > So what? You wreckaged your driver, so you fix it and be done with it.
>>
>> Do you mean no pm_notifier callback can return an error or NOTIFY_BAD
>> to abort the suspend process?
>>
>> It's not the driver issue. The driver return an error to abort the
>> suspend process on purpose. Why do you think it is not allowed to
>> return an error to abort suspend?
>>
>> The issue is very clear as described below.
>> 1. How the issue happened?
>> One of the pm notifier return error to abort suspend before
>> cpu_hotplug_disable() is called on PM_SUSPEND_PREPARE.
>>
>> 2. What's the result?
>> CPU hotplug work in a wrong way, or it doesn't work anymore. No way to
>> recover it.
>>
>> 3. The root cause is that there is no any handling for the unbalanced
>> cpu_hotplug_disable/enable calling. This patch add a protection for
>> such issue.
>
> Wrong. This is the symptom. The root cause is in #1. Therefor you are trying
> to fix the symptom and not the root cause
>
I don't understand why you keep saying that the issue is in the pm
notifier callback. As I told you, the pm notifier return an error(or
NOTIFY_BAD) on purpose to abort the suspend process. This is work as
design. Any driver can abort the suspend process if it is not ready to
suspend.

I know your maintainers are busy but it is not hard for you to
understand it. If you did not look at the suspend code for a long time
then you can look at it now.

Below are some examples to return error to abort the suspend on
PM_SUSPEND_PREPARE pm notifier.
http://lxr.free-electrons.com/source/arch/x86/power/cpu.c#L290
http://lxr.free-electrons.com/source/arch/s390/kernel/suspend.c#L164
http://lxr.free-electrons.com/source/drivers/s390/cio/css.c#L840
http://lxr.free-electrons.com/source/drivers/devfreq/exynos/exynos5_bus.c#L202

>> Anything not clear?
>
> No.
>
> I completely understand that you are tyring to put the cart before the horse.
No. Your understanding is wrong.
>
> Thanks,
>
>         tglx

[toc] | [prev] | [next] | [standalone]


#1392053

FromThomas Gleixner <tglx@linutronix.de>
Date2016-05-02 10:20 +0200
Message-ID<ruhfc-8nf-17@gated-at.bofh.it>
In reply to#1391456
On Fri, 29 Apr 2016, Lianwei Wang wrote:
> On Thu, Apr 28, 2016 at 5:44 PM, Thomas Gleixner <tglx@linutronix.de> wrote:
> > Wrong. This is the symptom. The root cause is in #1. Therefor you are trying
> > to fix the symptom and not the root cause
> >
> I don't understand why you keep saying that the issue is in the pm
> notifier callback. As I told you, the pm notifier return an error(or
> NOTIFY_BAD) on purpose to abort the suspend process. This is work as
> design. Any driver can abort the suspend process if it is not ready to
> suspend.

Right. That's not the issue. The issue is that as a consequence we end up with
an unbalanced count. So how do we end up with an unbalanced count? That's what
needs to be fixed and not worked around.

> > I completely understand that you are tyring to put the cart before the horse.
> No. Your understanding is wrong.

My understanding is very correct. We have a situation which leads to an
unbalanced count. Instead of fixing that, you fix up the unbalanced count.

Thanks,

	tglx

[toc] | [prev] | [next] | [standalone]


#1394056

FromLianwei Wang <lianwei.wang@gmail.com>
Date2016-05-04 09:30 +0200
Message-ID<ruZpV-7Yn-31@gated-at.bofh.it>
In reply to#1392053
On Mon, May 2, 2016 at 1:11 AM, Thomas Gleixner <tglx@linutronix.de> wrote:
> On Fri, 29 Apr 2016, Lianwei Wang wrote:
>> On Thu, Apr 28, 2016 at 5:44 PM, Thomas Gleixner <tglx@linutronix.de> wrote:
>> > Wrong. This is the symptom. The root cause is in #1. Therefor you are trying
>> > to fix the symptom and not the root cause
>> >
>> I don't understand why you keep saying that the issue is in the pm
>> notifier callback. As I told you, the pm notifier return an error(or
>> NOTIFY_BAD) on purpose to abort the suspend process. This is work as
>> design. Any driver can abort the suspend process if it is not ready to
>> suspend.
>
> Right. That's not the issue. The issue is that as a consequence we end up with
> an unbalanced count. So how do we end up with an unbalanced count? That's what
> needs to be fixed and not worked around.
>
In this example, the unbalanced count is caused by the
cpu_hotplug_pm_callback pm notifier callback function. We can add a
variable to avoid the unbalanced call of cpu_hotplug_enable ,e.g.
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 3e3f6e49eabb..aa6694f0e9d3 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -1140,16 +1140,21 @@ static int
 cpu_hotplug_pm_callback(struct notifier_block *nb,
                        unsigned long action, void *ptr)
 {
+       static int disabled;
+
        switch (action) {

        case PM_SUSPEND_PREPARE:
        case PM_HIBERNATION_PREPARE:
                cpu_hotplug_disable();
+               disabled = 1;
                break;

        case PM_POST_SUSPEND:
        case PM_POST_HIBERNATION:
-               cpu_hotplug_enable();
+               if (disabled)
+                       cpu_hotplug_enable();
+               disabled = 0;
                break;

        default:

Please let me know if you like to fix it in this way.

But actually I think we don't need to add a new variable to check if
the cpu_hotplug_disable() is called or not. We already have a disable
counter which can be used to check if the cpu_hotpug_disable is called
or not, as my original patch do in cpu_hotplug_enable() function.
Maybe the reset comments and reset cpu_hotplug_disabled to 0 operation
confuse you. I should check it firstly and do nothing if it is already
0.
e.g.
+static void _cpu_hotplug_enable(void)
+{
+       if (WARN(!cpu_hotplug_disabled, "Unbalanced cpu hotplug enable\n"))
+               return;
+
+       cpu_hotplug_disabled--;
+}

I like to fix it in the cpu_hotplug_enable because it is a public
kernel API and fix in it can prevent any other unbalanced calling. I
will update the patch.

>> > I completely understand that you are tyring to put the cart before the horse.
>> No. Your understanding is wrong.
>
> My understanding is very correct. We have a situation which leads to an
> unbalanced count. Instead of fixing that, you fix up the unbalanced count.
>
Yes, that's right. We are on the same page. The only difference is
that where/how to fix it. See my two solutions above and let me know
which one you like?
> Thanks,
>
>         tglx

[toc] | [prev] | [next] | [standalone]


#1395066

FromThomas Gleixner <tglx@linutronix.de>
Date2016-05-05 14:20 +0200
Message-ID<rvqq6-8en-13@gated-at.bofh.it>
In reply to#1394056
On Wed, 4 May 2016, Lianwei Wang wrote:
> In this example, the unbalanced count is caused by the
> cpu_hotplug_pm_callback pm notifier callback function.

I doubt that.

> We can add a variable to avoid the unbalanced call of cpu_hotplug_enable
> ,e.g.

> diff --git a/kernel/cpu.c b/kernel/cpu.c
> index 3e3f6e49eabb..aa6694f0e9d3 100644
> --- a/kernel/cpu.c
> +++ b/kernel/cpu.c
> @@ -1140,16 +1140,21 @@ static int
>  cpu_hotplug_pm_callback(struct notifier_block *nb,
>                         unsigned long action, void *ptr)
>  {
> +       static int disabled;
> +
>         switch (action) {
> 
>         case PM_SUSPEND_PREPARE:
>         case PM_HIBERNATION_PREPARE:
>                 cpu_hotplug_disable();
> +               disabled = 1;
>                 break;
> 
>         case PM_POST_SUSPEND:
>         case PM_POST_HIBERNATION:
> -               cpu_hotplug_enable();
> +               if (disabled)
> +                       cpu_hotplug_enable();
> +               disabled = 0;
>                 break;
> 
>         default:
> 
> Please let me know if you like to fix it in this way.

So you are moving the work around one step down w/o providing any reasonable
explanation how this asymetric call of that callback can happen.

Can you eventually come up with a coherent explanation of the problem down to
the root cause or are we going to play this "move the workaround one step
down" game for another 10 rounds?
 
> +static void _cpu_hotplug_enable(void)
> +{
> +       if (WARN(!cpu_hotplug_disabled, "Unbalanced cpu hotplug enable\n"))
> +               return;
> +
> +       cpu_hotplug_disabled--;
> +}
> 
> I like to fix it in the cpu_hotplug_enable because it is a public

You CANNOT fix it there. The problem is the call site and NOT
cpu_hotplug_enable(). Can you finally accept this?

> kernel API and fix in it can prevent any other unbalanced calling. I

It cannot prevent any unbalanced calls. It mitigates the issue, but that's a
different problem.

We can discuss that seperately after fixing the offending call site.

Thanks,

	tglx

[toc] | [prev] | [next] | [standalone]


#1395650

FromLianwei Wang <lianwei.wang@gmail.com>
Date2016-05-06 09:10 +0200
Message-ID<rvI3E-FN-7@gated-at.bofh.it>
In reply to#1395066
On Thu, May 5, 2016 at 5:13 AM, Thomas Gleixner <tglx@linutronix.de> wrote:
> On Wed, 4 May 2016, Lianwei Wang wrote:
>> In this example, the unbalanced count is caused by the
>> cpu_hotplug_pm_callback pm notifier callback function.
>
> I doubt that.
>
>> We can add a variable to avoid the unbalanced call of cpu_hotplug_enable
>> ,e.g.
>
>> diff --git a/kernel/cpu.c b/kernel/cpu.c
>> index 3e3f6e49eabb..aa6694f0e9d3 100644
>> --- a/kernel/cpu.c
>> +++ b/kernel/cpu.c
>> @@ -1140,16 +1140,21 @@ static int
>>  cpu_hotplug_pm_callback(struct notifier_block *nb,
>>                         unsigned long action, void *ptr)
>>  {
>> +       static int disabled;
>> +
>>         switch (action) {
>>
>>         case PM_SUSPEND_PREPARE:
>>         case PM_HIBERNATION_PREPARE:
>>                 cpu_hotplug_disable();
>> +               disabled = 1;
>>                 break;
>>
>>         case PM_POST_SUSPEND:
>>         case PM_POST_HIBERNATION:
>> -               cpu_hotplug_enable();
>> +               if (disabled)
>> +                       cpu_hotplug_enable();
>> +               disabled = 0;
>>                 break;
>>
>>         default:
>>
>> Please let me know if you like to fix it in this way.
>
> So you are moving the work around one step down w/o providing any reasonable
> explanation how this asymetric call of that callback can happen.
>
> Can you eventually come up with a coherent explanation of the problem down to
> the root cause or are we going to play this "move the workaround one step
> down" game for another 10 rounds?
>
Do you agree that any driver can abort the suspend process by
returning an error or NOTIFY_BAD if it is not ready to suspend?
I have explain it and I also copied the example code that abort
suspend by returning an error or NOTIFY_BAD in the pm notifier
callback function.
The cpu_hotplug_disable and cpu_hotplug_enable are called in one of
the PM notifier callback. And they are called from two difference
place.
Below is how it happened:
  pm_suspend
    |--enter_state
        |--suspend_prepare
            |--pm_notifier_call_chain(PM_SUSPEND_PREPARE)
            |    |--call_back_1
            |    |--call_back_..
            |    |--call_back_n ===> return NOTIFY_BAD to abort call chain and
            |    |                                suspend process here
            |    |--cpu_hotplug_pm_callback()
            |    |   |--cpu_hotplug_disable  =====> remember it is not
called yet
            |    |--call_back_..
            |
            |--pm_notifier_call_chain(PM_POST_SUSPEND)
            |    |--call_back_1
            |    |--call_back_..
            |    |--call_back_n
            |    |--cpu_hotplug_pm_callback()
            |    |   |--cpu_hotplug_enable  =====> Here it is unbalanced called
            |    |--call_back_..
            |
So, keep in mind that for pm notifier call chain, the
PM_SUSPEND_PREPARE notifier and PM_POST_SUSPEND notifier is not always
paired called. Sometimes for a driver's pm notifier callback, the
PM_POST_SUSPEND is called without PM_SUSPEND_PREPARE.

>> +static void _cpu_hotplug_enable(void)
>> +{
>> +       if (WARN(!cpu_hotplug_disabled, "Unbalanced cpu hotplug enable\n"))
>> +               return;
>> +
>> +       cpu_hotplug_disabled--;
>> +}
>>
>> I like to fix it in the cpu_hotplug_enable because it is a public
>
> You CANNOT fix it there. The problem is the call site and NOT
> cpu_hotplug_enable(). Can you finally accept this?
I know what you mean. But why let the driver unconditionally do
"--cpu_hotplug_disabled" without any checking. It should do nothing if
it detect a unbalanced enable. A good example for unbalanced checking
from enable_irq is here:
http://lxr.free-electrons.com/source/kernel/irq/manage.c#L512

It's the cpu hotplug driver's responsibility to guarantee that the cpu
hotplug always working well even others failed do something to it. And
the driver can check and handle it itself, why not let the driver to
handle it and make the cpu hotplug driver more strong?
>
>> kernel API and fix in it can prevent any other unbalanced calling.
>
> It cannot prevent any unbalanced calls. It mitigates the issue, but that's a
> different problem.
It did not migrate the issue. It give a warning message to log the
unbalanced issue and it also make sure the cpu hotplug continue to
work well even someone do an unbalanced call. It is a good checking as
the enable_irq/disable_irq do. There are some other unbalanced
checking in kernel too. All make sure the kernel has a better
stability.
>
> We can discuss that seperately after fixing the offending call site.
>
> Thanks,
>
>         tglx

[toc] | [prev] | [next] | [standalone]


#1395661

FromThomas Gleixner <tglx@linutronix.de>
Date2016-05-06 09:30 +0200
Message-ID<rvIn0-P0-15@gated-at.bofh.it>
In reply to#1395650
On Fri, 6 May 2016, Lianwei Wang wrote:
> On Thu, May 5, 2016 at 5:13 AM, Thomas Gleixner <tglx@linutronix.de> wrote:
> > Can you eventually come up with a coherent explanation of the problem down to
> > the root cause or are we going to play this "move the workaround one step
> > down" game for another 10 rounds?
> >
> Do you agree that any driver can abort the suspend process by
> returning an error or NOTIFY_BAD if it is not ready to suspend?
> I have explain it and I also copied the example code that abort
> suspend by returning an error or NOTIFY_BAD in the pm notifier
> callback function.

I don't need copied example code which does not tell me what the real problem
is.

> The cpu_hotplug_disable and cpu_hotplug_enable are called in one of
> the PM notifier callback. And they are called from two difference
> place.
> Below is how it happened:
>   pm_suspend
>     |--enter_state
>         |--suspend_prepare
>             |--pm_notifier_call_chain(PM_SUSPEND_PREPARE)
>             |    |--call_back_1
>             |    |--call_back_..
>             |    |--call_back_n ===> return NOTIFY_BAD to abort call chain and
>             |    |                                suspend process here
>             |    |--cpu_hotplug_pm_callback()
>             |    |   |--cpu_hotplug_disable  =====> remember it is not
> called yet
>             |    |--call_back_..
>             |
>             |--pm_notifier_call_chain(PM_POST_SUSPEND)
>             |    |--call_back_1
>             |    |--call_back_..
>             |    |--call_back_n
>             |    |--cpu_hotplug_pm_callback()
>             |    |   |--cpu_hotplug_enable  =====> Here it is unbalanced called
>             |    |--call_back_..
>             |
> So, keep in mind that for pm notifier call chain, the
> PM_SUSPEND_PREPARE notifier and PM_POST_SUSPEND notifier is not always
> paired called. Sometimes for a driver's pm notifier callback, the
> PM_POST_SUSPEND is called without PM_SUSPEND_PREPARE.

So that is the real problem: cpu_hotplug_pm_callback(PM_POST_SUSPEND) can be
called w/o a previous call to cpu_hotplug_pm_callback(PM_SUSPEND_PREPARE).
 
> > It cannot prevent any unbalanced calls. It mitigates the issue, but that's a
> > different problem.
> It did not migrate the issue. It give a warning message to log the
> unbalanced issue and it also make sure the cpu hotplug continue to
> work well even someone do an unbalanced call. It is a good checking as
> the enable_irq/disable_irq do. There are some other unbalanced
> checking in kernel too. All make sure the kernel has a better
> stability.

I'm not opposed to do that and I said so several times. But I said as well,
that we do not add this without fixing the problem which made you write that
patch in the first place.

So we have a proper explanation for the real problem now, but we have no
fix. 

And again: Your patch is NOT a fix. Simply because it will emit a warning
everytime the above happens. And that's wrong because the abort is a
legitimate scenario.

So please come up with a sensible fix for the suspend abort issue and then we
can add the balance check/fixup to the hotplug_disable/enable() code.

Thanks,

	tglx

[toc] | [prev] | [next] | [standalone]


#1399738

FromLianwei Wang <lianwei.wang@gmail.com>
Date2016-05-12 10:10 +0200
Message-ID<rxTR0-1yW-17@gated-at.bofh.it>
In reply to#1395661
I have come up a patch to make the pm notifier called symmetrically
and currently being tested. I will send it out after pass the test.

On Fri, May 6, 2016 at 12:18 AM, Thomas Gleixner <tglx@linutronix.de> wrote:
> On Fri, 6 May 2016, Lianwei Wang wrote:
>> On Thu, May 5, 2016 at 5:13 AM, Thomas Gleixner <tglx@linutronix.de> wrote:
>> > Can you eventually come up with a coherent explanation of the problem down to
>> > the root cause or are we going to play this "move the workaround one step
>> > down" game for another 10 rounds?
>> >
>> Do you agree that any driver can abort the suspend process by
>> returning an error or NOTIFY_BAD if it is not ready to suspend?
>> I have explain it and I also copied the example code that abort
>> suspend by returning an error or NOTIFY_BAD in the pm notifier
>> callback function.
>
> I don't need copied example code which does not tell me what the real problem
> is.
>
>> The cpu_hotplug_disable and cpu_hotplug_enable are called in one of
>> the PM notifier callback. And they are called from two difference
>> place.
>> Below is how it happened:
>>   pm_suspend
>>     |--enter_state
>>         |--suspend_prepare
>>             |--pm_notifier_call_chain(PM_SUSPEND_PREPARE)
>>             |    |--call_back_1
>>             |    |--call_back_..
>>             |    |--call_back_n ===> return NOTIFY_BAD to abort call chain and
>>             |    |                                suspend process here
>>             |    |--cpu_hotplug_pm_callback()
>>             |    |   |--cpu_hotplug_disable  =====> remember it is not
>> called yet
>>             |    |--call_back_..
>>             |
>>             |--pm_notifier_call_chain(PM_POST_SUSPEND)
>>             |    |--call_back_1
>>             |    |--call_back_..
>>             |    |--call_back_n
>>             |    |--cpu_hotplug_pm_callback()
>>             |    |   |--cpu_hotplug_enable  =====> Here it is unbalanced called
>>             |    |--call_back_..
>>             |
>> So, keep in mind that for pm notifier call chain, the
>> PM_SUSPEND_PREPARE notifier and PM_POST_SUSPEND notifier is not always
>> paired called. Sometimes for a driver's pm notifier callback, the
>> PM_POST_SUSPEND is called without PM_SUSPEND_PREPARE.
>
> So that is the real problem: cpu_hotplug_pm_callback(PM_POST_SUSPEND) can be
> called w/o a previous call to cpu_hotplug_pm_callback(PM_SUSPEND_PREPARE).
>
>> > It cannot prevent any unbalanced calls. It mitigates the issue, but that's a
>> > different problem.
>> It did not migrate the issue. It give a warning message to log the
>> unbalanced issue and it also make sure the cpu hotplug continue to
>> work well even someone do an unbalanced call. It is a good checking as
>> the enable_irq/disable_irq do. There are some other unbalanced
>> checking in kernel too. All make sure the kernel has a better
>> stability.
>
> I'm not opposed to do that and I said so several times. But I said as well,
> that we do not add this without fixing the problem which made you write that
> patch in the first place.
>
> So we have a proper explanation for the real problem now, but we have no
> fix.
>
> And again: Your patch is NOT a fix. Simply because it will emit a warning
> everytime the above happens. And that's wrong because the abort is a
> legitimate scenario.
>
> So please come up with a sensible fix for the suspend abort issue and then we
> can add the balance check/fixup to the hotplug_disable/enable() code.
>
> Thanks,
>
>         tglx
>
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web