* [PATCH 3/3] Initial cut to add __read_mostly support for powerpc.
2007-07-04 4:04 [PATCH 0/3] Patches for consideration for 2.6.23 Tony Breeds
@ 2007-07-04 4:04 ` Tony Breeds
2007-07-04 4:04 ` [PATCH 1/3] Create a dummy zImage if no valid platform has been selected Tony Breeds
2007-07-04 4:04 ` [PATCH 2/3] Modify sched_clock() to make CONFIG_PRINTK_TIME more sane Tony Breeds
2 siblings, 0 replies; 6+ messages in thread
From: Tony Breeds @ 2007-07-04 4:04 UTC (permalink / raw)
To: linuxppc-dev
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
---
This didn't get musch feedback the first time I posted it, so it's either
perfect ;P or it got missed.
arch/powerpc/kernel/vmlinux.lds.S | 6 ++++++
include/asm-powerpc/cache.h | 2 ++
2 files changed, 8 insertions(+)
Index: working/arch/powerpc/kernel/vmlinux.lds.S
===================================================================
--- working.orig/arch/powerpc/kernel/vmlinux.lds.S
+++ working/arch/powerpc/kernel/vmlinux.lds.S
@@ -7,6 +7,7 @@
#define PROVIDE32(x) PROVIDE(x)
#endif
#include <asm-generic/vmlinux.lds.h>
+#include <asm/cache.h>
ENTRY(_stext)
@@ -211,6 +212,11 @@ SECTIONS
*(.data.cacheline_aligned)
}
+ . = ALIGN(L1_CACHE_BYTES);
+ .data.read_mostly : {
+ *(.data.read_mostly)
+ }
+
. = ALIGN(PAGE_SIZE);
__data_nosave : {
__nosave_begin = .;
Index: working/include/asm-powerpc/cache.h
===================================================================
--- working.orig/include/asm-powerpc/cache.h
+++ working/include/asm-powerpc/cache.h
@@ -34,5 +34,9 @@ struct ppc64_caches {
extern struct ppc64_caches ppc64_caches;
#endif /* __powerpc64__ && ! __ASSEMBLY__ */
+#if !defined(__ASSEMBLY__)
+#define __read_mostly __attribute__((__section__(".data.read_mostly")))
+#endif
+
#endif /* __KERNEL__ */
#endif /* _ASM_POWERPC_CACHE_H */
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 1/3] Create a dummy zImage if no valid platform has been selected.
2007-07-04 4:04 [PATCH 0/3] Patches for consideration for 2.6.23 Tony Breeds
2007-07-04 4:04 ` [PATCH 3/3] Initial cut to add __read_mostly support for powerpc Tony Breeds
@ 2007-07-04 4:04 ` Tony Breeds
2007-07-04 4:04 ` [PATCH 2/3] Modify sched_clock() to make CONFIG_PRINTK_TIME more sane Tony Breeds
2 siblings, 0 replies; 6+ messages in thread
From: Tony Breeds @ 2007-07-04 4:04 UTC (permalink / raw)
To: linuxppc-dev
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
---
arch/powerpc/boot/Makefile | 10 ++++++++++
1 file changed, 10 insertions(+)
Index: working/arch/powerpc/boot/Makefile
===================================================================
--- working.orig/arch/powerpc/boot/Makefile
+++ working/arch/powerpc/boot/Makefile
@@ -184,6 +184,11 @@ $(obj)/zImage.initrd.%: vmlinux $(wrappe
$(obj)/zImage.%: vmlinux $(wrapperbits)
$(call if_changed,wrap,$*)
+# This cannot be in the root of $(src) as the zImage rule always adds a $(obj)
+# prefix
+$(obj)/vmlinux.strip: vmlinux
+ $(STRIP) -s -R .comment $< -o $@
+
$(obj)/zImage.iseries: vmlinux
$(STRIP) -s -R .comment $< -o $@
@@ -215,6 +220,11 @@ $(obj)/treeImage.initrd.%: vmlinux $(dts
$(obj)/treeImage.%: vmlinux $(dts) $(wrapperbits)
$(call if_changed,wrap,treeboot-$*,$(dts))
+# If there isn't a platform selected then just strip the vmlinux.
+ifeq (,$(image-y))
+image-y := vmlinux.strip
+endif
+
$(obj)/zImage: $(addprefix $(obj)/, $(image-y))
@rm -f $@; ln $< $@
$(obj)/zImage.initrd: $(addprefix $(obj)/, $(initrd-y))
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/3] Modify sched_clock() to make CONFIG_PRINTK_TIME more sane.
2007-07-04 4:04 [PATCH 0/3] Patches for consideration for 2.6.23 Tony Breeds
2007-07-04 4:04 ` [PATCH 3/3] Initial cut to add __read_mostly support for powerpc Tony Breeds
2007-07-04 4:04 ` [PATCH 1/3] Create a dummy zImage if no valid platform has been selected Tony Breeds
@ 2007-07-04 4:04 ` Tony Breeds
2007-07-04 4:27 ` Michael Ellerman
2 siblings, 1 reply; 6+ messages in thread
From: Tony Breeds @ 2007-07-04 4:04 UTC (permalink / raw)
To: linuxppc-dev
When booting a current kernel with CONFIG_PRINTK_TIME enabled you'll
see messages like:
[ 0.000000] time_init: decrementer frequency = 188.044000 MHz
[ 0.000000] time_init: processor frequency = 1504.352000 MHz
[3712914.436297] Console: colour dummy device 80x25
This cause by the initialisation of tb_to_ns_scale in time_init(), suddenly the
multiplication in sched_clock() now does something :). This patch modifies
sched_clock() to report the offset since the machine booted so the same
printk's now look like:
[ 0.000000] time_init: decrementer frequency = 188.044000 MHz
[ 0.000000] time_init: processor frequency = 1504.352000 MHz
[ 0.000135] Console: colour dummy device 80x25
Effectivly including the uptime in printk()s.
This patch makes tb_to_ns_scale and tb_to_ns_shift static and read_mostly for
good meassure.
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
---
There looks to be other variables that could be made static, I think
that's a job for another day though.
arch/powerpc/kernel/time.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
Index: working/arch/powerpc/kernel/time.c
===================================================================
--- working.orig/arch/powerpc/kernel/time.c
+++ working/arch/powerpc/kernel/time.c
@@ -113,8 +113,9 @@ u64 ticklen_to_xs; /* 0.64 fraction */
DEFINE_SPINLOCK(rtc_lock);
EXPORT_SYMBOL_GPL(rtc_lock);
-u64 tb_to_ns_scale;
-unsigned tb_to_ns_shift;
+static u64 tb_to_ns_scale __read_mostly;
+static unsigned tb_to_ns_shift __read_mostly;
+static unsigned long boot_tb __read_mostly;
struct gettimeofday_struct do_gtod;
@@ -735,7 +736,7 @@ unsigned long long sched_clock(void)
{
if (__USE_RTC())
return get_rtc();
- return mulhdu(get_tb(), tb_to_ns_scale) << tb_to_ns_shift;
+ return mulhdu(get_tb() - boot_tb, tb_to_ns_scale) << tb_to_ns_shift;
}
int do_settimeofday(struct timespec *tv)
@@ -960,6 +961,8 @@ void __init time_init(void)
}
tb_to_ns_scale = scale;
tb_to_ns_shift = shift;
+ /* Save the current timebase to pretty up CONFIG_PRINTK_TIME */
+ boot_tb = get_tb();
tm = get_boot_time();
^ permalink raw reply [flat|nested] 6+ messages in thread