Skip to contentSkip to conversation

Patches for consideration for 2.6.23.

PATCH In review Tony Breeds 2 participants 6 messages Jul 4, 2007 PowerPC

lore
Share & tools
lore
#0 lore raw

cover Patches for consideration for 2.6.23.

This is set of 3 patches that have been sent through the list as RFCs. I believe that I've addressed any feedback that was raised. Each of the patches is independant of the other and order is not important.

More feedback is always welcome.

Yours Tony

linux.conf.au http://linux.conf.au/ || http://lca2008.linux.org.au/
Jan 28 - Feb 02 2008 The Australian Linux Technical Conference!

#1 lore raw

PATCH 1/3 Create a dummy zImage if no valid platform has been selected.

---
 arch/powerpc/boot/Makefile |   10 ++++++++++
 1 file changed, 10 insertions(+)
arch/powerpc/boot/Makefile +5 -0
Index: 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))

#2 lore raw

PATCH 2/3 Modify sched_clock() to make CONFIG_PRINTK_TIME more sane.

In reply to Tony Breeds

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.

---
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(-)
arch/powerpc/kernel/time.c +6 -3
Index: 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();
 
#3 lore raw

Re: [PATCH 2/3] Modify sched_clock() to make CONFIG_PRINTK_TIME more sane.

Quoted 12 lines · Tony Breeds

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:

Quoted 5 lines
[    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.

Is this what other archs do?

cheers

Signature · 8 lines
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
#4 lore raw

Re: [PATCH 2/3] Modify sched_clock() to make CONFIG_PRINTK_TIME more sane.

Quoted 1 line · Michael Ellerman

Is this what other archs do?

They either use jiffies, or AFAICT an external counter that is initialised to 0 at system powerup.

Yours Tony

linux.conf.au http://linux.conf.au/ || http://lca2008.linux.org.au/
Jan 28 - Feb 02 2008 The Australian Linux Technical Conference!

#5 lore raw

PATCH 3/3 Initial cut to add __read_mostly support for powerpc.

In reply to Tony Breeds

---
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(+)
arch/powerpc/kernel/vmlinux.lds.S +6 -0
Index: 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 = .;
include/asm-powerpc/cache.h +4 -0
Index: 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 */