Realtime preempt support for PPC
Subsystems (3)
PATCH 1/1 Realtime preempt support for PPC
(Ingo, I apologize for the duplicate emails. I did not have my email config set up properly and was thus getting rejected by lkml.)
I have attached a patch to add realtime support for PowerPC (32 bit only). The patch applies over Ingo's real-time preempt patch:
http://people.redhat.com/mingo/realtime-preempt/realtime-preempt-2.6.11-rc4-V0.7.39-02
This patch has been tested on the IBM PPC 405GP eval board only. You might notice that this board is not an SMP board. A few small changes were required to build an SMP kernel, even though only one cpu is actually active. I can supply a patch of the SMP related changes if anyone desires it.
The testing has included a short (~ten minute) stress test for eight configuration permutations. The permutations are:
SMP=n SMP=y
------- -------
PREEMPT_NONE pn pn_smp
PREEMPT_VOLUNTARY pv pv_smp
PREEMPT_DESKTOP pd pd_smp
PREEMPT_RT pr pr_smpAny comments, suggestions, needed changes, etc are welcome.
Thanks,
-Frank
Frank Rowand <[email protected]>
MontaVista Software, Inc
Source: MontaVista Software, Inc.
arch/ppc/Kconfig +8 -9
@@ -17,9 +17,16 @@ config GENERIC_HARDIRQS config RWSEM_GENERIC_SPINLOCK bool + depends on !PREEMPT_RT + +config ASM_SEMAPHORES + bool + depends on !PREEMPT_RT + default y config RWSEM_XCHGADD_ALGORITHM bool + depends on !RWSEM_GENERIC_SPINLOCK && !PREEMPT_RT default y config GENERIC_CALIBRATE_DELAY
@@ -862,15 +869,7 @@ config NR_CPUS depends on SMP default "4" -config PREEMPT - bool "Preemptible Kernel" - help - This option reduces the latency of the kernel when reacting to - real-time or interactive events by allowing a low priority process to - be preempted even if it is in kernel mode executing a system call. - - Say Y here if you are building a kernel for a desktop, embedded - or real-time system. Say N if you are unsure. +source "lib/Kconfig.RT" config HIGHMEM bool "High memory support"
arch/ppc/platforms/prpmc800.c +2 -0
@@ -331,6 +331,7 @@ static void __init prpmc800_calibrate_de tb_ticks_per_second =100000000 /4 ; tb_ticks_per_jiffy = tb_ticks_per_second /HZ ; tb_to_us =mulhwu_scale_factor (tb_ticks_per_second,1000000 ); + us_to_tb = tb_ticks_per_second /1000000 ;return ; }
@@ -371,6 +372,7 @@ static void __init prpmc800_calibrate_de tb_ticks_per_second = (tbl_end - tbl_start) *2 ; tb_ticks_per_jiffy = tb_ticks_per_second /HZ ; tb_to_us =mulhwu_scale_factor (tb_ticks_per_second,1000000 ); + us_to_tb = tb_ticks_per_second /1000000 ; }static void prpmc800_restart (char *cmd)
arch/ppc/syslib/m8xx_setup.c +1 -0
@@ -163,6 +163,7 @@ void __init m8xx_calibrate_decr(void)printk ("Decrementer Frequency = %d/%d\n" , freq, divisor); tb_ticks_per_jiffy = freq /HZ / divisor; tb_to_us =mulhwu_scale_factor (freq / divisor,1000000 ); + us_to_tb = (freq / divisor) /1000000 ;/* Perform some more timer/timebase initialization. This used * to be done elsewhere, but other changes caused it to get
arch/ppc/platforms/chrp_time.c +1 -0
@@ -191,4 +191,5 @@ void __init chrp_calibrate_decr(void) freq/1000000, freq%1000000); tb_ticks_per_jiffy = freq /HZ ; tb_to_us =mulhwu_scale_factor (freq,1000000 ); + us_to_tb = freq /1000000 ; }
arch/ppc/platforms/gemini_setup.c +1 -0
@@ -465,6 +465,7 @@ void __init gemini_calibrate_decr(void) divisor =4 ; tb_ticks_per_jiffy = freq /HZ / divisor; tb_to_us =mulhwu_scale_factor (freq/divisor,1000000 ); + us_to_tb = (freq / divisor) /1000000 ; }unsigned long __init gemini_find_end_of_memory (void )
include/asm-ppc/time.h +1 -0
@@ -20,6 +20,7 @@extern unsigned tb_ticks_per_jiffy;extern unsigned tb_to_us;extern unsigned tb_last_stamp; +extern unsigned us_to_tb;extern unsigned long disarm_decr[NR_CPUS ];extern void to_tm (int tim,struct rtc_time * tm);
arch/ppc/platforms/pmac_time.c +2 -0
@@ -198,6 +198,7 @@ via_calibrate_decr(void) tb_ticks_per_jiffy = (dstart - dend) / (6 * (HZ /100 )); tb_to_us =mulhwu_scale_factor (dstart - dend,60000 ); + us_to_tb = (dstart - dend) /60000 ;printk (KERN_INFO "via_calibrate_decr: ticks per jiffy = %u (%u ticks)\n" , tb_ticks_per_jiffy, dstart - dend);
@@ -289,4 +290,5 @@ pmac_calibrate_decr(void) freq/1000000, freq%1000000); tb_ticks_per_jiffy = freq /HZ ; tb_to_us =mulhwu_scale_factor (freq,1000000 ); + us_to_tb = freq /1000000 ; }
arch/ppc/platforms/apus_setup.c +1 -0
@@ -282,6 +282,7 @@ void apus_calibrate_decr(void) freq/1000000, freq%1000000); tb_ticks_per_jiffy = freq /HZ ; tb_to_us =mulhwu_scale_factor (freq,1000000 ); + us_to_tb = freq /1000000 ; __bus_speed = bus_speed; __speed_test_failed = speed_test_failed;
arch/ppc/platforms/k2.c +1 -0
@@ -411,6 +411,7 @@ static void __init k2_calibrate_decr(voi freq =k2_get_bus_speed (); tb_ticks_per_jiffy = freq /HZ / divisor; tb_to_us =mulhwu_scale_factor (freq / divisor,1000000 ); + us_to_tb = (freq / divisor) /1000000 ; }static int k2_show_cpuinfo (struct seq_file *m)
arch/ppc/platforms/powerpmc250.c +1 -0
@@ -167,6 +167,7 @@ powerpmc250_calibrate_decr(void) tb_ticks_per_jiffy = freq / (HZ * divisor); tb_to_us =mulhwu_scale_factor (freq/divisor,1000000 ); + us_to_tb = (freq / divisor) /1000000 ; } static void
arch/ppc/syslib/m8260_setup.c +1 -0
@@ -78,6 +78,7 @@ m8260_calibrate_decr(void) divisor =4 ; tb_ticks_per_jiffy = freq /HZ / divisor; tb_to_us =mulhwu_scale_factor (freq / divisor,1000000 ); + us_to_tb = (freq / divisor) /1000000 ; }/* The 8260 has an internal 1-second timer update register that
arch/ppc/syslib/ibm44x_common.c +1 -0
@@ -60,6 +60,7 @@ void __init ibm44x_calibrate_decr(unsign { tb_ticks_per_jiffy = freq /HZ ; tb_to_us =mulhwu_scale_factor (freq,1000000 ); + us_to_tb = freq /1000000 ;/* Set the time base to zero */ mtspr (SPRN_TBWL ,0 );
arch/ppc/platforms/prpmc750.c +1 -0
@@ -271,6 +271,7 @@ static void __init prpmc750_calibrate_de tb_ticks_per_jiffy = freq / (HZ * divisor); tb_to_us =mulhwu_scale_factor (freq / divisor,1000000 ); + us_to_tb = (freq / divisor) /1000000 ; }static void prpmc750_restart (char *cmd)
arch/ppc/platforms/prep_setup.c +1 -0
@@ -938,6 +938,7 @@ prep_calibrate_decr(void) (freq/divisor)/1000000 , (freq/divisor)%1000000); tb_to_us =mulhwu_scale_factor (freq/divisor,1000000 ); + us_to_tb = (freq / divisor) /1000000 ; tb_ticks_per_jiffy = freq /HZ / divisor; } }
arch/ppc/platforms/spruce.c +1 -0
@@ -150,6 +150,7 @@ spruce_calibrate_decr(void) freq =SPRUCE_BUS_SPEED ; tb_ticks_per_jiffy = freq /HZ / divisor; tb_to_us =mulhwu_scale_factor (freq/divisor,1000000 ); + us_to_tb = (freq / divisor) /1000000 ; } static int
arch/ppc/syslib/mpc52xx_setup.c +1 -0
@@ -220,6 +220,7 @@ mpc52xx_calibrate_decr(void) tb_ticks_per_jiffy = xlbfreq /HZ / divisor; tb_to_us =mulhwu_scale_factor (xlbfreq / divisor,1000000 ); + us_to_tb = (xlbfreq / divisor) /1000000 ; }
arch/ppc/kernel/smp.c +6 -1
@@ -139,6 +139,11 @@ void smp_send_reschedule(int cpu)smp_message_pass (cpu,PPC_MSG_RESCHEDULE ,0 ,0 ); } +void smp_send_reschedule_allbutself (void ) +{ +smp_message_pass (MSG_ALL_BUT_SELF ,PPC_MSG_RESCHEDULE ,0 ,0 ); +} +#ifdef CONFIG_XMON void smp_send_xmon_break (int cpu) {
@@ -163,7 +168,7 @@ void smp_send_stop(void)* static memory requirements. It also looks cleaner. * Stolen from the i386 version. */ -static DEFINE_SPINLOCK (call_lock); +static DEFINE_RAW_SPINLOCK (call_lock); static struct call_data_struct { void (*func) (void *info);
arch/ppc/kernel/time.c +3 -1
@@ -86,12 +86,13 @@ unsigned tb_ticks_per_jiffy;unsigned tb_to_us;unsigned tb_last_stamp;unsigned long tb_to_ns_scale; +unsigned us_to_tb;extern unsigned long wall_jiffies;static long time_offset; -DEFINE_SPINLOCK (rtc_lock); +DEFINE_RAW_SPINLOCK (rtc_lock);EXPORT_SYMBOL (rtc_lock);
@@ -296,6 +297,7 @@ void __init time_init(void) tb_ticks_per_jiffy =DECREMENTER_COUNT_601 ;/* mulhwu_scale_factor(1000000000, 1000000) is 0x418937 */ tb_to_us =0x418937 ; + us_to_tb =1000000000 /1000000 ; }else { ppc_md.calibrate_decr (); tb_to_ns_scale =mulhwu (tb_to_us,1000 <<10 );
arch/ppc/platforms/ev64260.c +1 -0
@@ -552,6 +552,7 @@ ev64260_calibrate_decr(void) tb_ticks_per_jiffy = freq /HZ ; tb_to_us =mulhwu_scale_factor (freq,1000000 ); + us_to_tb = freq /1000000 ;return ; }
arch/ppc/syslib/ppc85xx_setup.c +1 -0
@@ -58,6 +58,7 @@ mpc85xx_calibrate_decr(void) divisor =8 ; tb_ticks_per_jiffy = freq / divisor /HZ ; tb_to_us =mulhwu_scale_factor (freq / divisor,1000000 ); + us_to_tb = (freq / divisor) /1000000 ;/* Set the time base to zero */ mtspr (SPRN_TBWL ,0 );
arch/ppc/syslib/todc_time.c +1 -0
@@ -504,6 +504,7 @@ todc_calibrate_decr(void) tb_ticks_per_jiffy = freq /HZ ; tb_to_us =mulhwu_scale_factor (freq,1000000 ); + us_to_tb = freq /1000000 ;return ; }
arch/ppc/platforms/adir_setup.c +1 -0
@@ -77,6 +77,7 @@ adir_calibrate_decr(void) freq =adir_get_bus_speed (); tb_ticks_per_jiffy = freq /HZ / divisor; tb_to_us =mulhwu_scale_factor (freq/divisor,1000000 ); + us_to_tb = (freq / divisor) /1000000 ; } static int
arch/ppc/syslib/ppc4xx_setup.c +1 -0
@@ -178,6 +178,7 @@ ppc4xx_calibrate_decr(void) freq = bip->bi_tbfreq; tb_ticks_per_jiffy = freq /HZ ; tb_to_us =mulhwu_scale_factor (freq,1000000 ); + us_to_tb = freq /1000000 ;/* Set the time base to zero. ** At 200 Mhz, time base will rollover in ~2925 years.
include/linux/rt_lock.h +5 -0
@@ -13,8 +13,13 @@ typedef struct { volatile unsigned long lock; # ifdef CONFIG_DEBUG_SPINLOCK +# ifdef CONFIG_PPC32 + volatile unsigned long owner_pc; + volatile unsigned long owner_cpu; +# else unsigned int magic; # endif +# endif # ifdef CONFIG_PREEMPT unsigned int break_lock; # endif
arch/ppc/syslib/cpm2_common.c +1 -1
@@ -115,7 +115,7 @@ cpm2_fastbrg(uint brg, uint rate, int di/* * dpalloc / dpfree bits. */ -static spinlock_t cpm_dpmem_lock; +static raw_spinlock_t cpm_dpmem_lock;/* 16 blocks should be enough to satisfy all requests * until the memory subsystem goes up... */ static rh_block_t cpm_boot_dpmem_rh_block[16 ];
arch/ppc/kernel/Makefile +2 -1
@@ -13,8 +13,9 @@ extra-y += vmlinux.lds obj-y := entry.o traps.o irq.o idle.o time.o misc.o \ process.o signal.o ptrace.o align.o \ - semaphore.o syscalls.o setup.o \ + syscalls.o setup.o \ cputable.o ppc_htab.o perfmon.o +obj-$(CONFIG_ASM_SEMAPHORES) += semaphore.o obj-$(CONFIG_6xx) += l2cr.o cpu_setup_6xx.o obj-$(CONFIG_POWER4) += cpu_setup_power4.o obj-$(CONFIG_MODULES) += module.o ppc_ksyms.o
include/asm-ppc/rwsem.h +2 -2
@@ -25,7 +25,7 @@ struct rw_semaphore {#define RWSEM_WAITING_BIAS (-0x00010000)#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) -spinlock_t wait_lock; +raw_spinlock_t wait_lock;struct list_head wait_list;#if RWSEM_DEBUG int debug;
@@ -42,7 +42,7 @@ struct rw_semaphore {#endif #define __RWSEM_INITIALIZER (name) \ - { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \ + { RWSEM_UNLOCKED_VALUE, RAW_SPIN_LOCK_UNLOCKED, \ LIST_HEAD_INIT((name).wait_list) \ __RWSEM_DEBUG_INIT }
arch/ppc/lib/dec_and_lock.c +4 -4
@@ -19,7 +19,7 @@*/ #ifndef ATOMIC_DEC_AND_LOCK -int _atomic_dec_and_lock (atomic_t *atomic,spinlock_t *lock) +int _atomic_dec_and_raw_spin_lock (atomic_t *atomic,raw_spinlock_t *lock) {int counter;int newcount;
@@ -35,12 +35,12 @@ int _atomic_dec_and_lock(atomic_t *atomi return 0; } -spin_lock (lock); +_raw_spin_lock (lock);if (atomic_dec_and_test (atomic))return 1 ; -spin_unlock (lock); +_raw_spin_unlock (lock);return 0 ; } -EXPORT_SYMBOL (_atomic_dec_and_lock); +EXPORT_SYMBOL (_atomic_dec_and_raw_spin_lock);#endif /* ATOMIC_DEC_AND_LOCK */
arch/ppc/8260_io/enet.c +1 -1
@@ -116,7 +116,7 @@ struct scc_enet_private {scc_t *sccp;struct net_device_stats stats;uint tx_full; -spinlock_t lock; +raw_spinlock_t lock; };static int scc_enet_open (struct net_device *dev);
arch/ppc/syslib/prom.c +1 -1
@@ -1397,7 +1397,7 @@ print_properties(struct device_node *np) }#endif -static DEFINE_SPINLOCK (rtas_lock); +static DEFINE_RAW_SPINLOCK (rtas_lock);/* this can be called after setup -- Cort */ int __openfirmware
include/asm-ppc/semaphore.h +5 -0
@@ -16,6 +16,10 @@#ifdef __KERNEL__ +#ifdef CONFIG_PREEMPT_RT +# include <linux/rt_lock.h> +#else +#include <asm/atomic.h> #include <asm/system.h> #include <linux/wait.h>
@@ -106,6 +110,7 @@ extern inline void up(struct semaphore *__up (sem); } +#endif /* CONFIG_PREEMPT_RT */ #endif /* __KERNEL__ */ #endif /* !(_PPC_SEMAPHORE_H) */
arch/ppc/8260_io/fcc_enet.c +1 -1
@@ -322,7 +322,7 @@ struct fcc_enet_private {volatile fcc_enet_t *ep;struct net_device_stats stats;uint tx_full; -spinlock_t lock; +raw_spinlock_t lock;#ifdef CONFIG_USE_MDIO uint phy_id;
include/asm-ppc/ocp.h +1 -1
@@ -29,10 +29,10 @@#include <linux/config.h> #include <linux/devfs_fs_kernel.h> #include <linux/device.h> +#include <linux/rwsem.h> #include <asm/mmu.h> #include <asm/ocp_ids.h> -#include <asm/rwsem.h> #include <asm/semaphore.h> #ifdef CONFIG_PPC_OCP
arch/ppc/8xx_io/enet.c +1 -1
@@ -144,7 +144,7 @@ struct scc_enet_private {unsigned char *rx_vaddr[RX_RING_SIZE ];struct net_device_stats stats;uint tx_full; -spinlock_t lock; +raw_spinlock_t lock; };static int scc_enet_open (struct net_device *dev);
arch/ppc/syslib/open_pic.c +1 -1
@@ -531,7 +531,7 @@ void openpic_reset_processor_phys(u_int }#if defined(CONFIG_SMP ) || defined(CONFIG_PM ) -static DEFINE_SPINLOCK (openpic_setup_lock); +static DEFINE_RAW_SPINLOCK (openpic_setup_lock);#endif #ifdef CONFIG_SMP
arch/ppc/platforms/pmac_feature.c +1 -1
@@ -63,7 +63,7 @@ extern struct device_node *k2_skiplist[2* We use a single global lock to protect accesses. Each driver has * to take care of its own locking */ -static DEFINE_SPINLOCK(feature_lock __pmacdata); +static DEFINE_RAW_SPINLOCK(feature_lock __pmacdata);#define LOCK (flags) spin_lock_irqsave(&feature_lock, flags);#define UNLOCK (flags) spin_unlock_irqrestore(&feature_lock, flags);
arch/ppc/8xx_io/commproc.c +1 -1
@@ -372,7 +372,7 @@ cpm_setbrg(uint brg, uint rate)/* * dpalloc / dpfree bits. */ -static spinlock_t cpm_dpmem_lock; +static raw_spinlock_t cpm_dpmem_lock;/* * 16 blocks should be enough to satisfy all requests * until the memory subsystem goes up...
arch/ppc/syslib/open_pic2.c +1 -1
@@ -386,7 +386,7 @@ static void openpic2_set_spurious(u_int vec); } -static DEFINE_SPINLOCK (openpic2_setup_lock); +static DEFINE_RAW_SPINLOCK (openpic2_setup_lock);/* * Initialize a timer interrupt (and disable it)
arch/ppc/platforms/pmac_nvram.c +1 -1
@@ -80,7 +80,7 @@ static volatile unsigned char *nvram_datstatic int nvram_mult, is_core_99;static int core99_bank =0 ;static int nvram_partitions[3 ]; -static DEFINE_SPINLOCK (nv_lock); +static DEFINE_RAW_SPINLOCK (nv_lock);extern int pmac_newworld;extern int system_running;
include/asm-ppc/tlb.h +8 -0
@@ -25,7 +25,11 @@ struct mmu_gather;extern void tlb_flush (struct mmu_gather *tlb);/* Get the generic bits... */ +#ifdef CONFIG_PREEMPT_RT +#include <asm-generic/tlb-simple.h> +#else #include <asm-generic/tlb.h> +#endif /* Nothing needed here in fact... */ #define tlb_start_vma (tlb, vma) do { } while (0)
@@ -50,7 +54,11 @@ static inline void __tlb_remove_tlb_entr#define tlb_flush (tlb) flush_tlb_mm((tlb)->mm)/* Get the generic bits... */ +#ifdef CONFIG_PREEMPT_RT +#include <asm-generic/tlb-simple.h> +#else #include <asm-generic/tlb.h> +#endif #endif /* CONFIG_PPC_STD_MMU */
arch/ppc/kernel/traps.c +1 -1
@@ -72,7 +72,7 @@ void (*debugger_fault_handler)(struct pt* Trap & Exception support */ -DEFINE_SPINLOCK (die_lock); +DEFINE_RAW_SPINLOCK (die_lock);void die (const char * str,struct pt_regs * fp,long err) {
arch/ppc/platforms/sbc82xx.c +1 -1
@@ -68,7 +68,7 @@ static void sbc82xx_time_init(void)static volatile char *sbc82xx_i8259_map;static char sbc82xx_i8259_mask =0xff ; -static DEFINE_SPINLOCK (sbc82xx_i8259_lock); +static DEFINE_RAW_SPINLOCK (sbc82xx_i8259_lock);static void sbc82xx_i8259_mask_and_ack_irq (unsigned int irq_nr) {
arch/ppc/platforms/chrp_smp.c +1 -1
@@ -57,7 +57,7 @@ smp_chrp_setup_cpu(int cpu_nr)do_openpic_setup_cpu (); } -static DEFINE_SPINLOCK (timebase_lock); +static DEFINE_RAW_SPINLOCK (timebase_lock);static unsigned int timebase_upper =0 , timebase_lower =0 ;void __devinit
include/asm-ppc/hw_irq.h +1 -0
@@ -13,6 +13,7 @@ extern void timer_interrupt(struct pt_re#define INLINE_IRQS #define irqs_disabled () ((mfmsr() & MSR_EE) == 0) +#define irqs_disabled_flags (flags) ((flags & MSR_EE) == 0)#ifdef INLINE_IRQS
include/asm-ppc/spinlock.h +30 -55
158 lines not on this page · raw message
include/asm-ppc/dma.h +1 -1
@@ -175,7 +175,7 @@ extern long ppc_cs4232_dma, ppc_cs4232_d#define DMA_MODE_CASCADE 0xC0/* pass thru DREQ->HRQ, DACK<-HLDA only */ #define DMA_AUTOINIT 0x10 -extern spinlock_t dma_spin_lock; +extern raw_spinlock_t dma_spin_lock;static __inline__unsigned long claim_dma_lock (void ) {
arch/ppc/8xx_io/fec.c +1 -1
@@ -165,7 +165,7 @@ struct fec_enet_private {struct net_device_stats stats;uint tx_full; -spinlock_t lock; +raw_spinlock_t lock;#ifdef CONFIG_USE_MDIO uint phy_id;
arch/ppc/lib/locks.c +17 -17
@@ -43,7 +43,7 @@ static inline unsigned long __spin_tryloreturn ret; } -void _raw_spin_lock (spinlock_t *lock) +void __raw_spin_lock (raw_spinlock_t *lock) {int cpu =smp_processor_id ();unsigned int stuck =INIT_STUCK ;
@@ -63,9 +63,9 @@ void _raw_spin_lock(spinlock_t *lock) lock->owner_pc = (unsigned long )__builtin_return_address (0 ); lock->owner_cpu = cpu; } -EXPORT_SYMBOL (_raw_spin_lock); +EXPORT_SYMBOL (__raw_spin_lock); -int _raw_spin_trylock (spinlock_t *lock) +int __raw_spin_trylock (raw_spinlock_t *lock) {if (__spin_trylock (&lock->lock))return 0 ;
@@ -73,9 +73,9 @@ int _raw_spin_trylock(spinlock_t *lock) lock->owner_pc = (unsigned long )__builtin_return_address (0 );return 1 ; } -EXPORT_SYMBOL (_raw_spin_trylock); +EXPORT_SYMBOL (__raw_spin_trylock); -void _raw_spin_unlock (spinlock_t *lp) +void __raw_spin_unlock (raw_spinlock_t *lp) {if ( !lp->lock ) printk("_spin_unlock(%p): no lock cpu %d curr PC %p %s/%d\n",
@@ -89,13 +89,13 @@ void _raw_spin_unlock(spinlock_t *lp)wmb (); lp->lock =0 ; } -EXPORT_SYMBOL (_raw_spin_unlock); +EXPORT_SYMBOL (__raw_spin_unlock);/* * For rwlocks, zero is unlocked, -1 is write-locked, * positive is read-locked. */ -static __inline__int __read_trylock (rwlock_t *rw) +static __inline__int __read_trylock (raw_rwlock_t *rw) {signed int tmp;
@@ -115,7 +115,7 @@ static __inline__ int __read_trylock(rwlreturn tmp; } -int _raw_read_trylock (rwlock_t *rw) +int __raw_read_trylock (raw_rwlock_t *rw) {return __read_trylock (rw) >0 ; }
@@ -136,9 +136,9 @@ void _raw_read_lock(rwlock_t *rw) } } } -EXPORT_SYMBOL (_raw_read_lock); +EXPORT_SYMBOL (__raw_read_lock); -void _raw_read_unlock (rwlock_t *rw) +void __raw_read_unlock (raw_rwlock_t *rw) {if ( rw->lock ==0 ) printk("_read_unlock(): %s/%d (nip %08lX) lock %d\n",
@@ -147,9 +147,9 @@ void _raw_read_unlock(rwlock_t *rw)wmb ();atomic_dec ((atomic_t *) &(rw)->lock); } -EXPORT_SYMBOL (_raw_read_unlock); +EXPORT_SYMBOL (__raw_read_unlock); -void _raw_write_lock (rwlock_t *rw) +void __raw_write_lock (raw_rwlock_t *rw) {unsigned int stuck;
@@ -165,18 +165,18 @@ void _raw_write_lock(rwlock_t *rw) }wmb (); } -EXPORT_SYMBOL (_raw_write_lock); +EXPORT_SYMBOL (__raw_write_lock); -int _raw_write_trylock (rwlock_t *rw) +int __raw_write_trylock (raw_rwlock_t *rw) {if (cmpxchg (&rw->lock,0 ,-1 ) !=0 )return 0 ;wmb ();return 1 ; } -EXPORT_SYMBOL (_raw_write_trylock); +EXPORT_SYMBOL (__raw_write_trylock); -void _raw_write_unlock (rwlock_t *rw) +void __raw_write_unlock (raw_rwlock_t *rw) {if (rw->lock >=0 ) printk("_write_lock(): %s/%d (nip %08lX) lock %d\n",
@@ -185,6 +185,6 @@ void _raw_write_unlock(rwlock_t *rw)wmb (); rw->lock = 0; } -EXPORT_SYMBOL (_raw_write_unlock); +EXPORT_SYMBOL (__raw_write_unlock);#endif
arch/ppc/kernel/ppc_ksyms.c +2 -0
@@ -295,9 +295,11 @@ EXPORT_SYMBOL(console_drivers);EXPORT_SYMBOL (xmon);EXPORT_SYMBOL (xmon_printf);#endif +#ifdef CONFIG_ASM_SEMAPHORES EXPORT_SYMBOL (__up);EXPORT_SYMBOL (__down);EXPORT_SYMBOL (__down_interruptible); +#endif #if defined(CONFIG_KGDB ) || defined(CONFIG_XMON )extern void (*debugger)(struct pt_regs *regs);
arch/ppc/platforms/pmac_pic.c +1 -1
@@ -68,7 +68,7 @@ static int max_irqs __pmacdata; static int max_real_irqs __pmacdata; static u32 level_mask[4] __pmacdata; -static DEFINE_SPINLOCK(pmac_pic_lock __pmacdata); +static DEFINE_RAW_SPINLOCK(pmac_pic_lock __pmacdata);#define GATWICK_IRQ_POOL_SIZE 10
arch/ppc/kernel/dma-mapping.c +1 -1
@@ -71,7 +71,7 @@ int map_page(unsigned long va, phys_addr* This is the page table (2MB) covering uncached, DMA consistent allocations */ static pte_t *consistent_pte; -static DEFINE_SPINLOCK (consistent_lock); +static DEFINE_RAW_SPINLOCK (consistent_lock);/* * VM region handling support.
arch/ppc/syslib/ocp.c +1 -1
@@ -45,11 +45,11 @@#include <linux/pm.h> #include <linux/bootmem.h> #include <linux/device.h> +#include <linux/rwsem.h> #include <asm/io.h> #include <asm/ocp.h> #include <asm/errno.h> -#include <asm/rwsem.h> #include <asm/semaphore.h> //#define DBG(x) printk x
drivers/net/ibm_emac/ibm_emac_core.c +0 -1
@@ -912,7 +912,6 @@ static int emac_start_xmit(struct sk_bufPKT_DEBUG (("emac_start_xmit() stopping queue\n" ));netif_stop_queue (dev);spin_unlock_irqrestore (&fep->lock, flags); -restore_flags (flags);return -EBUSY ; }
Quoted 2 lines · Frank Rowand
I have attached a patch to add realtime support for PowerPC (32 bit only). [...]
two comments:
- why is us_to_tb needed? It just seems to add alot of unnecessary clutter to the patch, while it's not used anywhere.
- could you submit the drivers/net/ibm_emac/ibm_emac_core.c patch upstream as well?
otherwise it looks pretty clean and straightforward.
Ingo
Quoted 11 lines · Ingo Molnar
Quoted 2 lines · Frank Rowand
I have attached a patch to add realtime support for PowerPC (32 bit only). [...]
two comments:
- why is
us_to_tbneeded? It just seems to add alot of unnecessary clutter to the patch, while it's not used anywhere.
Sorry, the usage of us_to_tb got dropped from the patch when I moved it from one of my development trees to another. It gets used in usecs_to_cycles(). The patch to add that is attached below.
Even with the usage of us_to_tb by usecs_to_cycles(), there is a lot of added clutter for what is accomplished. I considered a nasty hack to try to derive the proper value from other sources, but adding us_to_tb seemed a lot easier to understand.
This patch also adds the dreaded #ifdefs, so I suspect it will not be the correct implementation long term. I'm not sure if Manish's patch included the ARM implementation of usecs_to_cycles() - it is a third case in the #ifdef.
Performance instrumentation is also going to need mcount() and _mcount(), which is currently a work in progress.
Quoted 3 lines
- could you submit the
drivers/net/ibm_emac/ibm_emac_core.cpatch upstream as well?
Yes, I will do that.
Quoted 4 lines
otherwise it looks pretty clean and straightforward.
Ingo
Source: MontaVista Software, Inc.
kernel/latency.c +4 -0
@@ -192,7 +192,11 @@ static unsigned long notrace cycles_to_u static cycles_t notrace usecs_to_cycles(unsigned long delta) { +#if definedCONFIG_X86 return (cycles_t ) delta * (cycles_t) (cpu_khz/1000 +1 ); +#elif defined(CONFIG_PPC ) +return delta * us_to_tb; +#endif }#ifdef CONFIG_LATENCY_TRACE
Thanks,
-Frank (off to vacation for a couple days)
Signature · 2 lines
Frank Rowand <[email protected]> MontaVista Software, Inc
Quoted 6 lines · Frank Rowand
Quoted 3 lines · Ingo Molnar
* Frank Rowand <[email protected]> wrote:
- could you submit thedrivers/net/ibm_emac/ibm_emac_core.cpatch upstream as well?Yes, I will do that.
This one is already mainline, was posted a week or so ago.
-Matt
Realtime preempt
In reply to Ingo MolnarIngo,
this patch turns off the preemptable BKL when either PREEMPT_VOLUNTARY or PREEMPT_NONE is selected.
lib/Kconfig.RT 2005-02-18 11:20:16.021273614 +0000 renamed from lib/Kconfig.RT 2005-02-18 11:13:42.050554215 +0000 +1 -0
@@ -144,5 +144,6 @@ config PREEMPT_BKL bool depends on PREEMPT_RT || !SPINLOCK_BKL + default n if !PREEMPT default y
Re: Realtime preempt
Quoted 4 lines · Sven Dietrich
Ingo,
this patch turns off the preemptable BKL when either
PREEMPT_VOLUNTARYorPREEMPT_NONEis selected.
thanks, added it to my tree.
Ingo