linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* How to remove warn msg "cache: parent cpui should not be sleeping" i=1, 2, 3...
@ 2016-12-21 11:37 Jisheng Zhang
  2016-12-21 16:54 ` Sudeep Holla
  0 siblings, 1 reply; 6+ messages in thread
From: Jisheng Zhang @ 2016-12-21 11:37 UTC (permalink / raw)
  To: linux-arm-kernel

Hi all,

I'm not sure this is a bug, when wake up from s2ram, I could get something
like:

[  313.271464] Enabling non-boot CPUs ...
[  313.271551] CPU1: Booted secondary processor
[  313.271556] Detected VIPT I-cache on CPU1
[  313.301378]  cache: parent cpu1 should not be sleeping
[  313.301504] CPU1 is up
[  313.301582] CPU2: Booted secondary processor
[  313.301585] Detected VIPT I-cache on CPU2
[  313.331485]  cache: parent cpu2 should not be sleeping
[  313.331605] CPU2 is up
[  313.331683] CPU3: Booted secondary processor
[  313.331686] Detected VIPT I-cache on CPU3
[  313.361599]  cache: parent cpu3 should not be sleeping
[  313.361719] CPU3 is up

This is because we call cpu_device_create() when secondary cpu is brought
online, the cpu_cache device's parent device: cpu device isn't already
resumed, all device resume will resume after secondary cores are brought
up.

What's the elegant solution to remove this warning msg?

Thanks in advance,
Jisheng

^ permalink raw reply	[flat|nested] 6+ messages in thread

* How to remove warn msg "cache: parent cpui should not be sleeping" i=1, 2, 3...
  2016-12-21 11:37 How to remove warn msg "cache: parent cpui should not be sleeping" i=1, 2, 3 Jisheng Zhang
@ 2016-12-21 16:54 ` Sudeep Holla
  2016-12-22  7:48   ` Jisheng Zhang
                     ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Sudeep Holla @ 2016-12-21 16:54 UTC (permalink / raw)
  To: linux-arm-kernel



On 21/12/16 11:37, Jisheng Zhang wrote:
> Hi all,
> 
> I'm not sure this is a bug, when wake up from s2ram, I could get something
> like:
> 
> [  313.271464] Enabling non-boot CPUs ...
> [  313.271551] CPU1: Booted secondary processor
> [  313.271556] Detected VIPT I-cache on CPU1
> [  313.301378]  cache: parent cpu1 should not be sleeping
> [  313.301504] CPU1 is up
> [  313.301582] CPU2: Booted secondary processor
> [  313.301585] Detected VIPT I-cache on CPU2
> [  313.331485]  cache: parent cpu2 should not be sleeping
> [  313.331605] CPU2 is up
> [  313.331683] CPU3: Booted secondary processor
> [  313.331686] Detected VIPT I-cache on CPU3
> [  313.361599]  cache: parent cpu3 should not be sleeping
> [  313.361719] CPU3 is up
> 
> This is because we call cpu_device_create() when secondary cpu is brought
> online, the cpu_cache device's parent device: cpu device isn't already
> resumed, all device resume will resume after secondary cores are brought
> up.
> 
> What's the elegant solution to remove this warning msg?
> 

It is not a serious warning as you can see a comment in the code:
"/*
 * This is a fib.  But we'll allow new children to be added below
 * a resumed device, even if the device hasn't been completed yet.
 */"

But if we think it needs to be removed, I have something like below in
my mind. I am not sure if this is hacky or not(completely untested, not
even compiled).

Regards,
Sudeep

-->8

diff --git i/drivers/base/cpu.c w/drivers/base/cpu.c
index 4c28e1a09786..2a5c04377adf 100644
--- i/drivers/base/cpu.c
+++ w/drivers/base/cpu.c
@@ -344,6 +344,14 @@ static int cpu_uevent(struct device *dev, struct
kobj_uevent_env *env)
 }
 #endif

+static int cpu_dev_pm_unset_is_prepared(unsigned int cpu)
+{
+       struct device *cpu_dev = get_cpu_device(cpu);
+
+       if(cpu_dev)
+               cpu_dev->power.is_prepared = false;
+       return 0;
+}
 /*
  * register_cpu - Setup a sysfs device for a CPU.
  * @cpu - cpu->hotpluggable field set to 1 will generate a control file in
@@ -377,7 +385,9 @@ int register_cpu(struct cpu *cpu, int num)
        per_cpu(cpu_sys_devices, num) = &cpu->dev;
        register_cpu_under_node(num, cpu_to_node(num));

-       return 0;
+       return cpuhp_setup_state_nocalls(CPUHP_CPUDEV_PM_PREPARE,
+                                "base/cpu/dev_pm:prepare",
+                                cpu_dev_pm_unset_is_prepared, NULL);
 }

 struct device *get_cpu_device(unsigned cpu)
diff --git i/include/linux/cpuhotplug.h w/include/linux/cpuhotplug.h
index 2ab7bf53d529..5bfe3c1aa148 100644
--- i/include/linux/cpuhotplug.h
+++ w/include/linux/cpuhotplug.h
@@ -51,6 +51,7 @@ enum cpuhp_state {
        CPUHP_SLAB_PREPARE,
        CPUHP_MD_RAID5_PREPARE,
        CPUHP_RCUTREE_PREP,
+       CPUHP_CPUDEV_PM_PREPARE,
        CPUHP_CPUIDLE_COUPLED_PREPARE,
        CPUHP_POWERPC_PMAC_PREPARE,
        CPUHP_POWERPC_MMU_CTX_PREPARE,

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* How to remove warn msg "cache: parent cpui should not be sleeping" i=1, 2, 3...
  2016-12-21 16:54 ` Sudeep Holla
