All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cpufreq: remove sysfs link when a cpu != policy->cpu, is removed
@ 2014-02-17  9:22 Viresh Kumar
  2014-02-17 22:03 ` Rafael J. Wysocki
  2014-02-18 20:05 ` Stephen Warren
  0 siblings, 2 replies; 10+ messages in thread
From: Viresh Kumar @ 2014-02-17  9:22 UTC (permalink / raw)
  To: rjw, swarren; +Cc: linaro-kernel, cpufreq, linux-pm, linux-kernel, Viresh Kumar

Earlier patch tried to do this but missed this piece of code to fix.

42f921a cpufreq: remove sysfs files for CPUs which failed to come back after
resume

Currently we are getting this on suspend/resume:

------------[ cut here ]------------
WARNING: CPU: 0 PID: 877 at fs/sysfs/dir.c:52 sysfs_warn_dup+0x68/0x84()
sysfs: cannot create duplicate filename '/devices/system/cpu/cpu1/cpufreq'
Modules linked in: brcmfmac brcmutil
CPU: 0 PID: 877 Comm: test-rtc-resume Not tainted 3.14.0-rc2-00259-g9398a10cd964 #12
[<c0015bac>] (unwind_backtrace) from [<c0011850>] (show_stack+0x10/0x14)
[<c0011850>] (show_stack) from [<c056e018>] (dump_stack+0x80/0xcc)
[<c056e018>] (dump_stack) from [<c0025e44>] (warn_slowpath_common+0x64/0x88)
[<c0025e44>] (warn_slowpath_common) from [<c0025efc>] (warn_slowpath_fmt+0x30/0x40)
[<c0025efc>] (warn_slowpath_fmt) from [<c012776c>] (sysfs_warn_dup+0x68/0x84)
[<c012776c>] (sysfs_warn_dup) from [<c0127a54>] (sysfs_do_create_link_sd+0xb0/0xb8)
[<c0127a54>] (sysfs_do_create_link_sd) from [<c038ef64>] (__cpufreq_add_dev.isra.27+0x2a8/0x814)
[<c038ef64>] (__cpufreq_add_dev.isra.27) from [<c038f548>] (cpufreq_cpu_callback+0x70/0x8c)
[<c038f548>] (cpufreq_cpu_callback) from [<c0043864>] (notifier_call_chain+0x44/0x84)
[<c0043864>] (notifier_call_chain) from [<c0025f60>] (__cpu_notify+0x28/0x44)
[<c0025f60>] (__cpu_notify) from [<c00261e8>] (_cpu_up+0xf0/0x140)
[<c00261e8>] (_cpu_up) from [<c0569eb8>] (enable_nonboot_cpus+0x68/0xb0)
[<c0569eb8>] (enable_nonboot_cpus) from [<c006339c>] (suspend_devices_and_enter+0x198/0x2dc)
[<c006339c>] (suspend_devices_and_enter) from [<c0063654>] (pm_suspend+0x174/0x1e8)
[<c0063654>] (pm_suspend) from [<c00624e0>] (state_store+0x6c/0xbc)
[<c00624e0>] (state_store) from [<c01fc200>] (kobj_attr_store+0x14/0x20)
[<c01fc200>] (kobj_attr_store) from [<c0126e50>] (sysfs_kf_write+0x44/0x48)
[<c0126e50>] (sysfs_kf_write) from [<c012a274>] (kernfs_fop_write+0xb4/0x14c)
[<c012a274>] (kernfs_fop_write) from [<c00d4818>] (vfs_write+0xa8/0x180)
[<c00d4818>] (vfs_write) from [<c00d4bb8>] (SyS_write+0x3c/0x70)
[<c00d4bb8>] (SyS_write) from [<c000e620>] (ret_fast_syscall+0x0/0x30)
---[ end trace 76969904b614c18f ]---

Fix this by removing sysfs link for cpufreq directory when cpu removed isn't
policy->cpu.

Reported-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---

