* [PATCH 0/4] cacheinfo instrumentation tweaks @ 2019-06-27 5:15 Nathan Lynch 2019-06-27 5:15 ` [PATCH 1/4] powerpc/cacheinfo: set pr_fmt Nathan Lynch ` (4 more replies) 0 siblings, 5 replies; 6+ messages in thread From: Nathan Lynch @ 2019-06-27 5:15 UTC (permalink / raw) To: linuxppc-dev A few changes that would have aided debugging this code's interactions with partition migration, maybe they'll help with the next thing (hibernation?). Nathan Lynch (4): powerpc/cacheinfo: set pr_fmt powerpc/cacheinfo: name@unit instead of full DT path in debug messages powerpc/cacheinfo: improve diagnostics about malformed cache lists powerpc/cacheinfo: warn if cache object chain becomes unordered arch/powerpc/kernel/cacheinfo.c | 37 ++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 10 deletions(-) -- 2.20.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/4] powerpc/cacheinfo: set pr_fmt 2019-06-27 5:15 [PATCH 0/4] cacheinfo instrumentation tweaks Nathan Lynch @ 2019-06-27 5:15 ` Nathan Lynch 2019-06-27 5:15 ` [PATCH 2/4] powerpc/cacheinfo: name@unit instead of full DT path in debug messages Nathan Lynch ` (3 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: Nathan Lynch @ 2019-06-27 5:15 UTC (permalink / raw) To: linuxppc-dev Set pr_fmt so we get a nice prefix on messages. Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com> --- arch/powerpc/kernel/cacheinfo.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c index 42c559efe060..295af19e00f0 100644 --- a/arch/powerpc/kernel/cacheinfo.c +++ b/arch/powerpc/kernel/cacheinfo.c @@ -10,6 +10,8 @@ * 2 as published by the Free Software Foundation. */ +#define pr_fmt(fmt) "cacheinfo: " fmt + #include <linux/cpu.h> #include <linux/cpumask.h> #include <linux/kernel.h> -- 2.20.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/4] powerpc/cacheinfo: name@unit instead of full DT path in debug messages 2019-06-27 5:15 [PATCH 0/4] cacheinfo instrumentation tweaks Nathan Lynch 2019-06-27 5:15 ` [PATCH 1/4] powerpc/cacheinfo: set pr_fmt Nathan Lynch @ 2019-06-27 5:15 ` Nathan Lynch 2019-06-27 5:15 ` [PATCH 3/4] powerpc/cacheinfo: improve diagnostics about malformed cache lists Nathan Lynch ` (2 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: Nathan Lynch @ 2019-06-27 5:15 UTC (permalink / raw) To: linuxppc-dev We know that every OF node we deal with in this code is under /cpus, so we can make the debug messages a little less verbose without losing information. E.g. cacheinfo: creating L1 dcache and icache for /cpus/PowerPC,POWER8@0 cacheinfo: creating L2 ucache for /cpus/l2-cache@2006 cacheinfo: creating L3 ucache for /cpus/l3-cache@3106 becomes cacheinfo: creating L1 dcache and icache for PowerPC,POWER8@0 cacheinfo: creating L2 ucache for l2-cache@2006 cacheinfo: creating L3 ucache for l3-cache@3106 Replace all '%pOF' specifiers with '%pOFP'. Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com> --- arch/powerpc/kernel/cacheinfo.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c index 295af19e00f0..d8200f7e1075 100644 --- a/arch/powerpc/kernel/cacheinfo.c +++ b/arch/powerpc/kernel/cacheinfo.c @@ -171,7 +171,7 @@ static void release_cache_debugcheck(struct cache *cache) list_for_each_entry(iter, &cache_list, list) WARN_ONCE(iter->next_local == cache, - "cache for %pOF(%s) refers to cache for %pOF(%s)\n", + "cache for %pOFP(%s) refers to cache for %pOFP(%s)\n", iter->ofnode, cache_type_string(iter), cache->ofnode, @@ -183,7 +183,7 @@ static void release_cache(struct cache *cache) if (!cache) return; - pr_debug("freeing L%d %s cache for %pOF\n", cache->level, + pr_debug("freeing L%d %s cache for %pOFP\n", cache->level, cache_type_string(cache), cache->ofnode); release_cache_debugcheck(cache); @@ -198,7 +198,7 @@ static void cache_cpu_set(struct cache *cache, int cpu) while (next) { WARN_ONCE(cpumask_test_cpu(cpu, &next->shared_cpu_map), - "CPU %i already accounted in %pOF(%s)\n", + "CPU %i already accounted in %pOFP(%s)\n", cpu, next->ofnode, cache_type_string(next)); cpumask_set_cpu(cpu, &next->shared_cpu_map); @@ -359,7 +359,7 @@ static int cache_is_unified_d(const struct device_node *np) */ static struct cache *cache_do_one_devnode_unified(struct device_node *node, int level) { - pr_debug("creating L%d ucache for %pOF\n", level, node); + pr_debug("creating L%d ucache for %pOFP\n", level, node); return new_cache(cache_is_unified_d(node), level, node); } @@ -369,7 +369,7 @@ static struct cache *cache_do_one_devnode_split(struct device_node *node, { struct cache *dcache, *icache; - pr_debug("creating L%d dcache and icache for %pOF\n", level, + pr_debug("creating L%d dcache and icache for %pOFP\n", level, node); dcache = new_cache(CACHE_TYPE_DATA, level, node); @@ -740,13 +740,13 @@ static void cacheinfo_create_index_opt_attrs(struct cache_index_dir *dir) rc = attr->show(&dir->kobj, attr, buf); if (rc <= 0) { pr_debug("not creating %s attribute for " - "%pOF(%s) (rc = %zd)\n", + "%pOFP(%s) (rc = %zd)\n", attr->attr.name, cache->ofnode, cache_type, rc); continue; } if (sysfs_create_file(&dir->kobj, &attr->attr)) - pr_debug("could not create %s attribute for %pOF(%s)\n", + pr_debug("could not create %s attribute for %pOFP(%s)\n", attr->attr.name, cache->ofnode, cache_type); } @@ -862,7 +862,7 @@ static void cache_cpu_clear(struct cache *cache, int cpu) struct cache *next = cache->next_local; WARN_ONCE(!cpumask_test_cpu(cpu, &cache->shared_cpu_map), - "CPU %i not accounted in %pOF(%s)\n", + "CPU %i not accounted in %pOFP(%s)\n", cpu, cache->ofnode, cache_type_string(cache)); -- 2.20.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/4] powerpc/cacheinfo: improve diagnostics about malformed cache lists 2019-06-27 5:15 [PATCH 0/4] cacheinfo instrumentation tweaks Nathan Lynch 2019-06-27 5:15 ` [PATCH 1/4] powerpc/cacheinfo: set pr_fmt Nathan Lynch 2019-06-27 5:15 ` [PATCH 2/4] powerpc/cacheinfo: name@unit instead of full DT path in debug messages Nathan Lynch @ 2019-06-27 5:15 ` Nathan Lynch 2019-06-27 5:15 ` [PATCH 4/4] powerpc/cacheinfo: warn if cache object chain becomes unordered Nathan Lynch 2020-08-02 13:35 ` [PATCH 0/4] cacheinfo instrumentation tweaks Michael Ellerman 4 siblings, 0 replies; 6+ messages in thread From: Nathan Lynch @ 2019-06-27 5:15 UTC (permalink / raw) To: linuxppc-dev If we have a bug which causes us to start with the wrong kind of OF node when linking up the cache tree, it's helpful for debugging to print information about what we found vs what we expected. So replace uses of WARN_ON_ONCE with WARN_ONCE, which lets us include an informative message instead of a contentless backtrace. Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com> --- arch/powerpc/kernel/cacheinfo.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c index d8200f7e1075..30be2cdc8aa9 100644 --- a/arch/powerpc/kernel/cacheinfo.c +++ b/arch/powerpc/kernel/cacheinfo.c @@ -429,8 +429,14 @@ static void link_cache_lists(struct cache *smaller, struct cache *bigger) static void do_subsidiary_caches_debugcheck(struct cache *cache) { - WARN_ON_ONCE(cache->level != 1); - WARN_ON_ONCE(!of_node_is_type(cache->ofnode, "cpu")); + WARN_ONCE(cache->level != 1, + "instantiating cache chain from L%d %s cache for " + "%pOFP instead of an L1\n", cache->level, + cache_type_string(cache), cache->ofnode); + WARN_ONCE(!of_node_is_type(cache->ofnode, "cpu"), + "instantiating cache chain from node %pOFP of type '%s' " + "instead of a cpu node\n", cache->ofnode, + of_node_get_device_type(cache->ofnode)); } static void do_subsidiary_caches(struct cache *cache) -- 2.20.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/4] powerpc/cacheinfo: warn if cache object chain becomes unordered 2019-06-27 5:15 [PATCH 0/4] cacheinfo instrumentation tweaks Nathan Lynch ` (2 preceding siblings ...) 2019-06-27 5:15 ` [PATCH 3/4] powerpc/cacheinfo: improve diagnostics about malformed cache lists Nathan Lynch @ 2019-06-27 5:15 ` Nathan Lynch 2020-08-02 13:35 ` [PATCH 0/4] cacheinfo instrumentation tweaks Michael Ellerman 4 siblings, 0 replies; 6+ messages in thread From: Nathan Lynch @ 2019-06-27 5:15 UTC (permalink / raw) To: linuxppc-dev This can catch cases where the device tree has gotten mishandled into an inconsistent state at runtime, e.g. the cache nodes for both the source and the destination are present after a migration. Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com> --- arch/powerpc/kernel/cacheinfo.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c index 30be2cdc8aa9..5938aeeba8c0 100644 --- a/arch/powerpc/kernel/cacheinfo.c +++ b/arch/powerpc/kernel/cacheinfo.c @@ -425,6 +425,15 @@ static void link_cache_lists(struct cache *smaller, struct cache *bigger) } smaller->next_local = bigger; + + /* + * The cache->next_local list sorts by level ascending: + * L1d -> L1i -> L2 -> L3 ... + */ + WARN_ONCE((smaller->level == 1 && bigger->level > 2) || + (smaller->level > 1 && bigger->level != smaller->level + 1), + "linking L%i cache %pOFP to L%i cache %pOFP; skipped a level?\n", + smaller->level, smaller->ofnode, bigger->level, bigger->ofnode); } static void do_subsidiary_caches_debugcheck(struct cache *cache) -- 2.20.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/4] cacheinfo instrumentation tweaks 2019-06-27 5:15 [PATCH 0/4] cacheinfo instrumentation tweaks Nathan Lynch ` (3 preceding siblings ...) 2019-06-27 5:15 ` [PATCH 4/4] powerpc/cacheinfo: warn if cache object chain becomes unordered Nathan Lynch @ 2020-08-02 13:35 ` Michael Ellerman 4 siblings, 0 replies; 6+ messages in thread From: Michael Ellerman @ 2020-08-02 13:35 UTC (permalink / raw) To: linuxppc-dev, Nathan Lynch On Thu, 27 Jun 2019 00:15:33 -0500, Nathan Lynch wrote: > A few changes that would have aided debugging this code's interactions > with partition migration, maybe they'll help with the next thing > (hibernation?). > > Nathan Lynch (4): > powerpc/cacheinfo: set pr_fmt > powerpc/cacheinfo: name@unit instead of full DT path in debug messages > powerpc/cacheinfo: improve diagnostics about malformed cache lists > powerpc/cacheinfo: warn if cache object chain becomes unordered > > [...] Applied to powerpc/next. [1/4] powerpc/cacheinfo: Set pr_fmt() https://git.kernel.org/powerpc/c/e2b3c165f27a6bdb197b0dc86683ed36f61c5527 [2/4] powerpc/cacheinfo: Use name@unit instead of full DT path in debug messages https://git.kernel.org/powerpc/c/be6f885e97e9304541057fbf25148685847ef310 [3/4] powerpc/cacheinfo: Improve diagnostics about malformed cache lists https://git.kernel.org/powerpc/c/1b3da8ffaa158e9a95c19b17c14d7259d58bc0cd [4/4] powerpc/cacheinfo: Warn if cache object chain becomes unordered https://git.kernel.org/powerpc/c/6ec54363f198aae9c1343f82ff5b865546944a73 cheers ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-08-02 14:04 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-06-27 5:15 [PATCH 0/4] cacheinfo instrumentation tweaks Nathan Lynch 2019-06-27 5:15 ` [PATCH 1/4] powerpc/cacheinfo: set pr_fmt Nathan Lynch 2019-06-27 5:15 ` [PATCH 2/4] powerpc/cacheinfo: name@unit instead of full DT path in debug messages Nathan Lynch 2019-06-27 5:15 ` [PATCH 3/4] powerpc/cacheinfo: improve diagnostics about malformed cache lists Nathan Lynch 2019-06-27 5:15 ` [PATCH 4/4] powerpc/cacheinfo: warn if cache object chain becomes unordered Nathan Lynch 2020-08-02 13:35 ` [PATCH 0/4] cacheinfo instrumentation tweaks Michael Ellerman
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).