@ 2016-12-22  7:48   ` Jisheng Zhang
  2018-08-20 17:46   ` Steve Longerbeam
  2018-10-02 17:07   ` Eugeniu Rosca
  2 siblings, 0 replies; 6+ messages in thread
From: Jisheng Zhang @ 2016-12-22  7:48 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 21 Dec 2016 16:54:22 +0000 Sudeep Holla wrote:

> On 21/12/16 11:37, Jisheng Zhang wrote:
> > Hi all,
> > 
> > I'm not sure this is a bug, when wake up from s2ram, I could get something
> > like:
> > 
> > [  313.271464] Enabling non-boot CPUs ...
> > [  313.271551] CPU1: Booted secondary processor
> > [  313.271556] Detected VIPT I-cache on CPU1
> > [  313.301378]  cache: parent cpu1 should not be sleeping
> > [  313.301504] CPU1 is up
> > [  313.301582] CPU2: Booted secondary processor
> > [  313.301585] Detected VIPT I-cache on CPU2
> > [  313.331485]  cache: parent cpu2 should not be sleeping
> > [  313.331605] CPU2 is up
> > [  313.331683] CPU3: Booted secondary processor
> > [  313.331686] Detected VIPT I-cache on CPU3
> > [  313.361599]  cache: parent cpu3 should not be sleeping
> > [  313.361719] CPU3 is up
> > 
> > This is because we call cpu_device_create() when secondary cpu is brought
> > online, the cpu_cache device's parent device: cpu device isn't already
> > resumed, all device resume will resume after secondary cores are brought
> > up.
> > 
> > What's the elegant solution to remove this warning msg?
> >   
> 
> It is not a serious warning as you can see a comment in the code:
> "/*
>  * This is a fib.  But we'll allow new children to be added below
>  * a resumed device, even if the device hasn't been completed yet.
>  */"
> 

Great, make sense, I agree with "this is not a serious warn msg".

Thanks for the help,
Jisheng


> But if we think it needs to be removed, I have something like below in
> my mind. I am not sure if this is hacky or not(completely untested, not
> even compiled).
> 
> Regards,
> Sudeep
> 
> -->8  
> 
> diff --git i/drivers/base/cpu.c w/drivers/base/cpu.c
> index 4c28e1a09786..2a5c04377adf 100644
> --- i/drivers/base/cpu.c
> +++ w/drivers/base/cpu.c
> @@ -344,6 +344,14 @@ static int cpu_uevent(struct device *dev, struct
> kobj_uevent_env *env)
>  }
>  #endif
> 
> +static int cpu_dev_pm_unset_is_prepared(unsigned int cpu)
> +{
> +       struct device *cpu_dev = get_cpu_device(cpu);
> +
> +       if(cpu_dev)
> +               cpu_dev->power.is_prepared = false;
> +       return 0;
> +}
>  /*
>   * register_cpu - Setup a sysfs device for a CPU.
>   * @cpu - cpu->hotpluggable field set to 1 will generate a control file in
> @@ -377,7 +385,9 @@ int register_cpu(struct cpu *cpu, int num)
>         per_cpu(cpu_sys_devices, num) = &cpu->dev;
>         register_cpu_under_node(num, cpu_to_node(num));
> 
> -       return 0;
> +       return cpuhp_setup_state_nocalls(CPUHP_CPUDEV_PM_PREPARE,
> +                                "base/cpu/dev_pm:prepare",
> +                                cpu_dev_pm_unset_is_prepared, NULL);
>  }
> 
>  struct device *get_cpu_device(unsigned cpu)
> diff --git i/include/linux/cpuhotplug.h w/include/linux/cpuhotplug.h
> index 2ab7bf53d529..5bfe3c1aa148 100644
> --- i/include/linux/cpuhotplug.h
> +++ w/include/linux/cpuhotplug.h
> @@ -51,6 +51,7 @@ enum cpuhp_state {
>         CPUHP_SLAB_PREPARE,
>         CPUHP_MD_RAID5_PREPARE,
>         CPUHP_RCUTREE_PREP,
> +       CPUHP_CPUDEV_PM_PREPARE,
>         CPUHP_CPUIDLE_COUPLED_PREPARE,
>         CPUHP_POWERPC_PMAC_PREPARE,
>         CPUHP_POWERPC_MMU_CTX_PREPARE,

^ permalink raw reply	[flat|nested] 6+ messages in thread

* How to remove warn msg "cache: parent cpui should not be sleeping" i=1, 2, 3...
  2016-12-21 16:54 ` Sudeep Holla
  2016-12-22  7:48   ` Jisheng Zhang
@ 2018-08-20 17:46   ` Steve Longerbeam
  2018-10-02 17:07   ` Eugeniu Rosca
  2 siblings, 0 replies; 6+ messages in thread
From: Steve Longerbeam @ 2018-08-20 17:46 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Sudeep,


On 12/21/2016 08:54 AM, Sudeep Holla wrote:
>
> On 21/12/16 11:37, Jisheng Zhang wrote:
>> Hi all,
>>
>> I'm not sure this is a bug, when wake up from s2ram, I could get something
>> like:
>>
>> [  313.271464] Enabling non-boot CPUs ...
>> [  313.271551] CPU1: Booted secondary processor
>> [  313.271556] Detected VIPT I-cache on CPU1
>> [  313.301378]  cache: parent cpu1 should not be sleeping
>> [  313.301504] CPU1 is up
>> [  313.301582] CPU2: Booted secondary processor
>> [  313.301585] Detected VIPT I-cache on CPU2
>> [  313.331485]  cache: parent cpu2 should not be sleeping
>> [  313.331605] CPU2 is up
>> [  313.331683] CPU3: Booted secondary processor
>> [  313.331686] Detected VIPT I-cache on CPU3
>> [  313.361599]  cache: parent cpu3 should not be sleeping
>> [  313.361719] CPU3 is up
>>
>> This is because we call cpu_device_create() when secondary cpu is brought
>> online, the cpu_cache device's parent device: cpu device isn't already
>> resumed, all device resume will resume after secondary cores are brought
>> up.
>>
>> What's the elegant solution to remove this warning msg?
>>
> It is not a serious warning as you can see a comment in the code:
> "/*
>   * This is a fib.  But we'll allow new children to be added below
>   * a resumed device, even if the device hasn't been completed yet.
>   */"
>
> But if we think it needs to be removed, I have something like below in
> my mind. I am not sure if this is hacky or not(completely untested, not
> even compiled).

This is an old thread, but this warning still exists in the code and 
still occurs
on resume from suspend-to-ram, as of 4.18-rc2.

I have tested the below patch on a Renesas Salvator-X ES2.0 and it does
indeed remove this warning on S2RAM resume.

I agree it is not serious, but the text of the warning does not sound 
harmless.
So IMHO the text should be modified or the below patch should be submitted
for review/merge.

Thanks,
Steve


> Regards,
> Sudeep
>
> -->8
>
> diff --git i/drivers/base/cpu.c w/drivers/base/cpu.c
> index 4c28e1a09786..2a5c04377adf 100644
> --- i/drivers/base/cpu.c
> +++ w/drivers/base/cpu.c
> @@ -344,6 +344,14 @@ static int cpu_uevent(struct device *dev, struct
> kobj_uevent_env *env)
>   }
>   #endif
>
> +static int cpu_dev_pm_unset_is_prepared(unsigned int cpu)
> +{
> +       struct device *cpu_dev = get_cpu_device(cpu);
> +
> +       if(cpu_dev)
> +               cpu_dev->power.is_prepared = false;
> +       return 0;
> +}
>   /*
>    * register_cpu - Setup a sysfs device for a CPU.
>    * @cpu - cpu->hotpluggable field set to 1 will generate a control file in
> @@ -377,7 +385,9 @@ int register_cpu(struct cpu *cpu, int num)
>          per_cpu(cpu_sys_devices, num) = &cpu->dev;
>          register_cpu_under_node(num, cpu_to_node(num));
>
> -       return 0;
> +       return cpuhp_setup_state_nocalls(CPUHP_CPUDEV_PM_PREPARE,
> +                                "base/cpu/dev_pm:prepare",
> +                                cpu_dev_pm_unset_is_prepared, NULL);
>   }
>
>   struct device *get_cpu_device(unsigned cpu)
> diff --git i/include/linux/cpuhotplug.h w/include/linux/cpuhotplug.h
> index 2ab7bf53d529..5bfe3c1aa148 100644
> --- i/include/linux/cpuhotplug.h
> +++ w/include/linux/cpuhotplug.h
> @@ -51,6 +51,7 @@ enum cpuhp_state {
>          CPUHP_SLAB_PREPARE,
>          CPUHP_MD_RAID5_PREPARE,
>          CPUHP_RCUTREE_PREP,
> +       CPUHP_CPUDEV_PM_PREPARE,
>          CPUHP_CPUIDLE_COUPLED_PREPARE,
>          CPUHP_POWERPC_PMAC_PREPARE,
>          CPUHP_POWERPC_MMU_CTX_PREPARE,
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* How to remove warn msg "cache: parent cpui should not be sleeping" i=1, 2, 3...
  2016-12-21 16:54 ` Sudeep Holla
  2016-12-22  7:48   ` Jisheng Zhang
  2018-08-20 17:46   ` Steve Longerbeam
