LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Dale Farnsworth" <dale@farnsworth.org>
To: linuxppc-dev@ozlabs.org
Subject: powerpc: set ARCH_KMALLOC_MINALIGN if CONFIG_NOT_COHERENT_CACHE=y
Date: Fri, 3 Mar 2006 13:09:28 -0700	[thread overview]
Message-ID: <20060303200928.GA29099@xyzzy.farnsworth.org> (raw)

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 */

             reply	other threads:[~2006-03-03 20:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-03 20:09 Dale Farnsworth [this message]
2006-03-03 21:12 ` powerpc: set ARCH_KMALLOC_MINALIGN if CONFIG_NOT_COHERENT_CACHE=y Dale Farnsworth

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=20060303200928.GA29099@xyzzy.farnsworth.org \
    --to=dale@farnsworth.org \
    --cc=linuxppc-dev@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