Skip to content

Commit 6ec5436

Browse files
nathanlynchmpe
authored andcommitted
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 <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 1b3da8f commit 6ec5436

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

arch/powerpc/kernel/cacheinfo.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,15 @@ static void link_cache_lists(struct cache *smaller, struct cache *bigger)
420420
}
421421

422422
smaller->next_local = bigger;
423+
424+
/*
425+
* The cache->next_local list sorts by level ascending:
426+
* L1d -> L1i -> L2 -> L3 ...
427+
*/
428+
WARN_ONCE((smaller->level == 1 && bigger->level > 2) ||
429+
(smaller->level > 1 && bigger->level != smaller->level + 1),
430+
"linking L%i cache %pOFP to L%i cache %pOFP; skipped a level?\n",
431+
smaller->level, smaller->ofnode, bigger->level, bigger->ofnode);
423432
}
424433

425434
static void do_subsidiary_caches_debugcheck(struct cache *cache)

0 commit comments

Comments
 (0)