All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2.6.14-rt11 1/3] Fix LPPTEST Kconfig dependancies
@ 2005-11-11 20:42 Tom Rini
  2005-11-11 20:43 ` [PATCH 2.6.14-rt11 2/3] Switch to using get_cycles() rather than get_cpu_tick() Tom Rini
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Tom Rini @ 2005-11-11 20:42 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Tom Rini, Sven-Thorsten Dietrich, lkml

Since the LPPTEST driver depends on an x86-PC, make the Kconfig choice
do so as well.

Signed-off-by: Tom Rini <trini@kernel.crashing.org>

 drivers/char/Kconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.14/drivers/char/Kconfig
===================================================================
--- linux-2.6.14.orig/drivers/char/Kconfig
+++ linux-2.6.14/drivers/char/Kconfig
@@ -729,7 +729,7 @@ config BLOCKER
 
 config LPPTEST
 	tristate "Parallel Port Based Latency Measurement Device"
-	depends on !PARPORT
+	depends on !PARPORT && X86
 	default y
 	---help---
 	  If you say Y here then a device will be created that the userspace

-- 
Tom

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

* [PATCH 2.6.14-rt11 2/3] Switch to using get_cycles() rather than get_cpu_tick()
  2005-11-11 20:42 [PATCH 2.6.14-rt11 1/3] Fix LPPTEST Kconfig dependancies Tom Rini
@ 2005-11-11 20:43 ` Tom Rini
  2005-11-12 14:23   ` Ingo Molnar
  2005-11-11 20:43 ` [PATCH 2.6.14-rt11 3/3] Fix ppc32 bootwrapper code for new zlib Tom Rini
  2005-11-12 14:21 ` [PATCH 2.6.14-rt11 1/3] Fix LPPTEST Kconfig dependancies Ingo Molnar
  2 siblings, 1 reply; 7+ messages in thread
From: Tom Rini @ 2005-11-11 20:43 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Tom Rini, Sven-Thorsten Dietrich, lkml

In a few different drivers we had what boiled down to a custom
implementation of get_cycles().  On i386 and ppc32 this was the same
code, and I assume similar for ARM and MIPS.  In one case
(kernel/latency.c) it really was get_cycles() in the !i386 case.  Always
using get_cycles() makes new platform bringup easier.

Signed-off-by: Tom Rini <trini@kernel.crashing.org>

 drivers/char/blocker.c |   37 +------------------------------------
 drivers/char/lpptest.c |   39 ++-------------------------------------
 kernel/latency.c       |   35 +++++++++++------------------------
 3 files changed, 14 insertions(+), 97 deletions(-)

Index: linux-2.6.14/drivers/char/blocker.c
===================================================================
--- linux-2.6.14.orig/drivers/char/blocker.c
+++ linux-2.6.14/drivers/char/blocker.c
@@ -13,47 +13,12 @@
 
 #define MAX_LOCK_DEPTH		10
 
-/* this needs to be reconciled with driver/char/lpptest.c
- */
-static inline u64 notrace get_cpu_tick(void)
-{
-	u64 tsc;
-#if defined(CONFIG_X86)
-	__asm__ __volatile__("rdtsc" : "=A" (tsc));
-#elif defined(CONFIG_PPC)
-	unsigned long hi, lo;
-
-	do {
-		hi = get_tbu();
-		lo = get_tbl();
-	} while (get_tbu() != hi);
-	tsc = (u64)hi << 32 | lo;
-#elif defined(CONFIG_ARM)
-	tsc = *oscr;
-#elif defined(CONFIG_MIPS)
-#define read_32bit_cp0_register(source)				\
-({ int __res;							\
-	__asm__ __volatile__(					\
-	".set\tpush\n\t"					\
-	".set\treorder\n\t"					\
-	"mfc0\t%0,"STR(source)"\n\t"				\
-	".set\tpop"						\
-	: "=r" (__res));					\
-	__res;})
-
-	tsc = read_32bit_cp0_register(CP0_COUNT);
-#else
-	#error Implement get_cpu_tick()
-#endif
-	return tsc;
-}
-
 void loop(int loops)
 {
 	int i;
 
 	for (i = 0; i < loops; i++)
-		get_cpu_tick();
+		get_cycles();
 }
 
 static spinlock_t blocker_lock[MAX_LOCK_DEPTH];
Index: linux-2.6.14/drivers/char/lpptest.c
===================================================================
--- linux-2.6.14.orig/drivers/char/lpptest.c
+++ linux-2.6.14/drivers/char/lpptest.c
@@ -40,41 +40,6 @@ static char dev_id[] = "lpptest";
 
 static unsigned char out = 0x5a;
 
-/* this needs to be reconciled with driver/char/blocker.c
- */
-static inline u64 notrace get_cpu_tick(void)
-{
-	u64 tsc;
-#if defined(CONFIG_X86)
-	__asm__ __volatile__("rdtsc" : "=A" (tsc));
-#elif defined(CONFIG_PPC)
-	unsigned long hi, lo;
-
-	do {
-		hi = get_tbu();
-		lo = get_tbl();
-	} while (get_tbu() != hi);
-	tsc = (u64)hi << 32 | lo;
-#elif defined(CONFIG_ARM)
-	tsc = *oscr;
-#elif defined(CONFIG_MIPS)
-#define read_32bit_cp0_register(source)				\
-({ int __res;							\
-	__asm__ __volatile__(					\
-	".set\tpush\n\t"					\
-	".set\treorder\n\t"					\
-	"mfc0\t%0,"STR(source)"\n\t"				\
-	".set\tpop"						\
-	: "=r" (__res));					\
-	__res;})
-
-	tsc = read_32bit_cp0_register(CP0_COUNT);
-#else
-	#error Implement get_cpu_tick()
-#endif
-	return tsc;
-}
-
 /**
  * Interrupt handler. Flip a bit in the reply.
  */
@@ -96,7 +61,7 @@ static cycles_t test_response(void)
 	in = inb(0x379);
 	inb(0x378);
 	outb(0x08, 0x378);
-	now = get_cpu_tick();
+	now = get_cycles();
 	while(1) {
     		if (inb(0x379) != in)
 			break;
@@ -107,7 +72,7 @@ static cycles_t test_response(void)
 			return 0;
 		}
 	}
-	end = get_cpu_tick();
+	end = get_cycles();
 	outb(0x00, 0x378);
 	raw_local_irq_enable();
 
Index: linux-2.6.14/kernel/latency.c
===================================================================
--- linux-2.6.14.orig/kernel/latency.c
+++ linux-2.6.14/kernel/latency.c
@@ -33,19 +33,6 @@
 # endif
 #endif
 
-#ifdef __i386__
-static inline cycles_t cycles(void)
-{
-	unsigned long long ret;
-
-	rdtscll(ret);
-
-	return ret;
-}
-#else
-# define cycles() get_cycles()
-#endif
-
 #ifdef CONFIG_WAKEUP_TIMING
 struct sch_struct {
 	raw_spinlock_t trace_lock;
@@ -525,7 +512,7 @@ ____trace(int cpu, enum trace_type type,
 again:
 	idx = tr->trace_idx;
 	idx_next = idx + 1;
-	timestamp = cycles();
+	timestamp = get_cycles();
 
 	if (unlikely(trace_freerunning && (idx_next >= MAX_TRACE)))
 		idx_next = 0;
@@ -1470,7 +1457,7 @@ check_critical_timing(int cpu, struct cp
 	 * as long as possible:
 	 */
 	T0 = tr->preempt_timestamp;
-	T1 = cycles();
+	T1 = get_cycles();
 	delta = T1-T0;
 
 	raw_local_save_flags(flags);
@@ -1484,7 +1471,7 @@ check_critical_timing(int cpu, struct cp
 	 * might change it (it can only get larger so the latency
 	 * is fair to be reported):
 	 */
-	T2 = cycles();
+	T2 = get_cycles();
 	if (T2 < T1)
 		printk("bug: %016Lx < %016Lx!\n", T2, T1);
 	delta = T2-T0;
@@ -1535,7 +1522,7 @@ check_critical_timing(int cpu, struct cp
 	printk(" =>   ended at timestamp %lu: ", t1);
 	print_symbol("<%s>\n", tr->critical_end);
 	dump_stack();
-	t1 = cycles_to_usecs(cycles());
+	t1 = cycles_to_usecs(get_cycles());
 	printk(" =>   dump-end timestamp %lu\n\n", t1);
 #endif
 
@@ -1545,7 +1532,7 @@ check_critical_timing(int cpu, struct cp
 
 out:
 	tr->critical_sequence = max_sequence;
-	tr->preempt_timestamp = cycles();
+	tr->preempt_timestamp = get_cycles();
 	tr->early_warning = 0;
 	reset_trace_idx(cpu, tr);
 	_trace_cmdline(cpu, tr);
@@ -1593,7 +1580,7 @@ __start_critical_timing(unsigned long ei
 	atomic_inc(&tr->disabled);
 
 	tr->critical_sequence = max_sequence;
-	tr->preempt_timestamp = cycles();
+	tr->preempt_timestamp = get_cycles();
 	tr->critical_start = eip;
 	atomic_set(&tr->overrun, 0);
 	reset_trace_idx(cpu, tr);
@@ -1843,7 +1830,7 @@ check_wakeup_timing(struct cpu_trace *tr
 		goto out;
 
 	T0 = tr->preempt_timestamp;
-	T1 = cycles();
+	T1 = get_cycles();
 	/*
 	 * maybe preempt_timestamp originated on another CPU,
 	 * with a TSC drift:
@@ -1857,7 +1844,7 @@ check_wakeup_timing(struct cpu_trace *tr
 
 	raw_local_save_flags(flags);
 	____trace(smp_processor_id(), TRACE_FN, tr, CALLER_ADDR0, parent_eip, 0, 0, 0, flags);
-	T2 = cycles();
+	T2 = get_cycles();
 	if (T2 < T1)
 		printk("bug2: %016Lx < %016Lx!\n", T2, T1);
 	delta = T2-T0;
@@ -1943,7 +1930,7 @@ void __trace_start_sched_wakeup(struct t
 //	if (!atomic_read(&tr->disabled)) {
 		atomic_inc(&tr->disabled);
 		tr->critical_sequence = max_sequence;
-		tr->preempt_timestamp = cycles();
+		tr->preempt_timestamp = get_cycles();
 		tr->latency_type = WAKEUP_LATENCY;
 		tr->critical_start = CALLER_ADDR0;
 		atomic_set(&tr->overrun, 0);
@@ -2053,7 +2040,7 @@ long user_trace_start(void)
 	reset_trace_idx(cpu, tr);
 
 	tr->critical_sequence = max_sequence;
-	tr->preempt_timestamp = cycles();
+	tr->preempt_timestamp = get_cycles();
 	tr->critical_start = CALLER_ADDR0;
 	atomic_set(&tr->overrun, 0);
 	_trace_cmdline(cpu, tr);
@@ -2106,7 +2093,7 @@ long user_trace_stop(void)
 		unsigned long long tmp0;
 
 		T0 = tr->preempt_timestamp;
-		T1 = cycles();
+		T1 = get_cycles();
 		tmp0 = preempt_max_latency;
 		if (T1 < T0)
 			T0 = T1;

-- 
Tom

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

* [PATCH 2.6.14-rt11 3/3] Fix ppc32 bootwrapper code for new zlib
  2005-11-11 20:42 [PATCH 2.6.14-rt11 1/3] Fix LPPTEST Kconfig dependancies Tom Rini
  2005-11-11 20:43 ` [PATCH 2.6.14-rt11 2/3] Switch to using get_cycles() rather than get_cpu_tick() Tom Rini
