From: Nathan Lynch <nathanl@linux.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Subject: [PATCH 4/4] powerpc/cacheinfo: warn if cache object chain becomes unordered
Date: Thu, 27 Jun 2019 00:15:37 -0500 [thread overview]
Message-ID: <20190627051537.7298-5-nathanl@linux.ibm.com> (raw)
In-Reply-To: <20190627051537.7298-1-nathanl@linux.ibm.com>
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
next prev parent reply other threads:[~2019-06-27 5:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Nathan Lynch [this message]
2020-08-02 13:35 ` [PATCH 0/4] cacheinfo instrumentation tweaks Michael Ellerman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190627051537.7298-5-nathanl@linux.ibm.com \
--to=nathanl@linux.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).