summaryrefslogtreecommitdiff
path: root/arch/powerpc/kernel/cacheinfo.c
diff options
context:
space:
mode:
authorNathan Lynch <nathanl@linux.ibm.com>2019-06-27 08:15:37 +0300
committerMichael Ellerman <mpe@ellerman.id.au>2020-07-30 15:53:48 +0300
commit6ec54363f198aae9c1343f82ff5b865546944a73 (patch)
treeab59f468333813fb0173e69c0744dccd42d4c477 /arch/powerpc/kernel/cacheinfo.c
parent1b3da8ffaa158e9a95c19b17c14d7259d58bc0cd (diff)
downloadlinux-6ec54363f198aae9c1343f82ff5b865546944a73.tar.xz
powerpc/cacheinfo: Warn if cache object chain becomes unordered
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> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20190627051537.7298-5-nathanl@linux.ibm.com
Diffstat (limited to 'arch/powerpc/kernel/cacheinfo.c')
-rw-r--r--arch/powerpc/kernel/cacheinfo.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c
index a116d5bb6b12..65ab9fcebd31 100644
--- a/arch/powerpc/kernel/cacheinfo.c
+++ b/arch/powerpc/kernel/cacheinfo.c
@@ -420,6 +420,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)