Skip to contentSkip to conversation

drivers/base: cacheinfo: remove warning in resume

PATCH In review Sumit Gupta 2 participants 4 messages Aug 29, 2016 – Sep 2, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/base: cacheinfo: remove warning in resume

CPU notifier is present for creating device entries for child node "cache" under parent node "cpu" as per DT. During resume from suspend, while booting all non-boot CPU's, this notifier for adding cache device gets called before cpu device is added by device_resume. Because of this warning message of "parent should not be sleeping" comes during resume.

Removing the notifier to explicitly add/remove cache device as CPU and cache device get added/removed anyway as part of normal suspend resume sequence.
dpm_resume_end - > dpm_resume -> device_resume

---
 drivers/base/cacheinfo.c | 2 --
 1 file changed, 2 deletions(-)
drivers/base/cacheinfo.c +0 -2
index e9fd32e91668..17d9c051a16f 100644
@@ -544,8 +544,6 @@ static int __init cacheinfo_sysfs_init(void)
 			goto out;
 		}
 	}
-	__hotcpu_notifier(cacheinfo_cpu_callback, 0);
-
 out:
 	cpu_notifier_register_done();
 	return rc;
Signature · 1 line
2.1.4
#1 lore raw

Hi Sumit,

I understand the warning we get but the patch is completely wrong. One it removes the feature of adding/removing the cache devices on cpu hotplug events. Have you tested your patch with simple cpu hotplug and seen no change before and after this change ?

Quoted 3 lines · Sumit Gupta

CPU notifier is present for creating device entries for child node "cache" under parent node "cpu" as per DT.

Again DT is only on few architectures not on all(e.g. x86)

Quoted 8 lines

During resume from
suspend, while booting all non-boot CPU's, this notifier for adding cache device gets called before cpu device is added by device_resume. Because of this warning message of "parent should not be sleeping" comes during resume.

Yes that's correct and needs to be fixed. I have seen this but haven't spent much time to check in detail. It's harmless warning IMO. See the comment in the code too:"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"

CPU devices are special and they have separate hotplug paths. So we need to consider that for cpu devices and set is_prepared quite early.

Quoted 6 lines

Removing the notifier to explicitly add/remove cache device as CPU and cache device get added/removed anyway as part of normal suspend resume sequence.
dpm_resume_end - > dpm_resume -> device_resume

Yes, but:
1. the caches objects are visible even when the cpu is offline
2. how is this handled for normal cpu-hotplug events ? This patch breaks the existing feature.

Quoted 19 lines
---
 drivers/base/cacheinfo.c | 2 --
 1 file changed, 2 deletions(-)
drivers/base/cacheinfo.c +0 -2
index e9fd32e91668..17d9c051a16f 100644
@@ -544,8 +544,6 @@ static int __init cacheinfo_sysfs_init(void)
 			goto out;
 		}
 	}
-	__hotcpu_notifier(cacheinfo_cpu_callback, 0);
-
 out:
 	cpu_notifier_register_done();
 	return rc;
Signature · 2 lines
Regards,
Sudeep
#2 lore raw

Hi Sudeep,

Thank you for your comments.

Quoted 6 lines

I understand the warning we get but the patch is completely wrong. One it removes the feature of adding/removing the cache devices on cpu hotplug events. Have you tested your patch with simple cpu hotplug and seen no change before and after this change ?

I referred other node "cpufreq" under "cpu" node and that was also not getting deleted when core goes down. So, thought the behavior should be similar as entries are only used to read data and it won't change after boot.

Quoted 29 lines · Sumit Gupta
Quoted 2 lines

CPU notifier is present for creating device entries for child node "cache" under parent node "cpu" as per DT.

Again DT is only on few architectures not on all(e.g. x86)

Quoted 6 lines

During resume from
suspend, while booting all non-boot CPU's, this notifier for adding cache device gets called before cpu device is added by device_resume. Because of this warning message of "parent should not be sleeping" comes during resume.

