SOURCES: kernel-desktop-preempt-rt.patch - synced with rt25

sparky sparky at pld-linux.org
Sat May 27 15:51:55 CEST 2006


Author: sparky                       Date: Sat May 27 13:51:55 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- synced with rt25

---- Files affected:
SOURCES:
   kernel-desktop-preempt-rt.patch (1.4 -> 1.5) 

---- Diffs:

================================================================
Index: SOURCES/kernel-desktop-preempt-rt.patch
diff -u SOURCES/kernel-desktop-preempt-rt.patch:1.4 SOURCES/kernel-desktop-preempt-rt.patch:1.5
--- SOURCES/kernel-desktop-preempt-rt.patch:1.4	Wed May  3 23:58:19 2006
+++ SOURCES/kernel-desktop-preempt-rt.patch	Sat May 27 15:51:50 2006
@@ -2000,6 +2000,19 @@
  	.handler	= ioc_timer_interrupt
  };
  
+Index: linux/arch/arm/kernel/calls.S
+===================================================================
+--- linux.orig/arch/arm/kernel/calls.S
++++ linux/arch/arm/kernel/calls.S
+@@ -332,7 +332,7 @@
+ /* 320 */	CALL(sys_get_mempolicy)
+ 		CALL(sys_set_mempolicy)
+ #ifndef syscalls_counted
+-.equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls
++.equ syscalls_padding, ((__NR_syscalls + 3) & ~3) - __NR_syscalls
+ #define syscalls_counted
+ #endif
+ .rept syscalls_padding
 Index: linux/arch/arm/kernel/dma.c
 ===================================================================
 --- linux.orig/arch/arm/kernel/dma.c
@@ -2103,10 +2116,50 @@
  /*
   * "slow" syscall return path.  "why" tells us if this was a real syscall.
   */
