lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1292378268.2323.464.camel@sli10-conroe>
Date:	Wed, 15 Dec 2010 09:57:48 +0800
From:	Shaohua Li <shaohua.li@...el.com>
To:	Tejun Heo <htejun@...il.com>
Cc:	lkml <linux-kernel@...r.kernel.org>,
	"hpa@...or.com" <hpa@...or.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	"sam@...nborg.org" <sam@...nborg.org>,
	"eric.dumazet@...il.com" <eric.dumazet@...il.com>
Subject: Re: [patch 2/3] add new macros to make percpu readmostly section
 correctly align

On Tue, 2010-12-14 at 17:58 +0800, Tejun Heo wrote:
> Hello,
> 
> On 12/14/2010 02:08 AM, Shaohua Li wrote:
> > I don't understand what you mean. defining a cachine line size macro
> > for all archs? There is such macro, but using it in vmlinux.ld.h
> > always report error. There is some other defines which can't be
> > included in a link script.
> 
> I haven't really looked through it but wouldn't it be possible to
> ifdef it.  ie. if cacheline macro is available, align it to it;
> otherwise, don't.  And, ultimately, the correct thing to do is making
> it cacheline aligned on all archs.  There can be several different
> ways to get there but it might just as well be making cacheline size
> available in all archs first and then update the PERCPU macro.
How about this one?

Subject: Make x86 percpu readmostly section correctly aligned

percpu readmostly section should start and end at address cachline aligned to
avoid cache false sharing. For ARCHs care about the cache false sharing,
they should define INTERNODE_CACHE_BYTES. We use it to do the alignment.
Currently only x86 has percpu readmostly section, so only changed it so far.

Signed-off-by: Shaohua Li <shaohua.li@...el.com>

---
 arch/x86/kernel/vmlinux.lds.S     |    2 +-
 include/asm-generic/vmlinux.lds.h |   11 +++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

Index: linux/include/asm-generic/vmlinux.lds.h
===================================================================
--- linux.orig/include/asm-generic/vmlinux.lds.h	2010-12-15 09:27:26.000000000 +0800
+++ linux/include/asm-generic/vmlinux.lds.h	2010-12-15 09:55:22.000000000 +0800
@@ -665,6 +665,13 @@
 	*(.discard.*)							\
 	}
 
+#ifdef INTERNODE_CACHE_BYTES
+#define INTERNODE_CACHEALIGNED						\
+	. = ALIGN(INTERNODE_CACHE_BYTES);
+#else
+#define INTERNODE_CACHEALIGNED
+#endif
+
 /**
  * PERCPU_VADDR - define output section for percpu area
  * @vaddr: explicit base address (optional)
@@ -692,7 +699,9 @@
 		*(.data..percpu..first)					\
 		. = ALIGN(PAGE_SIZE);					\
 		*(.data..percpu..page_aligned)				\
+		INTERNODE_CACHEALIGNED					\
 		*(.data..percpu..readmostly)				\
+		INTERNODE_CACHEALIGNED					\
 		*(.data..percpu)					\
 		*(.data..percpu..shared_aligned)			\
 		VMLINUX_SYMBOL(__per_cpu_end) = .;			\
@@ -720,7 +729,9 @@
 		*(.data..percpu..first)					\
 		. = ALIGN(PAGE_SIZE);					\
 		*(.data..percpu..page_aligned)				\
+		INTERNODE_CACHEALIGNED					\
 		*(.data..percpu..readmostly)				\
+		INTERNODE_CACHEALIGNED					\
 		*(.data..percpu)					\
 		*(.data..percpu..shared_aligned)			\
 		VMLINUX_SYMBOL(__per_cpu_end) = .;			\
Index: linux/arch/x86/kernel/vmlinux.lds.S
===================================================================
--- linux.orig/arch/x86/kernel/vmlinux.lds.S	2010-12-15 09:37:01.000000000 +0800
+++ linux/arch/x86/kernel/vmlinux.lds.S	2010-12-15 09:37:06.000000000 +0800
@@ -20,11 +20,11 @@
 #define LOAD_OFFSET __START_KERNEL_map
 #endif
 
-#include <asm-generic/vmlinux.lds.h>
 #include <asm/asm-offsets.h>
 #include <asm/thread_info.h>
 #include <asm/page_types.h>
 #include <asm/cache.h>
+#include <asm-generic/vmlinux.lds.h>
 #include <asm/boot.h>
 
 #undef i386     /* in case the preprocessor is a 32bit one */


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