Yes that's correct and needs to be fixed. I have seen this but haven't spent much time to check in detail. It's harmless warning IMO. See the comment in the code too:"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"

CPU devices are special and they have separate hotplug paths. So we need to consider that for cpu devices and set is_prepared quite early.

Quoted 6 lines

Removing the notifier to explicitly add/remove
cache device as CPU and cache device get
added/removed anyway as part of normal suspend
resume sequence.
dpm_resume_end - > dpm_resume -> device_resume

Quoted 4 lines

Yes, but:
1. the caches objects are visible even when the cpu is offline
2. how is this handled for normal cpu-hotplug events ? This patch breaks the existing feature.

Compared with x86 now and there even cpufreq is getting deleted.
As per the comments, right behavior seems to be where cache entries should be created during core on and removed during core off in hotplug. I will try to find other way of doing it. Also will see why cpufreq is not getting deleted as in x86.

Quoted 24 lines
Quoted 12 lines
---
 drivers/base/cacheinfo.c | 2 --
 1 file changed, 2 deletions(-)
drivers/base/cacheinfo.c +0 -0
index e9fd32e91668..17d9c051a16f 100644

drivers/base/cacheinfo.c static int __init cacheinfo_sysfs_init(void) · line 549

Quoted 8 lines
drivers/base/cacheinfo.c +0 -2
@@ -544,8 +544,6 @@ static int __init cacheinfo_sysfs_init(void)
 			goto out;
 		}
 	}
-	__hotcpu_notifier(cacheinfo_cpu_callback, 0);
-
 out:
 	cpu_notifier_register_done();
 	return rc;

--
Regards,
Sudeep

#3 lore raw
Quoted 10 lines · Sumit Gupta

Hi Sudeep,

Thank you for your comments.

Quoted 6 lines

I understand the warning we get but the patch is completely wrong. One it removes the feature of adding/removing the cache devices on cpu hotplug events. Have you tested your patch with simple cpu hotplug and seen no change before and after this change ?

Quoted 5 lines

I referred other node "cpufreq" under "cpu" node and that was also not getting deleted when core goes down. So, thought the behavior should be similar as entries are only used to read data and it won't change after boot.

I agree, but for caches it has been like this and in a way make sense.

Quoted 32 lines
Quoted 28 lines · Sumit Gupta
Quoted 2 lines

CPU notifier is present for creating device entries for child node "cache" under parent node "cpu" as per DT.

Again DT is only on few architectures not on all(e.g. x86)

Quoted 5 lines

During resume from suspend, while booting all non-boot CPU's, this notifier for adding cache device gets called before cpu device is added by device_resume. Because of this warning message of "parent should not be sleeping" comes during resume.

Yes that's correct and needs to be fixed. I have seen this but haven't spent much time to check in detail. It's harmless warning IMO. See the comment in the code too:"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"

CPU devices are special and they have separate hotplug paths. So we need to consider that for cpu devices and set is_prepared quite early.

Quoted 5 lines

Removing the notifier to explicitly add/remove cache device as CPU and cache device get added/removed anyway as part of normal suspend resume sequence. dpm_resume_end - > dpm_resume -> device_resume

Quoted 3 lines

Yes, but: 1. the caches objects are visible even when the cpu is offline 2. how is this handled for normal cpu-hotplug events ? This patch breaks the existing feature.

Quoted 6 lines

Compared with x86 now and there even cpufreq is getting deleted. As per the comments, right behavior seems to be where cache entries should be created during core on and removed during core off in hotplug. I will try to find other way of doing it. Also will see why cpufreq is not getting deleted as in x86.

IIUC you are saying cpufreq sysfs entries are deleted on x86 while not on ARM{32,64} ? If so are you running same kernel version on both x86 and ARM ? I remember some recent change around cpufreq sysfs entries, it could be result of that.

Signature · 6 lines
Regards,
Sudeep

-- 
Regards,
Sudeep