-@@ -389,5 +392,112 @@ ENTRY(sys_oabi_call_table)
+@@ -87,8 +90,8 @@ ENTRY(ret_from_fork)
+ 	b	ret_slow_syscall
+ 	
+ 
+-	.equ NR_syscalls,0
+-#define CALL(x) .equ NR_syscalls,NR_syscalls+1
++	.equ __NR_syscalls,0			@ Used to determine syscall table padding.
++#define CALL(x) .equ __NR_syscalls,__NR_syscalls+1
+ #include "calls.S"
+ #undef CALL
+ #define CALL(x) .long x
+@@ -202,7 +205,7 @@ ENTRY(vector_swi)
+ 	tst	ip, #_TIF_SYSCALL_TRACE		@ are we tracing syscalls?
+ 	bne	__sys_trace
+ 
+-	cmp	scno, #NR_syscalls		@ check upper syscall limit
++	cmp	scno, #__NR_syscalls		@ check upper syscall limit
+ 	adr	lr, ret_fast_syscall		@ return address
+ 	ldrcc	pc, [tbl, scno, lsl #2]		@ call sys_* routine
+ 
+@@ -226,7 +229,7 @@ __sys_trace:
+ 	adr	lr, __sys_trace_return		@ return address
+ 	mov	scno, r0			@ syscall number (possibly new)
+ 	add	r1, sp, #S_R0 + S_OFF		@ pointer to regs
+-	cmp	scno, #NR_syscalls		@ check upper syscall limit
++	cmp	scno, #__NR_syscalls		@ check upper syscall limit
+ 	ldmccia	r1, {r0 - r3}			@ have to reload r0 - r3
+ 	ldrcc	pc, [tbl, scno, lsl #2]		@ call sys_* routine
+ 	b	2b
+@@ -273,7 +276,7 @@ ENTRY(sys_call_table)
+ sys_syscall:
+ 		eor	scno, r0, #__NR_OABI_SYSCALL_BASE
+ 		cmp	scno, #__NR_syscall - __NR_SYSCALL_BASE
+-		cmpne	scno, #NR_syscalls	@ check range
++		cmpne	scno, #__NR_syscalls	@ check range
+ 		stmloia	sp, {r5, r6}		@ shuffle args
+ 		movlo	r0, r1
+ 		movlo	r1, r2
+@@ -388,6 +391,112 @@ ENTRY(sys_oabi_call_table)
+ #include "calls.S"
  #undef ABI
  #undef OBSOLETE
- 
++#endif
++
 +#ifdef CONFIG_FRAME_POINTER
 +
 +#ifdef CONFIG_MCOUNT
@@ -2211,9 +2264,7 @@
 +	ldr	r0, [r0, #-4]   @ get target return address
 +1:
 +	mov	pc, lr
-+
-+#endif
-+
+ 
  #endif
  
 Index: linux/arch/arm/kernel/fiq.c
@@ -13923,10 +13974,10 @@
  	clear_thread_flag(TIF_POLLING_NRFLAG);
  	smp_mb__after_clear_bit();
 -	while (!need_resched()) {
-+	while (!need_resched() || !need_resched_delayed()) {
++	while (!need_resched() && !need_resched_delayed()) {
  		local_irq_disable();
 -		if (!need_resched())
-+		if (!need_resched() || !need_resched_delayed())
++		if (!need_resched() && !need_resched_delayed())
  			safe_halt();
  		else
  			local_irq_enable();
@@ -15344,7 +15395,7 @@
 ===================================================================
 --- linux.orig/drivers/char/Kconfig
 +++ linux/drivers/char/Kconfig
-@@ -719,6 +719,45 @@ config RTC
+@@ -719,6 +719,46 @@ config RTC
  	  To compile this driver as a module, choose M here: the
  	  module will be called rtc.
  
@@ -15359,6 +15410,7 @@
 +
 +config BLOCKER
 +	tristate "Priority Inheritance Debugging (Blocker) Device Support"
++	depends on X86
 +	default y
 +	---help---
 +	  If you say Y here then a device will be created that the userspace
@@ -17517,7 +17569,49 @@
  } 
  #endif
  
-@@ -2039,13 +2039,17 @@ static void vortex_tx_timeout(struct net
+@@ -1888,6 +1888,7 @@ vortex_timer(unsigned long data)
+ 	int next_tick = 60*HZ;
+ 	int ok = 0;
+ 	int media_status, mii_status, old_window;
++	unsigned long flags;
+ 
+ 	if (vortex_debug > 2) {
+ 		printk(KERN_DEBUG "%s: Media selection timer tick happened, %s.\n",
+@@ -1897,7 +1898,7 @@ vortex_timer(unsigned long data)
+ 
+ 	if (vp->medialock)
+ 		goto leave_media_alone;
+-	disable_irq(dev->irq);
++	spin_lock_irqsave(&vp->lock, flags);
+ 	old_window = ioread16(ioaddr + EL3_CMD) >> 13;
+ 	EL3WINDOW(4);
+ 	media_status = ioread16(ioaddr + Wn4_Media);
+@@ -1919,7 +1920,6 @@ vortex_timer(unsigned long data)
+ 		break;
+ 	case XCVR_MII: case XCVR_NWAY:
+ 		{
+-			spin_lock_bh(&vp->lock);
+ 			mii_status = mdio_read(dev, vp->phys[0], MII_BMSR);
+ 			if (!(mii_status & BMSR_LSTATUS)) {
+ 				/* Re-read to get actual link status */
+@@ -1957,7 +1957,6 @@ vortex_timer(unsigned long data)
+ 			} else {
+ 				netif_carrier_off(dev);
+ 			}
+-			spin_unlock_bh(&vp->lock);
+ 		}
+ 		break;
+ 	  default:					/* Other media types handled by Tx timeouts. */
+@@ -2000,7 +1999,7 @@ vortex_timer(unsigned long data)
+ 		/* AKPM: FIXME: Should reset Rx & Tx here.  P60 of 3c90xc.pdf */
+ 	}
+ 	EL3WINDOW(old_window);
+-	enable_irq(dev->irq);
++	spin_unlock_irqrestore(&vp->lock, flags);
+ 
+ leave_media_alone:
+ 	if (vortex_debug > 2)
+@@ -2039,13 +2038,17 @@ static void vortex_tx_timeout(struct net
  			/*
  			 * Block interrupts because vortex_interrupt does a bare spin_lock()
  			 */
@@ -18418,6 +18512,29 @@
  
  		spin_lock(&leader->proc_lock);
  		spin_lock(&current->proc_lock);
+Index: linux/fs/file.c
+===================================================================
+--- linux.orig/fs/file.c
++++ linux/fs/file.c
+@@ -137,7 +137,9 @@ static void free_fdtable_rcu(struct rcu_
+ 		kfree(fdt->fd);
+ 		kfree(fdt);
+ 	} else {
+-		fddef = &get_cpu_var(fdtable_defer_list);
++
++		fddef = &per_cpu(fdtable_defer_list, raw_smp_processor_id());
++
+ 		spin_lock(&fddef->lock);
+ 		fdt->next = fddef->next;
+ 		fddef->next = fdt;
+@@ -149,7 +151,6 @@ static void free_fdtable_rcu(struct rcu_
+ 		if (!schedule_work(&fddef->wq))
+ 			mod_timer(&fddef->timer, 5);
+ 		spin_unlock(&fddef->lock);
+-		put_cpu_var(fdtable_defer_list);
+ 	}
+ }
+ 
 Index: linux/fs/jbd/transaction.c
 ===================================================================
 --- linux.orig/fs/jbd/transaction.c
@@ -19055,6 +19172,19 @@
  #define ACPI_MUTEX_SEM              1
  
  /* Functions for acpi_os_signal */
+Index: linux/include/asm-arm/arch-omap/clock.h
+===================================================================
+--- linux.orig/include/asm-arm/arch-omap/clock.h
++++ linux/include/asm-arm/arch-omap/clock.h
+@@ -48,7 +48,7 @@ struct clk_functions {
+ 
+ extern unsigned int mpurate;
+ extern struct list_head clocks;
+-extern spinlock_t clockfw_lock;
++extern raw_spinlock_t clockfw_lock;
+ 
+ extern int clk_init(struct clk_functions * custom_clocks);
+ extern int clk_register(struct clk *clk);
 Index: linux/include/asm-arm/arch-pxa/timex.h
 ===================================================================
 --- linux.orig/include/asm-arm/arch-pxa/timex.h
@@ -19510,7 +19640,7 @@
 ===================================================================
 --- linux.orig/include/asm-arm/semaphore.h
 +++ linux/include/asm-arm/semaphore.h
-@@ -5,46 +5,67 @@
+@@ -5,46 +5,66 @@
  #define __ASM_ARM_SEMAPHORE_H
  
  #include <linux/linkage.h>
@@ -19528,7 +19658,6 @@
 + */
 +#ifndef CONFIG_PREEMPT_RT
 +# define semaphore compat_semaphore
-+#define __MUTEX_INITIALIZER(name) __COMPAT_MUTEX_INITIALIZER(name)
 +#endif
 +
  #include <asm/atomic.h>
@@ -19589,7 +19718,7 @@
  }
  
  /*
-@@ -55,16 +76,18 @@ asmlinkage int  __down_interruptible_fai
+@@ -55,16 +75,18 @@ asmlinkage int  __down_interruptible_fai
  asmlinkage int  __down_trylock_failed(void);
  asmlinkage void __up_wakeup(void);
  
@@ -19613,7 +19742,7 @@
  {
  	might_sleep();
  	__down_op(sem, __down_failed);
-@@ -74,13 +97,13 @@ static inline void down(struct semaphore
+@@ -74,13 +96,13 @@ static inline void down(struct semaphore
   * This is ugly, but we want the default case to fall through.
   * "__down_interruptible" is the actual routine that waits...
   */
@@ -19629,7 +19758,7 @@
  {
  	return __down_op_ret(sem, __down_trylock_failed);
  }
-@@ -91,9 +114,10 @@ static inline int down_trylock(struct se
+@@ -91,9 +113,10 @@ static inline int down_trylock(struct se
   * The default case (no contention) will result in NO
   * jumps for both down() and up().
   */
@@ -19666,104 +19795,115 @@
  
  #define CPU_ARCH_UNKNOWN	0
  #define CPU_ARCH_ARMv3		1
-@@ -186,7 +187,7 @@ static inline void sched_cacheflush(void
-  */
- #if __LINUX_ARM_ARCH__ >= 6
+@@ -181,72 +182,10 @@ static inline void sched_cacheflush(void
+ {
+ }
  
+-/*
+- * CPU interrupt mask handling.
+- */
+ #if __LINUX_ARM_ARCH__ >= 6
+-
 -#define local_irq_save(x)					\
-+#define raw_local_irq_save(x)					\
- 	({							\
- 	__asm__ __volatile__(					\
- 	"mrs	%0, cpsr		@ local_irq_save\n"	\
-@@ -194,17 +195,17 @@ static inline void sched_cacheflush(void
- 	: "=r" (x) : : "memory", "cc");				\
- 	})
- 
+-	({							\
+-	__asm__ __volatile__(					\
+-	"mrs	%0, cpsr		@ local_irq_save\n"	\
+-	"cpsid	i"						\
+-	: "=r" (x) : : "memory", "cc");				\
+-	})
+-
 -#define local_irq_enable()  __asm__("cpsie i	@ __sti" : : : "memory", "cc")
 -#define local_irq_disable() __asm__("cpsid i	@ __cli" : : : "memory", "cc")
 -#define local_fiq_enable()  __asm__("cpsie f	@ __stf" : : : "memory", "cc")
 -#define local_fiq_disable() __asm__("cpsid f	@ __clf" : : : "memory", "cc")
-+#define raw_local_irq_enable()  __asm__("cpsie i	@ __sti" : : : "memory", "cc")
-+#define raw_local_irq_disable() __asm__("cpsid i	@ __cli" : : : "memory", "cc")
+-
 +#define raw_local_fiq_enable()  __asm__("cpsie f	@ __stf" : : : "memory", "cc")
 +#define raw_local_fiq_disable() __asm__("cpsid f	@ __clf" : : : "memory", "cc")
- 
  #else
- 
- /*
-  * Save the current interrupt enable state & disable IRQs
-  */
+-
+-/*
+- * Save the current interrupt enable state & disable IRQs
+- */
 -#define local_irq_save(x)					\
-+#define raw_local_irq_save(x)					\
- 	({							\
- 		unsigned long temp;				\
- 		(void) (&temp == &x);				\
-@@ -216,11 +217,11 @@ static inline void sched_cacheflush(void
- 	:							\
- 	: "memory", "cc");					\
- 	})
+-	({							\
+-		unsigned long temp;				\
+-		(void) (&temp == &x);				\
+-	__asm__ __volatile__(					\
+-	"mrs	%0, cpsr		@ local_irq_save\n"	\
+-"	orr	%1, %0, #128\n"					\
+-"	msr	cpsr_c, %1"					\
+-	: "=r" (x), "=r" (temp)					\
+-	:							\
+-	: "memory", "cc");					\
+-	})
 -	
-+
- /*
-  * Enable IRQs
-  */
+-/*
+- * Enable IRQs
+- */
 -#define local_irq_enable()					\
-+#define raw_local_irq_enable()				\
- 	({							\
- 		unsigned long temp;				\
- 	__asm__ __volatile__(					\
-@@ -235,7 +236,7 @@ static inline void sched_cacheflush(void
- /*
-  * Disable IRQs
-  */
+-	({							\
+-		unsigned long temp;				\
+-	__asm__ __volatile__(					\
+-	"mrs	%0, cpsr		@ local_irq_enable\n"	\
+-"	bic	%0, %0, #128\n"					\
+-"	msr	cpsr_c, %0"					\
+-	: "=r" (temp)						\
+-	:							\
+-	: "memory", "cc");					\
+-	})
+-
+-/*
+- * Disable IRQs
+- */
 -#define local_irq_disable()					\
-+#define raw_local_irq_disable()				\
- 	({							\
- 		unsigned long temp;				\
- 	__asm__ __volatile__(					\
-@@ -282,7 +283,7 @@ static inline void sched_cacheflush(void
+-	({							\
+-		unsigned long temp;				\
+-	__asm__ __volatile__(					\
+-	"mrs	%0, cpsr		@ local_irq_disable\n"	\
+-"	orr	%0, %0, #128\n"					\
+-"	msr	cpsr_c, %0"					\
+-	: "=r" (temp)						\
+-	:							\
+-	: "memory", "cc");					\
+-	})
+-
  /*
-  * Save the current interrupt enable state.
+  * Enable FIQs
   */
+@@ -279,32 +218,7 @@ static inline void sched_cacheflush(void
+ 
+ #endif
+ 
+-/*
+- * Save the current interrupt enable state.
+- */
 -#define local_save_flags(x)					\
-+#define raw_local_save_flags(x)				\
- 	({							\
- 	__asm__ __volatile__(					\
- 	"mrs	%0, cpsr		@ local_save_flags"	\
-@@ -292,20 +293,27 @@ static inline void sched_cacheflush(void
- /*
-  * restore saved IRQ & FIQ state
-  */
+-	({							\
+-	__asm__ __volatile__(					\
+-	"mrs	%0, cpsr		@ local_save_flags"	\
+-	: "=r" (x) : : "memory", "cc");				\
+-	})
+-
+-/*
+- * restore saved IRQ & FIQ state
+- */
 -#define local_irq_restore(x)					\
-+#define raw_local_irq_restore(x)				\
- 	__asm__ __volatile__(					\
- 	"msr	cpsr_c, %0		@ local_irq_restore\n"	\
- 	:							\
- 	: "r" (x)						\
- 	: "memory", "cc")
- 
+-	__asm__ __volatile__(					\
+-	"msr	cpsr_c, %0		@ local_irq_restore\n"	\
+-	:							\
+-	: "r" (x)						\
+-	: "memory", "cc")
+-
 -#define irqs_disabled()			\
 -({					\
 -	unsigned long flags;		\
 -	local_save_flags(flags);	\
 -	(int)(flags & PSR_I_BIT);	\
-+#define raw_irqs_disabled_flags(flags)	\
-+({						\
-+	(int)(flags & PSR_I_BIT);		\
-+})
-+
-+#define raw_irqs_disabled()			\
-+({						\
-+	unsigned long flags;			\
-+	raw_local_save_flags(flags);		\
-+	raw_irqs_disabled_flags(flags);	\
- })
- 
+-})
 +#include <linux/trace_irqflags.h>
-+
+ 
  #ifdef CONFIG_SMP
  
- #define smp_mb()		mb()
 Index: linux/include/asm-arm/thread_info.h
 ===================================================================
 --- linux.orig/include/asm-arm/thread_info.h
@@ -19939,14 +20079,21 @@
 ===================================================================
 --- linux.orig/include/asm-arm/unistd.h
 +++ linux/include/asm-arm/unistd.h
-@@ -533,6 +533,10 @@ type name(type1 arg1, type2 arg2, type3 
+@@ -361,6 +361,9 @@
+ #define __NR_get_mempolicy		(__NR_SYSCALL_BASE+320)
+ #define __NR_set_mempolicy		(__NR_SYSCALL_BASE+321)
+ 
++// FIXME: check this number ...
++#define NR_syscalls			322
++
+ /*
+  * The following SWIs are ARM private.
+  */
+@@ -533,6 +536,7 @@ type name(type1 arg1, type2 arg2, type3 
  #define __ARCH_WANT_OLD_READDIR
  #define __ARCH_WANT_SYS_SOCKETCALL
  #endif
 +
-+// FIXME: check this number ...
-+#define NR_syscalls	328
-+
  #endif
  
  #ifdef __KERNEL_SYSCALLS__
@@ -26785,7 +26932,7 @@
 ===================================================================
 --- /dev/null
 +++ linux/include/linux/plist.h
-@@ -0,0 +1,247 @@
+@@ -0,0 +1,248 @@
 +/*
 + * Descending-priority-sorted double-linked list
 + *
@@ -26861,6 +27008,7 @@
 +#ifndef _LINUX_PLIST_H_
 +#define _LINUX_PLIST_H_
 +
++#include <linux/kernel.h>
 +#include <linux/list.h>
 +#include <linux/spinlock_types.h>
 +
@@ -31519,7 +31667,7 @@
  	if (err >= 0) {
  		key->shared.pgoff =
  			page->index << (PAGE_CACHE_SHIFT - PAGE_SHIFT);
-@@ -242,18 +279,246 @@ static void drop_key_refs(union futex_ke
+@@ -242,18 +279,254 @@ static void drop_key_refs(union futex_ke
  	}
  }
  
@@ -31718,11 +31866,19 @@
 +
 +	list_for_each_entry_safe(this, next, head, list) {
 +		if (match_futex (&this->key, &me->key)) {
-+			/*
-+			 * Another waiter already exists - bump up
-+			 * the refcount and return its pi_state:
-+			 */
++			/* Another waiter already exists */
 +			pi_state = this->pi_state;
++
++			/* make sure its a PI waiter: */
++			if (unlikely(!pi_state)) {
++#ifdef CONFIG_DEBUG_RT_MUTEXES
++				if (printk_ratelimit())
++					printk("BUG: %s/%d: Mixing PI and non-PI futexes!\n",
++						current->comm, current->pid);
++#endif
++				return -EINVAL;
++			}
++			/* bump up the refcount and return its pi_state: */
 +			atomic_inc(&pi_state->refcount);
 +			me->pi_state = pi_state;
 +			pr_debug("Waiter found: %d\n",
@@ -31768,7 +31924,7 @@
   * The hash bucket lock must be held when this is called.
   * Afterwards, the futex_q must not be accessed.
   */
-@@ -280,16 +545,85 @@ static void wake_futex(struct futex_q *q
+@@ -280,16 +553,85 @@ static void wake_futex(struct futex_q *q
  	q->lock_ptr = NULL;
  }
  
@@ -31858,7 +32014,7 @@
  	int ret;
  
  	down_read(&current->mm->mmap_sem);
-@@ -298,19 +632,21 @@ static int futex_wake(unsigned long uadd
+@@ -298,19 +640,27 @@ static int futex_wake(unsigned long uadd
  	if (unlikely(ret != 0))
  		goto out;
  
@@ -31871,8 +32027,14 @@
  
  	list_for_each_entry_safe(this, next, head, list) {
  		if (match_futex (&this->key, &key)) {
-+			if (this->pi_state)
-+				return -EINVAL;
++			/*
++			 * Mixing of PI-aware and PI-unaware
++			 * waiters is invalid:
++			 */
++			if (unlikely(this->pi_state)) {
++				ret = -EINVAL;
++				break;
++			}
  			wake_futex(this);
  			if (++ret >= nr_wake)
  				break;
@@ -31884,7 +32046,7 @@
  out:
  	up_read(&current->mm->mmap_sem);
  	return ret;
-@@ -320,10 +656,12 @@ out:
+@@ -320,10 +670,12 @@ out:
   * Wake up all waiters hashed on the physical page that is mapped
   * to this virtual address:
   */
@@ -31899,7 +32061,7 @@
  	struct list_head *head;
  	struct futex_q *this, *next;
  	int ret, op_ret, attempt = 0;
-@@ -338,27 +676,29 @@ retryfull:
+@@ -338,27 +690,29 @@ retryfull:
  	if (unlikely(ret != 0))
  		goto out;
  
@@ -31943,7 +32105,7 @@
  		ret = op_ret;
  		goto out;
  #endif
-@@ -368,47 +708,34 @@ retry:
+@@ -368,47 +722,34 @@ retry:
  			goto out;
  		}
  
@@ -31965,7 +32127,9 @@
 -			    !(vma = find_vma(mm, uaddr2)) ||
 -			    vma->vm_start > uaddr2 ||
 -			    !(vma->vm_flags & VM_WRITE))
--				goto out;
++			if (futex_handle_fault((unsigned long)uaddr2,
<<Diff was trimmed, longer than 597 lines>>

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/kernel-desktop-preempt-rt.patch?r1=1.4&r2=1.5&f=u



More information about the pld-cvs-commit mailing list