Skip to content

Commit

Permalink
powerpc/cacheinfo: Warn if cache object chain becomes unordered
Browse files Browse the repository at this point in the history
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]
  • Loading branch information
nathanlynch authored and mpe committed Jul 30, 2020
1 parent 1b3da8f commit 6ec5436
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions arch/powerpc/kernel/cacheinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6ec5436

Please sign in to comment.