Fix LPPTEST Kconfig dependancies
PATCH 1/3 Fix LPPTEST Kconfig dependancies
Since the LPPTEST driver depends on an x86-PC, make the Kconfig choice do so as well.
drivers/char/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/Kconfig +1 -1
@@ -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
Signature · 1 line
Tom
PATCH 2/3 Switch to using get_cycles() rather than get_cpu_tick()
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.
drivers/char/blocker.c | 37 +------------------------------------ drivers/char/lpptest.c | 39 ++------------------------------------- kernel/latency.c | 35 +++++++++++------------------------ 3 files changed, 14 insertions(+), 97 deletions(-)
drivers/char/blocker.c +1 -36
@@ -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 ];
drivers/char/lpptest.c +2 -37
@@ -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 ();
kernel/latency.c +11 -24
@@ -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 cpprintk (" => 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 eiatomic_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 *trraw_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 ;
Signature · 1 line
Tom
Ingo Molnar
AppliedRe: [PATCH 2.6.14-rt11 2/3] Switch to using get_cycles() rather than get_cpu_tick()
Quoted 7 lines · Tom Rini
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 wasget_cycles()in the !i386 case. Always usingget_cycles()makes new platform bringup easier.Signed-off-by Tom Rini <[email protected]>
thanks, applied.
Ingo
PATCH 3/3 Fix ppc32 bootwrapper code for new zlib
In reply to Tom RiniMake the ppc32 bootwrapper code mirror what the ppc64 version does to clean out locking, etc, from lib/zlib_inflate/
arch/ppc/boot/lib/Makefile | 48 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 9 deletions(-)
arch/ppc/boot/lib/Makefile +39 -9
@@ -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__@@;[email protected].<linux/module.h>@@;[email protected].<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 "[email protected].<linux/string.h>@@;[email protected].<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
Signature · 1 line
Tom
Re: [PATCH 2.6.14-rt11 3/3] Fix ppc32 bootwrapper code for new zlib
Quoted 4 lines · Tom Rini
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 <[email protected]>
why is this needed in -rt? Shouldnt this go upstream?
Ingo
Re: [PATCH 2.6.14-rt11 3/3] Fix ppc32 bootwrapper code for new zlib
Quoted 9 lines · Ingo Molnar
Quoted 4 lines · Tom Rini
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 <[email protected]>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.
Signature · 2 lines
Tom Rini http://gate.crashing.org/~trini/
Ingo Molnar
AppliedQuoted 4 lines · Tom Rini
Since the LPPTEST driver depends on an x86-PC, make the
Kconfigchoice do so as well.Signed-off-by Tom Rini <[email protected]>
thanks, applied.
Ingo