@ 2005-11-11 20:43 ` Tom Rini
  2005-11-12 14:24   ` Ingo Molnar
  2005-11-12 14:21 ` [PATCH 2.6.14-rt11 1/3] Fix LPPTEST Kconfig dependancies Ingo Molnar
  2 siblings, 1 reply; 7+ messages in thread
From: Tom Rini @ 2005-11-11 20:43 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Tom Rini, Sven-Thorsten Dietrich, lkml

Make the ppc32 bootwrapper code mirror what the ppc64 version does to
clean out locking, etc, from lib/zlib_inflate/

Signed-off-by: Tom Rini <trini@kernel.crashing.org>

 arch/ppc/boot/lib/Makefile |   48 ++++++++++++++++++++++++++++++++++++---------
 1 file changed, 39 insertions(+), 9 deletions(-)

Index: linux-2.6.14/arch/ppc/boot/lib/Makefile
===================================================================
--- linux-2.6.14.orig/arch/ppc/boot/lib/Makefile
+++ linux-2.6.14/arch/ppc/boot/lib/Makefile
@@ -5,19 +5,49 @@
 CFLAGS_kbd.o	:= -Idrivers/char
 CFLAGS_vreset.o := -I$(srctree)/arch/ppc/boot/include
 
-zlib  := infblock.c infcodes.c inffast.c inflate.c inftrees.c infutil.c
-	 
-lib-y += $(zlib:.c=.o) div64.o
-lib-$(CONFIG_VGA_CONSOLE) += vreset.o kbd.o
-
+zlib       := infblock.c infcodes.c inffast.c inflate.c inftrees.c infutil.c
+zlibheader := infblock.h infcodes.h inffast.h inftrees.h infutil.h
+zliblinuxheader := zlib.h zconf.h zutil.h
+
+$(addprefix $(obj)/,$(zlib)): $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader))
+
+src-boot := div64.S
+src-boot += $(zlib)
+#src-boot := $(addprefix $(obj)/, $(src-boot))
+obj-boot := $(addsuffix .o, $(basename $(src-boot)))
 
-# zlib files needs header from their original place
-EXTRA_CFLAGS += -Ilib/zlib_inflate
+BOOTCFLAGS	+= -I$(obj) -I$(srctree)/$(obj) $(CFLAGS)
 
 quiet_cmd_copy_zlib = COPY    $@
-      cmd_copy_zlib = cat $< > $@
+      cmd_copy_zlib = sed "s@__attribute_used__@@;s@.include.<linux/module.h>@@;s@.include.<linux/spinlock.h>@@;s@.*spin.*lock.*@@;s@.*SPINLOCK.*@@;s@<linux/\([^>]\+\).*@\"\1\"@" $< > $@
+
+quiet_cmd_copy_zlibheader = COPY    $@
+      cmd_copy_zlibheader = sed "s@<linux/\([^>]\+\).*@\"\1\"@" $< > $@
+# stddef.h for NULL
+quiet_cmd_copy_zliblinuxheader = COPY    $@
+      cmd_copy_zliblinuxheader = sed "s@.include.<linux/string.h>@@;s@.include.<linux/errno.h>@@;s@<linux/kernel.h>@<stddef.h>@;s@<linux/\([^>]\+\).*@\"\1\"@" $< > $@
 
 $(addprefix $(obj)/,$(zlib)): $(obj)/%: $(srctree)/lib/zlib_inflate/%
 	$(call cmd,copy_zlib)
 
-clean-files := $(zlib)
+$(addprefix $(obj)/,$(zlibheader)): $(obj)/%: $(srctree)/lib/zlib_inflate/%
+	$(call cmd,copy_zlibheader)
+
+$(addprefix $(obj)/,$(zliblinuxheader)): $(obj)/%: $(srctree)/include/linux/%
+	$(call cmd,copy_zliblinuxheader)
+
+clean-files := $(zlib) $(zlibheader) $(zliblinuxheader)
+
+quiet_cmd_bootcc = BOOTCC  $@
+      cmd_bootcc = $(CC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $<
+
+quiet_cmd_bootas = BOOTAS  $@
+      cmd_bootas = $(CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $<
+
+$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c
+	$(call if_changed_dep,bootcc)
+$(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S
+	$(call if_changed_dep,bootas)
+
+lib-y += $(obj-boot)
+lib-$(CONFIG_VGA_CONSOLE) += vreset.o kbd.o

-- 
Tom

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

* Re: [PATCH 2.6.14-rt11 1/3] Fix LPPTEST Kconfig dependancies
  2005-11-11 20:42 [PATCH 2.6.14-rt11 1/3] Fix LPPTEST Kconfig dependancies Tom Rini
  2005-11-11 20:43 ` [PATCH 2.6.14-rt11 2/3] Switch to using get_cycles() rather than get_cpu_tick() Tom Rini
  2005-11-11 20:43 ` [PATCH 2.6.14-rt11 3/3] Fix ppc32 bootwrapper code for new zlib Tom Rini
@ 2005-11-12 14:21 ` Ingo Molnar
  2 siblings, 0 replies; 7+ messages in thread
