LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* powerpc: set ARCH_KMALLOC_MINALIGN if CONFIG_NOT_COHERENT_CACHE=y
@ 2006-03-03 20:09 Dale Farnsworth
  2006-03-03 21:12 ` Dale Farnsworth
  0 siblings, 1 reply; 2+ messages in thread
From: Dale Farnsworth @ 2006-03-03 20:09 UTC (permalink / raw)
  To: linuxppc-dev

From: Dale Farnsworth <dale@farnsworth.org>

Ensure that buffers returned by kmalloc do not share a cache
line with other data when doing non-cache-coherent I/O.

Signed-off-by: Dale Farnsworth <dale@farnsworth.org>

---

Without this patch, when CONFIG_SLAB_DEBUG=y, the buffer
allocated by kmalloc shares a cache line with the redzone1 area.
This can cause false messages of this type:
	slab error in cache_free_debugcheck(): cache `size-2048':
	double free, or memory outside object was overwritten

We could work around it in each driver, but ARCH_KMALLOC_MINALIGN
is provided for this purpose, so use it.

 include/asm-powerpc/cache.h |    4 ++++
 1 file changed, 4 insertions(+)

Index: linux-2.6-mv643xx_enet/include/asm-powerpc/cache.h
===================================================================
--- linux-2.6-mv643xx_enet.orig/include/asm-powerpc/cache.h
+++ linux-2.6-mv643xx_enet/include/asm-powerpc/cache.h
@@ -20,6 +20,10 @@
 
 #define	SMP_CACHE_BYTES		L1_CACHE_BYTES
 
+#ifdef CONFIG_NOT_COHERENT_CACHE
+#define ARCH_KMALLOC_MINALIGN	L1_CACHE_BYTES
+#endif
+
 #if defined(__powerpc64__) && !defined(__ASSEMBLY__)
 struct ppc64_caches {
 	u32	dsize;			/* L1 d-cache size */

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

* Re: powerpc: set ARCH_KMALLOC_MINALIGN if CONFIG_NOT_COHERENT_CACHE=y
  2006-03-03 20:09 powerpc: set ARCH_KMALLOC_MINALIGN if CONFIG_NOT_COHERENT_CACHE=y Dale Farnsworth
@ 2006-03-03 21:12 ` Dale Farnsworth
  0 siblings, 0 replies; 2+ messages in thread
From: Dale Farnsworth @ 2006-03-03 21:12 UTC (permalink / raw)
  To: linuxppc-dev

In article <20060303200928.GA29099@xyzzy.farnsworth.org> you write:
> Ensure that buffers returned by kmalloc do not share a cache
> line with other data when doing non-cache-coherent I/O.

Eugene Surovegin points out that ARCH_KMALLOC_MINALIGN
doesn't work as avertised.

This patch doesn't work.

Thanks,
-Dale

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

end of thread, other threads:[~2006-03-03 21:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-03 20:09 powerpc: set ARCH_KMALLOC_MINALIGN if CONFIG_NOT_COHERENT_CACHE=y Dale Farnsworth
2006-03-03 21:12 ` Dale Farnsworth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox