linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] metag: cache aliasing detection fixes
@ 2013-06-24 12:49 James Hogan
  2013-06-24 12:49 ` [PATCH 1/2] metag: panic if cache aliasing possible James Hogan
  2013-06-24 12:49 ` [PATCH 2/2] metag: don't check for cache aliasing on smp cpu boot James Hogan
  0 siblings, 2 replies; 3+ messages in thread
From: James Hogan @ 2013-06-24 12:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: James Hogan

A couple of metag cache aliasing detection fixes I intend on applying
for v3.11.

James Hogan (2):
  metag: panic if cache aliasing possible
  metag: don't check for cache aliasing on smp cpu boot

 arch/metag/kernel/cachepart.c | 13 +++++++------
 arch/metag/kernel/smp.c       |  6 ------
 2 files changed, 7 insertions(+), 12 deletions(-)

-- 
1.8.1.2



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] metag: panic if cache aliasing possible
  2013-06-24 12:49 [PATCH 0/2] metag: cache aliasing detection fixes James Hogan
@ 2013-06-24 12:49 ` James Hogan
  2013-06-24 12:49 ` [PATCH 2/2] metag: don't check for cache aliasing on smp cpu boot James Hogan
  1 sibling, 0 replies; 3+ messages in thread
From: James Hogan @ 2013-06-24 12:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: James Hogan

If the cache and page size configuration allows for cache aliasing to
occur we warn on boot, but the log messages are easy to miss and will
result is random crashes occuring in userland. Let's panic too in this
case so that the user immediately knows they need to fix the cache
configuration or configured page size.

Also fix the warning messages which display the cache and page sizes to
include newlines, and add the word "Potential" since an actual cache
alias hasn't been detected.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
---
 arch/metag/kernel/cachepart.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/metag/kernel/cachepart.c b/arch/metag/kernel/cachepart.c
index 954548b..0a2385f 100644
--- a/arch/metag/kernel/cachepart.c
+++ b/arch/metag/kernel/cachepart.c
@@ -100,22 +100,23 @@ void check_for_cache_aliasing(int thread_id)
 		thread_cache_size =
 				get_thread_cache_size(cache_type, thread_id);
 		if (thread_cache_size < 0)
-			pr_emerg("Can't read %s cache size", \
+			pr_emerg("Can't read %s cache size\n",
 				 cache_type ? "DCACHE" : "ICACHE");
 		else if (thread_cache_size == 0)
 			/* Cache is off. No need to check for aliasing */
 			continue;
 		if (thread_cache_size / CACHE_ASSOCIATIVITY > PAGE_SIZE) {
-			pr_emerg("Cache aliasing detected in %s on Thread %d",
+			pr_emerg("Potential cache aliasing detected in %s on Thread %d\n",
 				 cache_type ? "DCACHE" : "ICACHE", thread_id);
-			pr_warn("Total %s size: %u bytes",
-				cache_type ? "DCACHE" : "ICACHE ",
+			pr_warn("Total %s size: %u bytes\n",
+				cache_type ? "DCACHE" : "ICACHE",
 				cache_type ? get_dcache_size()
 				: get_icache_size());
-			pr_warn("Thread %s size: %d bytes",
+			pr_warn("Thread %s size: %d bytes\n",
 				cache_type ? "CACHE" : "ICACHE",
 				thread_cache_size);
-			pr_warn("Page Size: %lu bytes", PAGE_SIZE);
+			pr_warn("Page Size: %lu bytes\n", PAGE_SIZE);
+			panic("Potential cache aliasing detected");
 		}
 	}
 }
-- 
1.8.1.2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] metag: don't check for cache aliasing on smp cpu boot
  2013-06-24 12:49 [PATCH 0/2] metag: cache aliasing detection fixes James Hogan
  2013-06-24 12:49 ` [PATCH 1/2] metag: panic if cache aliasing possible James Hogan
@ 2013-06-24 12:49 ` James Hogan
  1 sibling, 0 replies; 3+ messages in thread
From: James Hogan @ 2013-06-24 12:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: James Hogan

The cache configuration of the boot cpu is now duplicated to secondary
cpus, so there's no need to check for cache aliasing again when a
secondary cpu is booted. Therefore remove the check from
secondary_start_kernel().

Signed-off-by: James Hogan <james.hogan@imgtec.com>
---
 arch/metag/kernel/smp.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/arch/metag/kernel/smp.c b/arch/metag/kernel/smp.c
index f443ec9..86fdda4 100644
--- a/arch/metag/kernel/smp.c
+++ b/arch/metag/kernel/smp.c
@@ -404,12 +404,6 @@ asmlinkage void secondary_start_kernel(void)
 	set_cpu_online(cpu, true);
 
 	/*
-	 * Check for cache aliasing.
-	 * Preemption is disabled
-	 */
-	check_for_cache_aliasing(cpu);
-
-	/*
 	 * OK, it's off to the idle thread for us
 	 */
 	cpu_startup_entry(CPUHP_ONLINE);
-- 
1.8.1.2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-06-24 12:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-24 12:49 [PATCH 0/2] metag: cache aliasing detection fixes James Hogan
2013-06-24 12:49 ` [PATCH 1/2] metag: panic if cache aliasing possible James Hogan
2013-06-24 12:49 ` [PATCH 2/2] metag: don't check for cache aliasing on smp cpu boot James Hogan

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).