Fix for 3.14 only.

 drivers/cpufreq/cpufreq.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 08ca8c9..cb003a6 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1323,8 +1323,7 @@ static int __cpufreq_remove_dev_prepare(struct device *dev,
 	up_read(&policy->rwsem);
 
 	if (cpu != policy->cpu) {
-		if (!frozen)
-			sysfs_remove_link(&dev->kobj, "cpufreq");
+		sysfs_remove_link(&dev->kobj, "cpufreq");
 	} else if (cpus > 1) {
 		new_cpu = cpufreq_nominate_new_policy_cpu(policy, cpu);
 		if (new_cpu >= 0) {
-- 
1.7.12.rc2.18.g61b472e


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

* Re: [PATCH] cpufreq: remove sysfs link when a cpu != policy->cpu, is removed
  2014-02-17  9:22 [PATCH] cpufreq: remove sysfs link when a cpu != policy->cpu, is removed Viresh Kumar
@ 2014-02-17 22:03 ` Rafael J. Wysocki
  2014-04-07 17:15     ` Sören Brinkmann
  2014-02-18 20:05 ` Stephen Warren
  1 sibling, 1 reply; 10+ messages in thread
From: Rafael J. Wysocki @ 2014-02-17 22:03 UTC (permalink / raw)
  To: Viresh Kumar; +Cc: swarren, linaro-kernel, cpufreq, linux-pm, linux-kernel

On Monday, February 17, 2014 02:52:11 PM Viresh Kumar wrote:
> Earlier patch tried to do this but missed this piece of code to fix.
> 
> 42f921a cpufreq: remove sysfs files for CPUs which failed to come back after
> resume
> 
> Currently we are getting this on suspend/resume:
> 
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 877 at fs/sysfs/dir.c:52 sysfs_warn_dup+0x68/0x84()
> sysfs: cannot create duplicate filename '/devices/system/cpu/cpu1/cpufreq'
> Modules linked in: brcmfmac brcmutil
> CPU: 0 PID: 877 Comm: test-rtc-resume Not tainted 3.14.0-rc2-00259-g9398a10cd964 #12
> [<c0015bac>] (unwind_backtrace) from [<c0011850>] (show_stack+0x10/0x14)
> [<c0011850>] (show_stack) from [<c056e018>] (dump_stack+0x80/0xcc)
> [<c056e018>] (dump_stack) from [<c0025e44>] (warn_slowpath_common+0x64/0x88)
> [<c0025e44>] (warn_slowpath_common) from [<c0025efc>] (warn_slowpath_fmt+0x30/0x40)
> [<c0025efc>] (warn_slowpath_fmt) from [<c012776c>] (sysfs_warn_dup+0x68/0x84)
> [<c012776c>] (sysfs_warn_dup) from [<c0127a54>] (sysfs_do_create_link_sd+0xb0/0xb8)
> [<c0127a54>] (sysfs_do_create_link_sd) from [<c038ef64>] (__cpufreq_add_dev.isra.27+0x2a8/0x814)
> [<c038ef64>] (__cpufreq_add_dev.isra.27) from [<c038f548>] (cpufreq_cpu_callback+0x70/0x8c)
> [<c038f548>] (cpufreq_cpu_callback) from [<c0043864>] (notifier_call_chain+0x44/0x84)
> [<c0043864>] (notifier_call_chain) from [<c0025f60>] (__cpu_notify+0x28/0x44)
> [<c0025f60>] (__cpu_notify) from [<c00261e8>] (_cpu_up+0xf0/0x140)
> [<c00261e8>] (_cpu_up) from [<c0569eb8>] (enable_nonboot_cpus+0x68/0xb0)
> [<c0569eb8>] (enable_nonboot_cpus) from [<c006339c>] (suspend_devices_and_enter+0x198/0x2dc)
> [<c006339c>] (suspend_devices_and_enter) from [<c0063654>] (pm_suspend+0x174/0x1e8)
> [<c0063654>] (pm_suspend) from [<c00624e0>] (state_store+0x6c/0xbc)
> [<c00624e0>] (state_store) from [<c01fc200>] (kobj_attr_store+0x14/0x20)
> [<c01fc200>] (kobj_attr_store) from [<c0126e50>] (sysfs_kf_write+0x44/0x48)
> [<c0126e50>] (sysfs_kf_write) from [<c012a274>] (kernfs_fop_write+0xb4/0x14c)
> [<c012a274>] (kernfs_fop_write) from [<c00d4818>] (vfs_write+0xa8/0x180)
> [<c00d4818>] (vfs_write) from [<c00d4bb8>] (SyS_write+0x3c/0x70)
> [<c00d4bb8>] (SyS_write) from [<c000e620>] (ret_fast_syscall+0x0/0x30)
> ---[ end trace 76969904b614c18f ]---
> 
> Fix this by removing sysfs link for cpufreq directory when cpu removed isn't
> policy->cpu.
> 
> Reported-by: Stephen Warren <swarren@nvidia.com>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
> 
> Fix for 3.14 only.

Queued up for 3.14, thanks!

>  drivers/cpufreq/cpufreq.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 08ca8c9..cb003a6 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -1323,8 +1323,7 @@ static int __cpufreq_remove_dev_prepare(struct device *dev,
>  	up_read(&policy->rwsem);
>  
>  	if (cpu != policy->cpu) {
> -		if (!frozen)
> -			sysfs_remove_link(&dev->kobj, "cpufreq");
> +		sysfs_remove_link(&dev->kobj, "cpufreq");
>  	} else if (cpus > 1) {
>  		new_cpu = cpufreq_nominate_new_policy_cpu(policy, cpu);
>  		if (new_cpu >= 0) {
> 

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

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

* Re: [PATCH] cpufreq: remove sysfs link when a cpu != policy->cpu, is removed
  2014-02-17  9:22 [PATCH] cpufreq: remove sysfs link when a cpu != policy->cpu, is removed Viresh Kumar
  2014-02-17 22:03 ` Rafael J. Wysocki
@ 2014-02-18 20:05 ` Stephen Warren
  1 sibling, 0 replies; 10+ messages in thread
From: Stephen Warren @ 2014-02-18 20:05 UTC (permalink / raw)
  To: Viresh Kumar, rjw, swarren; +Cc: linaro-kernel, cpufreq, linux-pm, linux-kernel

On 02/17/2014 02:22 AM, Viresh Kumar wrote:
> Earlier patch tried to do this but missed this piece of code to fix.
> 
> 42f921a cpufreq: remove sysfs files for CPUs which failed to come back after
> resume
> 
> Currently we are getting this on suspend/resume:
> 
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 877 at fs/sysfs/dir.c:52 sysfs_warn_dup+0x68/0x84()
> sysfs: cannot create duplicate filename '/devices/system/cpu/cpu1/cpufreq'
...
> Fix this by removing sysfs link for cpufreq directory when cpu removed isn't
> policy->cpu.

Tested-by: Stephen Warren <swarren@nvidia.com>

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

* Re: [PATCH] cpufreq: remove sysfs link when a cpu != policy->cpu, is removed
  2014-02-17 22:03 ` Rafael J. Wysocki
  2014-04-07 17:15     ` Sören Brinkmann
@ 2014-04-07 17:15     ` Sören Brinkmann
  0 siblings, 0 replies; 10+ messages in thread
From: Sören Brinkmann @ 2014-04-07 17:15 UTC (permalink / raw)
  To: Rafael J. Wysocki, Greg Kroah-Hartman
  Cc: Viresh Kumar, swarren, linaro-kernel, cpufreq, linux-pm,
	linux-kernel, stable, Michal Simek

On Mon, 2014-02-17 at 11:03PM +0100, Rafael J. Wysocki wrote:
> On Monday, February 17, 2014 02:52:11 PM Viresh Kumar wrote:
> > Earlier patch tried to do this but missed this piece of code to fix.
> > 
> > 42f921a cpufreq: remove sysfs files for CPUs which failed to come back after
> > resume
> > 
> > Currently we are getting this on suspend/resume:
> > 
> > ------------[ cut here ]------------
> > WARNING: CPU: 0 PID: 877 at fs/sysfs/dir.c:52 sysfs_warn_dup+0x68/0x84()
> > sysfs: cannot create duplicate filename '/devices/system/cpu/cpu1/cpufreq'
> > Modules linked in: brcmfmac brcmutil
> > CPU: 0 PID: 877 Comm: test-rtc-resume Not tainted 3.14.0-rc2-00259-g9398a10cd964 #12
> > [<c0015bac>] (unwind_backtrace) from [<c0011850>] (show_stack+0x10/0x14)
> > [<c0011850>] (show_stack) from [<c056e018>] (dump_stack+0x80/0xcc)
> > [<c056e018>] (dump_stack) from [<c0025e44>] (warn_slowpath_common+0x64/0x88)
> > [<c0025e44>] (warn_slowpath_common) from [<c0025efc>] (warn_slowpath_fmt+0x30/0x40)
> > [<c0025efc>] (warn_slowpath_fmt) from [<c012776c>] (sysfs_warn_dup+0x68/0x84)
> > [<c012776c>] (sysfs_warn_dup) from [<c0127a54>] (sysfs_do_create_link_sd+0xb0/0xb8)
> > [<c0127a54>] (sysfs_do_create_link_sd) from [<c038ef64>] (__cpufreq_add_dev.isra.27+0x2a8/0x814)
> > [<c038ef64>] (__cpufreq_add_dev.isra.27) from [<c038f548>] (cpufreq_cpu_callback+0x70/0x8c)
> > [<c038f548>] (cpufreq_cpu_callback) from [<c0043864>] (notifier_call_chain+0x44/0x84)
> > [<c0043864>] (notifier_call_chain) from [<c0025f60>] (__cpu_notify+0x28/0x44)
> > [<c0025f60>] (__cpu_notify) from [<c00261e8>] (_cpu_up+0xf0/0x140)
> > [<c00261e8>] (_cpu_up) from [<c0569eb8>] (enable_nonboot_cpus+0x68/0xb0)
> > [<c0569eb8>] (enable_nonboot_cpus) from [<c006339c>] (suspend_devices_and_enter+0x198/0x2dc)
> > [<c006339c>] (suspend_devices_and_enter) from [<c0063654>] (pm_suspend+0x174/0x1e8)
> > [<c0063654>] (pm_suspend) from [<c00624e0>] (state_store+0x6c/0xbc)
> > [<c00624e0>] (state_store) from [<c01fc200>] (kobj_attr_store+0x14/0x20)
> > [<c01fc200>] (kobj_attr_store) from [<c0126e50>] (sysfs_kf_write+0x44/0x48)
> > [<c0126e50>] (sysfs_kf_write) from [<c012a274>] (kernfs_fop_write+0xb4/0x14c)
> > [<c012a274>] (kernfs_fop_write) from [<c00d4818>] (vfs_write+0xa8/0x180)
> > [<c00d4818>] (vfs_write) from [<c00d4bb8>] (SyS_write+0x3c/0x70)
> > [<c00d4bb8>] (SyS_write) from [<c000e620>] (ret_fast_syscall+0x0/0x30)
> > ---[ end trace 76969904b614c18f ]---
> > 
> > Fix this by removing sysfs link for cpufreq directory when cpu removed isn't
> > policy->cpu.
> > 
> > Reported-by: Stephen Warren <swarren@nvidia.com>
> > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> > ---
> > 
> > Fix for 3.14 only.
> 
> Queued up for 3.14, thanks!

I see this on 3.13 too (in our vendor tree, but I think mainline would
show the behavior as well). It probably worth to add it into the 3.13
stable kernel.

	Sören
> 
> >  drivers/cpufreq/cpufreq.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> > index 08ca8c9..cb003a6 100644
> > --- a/drivers/cpufreq/cpufreq.c
> > +++ b/drivers/cpufreq/cpufreq.c
> > @@ -1323,8 +1323,7 @@ static int __cpufreq_remove_dev_prepare(struct device *dev,
> >  	up_read(&policy->rwsem);
> >  
> >  	if (cpu != policy->cpu) {
> > -		if (!frozen)
> > -			sysfs_remove_link(&dev->kobj, "cpufreq");
> > +		sysfs_remove_link(&dev->kobj, "cpufreq");
> >  	} else if (cpus > 1) {
> >  		new_cpu = cpufreq_nominate_new_policy_cpu(policy, cpu);
> >  		if (new_cpu >= 0) {
> > 
> 
> -- 
> I speak only for myself.
> Rafael J. Wysocki, Intel Open Source Technology Center.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 


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

* Re: [PATCH] cpufreq: remove sysfs link when a cpu != policy->cpu, is removed
@ 2014-04-07 17:15     ` Sören Brinkmann
  0 siblings, 0 replies; 10+ messages in thread
From: Sören Brinkmann @ 2014-04-07 17:15 UTC (permalink / raw)
  To: Rafael J. Wysocki, Greg Kroah-Hartman
  Cc: Viresh Kumar, swarren, linaro-kernel, cpufreq, linux-pm,
	linux-kernel, stable, Michal Simek

On Mon, 2014-02-17 at 11:03PM +0100, Rafael J. Wysocki wrote:
> On Monday, February 17, 2014 02:52:11 PM Viresh Kumar wrote:
> > Earlier patch tried to do this but missed this piece of code to fix.
> > 
> > 42f921a cpufreq: remove sysfs files for CPUs which failed to come back after
> > resume
> > 
> > Currently we are getting this on suspend/resume:
> > 
> > ------------[ cut here ]------------
> > WARNING: CPU: 0 PID: 877 at fs/sysfs/dir.c:52 sysfs_warn_dup+0x68/0x84()
> > sysfs: cannot create duplicate filename '/devices/system/cpu/cpu1/cpufreq'
> > Modules linked in: brcmfmac brcmutil
> > CPU: 0 PID: 877 Comm: test-rtc-resume Not tainted 3.14.0-rc2-00259-g9398a10cd964 #12
> > [<c0015bac>] (unwind_backtrace) from [<c0011850>] (show_stack+0x10/0x14)
> > [<c0011850>] (show_stack) from [<c056e018>] (dump_stack+0x80/0xcc)
> > [<c056e018>] (dump_stack) from [<c0025e44>] (warn_slowpath_common+0x64/0x88)
> > [<c0025e44>] (warn_slowpath_common) from [<c0025efc>] (warn_slowpath_fmt+0x30/0x40)
> > [<c0025efc>] (warn_slowpath_fmt) from [<c012776c>] (sysfs_warn_dup+0x68/0x84)
> > [<c012776c>] (sysfs_warn_dup) from [<c0127a54>] (sysfs_do_create_link_sd+0xb0/0xb8)
> > [<c0127a54>] (sysfs_do_create_link_sd) from [<c038ef64>] (__cpufreq_add_dev.isra.27+0x2a8/0x814)
> > [<c038ef64>] (__cpufreq_add_dev.isra.27) from [<c038f548>] (cpufreq_cpu_callback+0x70/0x8c)
> > [<c038f548>] (cpufreq_cpu_callback) from [<c0043864>] (notifier_call_chain+0x44/0x84)
> > [<c0043864>] (notifier_call_chain) from [<c0025f60>] (__cpu_notify+0x28/0x44)
> > [<c0025f60>] (__cpu_notify) from [<c00261e8>] (_cpu_up+0xf0/0x140)
> > [<c00261e8>] (_cpu_up) from [<c0569eb8>] (enable_nonboot_cpus+0x68/0xb0)
> > [<c0569eb8>] (enable_nonboot_cpus) from [<c006339c>] (suspend_devices_and_enter+0x198/0x2dc)
> > [<c006339c>] (suspend_devices_and_enter) from [<c0063654>] (pm_suspend+0x174/0x1e8)
> > [<c0063654>] (pm_suspend) from [<c00624e0>] (state_store+0x6c/0xbc)
> > [<c00624e0>] (state_store) from [<c01fc200>] (kobj_attr_store+0x14/0x20)
> > [<c01fc200>] (kobj_attr_store) from [<c0126e50>] (sysfs_kf_write+0x44/0x48)
> > [<c0126e50>] (sysfs_kf_write) from [<c012a274>] (kernfs_fop_write+0xb4/0x14c)
> > [<c012a274>] (kernfs_fop_write) from [<c00d4818>] (vfs_write+0xa8/0x180)
> > [<c00d4818>] (vfs_write) from [<c00d4bb8>] (SyS_write+0x3c/0x70)
> > [<c00d4bb8>] (SyS_write) from [<c000e620>] (ret_fast_syscall+0x0/0x30)
> > ---[ end trace 76969904b614c18f ]---
> > 
> > Fix this by removing sysfs link for cpufreq directory when cpu removed isn't
> > policy->cpu.
> > 
> > Reported-by: Stephen Warren <swarren@nvidia.com>
> > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> > ---
> > 
> > Fix for 3.14 only.
> 
> Queued up for 3.14, thanks!

I see this on 3.13 too (in our vendor tree, but I think mainline would
show the behavior as well). It probably worth to add it into the 3.13
stable kernel.

	Sören
> 
> >  drivers/cpufreq/cpufreq.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> > index 08ca8c9..cb003a6 100644
> > --- a/drivers/cpufreq/cpufreq.c
> > +++ b/drivers/cpufreq/cpufreq.c
> > @@ -1323,8 +1323,7 @@ static int __cpufreq_remove_dev_prepare(struct device *dev,
> >  	up_read(&policy->rwsem);
> >  
> >  	if (cpu != policy->cpu) {
> > -		if (!frozen)
> > -			sysfs_remove_link(&dev->kobj, "cpufreq");
> > +		sysfs_remove_link(&dev->kobj, "cpufreq");
> >  	} else if (cpus > 1) {
> >  		new_cpu = cpufreq_nominate_new_policy_cpu(policy, cpu);
> >  		if (new_cpu >= 0) {
> > 
> 
> -- 
> I speak only for myself.
> Rafael J. Wysocki, Intel Open Source Technology Center.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 


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

* Re: [PATCH] cpufreq: remove sysfs link when a cpu != policy->cpu, is removed
@ 2014-04-07 17:15     ` Sören Brinkmann
  0 siblings, 0 replies; 10+ messages in thread
From: Sören Brinkmann @ 2014-04-07 17:15 UTC (permalink / raw)
  To: Rafael J. Wysocki, Greg Kroah-Hartman
  Cc: Viresh Kumar, swarren, linaro-kernel, cpufreq, linux-pm,
	linux-kernel, stable, Michal Simek

On Mon, 2014-02-17 at 11:03PM +0100, Rafael J. Wysocki wrote:
> On Monday, February 17, 2014 02:52:11 PM Viresh Kumar wrote:
> > Earlier patch tried to do this but missed this piece of code to fix.
> > 
> > 42f921a cpufreq: remove sysfs files for CPUs which failed to come back after
> > resume
> > 
> > Currently we are getting this on suspend/resume:
> > 
> > ------------[ cut here ]------------
> > WARNING: CPU: 0 PID: 877 at fs/sysfs/dir.c:52 sysfs_warn_dup+0x68/0x84()
> > sysfs: cannot create duplicate filename '/devices/system/cpu/cpu1/cpufreq'
> > Modules linked in: brcmfmac brcmutil
> > CPU: 0 PID: 877 Comm: test-rtc-resume Not tainted 3.14.0-rc2-00259-g9398a10cd964 #12
> > [<c0015bac>] (unwind_backtrace) from [<c0011850>] (show_stack+0x10/0x14)
> > [<c0011850>] (show_stack) from [<c056e018>] (dump_stack+0x80/0xcc)
> > [<c056e018>] (dump_stack) from [<c0025e44>] (warn_slowpath_common+0x64/0x88)
> > [<c0025e44>] (warn_slowpath_common) from [<c0025efc>] (warn_slowpath_fmt+0x30/0x40)
> > [<c0025efc>] (warn_slowpath_fmt) from [<c012776c>] (sysfs_warn_dup+0x68/0x84)
> > [<c012776c>] (sysfs_warn_dup) from [<c0127a54>] (sysfs_do_create_link_sd+0xb0/0xb8)
> > [<c0127a54>] (sysfs_do_create_link_sd) from [<c038ef64>] (__cpufreq_add_dev.isra.27+0x2a8/0x814)
> > [<c038ef64>] (__cpufreq_add_dev.isra.27) from [<c038f548>] (cpufreq_cpu_callback+0x70/0x8c)
> > [<c038f548>] (cpufreq_cpu_callback) from [<c0043864>] (notifier_call_chain+0x44/0x84)
> > [<c0043864>] (notifier_call_chain) from [<c0025f60>] (__cpu_notify+0x28/0x44)
> > [<c0025f60>] (__cpu_notify) from [<c00261e8>] (_cpu_up+0xf0/0x140)
> > [<c00261e8>] (_cpu_up) from [<c0569eb8>] (enable_nonboot_cpus+0x68/0xb0)
> > [<c0569eb8>] (enable_nonboot_cpus) from [<c006339c>] (suspend_devices_and_enter+0x198/0x2dc)
> > [<c006339c>] (suspend_devices_and_enter) from [<c0063654>] (pm_suspend+0x174/0x1e8)
> > [<c0063654>] (pm_suspend) from [<c00624e0>] (state_store+0x6c/0xbc)
> > [<c00624e0>] (state_store) from [<c01fc200>] (kobj_attr_store+0x14/0x20)
> > [<c01fc200>] (kobj_attr_store) from [<c0126e50>] (sysfs_kf_write+0x44/0x48)
> > [<c0126e50>] (sysfs_kf_write) from [<c012a274>] (kernfs_fop_write+0xb4/0x14c)
> > [<c012a274>] (kernfs_fop_write) from [<c00d4818>] (vfs_write+0xa8/0x180)
> > [<c00d4818>] (vfs_write) from [<c00d4bb8>] (SyS_write+0x3c/0x70)
> > [<c00d4bb8>] (SyS_write) from [<c000e620>] (ret_fast_syscall+0x0/0x30)
> > ---[ end trace 76969904b614c18f ]---
> > 
> > Fix this by removing sysfs link for cpufreq directory when cpu removed isn't
> > policy->cpu.
> > 
> > Reported-by: Stephen Warren <swarren@nvidia.com>
> > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> > ---
> > 
> > Fix for 3.14 only.
> 
> Queued up for 3.14, thanks!

I see this on 3.13 too (in our vendor tree, but I think mainline would
show the behavior as well). It probably worth to add it into the 3.13
stable kernel.

	Sören
> 
> >  drivers/cpufreq/cpufreq.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> > index 08ca8c9..cb003a6 100644
> > --- a/drivers/cpufreq/cpufreq.c
> > +++ b/drivers/cpufreq/cpufreq.c
> > @@ -1323,8 +1323,7 @@ static int __cpufreq_remove_dev_prepare(struct device *dev,
> >  	up_read(&policy->rwsem);
> >  
> >  	if (cpu != policy->cpu) {
> > -		if (!frozen)
> > -			sysfs_remove_link(&dev->kobj, "cpufreq");
> > +		sysfs_remove_link(&dev->kobj, "cpufreq");
> >  	} else if (cpus > 1) {
> >  		new_cpu = cpufreq_nominate_new_policy_cpu(policy, cpu);
> >  		if (new_cpu >= 0) {
> > 
> 
> -- 
> I speak only for myself.
> Rafael J. Wysocki, Intel Open Source Technology Center.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 


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

* Re: [PATCH] cpufreq: remove sysfs link when a cpu != policy->cpu, is removed
  2014-04-07 17:15     ` Sören Brinkmann
@ 2014-04-08  4:22       ` Viresh Kumar
  -1 siblings, 0 replies; 10+ messages in thread
From: Viresh Kumar @ 2014-04-08  4:22 UTC (permalink / raw)
  To: Sören Brinkmann
  Cc: Rafael J. Wysocki, Greg Kroah-Hartman, Stephen Warren,
	Lists linaro-kernel, cpufreq, linux-pm,
	Linux Kernel Mailing List, stable, Michal Simek

On 7 April 2014 22:45, Sören Brinkmann <soren.brinkmann@xilinx.com> wrote:
> I see this on 3.13 too (in our vendor tree, but I think mainline would
> show the behavior as well). It probably worth to add it into the 3.13
> stable kernel.

Thanks.. Patch sent for stable tree.

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

* Re: [PATCH] cpufreq: remove sysfs link when a cpu != policy->cpu, is removed
@ 2014-04-08  4:22       ` Viresh Kumar
  0 siblings, 0 replies; 10+ messages in thread
From: Viresh Kumar @ 2014-04-08  4:22 UTC (permalink / raw)
  To: Sören Brinkmann
  Cc: Rafael J. Wysocki, Greg Kroah-Hartman, Stephen Warren,
	Lists linaro-kernel, cpufreq, linux-pm,
	Linux Kernel Mailing List, stable, Michal Simek

On 7 April 2014 22:45, S�ren Brinkmann <soren.brinkmann@xilinx.com> wrote:
> I see this on 3.13 too (in our vendor tree, but I think mainline would
> show the behavior as well). It probably worth to add it into the 3.13
> stable kernel.

Thanks.. Patch sent for stable tree.

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

* Re: [PATCH] cpufreq: remove sysfs link when a cpu != policy->cpu, is removed
  2014-04-08  4:21 Viresh Kumar
@ 2014-04-08 12:09 ` Rafael J. Wysocki
  0 siblings, 0 replies; 10+ messages in thread
From: Rafael J. Wysocki @ 2014-04-08 12:09 UTC (permalink / raw)
  To: Viresh Kumar; +Cc: stable, soren.brinkmann, linux-pm, Rafael J. Wysocki

On Tuesday, April 08, 2014 09:51:28 AM Viresh Kumar wrote:
> From: viresh kumar <viresh.kumar@linaro.org>

The original commit hash has to be provided here too.

> Commit 42f921a (cpufreq: remove sysfs files for CPUs which failed to
> come back after resume) tried to do this but missed this piece of code
> to fix.
> 
> Currently we are getting this on suspend/resume:
> 
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 877 at fs/sysfs/dir.c:52 sysfs_warn_dup+0x68/0x84()
> sysfs: cannot create duplicate filename '/devices/system/cpu/cpu1/cpufreq'
> Modules linked in: brcmfmac brcmutil
> CPU: 0 PID: 877 Comm: test-rtc-resume Not tainted 3.14.0-rc2-00259-g9398a10cd964 #12
> [<c0015bac>] (unwind_backtrace) from [<c0011850>] (show_stack+0x10/0x14)
> [<c0011850>] (show_stack) from [<c056e018>] (dump_stack+0x80/0xcc)
> [<c056e018>] (dump_stack) from [<c0025e44>] (warn_slowpath_common+0x64/0x88)
> [<c0025e44>] (warn_slowpath_common) from [<c0025efc>] (warn_slowpath_fmt+0x30/0x40)
> [<c0025efc>] (warn_slowpath_fmt) from [<c012776c>] (sysfs_warn_dup+0x68/0x84)
> [<c012776c>] (sysfs_warn_dup) from [<c0127a54>] (sysfs_do_create_link_sd+0xb0/0xb8)
> [<c0127a54>] (sysfs_do_create_link_sd) from [<c038ef64>] (__cpufreq_add_dev.isra.27+0x2a8/0x814)
> [<c038ef64>] (__cpufreq_add_dev.isra.27) from [<c038f548>] (cpufreq_cpu_callback+0x70/0x8c)
> [<c038f548>] (cpufreq_cpu_callback) from [<c0043864>] (notifier_call_chain+0x44/0x84)
> [<c0043864>] (notifier_call_chain) from [<c0025f60>] (__cpu_notify+0x28/0x44)
> [<c0025f60>] (__cpu_notify) from [<c00261e8>] (_cpu_up+0xf0/0x140)
> [<c00261e8>] (_cpu_up) from [<c0569eb8>] (enable_nonboot_cpus+0x68/0xb0)
> [<c0569eb8>] (enable_nonboot_cpus) from [<c006339c>] (suspend_devices_and_enter+0x198/0x2dc)
> [<c006339c>] (suspend_devices_and_enter) from [<c0063654>] (pm_suspend+0x174/0x1e8)
> [<c0063654>] (pm_suspend) from [<c00624e0>] (state_store+0x6c/0xbc)
> [<c00624e0>] (state_store) from [<c01fc200>] (kobj_attr_store+0x14/0x20)
> [<c01fc200>] (kobj_attr_store) from [<c0126e50>] (sysfs_kf_write+0x44/0x48)
> [<c0126e50>] (sysfs_kf_write) from [<c012a274>] (kernfs_fop_write+0xb4/0x14c)
> [<c012a274>] (kernfs_fop_write) from [<c00d4818>] (vfs_write+0xa8/0x180)
> [<c00d4818>] (vfs_write) from [<c00d4bb8>] (SyS_write+0x3c/0x70)
> [<c00d4bb8>] (SyS_write) from [<c000e620>] (ret_fast_syscall+0x0/0x30)
> ---[ end trace 76969904b614c18f ]---
> 
> Fix this by removing sysfs link for cpufreq directory when cpu removed
> isn't policy->cpu.
> 
> Cc: <stable@vger.kernel.org> # 3.13.x
> Revamps: 42f921a (cpufreq: remove sysfs files for CPUs which failed to come back after resume)
> Reported-and-tested-by: Stephen Warren <swarren@nvidia.com>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>  drivers/cpufreq/cpufreq.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 99a443e..2aaa6cf 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -1223,8 +1223,7 @@ static int __cpufreq_remove_dev_prepare(struct device *dev,
>  	up_read(&policy->rwsem);
>  
>  	if (cpu != policy->cpu) {
> -		if (!frozen)
> -			sysfs_remove_link(&dev->kobj, "cpufreq");
> +		sysfs_remove_link(&dev->kobj, "cpufreq");
>  	} else if (cpus > 1) {
>  		new_cpu = cpufreq_nominate_new_policy_cpu(policy, cpu);
>  		if (new_cpu >= 0) {
> 

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

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

* [PATCH] cpufreq: remove sysfs link when a cpu != policy->cpu, is removed
@ 2014-04-08  4:21 Viresh Kumar
  2014-04-08 12:09 ` Rafael J. Wysocki
  0 siblings, 1 reply; 10+ messages in thread
From: Viresh Kumar @ 2014-04-08  4:21 UTC (permalink / raw)
  To: stable; +Cc: soren.brinkmann, linux-pm, viresh kumar, Rafael J. Wysocki

From: viresh kumar <viresh.kumar@linaro.org>

Commit 42f921a (cpufreq: remove sysfs files for CPUs which failed to
come back after resume) tried to do this but missed this piece of code
to fix.

Currently we are getting this on suspend/resume:

------------[ cut here ]------------
WARNING: CPU: 0 PID: 877 at fs/sysfs/dir.c:52 sysfs_warn_dup+0x68/0x84()
sysfs: cannot create duplicate filename '/devices/system/cpu/cpu1/cpufreq'
Modules linked in: brcmfmac brcmutil
CPU: 0 PID: 877 Comm: test-rtc-resume Not tainted 3.14.0-rc2-00259-g9398a10cd964 #12
[<c0015bac>] (unwind_backtrace) from [<c0011850>] (show_stack+0x10/0x14)
[<c0011850>] (show_stack) from [<c056e018>] (dump_stack+0x80/0xcc)
[<c056e018>] (dump_stack) from [<c0025e44>] (warn_slowpath_common+0x64/0x88)
[<c0025e44>] (warn_slowpath_common) from [<c0025efc>] (warn_slowpath_fmt+0x30/0x40)
[<c0025efc>] (warn_slowpath_fmt) from [<c012776c>] (sysfs_warn_dup+0x68/0x84)
[<c012776c>] (sysfs_warn_dup) from [<c0127a54>] (sysfs_do_create_link_sd+0xb0/0xb8)
[<c0127a54>] (sysfs_do_create_link_sd) from [<c038ef64>] (__cpufreq_add_dev.isra.27+0x2a8/0x814)
[<c038ef64>] (__cpufreq_add_dev.isra.27) from [<c038f548>] (cpufreq_cpu_callback+0x70/0x8c)
[<c038f548>] (cpufreq_cpu_callback) from [<c0043864>] (notifier_call_chain+0x44/0x84)
[<c0043864>] (notifier_call_chain) from [<c0025f60>] (__cpu_notify+0x28/0x44)
[<c0025f60>] (__cpu_notify) from [<c00261e8>] (_cpu_up+0xf0/0x140)
[<c00261e8>] (_cpu_up) from [<c0569eb8>] (enable_nonboot_cpus+0x68/0xb0)
[<c0569eb8>] (enable_nonboot_cpus) from [<c006339c>] (suspend_devices_and_enter+0x198/0x2dc)
[<c006339c>] (suspend_devices_and_enter) from [<c0063654>] (pm_suspend+0x174/0x1e8)
[<c0063654>] (pm_suspend) from [<c00624e0>] (state_store+0x6c/0xbc)
[<c00624e0>] (state_store) from [<c01fc200>] (kobj_attr_store+0x14/0x20)
[<c01fc200>] (kobj_attr_store) from [<c0126e50>] (sysfs_kf_write+0x44/0x48)
[<c0126e50>] (sysfs_kf_write) from [<c012a274>] (kernfs_fop_write+0xb4/0x14c)
[<c012a274>] (kernfs_fop_write) from [<c00d4818>] (vfs_write+0xa8/0x180)
[<c00d4818>] (vfs_write) from [<c00d4bb8>] (SyS_write+0x3c/0x70)
[<c00d4bb8>] (SyS_write) from [<c000e620>] (ret_fast_syscall+0x0/0x30)
---[ end trace 76969904b614c18f ]---

Fix this by removing sysfs link for cpufreq directory when cpu removed
isn't policy->cpu.

Cc: <stable@vger.kernel.org> # 3.13.x
Revamps: 42f921a (cpufreq: remove sysfs files for CPUs which failed to come back after resume)
Reported-and-tested-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/cpufreq/cpufreq.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 99a443e..2aaa6cf 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1223,8 +1223,7 @@ static int __cpufreq_remove_dev_prepare(struct device *dev,
 	up_read(&policy->rwsem);
 
 	if (cpu != policy->cpu) {
-		if (!frozen)
-			sysfs_remove_link(&dev->kobj, "cpufreq");
+		sysfs_remove_link(&dev->kobj, "cpufreq");
 	} else if (cpus > 1) {
 		new_cpu = cpufreq_nominate_new_policy_cpu(policy, cpu);
 		if (new_cpu >= 0) {
-- 
1.7.12.rc2.18.g61b472e


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

end of thread, other threads:[~2014-04-08 12:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-17  9:22 [PATCH] cpufreq: remove sysfs link when a cpu != policy->cpu, is removed Viresh Kumar
2014-02-17 22:03 ` Rafael J. Wysocki
2014-04-07 17:15   ` Sören Brinkmann
2014-04-07 17:15     ` Sören Brinkmann
2014-04-07 17:15     ` Sören Brinkmann
2014-04-08  4:22     ` Viresh Kumar
2014-04-08  4:22       ` Viresh Kumar
2014-02-18 20:05 ` Stephen Warren
2014-04-08  4:21 Viresh Kumar
2014-04-08 12:09 ` Rafael J. Wysocki

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.