@ 2018-10-02 17:07   ` Eugeniu Rosca
  2019-01-25 13:07     ` Eugeniu Rosca
  2 siblings, 1 reply; 6+ messages in thread
From: Eugeniu Rosca @ 2018-10-02 17:07 UTC (permalink / raw)
  To: linux-arm-kernel

Hello Sudeep,

I too experience the "cache: parent cpuN should not be sleeping" and
confirm these are healed with your patch. Would it be possible to have
the patch submitted for review?

Thank you very much,
Eugeniu.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to remove warn msg "cache: parent cpui should not be sleeping" i=1, 2, 3...
  2018-10-02 17:07   ` Eugeniu Rosca
@ 2019-01-25 13:07     ` Eugeniu Rosca
  0 siblings, 0 replies; 6+ messages in thread
From: Eugeniu Rosca @ 2019-01-25 13:07 UTC (permalink / raw)
  To: Sudeep Holla
  Cc: Jisheng Zhang, Steve Longerbeam, linux-pm, Eugeniu Rosca,
	Rafael J. Wysocki, Eugeniu Rosca, linux-arm-kernel,
	Joshua Frkuska

Hi Sudeep,

On Tue, Oct 02, 2018 at 07:07:54PM +0200, Eugeniu Rosca wrote:
> Hello Sudeep,
> 
> I too experience the "cache: parent cpuN should not be sleeping" and
> confirm these are healed with your patch. Would it be possible to have
> the patch submitted for review?

Doing some s2ram testing on R-Car H3 Salvator-X using
v5.0-rc3-130-gd73aba1115cf, I am still able to reproduce these warnings.

Is there any chance you push the patch to the mailing list? If not, can
it be taken with a different authorship by mentioning this discussion
thread as source of inspiration?

> Thank you very much,
> Eugeniu.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-01-25 13:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-21 11:37 How to remove warn msg "cache: parent cpui should not be sleeping" i=1, 2, 3 Jisheng Zhang
2016-12-21 16:54 ` Sudeep Holla
2016-12-22  7:48   ` Jisheng Zhang
2018-08-20 17:46   ` Steve Longerbeam
2018-10-02 17:07   ` Eugeniu Rosca
2019-01-25 13:07     ` Eugeniu Rosca

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).