From: Ingo Molnar @ 2005-11-12 14:21 UTC (permalink / raw)
  To: Tom Rini; +Cc: Sven-Thorsten Dietrich, lkml


* Tom Rini <trini@kernel.crashing.org> wrote:

> Since the LPPTEST driver depends on an x86-PC, make the Kconfig choice 
> do so as well.
> 
> Signed-off-by: Tom Rini <trini@kernel.crashing.org>

thanks, applied.

	Ingo

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

* Re: [PATCH 2.6.14-rt11 2/3] Switch to using get_cycles() rather than get_cpu_tick()
  2005-11-11 20:43 ` [PATCH 2.6.14-rt11 2/3] Switch to using get_cycles() rather than get_cpu_tick() Tom Rini
@ 2005-11-12 14:23   ` Ingo Molnar
  0 siblings, 0 replies; 7+ messages in thread
From: Ingo Molnar @ 2005-11-12 14:23 UTC (permalink / raw)
  To: Tom Rini; +Cc: Sven-Thorsten Dietrich, lkml


* Tom Rini <trini@kernel.crashing.org> wrote:

> In a few different drivers we had what boiled down to a custom 
> implementation of get_cycles().  On i386 and ppc32 this was the same 
> code, and I assume similar for ARM and MIPS.  In one case 
> (kernel/latency.c) it really was get_cycles() in the !i386 case.  
> Always using get_cycles() makes new platform bringup easier.
> 
> Signed-off-by: Tom Rini <trini@kernel.crashing.org>

thanks, applied.

	Ingo

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

* Re: [PATCH 2.6.14-rt11 3/3] Fix ppc32 bootwrapper code for new zlib
  2005-11-11 20:43 ` [PATCH 2.6.14-rt11 3/3] Fix ppc32 bootwrapper code for new zlib Tom Rini
@ 2005-11-12 14:24   ` Ingo Molnar
  2005-11-12 18:40     ` Tom Rini
  0 siblings, 1 reply; 7+ messages in thread
From: Ingo Molnar @ 2005-11-12 14:24 UTC (permalink / raw)
  To: Tom Rini; +Cc: Sven-Thorsten Dietrich, lkml


* Tom Rini <trini@kernel.crashing.org> wrote:

> Make the ppc32 bootwrapper code mirror what the ppc64 version does to 
> clean out locking, etc, from lib/zlib_inflate/
> 
> Signed-off-by: Tom Rini <trini@kernel.crashing.org>

why is this needed in -rt? Shouldnt this go upstream?

	Ingo

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

* Re: [PATCH 2.6.14-rt11 3/3] Fix ppc32 bootwrapper code for new zlib
  2005-11-12 14:24   ` Ingo Molnar
@ 2005-11-12 18:40     ` Tom Rini
  0 siblings, 0 replies; 7+ messages in thread
From: Tom Rini @ 2005-11-12 18:40 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Sven-Thorsten Dietrich, lkml

On Sat, Nov 12, 2005 at 03:24:28PM +0100, Ingo Molnar wrote:
> 
> * Tom Rini <trini@kernel.crashing.org> wrote:
> 
> > Make the ppc32 bootwrapper code mirror what the ppc64 version does to 
> > clean out locking, etc, from lib/zlib_inflate/
> > 
> > Signed-off-by: Tom Rini <trini@kernel.crashing.org>
> 
> why is this needed in -rt? Shouldnt this go upstream?

This is only needed by the 'add spinlocks/etc to zlib_inflate' changes
that aren't in 2.6.14 stock at least, and I don't think will be in
2.6.15-rc1.

The slightly better solution is I need to talk with Matt Mackall about
his zlib changes and how he thinks p*pc* can be done better, but without
duplicating code again.

-- 
Tom Rini
http://gate.crashing.org/~trini/

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

end of thread, other threads:[~2005-11-12 18:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-11 20:42 [PATCH 2.6.14-rt11 1/3] Fix LPPTEST Kconfig dependancies Tom Rini
2005-11-11 20:43 ` [PATCH 2.6.14-rt11 2/3] Switch to using get_cycles() rather than get_cpu_tick() Tom Rini
2005-11-12 14:23   ` Ingo Molnar
2005-11-11 20:43 ` [PATCH 2.6.14-rt11 3/3] Fix ppc32 bootwrapper code for new zlib Tom Rini
2005-11-12 14:24   ` Ingo Molnar
2005-11-12 18:40     ` Tom Rini
2005-11-12 14:21 ` [PATCH 2.6.14-rt11 1/3] Fix LPPTEST Kconfig dependancies Ingo Molnar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.