[kernel] r18090 - in dists/sid/linux-2.6/debian: . patches/features/all/rt patches/series

Uwe Kleine-König ukleinek-guest at alioth.debian.org
Thu Sep 15 14:07:17 UTC 2011


Author: ukleinek-guest
Date: Thu Sep 15 14:07:15 2011
New Revision: 18090

Log:
[amd64] Update rt featureset to 3.0.4-rt14

(and remove whitespace noise introduced in r18089)

Added:
   dists/sid/linux-2.6/debian/patches/features/all/rt/patch-3.0.4-rt14.patch
      - copied, changed from r18089, dists/sid/linux-2.6/debian/patches/features/all/rt/patch-3.0.4-rt13.patch
Deleted:
   dists/sid/linux-2.6/debian/patches/features/all/rt/patch-3.0.4-rt13.patch
Modified:
   dists/sid/linux-2.6/debian/changelog
   dists/sid/linux-2.6/debian/patches/series/4-extra

Modified: dists/sid/linux-2.6/debian/changelog
==============================================================================
--- dists/sid/linux-2.6/debian/changelog	Tue Sep 13 20:32:53 2011	(r18089)
+++ dists/sid/linux-2.6/debian/changelog	Thu Sep 15 14:07:15 2011	(r18090)
@@ -28,9 +28,9 @@
   [ Moritz Muehlenhoff ]
   * Update German Debconf translation. Thanks to Holger Wansing
     (Closes: #641487)
-    
+
   [ Uwe Kleine-König ]
-  * [amd64] Update rt featureset to 3.0.4-rt13
+  * [amd64] Update rt featureset to 3.0.4-rt14
 
  -- Ben Hutchings <ben at decadent.org.uk>  Sun, 28 Aug 2011 17:07:47 +0100
 

Copied and modified: dists/sid/linux-2.6/debian/patches/features/all/rt/patch-3.0.4-rt14.patch (from r18089, dists/sid/linux-2.6/debian/patches/features/all/rt/patch-3.0.4-rt13.patch)
==============================================================================
--- dists/sid/linux-2.6/debian/patches/features/all/rt/patch-3.0.4-rt13.patch	Tue Sep 13 20:32:53 2011	(r18089, copy source)
+++ dists/sid/linux-2.6/debian/patches/features/all/rt/patch-3.0.4-rt14.patch	Thu Sep 15 14:07:15 2011	(r18090)
@@ -1,3 +1,23 @@
+Index: linux-2.6/arch/arm/plat-mxc/include/mach/iomux-v3.h
+===================================================================
+--- linux-2.6.orig/arch/arm/plat-mxc/include/mach/iomux-v3.h
++++ linux-2.6/arch/arm/plat-mxc/include/mach/iomux-v3.h
+@@ -66,7 +66,6 @@ typedef u64 iomux_v3_cfg_t;
+ #define MUX_MODE_MASK		((iomux_v3_cfg_t)0x1f << MUX_MODE_SHIFT)
+ #define MUX_PAD_CTRL_SHIFT	41
+ #define MUX_PAD_CTRL_MASK	((iomux_v3_cfg_t)0x1ffff << MUX_PAD_CTRL_SHIFT)
+-#define NO_PAD_CTRL		((iomux_v3_cfg_t)1 << (MUX_PAD_CTRL_SHIFT + 16))
+ #define MUX_SEL_INPUT_SHIFT	58
+ #define MUX_SEL_INPUT_MASK	((iomux_v3_cfg_t)0xf << MUX_SEL_INPUT_SHIFT)
+ 
+@@ -85,6 +84,7 @@ typedef u64 iomux_v3_cfg_t;
+  * Use to set PAD control
+  */
+ 
++#define NO_PAD_CTRL			(1 << 16)
+ #define PAD_CTL_DVS			(1 << 13)
+ #define PAD_CTL_HYS			(1 << 8)
+ 
 Index: linux-2.6/mm/memory.c
 ===================================================================
 --- linux-2.6.orig/mm/memory.c
@@ -965,6 +985,198 @@
  
  	if (!debug_locks)
  		print_irqtrace_events(current);
+Index: linux-2.6/drivers/pci/dmar.c
+===================================================================
+--- linux-2.6.orig/drivers/pci/dmar.c
++++ linux-2.6/drivers/pci/dmar.c
+@@ -800,7 +800,7 @@ int alloc_iommu(struct dmar_drhd_unit *d
+ 		(unsigned long long)iommu->cap,
+ 		(unsigned long long)iommu->ecap);
+ 
+-	spin_lock_init(&iommu->register_lock);
++	raw_spin_lock_init(&iommu->register_lock);
+ 
+ 	drhd->iommu = iommu;
+ 	return 0;
+@@ -921,11 +921,11 @@ int qi_submit_sync(struct qi_desc *desc,
+ restart:
+ 	rc = 0;
+ 
+-	spin_lock_irqsave(&qi->q_lock, flags);
++	raw_spin_lock_irqsave(&qi->q_lock, flags);
+ 	while (qi->free_cnt < 3) {
+-		spin_unlock_irqrestore(&qi->q_lock, flags);
++		raw_spin_unlock_irqrestore(&qi->q_lock, flags);
+ 		cpu_relax();
+-		spin_lock_irqsave(&qi->q_lock, flags);
++		raw_spin_lock_irqsave(&qi->q_lock, flags);
+ 	}
+ 
+ 	index = qi->free_head;
+@@ -965,15 +965,15 @@ restart:
+ 		if (rc)
+ 			break;
+ 
+-		spin_unlock(&qi->q_lock);
++		raw_spin_unlock(&qi->q_lock);
+ 		cpu_relax();
+-		spin_lock(&qi->q_lock);
++		raw_spin_lock(&qi->q_lock);
+ 	}
+ 
+ 	qi->desc_status[index] = QI_DONE;
+ 
+ 	reclaim_free_desc(qi);
+-	spin_unlock_irqrestore(&qi->q_lock, flags);
++	raw_spin_unlock_irqrestore(&qi->q_lock, flags);
+ 
+ 	if (rc == -EAGAIN)
+ 		goto restart;
+@@ -1062,7 +1062,7 @@ void dmar_disable_qi(struct intel_iommu 
+ 	if (!ecap_qis(iommu->ecap))
+ 		return;
+ 
+-	spin_lock_irqsave(&iommu->register_lock, flags);
++	raw_spin_lock_irqsave(&iommu->register_lock, flags);
+ 
+ 	sts =  dmar_readq(iommu->reg + DMAR_GSTS_REG);
+ 	if (!(sts & DMA_GSTS_QIES))
+@@ -1082,7 +1082,7 @@ void dmar_disable_qi(struct intel_iommu 
+ 	IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG, readl,
+ 		      !(sts & DMA_GSTS_QIES), sts);
+ end:
+-	spin_unlock_irqrestore(&iommu->register_lock, flags);
++	raw_spin_unlock_irqrestore(&iommu->register_lock, flags);
+ }
+ 
+ /*
+@@ -1097,7 +1097,7 @@ static void __dmar_enable_qi(struct inte
+ 	qi->free_head = qi->free_tail = 0;
+ 	qi->free_cnt = QI_LENGTH;
+ 
+-	spin_lock_irqsave(&iommu->register_lock, flags);
++	raw_spin_lock_irqsave(&iommu->register_lock, flags);
+ 
+ 	/* write zero to the tail reg */
+ 	writel(0, iommu->reg + DMAR_IQT_REG);
+@@ -1110,7 +1110,7 @@ static void __dmar_enable_qi(struct inte
+ 	/* Make sure hardware complete it */
+ 	IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG, readl, (sts & DMA_GSTS_QIES), sts);
+ 
+-	spin_unlock_irqrestore(&iommu->register_lock, flags);
++	raw_spin_unlock_irqrestore(&iommu->register_lock, flags);
+ }
+ 
+ /*
+@@ -1159,7 +1159,7 @@ int dmar_enable_qi(struct intel_iommu *i
+ 	qi->free_head = qi->free_tail = 0;
+ 	qi->free_cnt = QI_LENGTH;
+ 
+-	spin_lock_init(&qi->q_lock);
++	raw_spin_lock_init(&qi->q_lock);
+ 
+ 	__dmar_enable_qi(iommu);
+ 
+@@ -1225,11 +1225,11 @@ void dmar_msi_unmask(struct irq_data *da
+ 	unsigned long flag;
+ 
+ 	/* unmask it */
+-	spin_lock_irqsave(&iommu->register_lock, flag);
++	raw_spin_lock_irqsave(&iommu->register_lock, flag);
+ 	writel(0, iommu->reg + DMAR_FECTL_REG);
+ 	/* Read a reg to force flush the post write */
+ 	readl(iommu->reg + DMAR_FECTL_REG);
+-	spin_unlock_irqrestore(&iommu->register_lock, flag);
++	raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
+ }
+ 
+ void dmar_msi_mask(struct irq_data *data)
+@@ -1238,11 +1238,11 @@ void dmar_msi_mask(struct irq_data *data
+ 	struct intel_iommu *iommu = irq_data_get_irq_handler_data(data);
+ 
+ 	/* mask it */
+-	spin_lock_irqsave(&iommu->register_lock, flag);
++	raw_spin_lock_irqsave(&iommu->register_lock, flag);
+ 	writel(DMA_FECTL_IM, iommu->reg + DMAR_FECTL_REG);
+ 	/* Read a reg to force flush the post write */
+ 	readl(iommu->reg + DMAR_FECTL_REG);
+-	spin_unlock_irqrestore(&iommu->register_lock, flag);
++	raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
+ }
+ 
+ void dmar_msi_write(int irq, struct msi_msg *msg)
+@@ -1250,11 +1250,11 @@ void dmar_msi_write(int irq, struct msi_
+ 	struct intel_iommu *iommu = irq_get_handler_data(irq);
+ 	unsigned long flag;
+ 
+-	spin_lock_irqsave(&iommu->register_lock, flag);
++	raw_spin_lock_irqsave(&iommu->register_lock, flag);
+ 	writel(msg->data, iommu->reg + DMAR_FEDATA_REG);
+ 	writel(msg->address_lo, iommu->reg + DMAR_FEADDR_REG);
+ 	writel(msg->address_hi, iommu->reg + DMAR_FEUADDR_REG);
+-	spin_unlock_irqrestore(&iommu->register_lock, flag);
++	raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
+ }
+ 
+ void dmar_msi_read(int irq, struct msi_msg *msg)
+@@ -1262,11 +1262,11 @@ void dmar_msi_read(int irq, struct msi_m
+ 	struct intel_iommu *iommu = irq_get_handler_data(irq);
+ 	unsigned long flag;
+ 
+-	spin_lock_irqsave(&iommu->register_lock, flag);
++	raw_spin_lock_irqsave(&iommu->register_lock, flag);
+ 	msg->data = readl(iommu->reg + DMAR_FEDATA_REG);
+ 	msg->address_lo = readl(iommu->reg + DMAR_FEADDR_REG);
+ 	msg->address_hi = readl(iommu->reg + DMAR_FEUADDR_REG);
+-	spin_unlock_irqrestore(&iommu->register_lock, flag);
++	raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
+ }
+ 
+ static int dmar_fault_do_one(struct intel_iommu *iommu, int type,
+@@ -1303,7 +1303,7 @@ irqreturn_t dmar_fault(int irq, void *de
+ 	u32 fault_status;
+ 	unsigned long flag;
+ 
+-	spin_lock_irqsave(&iommu->register_lock, flag);
++	raw_spin_lock_irqsave(&iommu->register_lock, flag);
+ 	fault_status = readl(iommu->reg + DMAR_FSTS_REG);
+ 	if (fault_status)
+ 		printk(KERN_ERR "DRHD: handling fault status reg %x\n",
+@@ -1342,7 +1342,7 @@ irqreturn_t dmar_fault(int irq, void *de
+ 		writel(DMA_FRCD_F, iommu->reg + reg +
+ 			fault_index * PRIMARY_FAULT_REG_LEN + 12);
+ 
+-		spin_unlock_irqrestore(&iommu->register_lock, flag);
++		raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
+ 
+ 		dmar_fault_do_one(iommu, type, fault_reason,
+ 				source_id, guest_addr);
+@@ -1350,14 +1350,14 @@ irqreturn_t dmar_fault(int irq, void *de
+ 		fault_index++;
+ 		if (fault_index >= cap_num_fault_regs(iommu->cap))
+ 			fault_index = 0;
+-		spin_lock_irqsave(&iommu->register_lock, flag);
++		raw_spin_lock_irqsave(&iommu->register_lock, flag);
+ 	}
+ clear_rest:
+ 	/* clear all the other faults */
+ 	fault_status = readl(iommu->reg + DMAR_FSTS_REG);
+ 	writel(fault_status, iommu->reg + DMAR_FSTS_REG);
+ 
+-	spin_unlock_irqrestore(&iommu->register_lock, flag);
++	raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
+ 	return IRQ_HANDLED;
+ }
+ 
+@@ -1388,7 +1388,7 @@ int dmar_set_interrupt(struct intel_iomm
+ 		return ret;
+ 	}
+ 
+-	ret = request_irq(irq, dmar_fault, 0, iommu->name, iommu);
++	ret = request_irq(irq, dmar_fault, IRQF_NO_THREAD, iommu->name, iommu);
+ 	if (ret)
+ 		printk(KERN_ERR "IOMMU: can't request irq\n");
+ 	return ret;
 Index: linux-2.6/kernel/trace/ftrace.c
 ===================================================================
 --- linux-2.6.orig/kernel/trace/ftrace.c
@@ -1557,7 +1769,22 @@
  #endif
  
  void set_user_nice(struct task_struct *p, long nice)
-@@ -5543,7 +5588,7 @@ SYSCALL_DEFINE0(sched_yield)
+@@ -5009,7 +5054,13 @@ EXPORT_SYMBOL(task_nice);
+  */
+ int idle_cpu(int cpu)
+ {
+-	return cpu_curr(cpu) == cpu_rq(cpu)->idle;
++	struct rq *rq = cpu_rq(cpu);
++
++#ifdef CONFIG_SMP
++	return rq->curr == rq->idle && !rq->nr_running && !rq->wake_list;
++#else
++	return rq->curr == rq->idle && !rq->nr_running;
++#endif
+ }
+ 
+ /**
+@@ -5543,7 +5594,7 @@ SYSCALL_DEFINE0(sched_yield)
  	__release(rq->lock);
  	spin_release(&rq->lock.dep_map, 1, _THIS_IP_);
  	do_raw_spin_unlock(&rq->lock);
@@ -1566,7 +1793,7 @@
  
  	schedule();
  
-@@ -5557,9 +5602,17 @@ static inline int should_resched(void)
+@@ -5557,9 +5608,17 @@ static inline int should_resched(void)
  
  static void __cond_resched(void)
  {
@@ -1587,7 +1814,7 @@
  }
  
  int __sched _cond_resched(void)
-@@ -5600,6 +5653,7 @@ int __cond_resched_lock(spinlock_t *lock
+@@ -5600,6 +5659,7 @@ int __cond_resched_lock(spinlock_t *lock
  }
  EXPORT_SYMBOL(__cond_resched_lock);
  
@@ -1595,7 +1822,7 @@
  int __sched __cond_resched_softirq(void)
  {
  	BUG_ON(!in_softirq());
-@@ -5613,6 +5667,7 @@ int __sched __cond_resched_softirq(void)
+@@ -5613,6 +5673,7 @@ int __sched __cond_resched_softirq(void)
  	return 0;
  }
  EXPORT_SYMBOL(__cond_resched_softirq);
@@ -1603,7 +1830,7 @@
  
  /**
   * yield - yield the current processor to other threads.
-@@ -5859,7 +5914,7 @@ void show_state_filter(unsigned long sta
+@@ -5859,7 +5920,7 @@ void show_state_filter(unsigned long sta
  	printk(KERN_INFO
  		"  task                        PC stack   pid father\n");
  #endif
@@ -1612,7 +1839,7 @@
  	do_each_thread(g, p) {
  		/*
  		 * reset the NMI-timeout, listing all files on a slow
-@@ -5875,7 +5930,7 @@ void show_state_filter(unsigned long sta
+@@ -5875,7 +5936,7 @@ void show_state_filter(unsigned long sta
  #ifdef CONFIG_SCHED_DEBUG
  	sysrq_sched_debug_show();
  #endif
@@ -1621,7 +1848,7 @@
  	/*
  	 * Only show locks if all tasks are dumped:
  	 */
-@@ -5997,12 +6052,12 @@ static inline void sched_init_granularit
+@@ -5997,12 +6058,12 @@ static inline void sched_init_granularit
  #ifdef CONFIG_SMP
  void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask)
  {
@@ -1638,7 +1865,7 @@
  }
  
  /*
-@@ -6053,7 +6108,7 @@ int set_cpus_allowed_ptr(struct task_str
+@@ -6053,7 +6114,7 @@ int set_cpus_allowed_ptr(struct task_str
  	do_set_cpus_allowed(p, new_mask);
  
  	/* Can the task run on the task's current CPU? If so, we're done */
@@ -1647,7 +1874,7 @@
  		goto out;
  
  	dest_cpu = cpumask_any_and(cpu_active_mask, new_mask);
-@@ -6072,6 +6127,124 @@ out:
+@@ -6072,6 +6133,124 @@ out:
  }
  EXPORT_SYMBOL_GPL(set_cpus_allowed_ptr);
  
@@ -1772,7 +1999,7 @@
  /*
   * Move (not current) task off this cpu, onto dest cpu. We're doing
   * this because either it can't run here any more (set_cpus_allowed()
-@@ -6100,7 +6273,7 @@ static int __migrate_task(struct task_st
+@@ -6100,7 +6279,7 @@ static int __migrate_task(struct task_st
  	if (task_cpu(p) != src_cpu)
  		goto done;
  	/* Affinity changed (again). */
@@ -1781,7 +2008,7 @@
  		goto fail;
  
  	/*
-@@ -6142,6 +6315,8 @@ static int migration_cpu_stop(void *data
+@@ -6142,6 +6321,8 @@ static int migration_cpu_stop(void *data
  
  #ifdef CONFIG_HOTPLUG_CPU
  
@@ -1790,7 +2017,7 @@
  /*
   * Ensures that the idle task is using init_mm right before its cpu goes
   * offline.
-@@ -6154,7 +6329,12 @@ void idle_task_exit(void)
+@@ -6154,7 +6335,12 @@ void idle_task_exit(void)
  
  	if (mm != &init_mm)
  		switch_mm(mm, &init_mm, current);
@@ -1804,7 +2031,7 @@
  }
  
  /*
-@@ -6472,6 +6652,12 @@ migration_call(struct notifier_block *nf
+@@ -6472,6 +6658,12 @@ migration_call(struct notifier_block *nf
  		migrate_nr_uninterruptible(rq);
  		calc_global_load_remove(rq);
  		break;
@@ -1817,7 +2044,7 @@
  #endif
  	}
  
-@@ -8188,7 +8374,8 @@ void __init sched_init(void)
+@@ -8188,7 +8380,8 @@ void __init sched_init(void)
  #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
  static inline int preempt_count_equals(int preempt_offset)
  {
@@ -2089,864 +2316,605 @@
 -				       unsigned int cpu);
 +void wq_worker_running(struct task_struct *task);
 +void wq_worker_sleeping(struct task_struct *task);
-Index: linux-2.6/arch/x86/kernel/cpu/intel_cacheinfo.c
+Index: linux-2.6/arch/mips/sibyte/sb1250/irq.c
 ===================================================================
---- linux-2.6.orig/arch/x86/kernel/cpu/intel_cacheinfo.c
-+++ linux-2.6/arch/x86/kernel/cpu/intel_cacheinfo.c
-@@ -151,28 +151,17 @@ union _cpuid4_leaf_ecx {
- 	u32 full;
- };
+--- linux-2.6.orig/arch/mips/sibyte/sb1250/irq.c
++++ linux-2.6/arch/mips/sibyte/sb1250/irq.c
+@@ -178,7 +178,7 @@ static void ack_sb1250_irq(struct irq_da
  
--struct amd_l3_cache {
--	struct	 amd_northbridge *nb;
--	unsigned indices;
--	u8	 subcaches[4];
--};
--
--struct _cpuid4_info {
-+struct _cpuid4_info_regs {
- 	union _cpuid4_leaf_eax eax;
- 	union _cpuid4_leaf_ebx ebx;
- 	union _cpuid4_leaf_ecx ecx;
- 	unsigned long size;
--	struct amd_l3_cache *l3;
--	DECLARE_BITMAP(shared_cpu_map, NR_CPUS);
-+	struct amd_northbridge *nb;
- };
+ static struct irq_chip sb1250_irq_type = {
+ 	.name = "SB1250-IMR",
+-	.irq_mask_ack = ack_sb1250_irq,
++	.irq_mask = ack_sb1250_irq,
+ 	.irq_unmask = enable_sb1250_irq,
+ #ifdef CONFIG_SMP
+ 	.irq_set_affinity = sb1250_set_affinity
+Index: linux-2.6/arch/mips/kernel/ftrace.c
+===================================================================
+--- linux-2.6.orig/arch/mips/kernel/ftrace.c
++++ linux-2.6/arch/mips/kernel/ftrace.c
+@@ -19,6 +19,26 @@
  
--/* subset of above _cpuid4_info w/o shared_cpu_map */
--struct _cpuid4_info_regs {
--	union _cpuid4_leaf_eax eax;
--	union _cpuid4_leaf_ebx ebx;
--	union _cpuid4_leaf_ecx ecx;
--	unsigned long size;
--	struct amd_l3_cache *l3;
-+struct _cpuid4_info {
-+	struct _cpuid4_info_regs base;
-+	DECLARE_BITMAP(shared_cpu_map, NR_CPUS);
- };
+ #include <asm-generic/sections.h>
  
- unsigned short			num_cache_leaves;
-@@ -314,12 +303,13 @@ struct _cache_attr {
- /*
-  * L3 cache descriptors
-  */
--static void __cpuinit amd_calc_l3_indices(struct amd_l3_cache *l3)
-+static void __cpuinit amd_calc_l3_indices(struct amd_northbridge *nb)
- {
-+	struct amd_l3_cache *l3 = &nb->l3_cache;
- 	unsigned int sc0, sc1, sc2, sc3;
- 	u32 val = 0;
- 
--	pci_read_config_dword(l3->nb->misc, 0x1C4, &val);
-+	pci_read_config_dword(nb->misc, 0x1C4, &val);
- 
- 	/* calculate subcache sizes */
- 	l3->subcaches[0] = sc0 = !(val & BIT(0));
-@@ -333,33 +323,16 @@ static void __cpuinit amd_calc_l3_indice
- static void __cpuinit amd_init_l3_cache(struct _cpuid4_info_regs *this_leaf,
- 					int index)
- {
--	static struct amd_l3_cache *__cpuinitdata l3_caches;
- 	int node;
- 
- 	/* only for L3, and not in virtualized environments */
--	if (index < 3 || amd_nb_num() == 0)
-+	if (index < 3)
- 		return;
++#if defined(KBUILD_MCOUNT_RA_ADDRESS) && defined(CONFIG_32BIT)
++#define MCOUNT_OFFSET_INSNS 5
++#else
++#define MCOUNT_OFFSET_INSNS 4
++#endif
++
++/*
++ * Check if the address is in kernel space
++ *
++ * Clone core_kernel_text() from kernel/extable.c, but doesn't call
++ * init_kernel_text() for Ftrace doesn't trace functions in init sections.
++ */
++static inline int in_kernel_space(unsigned long ip)
++{
++	if (ip >= (unsigned long)_stext &&
++	    ip <= (unsigned long)_etext)
++		return 1;
++	return 0;
++}
++
+ #ifdef CONFIG_DYNAMIC_FTRACE
  
--	/*
--	 * Strictly speaking, the amount in @size below is leaked since it is
--	 * never freed but this is done only on shutdown so it doesn't matter.
--	 */
--	if (!l3_caches) {
--		int size = amd_nb_num() * sizeof(struct amd_l3_cache);
--
--		l3_caches = kzalloc(size, GFP_ATOMIC);
--		if (!l3_caches)
--			return;
--	}
--
- 	node = amd_get_nb_id(smp_processor_id());
--
--	if (!l3_caches[node].nb) {
--		l3_caches[node].nb = node_to_amd_nb(node);
--		amd_calc_l3_indices(&l3_caches[node]);
--	}
--
--	this_leaf->l3 = &l3_caches[node];
-+	this_leaf->nb = node_to_amd_nb(node);
-+	if (this_leaf->nb && !this_leaf->nb->l3_cache.indices)
-+		amd_calc_l3_indices(this_leaf->nb);
+ #define JAL 0x0c000000		/* jump & link: ip --> ra, jump to target */
+@@ -54,20 +74,6 @@ static inline void ftrace_dyn_arch_init_
+ #endif
  }
  
- /*
-@@ -369,11 +342,11 @@ static void __cpuinit amd_init_l3_cache(
-  *
-  * @returns: the disabled index if used or negative value if slot free.
-  */
--int amd_get_l3_disable_slot(struct amd_l3_cache *l3, unsigned slot)
-+int amd_get_l3_disable_slot(struct amd_northbridge *nb, unsigned slot)
+-/*
+- * Check if the address is in kernel space
+- *
+- * Clone core_kernel_text() from kernel/extable.c, but doesn't call
+- * init_kernel_text() for Ftrace doesn't trace functions in init sections.
+- */
+-static inline int in_kernel_space(unsigned long ip)
+-{
+-	if (ip >= (unsigned long)_stext &&
+-	    ip <= (unsigned long)_etext)
+-		return 1;
+-	return 0;
+-}
+-
+ static int ftrace_modify_code(unsigned long ip, unsigned int new_code)
  {
- 	unsigned int reg = 0;
+ 	int faulted;
+@@ -112,11 +118,6 @@ static int ftrace_modify_code(unsigned l
+  *                                  1: offset = 4 instructions
+  */
  
--	pci_read_config_dword(l3->nb->misc, 0x1BC + slot * 4, &reg);
-+	pci_read_config_dword(nb->misc, 0x1BC + slot * 4, &reg);
+-#if defined(KBUILD_MCOUNT_RA_ADDRESS) && defined(CONFIG_32BIT)
+-#define MCOUNT_OFFSET_INSNS 5
+-#else
+-#define MCOUNT_OFFSET_INSNS 4
+-#endif
+ #define INSN_B_1F (0x10000000 | MCOUNT_OFFSET_INSNS)
  
- 	/* check whether this slot is activated already */
- 	if (reg & (3UL << 30))
-@@ -387,11 +360,10 @@ static ssize_t show_cache_disable(struct
- {
- 	int index;
+ int ftrace_make_nop(struct module *mod,
+Index: linux-2.6/arch/mips/loongson/fuloong-2e/irq.c
+===================================================================
+--- linux-2.6.orig/arch/mips/loongson/fuloong-2e/irq.c
++++ linux-2.6/arch/mips/loongson/fuloong-2e/irq.c
+@@ -42,6 +42,7 @@ asmlinkage void mach_irq_dispatch(unsign
+ static struct irqaction cascade_irqaction = {
+ 	.handler = no_action,
+ 	.name = "cascade",
++	.flags = IRQF_NO_THREAD,
+ };
  
--	if (!this_leaf->l3 ||
--	    !amd_nb_has_feature(AMD_NB_L3_INDEX_DISABLE))
-+	if (!this_leaf->base.nb || !amd_nb_has_feature(AMD_NB_L3_INDEX_DISABLE))
- 		return -EINVAL;
+ void __init mach_init_irq(void)
+Index: linux-2.6/arch/mips/loongson/lemote-2f/irq.c
+===================================================================
+--- linux-2.6.orig/arch/mips/loongson/lemote-2f/irq.c
++++ linux-2.6/arch/mips/loongson/lemote-2f/irq.c
+@@ -96,12 +96,13 @@ static irqreturn_t ip6_action(int cpl, v
+ struct irqaction ip6_irqaction = {
+ 	.handler = ip6_action,
+ 	.name = "cascade",
+-	.flags = IRQF_SHARED,
++	.flags = IRQF_SHARED | IRQF_NO_THREAD,
+ };
  
--	index = amd_get_l3_disable_slot(this_leaf->l3, slot);
-+	index = amd_get_l3_disable_slot(this_leaf->base.nb, slot);
- 	if (index >= 0)
- 		return sprintf(buf, "%d\n", index);
+ struct irqaction cascade_irqaction = {
+ 	.handler = no_action,
+ 	.name = "cascade",
++	.flags = IRQF_NO_THREAD,
+ };
  
-@@ -408,7 +380,7 @@ show_cache_disable_##slot(struct _cpuid4
- SHOW_CACHE_DISABLE(0)
- SHOW_CACHE_DISABLE(1)
+ void __init mach_init_irq(void)
+Index: linux-2.6/arch/mips/ar7/irq.c
+===================================================================
+--- linux-2.6.orig/arch/mips/ar7/irq.c
++++ linux-2.6/arch/mips/ar7/irq.c
+@@ -98,7 +98,8 @@ static struct irq_chip ar7_sec_irq_type 
  
--static void amd_l3_disable_index(struct amd_l3_cache *l3, int cpu,
-+static void amd_l3_disable_index(struct amd_northbridge *nb, int cpu,
- 				 unsigned slot, unsigned long idx)
- {
- 	int i;
-@@ -421,10 +393,10 @@ static void amd_l3_disable_index(struct 
- 	for (i = 0; i < 4; i++) {
- 		u32 reg = idx | (i << 20);
+ static struct irqaction ar7_cascade_action = {
+ 	.handler = no_action,
+-	.name = "AR7 cascade interrupt"
++	.name = "AR7 cascade interrupt",
++	.flags = IRQF_NO_THREAD,
+ };
  
--		if (!l3->subcaches[i])
-+		if (!nb->l3_cache.subcaches[i])
- 			continue;
+ static void __init ar7_irq_init(int base)
+Index: linux-2.6/arch/mips/bcm63xx/irq.c
+===================================================================
+--- linux-2.6.orig/arch/mips/bcm63xx/irq.c
++++ linux-2.6/arch/mips/bcm63xx/irq.c
+@@ -222,6 +222,7 @@ static struct irq_chip bcm63xx_external_
+ static struct irqaction cpu_ip2_cascade_action = {
+ 	.handler	= no_action,
+ 	.name		= "cascade_ip2",
++	.flags		= IRQF_NO_THREAD,
+ };
  
--		pci_write_config_dword(l3->nb->misc, 0x1BC + slot * 4, reg);
-+		pci_write_config_dword(nb->misc, 0x1BC + slot * 4, reg);
+ void __init arch_init_irq(void)
+Index: linux-2.6/arch/mips/cobalt/irq.c
+===================================================================
+--- linux-2.6.orig/arch/mips/cobalt/irq.c
++++ linux-2.6/arch/mips/cobalt/irq.c
+@@ -48,6 +48,7 @@ asmlinkage void plat_irq_dispatch(void)
+ static struct irqaction cascade = {
+ 	.handler	= no_action,
+ 	.name		= "cascade",
++	.flags		= IRQF_NO_THREAD,
+ };
  
- 		/*
- 		 * We need to WBINVD on a core on the node containing the L3
-@@ -434,7 +406,7 @@ static void amd_l3_disable_index(struct 
- 		wbinvd_on_cpu(cpu);
+ void __init arch_init_irq(void)
+Index: linux-2.6/arch/mips/dec/setup.c
+===================================================================
+--- linux-2.6.orig/arch/mips/dec/setup.c
++++ linux-2.6/arch/mips/dec/setup.c
+@@ -101,20 +101,24 @@ int cpu_fpu_mask = DEC_CPU_IRQ_MASK(DEC_
+ static struct irqaction ioirq = {
+ 	.handler = no_action,
+ 	.name = "cascade",
++	.flags = IRQF_NO_THREAD,
+ };
+ static struct irqaction fpuirq = {
+ 	.handler = no_action,
+ 	.name = "fpu",
++	.flags = IRQF_NO_THREAD,
+ };
  
- 		reg |= BIT(31);
--		pci_write_config_dword(l3->nb->misc, 0x1BC + slot * 4, reg);
-+		pci_write_config_dword(nb->misc, 0x1BC + slot * 4, reg);
- 	}
- }
+ static struct irqaction busirq = {
+ 	.flags = IRQF_DISABLED,
+ 	.name = "bus error",
++	.flags = IRQF_NO_THREAD,
+ };
  
-@@ -448,24 +420,24 @@ static void amd_l3_disable_index(struct 
-  *
-  * @return: 0 on success, error status on failure
-  */
--int amd_set_l3_disable_slot(struct amd_l3_cache *l3, int cpu, unsigned slot,
-+int amd_set_l3_disable_slot(struct amd_northbridge *nb, int cpu, unsigned slot,
- 			    unsigned long index)
- {
- 	int ret = 0;
+ static struct irqaction haltirq = {
+ 	.handler = dec_intr_halt,
+ 	.name = "halt",
++	.flags = IRQF_NO_THREAD,
+ };
  
- 	/*  check if @slot is already used or the index is already disabled */
--	ret = amd_get_l3_disable_slot(l3, slot);
-+	ret = amd_get_l3_disable_slot(nb, slot);
- 	if (ret >= 0)
- 		return -EINVAL;
  
--	if (index > l3->indices)
-+	if (index > nb->l3_cache.indices)
- 		return -EINVAL;
+Index: linux-2.6/arch/mips/emma/markeins/irq.c
+===================================================================
+--- linux-2.6.orig/arch/mips/emma/markeins/irq.c
++++ linux-2.6/arch/mips/emma/markeins/irq.c
+@@ -169,7 +169,7 @@ void emma2rh_gpio_irq_init(void)
  
- 	/* check whether the other slot has disabled the same index already */
--	if (index == amd_get_l3_disable_slot(l3, !slot))
-+	if (index == amd_get_l3_disable_slot(nb, !slot))
- 		return -EINVAL;
- 
--	amd_l3_disable_index(l3, cpu, slot, index);
-+	amd_l3_disable_index(nb, cpu, slot, index);
- 
- 	return 0;
- }
-@@ -480,8 +452,7 @@ static ssize_t store_cache_disable(struc
- 	if (!capable(CAP_SYS_ADMIN))
- 		return -EPERM;
- 
--	if (!this_leaf->l3 ||
--	    !amd_nb_has_feature(AMD_NB_L3_INDEX_DISABLE))
-+	if (!this_leaf->base.nb || !amd_nb_has_feature(AMD_NB_L3_INDEX_DISABLE))
- 		return -EINVAL;
- 
- 	cpu = cpumask_first(to_cpumask(this_leaf->shared_cpu_map));
-@@ -489,7 +460,7 @@ static ssize_t store_cache_disable(struc
- 	if (strict_strtoul(buf, 10, &val) < 0)
- 		return -EINVAL;
+ static struct irqaction irq_cascade = {
+ 	   .handler = no_action,
+-	   .flags = 0,
++	   .flags = IRQF_NO_THREAD,
+ 	   .name = "cascade",
+ 	   .dev_id = NULL,
+ 	   .next = NULL,
+Index: linux-2.6/arch/mips/lasat/interrupt.c
+===================================================================
+--- linux-2.6.orig/arch/mips/lasat/interrupt.c
++++ linux-2.6/arch/mips/lasat/interrupt.c
+@@ -105,6 +105,7 @@ asmlinkage void plat_irq_dispatch(void)
+ static struct irqaction cascade = {
+ 	.handler	= no_action,
+ 	.name		= "cascade",
++	.flags		= IRQF_NO_THREAD,
+ };
  
--	err = amd_set_l3_disable_slot(this_leaf->l3, cpu, slot, val);
-+	err = amd_set_l3_disable_slot(this_leaf->base.nb, cpu, slot, val);
- 	if (err) {
- 		if (err == -EEXIST)
- 			printk(KERN_WARNING "L3 disable slot %d in use!\n",
-@@ -518,7 +489,7 @@ static struct _cache_attr cache_disable_
- static ssize_t
- show_subcaches(struct _cpuid4_info *this_leaf, char *buf, unsigned int cpu)
- {
--	if (!this_leaf->l3 || !amd_nb_has_feature(AMD_NB_L3_PARTITIONING))
-+	if (!this_leaf->base.nb || !amd_nb_has_feature(AMD_NB_L3_PARTITIONING))
- 		return -EINVAL;
+ void __init arch_init_irq(void)
+Index: linux-2.6/arch/mips/mti-malta/malta-int.c
+===================================================================
+--- linux-2.6.orig/arch/mips/mti-malta/malta-int.c
++++ linux-2.6/arch/mips/mti-malta/malta-int.c
+@@ -350,12 +350,14 @@ unsigned int plat_ipi_resched_int_xlate(
  
- 	return sprintf(buf, "%x\n", amd_get_subcaches(cpu));
-@@ -533,7 +504,7 @@ store_subcaches(struct _cpuid4_info *thi
- 	if (!capable(CAP_SYS_ADMIN))
- 		return -EPERM;
+ static struct irqaction i8259irq = {
+ 	.handler = no_action,
+-	.name = "XT-PIC cascade"
++	.name = "XT-PIC cascade",
++	.flags = IRQF_NO_THREAD,
+ };
  
--	if (!this_leaf->l3 || !amd_nb_has_feature(AMD_NB_L3_PARTITIONING))
-+	if (!this_leaf->base.nb || !amd_nb_has_feature(AMD_NB_L3_PARTITIONING))
- 		return -EINVAL;
+ static struct irqaction corehi_irqaction = {
+ 	.handler = no_action,
+-	.name = "CoreHi"
++	.name = "CoreHi",
++	.flags = IRQF_NO_THREAD,
+ };
  
- 	if (strict_strtoul(buf, 16, &val) < 0)
-@@ -769,7 +740,7 @@ static void __cpuinit cache_shared_cpu_m
- 		return;
- 	}
- 	this_leaf = CPUID4_INFO_IDX(cpu, index);
--	num_threads_sharing = 1 + this_leaf->eax.split.num_threads_sharing;
-+	num_threads_sharing = 1 + this_leaf->base.eax.split.num_threads_sharing;
+ static msc_irqmap_t __initdata msc_irqmap[] = {
+Index: linux-2.6/arch/mips/pmc-sierra/msp71xx/msp_irq.c
+===================================================================
+--- linux-2.6.orig/arch/mips/pmc-sierra/msp71xx/msp_irq.c
++++ linux-2.6/arch/mips/pmc-sierra/msp71xx/msp_irq.c
+@@ -109,11 +109,13 @@ asmlinkage void plat_irq_dispatch(struct
+ static struct irqaction cic_cascade_msp = {
+ 	.handler = no_action,
+ 	.name	 = "MSP CIC cascade"
++	.flags	 = IRQF_NO_THREAD,
+ };
  
- 	if (num_threads_sharing == 1)
- 		cpumask_set_cpu(cpu, to_cpumask(this_leaf->shared_cpu_map));
-@@ -820,29 +791,19 @@ static void __cpuinit free_cache_attribu
- 	for (i = 0; i < num_cache_leaves; i++)
- 		cache_remove_shared_cpu_map(cpu, i);
+ static struct irqaction per_cascade_msp = {
+ 	.handler = no_action,
+ 	.name	 = "MSP PER cascade"
++	.flags	 = IRQF_NO_THREAD,
+ };
  
--	kfree(per_cpu(ici_cpuid4_info, cpu)->l3);
- 	kfree(per_cpu(ici_cpuid4_info, cpu));
- 	per_cpu(ici_cpuid4_info, cpu) = NULL;
- }
+ void __init arch_init_irq(void)
+Index: linux-2.6/arch/mips/pnx8550/common/int.c
+===================================================================
+--- linux-2.6.orig/arch/mips/pnx8550/common/int.c
++++ linux-2.6/arch/mips/pnx8550/common/int.c
+@@ -167,7 +167,7 @@ static struct irq_chip level_irq_type = 
  
--static int
--__cpuinit cpuid4_cache_lookup(int index, struct _cpuid4_info *this_leaf)
--{
--	struct _cpuid4_info_regs *leaf_regs =
--		(struct _cpuid4_info_regs *)this_leaf;
--
--	return cpuid4_cache_lookup_regs(index, leaf_regs);
--}
--
- static void __cpuinit get_cpu_leaves(void *_retval)
- {
- 	int j, *retval = _retval, cpu = smp_processor_id();
+ static struct irqaction gic_action = {
+ 	.handler =	no_action,
+-	.flags =	IRQF_DISABLED,
++	.flags =	IRQF_DISABLED | IRQF_NO_THREAD,
+ 	.name =		"GIC",
+ };
  
- 	/* Do cpuid and store the results */
- 	for (j = 0; j < num_cache_leaves; j++) {
--		struct _cpuid4_info *this_leaf;
--		this_leaf = CPUID4_INFO_IDX(cpu, j);
--		*retval = cpuid4_cache_lookup(j, this_leaf);
-+		struct _cpuid4_info *this_leaf = CPUID4_INFO_IDX(cpu, j);
-+
-+		*retval = cpuid4_cache_lookup_regs(j, &this_leaf->base);
- 		if (unlikely(*retval < 0)) {
- 			int i;
+Index: linux-2.6/arch/mips/sgi-ip22/ip22-int.c
+===================================================================
+--- linux-2.6.orig/arch/mips/sgi-ip22/ip22-int.c
++++ linux-2.6/arch/mips/sgi-ip22/ip22-int.c
+@@ -155,32 +155,32 @@ static void __irq_entry indy_buserror_ir
  
-@@ -900,16 +861,16 @@ static ssize_t show_##file_name(struct _
- 	return sprintf(buf, "%lu\n", (unsigned long)this_leaf->object + val); \
- }
+ static struct irqaction local0_cascade = {
+ 	.handler	= no_action,
+-	.flags		= IRQF_DISABLED,
++	.flags		= IRQF_DISABLED | IRQF_NO_THREAD,
+ 	.name		= "local0 cascade",
+ };
  
--show_one_plus(level, eax.split.level, 0);
--show_one_plus(coherency_line_size, ebx.split.coherency_line_size, 1);
--show_one_plus(physical_line_partition, ebx.split.physical_line_partition, 1);
--show_one_plus(ways_of_associativity, ebx.split.ways_of_associativity, 1);
--show_one_plus(number_of_sets, ecx.split.number_of_sets, 1);
-+show_one_plus(level, base.eax.split.level, 0);
-+show_one_plus(coherency_line_size, base.ebx.split.coherency_line_size, 1);
-+show_one_plus(physical_line_partition, base.ebx.split.physical_line_partition, 1);
-+show_one_plus(ways_of_associativity, base.ebx.split.ways_of_associativity, 1);
-+show_one_plus(number_of_sets, base.ecx.split.number_of_sets, 1);
+ static struct irqaction local1_cascade = {
+ 	.handler	= no_action,
+-	.flags		= IRQF_DISABLED,
++	.flags		= IRQF_DISABLED | IRQF_NO_THREAD,
+ 	.name		= "local1 cascade",
+ };
  
- static ssize_t show_size(struct _cpuid4_info *this_leaf, char *buf,
- 			 unsigned int cpu)
- {
--	return sprintf(buf, "%luK\n", this_leaf->size / 1024);
-+	return sprintf(buf, "%luK\n", this_leaf->base.size / 1024);
- }
+ static struct irqaction buserr = {
+ 	.handler	= no_action,
+-	.flags		= IRQF_DISABLED,
++	.flags		= IRQF_DISABLED | IRQF_NO_THREAD,
+ 	.name		= "Bus Error",
+ };
  
- static ssize_t show_shared_cpu_map_func(struct _cpuid4_info *this_leaf,
-@@ -946,7 +907,7 @@ static inline ssize_t show_shared_cpu_li
- static ssize_t show_type(struct _cpuid4_info *this_leaf, char *buf,
- 			 unsigned int cpu)
- {
--	switch (this_leaf->eax.split.type) {
-+	switch (this_leaf->base.eax.split.type) {
- 	case CACHE_TYPE_DATA:
- 		return sprintf(buf, "Data\n");
- 	case CACHE_TYPE_INST:
-@@ -1135,7 +1096,7 @@ static int __cpuinit cache_add_dev(struc
+ static struct irqaction map0_cascade = {
+ 	.handler	= no_action,
+-	.flags		= IRQF_DISABLED,
++	.flags		= IRQF_DISABLED | IRQF_NO_THREAD,
+ 	.name		= "mapable0 cascade",
+ };
  
- 		ktype_cache.default_attrs = default_attrs;
- #ifdef CONFIG_AMD_NB
--		if (this_leaf->l3)
-+		if (this_leaf->base.nb)
- 			ktype_cache.default_attrs = amd_l3_attrs();
- #endif
- 		retval = kobject_init_and_add(&(this_object->kobj),
-Index: linux-2.6/arch/x86/include/asm/amd_nb.h
+ #ifdef USE_LIO3_IRQ
+ static struct irqaction map1_cascade = {
+ 	.handler	= no_action,
+-	.flags		= IRQF_DISABLED,
++	.flags		= IRQF_DISABLED | IRQF_NO_THREAD,
+ 	.name		= "mapable1 cascade",
+ };
+ #define SGI_INTERRUPTS	SGINT_END
+Index: linux-2.6/arch/mips/sni/rm200.c
 ===================================================================
---- linux-2.6.orig/arch/x86/include/asm/amd_nb.h
-+++ linux-2.6/arch/x86/include/asm/amd_nb.h
-@@ -19,9 +19,15 @@ extern int amd_numa_init(void);
- extern int amd_get_subcaches(int);
- extern int amd_set_subcaches(int, int);
- 
-+struct amd_l3_cache {
-+	unsigned indices;
-+	u8	 subcaches[4];
-+};
-+
- struct amd_northbridge {
- 	struct pci_dev *misc;
- 	struct pci_dev *link;
-+	struct amd_l3_cache l3_cache;
+--- linux-2.6.orig/arch/mips/sni/rm200.c
++++ linux-2.6/arch/mips/sni/rm200.c
+@@ -359,6 +359,7 @@ void sni_rm200_init_8259A(void)
+ static struct irqaction sni_rm200_irq2 = {
+ 	.handler = no_action,
+ 	.name = "cascade",
++	.flags = IRQF_NO_THREAD,
  };
  
- struct amd_northbridge_info {
-Index: linux-2.6/arch/mips/sibyte/sb1250/irq.c
+ static struct resource sni_rm200_pic1_resource = {
+Index: linux-2.6/arch/mips/vr41xx/common/irq.c
 ===================================================================
---- linux-2.6.orig/arch/mips/sibyte/sb1250/irq.c
-+++ linux-2.6/arch/mips/sibyte/sb1250/irq.c
-@@ -178,7 +178,7 @@ static void ack_sb1250_irq(struct irq_da
+--- linux-2.6.orig/arch/mips/vr41xx/common/irq.c
++++ linux-2.6/arch/mips/vr41xx/common/irq.c
+@@ -34,6 +34,7 @@ static irq_cascade_t irq_cascade[NR_IRQS
+ static struct irqaction cascade_irqaction = {
+ 	.handler	= no_action,
+ 	.name		= "cascade",
++	.flags		= IRQF_NO_THREAD,
+ };
  
- static struct irq_chip sb1250_irq_type = {
- 	.name = "SB1250-IMR",
--	.irq_mask_ack = ack_sb1250_irq,
-+	.irq_mask = ack_sb1250_irq,
- 	.irq_unmask = enable_sb1250_irq,
- #ifdef CONFIG_SMP
- 	.irq_set_affinity = sb1250_set_affinity
-Index: linux-2.6/arch/mips/kernel/ftrace.c
+ int cascade_irq(unsigned int irq, int (*get_irq)(unsigned int))
+Index: linux-2.6/arch/mips/Kconfig
 ===================================================================
---- linux-2.6.orig/arch/mips/kernel/ftrace.c
-+++ linux-2.6/arch/mips/kernel/ftrace.c
-@@ -19,6 +19,26 @@
+--- linux-2.6.orig/arch/mips/Kconfig
++++ linux-2.6/arch/mips/Kconfig
+@@ -24,6 +24,7 @@ config MIPS
+ 	select GENERIC_IRQ_PROBE
+ 	select GENERIC_IRQ_SHOW
+ 	select HAVE_ARCH_JUMP_LABEL
++	select IRQ_FORCED_THREADING
  
- #include <asm-generic/sections.h>
+ menu "Machine selection"
  
-+#if defined(KBUILD_MCOUNT_RA_ADDRESS) && defined(CONFIG_32BIT)
-+#define MCOUNT_OFFSET_INSNS 5
-+#else
-+#define MCOUNT_OFFSET_INSNS 4
-+#endif
-+
-+/*
-+ * Check if the address is in kernel space
-+ *
-+ * Clone core_kernel_text() from kernel/extable.c, but doesn't call
-+ * init_kernel_text() for Ftrace doesn't trace functions in init sections.
-+ */
-+static inline int in_kernel_space(unsigned long ip)
-+{
-+	if (ip >= (unsigned long)_stext &&
-+	    ip <= (unsigned long)_etext)
-+		return 1;
-+	return 0;
-+}
-+
- #ifdef CONFIG_DYNAMIC_FTRACE
+@@ -2038,7 +2039,7 @@ config CPU_R4400_WORKAROUNDS
+ #
+ config HIGHMEM
+ 	bool "High Memory Support"
+-	depends on 32BIT && CPU_SUPPORTS_HIGHMEM && SYS_SUPPORTS_HIGHMEM
++	depends on 32BIT && CPU_SUPPORTS_HIGHMEM && SYS_SUPPORTS_HIGHMEM && !PREEMPT_RT_FULL
  
- #define JAL 0x0c000000		/* jump & link: ip --> ra, jump to target */
-@@ -54,20 +74,6 @@ static inline void ftrace_dyn_arch_init_
- #endif
+ config CPU_SUPPORTS_HIGHMEM
+ 	bool
+Index: linux-2.6/arch/mips/kernel/traps.c
+===================================================================
+--- linux-2.6.orig/arch/mips/kernel/traps.c
++++ linux-2.6/arch/mips/kernel/traps.c
+@@ -364,7 +364,7 @@ static int regs_to_trapnr(struct pt_regs
+ 	return (regs->cp0_cause >> 2) & 0x1f;
  }
  
--/*
-- * Check if the address is in kernel space
-- *
-- * Clone core_kernel_text() from kernel/extable.c, but doesn't call
-- * init_kernel_text() for Ftrace doesn't trace functions in init sections.
-- */
--static inline int in_kernel_space(unsigned long ip)
--{
--	if (ip >= (unsigned long)_stext &&
--	    ip <= (unsigned long)_etext)
--		return 1;
--	return 0;
--}
--
- static int ftrace_modify_code(unsigned long ip, unsigned int new_code)
+-static DEFINE_SPINLOCK(die_lock);
++static DEFINE_RAW_SPINLOCK(die_lock);
+ 
+ void __noreturn die(const char *str, struct pt_regs *regs)
  {
- 	int faulted;
-@@ -112,11 +118,6 @@ static int ftrace_modify_code(unsigned l
-  *                                  1: offset = 4 instructions
-  */
+@@ -378,7 +378,7 @@ void __noreturn die(const char *str, str
+ 		sig = 0;
  
--#if defined(KBUILD_MCOUNT_RA_ADDRESS) && defined(CONFIG_32BIT)
--#define MCOUNT_OFFSET_INSNS 5
--#else
--#define MCOUNT_OFFSET_INSNS 4
--#endif
- #define INSN_B_1F (0x10000000 | MCOUNT_OFFSET_INSNS)
+ 	console_verbose();
+-	spin_lock_irq(&die_lock);
++	raw_spin_lock_irq(&die_lock);
+ 	bust_spinlocks(1);
+ #ifdef CONFIG_MIPS_MT_SMTC
+ 	mips_mt_regdump(dvpret);
+@@ -387,7 +387,7 @@ void __noreturn die(const char *str, str
+ 	printk("%s[#%d]:\n", str, ++die_counter);
+ 	show_registers(regs);
+ 	add_taint(TAINT_DIE);
+-	spin_unlock_irq(&die_lock);
++	raw_spin_unlock_irq(&die_lock);
  
- int ftrace_make_nop(struct module *mod,
-Index: linux-2.6/arch/mips/loongson/fuloong-2e/irq.c
+ 	if (in_interrupt())
+ 		panic("Fatal exception in interrupt");
+Index: linux-2.6/arch/mips/kernel/signal.c
 ===================================================================
---- linux-2.6.orig/arch/mips/loongson/fuloong-2e/irq.c
-+++ linux-2.6/arch/mips/loongson/fuloong-2e/irq.c
-@@ -42,6 +42,7 @@ asmlinkage void mach_irq_dispatch(unsign
- static struct irqaction cascade_irqaction = {
- 	.handler = no_action,
- 	.name = "cascade",
-+	.flags = IRQF_NO_THREAD,
- };
+--- linux-2.6.orig/arch/mips/kernel/signal.c
++++ linux-2.6/arch/mips/kernel/signal.c
+@@ -603,6 +603,9 @@ static void do_signal(struct pt_regs *re
+ 	if (!user_mode(regs))
+ 		return;
  
- void __init mach_init_irq(void)
-Index: linux-2.6/arch/mips/loongson/lemote-2f/irq.c
++	local_irq_enable();
++	preempt_check_resched();
++
+ 	if (test_thread_flag(TIF_RESTORE_SIGMASK))
+ 		oldset = &current->saved_sigmask;
+ 	else
+Index: linux-2.6/arch/mips/kernel/i8259.c
 ===================================================================
---- linux-2.6.orig/arch/mips/loongson/lemote-2f/irq.c
-+++ linux-2.6/arch/mips/loongson/lemote-2f/irq.c
-@@ -96,12 +96,13 @@ static irqreturn_t ip6_action(int cpl, v
- struct irqaction ip6_irqaction = {
- 	.handler = ip6_action,
- 	.name = "cascade",
--	.flags = IRQF_SHARED,
-+	.flags = IRQF_SHARED | IRQF_NO_THREAD,
- };
- 
- struct irqaction cascade_irqaction = {
+--- linux-2.6.orig/arch/mips/kernel/i8259.c
++++ linux-2.6/arch/mips/kernel/i8259.c
+@@ -295,6 +295,7 @@ static void init_8259A(int auto_eoi)
+ static struct irqaction irq2 = {
  	.handler = no_action,
  	.name = "cascade",
 +	.flags = IRQF_NO_THREAD,
  };
  
- void __init mach_init_irq(void)
-Index: linux-2.6/arch/mips/ar7/irq.c
+ static struct resource pic1_io_resource = {
+Index: linux-2.6/arch/arm/kernel/signal.c
 ===================================================================
---- linux-2.6.orig/arch/mips/ar7/irq.c
-+++ linux-2.6/arch/mips/ar7/irq.c
-@@ -98,7 +98,8 @@ static struct irq_chip ar7_sec_irq_type 
- 
- static struct irqaction ar7_cascade_action = {
- 	.handler = no_action,
--	.name = "AR7 cascade interrupt"
-+	.name = "AR7 cascade interrupt",
-+	.flags = IRQF_NO_THREAD,
- };
+--- linux-2.6.orig/arch/arm/kernel/signal.c
++++ linux-2.6/arch/arm/kernel/signal.c
+@@ -673,6 +673,9 @@ static void do_signal(struct pt_regs *re
+ 	if (!user_mode(regs))
+ 		return;
  
- static void __init ar7_irq_init(int base)
-Index: linux-2.6/arch/mips/bcm63xx/irq.c
++	local_irq_enable();
++	preempt_check_resched();
++
+ 	/*
+ 	 * If we were from a system call, check for system call restarting...
+ 	 */
+Index: linux-2.6/arch/arm/kernel/smp.c
 ===================================================================
---- linux-2.6.orig/arch/mips/bcm63xx/irq.c
-+++ linux-2.6/arch/mips/bcm63xx/irq.c
-@@ -222,6 +222,7 @@ static struct irq_chip bcm63xx_external_
- static struct irqaction cpu_ip2_cascade_action = {
- 	.handler	= no_action,
- 	.name		= "cascade_ip2",
-+	.flags		= IRQF_NO_THREAD,
- };
+--- linux-2.6.orig/arch/arm/kernel/smp.c
++++ linux-2.6/arch/arm/kernel/smp.c
+@@ -305,6 +305,18 @@ asmlinkage void __cpuinit secondary_star
+ 	 * Enable local interrupts.
+ 	 */
+ 	notify_cpu_starting(cpu);
++
++	/*
++	 * OK, now it's safe to let the boot CPU continue.  Wait for
++	 * the CPU migration code to notice that the CPU is online
++	 * before we continue. We need to do that before we enable
++	 * interrupts otherwise a wakeup of a kernel thread affine to
++	 * this CPU might break the affinity and let hell break lose.
++	 */
++	set_cpu_online(cpu, true);
++	while (!cpu_active(cpu))
++		cpu_relax();
++
+ 	local_irq_enable();
+ 	local_fiq_enable();
  
- void __init arch_init_irq(void)
-Index: linux-2.6/arch/mips/cobalt/irq.c
-===================================================================
---- linux-2.6.orig/arch/mips/cobalt/irq.c
-+++ linux-2.6/arch/mips/cobalt/irq.c
-@@ -48,6 +48,7 @@ asmlinkage void plat_irq_dispatch(void)
- static struct irqaction cascade = {
- 	.handler	= no_action,
- 	.name		= "cascade",
-+	.flags		= IRQF_NO_THREAD,
- };
+@@ -318,15 +330,6 @@ asmlinkage void __cpuinit secondary_star
+ 	smp_store_cpu_info(cpu);
  
- void __init arch_init_irq(void)
-Index: linux-2.6/arch/mips/dec/setup.c
-===================================================================
---- linux-2.6.orig/arch/mips/dec/setup.c
-+++ linux-2.6/arch/mips/dec/setup.c
-@@ -101,20 +101,24 @@ int cpu_fpu_mask = DEC_CPU_IRQ_MASK(DEC_
- static struct irqaction ioirq = {
- 	.handler = no_action,
- 	.name = "cascade",
-+	.flags = IRQF_NO_THREAD,
- };
- static struct irqaction fpuirq = {
- 	.handler = no_action,
- 	.name = "fpu",
-+	.flags = IRQF_NO_THREAD,
- };
+ 	/*
+-	 * OK, now it's safe to let the boot CPU continue.  Wait for
+-	 * the CPU migration code to notice that the CPU is online
+-	 * before we continue.
+-	 */
+-	set_cpu_online(cpu, true);
+-	while (!cpu_active(cpu))
+-		cpu_relax();
+-
+-	/*
+ 	 * OK, it's off to the idle thread for us
+ 	 */
+ 	cpu_idle();
+@@ -531,7 +534,7 @@ static void percpu_timer_stop(void)
+ }
+ #endif
  
- static struct irqaction busirq = {
- 	.flags = IRQF_DISABLED,
- 	.name = "bus error",
-+	.flags = IRQF_NO_THREAD,
- };
+-static DEFINE_SPINLOCK(stop_lock);
++static DEFINE_RAW_SPINLOCK(stop_lock);
  
- static struct irqaction haltirq = {
- 	.handler = dec_intr_halt,
- 	.name = "halt",
-+	.flags = IRQF_NO_THREAD,
- };
- 
- 
-Index: linux-2.6/arch/mips/emma/markeins/irq.c
-===================================================================
---- linux-2.6.orig/arch/mips/emma/markeins/irq.c
-+++ linux-2.6/arch/mips/emma/markeins/irq.c
-@@ -169,7 +169,7 @@ void emma2rh_gpio_irq_init(void)
+ /*
+  * ipi_cpu_stop - handle IPI from smp_send_stop()
+@@ -540,10 +543,10 @@ static void ipi_cpu_stop(unsigned int cp
+ {
+ 	if (system_state == SYSTEM_BOOTING ||
+ 	    system_state == SYSTEM_RUNNING) {
+-		spin_lock(&stop_lock);
++		raw_spin_lock(&stop_lock);
+ 		printk(KERN_CRIT "CPU%u: stopping\n", cpu);
+ 		dump_stack();
+-		spin_unlock(&stop_lock);
++		raw_spin_unlock(&stop_lock);
+ 	}
  
- static struct irqaction irq_cascade = {
- 	   .handler = no_action,
--	   .flags = 0,
-+	   .flags = IRQF_NO_THREAD,
- 	   .name = "cascade",
- 	   .dev_id = NULL,
- 	   .next = NULL,
-Index: linux-2.6/arch/mips/lasat/interrupt.c
+ 	set_cpu_online(cpu, false);
+Index: linux-2.6/kernel/watchdog.c
 ===================================================================
---- linux-2.6.orig/arch/mips/lasat/interrupt.c
-+++ linux-2.6/arch/mips/lasat/interrupt.c
-@@ -105,6 +105,7 @@ asmlinkage void plat_irq_dispatch(void)
- static struct irqaction cascade = {
- 	.handler	= no_action,
- 	.name		= "cascade",
-+	.flags		= IRQF_NO_THREAD,
+--- linux-2.6.orig/kernel/watchdog.c
++++ linux-2.6/kernel/watchdog.c
+@@ -208,6 +208,8 @@ static struct perf_event_attr wd_hw_attr
+ 	.disabled	= 1,
  };
  
- void __init arch_init_irq(void)
-Index: linux-2.6/arch/mips/mti-malta/malta-int.c
-===================================================================
---- linux-2.6.orig/arch/mips/mti-malta/malta-int.c
-+++ linux-2.6/arch/mips/mti-malta/malta-int.c
-@@ -350,12 +350,14 @@ unsigned int plat_ipi_resched_int_xlate(
++static DEFINE_RAW_SPINLOCK(watchdog_output_lock);
++
+ /* Callback function for perf event subsystem */
+ static void watchdog_overflow_callback(struct perf_event *event, int nmi,
+ 		 struct perf_sample_data *data,
+@@ -234,10 +236,19 @@ static void watchdog_overflow_callback(s
+ 		if (__this_cpu_read(hard_watchdog_warn) == true)
+ 			return;
  
- static struct irqaction i8259irq = {
- 	.handler = no_action,
--	.name = "XT-PIC cascade"
-+	.name = "XT-PIC cascade",
-+	.flags = IRQF_NO_THREAD,
- };
+-		if (hardlockup_panic)
++		/*
++		 * If early-printk is enabled then make sure we do not
++		 * lock up in printk() and kill console logging:
++		 */
++		printk_kill();
++
++		if (hardlockup_panic) {
+ 			panic("Watchdog detected hard LOCKUP on cpu %d", this_cpu);
+-		else
++		} else {
++			raw_spin_lock(&watchdog_output_lock);
+ 			WARN(1, "Watchdog detected hard LOCKUP on cpu %d", this_cpu);
++			raw_spin_unlock(&watchdog_output_lock);
++		}
  
- static struct irqaction corehi_irqaction = {
- 	.handler = no_action,
--	.name = "CoreHi"
-+	.name = "CoreHi",
-+	.flags = IRQF_NO_THREAD,
- };
+ 		__this_cpu_write(hard_watchdog_warn, true);
+ 		return;
+@@ -320,7 +331,7 @@ static enum hrtimer_restart watchdog_tim
+  */
+ static int watchdog(void *unused)
+ {
+-	static struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 };
++	struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 };
+ 	struct hrtimer *hrtimer = &__raw_get_cpu_var(watchdog_hrtimer);
  
- static msc_irqmap_t __initdata msc_irqmap[] = {
-Index: linux-2.6/arch/mips/pmc-sierra/msp71xx/msp_irq.c
-===================================================================
---- linux-2.6.orig/arch/mips/pmc-sierra/msp71xx/msp_irq.c
-+++ linux-2.6/arch/mips/pmc-sierra/msp71xx/msp_irq.c
-@@ -109,11 +109,13 @@ asmlinkage void plat_irq_dispatch(struct
- static struct irqaction cic_cascade_msp = {
- 	.handler = no_action,
- 	.name	 = "MSP CIC cascade"
-+	.flags	 = IRQF_NO_THREAD,
- };
+ 	sched_setscheduler(current, SCHED_FIFO, &param);
+@@ -349,7 +360,8 @@ static int watchdog(void *unused)
+ 		set_current_state(TASK_INTERRUPTIBLE);
+ 	}
+ 	__set_current_state(TASK_RUNNING);
+-
++	param.sched_priority = 0;
++	sched_setscheduler(current, SCHED_NORMAL, &param);
+ 	return 0;
+ }
  
- static struct irqaction per_cascade_msp = {
- 	.handler = no_action,
- 	.name	 = "MSP PER cascade"
-+	.flags	 = IRQF_NO_THREAD,
- };
+@@ -422,6 +434,7 @@ static void watchdog_prepare_cpu(int cpu
+ 	WARN_ON(per_cpu(softlockup_watchdog, cpu));
+ 	hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
+ 	hrtimer->function = watchdog_timer_fn;
++	hrtimer->irqsafe = 1;
+ }
  
- void __init arch_init_irq(void)
-Index: linux-2.6/arch/mips/pnx8550/common/int.c
+ static int watchdog_enable(int cpu)
+Index: linux-2.6/kernel/time/clocksource.c
 ===================================================================
---- linux-2.6.orig/arch/mips/pnx8550/common/int.c
-+++ linux-2.6/arch/mips/pnx8550/common/int.c
-@@ -167,7 +167,7 @@ static struct irq_chip level_irq_type = 
- 
- static struct irqaction gic_action = {
- 	.handler =	no_action,
--	.flags =	IRQF_DISABLED,
-+	.flags =	IRQF_DISABLED | IRQF_NO_THREAD,
- 	.name =		"GIC",
- };
+--- linux-2.6.orig/kernel/time/clocksource.c
++++ linux-2.6/kernel/time/clocksource.c
+@@ -186,6 +186,7 @@ static struct timer_list watchdog_timer;
+ static DECLARE_WORK(watchdog_work, clocksource_watchdog_work);
+ static DEFINE_SPINLOCK(watchdog_lock);
+ static int watchdog_running;
++static atomic_t watchdog_reset_pending;
  
-Index: linux-2.6/arch/mips/sgi-ip22/ip22-int.c
-===================================================================
---- linux-2.6.orig/arch/mips/sgi-ip22/ip22-int.c
-+++ linux-2.6/arch/mips/sgi-ip22/ip22-int.c
-@@ -155,32 +155,32 @@ static void __irq_entry indy_buserror_ir
+ static int clocksource_watchdog_kthread(void *data);
+ static void __clocksource_change_rating(struct clocksource *cs, int rating);
+@@ -247,12 +248,14 @@ static void clocksource_watchdog(unsigne
+ 	struct clocksource *cs;
+ 	cycle_t csnow, wdnow;
+ 	int64_t wd_nsec, cs_nsec;
+-	int next_cpu;
++	int next_cpu, reset_pending;
  
- static struct irqaction local0_cascade = {
- 	.handler	= no_action,
--	.flags		= IRQF_DISABLED,
-+	.flags		= IRQF_DISABLED | IRQF_NO_THREAD,
- 	.name		= "local0 cascade",
- };
+ 	spin_lock(&watchdog_lock);
+ 	if (!watchdog_running)
+ 		goto out;
  
- static struct irqaction local1_cascade = {
- 	.handler	= no_action,
--	.flags		= IRQF_DISABLED,
-+	.flags		= IRQF_DISABLED | IRQF_NO_THREAD,
- 	.name		= "local1 cascade",
- };
++	reset_pending = atomic_read(&watchdog_reset_pending);
++
+ 	list_for_each_entry(cs, &watchdog_list, wd_list) {
  
- static struct irqaction buserr = {
- 	.handler	= no_action,
--	.flags		= IRQF_DISABLED,
-+	.flags		= IRQF_DISABLED | IRQF_NO_THREAD,
- 	.name		= "Bus Error",
- };
+ 		/* Clocksource already marked unstable? */
+@@ -268,7 +271,8 @@ static void clocksource_watchdog(unsigne
+ 		local_irq_enable();
  
- static struct irqaction map0_cascade = {
- 	.handler	= no_action,
--	.flags		= IRQF_DISABLED,
-+	.flags		= IRQF_DISABLED | IRQF_NO_THREAD,
- 	.name		= "mapable0 cascade",
- };
+ 		/* Clocksource initialized ? */
+-		if (!(cs->flags & CLOCK_SOURCE_WATCHDOG)) {
++		if (!(cs->flags & CLOCK_SOURCE_WATCHDOG) ||
++		    atomic_read(&watchdog_reset_pending)) {
+ 			cs->flags |= CLOCK_SOURCE_WATCHDOG;
+ 			cs->wd_last = wdnow;
+ 			cs->cs_last = csnow;
+@@ -283,8 +287,11 @@ static void clocksource_watchdog(unsigne
+ 		cs->cs_last = csnow;
+ 		cs->wd_last = wdnow;
  
- #ifdef USE_LIO3_IRQ
- static struct irqaction map1_cascade = {
- 	.handler	= no_action,
--	.flags		= IRQF_DISABLED,
-+	.flags		= IRQF_DISABLED | IRQF_NO_THREAD,
- 	.name		= "mapable1 cascade",
- };
- #define SGI_INTERRUPTS	SGINT_END
-Index: linux-2.6/arch/mips/sni/rm200.c
-===================================================================
---- linux-2.6.orig/arch/mips/sni/rm200.c
-+++ linux-2.6/arch/mips/sni/rm200.c
-@@ -359,6 +359,7 @@ void sni_rm200_init_8259A(void)
- static struct irqaction sni_rm200_irq2 = {
- 	.handler = no_action,
- 	.name = "cascade",
-+	.flags = IRQF_NO_THREAD,
- };
++		if (atomic_read(&watchdog_reset_pending))
++			continue;
++
+ 		/* Check the deviation from the watchdog clocksource. */
+-		if (abs(cs_nsec - wd_nsec) > WATCHDOG_THRESHOLD) {
++		if ((abs(cs_nsec - wd_nsec) > WATCHDOG_THRESHOLD)) {
+ 			clocksource_unstable(cs, cs_nsec - wd_nsec);
+ 			continue;
+ 		}
+@@ -303,6 +310,13 @@ static void clocksource_watchdog(unsigne
+ 	}
  
- static struct resource sni_rm200_pic1_resource = {
-Index: linux-2.6/arch/mips/vr41xx/common/irq.c
-===================================================================
---- linux-2.6.orig/arch/mips/vr41xx/common/irq.c
-+++ linux-2.6/arch/mips/vr41xx/common/irq.c
-@@ -34,6 +34,7 @@ static irq_cascade_t irq_cascade[NR_IRQS
- static struct irqaction cascade_irqaction = {
- 	.handler	= no_action,
- 	.name		= "cascade",
-+	.flags		= IRQF_NO_THREAD,
- };
- 
- int cascade_irq(unsigned int irq, int (*get_irq)(unsigned int))
-Index: linux-2.6/arch/mips/Kconfig
-===================================================================
---- linux-2.6.orig/arch/mips/Kconfig
-+++ linux-2.6/arch/mips/Kconfig
-@@ -24,6 +24,7 @@ config MIPS
- 	select GENERIC_IRQ_PROBE
- 	select GENERIC_IRQ_SHOW
- 	select HAVE_ARCH_JUMP_LABEL
-+	select IRQ_FORCED_THREADING
- 
- menu "Machine selection"
- 
-@@ -2038,7 +2039,7 @@ config CPU_R4400_WORKAROUNDS
- #
- config HIGHMEM
- 	bool "High Memory Support"
--	depends on 32BIT && CPU_SUPPORTS_HIGHMEM && SYS_SUPPORTS_HIGHMEM
-+	depends on 32BIT && CPU_SUPPORTS_HIGHMEM && SYS_SUPPORTS_HIGHMEM && !PREEMPT_RT_FULL
- 
- config CPU_SUPPORTS_HIGHMEM
- 	bool
-Index: linux-2.6/arch/mips/kernel/traps.c
-===================================================================
---- linux-2.6.orig/arch/mips/kernel/traps.c
-+++ linux-2.6/arch/mips/kernel/traps.c
-@@ -364,7 +364,7 @@ static int regs_to_trapnr(struct pt_regs
- 	return (regs->cp0_cause >> 2) & 0x1f;
- }
- 
--static DEFINE_SPINLOCK(die_lock);
-+static DEFINE_RAW_SPINLOCK(die_lock);
- 
- void __noreturn die(const char *str, struct pt_regs *regs)
- {
-@@ -378,7 +378,7 @@ void __noreturn die(const char *str, str
- 		sig = 0;
- 
- 	console_verbose();
--	spin_lock_irq(&die_lock);
-+	raw_spin_lock_irq(&die_lock);
- 	bust_spinlocks(1);
- #ifdef CONFIG_MIPS_MT_SMTC
- 	mips_mt_regdump(dvpret);
-@@ -387,7 +387,7 @@ void __noreturn die(const char *str, str
- 	printk("%s[#%d]:\n", str, ++die_counter);
- 	show_registers(regs);
- 	add_taint(TAINT_DIE);
--	spin_unlock_irq(&die_lock);
-+	raw_spin_unlock_irq(&die_lock);
- 
- 	if (in_interrupt())
- 		panic("Fatal exception in interrupt");
-Index: linux-2.6/arch/mips/kernel/signal.c
-===================================================================
---- linux-2.6.orig/arch/mips/kernel/signal.c
-+++ linux-2.6/arch/mips/kernel/signal.c
-@@ -603,6 +603,9 @@ static void do_signal(struct pt_regs *re
- 	if (!user_mode(regs))
- 		return;
- 
-+	local_irq_enable();
-+	preempt_check_resched();
-+
- 	if (test_thread_flag(TIF_RESTORE_SIGMASK))
- 		oldset = &current->saved_sigmask;
- 	else
-Index: linux-2.6/arch/arm/kernel/signal.c
-===================================================================
---- linux-2.6.orig/arch/arm/kernel/signal.c
-+++ linux-2.6/arch/arm/kernel/signal.c
-@@ -673,6 +673,9 @@ static void do_signal(struct pt_regs *re
- 	if (!user_mode(regs))
- 		return;
- 
-+	local_irq_enable();
-+	preempt_check_resched();
-+
- 	/*
- 	 * If we were from a system call, check for system call restarting...
- 	 */
-Index: linux-2.6/arch/arm/kernel/smp.c
-===================================================================
---- linux-2.6.orig/arch/arm/kernel/smp.c
-+++ linux-2.6/arch/arm/kernel/smp.c
-@@ -305,6 +305,18 @@ asmlinkage void __cpuinit secondary_star
- 	 * Enable local interrupts.
- 	 */
- 	notify_cpu_starting(cpu);
-+
-+	/*
-+	 * OK, now it's safe to let the boot CPU continue.  Wait for
-+	 * the CPU migration code to notice that the CPU is online
-+	 * before we continue. We need to do that before we enable
-+	 * interrupts otherwise a wakeup of a kernel thread affine to
-+	 * this CPU might break the affinity and let hell break lose.
-+	 */
-+	set_cpu_online(cpu, true);
-+	while (!cpu_active(cpu))
-+		cpu_relax();
-+
- 	local_irq_enable();
- 	local_fiq_enable();
- 
-@@ -318,15 +330,6 @@ asmlinkage void __cpuinit secondary_star
- 	smp_store_cpu_info(cpu);
- 
- 	/*
--	 * OK, now it's safe to let the boot CPU continue.  Wait for
--	 * the CPU migration code to notice that the CPU is online
--	 * before we continue.
--	 */
--	set_cpu_online(cpu, true);
--	while (!cpu_active(cpu))
--		cpu_relax();
--
--	/*
- 	 * OK, it's off to the idle thread for us
- 	 */
- 	cpu_idle();
-@@ -531,7 +534,7 @@ static void percpu_timer_stop(void)
- }
- #endif
- 
--static DEFINE_SPINLOCK(stop_lock);
-+static DEFINE_RAW_SPINLOCK(stop_lock);
- 
- /*
-  * ipi_cpu_stop - handle IPI from smp_send_stop()
-@@ -540,10 +543,10 @@ static void ipi_cpu_stop(unsigned int cp
- {
- 	if (system_state == SYSTEM_BOOTING ||
- 	    system_state == SYSTEM_RUNNING) {
--		spin_lock(&stop_lock);
-+		raw_spin_lock(&stop_lock);
- 		printk(KERN_CRIT "CPU%u: stopping\n", cpu);
- 		dump_stack();
--		spin_unlock(&stop_lock);
-+		raw_spin_unlock(&stop_lock);
- 	}
- 
- 	set_cpu_online(cpu, false);
-Index: linux-2.6/arch/mips/kernel/i8259.c
-===================================================================
---- linux-2.6.orig/arch/mips/kernel/i8259.c
-+++ linux-2.6/arch/mips/kernel/i8259.c
-@@ -295,6 +295,7 @@ static void init_8259A(int auto_eoi)
- static struct irqaction irq2 = {
- 	.handler = no_action,
- 	.name = "cascade",
-+	.flags = IRQF_NO_THREAD,
- };
- 
- static struct resource pic1_io_resource = {
-Index: linux-2.6/kernel/time/clocksource.c
-===================================================================
---- linux-2.6.orig/kernel/time/clocksource.c
-+++ linux-2.6/kernel/time/clocksource.c
-@@ -186,6 +186,7 @@ static struct timer_list watchdog_timer;
- static DECLARE_WORK(watchdog_work, clocksource_watchdog_work);
- static DEFINE_SPINLOCK(watchdog_lock);
- static int watchdog_running;
-+static atomic_t watchdog_reset_pending;
- 
- static int clocksource_watchdog_kthread(void *data);
- static void __clocksource_change_rating(struct clocksource *cs, int rating);
-@@ -247,12 +248,14 @@ static void clocksource_watchdog(unsigne
- 	struct clocksource *cs;
- 	cycle_t csnow, wdnow;
- 	int64_t wd_nsec, cs_nsec;
--	int next_cpu;
-+	int next_cpu, reset_pending;
- 
- 	spin_lock(&watchdog_lock);
- 	if (!watchdog_running)
- 		goto out;
- 
-+	reset_pending = atomic_read(&watchdog_reset_pending);
-+
- 	list_for_each_entry(cs, &watchdog_list, wd_list) {
- 
- 		/* Clocksource already marked unstable? */
-@@ -268,7 +271,8 @@ static void clocksource_watchdog(unsigne
- 		local_irq_enable();
- 
- 		/* Clocksource initialized ? */
--		if (!(cs->flags & CLOCK_SOURCE_WATCHDOG)) {
-+		if (!(cs->flags & CLOCK_SOURCE_WATCHDOG) ||
-+		    atomic_read(&watchdog_reset_pending)) {
- 			cs->flags |= CLOCK_SOURCE_WATCHDOG;
- 			cs->wd_last = wdnow;
- 			cs->cs_last = csnow;
-@@ -283,8 +287,11 @@ static void clocksource_watchdog(unsigne
- 		cs->cs_last = csnow;
- 		cs->wd_last = wdnow;
- 
-+		if (atomic_read(&watchdog_reset_pending))
-+			continue;
-+
- 		/* Check the deviation from the watchdog clocksource. */
--		if (abs(cs_nsec - wd_nsec) > WATCHDOG_THRESHOLD) {
-+		if ((abs(cs_nsec - wd_nsec) > WATCHDOG_THRESHOLD)) {
- 			clocksource_unstable(cs, cs_nsec - wd_nsec);
- 			continue;
- 		}
-@@ -303,6 +310,13 @@ static void clocksource_watchdog(unsigne
- 	}
- 
- 	/*
-+	 * We only clear the watchdog_reset_pending, when we did a
-+	 * full cycle through all clocksources.
-+	 */
-+	if (reset_pending)
-+		atomic_dec(&watchdog_reset_pending);
-+
-+	/*
- 	 * Cycle through CPUs to check if the CPUs stay synchronized
- 	 * to each other.
- 	 */
-@@ -344,23 +358,7 @@ static inline void clocksource_reset_wat
+ 	/*
++	 * We only clear the watchdog_reset_pending, when we did a
++	 * full cycle through all clocksources.
++	 */
++	if (reset_pending)
++		atomic_dec(&watchdog_reset_pending);
++
++	/*
+ 	 * Cycle through CPUs to check if the CPUs stay synchronized
+ 	 * to each other.
+ 	 */
+@@ -344,23 +358,7 @@ static inline void clocksource_reset_wat
  
  static void clocksource_resume_watchdog(void)
  {
@@ -2971,75 +2939,13 @@
  }
  
  static void clocksource_enqueue_watchdog(struct clocksource *cs)
-Index: linux-2.6/kernel/watchdog.c
+Index: linux-2.6/kernel/rtmutex-debug.c
 ===================================================================
---- linux-2.6.orig/kernel/watchdog.c
-+++ linux-2.6/kernel/watchdog.c
-@@ -208,6 +208,8 @@ static struct perf_event_attr wd_hw_attr
- 	.disabled	= 1,
- };
- 
-+static DEFINE_RAW_SPINLOCK(watchdog_output_lock);
-+
- /* Callback function for perf event subsystem */
- static void watchdog_overflow_callback(struct perf_event *event, int nmi,
- 		 struct perf_sample_data *data,
-@@ -234,10 +236,19 @@ static void watchdog_overflow_callback(s
- 		if (__this_cpu_read(hard_watchdog_warn) == true)
- 			return;
+--- linux-2.6.orig/kernel/rtmutex-debug.c
++++ linux-2.6/kernel/rtmutex-debug.c
+@@ -29,61 +29,6 @@
  
--		if (hardlockup_panic)
-+		/*
-+		 * If early-printk is enabled then make sure we do not
-+		 * lock up in printk() and kill console logging:
-+		 */
-+		printk_kill();
-+
-+		if (hardlockup_panic) {
- 			panic("Watchdog detected hard LOCKUP on cpu %d", this_cpu);
--		else
-+		} else {
-+			raw_spin_lock(&watchdog_output_lock);
- 			WARN(1, "Watchdog detected hard LOCKUP on cpu %d", this_cpu);
-+			raw_spin_unlock(&watchdog_output_lock);
-+		}
- 
- 		__this_cpu_write(hard_watchdog_warn, true);
- 		return;
-@@ -320,7 +331,7 @@ static enum hrtimer_restart watchdog_tim
-  */
- static int watchdog(void *unused)
- {
--	static struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 };
-+	struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 };
- 	struct hrtimer *hrtimer = &__raw_get_cpu_var(watchdog_hrtimer);
- 
- 	sched_setscheduler(current, SCHED_FIFO, &param);
-@@ -349,7 +360,8 @@ static int watchdog(void *unused)
- 		set_current_state(TASK_INTERRUPTIBLE);
- 	}
- 	__set_current_state(TASK_RUNNING);
--
-+	param.sched_priority = 0;
-+	sched_setscheduler(current, SCHED_NORMAL, &param);
- 	return 0;
- }
- 
-@@ -422,6 +434,7 @@ static void watchdog_prepare_cpu(int cpu
- 	WARN_ON(per_cpu(softlockup_watchdog, cpu));
- 	hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
- 	hrtimer->function = watchdog_timer_fn;
-+	hrtimer->irqsafe = 1;
- }
- 
- static int watchdog_enable(int cpu)
-Index: linux-2.6/kernel/rtmutex-debug.c
-===================================================================
---- linux-2.6.orig/kernel/rtmutex-debug.c
-+++ linux-2.6/kernel/rtmutex-debug.c
-@@ -29,61 +29,6 @@
- 
- #include "rtmutex_common.h"
+ #include "rtmutex_common.h"
  
 -# define TRACE_WARN_ON(x)			WARN_ON(x)
 -# define TRACE_BUG_ON(x)			BUG_ON(x)
@@ -3175,6235 +3081,6403 @@
  	memset(waiter, 0x22, sizeof(*waiter));
  }
  
-Index: linux-2.6/arch/arm/kernel/perf_event.c
-===================================================================
---- linux-2.6.orig/arch/arm/kernel/perf_event.c
-+++ linux-2.6/arch/arm/kernel/perf_event.c
-@@ -420,7 +420,7 @@ armpmu_reserve_hardware(void)
- 			continue;
- 
- 		err = request_irq(irq, handle_irq,
--				  IRQF_DISABLED | IRQF_NOBALANCING,
-+				  IRQF_DISABLED | IRQF_NOBALANCING | IRQF_NO_THREAD,
- 				  "armpmu", NULL);
- 		if (err) {
- 			pr_warning("unable to request IRQ%d for ARM perf "
-Index: linux-2.6/arch/arm/Kconfig
+Index: linux-2.6/include/linux/kprobes.h
 ===================================================================
---- linux-2.6.orig/arch/arm/Kconfig
-+++ linux-2.6/arch/arm/Kconfig
-@@ -29,6 +29,7 @@ config ARM
- 	select HAVE_GENERIC_HARDIRQS
- 	select HAVE_SPARSE_IRQ
- 	select GENERIC_IRQ_SHOW
-+	select IRQ_FORCED_THREADING
- 	help
- 	  The ARM series is a line of low-power-consumption RISC chip designs
- 	  licensed by ARM Ltd and targeted at embedded applications and
-@@ -1510,7 +1511,7 @@ config HAVE_ARCH_PFN_VALID
+--- linux-2.6.orig/include/linux/kprobes.h
++++ linux-2.6/include/linux/kprobes.h
+@@ -181,7 +181,7 @@ struct kretprobe {
+ 	int nmissed;
+ 	size_t data_size;
+ 	struct hlist_head free_instances;
+-	spinlock_t lock;
++	raw_spinlock_t lock;
+ };
  
- config HIGHMEM
- 	bool "High Memory Support"
--	depends on MMU
-+	depends on MMU && !PREEMPT_RT_FULL
- 	help
- 	  The address space of ARM processors is only 4 Gigabytes large
- 	  and it has to accommodate user address space, kernel address
-Index: linux-2.6/arch/powerpc/platforms/85xx/mpc85xx_cds.c
+ struct kretprobe_instance {
+Index: linux-2.6/kernel/kprobes.c
 ===================================================================
---- linux-2.6.orig/arch/powerpc/platforms/85xx/mpc85xx_cds.c
-+++ linux-2.6/arch/powerpc/platforms/85xx/mpc85xx_cds.c
-@@ -178,7 +178,7 @@ static irqreturn_t mpc85xx_8259_cascade_
+--- linux-2.6.orig/kernel/kprobes.c
++++ linux-2.6/kernel/kprobes.c
+@@ -78,10 +78,10 @@ static bool kprobes_all_disarmed;
+ static DEFINE_MUTEX(kprobe_mutex);
+ static DEFINE_PER_CPU(struct kprobe *, kprobe_instance) = NULL;
+ static struct {
+-	spinlock_t lock ____cacheline_aligned_in_smp;
++	raw_spinlock_t lock ____cacheline_aligned_in_smp;
+ } kretprobe_table_locks[KPROBE_TABLE_SIZE];
  
- static struct irqaction mpc85xxcds_8259_irqaction = {
- 	.handler = mpc85xx_8259_cascade_action,
--	.flags = IRQF_SHARED,
-+	.flags = IRQF_SHARED | IRQF_NO_THREAD,
- 	.name = "8259 cascade",
- };
- #endif /* PPC_I8259 */
-Index: linux-2.6/arch/powerpc/Kconfig
-===================================================================
---- linux-2.6.orig/arch/powerpc/Kconfig
-+++ linux-2.6/arch/powerpc/Kconfig
-@@ -69,10 +69,11 @@ config LOCKDEP_SUPPORT
+-static spinlock_t *kretprobe_table_lock_ptr(unsigned long hash)
++static raw_spinlock_t *kretprobe_table_lock_ptr(unsigned long hash)
+ {
+ 	return &(kretprobe_table_locks[hash].lock);
+ }
+@@ -1013,9 +1013,9 @@ void __kprobes recycle_rp_inst(struct kr
+ 	hlist_del(&ri->hlist);
+ 	INIT_HLIST_NODE(&ri->hlist);
+ 	if (likely(rp)) {
+-		spin_lock(&rp->lock);
++		raw_spin_lock(&rp->lock);
+ 		hlist_add_head(&ri->hlist, &rp->free_instances);
+-		spin_unlock(&rp->lock);
++		raw_spin_unlock(&rp->lock);
+ 	} else
+ 		/* Unregistering */
+ 		hlist_add_head(&ri->hlist, head);
+@@ -1026,19 +1026,19 @@ void __kprobes kretprobe_hash_lock(struc
+ __acquires(hlist_lock)
+ {
+ 	unsigned long hash = hash_ptr(tsk, KPROBE_HASH_BITS);
+-	spinlock_t *hlist_lock;
++	raw_spinlock_t *hlist_lock;
  
- config RWSEM_GENERIC_SPINLOCK
- 	bool
-+	default y if PREEMPT_RT_FULL
+ 	*head = &kretprobe_inst_table[hash];
+ 	hlist_lock = kretprobe_table_lock_ptr(hash);
+-	spin_lock_irqsave(hlist_lock, *flags);
++	raw_spin_lock_irqsave(hlist_lock, *flags);
+ }
  
- config RWSEM_XCHGADD_ALGORITHM
- 	bool
--	default y
-+	default y if !PREEMPT_RT_FULL
+ static void __kprobes kretprobe_table_lock(unsigned long hash,
+ 	unsigned long *flags)
+ __acquires(hlist_lock)
+ {
+-	spinlock_t *hlist_lock = kretprobe_table_lock_ptr(hash);
+-	spin_lock_irqsave(hlist_lock, *flags);
++	raw_spinlock_t *hlist_lock = kretprobe_table_lock_ptr(hash);
++	raw_spin_lock_irqsave(hlist_lock, *flags);
+ }
  
- config GENERIC_LOCKBREAK
- 	bool
-@@ -134,6 +135,7 @@ config PPC
- 	select GENERIC_IRQ_SHOW_LEVEL
- 	select HAVE_RCU_TABLE_FREE if SMP
- 	select HAVE_SYSCALL_TRACEPOINTS
-+	select IRQ_FORCED_THREADING
+ void __kprobes kretprobe_hash_unlock(struct task_struct *tsk,
+@@ -1046,18 +1046,18 @@ void __kprobes kretprobe_hash_unlock(str
+ __releases(hlist_lock)
+ {
+ 	unsigned long hash = hash_ptr(tsk, KPROBE_HASH_BITS);
+-	spinlock_t *hlist_lock;
++	raw_spinlock_t *hlist_lock;
  
- config EARLY_PRINTK
- 	bool
-@@ -271,7 +273,7 @@ menu "Kernel options"
+ 	hlist_lock = kretprobe_table_lock_ptr(hash);
+-	spin_unlock_irqrestore(hlist_lock, *flags);
++	raw_spin_unlock_irqrestore(hlist_lock, *flags);
+ }
  
- config HIGHMEM
- 	bool "High memory support"
--	depends on PPC32
-+	depends on PPC32 && !PREEMPT_RT_FULL
+ static void __kprobes kretprobe_table_unlock(unsigned long hash,
+        unsigned long *flags)
+ __releases(hlist_lock)
+ {
+-	spinlock_t *hlist_lock = kretprobe_table_lock_ptr(hash);
+-	spin_unlock_irqrestore(hlist_lock, *flags);
++	raw_spinlock_t *hlist_lock = kretprobe_table_lock_ptr(hash);
++	raw_spin_unlock_irqrestore(hlist_lock, *flags);
+ }
  
- source kernel/time/Kconfig
- source kernel/Kconfig.hz
-Index: linux-2.6/include/linux/sched.h
-===================================================================
---- linux-2.6.orig/include/linux/sched.h
-+++ linux-2.6/include/linux/sched.h
-@@ -63,6 +63,7 @@ struct sched_param {
- #include <linux/nodemask.h>
- #include <linux/mm_types.h>
+ /*
+@@ -1650,12 +1650,12 @@ static int __kprobes pre_handler_kretpro
  
-+#include <asm/kmap_types.h>
- #include <asm/system.h>
- #include <asm/page.h>
- #include <asm/ptrace.h>
-@@ -90,6 +91,7 @@ struct sched_param {
- #include <linux/task_io_accounting.h>
- #include <linux/latencytop.h>
- #include <linux/cred.h>
-+#include <linux/hardirq.h>
+ 	/*TODO: consider to only swap the RA after the last pre_handler fired */
+ 	hash = hash_ptr(current, KPROBE_HASH_BITS);
+-	spin_lock_irqsave(&rp->lock, flags);
++	raw_spin_lock_irqsave(&rp->lock, flags);
+ 	if (!hlist_empty(&rp->free_instances)) {
+ 		ri = hlist_entry(rp->free_instances.first,
+ 				struct kretprobe_instance, hlist);
+ 		hlist_del(&ri->hlist);
+-		spin_unlock_irqrestore(&rp->lock, flags);
++		raw_spin_unlock_irqrestore(&rp->lock, flags);
  
- #include <asm/processor.h>
+ 		ri->rp = rp;
+ 		ri->task = current;
+@@ -1672,7 +1672,7 @@ static int __kprobes pre_handler_kretpro
+ 		kretprobe_table_unlock(hash, &flags);
+ 	} else {
+ 		rp->nmissed++;
+-		spin_unlock_irqrestore(&rp->lock, flags);
++		raw_spin_unlock_irqrestore(&rp->lock, flags);
+ 	}
+ 	return 0;
+ }
+@@ -1708,7 +1708,7 @@ int __kprobes register_kretprobe(struct 
+ 		rp->maxactive = num_possible_cpus();
+ #endif
+ 	}
+-	spin_lock_init(&rp->lock);
++	raw_spin_lock_init(&rp->lock);
+ 	INIT_HLIST_HEAD(&rp->free_instances);
+ 	for (i = 0; i < rp->maxactive; i++) {
+ 		inst = kmalloc(sizeof(struct kretprobe_instance) +
+@@ -1946,7 +1946,7 @@ static int __init init_kprobes(void)
+ 	for (i = 0; i < KPROBE_TABLE_SIZE; i++) {
+ 		INIT_HLIST_HEAD(&kprobe_table[i]);
+ 		INIT_HLIST_HEAD(&kretprobe_inst_table[i]);
+-		spin_lock_init(&(kretprobe_table_locks[i].lock));
++		raw_spin_lock_init(&(kretprobe_table_locks[i].lock));
+ 	}
  
-@@ -359,6 +361,7 @@ extern signed long schedule_timeout_inte
- extern signed long schedule_timeout_killable(signed long timeout);
- extern signed long schedule_timeout_uninterruptible(signed long timeout);
- asmlinkage void schedule(void);
-+extern void schedule_preempt_disabled(void);
- extern int mutex_spin_on_owner(struct mutex *lock, struct task_struct *owner);
+ 	/*
+Index: linux-2.6/include/linux/percpu_counter.h
+===================================================================
+--- linux-2.6.orig/include/linux/percpu_counter.h
++++ linux-2.6/include/linux/percpu_counter.h
+@@ -16,7 +16,7 @@
+ #ifdef CONFIG_SMP
  
- struct nsproxy;
-@@ -510,7 +513,7 @@ struct task_cputime {
- struct thread_group_cputimer {
- 	struct task_cputime cputime;
- 	int running;
+ struct percpu_counter {
 -	spinlock_t lock;
 +	raw_spinlock_t lock;
- };
+ 	s64 count;
+ #ifdef CONFIG_HOTPLUG_CPU
+ 	struct list_head list;	/* All percpu_counters are on a list */
+Index: linux-2.6/lib/percpu_counter.c
+===================================================================
+--- linux-2.6.orig/lib/percpu_counter.c
++++ linux-2.6/lib/percpu_counter.c
+@@ -59,13 +59,13 @@ void percpu_counter_set(struct percpu_co
+ {
+ 	int cpu;
  
- #include <linux/rwsem.h>
-@@ -1070,6 +1073,7 @@ struct sched_domain;
- #define WF_SYNC		0x01		/* waker goes to sleep after wakup */
- #define WF_FORK		0x02		/* child wakeup after fork */
- #define WF_MIGRATED	0x04		/* internal use, task got migrated */
-+#define WF_LOCK_SLEEPER	0x08		/* wakeup spinlock "sleeper" */
+-	spin_lock(&fbc->lock);
++	raw_spin_lock(&fbc->lock);
+ 	for_each_possible_cpu(cpu) {
+ 		s32 *pcount = per_cpu_ptr(fbc->counters, cpu);
+ 		*pcount = 0;
+ 	}
+ 	fbc->count = amount;
+-	spin_unlock(&fbc->lock);
++	raw_spin_unlock(&fbc->lock);
+ }
+ EXPORT_SYMBOL(percpu_counter_set);
  
- #define ENQUEUE_WAKEUP		1
- #define ENQUEUE_HEAD		2
-@@ -1219,6 +1223,7 @@ enum perf_event_task_context {
+@@ -76,10 +76,10 @@ void __percpu_counter_add(struct percpu_
+ 	preempt_disable();
+ 	count = __this_cpu_read(*fbc->counters) + amount;
+ 	if (count >= batch || count <= -batch) {
+-		spin_lock(&fbc->lock);
++		raw_spin_lock(&fbc->lock);
+ 		fbc->count += count;
+ 		__this_cpu_write(*fbc->counters, 0);
+-		spin_unlock(&fbc->lock);
++		raw_spin_unlock(&fbc->lock);
+ 	} else {
+ 		__this_cpu_write(*fbc->counters, count);
+ 	}
+@@ -96,13 +96,13 @@ s64 __percpu_counter_sum(struct percpu_c
+ 	s64 ret;
+ 	int cpu;
  
- struct task_struct {
- 	volatile long state;	/* -1 unrunnable, 0 runnable, >0 stopped */
-+	volatile long saved_state;	/* saved state for "spinlock sleepers" */
- 	void *stack;
- 	atomic_t usage;
- 	unsigned int flags;	/* per process flags, defined below */
-@@ -1255,14 +1260,17 @@ struct task_struct {
- #endif
+-	spin_lock(&fbc->lock);
++	raw_spin_lock(&fbc->lock);
+ 	ret = fbc->count;
+ 	for_each_online_cpu(cpu) {
+ 		s32 *pcount = per_cpu_ptr(fbc->counters, cpu);
+ 		ret += *pcount;
+ 	}
+-	spin_unlock(&fbc->lock);
++	raw_spin_unlock(&fbc->lock);
+ 	return ret;
+ }
+ EXPORT_SYMBOL(__percpu_counter_sum);
+@@ -110,7 +110,7 @@ EXPORT_SYMBOL(__percpu_counter_sum);
+ int __percpu_counter_init(struct percpu_counter *fbc, s64 amount,
+ 			  struct lock_class_key *key)
+ {
+-	spin_lock_init(&fbc->lock);
++	raw_spin_lock_init(&fbc->lock);
+ 	lockdep_set_class(&fbc->lock, key);
+ 	fbc->count = amount;
+ 	fbc->counters = alloc_percpu(s32);
+@@ -173,11 +173,11 @@ static int __cpuinit percpu_counter_hotc
+ 		s32 *pcount;
+ 		unsigned long flags;
  
- 	unsigned int policy;
-+#ifdef CONFIG_PREEMPT_RT_FULL
-+	int migrate_disable;
-+#ifdef CONFIG_SCHED_DEBUG
-+	int migrate_disable_atomic;
-+#endif
-+#endif
- 	cpumask_t cpus_allowed;
+-		spin_lock_irqsave(&fbc->lock, flags);
++		raw_spin_lock_irqsave(&fbc->lock, flags);
+ 		pcount = per_cpu_ptr(fbc->counters, cpu);
+ 		fbc->count += *pcount;
+ 		*pcount = 0;
+-		spin_unlock_irqrestore(&fbc->lock, flags);
++		raw_spin_unlock_irqrestore(&fbc->lock, flags);
+ 	}
+ 	mutex_unlock(&percpu_counters_lock);
+ #endif
+Index: linux-2.6/kernel/cgroup.c
+===================================================================
+--- linux-2.6.orig/kernel/cgroup.c
++++ linux-2.6/kernel/cgroup.c
+@@ -263,7 +263,7 @@ list_for_each_entry(_root, &roots, root_
+ /* the list of cgroups eligible for automatic release. Protected by
+  * release_list_lock */
+ static LIST_HEAD(release_list);
+-static DEFINE_SPINLOCK(release_list_lock);
++static DEFINE_RAW_SPINLOCK(release_list_lock);
+ static void cgroup_release_agent(struct work_struct *work);
+ static DECLARE_WORK(release_agent_work, cgroup_release_agent);
+ static void check_for_release(struct cgroup *cgrp);
+@@ -4010,11 +4010,11 @@ again:
+ 	finish_wait(&cgroup_rmdir_waitq, &wait);
+ 	clear_bit(CGRP_WAIT_ON_RMDIR, &cgrp->flags);
  
- #ifdef CONFIG_PREEMPT_RCU
- 	int rcu_read_lock_nesting;
- 	char rcu_read_unlock_special;
--#if defined(CONFIG_RCU_BOOST) && defined(CONFIG_TREE_PREEMPT_RCU)
--	int rcu_boosted;
--#endif /* #if defined(CONFIG_RCU_BOOST) && defined(CONFIG_TREE_PREEMPT_RCU) */
- 	struct list_head rcu_node_entry;
- #endif /* #ifdef CONFIG_PREEMPT_RCU */
- #ifdef CONFIG_TREE_PREEMPT_RCU
-@@ -1356,6 +1364,9 @@ struct task_struct {
+-	spin_lock(&release_list_lock);
++	raw_spin_lock(&release_list_lock);
+ 	set_bit(CGRP_REMOVED, &cgrp->flags);
+ 	if (!list_empty(&cgrp->release_list))
+ 		list_del_init(&cgrp->release_list);
+-	spin_unlock(&release_list_lock);
++	raw_spin_unlock(&release_list_lock);
  
- 	struct task_cputime cputime_expires;
- 	struct list_head cpu_timers[3];
-+#ifdef CONFIG_PREEMPT_RT_BASE
-+	struct task_struct *posix_timer_list;
-+#endif
+ 	cgroup_lock_hierarchy(cgrp->root);
+ 	/* delete this cgroup from parent->children */
+@@ -4667,13 +4667,13 @@ static void check_for_release(struct cgr
+ 		 * already queued for a userspace notification, queue
+ 		 * it now */
+ 		int need_schedule_work = 0;
+-		spin_lock(&release_list_lock);
++		raw_spin_lock(&release_list_lock);
+ 		if (!cgroup_is_removed(cgrp) &&
+ 		    list_empty(&cgrp->release_list)) {
+ 			list_add(&cgrp->release_list, &release_list);
+ 			need_schedule_work = 1;
+ 		}
+-		spin_unlock(&release_list_lock);
++		raw_spin_unlock(&release_list_lock);
+ 		if (need_schedule_work)
+ 			schedule_work(&release_agent_work);
+ 	}
+@@ -4725,7 +4725,7 @@ static void cgroup_release_agent(struct 
+ {
+ 	BUG_ON(work != &release_agent_work);
+ 	mutex_lock(&cgroup_mutex);
+-	spin_lock(&release_list_lock);
++	raw_spin_lock(&release_list_lock);
+ 	while (!list_empty(&release_list)) {
+ 		char *argv[3], *envp[3];
+ 		int i;
+@@ -4734,7 +4734,7 @@ static void cgroup_release_agent(struct 
+ 						    struct cgroup,
+ 						    release_list);
+ 		list_del_init(&cgrp->release_list);
+-		spin_unlock(&release_list_lock);
++		raw_spin_unlock(&release_list_lock);
+ 		pathbuf = kmalloc(PAGE_SIZE, GFP_KERNEL);
+ 		if (!pathbuf)
+ 			goto continue_free;
+@@ -4764,9 +4764,9 @@ static void cgroup_release_agent(struct 
+  continue_free:
+ 		kfree(pathbuf);
+ 		kfree(agentbuf);
+-		spin_lock(&release_list_lock);
++		raw_spin_lock(&release_list_lock);
+ 	}
+-	spin_unlock(&release_list_lock);
++	raw_spin_unlock(&release_list_lock);
+ 	mutex_unlock(&cgroup_mutex);
+ }
  
- /* process credentials */
- 	const struct cred __rcu *real_cred; /* objective and real subjective task
-@@ -1389,6 +1400,7 @@ struct task_struct {
- /* signal handlers */
- 	struct signal_struct *signal;
- 	struct sighand_struct *sighand;
-+	struct sigqueue *sigqueue_cache;
+Index: linux-2.6/include/linux/proportions.h
+===================================================================
+--- linux-2.6.orig/include/linux/proportions.h
++++ linux-2.6/include/linux/proportions.h
+@@ -58,7 +58,7 @@ struct prop_local_percpu {
+ 	 */
+ 	int shift;
+ 	unsigned long period;
+-	spinlock_t lock;		/* protect the snapshot state */
++	raw_spinlock_t lock;		/* protect the snapshot state */
+ };
  
- 	sigset_t blocked, real_blocked;
- 	sigset_t saved_sigmask;	/* restored if set_restore_sigmask() was used */
-@@ -1432,6 +1444,9 @@ struct task_struct {
- 	/* mutex deadlock detection */
- 	struct mutex_waiter *blocked_on;
- #endif
-+#ifdef CONFIG_PREEMPT_RT_FULL
-+	int pagefault_disabled;
-+#endif
- #ifdef CONFIG_TRACE_IRQFLAGS
- 	unsigned int irq_events;
- 	unsigned long hardirq_enable_ip;
-@@ -1558,6 +1573,12 @@ struct task_struct {
- 	unsigned long trace;
- 	/* bitmask and counter of trace recursion */
- 	unsigned long trace_recursion;
-+#ifdef CONFIG_WAKEUP_LATENCY_HIST
-+	u64 preempt_timestamp_hist;
-+#ifdef CONFIG_MISSED_TIMER_OFFSETS_HIST
-+	unsigned long timer_offset;
-+#endif
-+#endif
- #endif /* CONFIG_TRACING */
- #ifdef CONFIG_CGROUP_MEM_RES_CTLR /* memcg uses this to do batch job */
- 	struct memcg_batch_info {
-@@ -1570,10 +1591,26 @@ struct task_struct {
- #ifdef CONFIG_HAVE_HW_BREAKPOINT
- 	atomic_t ptrace_bp_refcnt;
- #endif
-+#ifdef CONFIG_PREEMPT_RT_BASE
-+	struct rcu_head put_rcu;
-+	int softirq_nestcnt;
-+#endif
-+#if defined CONFIG_PREEMPT_RT_FULL && defined CONFIG_HIGHMEM
-+	int kmap_idx;
-+	pte_t kmap_pte[KM_TYPE_NR];
-+#endif
+ int prop_local_init_percpu(struct prop_local_percpu *pl);
+@@ -106,11 +106,11 @@ struct prop_local_single {
+ 	 */
+ 	unsigned long period;
+ 	int shift;
+-	spinlock_t lock;		/* protect the snapshot state */
++	raw_spinlock_t lock;		/* protect the snapshot state */
  };
  
--/* Future-safe accessor for struct task_struct's cpus_allowed. */
--#define tsk_cpus_allowed(tsk) (&(tsk)->cpus_allowed)
-+#ifdef CONFIG_PREEMPT_RT_FULL
-+static inline bool cur_pf_disabled(void) { return current->pagefault_disabled; }
-+#else
-+static inline bool cur_pf_disabled(void) { return false; }
-+#endif
-+
-+static inline bool pagefault_disabled(void)
-+{
-+	return in_atomic() || cur_pf_disabled();
-+}
+ #define INIT_PROP_LOCAL_SINGLE(name)			\
+-{	.lock = __SPIN_LOCK_UNLOCKED(name.lock),	\
++{	.lock = __RAW_SPIN_LOCK_UNLOCKED(name.lock),	\
+ }
  
- /*
-  * Priority of a process goes from 0..MAX_PRIO-1, valid RT
-@@ -1743,6 +1780,15 @@ extern struct pid *cad_pid;
- extern void free_task(struct task_struct *tsk);
- #define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0)
+ int prop_local_init_single(struct prop_local_single *pl);
+Index: linux-2.6/lib/proportions.c
+===================================================================
+--- linux-2.6.orig/lib/proportions.c
++++ linux-2.6/lib/proportions.c
+@@ -190,7 +190,7 @@ prop_adjust_shift(int *pl_shift, unsigne
  
-+#ifdef CONFIG_PREEMPT_RT_BASE
-+extern void __put_task_struct_cb(struct rcu_head *rhp);
-+
-+static inline void put_task_struct(struct task_struct *t)
-+{
-+	if (atomic_dec_and_test(&t->usage))
-+		call_rcu(&t->put_rcu, __put_task_struct_cb);
-+}
-+#else
- extern void __put_task_struct(struct task_struct *t);
+ int prop_local_init_percpu(struct prop_local_percpu *pl)
+ {
+-	spin_lock_init(&pl->lock);
++	raw_spin_lock_init(&pl->lock);
+ 	pl->shift = 0;
+ 	pl->period = 0;
+ 	return percpu_counter_init(&pl->events, 0);
+@@ -226,7 +226,7 @@ void prop_norm_percpu(struct prop_global
+ 	if (pl->period == global_period)
+ 		return;
  
- static inline void put_task_struct(struct task_struct *t)
-@@ -1750,6 +1796,7 @@ static inline void put_task_struct(struc
- 	if (atomic_dec_and_test(&t->usage))
- 		__put_task_struct(t);
- }
-+#endif
+-	spin_lock_irqsave(&pl->lock, flags);
++	raw_spin_lock_irqsave(&pl->lock, flags);
+ 	prop_adjust_shift(&pl->shift, &pl->period, pg->shift);
  
- extern void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st);
- extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *st);
-@@ -1774,6 +1821,7 @@ extern void thread_group_times(struct ta
- #define PF_FROZEN	0x00010000	/* frozen for system suspend */
- #define PF_FSTRANS	0x00020000	/* inside a filesystem transaction */
- #define PF_KSWAPD	0x00040000	/* I am kswapd */
-+#define PF_STOMPER	0x00080000	/* I am a stomp machine thread */
- #define PF_LESS_THROTTLE 0x00100000	/* Throttle me less: I clean memory */
- #define PF_KTHREAD	0x00200000	/* I am a kernel thread */
- #define PF_RANDOMIZE	0x00400000	/* randomize virtual address space */
-@@ -2022,15 +2070,27 @@ static inline void sched_autogroup_exit(
- #endif
+ 	/*
+@@ -247,7 +247,7 @@ void prop_norm_percpu(struct prop_global
+ 		percpu_counter_set(&pl->events, 0);
  
- #ifdef CONFIG_RT_MUTEXES
-+extern void task_setprio(struct task_struct *p, int prio);
- extern int rt_mutex_getprio(struct task_struct *p);
--extern void rt_mutex_setprio(struct task_struct *p, int prio);
-+static inline void rt_mutex_setprio(struct task_struct *p, int prio)
-+{
-+	task_setprio(p, prio);
-+}
- extern void rt_mutex_adjust_pi(struct task_struct *p);
-+static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
-+{
-+	return tsk->pi_blocked_on != NULL;
-+}
- #else
- static inline int rt_mutex_getprio(struct task_struct *p)
- {
- 	return p->normal_prio;
+ 	pl->period = global_period;
+-	spin_unlock_irqrestore(&pl->lock, flags);
++	raw_spin_unlock_irqrestore(&pl->lock, flags);
  }
- # define rt_mutex_adjust_pi(p)		do { } while (0)
-+static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
-+{
-+	return false;
-+}
- #endif
- 
- extern bool yield_to(struct task_struct *p, bool preempt);
-@@ -2110,6 +2170,7 @@ extern void xtime_update(unsigned long t
  
- extern int wake_up_state(struct task_struct *tsk, unsigned int state);
- extern int wake_up_process(struct task_struct *tsk);
-+extern int wake_up_lock_sleeper(struct task_struct * tsk);
- extern void wake_up_new_task(struct task_struct *tsk);
- #ifdef CONFIG_SMP
-  extern void kick_process(struct task_struct *tsk);
-@@ -2199,12 +2260,24 @@ extern struct mm_struct * mm_alloc(void)
+ /*
+@@ -324,7 +324,7 @@ void prop_fraction_percpu(struct prop_de
  
- /* mmdrop drops the mm and the page tables */
- extern void __mmdrop(struct mm_struct *);
-+
- static inline void mmdrop(struct mm_struct * mm)
+ int prop_local_init_single(struct prop_local_single *pl)
  {
- 	if (unlikely(atomic_dec_and_test(&mm->mm_count)))
- 		__mmdrop(mm);
- }
+-	spin_lock_init(&pl->lock);
++	raw_spin_lock_init(&pl->lock);
+ 	pl->shift = 0;
+ 	pl->period = 0;
+ 	pl->events = 0;
+@@ -356,7 +356,7 @@ void prop_norm_single(struct prop_global
+ 	if (pl->period == global_period)
+ 		return;
  
-+#ifdef CONFIG_PREEMPT_RT_BASE
-+extern void __mmdrop_delayed(struct rcu_head *rhp);
-+static inline void mmdrop_delayed(struct mm_struct *mm)
-+{
-+	if (atomic_dec_and_test(&mm->mm_count))
-+		call_rcu(&mm->delayed_drop, __mmdrop_delayed);
-+}
-+#else
-+# define mmdrop_delayed(mm)	mmdrop(mm)
-+#endif
-+
- /* mmput gets rid of the mappings and all user-space */
- extern void mmput(struct mm_struct *);
- /* Grab a reference to a task's mm, if it is not already going away */
-@@ -2510,7 +2583,7 @@ extern int _cond_resched(void);
+-	spin_lock_irqsave(&pl->lock, flags);
++	raw_spin_lock_irqsave(&pl->lock, flags);
+ 	prop_adjust_shift(&pl->shift, &pl->period, pg->shift);
+ 	/*
+ 	 * For each missed period, we half the local counter.
+@@ -367,7 +367,7 @@ void prop_norm_single(struct prop_global
+ 	else
+ 		pl->events = 0;
+ 	pl->period = global_period;
+-	spin_unlock_irqrestore(&pl->lock, flags);
++	raw_spin_unlock_irqrestore(&pl->lock, flags);
+ }
  
- extern int __cond_resched_lock(spinlock_t *lock);
+ /*
+Index: linux-2.6/kernel/trace/ring_buffer.c
+===================================================================
+--- linux-2.6.orig/kernel/trace/ring_buffer.c
++++ linux-2.6/kernel/trace/ring_buffer.c
+@@ -478,7 +478,7 @@ struct ring_buffer_per_cpu {
+ 	int				cpu;
+ 	atomic_t			record_disabled;
+ 	struct ring_buffer		*buffer;
+-	spinlock_t			reader_lock;	/* serialize readers */
++	raw_spinlock_t			reader_lock;	/* serialize readers */
+ 	arch_spinlock_t			lock;
+ 	struct lock_class_key		lock_key;
+ 	struct list_head		*pages;
+@@ -1055,7 +1055,7 @@ rb_allocate_cpu_buffer(struct ring_buffe
  
--#ifdef CONFIG_PREEMPT
-+#if defined(CONFIG_PREEMPT) && !defined(CONFIG_PREEMPT_RT_FULL)
- #define PREEMPT_LOCK_OFFSET	PREEMPT_OFFSET
- #else
- #define PREEMPT_LOCK_OFFSET	0
-@@ -2521,12 +2594,16 @@ extern int __cond_resched_lock(spinlock_
- 	__cond_resched_lock(lock);				\
- })
+ 	cpu_buffer->cpu = cpu;
+ 	cpu_buffer->buffer = buffer;
+-	spin_lock_init(&cpu_buffer->reader_lock);
++	raw_spin_lock_init(&cpu_buffer->reader_lock);
+ 	lockdep_set_class(&cpu_buffer->reader_lock, buffer->reader_lock_key);
+ 	cpu_buffer->lock = (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED;
  
-+#ifndef CONFIG_PREEMPT_RT_FULL
- extern int __cond_resched_softirq(void);
+@@ -1252,7 +1252,7 @@ rb_remove_pages(struct ring_buffer_per_c
+ 	struct list_head *p;
+ 	unsigned i;
  
- #define cond_resched_softirq() ({					\
- 	__might_sleep(__FILE__, __LINE__, SOFTIRQ_DISABLE_OFFSET);	\
- 	__cond_resched_softirq();					\
- })
-+#else
-+# define cond_resched_softirq()		cond_resched()
-+#endif
+-	spin_lock_irq(&cpu_buffer->reader_lock);
++	raw_spin_lock_irq(&cpu_buffer->reader_lock);
+ 	rb_head_page_deactivate(cpu_buffer);
  
- /*
-  * Does a critical section need to be broken due to another
-@@ -2550,7 +2627,7 @@ void thread_group_cputimer(struct task_s
+ 	for (i = 0; i < nr_pages; i++) {
+@@ -1270,7 +1270,7 @@ rb_remove_pages(struct ring_buffer_per_c
+ 	rb_check_pages(cpu_buffer);
  
- static inline void thread_group_cputime_init(struct signal_struct *sig)
- {
--	spin_lock_init(&sig->cputimer.lock);
-+	raw_spin_lock_init(&sig->cputimer.lock);
+ out:
+-	spin_unlock_irq(&cpu_buffer->reader_lock);
++	raw_spin_unlock_irq(&cpu_buffer->reader_lock);
  }
  
- /*
-@@ -2589,6 +2666,26 @@ static inline void set_task_cpu(struct t
+ static void
+@@ -1281,7 +1281,7 @@ rb_insert_pages(struct ring_buffer_per_c
+ 	struct list_head *p;
+ 	unsigned i;
  
- #endif /* CONFIG_SMP */
+-	spin_lock_irq(&cpu_buffer->reader_lock);
++	raw_spin_lock_irq(&cpu_buffer->reader_lock);
+ 	rb_head_page_deactivate(cpu_buffer);
  
-+static inline int __migrate_disabled(struct task_struct *p)
-+{
-+#ifdef CONFIG_PREEMPT_RT_FULL
-+	return p->migrate_disable;
-+#else
-+	return 0;
-+#endif
-+}
-+
-+/* Future-safe accessor for struct task_struct's cpus_allowed. */
-+static inline const struct cpumask *tsk_cpus_allowed(struct task_struct *p)
-+{
-+#ifdef CONFIG_PREEMPT_RT_FULL
-+	if (p->migrate_disable)
-+		return cpumask_of(task_cpu(p));
-+#endif
-+
-+	return &p->cpus_allowed;
-+}
-+
- extern long sched_setaffinity(pid_t pid, const struct cpumask *new_mask);
- extern long sched_getaffinity(pid_t pid, struct cpumask *mask);
+ 	for (i = 0; i < nr_pages; i++) {
+@@ -1296,7 +1296,7 @@ rb_insert_pages(struct ring_buffer_per_c
+ 	rb_check_pages(cpu_buffer);
  
-Index: linux-2.6/arch/arm/kernel/process.c
-===================================================================
---- linux-2.6.orig/arch/arm/kernel/process.c
-+++ linux-2.6/arch/arm/kernel/process.c
-@@ -209,9 +209,7 @@ void cpu_idle(void)
- 		}
- 		leds_event(led_idle_end);
- 		tick_nohz_restart_sched_tick();
--		preempt_enable_no_resched();
--		schedule();
--		preempt_disable();
-+		schedule_preempt_disabled();
- 	}
+ out:
+-	spin_unlock_irq(&cpu_buffer->reader_lock);
++	raw_spin_unlock_irq(&cpu_buffer->reader_lock);
  }
  
-Index: linux-2.6/arch/avr32/kernel/process.c
-===================================================================
---- linux-2.6.orig/arch/avr32/kernel/process.c
-+++ linux-2.6/arch/avr32/kernel/process.c
-@@ -38,9 +38,7 @@ void cpu_idle(void)
- 		while (!need_resched())
- 			cpu_idle_sleep();
- 		tick_nohz_restart_sched_tick();
--		preempt_enable_no_resched();
--		schedule();
--		preempt_disable();
-+		schedule_preempt_disabled();
- 	}
- }
+ /**
+@@ -2790,9 +2790,9 @@ void ring_buffer_iter_reset(struct ring_
  
-Index: linux-2.6/arch/blackfin/kernel/process.c
-===================================================================
---- linux-2.6.orig/arch/blackfin/kernel/process.c
-+++ linux-2.6/arch/blackfin/kernel/process.c
-@@ -92,9 +92,7 @@ void cpu_idle(void)
- 		while (!need_resched())
- 			idle();
- 		tick_nohz_restart_sched_tick();
--		preempt_enable_no_resched();
--		schedule();
--		preempt_disable();
-+		schedule_preempt_disabled();
- 	}
- }
+ 	cpu_buffer = iter->cpu_buffer;
  
-Index: linux-2.6/arch/cris/kernel/process.c
-===================================================================
---- linux-2.6.orig/arch/cris/kernel/process.c
-+++ linux-2.6/arch/cris/kernel/process.c
-@@ -115,9 +115,7 @@ void cpu_idle (void)
- 				idle = default_idle;
- 			idle();
- 		}
--		preempt_enable_no_resched();
--		schedule();
--		preempt_disable();
-+		schedule_preempt_disabled();
- 	}
+-	spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
++	raw_spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
+ 	rb_iter_reset(iter);
+-	spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
++	raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
  }
+ EXPORT_SYMBOL_GPL(ring_buffer_iter_reset);
  
-Index: linux-2.6/arch/frv/kernel/process.c
-===================================================================
---- linux-2.6.orig/arch/frv/kernel/process.c
-+++ linux-2.6/arch/frv/kernel/process.c
-@@ -92,9 +92,7 @@ void cpu_idle(void)
- 				idle();
- 		}
+@@ -3251,12 +3251,12 @@ ring_buffer_peek(struct ring_buffer *buf
+  again:
+ 	local_irq_save(flags);
+ 	if (dolock)
+-		spin_lock(&cpu_buffer->reader_lock);
++		raw_spin_lock(&cpu_buffer->reader_lock);
+ 	event = rb_buffer_peek(cpu_buffer, ts, lost_events);
+ 	if (event && event->type_len == RINGBUF_TYPE_PADDING)
+ 		rb_advance_reader(cpu_buffer);
+ 	if (dolock)
+-		spin_unlock(&cpu_buffer->reader_lock);
++		raw_spin_unlock(&cpu_buffer->reader_lock);
+ 	local_irq_restore(flags);
  
--		preempt_enable_no_resched();
--		schedule();
--		preempt_disable();
-+		schedule_preempt_disabled();
- 	}
- }
+ 	if (event && event->type_len == RINGBUF_TYPE_PADDING)
+@@ -3281,9 +3281,9 @@ ring_buffer_iter_peek(struct ring_buffer
+ 	unsigned long flags;
  
-Index: linux-2.6/arch/h8300/kernel/process.c
-===================================================================
---- linux-2.6.orig/arch/h8300/kernel/process.c
-+++ linux-2.6/arch/h8300/kernel/process.c
-@@ -81,9 +81,7 @@ void cpu_idle(void)
- 	while (1) {
- 		while (!need_resched())
- 			idle();
--		preempt_enable_no_resched();
--		schedule();
--		preempt_disable();
-+		schedule_preempt_disabled();
- 	}
- }
+  again:
+-	spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
++	raw_spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
+ 	event = rb_iter_peek(iter, ts);
+-	spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
++	raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
  
-Index: linux-2.6/arch/ia64/kernel/process.c
-===================================================================
---- linux-2.6.orig/arch/ia64/kernel/process.c
-+++ linux-2.6/arch/ia64/kernel/process.c
-@@ -330,9 +330,7 @@ cpu_idle (void)
- 			normal_xtp();
- #endif
- 		}
--		preempt_enable_no_resched();
--		schedule();
--		preempt_disable();
-+		schedule_preempt_disabled();
- 		check_pgt_cache();
- 		if (cpu_is_offline(cpu))
- 			play_dead();
-Index: linux-2.6/arch/m32r/kernel/process.c
-===================================================================
---- linux-2.6.orig/arch/m32r/kernel/process.c
-+++ linux-2.6/arch/m32r/kernel/process.c
-@@ -90,9 +90,7 @@ void cpu_idle (void)
+ 	if (event && event->type_len == RINGBUF_TYPE_PADDING)
+ 		goto again;
+@@ -3323,7 +3323,7 @@ ring_buffer_consume(struct ring_buffer *
+ 	cpu_buffer = buffer->buffers[cpu];
+ 	local_irq_save(flags);
+ 	if (dolock)
+-		spin_lock(&cpu_buffer->reader_lock);
++		raw_spin_lock(&cpu_buffer->reader_lock);
  
- 			idle();
- 		}
--		preempt_enable_no_resched();
--		schedule();
--		preempt_disable();
-+		schedule_preempt_disabled();
+ 	event = rb_buffer_peek(cpu_buffer, ts, lost_events);
+ 	if (event) {
+@@ -3332,7 +3332,7 @@ ring_buffer_consume(struct ring_buffer *
  	}
- }
  
-Index: linux-2.6/arch/m68k/kernel/process_mm.c
-===================================================================
---- linux-2.6.orig/arch/m68k/kernel/process_mm.c
-+++ linux-2.6/arch/m68k/kernel/process_mm.c
-@@ -94,9 +94,7 @@ void cpu_idle(void)
- 	while (1) {
- 		while (!need_resched())
- 			idle();
--		preempt_enable_no_resched();
--		schedule();
--		preempt_disable();
-+		schedule_preempt_disabled();
- 	}
- }
+ 	if (dolock)
+-		spin_unlock(&cpu_buffer->reader_lock);
++		raw_spin_unlock(&cpu_buffer->reader_lock);
+ 	local_irq_restore(flags);
  
-Index: linux-2.6/arch/m68k/kernel/process_no.c
-===================================================================
---- linux-2.6.orig/arch/m68k/kernel/process_no.c
-+++ linux-2.6/arch/m68k/kernel/process_no.c
-@@ -73,9 +73,7 @@ void cpu_idle(void)
- 	/* endless idle loop with no priority at all */
- 	while (1) {
- 		idle();
--		preempt_enable_no_resched();
--		schedule();
--		preempt_disable();
-+		schedule_preempt_disabled();
- 	}
- }
+  out:
+@@ -3424,11 +3424,11 @@ ring_buffer_read_start(struct ring_buffe
  
-Index: linux-2.6/arch/microblaze/kernel/process.c
-===================================================================
---- linux-2.6.orig/arch/microblaze/kernel/process.c
-+++ linux-2.6/arch/microblaze/kernel/process.c
-@@ -108,9 +108,7 @@ void cpu_idle(void)
- 			idle();
- 		tick_nohz_restart_sched_tick();
+ 	cpu_buffer = iter->cpu_buffer;
  
--		preempt_enable_no_resched();
--		schedule();
--		preempt_disable();
-+		schedule_preempt_disabled();
- 		check_pgt_cache();
- 	}
+-	spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
++	raw_spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
+ 	arch_spin_lock(&cpu_buffer->lock);
+ 	rb_iter_reset(iter);
+ 	arch_spin_unlock(&cpu_buffer->lock);
+-	spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
++	raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
  }
-Index: linux-2.6/arch/mips/kernel/process.c
-===================================================================
---- linux-2.6.orig/arch/mips/kernel/process.c
-+++ linux-2.6/arch/mips/kernel/process.c
-@@ -78,9 +78,7 @@ void __noreturn cpu_idle(void)
- 			play_dead();
- #endif
- 		tick_nohz_restart_sched_tick();
--		preempt_enable_no_resched();
--		schedule();
--		preempt_disable();
-+		schedule_preempt_disabled();
- 	}
+ EXPORT_SYMBOL_GPL(ring_buffer_read_start);
+ 
+@@ -3463,7 +3463,7 @@ ring_buffer_read(struct ring_buffer_iter
+ 	struct ring_buffer_per_cpu *cpu_buffer = iter->cpu_buffer;
+ 	unsigned long flags;
+ 
+-	spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
++	raw_spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
+  again:
+ 	event = rb_iter_peek(iter, ts);
+ 	if (!event)
+@@ -3474,7 +3474,7 @@ ring_buffer_read(struct ring_buffer_iter
+ 
+ 	rb_advance_iter(iter);
+  out:
+-	spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
++	raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
+ 
+ 	return event;
  }
+@@ -3543,7 +3543,7 @@ void ring_buffer_reset_cpu(struct ring_b
  
-Index: linux-2.6/arch/mn10300/kernel/process.c
-===================================================================
---- linux-2.6.orig/arch/mn10300/kernel/process.c
-+++ linux-2.6/arch/mn10300/kernel/process.c
-@@ -123,9 +123,7 @@ void cpu_idle(void)
- 			idle();
- 		}
+ 	atomic_inc(&cpu_buffer->record_disabled);
  
--		preempt_enable_no_resched();
--		schedule();
--		preempt_disable();
-+		schedule_preempt_disabled();
- 	}
+-	spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
++	raw_spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
+ 
+ 	if (RB_WARN_ON(cpu_buffer, local_read(&cpu_buffer->committing)))
+ 		goto out;
+@@ -3555,7 +3555,7 @@ void ring_buffer_reset_cpu(struct ring_b
+ 	arch_spin_unlock(&cpu_buffer->lock);
+ 
+  out:
+-	spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
++	raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
+ 
+ 	atomic_dec(&cpu_buffer->record_disabled);
  }
+@@ -3593,10 +3593,10 @@ int ring_buffer_empty(struct ring_buffer
+ 		cpu_buffer = buffer->buffers[cpu];
+ 		local_irq_save(flags);
+ 		if (dolock)
+-			spin_lock(&cpu_buffer->reader_lock);
++			raw_spin_lock(&cpu_buffer->reader_lock);
+ 		ret = rb_per_cpu_empty(cpu_buffer);
+ 		if (dolock)
+-			spin_unlock(&cpu_buffer->reader_lock);
++			raw_spin_unlock(&cpu_buffer->reader_lock);
+ 		local_irq_restore(flags);
  
-Index: linux-2.6/arch/parisc/kernel/process.c
-===================================================================
---- linux-2.6.orig/arch/parisc/kernel/process.c
-+++ linux-2.6/arch/parisc/kernel/process.c
-@@ -71,9 +71,7 @@ void cpu_idle(void)
- 	while (1) {
- 		while (!need_resched())
- 			barrier();
--		preempt_enable_no_resched();
--		schedule();
--		preempt_disable();
-+		schedule_preempt_disabled();
- 		check_pgt_cache();
- 	}
- }
-Index: linux-2.6/arch/powerpc/kernel/idle.c
-===================================================================
---- linux-2.6.orig/arch/powerpc/kernel/idle.c
-+++ linux-2.6/arch/powerpc/kernel/idle.c
-@@ -94,11 +94,11 @@ void cpu_idle(void)
- 		HMT_medium();
- 		ppc64_runlatch_on();
- 		tick_nohz_restart_sched_tick();
--		preempt_enable_no_resched();
--		if (cpu_should_die())
-+		if (cpu_should_die()) {
-+			__preempt_enable_no_resched();
- 			cpu_die();
--		schedule();
--		preempt_disable();
-+		}
-+		schedule_preempt_disabled();
- 	}
- }
+ 		if (!ret)
+@@ -3627,10 +3627,10 @@ int ring_buffer_empty_cpu(struct ring_bu
+ 	cpu_buffer = buffer->buffers[cpu];
+ 	local_irq_save(flags);
+ 	if (dolock)
+-		spin_lock(&cpu_buffer->reader_lock);
++		raw_spin_lock(&cpu_buffer->reader_lock);
+ 	ret = rb_per_cpu_empty(cpu_buffer);
+ 	if (dolock)
+-		spin_unlock(&cpu_buffer->reader_lock);
++		raw_spin_unlock(&cpu_buffer->reader_lock);
+ 	local_irq_restore(flags);
  
-Index: linux-2.6/arch/powerpc/platforms/iseries/setup.c
+ 	return ret;
+@@ -3826,7 +3826,7 @@ int ring_buffer_read_page(struct ring_bu
+ 	if (!bpage)
+ 		goto out;
+ 
+-	spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
++	raw_spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
+ 
+ 	reader = rb_get_reader_page(cpu_buffer);
+ 	if (!reader)
+@@ -3949,7 +3949,7 @@ int ring_buffer_read_page(struct ring_bu
+ 		memset(&bpage->data[commit], 0, BUF_PAGE_SIZE - commit);
+ 
+  out_unlock:
+-	spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
++	raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
+ 
+  out:
+ 	return ret;
+Index: linux-2.6/kernel/trace/trace.c
 ===================================================================
---- linux-2.6.orig/arch/powerpc/platforms/iseries/setup.c
-+++ linux-2.6/arch/powerpc/platforms/iseries/setup.c
-@@ -581,9 +581,7 @@ static void iseries_shared_idle(void)
- 		if (hvlpevent_is_pending())
- 			process_iSeries_events();
+--- linux-2.6.orig/kernel/trace/trace.c
++++ linux-2.6/kernel/trace/trace.c
+@@ -341,7 +341,7 @@ unsigned long trace_flags = TRACE_ITER_P
+ 	TRACE_ITER_GRAPH_TIME | TRACE_ITER_RECORD_CMD | TRACE_ITER_OVERWRITE;
  
--		preempt_enable_no_resched();
--		schedule();
--		preempt_disable();
-+		schedule_preempt_disabled();
- 	}
- }
+ static int trace_stop_count;
+-static DEFINE_SPINLOCK(tracing_start_lock);
++static DEFINE_RAW_SPINLOCK(tracing_start_lock);
  
-@@ -610,9 +608,7 @@ static void iseries_dedicated_idle(void)
+ /**
+  * trace_wake_up - wake up tasks waiting for trace input
+@@ -351,6 +351,7 @@ static DEFINE_SPINLOCK(tracing_start_loc
+  */
+ void trace_wake_up(void)
+ {
++#ifndef CONFIG_PREEMPT_RT_FULL
+ 	int cpu;
  
- 		ppc64_runlatch_on();
- 		tick_nohz_restart_sched_tick();
--		preempt_enable_no_resched();
--		schedule();
--		preempt_disable();
-+		schedule_preempt_disabled();
- 	}
+ 	if (trace_flags & TRACE_ITER_BLOCK)
+@@ -363,6 +364,7 @@ void trace_wake_up(void)
+ 	if (!runqueue_is_locked(cpu))
+ 		wake_up(&trace_wait);
+ 	put_cpu();
++#endif
  }
  
-Index: linux-2.6/arch/s390/kernel/process.c
-===================================================================
---- linux-2.6.orig/arch/s390/kernel/process.c
-+++ linux-2.6/arch/s390/kernel/process.c
-@@ -94,9 +94,7 @@ void cpu_idle(void)
- 		while (!need_resched())
- 			default_idle();
- 		tick_nohz_restart_sched_tick();
--		preempt_enable_no_resched();
--		schedule();
--		preempt_disable();
-+		schedule_preempt_disabled();
- 	}
+ static int __init set_buf_size(char *str)
+@@ -716,6 +718,12 @@ update_max_tr_single(struct trace_array 
  }
+ #endif /* CONFIG_TRACER_MAX_TRACE */
  
-Index: linux-2.6/arch/score/kernel/process.c
-===================================================================
---- linux-2.6.orig/arch/score/kernel/process.c
-+++ linux-2.6/arch/score/kernel/process.c
-@@ -53,9 +53,7 @@ void __noreturn cpu_idle(void)
- 		while (!need_resched())
- 			barrier();
++#ifndef CONFIG_PREEMPT_RT_FULL
++static void default_wait_pipe(struct trace_iterator *iter);
++#else
++#define default_wait_pipe	poll_wait_pipe
++#endif
++
+ /**
+  * register_tracer - register a tracer with the ftrace system.
+  * @type - the plugin for the tracer
+@@ -958,7 +966,7 @@ void tracing_start(void)
+ 	if (tracing_disabled)
+ 		return;
  
--		preempt_enable_no_resched();
--		schedule();
--		preempt_disable();
-+		schedule_preempt_disabled();
- 	}
+-	spin_lock_irqsave(&tracing_start_lock, flags);
++	raw_spin_lock_irqsave(&tracing_start_lock, flags);
+ 	if (--trace_stop_count) {
+ 		if (trace_stop_count < 0) {
+ 			/* Someone screwed up their debugging */
+@@ -983,7 +991,7 @@ void tracing_start(void)
+ 
+ 	ftrace_start();
+  out:
+-	spin_unlock_irqrestore(&tracing_start_lock, flags);
++	raw_spin_unlock_irqrestore(&tracing_start_lock, flags);
  }
  
-Index: linux-2.6/arch/sh/kernel/idle.c
-===================================================================
---- linux-2.6.orig/arch/sh/kernel/idle.c
-+++ linux-2.6/arch/sh/kernel/idle.c
-@@ -110,9 +110,7 @@ void cpu_idle(void)
- 		}
+ /**
+@@ -998,7 +1006,7 @@ void tracing_stop(void)
+ 	unsigned long flags;
  
- 		tick_nohz_restart_sched_tick();
--		preempt_enable_no_resched();
--		schedule();
--		preempt_disable();
-+		schedule_preempt_disabled();
- 	}
+ 	ftrace_stop();
+-	spin_lock_irqsave(&tracing_start_lock, flags);
++	raw_spin_lock_irqsave(&tracing_start_lock, flags);
+ 	if (trace_stop_count++)
+ 		goto out;
+ 
+@@ -1016,7 +1024,7 @@ void tracing_stop(void)
+ 	arch_spin_unlock(&ftrace_max_lock);
+ 
+  out:
+-	spin_unlock_irqrestore(&tracing_start_lock, flags);
++	raw_spin_unlock_irqrestore(&tracing_start_lock, flags);
  }
  
-Index: linux-2.6/arch/sparc/kernel/process_32.c
-===================================================================
---- linux-2.6.orig/arch/sparc/kernel/process_32.c
-+++ linux-2.6/arch/sparc/kernel/process_32.c
-@@ -113,9 +113,7 @@ void cpu_idle(void)
- 			while (!need_resched())
- 				cpu_relax();
- 		}
--		preempt_enable_no_resched();
--		schedule();
--		preempt_disable();
-+		schedule_preempt_disabled();
- 		check_pgt_cache();
- 	}
+ void trace_stop_cmdline_recording(void);
+@@ -1120,6 +1128,8 @@ tracing_generic_entry_update(struct trac
+ 		((pc & HARDIRQ_MASK) ? TRACE_FLAG_HARDIRQ : 0) |
+ 		((pc & SOFTIRQ_MASK) ? TRACE_FLAG_SOFTIRQ : 0) |
+ 		(need_resched() ? TRACE_FLAG_NEED_RESCHED : 0);
++
++	entry->migrate_disable	= (tsk) ? __migrate_disabled(tsk) & 0xFF : 0;
  }
-@@ -138,9 +136,7 @@ void cpu_idle(void)
- 			while (!need_resched())
- 				cpu_relax();
- 		}
--		preempt_enable_no_resched();
--		schedule();
--		preempt_disable();
-+		schedule_preempt_disabled();
- 		check_pgt_cache();
- 	}
+ EXPORT_SYMBOL_GPL(tracing_generic_entry_update);
+ 
+@@ -1757,9 +1767,10 @@ static void print_lat_help_header(struct
+ 	seq_puts(m, "#                | / _----=> need-resched    \n");
+ 	seq_puts(m, "#                || / _---=> hardirq/softirq \n");
+ 	seq_puts(m, "#                ||| / _--=> preempt-depth   \n");
+-	seq_puts(m, "#                |||| /     delay             \n");
+-	seq_puts(m, "#  cmd     pid   ||||| time  |   caller      \n");
+-	seq_puts(m, "#     \\   /      |||||  \\    |   /           \n");
++	seq_puts(m, "#                |||| / _--=> migrate-disable\n");
++	seq_puts(m, "#                ||||| /     delay           \n");
++	seq_puts(m, "#  cmd     pid   |||||| time  |   caller     \n");
++	seq_puts(m, "#     \\   /      |||||  \\   |   /          \n");
  }
-Index: linux-2.6/arch/sparc/kernel/process_64.c
-===================================================================
---- linux-2.6.orig/arch/sparc/kernel/process_64.c
-+++ linux-2.6/arch/sparc/kernel/process_64.c
-@@ -102,15 +102,13 @@ void cpu_idle(void)
  
- 		tick_nohz_restart_sched_tick();
+ static void print_func_help_header(struct seq_file *m)
+@@ -3067,6 +3078,7 @@ static int tracing_release_pipe(struct i
+ 	return 0;
+ }
  
--		preempt_enable_no_resched();
--
- #ifdef CONFIG_HOTPLUG_CPU
--		if (cpu_is_offline(cpu))
-+		if (cpu_is_offline(cpu)) {
-+			__preempt_enable_no_resched();
- 			cpu_play_dead();
-+		}
- #endif
--
--		schedule();
--		preempt_disable();
-+		schedule_preempt_disabled();
++#ifndef CONFIG_PREEMPT_RT_FULL
+ static unsigned int
+ tracing_poll_pipe(struct file *filp, poll_table *poll_table)
+ {
+@@ -3088,8 +3100,7 @@ tracing_poll_pipe(struct file *filp, pol
  	}
  }
  
-Index: linux-2.6/arch/tile/kernel/process.c
-===================================================================
---- linux-2.6.orig/arch/tile/kernel/process.c
-+++ linux-2.6/arch/tile/kernel/process.c
-@@ -106,9 +106,7 @@ void cpu_idle(void)
- 			current_thread_info()->status |= TS_POLLING;
- 		}
- 		tick_nohz_restart_sched_tick();
--		preempt_enable_no_resched();
--		schedule();
--		preempt_disable();
-+		schedule_preempt_disabled();
- 	}
- }
+-
+-void default_wait_pipe(struct trace_iterator *iter)
++static void default_wait_pipe(struct trace_iterator *iter)
+ {
+ 	DEFINE_WAIT(wait);
  
-Index: linux-2.6/arch/x86/kernel/process_32.c
-===================================================================
---- linux-2.6.orig/arch/x86/kernel/process_32.c
-+++ linux-2.6/arch/x86/kernel/process_32.c
-@@ -38,6 +38,7 @@
- #include <linux/uaccess.h>
- #include <linux/io.h>
- #include <linux/kdebug.h>
-+#include <linux/highmem.h>
+@@ -3100,6 +3111,20 @@ void default_wait_pipe(struct trace_iter
  
- #include <asm/pgtable.h>
- #include <asm/system.h>
-@@ -113,9 +114,7 @@ void cpu_idle(void)
- 			start_critical_timings();
- 		}
- 		tick_nohz_restart_sched_tick();
--		preempt_enable_no_resched();
--		schedule();
--		preempt_disable();
-+		schedule_preempt_disabled();
- 	}
+ 	finish_wait(&trace_wait, &wait);
  }
- 
-@@ -348,6 +347,41 @@ __switch_to(struct task_struct *prev_p, 
- 		     task_thread_info(next_p)->flags & _TIF_WORK_CTXSW_NEXT))
- 		__switch_to_xtra(prev_p, next_p, tss);
- 
-+#if defined CONFIG_PREEMPT_RT_FULL && defined CONFIG_HIGHMEM
-+	/*
-+	 * Save @prev's kmap_atomic stack
-+	 */
-+	prev_p->kmap_idx = __this_cpu_read(__kmap_atomic_idx);
-+	if (unlikely(prev_p->kmap_idx)) {
-+		int i;
-+
-+		for (i = 0; i < prev_p->kmap_idx; i++) {
-+			int idx = i + KM_TYPE_NR * smp_processor_id();
-+
-+			pte_t *ptep = kmap_pte - idx;
-+			prev_p->kmap_pte[i] = *ptep;
-+			kpte_clear_flush(ptep, __fix_to_virt(FIX_KMAP_BEGIN + idx));
-+		}
-+
-+		__this_cpu_write(__kmap_atomic_idx, 0);
-+	}
-+
-+	/*
-+	 * Restore @next_p's kmap_atomic stack
-+	 */
-+	if (unlikely(next_p->kmap_idx)) {
-+		int i;
-+
-+		__this_cpu_write(__kmap_atomic_idx, next_p->kmap_idx);
-+
-+		for (i = 0; i < next_p->kmap_idx; i++) {
-+			int idx = i + KM_TYPE_NR * smp_processor_id();
++#else
++static unsigned int
++tracing_poll_pipe(struct file *filp, poll_table *poll_table)
++{
++	struct trace_iterator *iter = filp->private_data;
 +
-+			set_pte(kmap_pte - idx, next_p->kmap_pte[i]);
-+		}
-+	}
++	if ((trace_flags & TRACE_ITER_BLOCK) || !trace_empty(iter))
++		return POLLIN | POLLRDNORM;
++	poll_wait_pipe(iter);
++	if (!trace_empty(iter))
++		return POLLIN | POLLRDNORM;
++	return 0;
++}
 +#endif
-+
- 	/* If we're going to preload the fpu context, make sure clts
- 	   is run while we're batching the cpu state updates. */
- 	if (preload_fpu)
-Index: linux-2.6/arch/x86/kernel/process_64.c
+ 
+ /*
+  * This is a make-shift waitqueue.
+Index: linux-2.6/kernel/trace/trace_irqsoff.c
 ===================================================================
---- linux-2.6.orig/arch/x86/kernel/process_64.c
-+++ linux-2.6/arch/x86/kernel/process_64.c
-@@ -146,9 +146,7 @@ void cpu_idle(void)
- 		}
+--- linux-2.6.orig/kernel/trace/trace_irqsoff.c
++++ linux-2.6/kernel/trace/trace_irqsoff.c
+@@ -17,13 +17,14 @@
+ #include <linux/fs.h>
  
- 		tick_nohz_restart_sched_tick();
--		preempt_enable_no_resched();
--		schedule();
--		preempt_disable();
-+		schedule_preempt_disabled();
- 	}
- }
+ #include "trace.h"
++#include <trace/events/hist.h>
  
-Index: linux-2.6/arch/xtensa/kernel/process.c
-===================================================================
---- linux-2.6.orig/arch/xtensa/kernel/process.c
-+++ linux-2.6/arch/xtensa/kernel/process.c
-@@ -113,9 +113,7 @@ void cpu_idle(void)
- 	while (1) {
- 		while (!need_resched())
- 			platform_idle();
--		preempt_enable_no_resched();
--		schedule();
--		preempt_disable();
-+		schedule_preempt_disabled();
- 	}
- }
+ static struct trace_array		*irqsoff_trace __read_mostly;
+ static int				tracer_enabled __read_mostly;
  
-Index: linux-2.6/init/main.c
-===================================================================
---- linux-2.6.orig/init/main.c
-+++ linux-2.6/init/main.c
-@@ -68,6 +68,7 @@
- #include <linux/shmem_fs.h>
- #include <linux/slab.h>
- #include <linux/perf_event.h>
-+#include <linux/posix-timers.h>
+ static DEFINE_PER_CPU(int, tracing_cpu);
  
- #include <asm/io.h>
- #include <asm/bugs.h>
-@@ -367,9 +368,7 @@ static noinline void __init_refok rest_i
- 	 * at least once to get things moving:
- 	 */
- 	init_idle_bootup_task(current);
--	preempt_enable_no_resched();
--	schedule();
--	preempt_disable();
-+	schedule_preempt_disabled();
+-static DEFINE_SPINLOCK(max_trace_lock);
++static DEFINE_RAW_SPINLOCK(max_trace_lock);
  
- 	/* Call into cpu_idle with preempt disabled */
- 	cpu_idle();
-@@ -501,6 +500,7 @@ asmlinkage void __init start_kernel(void
- 	parse_args("Booting kernel", static_command_line, __start___param,
- 		   __stop___param - __start___param,
- 		   &unknown_bootoption);
-+	softirq_early_init();
- 	/*
- 	 * These use large bootmem allocations and must precede
- 	 * kmem_cache_init()
-Index: linux-2.6/kernel/mutex.c
-===================================================================
---- linux-2.6.orig/kernel/mutex.c
-+++ linux-2.6/kernel/mutex.c
-@@ -240,9 +240,7 @@ __mutex_lock_common(struct mutex *lock, 
+ enum {
+ 	TRACER_IRQS_OFF		= (1 << 1),
+@@ -319,7 +320,7 @@ check_critical_timing(struct trace_array
+ 	if (!report_latency(delta))
+ 		goto out;
  
- 		/* didn't get the lock, go to sleep: */
- 		spin_unlock_mutex(&lock->wait_lock, flags);
--		preempt_enable_no_resched();
--		schedule();
--		preempt_disable();
-+		schedule_preempt_disabled();
- 		spin_lock_mutex(&lock->wait_lock, flags);
- 	}
+-	spin_lock_irqsave(&max_trace_lock, flags);
++	raw_spin_lock_irqsave(&max_trace_lock, flags);
  
-Index: linux-2.6/kernel/softirq.c
-===================================================================
---- linux-2.6.orig/kernel/softirq.c
-+++ linux-2.6/kernel/softirq.c
-@@ -24,6 +24,7 @@
- #include <linux/ftrace.h>
- #include <linux/smp.h>
- #include <linux/tick.h>
-+#include <linux/locallock.h>
+ 	/* check if we are still the max latency */
+ 	if (!report_latency(delta))
+@@ -342,7 +343,7 @@ check_critical_timing(struct trace_array
+ 	max_sequence++;
  
- #define CREATE_TRACE_POINTS
- #include <trace/events/irq.h>
-@@ -61,6 +62,67 @@ char *softirq_to_name[NR_SOFTIRQS] = {
- 	"TASKLET", "SCHED", "HRTIMER", "RCU"
- };
+ out_unlock:
+-	spin_unlock_irqrestore(&max_trace_lock, flags);
++	raw_spin_unlock_irqrestore(&max_trace_lock, flags);
  
-+#ifdef CONFIG_NO_HZ
-+# ifdef CONFIG_PREEMPT_RT_FULL
-+/*
-+ * On preempt-rt a softirq might be blocked on a lock. There might be
-+ * no other runnable task on this CPU because the lock owner runs on
-+ * some other CPU. So we have to go into idle with the pending bit
-+ * set. Therefor we need to check this otherwise we warn about false
-+ * positives which confuses users and defeats the whole purpose of
-+ * this test.
-+ *
-+ * This code is called with interrupts disabled.
-+ */
-+void softirq_check_pending_idle(void)
-+{
-+	static int rate_limit;
-+	u32 warnpending = 0, pending = local_softirq_pending();
-+
-+	if (rate_limit >= 10)
-+		return;
-+
-+	if (pending) {
-+		struct task_struct *tsk;
-+
-+		tsk = __get_cpu_var(ksoftirqd);
-+		/*
-+		 * The wakeup code in rtmutex.c wakes up the task
-+		 * _before_ it sets pi_blocked_on to NULL under
-+		 * tsk->pi_lock. So we need to check for both: state
-+		 * and pi_blocked_on.
-+		 */
-+		raw_spin_lock(&tsk->pi_lock);
-+
-+		if (!tsk->pi_blocked_on && !(tsk->state == TASK_RUNNING))
-+			warnpending = 1;
-+
-+		raw_spin_unlock(&tsk->pi_lock);
-+	}
-+
-+	if (warnpending) {
-+		printk(KERN_ERR "NOHZ: local_softirq_pending %02x\n",
-+		       pending);
-+		rate_limit++;
-+	}
-+}
-+# else
-+/*
-+ * On !PREEMPT_RT we just printk rate limited:
-+ */
-+void softirq_check_pending_idle(void)
-+{
-+	static int rate_limit;
-+
-+	if (rate_limit < 10) {
-+		printk(KERN_ERR "NOHZ: local_softirq_pending %02x\n",
-+		       local_softirq_pending());
-+		rate_limit++;
-+	}
-+}
-+# endif
-+#endif
-+
- /*
-  * we cannot loop indefinitely here to avoid userspace starvation,
-  * but we also don't want to introduce a worst case 1/HZ latency
-@@ -76,6 +138,35 @@ static void wakeup_softirqd(void)
- 		wake_up_process(tsk);
+ out:
+ 	data->critical_sequence = max_sequence;
+@@ -424,11 +425,13 @@ void start_critical_timings(void)
+ {
+ 	if (preempt_trace() || irq_trace())
+ 		start_critical_timing(CALLER_ADDR0, CALLER_ADDR1);
++	trace_preemptirqsoff_hist(TRACE_START, 1);
  }
+ EXPORT_SYMBOL_GPL(start_critical_timings);
  
-+static void handle_pending_softirqs(u32 pending, int cpu)
-+{
-+	struct softirq_action *h = softirq_vec;
-+	unsigned int prev_count = preempt_count();
-+
-+	local_irq_enable();
-+	for ( ; pending; h++, pending >>= 1) {
-+		unsigned int vec_nr = h - softirq_vec;
-+
-+		if (!(pending & 1))
-+			continue;
-+
-+		kstat_incr_softirqs_this_cpu(vec_nr);
-+		trace_softirq_entry(vec_nr);
-+		h->action(h);
-+		trace_softirq_exit(vec_nr);
-+		if (unlikely(prev_count != preempt_count())) {
-+			printk(KERN_ERR
-+ "huh, entered softirq %u %s %p with preempt_count %08x exited with %08x?\n",
-+			       vec_nr, softirq_to_name[vec_nr], h->action,
-+			       prev_count, (unsigned int) preempt_count());
-+			preempt_count() = prev_count;
-+		}
-+		rcu_bh_qs(cpu);
-+	}
-+	local_irq_disable();
-+}
-+
-+#ifndef CONFIG_PREEMPT_RT_FULL
- /*
-  * preempt_count and SOFTIRQ_OFFSET usage:
-  * - preempt_count is changed by SOFTIRQ_OFFSET on entering or leaving
-@@ -206,7 +297,6 @@ EXPORT_SYMBOL(local_bh_enable_ip);
- 
- asmlinkage void __do_softirq(void)
+ void stop_critical_timings(void)
  {
--	struct softirq_action *h;
- 	__u32 pending;
- 	int max_restart = MAX_SOFTIRQ_RESTART;
- 	int cpu;
-@@ -215,7 +305,7 @@ asmlinkage void __do_softirq(void)
- 	account_system_vtime(current);
++	trace_preemptirqsoff_hist(TRACE_STOP, 0);
+ 	if (preempt_trace() || irq_trace())
+ 		stop_critical_timing(CALLER_ADDR0, CALLER_ADDR1);
+ }
+@@ -438,6 +441,7 @@ EXPORT_SYMBOL_GPL(stop_critical_timings)
+ #ifdef CONFIG_PROVE_LOCKING
+ void time_hardirqs_on(unsigned long a0, unsigned long a1)
+ {
++	trace_preemptirqsoff_hist(IRQS_ON, 0);
+ 	if (!preempt_trace() && irq_trace())
+ 		stop_critical_timing(a0, a1);
+ }
+@@ -446,6 +450,7 @@ void time_hardirqs_off(unsigned long a0,
+ {
+ 	if (!preempt_trace() && irq_trace())
+ 		start_critical_timing(a0, a1);
++	trace_preemptirqsoff_hist(IRQS_OFF, 1);
+ }
  
- 	__local_bh_disable((unsigned long)__builtin_return_address(0),
--				SOFTIRQ_OFFSET);
-+			   SOFTIRQ_OFFSET);
- 	lockdep_softirq_enter();
+ #else /* !CONFIG_PROVE_LOCKING */
+@@ -471,6 +476,7 @@ inline void print_irqtrace_events(struct
+  */
+ void trace_hardirqs_on(void)
+ {
++	trace_preemptirqsoff_hist(IRQS_ON, 0);
+ 	if (!preempt_trace() && irq_trace())
+ 		stop_critical_timing(CALLER_ADDR0, CALLER_ADDR1);
+ }
+@@ -480,11 +486,13 @@ void trace_hardirqs_off(void)
+ {
+ 	if (!preempt_trace() && irq_trace())
+ 		start_critical_timing(CALLER_ADDR0, CALLER_ADDR1);
++	trace_preemptirqsoff_hist(IRQS_OFF, 1);
+ }
+ EXPORT_SYMBOL(trace_hardirqs_off);
  
- 	cpu = smp_processor_id();
-@@ -223,36 +313,7 @@ restart:
- 	/* Reset the pending bitmask before enabling irqs */
- 	set_softirq_pending(0);
+ void trace_hardirqs_on_caller(unsigned long caller_addr)
+ {
++	trace_preemptirqsoff_hist(IRQS_ON, 0);
+ 	if (!preempt_trace() && irq_trace())
+ 		stop_critical_timing(CALLER_ADDR0, caller_addr);
+ }
+@@ -494,6 +502,7 @@ void trace_hardirqs_off_caller(unsigned 
+ {
+ 	if (!preempt_trace() && irq_trace())
+ 		start_critical_timing(CALLER_ADDR0, caller_addr);
++	trace_preemptirqsoff_hist(IRQS_OFF, 1);
+ }
+ EXPORT_SYMBOL(trace_hardirqs_off_caller);
  
--	local_irq_enable();
--
--	h = softirq_vec;
--
--	do {
--		if (pending & 1) {
--			unsigned int vec_nr = h - softirq_vec;
--			int prev_count = preempt_count();
--
--			kstat_incr_softirqs_this_cpu(vec_nr);
--
--			trace_softirq_entry(vec_nr);
--			h->action(h);
--			trace_softirq_exit(vec_nr);
--			if (unlikely(prev_count != preempt_count())) {
--				printk(KERN_ERR "huh, entered softirq %u %s %p"
--				       "with preempt_count %08x,"
--				       " exited with %08x?\n", vec_nr,
--				       softirq_to_name[vec_nr], h->action,
--				       prev_count, preempt_count());
--				preempt_count() = prev_count;
--			}
--
--			rcu_bh_qs(cpu);
--		}
--		h++;
--		pending >>= 1;
--	} while (pending);
--
--	local_irq_disable();
-+	handle_pending_softirqs(pending, cpu);
+@@ -503,12 +512,14 @@ EXPORT_SYMBOL(trace_hardirqs_off_caller)
+ #ifdef CONFIG_PREEMPT_TRACER
+ void trace_preempt_on(unsigned long a0, unsigned long a1)
+ {
++	trace_preemptirqsoff_hist(PREEMPT_ON, 0);
+ 	if (preempt_trace())
+ 		stop_critical_timing(a0, a1);
+ }
  
- 	pending = local_softirq_pending();
- 	if (pending && --max_restart)
-@@ -267,6 +328,26 @@ restart:
- 	__local_bh_enable(SOFTIRQ_OFFSET);
+ void trace_preempt_off(unsigned long a0, unsigned long a1)
+ {
++	trace_preemptirqsoff_hist(PREEMPT_OFF, 1);
+ 	if (preempt_trace())
+ 		start_critical_timing(a0, a1);
  }
+Index: linux-2.6/include/linux/ratelimit.h
+===================================================================
+--- linux-2.6.orig/include/linux/ratelimit.h
++++ linux-2.6/include/linux/ratelimit.h
+@@ -8,7 +8,7 @@
+ #define DEFAULT_RATELIMIT_BURST		10
  
-+/*
-+ * Called with preemption disabled from run_ksoftirqd()
-+ */
-+static int ksoftirqd_do_softirq(int cpu)
-+{
-+	/*
-+	 * Preempt disable stops cpu going offline.
-+	 * If already offline, we'll be on wrong CPU:
-+	 * don't process.
-+	 */
-+	if (cpu_is_offline(cpu))
-+		return -1;
-+
-+	local_irq_disable();
-+	if (local_softirq_pending())
-+		__do_softirq();
-+	local_irq_enable();
-+	return 0;
-+}
-+
- #ifndef __ARCH_HAS_DO_SOFTIRQ
+ struct ratelimit_state {
+-	spinlock_t	lock;		/* protect the state */
++	raw_spinlock_t	lock;		/* protect the state */
  
- asmlinkage void do_softirq(void)
-@@ -289,6 +370,178 @@ asmlinkage void do_softirq(void)
+ 	int		interval;
+ 	int		burst;
+@@ -20,7 +20,7 @@ struct ratelimit_state {
+ #define DEFINE_RATELIMIT_STATE(name, interval_init, burst_init)		\
+ 									\
+ 	struct ratelimit_state name = {					\
+-		.lock		= __SPIN_LOCK_UNLOCKED(name.lock),	\
++		.lock		= __RAW_SPIN_LOCK_UNLOCKED(name.lock),	\
+ 		.interval	= interval_init,			\
+ 		.burst		= burst_init,				\
+ 	}
+@@ -28,7 +28,7 @@ struct ratelimit_state {
+ static inline void ratelimit_state_init(struct ratelimit_state *rs,
+ 					int interval, int burst)
+ {
+-	spin_lock_init(&rs->lock);
++	raw_spin_lock_init(&rs->lock);
+ 	rs->interval = interval;
+ 	rs->burst = burst;
+ 	rs->printed = 0;
+Index: linux-2.6/kernel/printk.c
+===================================================================
+--- linux-2.6.orig/kernel/printk.c
++++ linux-2.6/kernel/printk.c
+@@ -44,13 +44,6 @@
  
- #endif
+ #include <asm/uaccess.h>
  
-+static inline void local_bh_disable_nort(void) { local_bh_disable(); }
-+static inline void _local_bh_enable_nort(void) { _local_bh_enable(); }
-+static inline void ksoftirqd_set_sched_params(void) { }
-+static inline void ksoftirqd_clr_sched_params(void) { }
-+
-+#else /* !PREEMPT_RT_FULL */
-+
-+/*
-+ * On RT we serialize softirq execution with a cpu local lock
-+ */
-+static DEFINE_LOCAL_IRQ_LOCK(local_softirq_lock);
-+static DEFINE_PER_CPU(struct task_struct *, local_softirq_runner);
-+
-+static void __do_softirq(void);
-+
-+void __init softirq_early_init(void)
-+{
-+	local_irq_lock_init(local_softirq_lock);
-+}
-+
-+void local_bh_disable(void)
-+{
-+	migrate_disable();
-+	current->softirq_nestcnt++;
-+}
-+EXPORT_SYMBOL(local_bh_disable);
-+
-+void local_bh_enable(void)
-+{
-+	if (WARN_ON(current->softirq_nestcnt == 0))
-+		return;
-+
-+	if ((current->softirq_nestcnt == 1) &&
-+	    local_softirq_pending() &&
-+	    local_trylock(local_softirq_lock)) {
-+
-+		local_irq_disable();
-+		if (local_softirq_pending())
-+			__do_softirq();
-+		local_unlock(local_softirq_lock);
-+		local_irq_enable();
-+		WARN_ON(current->softirq_nestcnt != 1);
-+	}
-+	current->softirq_nestcnt--;
+-/*
+- * Architectures can override it:
+- */
+-void asmlinkage __attribute__((weak)) early_printk(const char *fmt, ...)
+-{
+-}
+-
+ #define __LOG_BUF_LEN	(1 << CONFIG_LOG_BUF_SHIFT)
+ 
+ /* printk's without a loglevel use this.. */
+@@ -100,7 +93,7 @@ static int console_locked, console_suspe
+  * It is also used in interesting ways to provide interlocking in
+  * console_unlock();.
+  */
+-static DEFINE_SPINLOCK(logbuf_lock);
++static DEFINE_RAW_SPINLOCK(logbuf_lock);
+ 
+ #define LOG_BUF_MASK (log_buf_len-1)
+ #define LOG_BUF(idx) (log_buf[(idx) & LOG_BUF_MASK])
+@@ -212,7 +205,7 @@ void __init setup_log_buf(int early)
+ 		return;
+ 	}
+ 
+-	spin_lock_irqsave(&logbuf_lock, flags);
++	raw_spin_lock_irqsave(&logbuf_lock, flags);
+ 	log_buf_len = new_log_buf_len;
+ 	log_buf = new_log_buf;
+ 	new_log_buf_len = 0;
+@@ -230,7 +223,7 @@ void __init setup_log_buf(int early)
+ 	log_start -= offset;
+ 	con_start -= offset;
+ 	log_end -= offset;
+-	spin_unlock_irqrestore(&logbuf_lock, flags);
++	raw_spin_unlock_irqrestore(&logbuf_lock, flags);
+ 
+ 	pr_info("log_buf_len: %d\n", log_buf_len);
+ 	pr_info("early log buf free: %d(%d%%)\n",
+@@ -363,18 +356,18 @@ int do_syslog(int type, char __user *buf
+ 		if (error)
+ 			goto out;
+ 		i = 0;
+-		spin_lock_irq(&logbuf_lock);
++		raw_spin_lock_irq(&logbuf_lock);
+ 		while (!error && (log_start != log_end) && i < len) {
+ 			c = LOG_BUF(log_start);
+ 			log_start++;
+-			spin_unlock_irq(&logbuf_lock);
++			raw_spin_unlock_irq(&logbuf_lock);
+ 			error = __put_user(c,buf);
+ 			buf++;
+ 			i++;
+ 			cond_resched();
+-			spin_lock_irq(&logbuf_lock);
++			raw_spin_lock_irq(&logbuf_lock);
+ 		}
+-		spin_unlock_irq(&logbuf_lock);
++		raw_spin_unlock_irq(&logbuf_lock);
+ 		if (!error)
+ 			error = i;
+ 		break;
+@@ -397,7 +390,7 @@ int do_syslog(int type, char __user *buf
+ 		count = len;
+ 		if (count > log_buf_len)
+ 			count = log_buf_len;
+-		spin_lock_irq(&logbuf_lock);
++		raw_spin_lock_irq(&logbuf_lock);
+ 		if (count > logged_chars)
+ 			count = logged_chars;
+ 		if (do_clear)
+@@ -414,12 +407,12 @@ int do_syslog(int type, char __user *buf
+ 			if (j + log_buf_len < log_end)
+ 				break;
+ 			c = LOG_BUF(j);
+-			spin_unlock_irq(&logbuf_lock);
++			raw_spin_unlock_irq(&logbuf_lock);
+ 			error = __put_user(c,&buf[count-1-i]);
+ 			cond_resched();
+-			spin_lock_irq(&logbuf_lock);
++			raw_spin_lock_irq(&logbuf_lock);
+ 		}
+-		spin_unlock_irq(&logbuf_lock);
++		raw_spin_unlock_irq(&logbuf_lock);
+ 		if (error)
+ 			break;
+ 		error = i;
+@@ -509,6 +502,7 @@ static void __call_console_drivers(unsig
+ {
+ 	struct console *con;
+ 
++	migrate_disable();
+ 	for_each_console(con) {
+ 		if (exclusive_console && con != exclusive_console)
+ 			continue;
+@@ -517,8 +511,62 @@ static void __call_console_drivers(unsig
+ 				(con->flags & CON_ANYTIME)))
+ 			con->write(con, &LOG_BUF(start), end - start);
+ 	}
 +	migrate_enable();
 +}
-+EXPORT_SYMBOL(local_bh_enable);
 +
-+void local_bh_enable_ip(unsigned long ip)
-+{
-+	local_bh_enable();
-+}
-+EXPORT_SYMBOL(local_bh_enable_ip);
++#ifdef CONFIG_EARLY_PRINTK
++struct console *early_console;
 +
-+/* For tracing */
-+int notrace __in_softirq(void)
++static void early_vprintk(const char *fmt, va_list ap)
 +{
-+	if (__get_cpu_var(local_softirq_lock).owner == current)
-+		return __get_cpu_var(local_softirq_lock).nestcnt;
-+	return 0;
++	char buf[512];
++	int n = vscnprintf(buf, sizeof(buf), fmt, ap);
++	if (early_console)
++		early_console->write(early_console, buf, n);
 +}
 +
-+int in_serving_softirq(void)
++asmlinkage void early_printk(const char *fmt, ...)
 +{
-+	int res;
-+
-+	preempt_disable();
-+	res = __get_cpu_var(local_softirq_runner) == current;
-+	preempt_enable();
-+	return res;
++	va_list ap;
++	va_start(ap, fmt);
++	early_vprintk(fmt, ap);
++	va_end(ap);
 +}
 +
 +/*
-+ * Called with bh and local interrupts disabled. For full RT cpu must
-+ * be pinned.
++ * This is independent of any log levels - a global
++ * kill switch that turns off all of printk.
++ *
++ * Used by the NMI watchdog if early-printk is enabled.
 + */
-+static void __do_softirq(void)
-+{
-+	u32 pending = local_softirq_pending();
-+	int cpu = smp_processor_id();
-+
-+	current->softirq_nestcnt++;
-+
-+	/* Reset the pending bitmask before enabling irqs */
-+	set_softirq_pending(0);
-+
-+	__get_cpu_var(local_softirq_runner) = current;
-+
-+	lockdep_softirq_enter();
-+
-+	handle_pending_softirqs(pending, cpu);
-+
-+	pending = local_softirq_pending();
-+	if (pending)
-+		wakeup_softirqd();
-+
-+	lockdep_softirq_exit();
-+	__get_cpu_var(local_softirq_runner) = NULL;
-+
-+	current->softirq_nestcnt--;
-+}
++static int __read_mostly printk_killswitch;
 +
-+static int __thread_do_softirq(int cpu)
++static int __init force_early_printk_setup(char *str)
 +{
-+	/*
-+	 * Prevent the current cpu from going offline.
-+	 * pin_current_cpu() can reenable preemption and block on the
-+	 * hotplug mutex. When it returns, the current cpu is
-+	 * pinned. It might be the wrong one, but the offline check
-+	 * below catches that.
-+	 */
-+	pin_current_cpu();
-+	/*
-+	 * If called from ksoftirqd (cpu >= 0) we need to check
-+	 * whether we are on the wrong cpu due to cpu offlining. If
-+	 * called via thread_do_softirq() no action required.
-+	 */
-+	if (cpu >= 0 && cpu_is_offline(cpu)) {
-+		unpin_current_cpu();
-+		return -1;
-+	}
-+	preempt_enable();
-+	local_lock(local_softirq_lock);
-+	local_irq_disable();
-+	/*
-+	 * We cannot switch stacks on RT as we want to be able to
-+	 * schedule!
-+	 */
-+	if (local_softirq_pending())
-+		__do_softirq();
-+	local_unlock(local_softirq_lock);
-+	unpin_current_cpu();
-+	preempt_disable();
-+	local_irq_enable();
++	printk_killswitch = 1;
 +	return 0;
 +}
++early_param("force_early_printk", force_early_printk_setup);
 +
-+/*
-+ * Called from netif_rx_ni(). Preemption enabled.
-+ */
-+void thread_do_softirq(void)
-+{
-+	if (!in_serving_softirq()) {
-+		preempt_disable();
-+		__thread_do_softirq(-1);
-+		preempt_enable();
-+	}
-+}
-+
-+static int ksoftirqd_do_softirq(int cpu)
++void printk_kill(void)
 +{
-+	return __thread_do_softirq(cpu);
-+}
-+
-+static inline void local_bh_disable_nort(void) { }
-+static inline void _local_bh_enable_nort(void) { }
-+
-+static inline void ksoftirqd_set_sched_params(void)
++	printk_killswitch = 1;
+ }
+ 
++static int forced_early_printk(const char *fmt, va_list ap)
 +{
-+	struct sched_param param = { .sched_priority = 1 };
-+
-+	sched_setscheduler(current, SCHED_FIFO, &param);
++	if (!printk_killswitch)
++		return 0;
++	early_vprintk(fmt, ap);
++	return 1;
 +}
-+
-+static inline void ksoftirqd_clr_sched_params(void)
++#else
++static inline int forced_early_printk(const char *fmt, va_list ap)
 +{
-+	struct sched_param param = { .sched_priority = 0 };
-+
-+	sched_setscheduler(current, SCHED_NORMAL, &param);
++	return 0;
 +}
++#endif
 +
-+#endif /* PREEMPT_RT_FULL */
- /*
-  * Enter an interrupt context.
-  */
-@@ -302,9 +555,9 @@ void irq_enter(void)
- 		 * Prevent raise_softirq from needlessly waking up ksoftirqd
- 		 * here, as softirq will be serviced on return from interrupt.
- 		 */
--		local_bh_disable();
-+		local_bh_disable_nort();
- 		tick_check_idle(cpu);
--		_local_bh_enable();
-+		_local_bh_enable_nort();
- 	}
+ static int __read_mostly ignore_loglevel;
  
- 	__irq_enter();
-@@ -313,6 +566,7 @@ void irq_enter(void)
- #ifdef __ARCH_IRQ_EXIT_IRQS_DISABLED
- static inline void invoke_softirq(void)
- {
-+#ifndef CONFIG_PREEMPT_RT_FULL
- 	if (!force_irqthreads)
- 		__do_softirq();
- 	else {
-@@ -321,10 +575,14 @@ static inline void invoke_softirq(void)
- 		wakeup_softirqd();
- 		__local_bh_enable(SOFTIRQ_OFFSET);
- 	}
-+#else
-+	wakeup_softirqd();
-+#endif
+ static int __init ignore_loglevel_setup(char *str)
+@@ -687,7 +735,7 @@ static void zap_locks(void)
+ 	oops_timestamp = jiffies;
+ 
+ 	/* If a crash is occurring, make sure we can't deadlock */
+-	spin_lock_init(&logbuf_lock);
++	raw_spin_lock_init(&logbuf_lock);
+ 	/* And make sure that we print immediately */
+ 	sema_init(&console_sem, 1);
  }
- #else
- static inline void invoke_softirq(void)
+@@ -779,12 +827,18 @@ static inline int can_use_console(unsign
+  * interrupts disabled. It should return with 'lockbuf_lock'
+  * released but interrupts still disabled.
+  */
+-static int console_trylock_for_printk(unsigned int cpu)
++static int console_trylock_for_printk(unsigned int cpu, unsigned long flags)
+ 	__releases(&logbuf_lock)
  {
-+#ifndef CONFIG_PREEMPT_RT_FULL
- 	if (!force_irqthreads)
- 		do_softirq();
- 	else {
-@@ -333,6 +591,9 @@ static inline void invoke_softirq(void)
- 		wakeup_softirqd();
- 		__local_bh_enable(SOFTIRQ_OFFSET);
- 	}
++#ifdef CONFIG_PREEMPT_RT_FULL
++	int lock = !early_boot_irqs_disabled && !irqs_disabled_flags(flags) &&
++		!preempt_count();
 +#else
-+	wakeup_softirqd();
++	int lock = 1;
 +#endif
- }
- #endif
+ 	int retval = 0;
  
-@@ -353,7 +614,7 @@ void irq_exit(void)
- 	if (idle_cpu(smp_processor_id()) && !in_interrupt() && !need_resched())
- 		tick_nohz_stop_sched_tick(0);
- #endif
--	preempt_enable_no_resched();
-+	__preempt_enable_no_resched();
- }
+-	if (console_trylock()) {
++	if (lock && console_trylock()) {
+ 		retval = 1;
  
- /*
-@@ -739,29 +1000,21 @@ void __init softirq_init(void)
+ 		/*
+@@ -800,7 +854,7 @@ static int console_trylock_for_printk(un
+ 		}
+ 	}
+ 	printk_cpu = UINT_MAX;
+-	spin_unlock(&logbuf_lock);
++	raw_spin_unlock(&logbuf_lock);
+ 	return retval;
+ }
+ static const char recursion_bug_msg [] =
+@@ -833,6 +887,13 @@ asmlinkage int vprintk(const char *fmt, 
+ 	size_t plen;
+ 	char special;
  
- static int run_ksoftirqd(void * __bind_cpu)
- {
-+	ksoftirqd_set_sched_params();
++	/*
++	 * Fall back to early_printk if a debugging subsystem has
++	 * killed printk output
++	 */
++	if (unlikely(forced_early_printk(fmt, args)))
++		return 1;
 +
- 	set_current_state(TASK_INTERRUPTIBLE);
+ 	boot_delay_msec();
+ 	printk_delay();
  
- 	while (!kthread_should_stop()) {
- 		preempt_disable();
--		if (!local_softirq_pending()) {
--			preempt_enable_no_resched();
--			schedule();
--			preempt_disable();
--		}
-+		if (!local_softirq_pending())
-+			schedule_preempt_disabled();
+@@ -860,7 +921,7 @@ asmlinkage int vprintk(const char *fmt, 
+ 	}
  
- 		__set_current_state(TASK_RUNNING);
+ 	lockdep_off();
+-	spin_lock(&logbuf_lock);
++	raw_spin_lock(&logbuf_lock);
+ 	printk_cpu = this_cpu;
  
- 		while (local_softirq_pending()) {
--			/* Preempt disable stops cpu going offline.
--			   If already offline, we'll be on wrong CPU:
--			   don't process */
--			if (cpu_is_offline((long)__bind_cpu))
-+			if (ksoftirqd_do_softirq((long) __bind_cpu))
- 				goto wait_to_die;
--			local_irq_disable();
--			if (local_softirq_pending())
--				__do_softirq();
--			local_irq_enable();
--			preempt_enable_no_resched();
-+			__preempt_enable_no_resched();
- 			cond_resched();
- 			preempt_disable();
- 			rcu_note_context_switch((long)__bind_cpu);
-@@ -774,6 +1027,7 @@ static int run_ksoftirqd(void * __bind_c
+ 	if (recursion_bug) {
+@@ -953,8 +1014,15 @@ asmlinkage int vprintk(const char *fmt, 
+ 	 * will release 'logbuf_lock' regardless of whether it
+ 	 * actually gets the semaphore or not.
+ 	 */
+-	if (console_trylock_for_printk(this_cpu))
++	if (console_trylock_for_printk(this_cpu, flags)) {
++#ifndef CONFIG_PREEMPT_RT_FULL
++		console_unlock();
++#else
++		raw_local_irq_restore(flags);
+ 		console_unlock();
++		raw_local_irq_save(flags);
++#endif
++	}
  
- wait_to_die:
- 	preempt_enable();
-+	ksoftirqd_clr_sched_params();
- 	/* Wait for kthread_stop */
- 	set_current_state(TASK_INTERRUPTIBLE);
- 	while (!kthread_should_stop()) {
-Index: linux-2.6/include/linux/kprobes.h
-===================================================================
---- linux-2.6.orig/include/linux/kprobes.h
-+++ linux-2.6/include/linux/kprobes.h
-@@ -181,7 +181,7 @@ struct kretprobe {
- 	int nmissed;
- 	size_t data_size;
- 	struct hlist_head free_instances;
--	spinlock_t lock;
-+	raw_spinlock_t lock;
- };
+ 	lockdep_on();
+ out_restore_irqs:
+@@ -1252,18 +1320,23 @@ void console_unlock(void)
+ 	console_may_schedule = 0;
  
- struct kretprobe_instance {
-Index: linux-2.6/kernel/kprobes.c
-===================================================================
---- linux-2.6.orig/kernel/kprobes.c
-+++ linux-2.6/kernel/kprobes.c
-@@ -78,10 +78,10 @@ static bool kprobes_all_disarmed;
- static DEFINE_MUTEX(kprobe_mutex);
- static DEFINE_PER_CPU(struct kprobe *, kprobe_instance) = NULL;
- static struct {
--	spinlock_t lock ____cacheline_aligned_in_smp;
-+	raw_spinlock_t lock ____cacheline_aligned_in_smp;
- } kretprobe_table_locks[KPROBE_TABLE_SIZE];
+ 	for ( ; ; ) {
+-		spin_lock_irqsave(&logbuf_lock, flags);
++		raw_spin_lock_irqsave(&logbuf_lock, flags);
+ 		wake_klogd |= log_start - log_end;
+ 		if (con_start == log_end)
+ 			break;			/* Nothing to print */
+ 		_con_start = con_start;
+ 		_log_end = log_end;
+ 		con_start = log_end;		/* Flush */
+-		spin_unlock(&logbuf_lock);
++#ifndef CONFIG_PREEMPT_RT_FULL
++		raw_spin_unlock(&logbuf_lock);
+ 		stop_critical_timings();	/* don't trace print latency */
+ 		call_console_drivers(_con_start, _log_end);
+ 		start_critical_timings();
+ 		local_irq_restore(flags);
++#else
++		raw_spin_unlock_irqrestore(&logbuf_lock, flags);
++		call_console_drivers(_con_start, _log_end);
++#endif
+ 	}
+ 	console_locked = 0;
  
--static spinlock_t *kretprobe_table_lock_ptr(unsigned long hash)
-+static raw_spinlock_t *kretprobe_table_lock_ptr(unsigned long hash)
- {
- 	return &(kretprobe_table_locks[hash].lock);
- }
-@@ -1013,9 +1013,9 @@ void __kprobes recycle_rp_inst(struct kr
- 	hlist_del(&ri->hlist);
- 	INIT_HLIST_NODE(&ri->hlist);
- 	if (likely(rp)) {
--		spin_lock(&rp->lock);
-+		raw_spin_lock(&rp->lock);
- 		hlist_add_head(&ri->hlist, &rp->free_instances);
--		spin_unlock(&rp->lock);
-+		raw_spin_unlock(&rp->lock);
- 	} else
- 		/* Unregistering */
- 		hlist_add_head(&ri->hlist, head);
-@@ -1026,19 +1026,19 @@ void __kprobes kretprobe_hash_lock(struc
- __acquires(hlist_lock)
- {
- 	unsigned long hash = hash_ptr(tsk, KPROBE_HASH_BITS);
--	spinlock_t *hlist_lock;
-+	raw_spinlock_t *hlist_lock;
+@@ -1272,7 +1345,7 @@ void console_unlock(void)
+ 		exclusive_console = NULL;
  
- 	*head = &kretprobe_inst_table[hash];
- 	hlist_lock = kretprobe_table_lock_ptr(hash);
--	spin_lock_irqsave(hlist_lock, *flags);
-+	raw_spin_lock_irqsave(hlist_lock, *flags);
+ 	up(&console_sem);
+-	spin_unlock_irqrestore(&logbuf_lock, flags);
++	raw_spin_unlock_irqrestore(&logbuf_lock, flags);
+ 	if (wake_klogd)
+ 		wake_up_klogd();
  }
+@@ -1502,9 +1575,9 @@ void register_console(struct console *ne
+ 		 * console_unlock(); will print out the buffered messages
+ 		 * for us.
+ 		 */
+-		spin_lock_irqsave(&logbuf_lock, flags);
++		raw_spin_lock_irqsave(&logbuf_lock, flags);
+ 		con_start = log_start;
+-		spin_unlock_irqrestore(&logbuf_lock, flags);
++		raw_spin_unlock_irqrestore(&logbuf_lock, flags);
+ 		/*
+ 		 * We're about to replay the log buffer.  Only do this to the
+ 		 * just-registered console to avoid excessive message spam to
+@@ -1711,10 +1784,10 @@ void kmsg_dump(enum kmsg_dump_reason rea
+ 	/* Theoretically, the log could move on after we do this, but
+ 	   there's not a lot we can do about that. The new messages
+ 	   will overwrite the start of what we dump. */
+-	spin_lock_irqsave(&logbuf_lock, flags);
++	raw_spin_lock_irqsave(&logbuf_lock, flags);
+ 	end = log_end & LOG_BUF_MASK;
+ 	chars = logged_chars;
+-	spin_unlock_irqrestore(&logbuf_lock, flags);
++	raw_spin_unlock_irqrestore(&logbuf_lock, flags);
  
- static void __kprobes kretprobe_table_lock(unsigned long hash,
- 	unsigned long *flags)
- __acquires(hlist_lock)
- {
--	spinlock_t *hlist_lock = kretprobe_table_lock_ptr(hash);
--	spin_lock_irqsave(hlist_lock, *flags);
-+	raw_spinlock_t *hlist_lock = kretprobe_table_lock_ptr(hash);
-+	raw_spin_lock_irqsave(hlist_lock, *flags);
- }
- 
- void __kprobes kretprobe_hash_unlock(struct task_struct *tsk,
-@@ -1046,18 +1046,18 @@ void __kprobes kretprobe_hash_unlock(str
- __releases(hlist_lock)
- {
- 	unsigned long hash = hash_ptr(tsk, KPROBE_HASH_BITS);
--	spinlock_t *hlist_lock;
-+	raw_spinlock_t *hlist_lock;
+ 	if (chars > end) {
+ 		s1 = log_buf + log_buf_len - chars + end;
+Index: linux-2.6/lib/ratelimit.c
+===================================================================
+--- linux-2.6.orig/lib/ratelimit.c
++++ linux-2.6/lib/ratelimit.c
+@@ -39,7 +39,7 @@ int ___ratelimit(struct ratelimit_state 
+ 	 * in addition to the one that will be printed by
+ 	 * the entity that is holding the lock already:
+ 	 */
+-	if (!spin_trylock_irqsave(&rs->lock, flags))
++	if (!raw_spin_trylock_irqsave(&rs->lock, flags))
+ 		return 0;
  
- 	hlist_lock = kretprobe_table_lock_ptr(hash);
--	spin_unlock_irqrestore(hlist_lock, *flags);
-+	raw_spin_unlock_irqrestore(hlist_lock, *flags);
- }
+ 	if (!rs->begin)
+@@ -60,7 +60,7 @@ int ___ratelimit(struct ratelimit_state 
+ 		rs->missed++;
+ 		ret = 0;
+ 	}
+-	spin_unlock_irqrestore(&rs->lock, flags);
++	raw_spin_unlock_irqrestore(&rs->lock, flags);
  
- static void __kprobes kretprobe_table_unlock(unsigned long hash,
-        unsigned long *flags)
- __releases(hlist_lock)
- {
--	spinlock_t *hlist_lock = kretprobe_table_lock_ptr(hash);
--	spin_unlock_irqrestore(hlist_lock, *flags);
-+	raw_spinlock_t *hlist_lock = kretprobe_table_lock_ptr(hash);
-+	raw_spin_unlock_irqrestore(hlist_lock, *flags);
+ 	return ret;
  }
+Index: linux-2.6/include/linux/init_task.h
+===================================================================
+--- linux-2.6.orig/include/linux/init_task.h
++++ linux-2.6/include/linux/init_task.h
+@@ -42,7 +42,7 @@ extern struct fs_struct init_fs;
+ 	.cputimer	= { 						\
+ 		.cputime = INIT_CPUTIME,				\
+ 		.running = 0,						\
+-		.lock = __SPIN_LOCK_UNLOCKED(sig.cputimer.lock),	\
++		.lock = __RAW_SPIN_LOCK_UNLOCKED(sig.cputimer.lock),	\
+ 	},								\
+ 	.cred_guard_mutex =						\
+ 		 __MUTEX_INITIALIZER(sig.cred_guard_mutex),		\
+@@ -126,6 +126,12 @@ extern struct cred init_cred;
+ # define INIT_PERF_EVENTS(tsk)
+ #endif
  
++#ifdef CONFIG_PREEMPT_RT_BASE
++# define INIT_TIMER_LIST		.posix_timer_list = NULL,
++#else
++# define INIT_TIMER_LIST
++#endif
++
  /*
-@@ -1650,12 +1650,12 @@ static int __kprobes pre_handler_kretpro
+  *  INIT_TASK is used to set up the first task table, touch at
+  * your own risk!. Base=0, limit=0x1fffff (=2MB)
+@@ -179,6 +185,7 @@ extern struct cred init_cred;
+ 	.fs_excl	= ATOMIC_INIT(0),				\
+ 	.pi_lock	= __RAW_SPIN_LOCK_UNLOCKED(tsk.pi_lock),	\
+ 	.timer_slack_ns = 50000, /* 50 usec default slack */		\
++	INIT_TIMER_LIST							\
+ 	.pids = {							\
+ 		[PIDTYPE_PID]  = INIT_PID_LINK(PIDTYPE_PID),		\
+ 		[PIDTYPE_PGID] = INIT_PID_LINK(PIDTYPE_PGID),		\
+Index: linux-2.6/include/linux/sched.h
+===================================================================
+--- linux-2.6.orig/include/linux/sched.h
++++ linux-2.6/include/linux/sched.h
+@@ -63,6 +63,7 @@ struct sched_param {
+ #include <linux/nodemask.h>
+ #include <linux/mm_types.h>
  
- 	/*TODO: consider to only swap the RA after the last pre_handler fired */
- 	hash = hash_ptr(current, KPROBE_HASH_BITS);
--	spin_lock_irqsave(&rp->lock, flags);
-+	raw_spin_lock_irqsave(&rp->lock, flags);
- 	if (!hlist_empty(&rp->free_instances)) {
- 		ri = hlist_entry(rp->free_instances.first,
- 				struct kretprobe_instance, hlist);
- 		hlist_del(&ri->hlist);
--		spin_unlock_irqrestore(&rp->lock, flags);
-+		raw_spin_unlock_irqrestore(&rp->lock, flags);
++#include <asm/kmap_types.h>
+ #include <asm/system.h>
+ #include <asm/page.h>
+ #include <asm/ptrace.h>
+@@ -90,6 +91,7 @@ struct sched_param {
+ #include <linux/task_io_accounting.h>
+ #include <linux/latencytop.h>
+ #include <linux/cred.h>
++#include <linux/hardirq.h>
  
- 		ri->rp = rp;
- 		ri->task = current;
-@@ -1672,7 +1672,7 @@ static int __kprobes pre_handler_kretpro
- 		kretprobe_table_unlock(hash, &flags);
- 	} else {
- 		rp->nmissed++;
--		spin_unlock_irqrestore(&rp->lock, flags);
-+		raw_spin_unlock_irqrestore(&rp->lock, flags);
- 	}
- 	return 0;
- }
-@@ -1708,7 +1708,7 @@ int __kprobes register_kretprobe(struct 
- 		rp->maxactive = num_possible_cpus();
- #endif
- 	}
--	spin_lock_init(&rp->lock);
-+	raw_spin_lock_init(&rp->lock);
- 	INIT_HLIST_HEAD(&rp->free_instances);
- 	for (i = 0; i < rp->maxactive; i++) {
- 		inst = kmalloc(sizeof(struct kretprobe_instance) +
-@@ -1946,7 +1946,7 @@ static int __init init_kprobes(void)
- 	for (i = 0; i < KPROBE_TABLE_SIZE; i++) {
- 		INIT_HLIST_HEAD(&kprobe_table[i]);
- 		INIT_HLIST_HEAD(&kretprobe_inst_table[i]);
--		spin_lock_init(&(kretprobe_table_locks[i].lock));
-+		raw_spin_lock_init(&(kretprobe_table_locks[i].lock));
- 	}
+ #include <asm/processor.h>
  
- 	/*
-Index: linux-2.6/include/linux/percpu_counter.h
-===================================================================
---- linux-2.6.orig/include/linux/percpu_counter.h
-+++ linux-2.6/include/linux/percpu_counter.h
-@@ -16,7 +16,7 @@
- #ifdef CONFIG_SMP
+@@ -359,6 +361,7 @@ extern signed long schedule_timeout_inte
+ extern signed long schedule_timeout_killable(signed long timeout);
+ extern signed long schedule_timeout_uninterruptible(signed long timeout);
+ asmlinkage void schedule(void);
++extern void schedule_preempt_disabled(void);
+ extern int mutex_spin_on_owner(struct mutex *lock, struct task_struct *owner);
  
- struct percpu_counter {
+ struct nsproxy;
+@@ -510,7 +513,7 @@ struct task_cputime {
+ struct thread_group_cputimer {
+ 	struct task_cputime cputime;
+ 	int running;
 -	spinlock_t lock;
 +	raw_spinlock_t lock;
- 	s64 count;
- #ifdef CONFIG_HOTPLUG_CPU
- 	struct list_head list;	/* All percpu_counters are on a list */
-Index: linux-2.6/lib/percpu_counter.c
-===================================================================
---- linux-2.6.orig/lib/percpu_counter.c
-+++ linux-2.6/lib/percpu_counter.c
-@@ -59,13 +59,13 @@ void percpu_counter_set(struct percpu_co
- {
- 	int cpu;
- 
--	spin_lock(&fbc->lock);
-+	raw_spin_lock(&fbc->lock);
- 	for_each_possible_cpu(cpu) {
- 		s32 *pcount = per_cpu_ptr(fbc->counters, cpu);
- 		*pcount = 0;
- 	}
- 	fbc->count = amount;
--	spin_unlock(&fbc->lock);
-+	raw_spin_unlock(&fbc->lock);
- }
- EXPORT_SYMBOL(percpu_counter_set);
+ };
  
-@@ -76,10 +76,10 @@ void __percpu_counter_add(struct percpu_
- 	preempt_disable();
- 	count = __this_cpu_read(*fbc->counters) + amount;
- 	if (count >= batch || count <= -batch) {
--		spin_lock(&fbc->lock);
-+		raw_spin_lock(&fbc->lock);
- 		fbc->count += count;
- 		__this_cpu_write(*fbc->counters, 0);
--		spin_unlock(&fbc->lock);
-+		raw_spin_unlock(&fbc->lock);
- 	} else {
- 		__this_cpu_write(*fbc->counters, count);
- 	}
-@@ -96,13 +96,13 @@ s64 __percpu_counter_sum(struct percpu_c
- 	s64 ret;
- 	int cpu;
+ #include <linux/rwsem.h>
+@@ -1070,6 +1073,7 @@ struct sched_domain;
+ #define WF_SYNC		0x01		/* waker goes to sleep after wakup */
+ #define WF_FORK		0x02		/* child wakeup after fork */
+ #define WF_MIGRATED	0x04		/* internal use, task got migrated */
++#define WF_LOCK_SLEEPER	0x08		/* wakeup spinlock "sleeper" */
  
--	spin_lock(&fbc->lock);
-+	raw_spin_lock(&fbc->lock);
- 	ret = fbc->count;
- 	for_each_online_cpu(cpu) {
- 		s32 *pcount = per_cpu_ptr(fbc->counters, cpu);
- 		ret += *pcount;
- 	}
--	spin_unlock(&fbc->lock);
-+	raw_spin_unlock(&fbc->lock);
- 	return ret;
- }
- EXPORT_SYMBOL(__percpu_counter_sum);
-@@ -110,7 +110,7 @@ EXPORT_SYMBOL(__percpu_counter_sum);
- int __percpu_counter_init(struct percpu_counter *fbc, s64 amount,
- 			  struct lock_class_key *key)
- {
--	spin_lock_init(&fbc->lock);
-+	raw_spin_lock_init(&fbc->lock);
- 	lockdep_set_class(&fbc->lock, key);
- 	fbc->count = amount;
- 	fbc->counters = alloc_percpu(s32);
-@@ -173,11 +173,11 @@ static int __cpuinit percpu_counter_hotc
- 		s32 *pcount;
- 		unsigned long flags;
+ #define ENQUEUE_WAKEUP		1
+ #define ENQUEUE_HEAD		2
+@@ -1219,6 +1223,7 @@ enum perf_event_task_context {
  
--		spin_lock_irqsave(&fbc->lock, flags);
-+		raw_spin_lock_irqsave(&fbc->lock, flags);
- 		pcount = per_cpu_ptr(fbc->counters, cpu);
- 		fbc->count += *pcount;
- 		*pcount = 0;
--		spin_unlock_irqrestore(&fbc->lock, flags);
-+		raw_spin_unlock_irqrestore(&fbc->lock, flags);
- 	}
- 	mutex_unlock(&percpu_counters_lock);
+ struct task_struct {
+ 	volatile long state;	/* -1 unrunnable, 0 runnable, >0 stopped */
++	volatile long saved_state;	/* saved state for "spinlock sleepers" */
+ 	void *stack;
+ 	atomic_t usage;
+ 	unsigned int flags;	/* per process flags, defined below */
+@@ -1255,14 +1260,17 @@ struct task_struct {
  #endif
-Index: linux-2.6/kernel/cgroup.c
-===================================================================
---- linux-2.6.orig/kernel/cgroup.c
-+++ linux-2.6/kernel/cgroup.c
-@@ -263,7 +263,7 @@ list_for_each_entry(_root, &roots, root_
- /* the list of cgroups eligible for automatic release. Protected by
-  * release_list_lock */
- static LIST_HEAD(release_list);
--static DEFINE_SPINLOCK(release_list_lock);
-+static DEFINE_RAW_SPINLOCK(release_list_lock);
- static void cgroup_release_agent(struct work_struct *work);
- static DECLARE_WORK(release_agent_work, cgroup_release_agent);
- static void check_for_release(struct cgroup *cgrp);
-@@ -4010,11 +4010,11 @@ again:
- 	finish_wait(&cgroup_rmdir_waitq, &wait);
- 	clear_bit(CGRP_WAIT_ON_RMDIR, &cgrp->flags);
  
--	spin_lock(&release_list_lock);
-+	raw_spin_lock(&release_list_lock);
- 	set_bit(CGRP_REMOVED, &cgrp->flags);
- 	if (!list_empty(&cgrp->release_list))
- 		list_del_init(&cgrp->release_list);
--	spin_unlock(&release_list_lock);
-+	raw_spin_unlock(&release_list_lock);
+ 	unsigned int policy;
++#ifdef CONFIG_PREEMPT_RT_FULL
++	int migrate_disable;
++#ifdef CONFIG_SCHED_DEBUG
++	int migrate_disable_atomic;
++#endif
++#endif
+ 	cpumask_t cpus_allowed;
  
- 	cgroup_lock_hierarchy(cgrp->root);
- 	/* delete this cgroup from parent->children */
-@@ -4667,13 +4667,13 @@ static void check_for_release(struct cgr
- 		 * already queued for a userspace notification, queue
- 		 * it now */
- 		int need_schedule_work = 0;
--		spin_lock(&release_list_lock);
-+		raw_spin_lock(&release_list_lock);
- 		if (!cgroup_is_removed(cgrp) &&
- 		    list_empty(&cgrp->release_list)) {
- 			list_add(&cgrp->release_list, &release_list);
- 			need_schedule_work = 1;
- 		}
--		spin_unlock(&release_list_lock);
-+		raw_spin_unlock(&release_list_lock);
- 		if (need_schedule_work)
- 			schedule_work(&release_agent_work);
- 	}
-@@ -4725,7 +4725,7 @@ static void cgroup_release_agent(struct 
- {
- 	BUG_ON(work != &release_agent_work);
- 	mutex_lock(&cgroup_mutex);
--	spin_lock(&release_list_lock);
-+	raw_spin_lock(&release_list_lock);
- 	while (!list_empty(&release_list)) {
- 		char *argv[3], *envp[3];
- 		int i;
-@@ -4734,7 +4734,7 @@ static void cgroup_release_agent(struct 
- 						    struct cgroup,
- 						    release_list);
- 		list_del_init(&cgrp->release_list);
--		spin_unlock(&release_list_lock);
-+		raw_spin_unlock(&release_list_lock);
- 		pathbuf = kmalloc(PAGE_SIZE, GFP_KERNEL);
- 		if (!pathbuf)
- 			goto continue_free;
-@@ -4764,9 +4764,9 @@ static void cgroup_release_agent(struct 
-  continue_free:
- 		kfree(pathbuf);
- 		kfree(agentbuf);
--		spin_lock(&release_list_lock);
-+		raw_spin_lock(&release_list_lock);
- 	}
--	spin_unlock(&release_list_lock);
-+	raw_spin_unlock(&release_list_lock);
- 	mutex_unlock(&cgroup_mutex);
- }
+ #ifdef CONFIG_PREEMPT_RCU
+ 	int rcu_read_lock_nesting;
+ 	char rcu_read_unlock_special;
+-#if defined(CONFIG_RCU_BOOST) && defined(CONFIG_TREE_PREEMPT_RCU)
+-	int rcu_boosted;
+-#endif /* #if defined(CONFIG_RCU_BOOST) && defined(CONFIG_TREE_PREEMPT_RCU) */
+ 	struct list_head rcu_node_entry;
+ #endif /* #ifdef CONFIG_PREEMPT_RCU */
+ #ifdef CONFIG_TREE_PREEMPT_RCU
+@@ -1356,6 +1364,9 @@ struct task_struct {
  
-Index: linux-2.6/include/linux/proportions.h
-===================================================================
---- linux-2.6.orig/include/linux/proportions.h
-+++ linux-2.6/include/linux/proportions.h
-@@ -58,7 +58,7 @@ struct prop_local_percpu {
- 	 */
- 	int shift;
- 	unsigned long period;
--	spinlock_t lock;		/* protect the snapshot state */
-+	raw_spinlock_t lock;		/* protect the snapshot state */
- };
+ 	struct task_cputime cputime_expires;
+ 	struct list_head cpu_timers[3];
++#ifdef CONFIG_PREEMPT_RT_BASE
++	struct task_struct *posix_timer_list;
++#endif
  
- int prop_local_init_percpu(struct prop_local_percpu *pl);
-@@ -106,11 +106,11 @@ struct prop_local_single {
- 	 */
- 	unsigned long period;
- 	int shift;
--	spinlock_t lock;		/* protect the snapshot state */
-+	raw_spinlock_t lock;		/* protect the snapshot state */
+ /* process credentials */
+ 	const struct cred __rcu *real_cred; /* objective and real subjective task
+@@ -1389,6 +1400,7 @@ struct task_struct {
+ /* signal handlers */
+ 	struct signal_struct *signal;
+ 	struct sighand_struct *sighand;
++	struct sigqueue *sigqueue_cache;
+ 
+ 	sigset_t blocked, real_blocked;
+ 	sigset_t saved_sigmask;	/* restored if set_restore_sigmask() was used */
+@@ -1432,6 +1444,9 @@ struct task_struct {
+ 	/* mutex deadlock detection */
+ 	struct mutex_waiter *blocked_on;
+ #endif
++#ifdef CONFIG_PREEMPT_RT_FULL
++	int pagefault_disabled;
++#endif
+ #ifdef CONFIG_TRACE_IRQFLAGS
+ 	unsigned int irq_events;
+ 	unsigned long hardirq_enable_ip;
+@@ -1558,6 +1573,12 @@ struct task_struct {
+ 	unsigned long trace;
+ 	/* bitmask and counter of trace recursion */
+ 	unsigned long trace_recursion;
++#ifdef CONFIG_WAKEUP_LATENCY_HIST
++	u64 preempt_timestamp_hist;
++#ifdef CONFIG_MISSED_TIMER_OFFSETS_HIST
++	unsigned long timer_offset;
++#endif
++#endif
+ #endif /* CONFIG_TRACING */
+ #ifdef CONFIG_CGROUP_MEM_RES_CTLR /* memcg uses this to do batch job */
+ 	struct memcg_batch_info {
+@@ -1570,10 +1591,26 @@ struct task_struct {
+ #ifdef CONFIG_HAVE_HW_BREAKPOINT
+ 	atomic_t ptrace_bp_refcnt;
+ #endif
++#ifdef CONFIG_PREEMPT_RT_BASE
++	struct rcu_head put_rcu;
++	int softirq_nestcnt;
++#endif
++#if defined CONFIG_PREEMPT_RT_FULL && defined CONFIG_HIGHMEM
++	int kmap_idx;
++	pte_t kmap_pte[KM_TYPE_NR];
++#endif
  };
  
- #define INIT_PROP_LOCAL_SINGLE(name)			\
--{	.lock = __SPIN_LOCK_UNLOCKED(name.lock),	\
-+{	.lock = __RAW_SPIN_LOCK_UNLOCKED(name.lock),	\
- }
+-/* Future-safe accessor for struct task_struct's cpus_allowed. */
+-#define tsk_cpus_allowed(tsk) (&(tsk)->cpus_allowed)
++#ifdef CONFIG_PREEMPT_RT_FULL
++static inline bool cur_pf_disabled(void) { return current->pagefault_disabled; }
++#else
++static inline bool cur_pf_disabled(void) { return false; }
++#endif
++
++static inline bool pagefault_disabled(void)
++{
++	return in_atomic() || cur_pf_disabled();
++}
  
- int prop_local_init_single(struct prop_local_single *pl);
-Index: linux-2.6/lib/proportions.c
-===================================================================
---- linux-2.6.orig/lib/proportions.c
-+++ linux-2.6/lib/proportions.c
-@@ -190,7 +190,7 @@ prop_adjust_shift(int *pl_shift, unsigne
+ /*
+  * Priority of a process goes from 0..MAX_PRIO-1, valid RT
+@@ -1743,6 +1780,15 @@ extern struct pid *cad_pid;
+ extern void free_task(struct task_struct *tsk);
+ #define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0)
  
- int prop_local_init_percpu(struct prop_local_percpu *pl)
- {
--	spin_lock_init(&pl->lock);
-+	raw_spin_lock_init(&pl->lock);
- 	pl->shift = 0;
- 	pl->period = 0;
- 	return percpu_counter_init(&pl->events, 0);
-@@ -226,7 +226,7 @@ void prop_norm_percpu(struct prop_global
- 	if (pl->period == global_period)
- 		return;
++#ifdef CONFIG_PREEMPT_RT_BASE
++extern void __put_task_struct_cb(struct rcu_head *rhp);
++
++static inline void put_task_struct(struct task_struct *t)
++{
++	if (atomic_dec_and_test(&t->usage))
++		call_rcu(&t->put_rcu, __put_task_struct_cb);
++}
++#else
+ extern void __put_task_struct(struct task_struct *t);
  
--	spin_lock_irqsave(&pl->lock, flags);
-+	raw_spin_lock_irqsave(&pl->lock, flags);
- 	prop_adjust_shift(&pl->shift, &pl->period, pg->shift);
+ static inline void put_task_struct(struct task_struct *t)
+@@ -1750,6 +1796,7 @@ static inline void put_task_struct(struc
+ 	if (atomic_dec_and_test(&t->usage))
+ 		__put_task_struct(t);
+ }
++#endif
  
- 	/*
-@@ -247,7 +247,7 @@ void prop_norm_percpu(struct prop_global
- 		percpu_counter_set(&pl->events, 0);
+ extern void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st);
+ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *st);
+@@ -1774,6 +1821,7 @@ extern void thread_group_times(struct ta
+ #define PF_FROZEN	0x00010000	/* frozen for system suspend */
+ #define PF_FSTRANS	0x00020000	/* inside a filesystem transaction */
+ #define PF_KSWAPD	0x00040000	/* I am kswapd */
++#define PF_STOMPER	0x00080000	/* I am a stomp machine thread */
+ #define PF_LESS_THROTTLE 0x00100000	/* Throttle me less: I clean memory */
+ #define PF_KTHREAD	0x00200000	/* I am a kernel thread */
+ #define PF_RANDOMIZE	0x00400000	/* randomize virtual address space */
+@@ -2022,15 +2070,27 @@ static inline void sched_autogroup_exit(
+ #endif
  
- 	pl->period = global_period;
--	spin_unlock_irqrestore(&pl->lock, flags);
-+	raw_spin_unlock_irqrestore(&pl->lock, flags);
+ #ifdef CONFIG_RT_MUTEXES
++extern void task_setprio(struct task_struct *p, int prio);
+ extern int rt_mutex_getprio(struct task_struct *p);
+-extern void rt_mutex_setprio(struct task_struct *p, int prio);
++static inline void rt_mutex_setprio(struct task_struct *p, int prio)
++{
++	task_setprio(p, prio);
++}
+ extern void rt_mutex_adjust_pi(struct task_struct *p);
++static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
++{
++	return tsk->pi_blocked_on != NULL;
++}
+ #else
+ static inline int rt_mutex_getprio(struct task_struct *p)
+ {
+ 	return p->normal_prio;
  }
+ # define rt_mutex_adjust_pi(p)		do { } while (0)
++static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
++{
++	return false;
++}
+ #endif
  
- /*
-@@ -324,7 +324,7 @@ void prop_fraction_percpu(struct prop_de
+ extern bool yield_to(struct task_struct *p, bool preempt);
+@@ -2110,6 +2170,7 @@ extern void xtime_update(unsigned long t
  
- int prop_local_init_single(struct prop_local_single *pl)
+ extern int wake_up_state(struct task_struct *tsk, unsigned int state);
+ extern int wake_up_process(struct task_struct *tsk);
++extern int wake_up_lock_sleeper(struct task_struct * tsk);
+ extern void wake_up_new_task(struct task_struct *tsk);
+ #ifdef CONFIG_SMP
+  extern void kick_process(struct task_struct *tsk);
+@@ -2199,12 +2260,24 @@ extern struct mm_struct * mm_alloc(void)
+ 
+ /* mmdrop drops the mm and the page tables */
+ extern void __mmdrop(struct mm_struct *);
++
+ static inline void mmdrop(struct mm_struct * mm)
  {
--	spin_lock_init(&pl->lock);
-+	raw_spin_lock_init(&pl->lock);
- 	pl->shift = 0;
- 	pl->period = 0;
- 	pl->events = 0;
-@@ -356,7 +356,7 @@ void prop_norm_single(struct prop_global
- 	if (pl->period == global_period)
- 		return;
- 
--	spin_lock_irqsave(&pl->lock, flags);
-+	raw_spin_lock_irqsave(&pl->lock, flags);
- 	prop_adjust_shift(&pl->shift, &pl->period, pg->shift);
- 	/*
- 	 * For each missed period, we half the local counter.
-@@ -367,7 +367,7 @@ void prop_norm_single(struct prop_global
- 	else
- 		pl->events = 0;
- 	pl->period = global_period;
--	spin_unlock_irqrestore(&pl->lock, flags);
-+	raw_spin_unlock_irqrestore(&pl->lock, flags);
+ 	if (unlikely(atomic_dec_and_test(&mm->mm_count)))
+ 		__mmdrop(mm);
  }
  
- /*
-Index: linux-2.6/kernel/trace/ring_buffer.c
-===================================================================
---- linux-2.6.orig/kernel/trace/ring_buffer.c
-+++ linux-2.6/kernel/trace/ring_buffer.c
-@@ -478,7 +478,7 @@ struct ring_buffer_per_cpu {
- 	int				cpu;
- 	atomic_t			record_disabled;
- 	struct ring_buffer		*buffer;
--	spinlock_t			reader_lock;	/* serialize readers */
-+	raw_spinlock_t			reader_lock;	/* serialize readers */
- 	arch_spinlock_t			lock;
- 	struct lock_class_key		lock_key;
- 	struct list_head		*pages;
-@@ -1055,7 +1055,7 @@ rb_allocate_cpu_buffer(struct ring_buffe
- 
- 	cpu_buffer->cpu = cpu;
- 	cpu_buffer->buffer = buffer;
--	spin_lock_init(&cpu_buffer->reader_lock);
-+	raw_spin_lock_init(&cpu_buffer->reader_lock);
- 	lockdep_set_class(&cpu_buffer->reader_lock, buffer->reader_lock_key);
- 	cpu_buffer->lock = (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED;
++#ifdef CONFIG_PREEMPT_RT_BASE
++extern void __mmdrop_delayed(struct rcu_head *rhp);
++static inline void mmdrop_delayed(struct mm_struct *mm)
++{
++	if (atomic_dec_and_test(&mm->mm_count))
++		call_rcu(&mm->delayed_drop, __mmdrop_delayed);
++}
++#else
++# define mmdrop_delayed(mm)	mmdrop(mm)
++#endif
++
+ /* mmput gets rid of the mappings and all user-space */
+ extern void mmput(struct mm_struct *);
+ /* Grab a reference to a task's mm, if it is not already going away */
+@@ -2510,7 +2583,7 @@ extern int _cond_resched(void);
  
-@@ -1252,7 +1252,7 @@ rb_remove_pages(struct ring_buffer_per_c
- 	struct list_head *p;
- 	unsigned i;
+ extern int __cond_resched_lock(spinlock_t *lock);
  
--	spin_lock_irq(&cpu_buffer->reader_lock);
-+	raw_spin_lock_irq(&cpu_buffer->reader_lock);
- 	rb_head_page_deactivate(cpu_buffer);
+-#ifdef CONFIG_PREEMPT
++#if defined(CONFIG_PREEMPT) && !defined(CONFIG_PREEMPT_RT_FULL)
+ #define PREEMPT_LOCK_OFFSET	PREEMPT_OFFSET
+ #else
+ #define PREEMPT_LOCK_OFFSET	0
+@@ -2521,12 +2594,16 @@ extern int __cond_resched_lock(spinlock_
+ 	__cond_resched_lock(lock);				\
+ })
  
- 	for (i = 0; i < nr_pages; i++) {
-@@ -1270,7 +1270,7 @@ rb_remove_pages(struct ring_buffer_per_c
- 	rb_check_pages(cpu_buffer);
++#ifndef CONFIG_PREEMPT_RT_FULL
+ extern int __cond_resched_softirq(void);
  
- out:
--	spin_unlock_irq(&cpu_buffer->reader_lock);
-+	raw_spin_unlock_irq(&cpu_buffer->reader_lock);
- }
+ #define cond_resched_softirq() ({					\
+ 	__might_sleep(__FILE__, __LINE__, SOFTIRQ_DISABLE_OFFSET);	\
+ 	__cond_resched_softirq();					\
+ })
++#else
++# define cond_resched_softirq()		cond_resched()
++#endif
  
- static void
-@@ -1281,7 +1281,7 @@ rb_insert_pages(struct ring_buffer_per_c
- 	struct list_head *p;
- 	unsigned i;
+ /*
+  * Does a critical section need to be broken due to another
+@@ -2550,7 +2627,7 @@ void thread_group_cputimer(struct task_s
  
--	spin_lock_irq(&cpu_buffer->reader_lock);
-+	raw_spin_lock_irq(&cpu_buffer->reader_lock);
- 	rb_head_page_deactivate(cpu_buffer);
+ static inline void thread_group_cputime_init(struct signal_struct *sig)
+ {
+-	spin_lock_init(&sig->cputimer.lock);
++	raw_spin_lock_init(&sig->cputimer.lock);
+ }
  
- 	for (i = 0; i < nr_pages; i++) {
-@@ -1296,7 +1296,7 @@ rb_insert_pages(struct ring_buffer_per_c
- 	rb_check_pages(cpu_buffer);
+ /*
+@@ -2589,6 +2666,26 @@ static inline void set_task_cpu(struct t
  
- out:
--	spin_unlock_irq(&cpu_buffer->reader_lock);
-+	raw_spin_unlock_irq(&cpu_buffer->reader_lock);
- }
+ #endif /* CONFIG_SMP */
  
- /**
-@@ -2790,9 +2790,9 @@ void ring_buffer_iter_reset(struct ring_
++static inline int __migrate_disabled(struct task_struct *p)
++{
++#ifdef CONFIG_PREEMPT_RT_FULL
++	return p->migrate_disable;
++#else
++	return 0;
++#endif
++}
++
++/* Future-safe accessor for struct task_struct's cpus_allowed. */
++static inline const struct cpumask *tsk_cpus_allowed(struct task_struct *p)
++{
++#ifdef CONFIG_PREEMPT_RT_FULL
++	if (p->migrate_disable)
++		return cpumask_of(task_cpu(p));
++#endif
++
++	return &p->cpus_allowed;
++}
++
+ extern long sched_setaffinity(pid_t pid, const struct cpumask *new_mask);
+ extern long sched_getaffinity(pid_t pid, struct cpumask *mask);
  
- 	cpu_buffer = iter->cpu_buffer;
+Index: linux-2.6/kernel/posix-cpu-timers.c
+===================================================================
+--- linux-2.6.orig/kernel/posix-cpu-timers.c
++++ linux-2.6/kernel/posix-cpu-timers.c
+@@ -274,7 +274,7 @@ void thread_group_cputimer(struct task_s
+ 	struct task_cputime sum;
+ 	unsigned long flags;
  
--	spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
-+	raw_spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
- 	rb_iter_reset(iter);
--	spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
-+	raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
+-	spin_lock_irqsave(&cputimer->lock, flags);
++	raw_spin_lock_irqsave(&cputimer->lock, flags);
+ 	if (!cputimer->running) {
+ 		cputimer->running = 1;
+ 		/*
+@@ -287,7 +287,7 @@ void thread_group_cputimer(struct task_s
+ 		update_gt_cputime(&cputimer->cputime, &sum);
+ 	}
+ 	*times = cputimer->cputime;
+-	spin_unlock_irqrestore(&cputimer->lock, flags);
++	raw_spin_unlock_irqrestore(&cputimer->lock, flags);
  }
- EXPORT_SYMBOL_GPL(ring_buffer_iter_reset);
  
-@@ -3251,12 +3251,12 @@ ring_buffer_peek(struct ring_buffer *buf
-  again:
- 	local_irq_save(flags);
- 	if (dolock)
--		spin_lock(&cpu_buffer->reader_lock);
-+		raw_spin_lock(&cpu_buffer->reader_lock);
- 	event = rb_buffer_peek(cpu_buffer, ts, lost_events);
- 	if (event && event->type_len == RINGBUF_TYPE_PADDING)
- 		rb_advance_reader(cpu_buffer);
- 	if (dolock)
--		spin_unlock(&cpu_buffer->reader_lock);
-+		raw_spin_unlock(&cpu_buffer->reader_lock);
- 	local_irq_restore(flags);
+ /*
+@@ -699,7 +699,7 @@ static int posix_cpu_timer_set(struct k_
+ 	/*
+ 	 * Disarm any old timer after extracting its expiry time.
+ 	 */
+-	BUG_ON(!irqs_disabled());
++	BUG_ON_NONRT(!irqs_disabled());
  
- 	if (event && event->type_len == RINGBUF_TYPE_PADDING)
-@@ -3281,9 +3281,9 @@ ring_buffer_iter_peek(struct ring_buffer
+ 	ret = 0;
+ 	old_incr = timer->it.cpu.incr;
+@@ -997,9 +997,9 @@ static void stop_process_timers(struct s
+ 	struct thread_group_cputimer *cputimer = &sig->cputimer;
  	unsigned long flags;
  
-  again:
--	spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
-+	raw_spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
- 	event = rb_iter_peek(iter, ts);
--	spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
-+	raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
+-	spin_lock_irqsave(&cputimer->lock, flags);
++	raw_spin_lock_irqsave(&cputimer->lock, flags);
+ 	cputimer->running = 0;
+-	spin_unlock_irqrestore(&cputimer->lock, flags);
++	raw_spin_unlock_irqrestore(&cputimer->lock, flags);
+ }
  
- 	if (event && event->type_len == RINGBUF_TYPE_PADDING)
- 		goto again;
-@@ -3323,7 +3323,7 @@ ring_buffer_consume(struct ring_buffer *
- 	cpu_buffer = buffer->buffers[cpu];
- 	local_irq_save(flags);
- 	if (dolock)
--		spin_lock(&cpu_buffer->reader_lock);
-+		raw_spin_lock(&cpu_buffer->reader_lock);
+ static u32 onecputick;
+@@ -1221,7 +1221,7 @@ void posix_cpu_timer_schedule(struct k_i
+ 	/*
+ 	 * Now re-arm for the new expiry time.
+ 	 */
+-	BUG_ON(!irqs_disabled());
++	BUG_ON_NONRT(!irqs_disabled());
+ 	arm_timer(timer);
+ 	spin_unlock(&p->sighand->siglock);
  
- 	event = rb_buffer_peek(cpu_buffer, ts, lost_events);
- 	if (event) {
-@@ -3332,7 +3332,7 @@ ring_buffer_consume(struct ring_buffer *
- 	}
+@@ -1288,10 +1288,11 @@ static inline int fastpath_timer_check(s
+ 	sig = tsk->signal;
+ 	if (sig->cputimer.running) {
+ 		struct task_cputime group_sample;
++		unsigned long flags;
  
- 	if (dolock)
--		spin_unlock(&cpu_buffer->reader_lock);
-+		raw_spin_unlock(&cpu_buffer->reader_lock);
- 	local_irq_restore(flags);
+-		spin_lock(&sig->cputimer.lock);
++		raw_spin_lock_irqsave(&sig->cputimer.lock, flags);
+ 		group_sample = sig->cputimer.cputime;
+-		spin_unlock(&sig->cputimer.lock);
++		raw_spin_unlock_irqrestore(&sig->cputimer.lock, flags);
  
-  out:
-@@ -3424,11 +3424,11 @@ ring_buffer_read_start(struct ring_buffe
+ 		if (task_cputime_expired(&group_sample, &sig->cputime_expires))
+ 			return 1;
+@@ -1305,13 +1306,13 @@ static inline int fastpath_timer_check(s
+  * already updated our counts.  We need to check if any timers fire now.
+  * Interrupts are disabled.
+  */
+-void run_posix_cpu_timers(struct task_struct *tsk)
++static void __run_posix_cpu_timers(struct task_struct *tsk)
+ {
+ 	LIST_HEAD(firing);
+ 	struct k_itimer *timer, *next;
+ 	unsigned long flags;
  
- 	cpu_buffer = iter->cpu_buffer;
+-	BUG_ON(!irqs_disabled());
++	BUG_ON_NONRT(!irqs_disabled());
  
--	spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
-+	raw_spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
- 	arch_spin_lock(&cpu_buffer->lock);
- 	rb_iter_reset(iter);
- 	arch_spin_unlock(&cpu_buffer->lock);
--	spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
-+	raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
+ 	/*
+ 	 * The fast path checks that there are no expired thread or thread
+@@ -1369,6 +1370,190 @@ void run_posix_cpu_timers(struct task_st
+ 	}
  }
- EXPORT_SYMBOL_GPL(ring_buffer_read_start);
  
-@@ -3463,7 +3463,7 @@ ring_buffer_read(struct ring_buffer_iter
- 	struct ring_buffer_per_cpu *cpu_buffer = iter->cpu_buffer;
- 	unsigned long flags;
++#ifdef CONFIG_PREEMPT_RT_BASE
++#include <linux/kthread.h>
++#include <linux/cpu.h>
++DEFINE_PER_CPU(struct task_struct *, posix_timer_task);
++DEFINE_PER_CPU(struct task_struct *, posix_timer_tasklist);
++
++static int posix_cpu_timers_thread(void *data)
++{
++	int cpu = (long)data;
++
++	BUG_ON(per_cpu(posix_timer_task,cpu) != current);
++
++	while (!kthread_should_stop()) {
++		struct task_struct *tsk = NULL;
++		struct task_struct *next = NULL;
++
++		if (cpu_is_offline(cpu))
++			goto wait_to_die;
++
++		/* grab task list */
++		raw_local_irq_disable();
++		tsk = per_cpu(posix_timer_tasklist, cpu);
++		per_cpu(posix_timer_tasklist, cpu) = NULL;
++		raw_local_irq_enable();
++
++		/* its possible the list is empty, just return */
++		if (!tsk) {
++			set_current_state(TASK_INTERRUPTIBLE);
++			schedule();
++			__set_current_state(TASK_RUNNING);
++			continue;
++		}
++
++		/* Process task list */
++		while (1) {
++			/* save next */
++			next = tsk->posix_timer_list;
++
++			/* run the task timers, clear its ptr and
++			 * unreference it
++			 */
++			__run_posix_cpu_timers(tsk);
++			tsk->posix_timer_list = NULL;
++			put_task_struct(tsk);
++
++			/* check if this is the last on the list */
++			if (next == tsk)
++				break;
++			tsk = next;
++		}
++	}
++	return 0;
++
++wait_to_die:
++	/* Wait for kthread_stop */
++	set_current_state(TASK_INTERRUPTIBLE);
++	while (!kthread_should_stop()) {
++		schedule();
++		set_current_state(TASK_INTERRUPTIBLE);
++	}
++	__set_current_state(TASK_RUNNING);
++	return 0;
++}
++
++static inline int __fastpath_timer_check(struct task_struct *tsk)
++{
++	/* tsk == current, ensure it is safe to use ->signal/sighand */
++	if (unlikely(tsk->exit_state))
++		return 0;
++
++	if (!task_cputime_zero(&tsk->cputime_expires))
++			return 1;
++
++	if (!task_cputime_zero(&tsk->signal->cputime_expires))
++			return 1;
++
++	return 0;
++}
++
++void run_posix_cpu_timers(struct task_struct *tsk)
++{
++	unsigned long cpu = smp_processor_id();
++	struct task_struct *tasklist;
++
++	BUG_ON(!irqs_disabled());
++	if(!per_cpu(posix_timer_task, cpu))
++		return;
++	/* get per-cpu references */
++	tasklist = per_cpu(posix_timer_tasklist, cpu);
++
++	/* check to see if we're already queued */
++	if (!tsk->posix_timer_list && __fastpath_timer_check(tsk)) {
++		get_task_struct(tsk);
++		if (tasklist) {
++			tsk->posix_timer_list = tasklist;
++		} else {
++			/*
++			 * The list is terminated by a self-pointing
++			 * task_struct
++			 */
++			tsk->posix_timer_list = tsk;
++		}
++		per_cpu(posix_timer_tasklist, cpu) = tsk;
++
++		wake_up_process(per_cpu(posix_timer_task, cpu));
++	}
++}
++
++/*
++ * posix_cpu_thread_call - callback that gets triggered when a CPU is added.
++ * Here we can start up the necessary migration thread for the new CPU.
++ */
++static int posix_cpu_thread_call(struct notifier_block *nfb,
++				 unsigned long action, void *hcpu)
++{
++	int cpu = (long)hcpu;
++	struct task_struct *p;
++	struct sched_param param;
++
++	switch (action) {
++	case CPU_UP_PREPARE:
++		p = kthread_create(posix_cpu_timers_thread, hcpu,
++					"posixcputmr/%d",cpu);
++		if (IS_ERR(p))
++			return NOTIFY_BAD;
++		p->flags |= PF_NOFREEZE;
++		kthread_bind(p, cpu);
++		/* Must be high prio to avoid getting starved */
++		param.sched_priority = MAX_RT_PRIO-1;
++		sched_setscheduler(p, SCHED_FIFO, &param);
++		per_cpu(posix_timer_task,cpu) = p;
++		break;
++	case CPU_ONLINE:
++		/* Strictly unneccessary, as first user will wake it. */
++		wake_up_process(per_cpu(posix_timer_task,cpu));
++		break;
++#ifdef CONFIG_HOTPLUG_CPU
++	case CPU_UP_CANCELED:
++		/* Unbind it from offline cpu so it can run.  Fall thru. */
++		kthread_bind(per_cpu(posix_timer_task,cpu),
++			     any_online_cpu(cpu_online_map));
++		kthread_stop(per_cpu(posix_timer_task,cpu));
++		per_cpu(posix_timer_task,cpu) = NULL;
++		break;
++	case CPU_DEAD:
++		kthread_stop(per_cpu(posix_timer_task,cpu));
++		per_cpu(posix_timer_task,cpu) = NULL;
++		break;
++#endif
++	}
++	return NOTIFY_OK;
++}
++
++/* Register at highest priority so that task migration (migrate_all_tasks)
++ * happens before everything else.
++ */
++static struct notifier_block __devinitdata posix_cpu_thread_notifier = {
++	.notifier_call = posix_cpu_thread_call,
++	.priority = 10
++};
++
++static int __init posix_cpu_thread_init(void)
++{
++	void *hcpu = (void *)(long)smp_processor_id();
++	/* Start one for boot CPU. */
++	unsigned long cpu;
++
++	/* init the per-cpu posix_timer_tasklets */
++	for_each_cpu_mask(cpu, cpu_possible_map)
++		per_cpu(posix_timer_tasklist, cpu) = NULL;
++
++	posix_cpu_thread_call(&posix_cpu_thread_notifier, CPU_UP_PREPARE, hcpu);
++	posix_cpu_thread_call(&posix_cpu_thread_notifier, CPU_ONLINE, hcpu);
++	register_cpu_notifier(&posix_cpu_thread_notifier);
++	return 0;
++}
++early_initcall(posix_cpu_thread_init);
++#else /* CONFIG_PREEMPT_RT_BASE */
++void run_posix_cpu_timers(struct task_struct *tsk)
++{
++	__run_posix_cpu_timers(tsk);
++}
++#endif /* CONFIG_PREEMPT_RT_BASE */
++
+ /*
+  * Set one of the process-wide special case CPU timers or RLIMIT_CPU.
+  * The tsk->sighand->siglock must be held by the caller.
+Index: linux-2.6/kernel/sched_stats.h
+===================================================================
+--- linux-2.6.orig/kernel/sched_stats.h
++++ linux-2.6/kernel/sched_stats.h
+@@ -282,10 +282,10 @@ static inline void account_group_user_ti
+ 	if (!cputimer->running)
+ 		return;
  
--	spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
-+	raw_spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
-  again:
- 	event = rb_iter_peek(iter, ts);
- 	if (!event)
-@@ -3474,7 +3474,7 @@ ring_buffer_read(struct ring_buffer_iter
+-	spin_lock(&cputimer->lock);
++	raw_spin_lock(&cputimer->lock);
+ 	cputimer->cputime.utime =
+ 		cputime_add(cputimer->cputime.utime, cputime);
+-	spin_unlock(&cputimer->lock);
++	raw_spin_unlock(&cputimer->lock);
+ }
  
- 	rb_advance_iter(iter);
-  out:
--	spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
-+	raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
+ /**
+@@ -306,10 +306,10 @@ static inline void account_group_system_
+ 	if (!cputimer->running)
+ 		return;
  
- 	return event;
+-	spin_lock(&cputimer->lock);
++	raw_spin_lock(&cputimer->lock);
+ 	cputimer->cputime.stime =
+ 		cputime_add(cputimer->cputime.stime, cputime);
+-	spin_unlock(&cputimer->lock);
++	raw_spin_unlock(&cputimer->lock);
  }
-@@ -3543,7 +3543,7 @@ void ring_buffer_reset_cpu(struct ring_b
  
- 	atomic_inc(&cpu_buffer->record_disabled);
+ /**
+@@ -330,7 +330,7 @@ static inline void account_group_exec_ru
+ 	if (!cputimer->running)
+ 		return;
  
--	spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
-+	raw_spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
+-	spin_lock(&cputimer->lock);
++	raw_spin_lock(&cputimer->lock);
+ 	cputimer->cputime.sum_exec_runtime += ns;
+-	spin_unlock(&cputimer->lock);
++	raw_spin_unlock(&cputimer->lock);
+ }
+Index: linux-2.6/include/linux/semaphore.h
+===================================================================
+--- linux-2.6.orig/include/linux/semaphore.h
++++ linux-2.6/include/linux/semaphore.h
+@@ -14,14 +14,14 @@
  
- 	if (RB_WARN_ON(cpu_buffer, local_read(&cpu_buffer->committing)))
- 		goto out;
-@@ -3555,7 +3555,7 @@ void ring_buffer_reset_cpu(struct ring_b
- 	arch_spin_unlock(&cpu_buffer->lock);
- 
-  out:
--	spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
-+	raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
+ /* Please don't access any members of this structure directly */
+ struct semaphore {
+-	spinlock_t		lock;
++	raw_spinlock_t		lock;
+ 	unsigned int		count;
+ 	struct list_head	wait_list;
+ };
  
- 	atomic_dec(&cpu_buffer->record_disabled);
+ #define __SEMAPHORE_INITIALIZER(name, n)				\
+ {									\
+-	.lock		= __SPIN_LOCK_UNLOCKED((name).lock),		\
++	.lock		= __RAW_SPIN_LOCK_UNLOCKED((name).lock),	\
+ 	.count		= n,						\
+ 	.wait_list	= LIST_HEAD_INIT((name).wait_list),		\
  }
-@@ -3593,10 +3593,10 @@ int ring_buffer_empty(struct ring_buffer
- 		cpu_buffer = buffer->buffers[cpu];
- 		local_irq_save(flags);
- 		if (dolock)
--			spin_lock(&cpu_buffer->reader_lock);
-+			raw_spin_lock(&cpu_buffer->reader_lock);
- 		ret = rb_per_cpu_empty(cpu_buffer);
- 		if (dolock)
--			spin_unlock(&cpu_buffer->reader_lock);
-+			raw_spin_unlock(&cpu_buffer->reader_lock);
- 		local_irq_restore(flags);
- 
- 		if (!ret)
-@@ -3627,10 +3627,10 @@ int ring_buffer_empty_cpu(struct ring_bu
- 	cpu_buffer = buffer->buffers[cpu];
- 	local_irq_save(flags);
- 	if (dolock)
--		spin_lock(&cpu_buffer->reader_lock);
-+		raw_spin_lock(&cpu_buffer->reader_lock);
- 	ret = rb_per_cpu_empty(cpu_buffer);
- 	if (dolock)
--		spin_unlock(&cpu_buffer->reader_lock);
-+		raw_spin_unlock(&cpu_buffer->reader_lock);
- 	local_irq_restore(flags);
- 
- 	return ret;
-@@ -3826,7 +3826,7 @@ int ring_buffer_read_page(struct ring_bu
- 	if (!bpage)
- 		goto out;
- 
--	spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
-+	raw_spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
- 
- 	reader = rb_get_reader_page(cpu_buffer);
- 	if (!reader)
-@@ -3949,7 +3949,7 @@ int ring_buffer_read_page(struct ring_bu
- 		memset(&bpage->data[commit], 0, BUF_PAGE_SIZE - commit);
- 
-  out_unlock:
--	spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
-+	raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
- 
-  out:
- 	return ret;
-Index: linux-2.6/kernel/trace/trace.c
+Index: linux-2.6/kernel/semaphore.c
 ===================================================================
---- linux-2.6.orig/kernel/trace/trace.c
-+++ linux-2.6/kernel/trace/trace.c
-@@ -341,7 +341,7 @@ unsigned long trace_flags = TRACE_ITER_P
- 	TRACE_ITER_GRAPH_TIME | TRACE_ITER_RECORD_CMD | TRACE_ITER_OVERWRITE;
- 
- static int trace_stop_count;
--static DEFINE_SPINLOCK(tracing_start_lock);
-+static DEFINE_RAW_SPINLOCK(tracing_start_lock);
- 
- /**
-  * trace_wake_up - wake up tasks waiting for trace input
-@@ -351,6 +351,7 @@ static DEFINE_SPINLOCK(tracing_start_loc
-  */
- void trace_wake_up(void)
+--- linux-2.6.orig/kernel/semaphore.c
++++ linux-2.6/kernel/semaphore.c
+@@ -54,12 +54,12 @@ void down(struct semaphore *sem)
  {
-+#ifndef CONFIG_PREEMPT_RT_FULL
- 	int cpu;
- 
- 	if (trace_flags & TRACE_ITER_BLOCK)
-@@ -363,6 +364,7 @@ void trace_wake_up(void)
- 	if (!runqueue_is_locked(cpu))
- 		wake_up(&trace_wait);
- 	put_cpu();
-+#endif
- }
+ 	unsigned long flags;
  
- static int __init set_buf_size(char *str)
-@@ -716,6 +718,12 @@ update_max_tr_single(struct trace_array 
+-	spin_lock_irqsave(&sem->lock, flags);
++	raw_spin_lock_irqsave(&sem->lock, flags);
+ 	if (likely(sem->count > 0))
+ 		sem->count--;
+ 	else
+ 		__down(sem);
+-	spin_unlock_irqrestore(&sem->lock, flags);
++	raw_spin_unlock_irqrestore(&sem->lock, flags);
  }
- #endif /* CONFIG_TRACER_MAX_TRACE */
+ EXPORT_SYMBOL(down);
  
-+#ifndef CONFIG_PREEMPT_RT_FULL
-+static void default_wait_pipe(struct trace_iterator *iter);
-+#else
-+#define default_wait_pipe	poll_wait_pipe
-+#endif
-+
- /**
-  * register_tracer - register a tracer with the ftrace system.
-  * @type - the plugin for the tracer
-@@ -958,7 +966,7 @@ void tracing_start(void)
- 	if (tracing_disabled)
- 		return;
+@@ -77,12 +77,12 @@ int down_interruptible(struct semaphore 
+ 	unsigned long flags;
+ 	int result = 0;
  
--	spin_lock_irqsave(&tracing_start_lock, flags);
-+	raw_spin_lock_irqsave(&tracing_start_lock, flags);
- 	if (--trace_stop_count) {
- 		if (trace_stop_count < 0) {
- 			/* Someone screwed up their debugging */
-@@ -983,7 +991,7 @@ void tracing_start(void)
+-	spin_lock_irqsave(&sem->lock, flags);
++	raw_spin_lock_irqsave(&sem->lock, flags);
+ 	if (likely(sem->count > 0))
+ 		sem->count--;
+ 	else
+ 		result = __down_interruptible(sem);
+-	spin_unlock_irqrestore(&sem->lock, flags);
++	raw_spin_unlock_irqrestore(&sem->lock, flags);
  
- 	ftrace_start();
-  out:
--	spin_unlock_irqrestore(&tracing_start_lock, flags);
-+	raw_spin_unlock_irqrestore(&tracing_start_lock, flags);
+ 	return result;
  }
- 
- /**
-@@ -998,7 +1006,7 @@ void tracing_stop(void)
+@@ -103,12 +103,12 @@ int down_killable(struct semaphore *sem)
  	unsigned long flags;
+ 	int result = 0;
  
- 	ftrace_stop();
--	spin_lock_irqsave(&tracing_start_lock, flags);
-+	raw_spin_lock_irqsave(&tracing_start_lock, flags);
- 	if (trace_stop_count++)
- 		goto out;
- 
-@@ -1016,7 +1024,7 @@ void tracing_stop(void)
- 	arch_spin_unlock(&ftrace_max_lock);
+-	spin_lock_irqsave(&sem->lock, flags);
++	raw_spin_lock_irqsave(&sem->lock, flags);
+ 	if (likely(sem->count > 0))
+ 		sem->count--;
+ 	else
+ 		result = __down_killable(sem);
+-	spin_unlock_irqrestore(&sem->lock, flags);
++	raw_spin_unlock_irqrestore(&sem->lock, flags);
  
-  out:
--	spin_unlock_irqrestore(&tracing_start_lock, flags);
-+	raw_spin_unlock_irqrestore(&tracing_start_lock, flags);
+ 	return result;
  }
+@@ -132,11 +132,11 @@ int down_trylock(struct semaphore *sem)
+ 	unsigned long flags;
+ 	int count;
  
- void trace_stop_cmdline_recording(void);
-@@ -1120,6 +1128,8 @@ tracing_generic_entry_update(struct trac
- 		((pc & HARDIRQ_MASK) ? TRACE_FLAG_HARDIRQ : 0) |
- 		((pc & SOFTIRQ_MASK) ? TRACE_FLAG_SOFTIRQ : 0) |
- 		(need_resched() ? TRACE_FLAG_NEED_RESCHED : 0);
-+
-+	entry->migrate_disable	= (tsk) ? __migrate_disabled(tsk) & 0xFF : 0;
- }
- EXPORT_SYMBOL_GPL(tracing_generic_entry_update);
+-	spin_lock_irqsave(&sem->lock, flags);
++	raw_spin_lock_irqsave(&sem->lock, flags);
+ 	count = sem->count - 1;
+ 	if (likely(count >= 0))
+ 		sem->count = count;
+-	spin_unlock_irqrestore(&sem->lock, flags);
++	raw_spin_unlock_irqrestore(&sem->lock, flags);
  
-@@ -1757,9 +1767,10 @@ static void print_lat_help_header(struct
- 	seq_puts(m, "#                | / _----=> need-resched    \n");
- 	seq_puts(m, "#                || / _---=> hardirq/softirq \n");
- 	seq_puts(m, "#                ||| / _--=> preempt-depth   \n");
--	seq_puts(m, "#                |||| /     delay             \n");
--	seq_puts(m, "#  cmd     pid   ||||| time  |   caller      \n");
--	seq_puts(m, "#     \\   /      |||||  \\    |   /           \n");
-+	seq_puts(m, "#                |||| / _--=> migrate-disable\n");
-+	seq_puts(m, "#                ||||| /     delay           \n");
-+	seq_puts(m, "#  cmd     pid   |||||| time  |   caller     \n");
-+	seq_puts(m, "#     \\   /      |||||  \\   |   /          \n");
+ 	return (count < 0);
  }
+@@ -157,12 +157,12 @@ int down_timeout(struct semaphore *sem, 
+ 	unsigned long flags;
+ 	int result = 0;
  
- static void print_func_help_header(struct seq_file *m)
-@@ -3067,6 +3078,7 @@ static int tracing_release_pipe(struct i
- 	return 0;
- }
+-	spin_lock_irqsave(&sem->lock, flags);
++	raw_spin_lock_irqsave(&sem->lock, flags);
+ 	if (likely(sem->count > 0))
+ 		sem->count--;
+ 	else
+ 		result = __down_timeout(sem, jiffies);
+-	spin_unlock_irqrestore(&sem->lock, flags);
++	raw_spin_unlock_irqrestore(&sem->lock, flags);
  
-+#ifndef CONFIG_PREEMPT_RT_FULL
- static unsigned int
- tracing_poll_pipe(struct file *filp, poll_table *poll_table)
- {
-@@ -3088,8 +3100,7 @@ tracing_poll_pipe(struct file *filp, pol
- 	}
+ 	return result;
  }
- 
--
--void default_wait_pipe(struct trace_iterator *iter)
-+static void default_wait_pipe(struct trace_iterator *iter)
+@@ -179,12 +179,12 @@ void up(struct semaphore *sem)
  {
- 	DEFINE_WAIT(wait);
- 
-@@ -3100,6 +3111,20 @@ void default_wait_pipe(struct trace_iter
+ 	unsigned long flags;
  
- 	finish_wait(&trace_wait, &wait);
+-	spin_lock_irqsave(&sem->lock, flags);
++	raw_spin_lock_irqsave(&sem->lock, flags);
+ 	if (likely(list_empty(&sem->wait_list)))
+ 		sem->count++;
+ 	else
+ 		__up(sem);
+-	spin_unlock_irqrestore(&sem->lock, flags);
++	raw_spin_unlock_irqrestore(&sem->lock, flags);
  }
-+#else
-+static unsigned int
-+tracing_poll_pipe(struct file *filp, poll_table *poll_table)
-+{
-+	struct trace_iterator *iter = filp->private_data;
-+
-+	if ((trace_flags & TRACE_ITER_BLOCK) || !trace_empty(iter))
-+		return POLLIN | POLLRDNORM;
-+	poll_wait_pipe(iter);
-+	if (!trace_empty(iter))
-+		return POLLIN | POLLRDNORM;
-+	return 0;
-+}
-+#endif
+ EXPORT_SYMBOL(up);
  
- /*
-  * This is a make-shift waitqueue.
-Index: linux-2.6/kernel/trace/trace_irqsoff.c
-===================================================================
---- linux-2.6.orig/kernel/trace/trace_irqsoff.c
-+++ linux-2.6/kernel/trace/trace_irqsoff.c
-@@ -17,13 +17,14 @@
- #include <linux/fs.h>
- 
- #include "trace.h"
-+#include <trace/events/hist.h>
+@@ -217,9 +217,9 @@ static inline int __sched __down_common(
+ 		if (timeout <= 0)
+ 			goto timed_out;
+ 		__set_task_state(task, state);
+-		spin_unlock_irq(&sem->lock);
++		raw_spin_unlock_irq(&sem->lock);
+ 		timeout = schedule_timeout(timeout);
+-		spin_lock_irq(&sem->lock);
++		raw_spin_lock_irq(&sem->lock);
+ 		if (waiter.up)
+ 			return 0;
+ 	}
+Index: linux-2.6/include/linux/rwsem-spinlock.h
+===================================================================
+--- linux-2.6.orig/include/linux/rwsem-spinlock.h
++++ linux-2.6/include/linux/rwsem-spinlock.h
+@@ -20,26 +20,42 @@
+  * - if activity is -1 then there is one active writer
+  * - if wait_list is not empty, then there are processes waiting for the semaphore
+  */
++struct rw_anon_semaphore {
++	__s32			activity;
++	raw_spinlock_t		wait_lock;
++	struct list_head	wait_list;
++#ifdef CONFIG_DEBUG_LOCK_ALLOC
++	struct lockdep_map dep_map;
++#endif
++};
++
++#ifndef CONFIG_PREEMPT_RT_FULL
++/*
++ * Non preempt-rt implementation of rw_semaphore. Same as above, but
++ * restricted vs. ownership. i.e. ownerless locked state and non owner
++ * release not allowed.
++ */
+ struct rw_semaphore {
+ 	__s32			activity;
+-	spinlock_t		wait_lock;
++	raw_spinlock_t		wait_lock;
+ 	struct list_head	wait_list;
+ #ifdef CONFIG_DEBUG_LOCK_ALLOC
+ 	struct lockdep_map dep_map;
+ #endif
+ };
++#endif /* PREEMPT_RT_FULL */
  
- static struct trace_array		*irqsoff_trace __read_mostly;
- static int				tracer_enabled __read_mostly;
+ #define RWSEM_UNLOCKED_VALUE		0x00000000
  
- static DEFINE_PER_CPU(int, tracing_cpu);
+-extern void __down_read(struct rw_semaphore *sem);
+-extern int __down_read_trylock(struct rw_semaphore *sem);
+-extern void __down_write(struct rw_semaphore *sem);
+-extern void __down_write_nested(struct rw_semaphore *sem, int subclass);
+-extern int __down_write_trylock(struct rw_semaphore *sem);
+-extern void __up_read(struct rw_semaphore *sem);
+-extern void __up_write(struct rw_semaphore *sem);
+-extern void __downgrade_write(struct rw_semaphore *sem);
+-extern int rwsem_is_locked(struct rw_semaphore *sem);
++extern void __down_read(struct rw_anon_semaphore *sem);
++extern int __down_read_trylock(struct rw_anon_semaphore *sem);
++extern void __down_write(struct rw_anon_semaphore *sem);
++extern void __down_write_nested(struct rw_anon_semaphore *sem, int subclass);
++extern int __down_write_trylock(struct rw_anon_semaphore *sem);
++extern void __up_read(struct rw_anon_semaphore *sem);
++extern void __up_write(struct rw_anon_semaphore *sem);
++extern void __downgrade_write(struct rw_anon_semaphore *sem);
++extern int anon_rwsem_is_locked(struct rw_anon_semaphore *sem);
  
--static DEFINE_SPINLOCK(max_trace_lock);
-+static DEFINE_RAW_SPINLOCK(max_trace_lock);
+ #endif /* __KERNEL__ */
+ #endif /* _LINUX_RWSEM_SPINLOCK_H */
+Index: linux-2.6/include/linux/rwsem.h
+===================================================================
+--- linux-2.6.orig/include/linux/rwsem.h
++++ linux-2.6/include/linux/rwsem.h
+@@ -17,37 +17,50 @@
+ #include <asm/system.h>
+ #include <asm/atomic.h>
  
- enum {
- 	TRACER_IRQS_OFF		= (1 << 1),
-@@ -319,7 +320,7 @@ check_critical_timing(struct trace_array
- 	if (!report_latency(delta))
- 		goto out;
++struct rw_anon_semaphore;
+ struct rw_semaphore;
  
--	spin_lock_irqsave(&max_trace_lock, flags);
-+	raw_spin_lock_irqsave(&max_trace_lock, flags);
+ #ifdef CONFIG_RWSEM_GENERIC_SPINLOCK
+ #include <linux/rwsem-spinlock.h> /* use a generic implementation */
+-#else
++#else /* RWSEM_GENERIC_SPINLOCK */
++
+ /* All arch specific implementations share the same struct */
+-struct rw_semaphore {
++struct rw_anon_semaphore {
+ 	long			count;
+-	spinlock_t		wait_lock;
++	raw_spinlock_t		wait_lock;
+ 	struct list_head	wait_list;
+ #ifdef CONFIG_DEBUG_LOCK_ALLOC
+ 	struct lockdep_map	dep_map;
+ #endif
+ };
  
- 	/* check if we are still the max latency */
- 	if (!report_latency(delta))
-@@ -342,7 +343,7 @@ check_critical_timing(struct trace_array
- 	max_sequence++;
+-extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *sem);
+-extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem);
+-extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *);
+-extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem);
++extern struct rw_anon_semaphore *rwsem_down_read_failed(struct rw_anon_semaphore *sem);
++extern struct rw_anon_semaphore *rwsem_down_write_failed(struct rw_anon_semaphore *sem);
++extern struct rw_anon_semaphore *rwsem_wake(struct rw_anon_semaphore *);
++extern struct rw_anon_semaphore *rwsem_downgrade_wake(struct rw_anon_semaphore *sem);
  
- out_unlock:
--	spin_unlock_irqrestore(&max_trace_lock, flags);
-+	raw_spin_unlock_irqrestore(&max_trace_lock, flags);
+ /* Include the arch specific part */
+ #include <asm/rwsem.h>
  
- out:
- 	data->critical_sequence = max_sequence;
-@@ -424,11 +425,13 @@ void start_critical_timings(void)
+ /* In all implementations count != 0 means locked */
+-static inline int rwsem_is_locked(struct rw_semaphore *sem)
++static inline int anon_rwsem_is_locked(struct rw_anon_semaphore *sem)
  {
- 	if (preempt_trace() || irq_trace())
- 		start_critical_timing(CALLER_ADDR0, CALLER_ADDR1);
-+	trace_preemptirqsoff_hist(TRACE_START, 1);
+ 	return sem->count != 0;
  }
- EXPORT_SYMBOL_GPL(start_critical_timings);
  
- void stop_critical_timings(void)
- {
-+	trace_preemptirqsoff_hist(TRACE_STOP, 0);
- 	if (preempt_trace() || irq_trace())
- 		stop_critical_timing(CALLER_ADDR0, CALLER_ADDR1);
- }
-@@ -438,6 +441,7 @@ EXPORT_SYMBOL_GPL(stop_critical_timings)
- #ifdef CONFIG_PROVE_LOCKING
- void time_hardirqs_on(unsigned long a0, unsigned long a1)
- {
-+	trace_preemptirqsoff_hist(IRQS_ON, 0);
- 	if (!preempt_trace() && irq_trace())
- 		stop_critical_timing(a0, a1);
- }
-@@ -446,6 +450,7 @@ void time_hardirqs_off(unsigned long a0,
- {
- 	if (!preempt_trace() && irq_trace())
- 		start_critical_timing(a0, a1);
-+	trace_preemptirqsoff_hist(IRQS_OFF, 1);
- }
++#ifndef CONFIG_PREEMPT_RT_FULL
++struct rw_semaphore {
++	long			count;
++	raw_spinlock_t		wait_lock;
++	struct list_head	wait_list;
++#ifdef CONFIG_DEBUG_LOCK_ALLOC
++	struct lockdep_map	dep_map;
++#endif
++};
+ #endif
  
- #else /* !CONFIG_PROVE_LOCKING */
-@@ -471,6 +476,7 @@ inline void print_irqtrace_events(struct
-  */
- void trace_hardirqs_on(void)
- {
-+	trace_preemptirqsoff_hist(IRQS_ON, 0);
- 	if (!preempt_trace() && irq_trace())
- 		stop_critical_timing(CALLER_ADDR0, CALLER_ADDR1);
- }
-@@ -480,11 +486,13 @@ void trace_hardirqs_off(void)
- {
- 	if (!preempt_trace() && irq_trace())
- 		start_critical_timing(CALLER_ADDR0, CALLER_ADDR1);
-+	trace_preemptirqsoff_hist(IRQS_OFF, 1);
- }
- EXPORT_SYMBOL(trace_hardirqs_off);
++#endif /* !RWSEM_GENERIC_SPINLOCK */
++
+ /* Common initializer macros and functions */
  
- void trace_hardirqs_on_caller(unsigned long caller_addr)
- {
-+	trace_preemptirqsoff_hist(IRQS_ON, 0);
- 	if (!preempt_trace() && irq_trace())
- 		stop_critical_timing(CALLER_ADDR0, caller_addr);
- }
-@@ -494,6 +502,7 @@ void trace_hardirqs_off_caller(unsigned 
- {
- 	if (!preempt_trace() && irq_trace())
- 		start_critical_timing(CALLER_ADDR0, caller_addr);
-+	trace_preemptirqsoff_hist(IRQS_OFF, 1);
- }
- EXPORT_SYMBOL(trace_hardirqs_off_caller);
+ #ifdef CONFIG_DEBUG_LOCK_ALLOC
+@@ -56,57 +69,59 @@ static inline int rwsem_is_locked(struct
+ # define __RWSEM_DEP_MAP_INIT(lockname)
+ #endif
  
-@@ -503,12 +512,14 @@ EXPORT_SYMBOL(trace_hardirqs_off_caller)
- #ifdef CONFIG_PREEMPT_TRACER
- void trace_preempt_on(unsigned long a0, unsigned long a1)
- {
-+	trace_preemptirqsoff_hist(PREEMPT_ON, 0);
- 	if (preempt_trace())
- 		stop_critical_timing(a0, a1);
- }
+-#define __RWSEM_INITIALIZER(name) \
+-	{ RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED(name.wait_lock),	\
+-	  LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) }
++#define __RWSEM_ANON_INITIALIZER(name)			\
++	{ RWSEM_UNLOCKED_VALUE,				\
++	  __RAW_SPIN_LOCK_UNLOCKED(name.wait_lock),	\
++	  LIST_HEAD_INIT((name).wait_list)		\
++	  __RWSEM_DEP_MAP_INIT(name) }
  
- void trace_preempt_off(unsigned long a0, unsigned long a1)
- {
-+	trace_preemptirqsoff_hist(PREEMPT_OFF, 1);
- 	if (preempt_trace())
- 		start_critical_timing(a0, a1);
- }
-Index: linux-2.6/include/linux/ratelimit.h
-===================================================================
---- linux-2.6.orig/include/linux/ratelimit.h
-+++ linux-2.6/include/linux/ratelimit.h
-@@ -8,7 +8,7 @@
- #define DEFAULT_RATELIMIT_BURST		10
+-#define DECLARE_RWSEM(name) \
+-	struct rw_semaphore name = __RWSEM_INITIALIZER(name)
++#define DECLARE_ANON_RWSEM(name) \
++	struct rw_anon_semaphore name = __RWSEM_INITIALIZER(name)
  
- struct ratelimit_state {
--	spinlock_t	lock;		/* protect the state */
-+	raw_spinlock_t	lock;		/* protect the state */
+-extern void __init_rwsem(struct rw_semaphore *sem, const char *name,
+-			 struct lock_class_key *key);
++extern void __init_anon_rwsem(struct rw_anon_semaphore *sem, const char *name,
++			      struct lock_class_key *key);
  
- 	int		interval;
- 	int		burst;
-@@ -20,7 +20,7 @@ struct ratelimit_state {
- #define DEFINE_RATELIMIT_STATE(name, interval_init, burst_init)		\
- 									\
- 	struct ratelimit_state name = {					\
--		.lock		= __SPIN_LOCK_UNLOCKED(name.lock),	\
-+		.lock		= __RAW_SPIN_LOCK_UNLOCKED(name.lock),	\
- 		.interval	= interval_init,			\
- 		.burst		= burst_init,				\
- 	}
-@@ -28,7 +28,7 @@ struct ratelimit_state {
- static inline void ratelimit_state_init(struct ratelimit_state *rs,
- 					int interval, int burst)
- {
--	spin_lock_init(&rs->lock);
-+	raw_spin_lock_init(&rs->lock);
- 	rs->interval = interval;
- 	rs->burst = burst;
- 	rs->printed = 0;
-Index: linux-2.6/kernel/printk.c
-===================================================================
---- linux-2.6.orig/kernel/printk.c
-+++ linux-2.6/kernel/printk.c
-@@ -44,13 +44,6 @@
+-#define init_rwsem(sem)						\
++#define init_anon_rwsem(sem)					\
+ do {								\
+ 	static struct lock_class_key __key;			\
+ 								\
+-	__init_rwsem((sem), #sem, &__key);			\
++	__init_anon_rwsem((sem), #sem, &__key);			\
+ } while (0)
  
- #include <asm/uaccess.h>
+ /*
+  * lock for reading
+  */
+-extern void down_read(struct rw_semaphore *sem);
++extern void anon_down_read(struct rw_anon_semaphore *sem);
  
--/*
-- * Architectures can override it:
-- */
--void asmlinkage __attribute__((weak)) early_printk(const char *fmt, ...)
--{
--}
--
- #define __LOG_BUF_LEN	(1 << CONFIG_LOG_BUF_SHIFT)
+ /*
+  * trylock for reading -- returns 1 if successful, 0 if contention
+  */
+-extern int down_read_trylock(struct rw_semaphore *sem);
++extern int anon_down_read_trylock(struct rw_anon_semaphore *sem);
  
- /* printk's without a loglevel use this.. */
-@@ -100,7 +93,7 @@ static int console_locked, console_suspe
-  * It is also used in interesting ways to provide interlocking in
-  * console_unlock();.
+ /*
+  * lock for writing
   */
--static DEFINE_SPINLOCK(logbuf_lock);
-+static DEFINE_RAW_SPINLOCK(logbuf_lock);
+-extern void down_write(struct rw_semaphore *sem);
++extern void anon_down_write(struct rw_anon_semaphore *sem);
  
- #define LOG_BUF_MASK (log_buf_len-1)
- #define LOG_BUF(idx) (log_buf[(idx) & LOG_BUF_MASK])
-@@ -212,7 +205,7 @@ void __init setup_log_buf(int early)
- 		return;
- 	}
+ /*
+  * trylock for writing -- returns 1 if successful, 0 if contention
+  */
+-extern int down_write_trylock(struct rw_semaphore *sem);
++extern int anon_down_write_trylock(struct rw_anon_semaphore *sem);
  
--	spin_lock_irqsave(&logbuf_lock, flags);
-+	raw_spin_lock_irqsave(&logbuf_lock, flags);
- 	log_buf_len = new_log_buf_len;
- 	log_buf = new_log_buf;
- 	new_log_buf_len = 0;
-@@ -230,7 +223,7 @@ void __init setup_log_buf(int early)
- 	log_start -= offset;
- 	con_start -= offset;
- 	log_end -= offset;
--	spin_unlock_irqrestore(&logbuf_lock, flags);
-+	raw_spin_unlock_irqrestore(&logbuf_lock, flags);
+ /*
+  * release a read lock
+  */
+-extern void up_read(struct rw_semaphore *sem);
++extern void anon_up_read(struct rw_anon_semaphore *sem);
  
- 	pr_info("log_buf_len: %d\n", log_buf_len);
- 	pr_info("early log buf free: %d(%d%%)\n",
-@@ -363,18 +356,18 @@ int do_syslog(int type, char __user *buf
- 		if (error)
- 			goto out;
- 		i = 0;
--		spin_lock_irq(&logbuf_lock);
-+		raw_spin_lock_irq(&logbuf_lock);
- 		while (!error && (log_start != log_end) && i < len) {
- 			c = LOG_BUF(log_start);
- 			log_start++;
--			spin_unlock_irq(&logbuf_lock);
-+			raw_spin_unlock_irq(&logbuf_lock);
- 			error = __put_user(c,buf);
- 			buf++;
- 			i++;
- 			cond_resched();
--			spin_lock_irq(&logbuf_lock);
-+			raw_spin_lock_irq(&logbuf_lock);
- 		}
--		spin_unlock_irq(&logbuf_lock);
-+		raw_spin_unlock_irq(&logbuf_lock);
- 		if (!error)
- 			error = i;
- 		break;
-@@ -397,7 +390,7 @@ int do_syslog(int type, char __user *buf
- 		count = len;
- 		if (count > log_buf_len)
- 			count = log_buf_len;
--		spin_lock_irq(&logbuf_lock);
-+		raw_spin_lock_irq(&logbuf_lock);
- 		if (count > logged_chars)
- 			count = logged_chars;
- 		if (do_clear)
-@@ -414,12 +407,12 @@ int do_syslog(int type, char __user *buf
- 			if (j + log_buf_len < log_end)
- 				break;
- 			c = LOG_BUF(j);
--			spin_unlock_irq(&logbuf_lock);
-+			raw_spin_unlock_irq(&logbuf_lock);
- 			error = __put_user(c,&buf[count-1-i]);
- 			cond_resched();
--			spin_lock_irq(&logbuf_lock);
-+			raw_spin_lock_irq(&logbuf_lock);
- 		}
--		spin_unlock_irq(&logbuf_lock);
-+		raw_spin_unlock_irq(&logbuf_lock);
- 		if (error)
- 			break;
- 		error = i;
-@@ -509,6 +502,7 @@ static void __call_console_drivers(unsig
- {
- 	struct console *con;
+ /*
+  * release a write lock
+  */
+-extern void up_write(struct rw_semaphore *sem);
++extern void anon_up_write(struct rw_anon_semaphore *sem);
  
-+	migrate_disable();
- 	for_each_console(con) {
- 		if (exclusive_console && con != exclusive_console)
- 			continue;
-@@ -517,8 +511,62 @@ static void __call_console_drivers(unsig
- 				(con->flags & CON_ANYTIME)))
- 			con->write(con, &LOG_BUF(start), end - start);
- 	}
-+	migrate_enable();
-+}
+ /*
+  * downgrade write lock to read lock
+  */
+-extern void downgrade_write(struct rw_semaphore *sem);
++extern void anon_downgrade_write(struct rw_anon_semaphore *sem);
+ 
+ #ifdef CONFIG_DEBUG_LOCK_ALLOC
+ /*
+@@ -122,21 +137,101 @@ extern void downgrade_write(struct rw_se
+  * lockdep_set_class() at lock initialization time.
+  * See Documentation/lockdep-design.txt for more details.)
+  */
+-extern void down_read_nested(struct rw_semaphore *sem, int subclass);
+-extern void down_write_nested(struct rw_semaphore *sem, int subclass);
++extern void anon_down_read_nested(struct rw_anon_semaphore *sem, int subclass);
++extern void anon_down_write_nested(struct rw_anon_semaphore *sem, int subclass);
+ /*
+  * Take/release a lock when not the owner will release it.
+  *
+  * [ This API should be avoided as much as possible - the
+  *   proper abstraction for this case is completions. ]
+  */
+-extern void down_read_non_owner(struct rw_semaphore *sem);
+-extern void up_read_non_owner(struct rw_semaphore *sem);
++extern void anon_down_read_non_owner(struct rw_anon_semaphore *sem);
++extern void anon_up_read_non_owner(struct rw_anon_semaphore *sem);
+ #else
+-# define down_read_nested(sem, subclass)		down_read(sem)
+-# define down_write_nested(sem, subclass)	down_write(sem)
+-# define down_read_non_owner(sem)		down_read(sem)
+-# define up_read_non_owner(sem)			up_read(sem)
++# define anon_down_read_nested(sem, subclass)	anon_down_read(sem)
++# define anon_down_write_nested(sem, subclass)	anon_down_write(sem)
++# define anon_down_read_non_owner(sem)		anon_down_read(sem)
++# define anon_up_read_non_owner(sem)		anon_up_read(sem)
+ #endif
+ 
++#ifdef CONFIG_PREEMPT_RT_FULL
++#include <linux/rwsem_rt.h>
++#else /* PREEMPT_RT_FULL */
++/*
++ * Non preempt-rt implementations
++ */
++#define __RWSEM_INITIALIZER(name)			\
++	{ RWSEM_UNLOCKED_VALUE,				\
++	  __RAW_SPIN_LOCK_UNLOCKED(name.wait_lock),	\
++	  LIST_HEAD_INIT((name).wait_list)		\
++	  __RWSEM_DEP_MAP_INIT(name) }
 +
-+#ifdef CONFIG_EARLY_PRINTK
-+struct console *early_console;
++#define DECLARE_RWSEM(name) \
++	struct rw_semaphore name = __RWSEM_INITIALIZER(name)
 +
-+static void early_vprintk(const char *fmt, va_list ap)
++static inline void __init_rwsem(struct rw_semaphore *sem, const char *name,
++				struct lock_class_key *key)
 +{
-+	char buf[512];
-+	int n = vscnprintf(buf, sizeof(buf), fmt, ap);
-+	if (early_console)
-+		early_console->write(early_console, buf, n);
++	__init_anon_rwsem((struct rw_anon_semaphore *)sem, name, key);
 +}
 +
-+asmlinkage void early_printk(const char *fmt, ...)
++#define init_rwsem(sem)						\
++do {								\
++	static struct lock_class_key __key;			\
++								\
++	__init_rwsem((sem), #sem, &__key);			\
++} while (0)
++
++static inline void down_read(struct rw_semaphore *sem)
 +{
-+	va_list ap;
-+	va_start(ap, fmt);
-+	early_vprintk(fmt, ap);
-+	va_end(ap);
++	anon_down_read((struct rw_anon_semaphore *)sem);
 +}
 +
-+/*
-+ * This is independent of any log levels - a global
-+ * kill switch that turns off all of printk.
-+ *
-+ * Used by the NMI watchdog if early-printk is enabled.
-+ */
-+static int __read_mostly printk_killswitch;
++static inline int down_read_trylock(struct rw_semaphore *sem)
++{
++	return anon_down_read_trylock((struct rw_anon_semaphore *)sem);
++}
 +
-+static int __init force_early_printk_setup(char *str)
++static inline void down_write(struct rw_semaphore *sem)
 +{
-+	printk_killswitch = 1;
-+	return 0;
++	anon_down_write((struct rw_anon_semaphore *)sem);
 +}
-+early_param("force_early_printk", force_early_printk_setup);
 +
-+void printk_kill(void)
++static inline int down_write_trylock(struct rw_semaphore *sem)
 +{
-+	printk_killswitch = 1;
- }
- 
-+static int forced_early_printk(const char *fmt, va_list ap)
++	return anon_down_write_trylock((struct rw_anon_semaphore *)sem);
++}
++
++static inline void up_read(struct rw_semaphore *sem)
 +{
-+	if (!printk_killswitch)
-+		return 0;
-+	early_vprintk(fmt, ap);
-+	return 1;
++	anon_up_read((struct rw_anon_semaphore *)sem);
 +}
-+#else
-+static inline int forced_early_printk(const char *fmt, va_list ap)
++
++static inline void up_write(struct rw_semaphore *sem)
 +{
-+	return 0;
++	anon_up_write((struct rw_anon_semaphore *)sem);
 +}
-+#endif
 +
- static int __read_mostly ignore_loglevel;
++static inline void downgrade_write(struct rw_semaphore *sem)
++{
++	anon_downgrade_write((struct rw_anon_semaphore *)sem);
++}
++
++static inline void down_read_nested(struct rw_semaphore *sem, int subclass)
++{
++	return anon_down_read_nested((struct rw_anon_semaphore *)sem, subclass);
++}
++
++static inline void down_write_nested(struct rw_semaphore *sem, int subclass)
++{
++	anon_down_write_nested((struct rw_anon_semaphore *)sem, subclass);
++}
++
++static inline int rwsem_is_locked(struct rw_semaphore *sem)
++{
++	return anon_rwsem_is_locked((struct rw_anon_semaphore *)sem);
++}
++#endif /* !PREEMPT_RT_FULL */
++
+ #endif /* _LINUX_RWSEM_H */
++
+Index: linux-2.6/lib/rwsem-spinlock.c
+===================================================================
+--- linux-2.6.orig/lib/rwsem-spinlock.c
++++ linux-2.6/lib/rwsem-spinlock.c
+@@ -17,24 +17,24 @@ struct rwsem_waiter {
+ #define RWSEM_WAITING_FOR_WRITE	0x00000002
+ };
  
- static int __init ignore_loglevel_setup(char *str)
-@@ -687,7 +735,7 @@ static void zap_locks(void)
- 	oops_timestamp = jiffies;
+-int rwsem_is_locked(struct rw_semaphore *sem)
++int anon_rwsem_is_locked(struct rw_anon_semaphore *sem)
+ {
+ 	int ret = 1;
+ 	unsigned long flags;
  
- 	/* If a crash is occurring, make sure we can't deadlock */
--	spin_lock_init(&logbuf_lock);
-+	raw_spin_lock_init(&logbuf_lock);
- 	/* And make sure that we print immediately */
- 	sema_init(&console_sem, 1);
+-	if (spin_trylock_irqsave(&sem->wait_lock, flags)) {
++	if (raw_spin_trylock_irqsave(&sem->wait_lock, flags)) {
+ 		ret = (sem->activity != 0);
+-		spin_unlock_irqrestore(&sem->wait_lock, flags);
++		raw_spin_unlock_irqrestore(&sem->wait_lock, flags);
+ 	}
+ 	return ret;
  }
-@@ -779,12 +827,18 @@ static inline int can_use_console(unsign
-  * interrupts disabled. It should return with 'lockbuf_lock'
-  * released but interrupts still disabled.
+-EXPORT_SYMBOL(rwsem_is_locked);
++EXPORT_SYMBOL(anon_rwsem_is_locked);
+ 
+ /*
+  * initialise the semaphore
   */
--static int console_trylock_for_printk(unsigned int cpu)
-+static int console_trylock_for_printk(unsigned int cpu, unsigned long flags)
- 	__releases(&logbuf_lock)
+-void __init_rwsem(struct rw_semaphore *sem, const char *name,
+-		  struct lock_class_key *key)
++void __init_anon_rwsem(struct rw_anon_semaphore *sem, const char *name,
++		       struct lock_class_key *key)
  {
-+#ifdef CONFIG_PREEMPT_RT_FULL
-+	int lock = !early_boot_irqs_disabled && !irqs_disabled_flags(flags) &&
-+		!preempt_count();
-+#else
-+	int lock = 1;
-+#endif
- 	int retval = 0;
+ #ifdef CONFIG_DEBUG_LOCK_ALLOC
+ 	/*
+@@ -44,10 +44,10 @@ void __init_rwsem(struct rw_semaphore *s
+ 	lockdep_init_map(&sem->dep_map, name, key, 0);
+ #endif
+ 	sem->activity = 0;
+-	spin_lock_init(&sem->wait_lock);
++	raw_spin_lock_init(&sem->wait_lock);
+ 	INIT_LIST_HEAD(&sem->wait_list);
+ }
+-EXPORT_SYMBOL(__init_rwsem);
++EXPORT_SYMBOL(__init_anon_rwsem);
  
--	if (console_trylock()) {
-+	if (lock && console_trylock()) {
- 		retval = 1;
+ /*
+  * handle the lock release when processes blocked on it that can now run
+@@ -58,8 +58,8 @@ EXPORT_SYMBOL(__init_rwsem);
+  * - woken process blocks are discarded from the list after having task zeroed
+  * - writers are only woken if wakewrite is non-zero
+  */
+-static inline struct rw_semaphore *
+-__rwsem_do_wake(struct rw_semaphore *sem, int wakewrite)
++static inline struct rw_anon_semaphore *
++__rwsem_do_wake(struct rw_anon_semaphore *sem, int wakewrite)
+ {
+ 	struct rwsem_waiter *waiter;
+ 	struct task_struct *tsk;
+@@ -117,8 +117,8 @@ __rwsem_do_wake(struct rw_semaphore *sem
+ /*
+  * wake a single writer
+  */
+-static inline struct rw_semaphore *
+-__rwsem_wake_one_writer(struct rw_semaphore *sem)
++static inline struct rw_anon_semaphore *
++__rwsem_wake_one_writer(struct rw_anon_semaphore *sem)
+ {
+ 	struct rwsem_waiter *waiter;
+ 	struct task_struct *tsk;
+@@ -139,18 +139,18 @@ __rwsem_wake_one_writer(struct rw_semaph
+ /*
+  * get a read lock on the semaphore
+  */
+-void __sched __down_read(struct rw_semaphore *sem)
++void __sched __down_read(struct rw_anon_semaphore *sem)
+ {
+ 	struct rwsem_waiter waiter;
+ 	struct task_struct *tsk;
+ 	unsigned long flags;
  
- 		/*
-@@ -800,7 +854,7 @@ static int console_trylock_for_printk(un
- 		}
+-	spin_lock_irqsave(&sem->wait_lock, flags);
++	raw_spin_lock_irqsave(&sem->wait_lock, flags);
+ 
+ 	if (sem->activity >= 0 && list_empty(&sem->wait_list)) {
+ 		/* granted */
+ 		sem->activity++;
+-		spin_unlock_irqrestore(&sem->wait_lock, flags);
++		raw_spin_unlock_irqrestore(&sem->wait_lock, flags);
+ 		goto out;
  	}
- 	printk_cpu = UINT_MAX;
--	spin_unlock(&logbuf_lock);
-+	raw_spin_unlock(&logbuf_lock);
- 	return retval;
- }
- static const char recursion_bug_msg [] =
-@@ -833,6 +887,13 @@ asmlinkage int vprintk(const char *fmt, 
- 	size_t plen;
- 	char special;
  
-+	/*
-+	 * Fall back to early_printk if a debugging subsystem has
-+	 * killed printk output
-+	 */
-+	if (unlikely(forced_early_printk(fmt, args)))
-+		return 1;
-+
- 	boot_delay_msec();
- 	printk_delay();
+@@ -165,7 +165,7 @@ void __sched __down_read(struct rw_semap
+ 	list_add_tail(&waiter.list, &sem->wait_list);
  
-@@ -860,7 +921,7 @@ asmlinkage int vprintk(const char *fmt, 
- 	}
+ 	/* we don't need to touch the semaphore struct anymore */
+-	spin_unlock_irqrestore(&sem->wait_lock, flags);
++	raw_spin_unlock_irqrestore(&sem->wait_lock, flags);
  
- 	lockdep_off();
--	spin_lock(&logbuf_lock);
-+	raw_spin_lock(&logbuf_lock);
- 	printk_cpu = this_cpu;
+ 	/* wait to be given the lock */
+ 	for (;;) {
+@@ -183,13 +183,13 @@ void __sched __down_read(struct rw_semap
+ /*
+  * trylock for reading -- returns 1 if successful, 0 if contention
+  */
+-int __down_read_trylock(struct rw_semaphore *sem)
++int __down_read_trylock(struct rw_anon_semaphore *sem)
+ {
+ 	unsigned long flags;
+ 	int ret = 0;
  
- 	if (recursion_bug) {
-@@ -953,8 +1014,15 @@ asmlinkage int vprintk(const char *fmt, 
- 	 * will release 'logbuf_lock' regardless of whether it
- 	 * actually gets the semaphore or not.
- 	 */
--	if (console_trylock_for_printk(this_cpu))
-+	if (console_trylock_for_printk(this_cpu, flags)) {
-+#ifndef CONFIG_PREEMPT_RT_FULL
-+		console_unlock();
-+#else
-+		raw_local_irq_restore(flags);
- 		console_unlock();
-+		raw_local_irq_save(flags);
-+#endif
-+	}
  
- 	lockdep_on();
- out_restore_irqs:
-@@ -1252,18 +1320,23 @@ void console_unlock(void)
- 	console_may_schedule = 0;
+-	spin_lock_irqsave(&sem->wait_lock, flags);
++	raw_spin_lock_irqsave(&sem->wait_lock, flags);
  
- 	for ( ; ; ) {
--		spin_lock_irqsave(&logbuf_lock, flags);
-+		raw_spin_lock_irqsave(&logbuf_lock, flags);
- 		wake_klogd |= log_start - log_end;
- 		if (con_start == log_end)
- 			break;			/* Nothing to print */
- 		_con_start = con_start;
- 		_log_end = log_end;
- 		con_start = log_end;		/* Flush */
--		spin_unlock(&logbuf_lock);
-+#ifndef CONFIG_PREEMPT_RT_FULL
-+		raw_spin_unlock(&logbuf_lock);
- 		stop_critical_timings();	/* don't trace print latency */
- 		call_console_drivers(_con_start, _log_end);
- 		start_critical_timings();
- 		local_irq_restore(flags);
-+#else
-+		raw_spin_unlock_irqrestore(&logbuf_lock, flags);
-+		call_console_drivers(_con_start, _log_end);
-+#endif
+ 	if (sem->activity >= 0 && list_empty(&sem->wait_list)) {
+ 		/* granted */
+@@ -197,7 +197,7 @@ int __down_read_trylock(struct rw_semaph
+ 		ret = 1;
  	}
- 	console_locked = 0;
  
-@@ -1272,7 +1345,7 @@ void console_unlock(void)
- 		exclusive_console = NULL;
+-	spin_unlock_irqrestore(&sem->wait_lock, flags);
++	raw_spin_unlock_irqrestore(&sem->wait_lock, flags);
  
- 	up(&console_sem);
--	spin_unlock_irqrestore(&logbuf_lock, flags);
-+	raw_spin_unlock_irqrestore(&logbuf_lock, flags);
- 	if (wake_klogd)
- 		wake_up_klogd();
+ 	return ret;
  }
-@@ -1502,9 +1575,9 @@ void register_console(struct console *ne
- 		 * console_unlock(); will print out the buffered messages
- 		 * for us.
- 		 */
--		spin_lock_irqsave(&logbuf_lock, flags);
-+		raw_spin_lock_irqsave(&logbuf_lock, flags);
- 		con_start = log_start;
--		spin_unlock_irqrestore(&logbuf_lock, flags);
-+		raw_spin_unlock_irqrestore(&logbuf_lock, flags);
- 		/*
- 		 * We're about to replay the log buffer.  Only do this to the
- 		 * just-registered console to avoid excessive message spam to
-@@ -1711,10 +1784,10 @@ void kmsg_dump(enum kmsg_dump_reason rea
- 	/* Theoretically, the log could move on after we do this, but
- 	   there's not a lot we can do about that. The new messages
- 	   will overwrite the start of what we dump. */
--	spin_lock_irqsave(&logbuf_lock, flags);
-+	raw_spin_lock_irqsave(&logbuf_lock, flags);
- 	end = log_end & LOG_BUF_MASK;
- 	chars = logged_chars;
--	spin_unlock_irqrestore(&logbuf_lock, flags);
-+	raw_spin_unlock_irqrestore(&logbuf_lock, flags);
- 
- 	if (chars > end) {
- 		s1 = log_buf + log_buf_len - chars + end;
-Index: linux-2.6/lib/ratelimit.c
-===================================================================
---- linux-2.6.orig/lib/ratelimit.c
-+++ linux-2.6/lib/ratelimit.c
-@@ -39,7 +39,7 @@ int ___ratelimit(struct ratelimit_state 
- 	 * in addition to the one that will be printed by
- 	 * the entity that is holding the lock already:
- 	 */
--	if (!spin_trylock_irqsave(&rs->lock, flags))
-+	if (!raw_spin_trylock_irqsave(&rs->lock, flags))
- 		return 0;
+@@ -206,18 +206,18 @@ int __down_read_trylock(struct rw_semaph
+  * get a write lock on the semaphore
+  * - we increment the waiting count anyway to indicate an exclusive lock
+  */
+-void __sched __down_write_nested(struct rw_semaphore *sem, int subclass)
++void __sched __down_write_nested(struct rw_anon_semaphore *sem, int subclass)
+ {
+ 	struct rwsem_waiter waiter;
+ 	struct task_struct *tsk;
+ 	unsigned long flags;
  
- 	if (!rs->begin)
-@@ -60,7 +60,7 @@ int ___ratelimit(struct ratelimit_state 
- 		rs->missed++;
- 		ret = 0;
+-	spin_lock_irqsave(&sem->wait_lock, flags);
++	raw_spin_lock_irqsave(&sem->wait_lock, flags);
+ 
+ 	if (sem->activity == 0 && list_empty(&sem->wait_list)) {
+ 		/* granted */
+ 		sem->activity = -1;
+-		spin_unlock_irqrestore(&sem->wait_lock, flags);
++		raw_spin_unlock_irqrestore(&sem->wait_lock, flags);
+ 		goto out;
  	}
--	spin_unlock_irqrestore(&rs->lock, flags);
-+	raw_spin_unlock_irqrestore(&rs->lock, flags);
  
- 	return ret;
+@@ -232,7 +232,7 @@ void __sched __down_write_nested(struct 
+ 	list_add_tail(&waiter.list, &sem->wait_list);
+ 
+ 	/* we don't need to touch the semaphore struct anymore */
+-	spin_unlock_irqrestore(&sem->wait_lock, flags);
++	raw_spin_unlock_irqrestore(&sem->wait_lock, flags);
+ 
+ 	/* wait to be given the lock */
+ 	for (;;) {
+@@ -247,7 +247,7 @@ void __sched __down_write_nested(struct 
+ 	;
  }
-Index: linux-2.6/include/linux/init_task.h
-===================================================================
---- linux-2.6.orig/include/linux/init_task.h
-+++ linux-2.6/include/linux/init_task.h
-@@ -42,7 +42,7 @@ extern struct fs_struct init_fs;
- 	.cputimer	= { 						\
- 		.cputime = INIT_CPUTIME,				\
- 		.running = 0,						\
--		.lock = __SPIN_LOCK_UNLOCKED(sig.cputimer.lock),	\
-+		.lock = __RAW_SPIN_LOCK_UNLOCKED(sig.cputimer.lock),	\
- 	},								\
- 	.cred_guard_mutex =						\
- 		 __MUTEX_INITIALIZER(sig.cred_guard_mutex),		\
-@@ -126,6 +126,12 @@ extern struct cred init_cred;
- # define INIT_PERF_EVENTS(tsk)
- #endif
  
-+#ifdef CONFIG_PREEMPT_RT_BASE
-+# define INIT_TIMER_LIST		.posix_timer_list = NULL,
-+#else
-+# define INIT_TIMER_LIST
-+#endif
-+
+-void __sched __down_write(struct rw_semaphore *sem)
++void __sched __down_write(struct rw_anon_semaphore *sem)
+ {
+ 	__down_write_nested(sem, 0);
+ }
+@@ -255,12 +255,12 @@ void __sched __down_write(struct rw_sema
  /*
-  *  INIT_TASK is used to set up the first task table, touch at
-  * your own risk!. Base=0, limit=0x1fffff (=2MB)
-@@ -179,6 +185,7 @@ extern struct cred init_cred;
- 	.fs_excl	= ATOMIC_INIT(0),				\
- 	.pi_lock	= __RAW_SPIN_LOCK_UNLOCKED(tsk.pi_lock),	\
- 	.timer_slack_ns = 50000, /* 50 usec default slack */		\
-+	INIT_TIMER_LIST							\
- 	.pids = {							\
- 		[PIDTYPE_PID]  = INIT_PID_LINK(PIDTYPE_PID),		\
- 		[PIDTYPE_PGID] = INIT_PID_LINK(PIDTYPE_PGID),		\
-Index: linux-2.6/kernel/posix-cpu-timers.c
-===================================================================
---- linux-2.6.orig/kernel/posix-cpu-timers.c
-+++ linux-2.6/kernel/posix-cpu-timers.c
-@@ -274,7 +274,7 @@ void thread_group_cputimer(struct task_s
- 	struct task_cputime sum;
+  * trylock for writing -- returns 1 if successful, 0 if contention
+  */
+-int __down_write_trylock(struct rw_semaphore *sem)
++int __down_write_trylock(struct rw_anon_semaphore *sem)
+ {
  	unsigned long flags;
+ 	int ret = 0;
  
--	spin_lock_irqsave(&cputimer->lock, flags);
-+	raw_spin_lock_irqsave(&cputimer->lock, flags);
- 	if (!cputimer->running) {
- 		cputimer->running = 1;
- 		/*
-@@ -287,7 +287,7 @@ void thread_group_cputimer(struct task_s
- 		update_gt_cputime(&cputimer->cputime, &sum);
+-	spin_lock_irqsave(&sem->wait_lock, flags);
++	raw_spin_lock_irqsave(&sem->wait_lock, flags);
+ 
+ 	if (sem->activity == 0 && list_empty(&sem->wait_list)) {
+ 		/* granted */
+@@ -268,7 +268,7 @@ int __down_write_trylock(struct rw_semap
+ 		ret = 1;
  	}
- 	*times = cputimer->cputime;
--	spin_unlock_irqrestore(&cputimer->lock, flags);
-+	raw_spin_unlock_irqrestore(&cputimer->lock, flags);
- }
  
- /*
-@@ -699,7 +699,7 @@ static int posix_cpu_timer_set(struct k_
- 	/*
- 	 * Disarm any old timer after extracting its expiry time.
- 	 */
--	BUG_ON(!irqs_disabled());
-+	BUG_ON_NONRT(!irqs_disabled());
+-	spin_unlock_irqrestore(&sem->wait_lock, flags);
++	raw_spin_unlock_irqrestore(&sem->wait_lock, flags);
  
- 	ret = 0;
- 	old_incr = timer->it.cpu.incr;
-@@ -997,9 +997,9 @@ static void stop_process_timers(struct s
- 	struct thread_group_cputimer *cputimer = &sig->cputimer;
+ 	return ret;
+ }
+@@ -276,48 +276,48 @@ int __down_write_trylock(struct rw_semap
+ /*
+  * release a read lock on the semaphore
+  */
+-void __up_read(struct rw_semaphore *sem)
++void __up_read(struct rw_anon_semaphore *sem)
+ {
  	unsigned long flags;
  
--	spin_lock_irqsave(&cputimer->lock, flags);
-+	raw_spin_lock_irqsave(&cputimer->lock, flags);
- 	cputimer->running = 0;
--	spin_unlock_irqrestore(&cputimer->lock, flags);
-+	raw_spin_unlock_irqrestore(&cputimer->lock, flags);
+-	spin_lock_irqsave(&sem->wait_lock, flags);
++	raw_spin_lock_irqsave(&sem->wait_lock, flags);
+ 
+ 	if (--sem->activity == 0 && !list_empty(&sem->wait_list))
+ 		sem = __rwsem_wake_one_writer(sem);
+ 
+-	spin_unlock_irqrestore(&sem->wait_lock, flags);
++	raw_spin_unlock_irqrestore(&sem->wait_lock, flags);
  }
  
- static u32 onecputick;
-@@ -1221,7 +1221,7 @@ void posix_cpu_timer_schedule(struct k_i
- 	/*
- 	 * Now re-arm for the new expiry time.
- 	 */
--	BUG_ON(!irqs_disabled());
-+	BUG_ON_NONRT(!irqs_disabled());
- 	arm_timer(timer);
- 	spin_unlock(&p->sighand->siglock);
+ /*
+  * release a write lock on the semaphore
+  */
+-void __up_write(struct rw_semaphore *sem)
++void __up_write(struct rw_anon_semaphore *sem)
+ {
+ 	unsigned long flags;
  
-@@ -1288,10 +1288,11 @@ static inline int fastpath_timer_check(s
- 	sig = tsk->signal;
- 	if (sig->cputimer.running) {
- 		struct task_cputime group_sample;
-+		unsigned long flags;
+-	spin_lock_irqsave(&sem->wait_lock, flags);
++	raw_spin_lock_irqsave(&sem->wait_lock, flags);
  
--		spin_lock(&sig->cputimer.lock);
-+		raw_spin_lock_irqsave(&sig->cputimer.lock, flags);
- 		group_sample = sig->cputimer.cputime;
--		spin_unlock(&sig->cputimer.lock);
-+		raw_spin_unlock_irqrestore(&sig->cputimer.lock, flags);
+ 	sem->activity = 0;
+ 	if (!list_empty(&sem->wait_list))
+ 		sem = __rwsem_do_wake(sem, 1);
  
- 		if (task_cputime_expired(&group_sample, &sig->cputime_expires))
- 			return 1;
-@@ -1305,13 +1306,13 @@ static inline int fastpath_timer_check(s
-  * already updated our counts.  We need to check if any timers fire now.
-  * Interrupts are disabled.
+-	spin_unlock_irqrestore(&sem->wait_lock, flags);
++	raw_spin_unlock_irqrestore(&sem->wait_lock, flags);
+ }
+ 
+ /*
+  * downgrade a write lock into a read lock
+  * - just wake up any readers at the front of the queue
   */
--void run_posix_cpu_timers(struct task_struct *tsk)
-+static void __run_posix_cpu_timers(struct task_struct *tsk)
+-void __downgrade_write(struct rw_semaphore *sem)
++void __downgrade_write(struct rw_anon_semaphore *sem)
  {
- 	LIST_HEAD(firing);
- 	struct k_itimer *timer, *next;
  	unsigned long flags;
  
--	BUG_ON(!irqs_disabled());
-+	BUG_ON_NONRT(!irqs_disabled());
+-	spin_lock_irqsave(&sem->wait_lock, flags);
++	raw_spin_lock_irqsave(&sem->wait_lock, flags);
+ 
+ 	sem->activity = 1;
+ 	if (!list_empty(&sem->wait_list))
+ 		sem = __rwsem_do_wake(sem, 0);
+ 
+-	spin_unlock_irqrestore(&sem->wait_lock, flags);
++	raw_spin_unlock_irqrestore(&sem->wait_lock, flags);
+ }
  
+Index: linux-2.6/lib/rwsem.c
+===================================================================
+--- linux-2.6.orig/lib/rwsem.c
++++ linux-2.6/lib/rwsem.c
+@@ -11,8 +11,8 @@
+ /*
+  * Initialize an rwsem:
+  */
+-void __init_rwsem(struct rw_semaphore *sem, const char *name,
+-		  struct lock_class_key *key)
++void __init_anon_rwsem(struct rw_anon_semaphore *sem, const char *name,
++		       struct lock_class_key *key)
+ {
+ #ifdef CONFIG_DEBUG_LOCK_ALLOC
  	/*
- 	 * The fast path checks that there are no expired thread or thread
-@@ -1369,6 +1370,190 @@ void run_posix_cpu_timers(struct task_st
- 	}
+@@ -22,11 +22,11 @@ void __init_rwsem(struct rw_semaphore *s
+ 	lockdep_init_map(&sem->dep_map, name, key, 0);
+ #endif
+ 	sem->count = RWSEM_UNLOCKED_VALUE;
+-	spin_lock_init(&sem->wait_lock);
++	raw_spin_lock_init(&sem->wait_lock);
+ 	INIT_LIST_HEAD(&sem->wait_list);
  }
  
-+#ifdef CONFIG_PREEMPT_RT_BASE
-+#include <linux/kthread.h>
-+#include <linux/cpu.h>
-+DEFINE_PER_CPU(struct task_struct *, posix_timer_task);
-+DEFINE_PER_CPU(struct task_struct *, posix_timer_tasklist);
-+
-+static int posix_cpu_timers_thread(void *data)
-+{
-+	int cpu = (long)data;
-+
-+	BUG_ON(per_cpu(posix_timer_task,cpu) != current);
-+
-+	while (!kthread_should_stop()) {
-+		struct task_struct *tsk = NULL;
-+		struct task_struct *next = NULL;
-+
-+		if (cpu_is_offline(cpu))
-+			goto wait_to_die;
-+
-+		/* grab task list */
-+		raw_local_irq_disable();
-+		tsk = per_cpu(posix_timer_tasklist, cpu);
-+		per_cpu(posix_timer_tasklist, cpu) = NULL;
-+		raw_local_irq_enable();
-+
-+		/* its possible the list is empty, just return */
-+		if (!tsk) {
-+			set_current_state(TASK_INTERRUPTIBLE);
-+			schedule();
-+			__set_current_state(TASK_RUNNING);
-+			continue;
-+		}
-+
-+		/* Process task list */
-+		while (1) {
-+			/* save next */
-+			next = tsk->posix_timer_list;
-+
-+			/* run the task timers, clear its ptr and
-+			 * unreference it
-+			 */
-+			__run_posix_cpu_timers(tsk);
-+			tsk->posix_timer_list = NULL;
-+			put_task_struct(tsk);
-+
-+			/* check if this is the last on the list */
-+			if (next == tsk)
-+				break;
-+			tsk = next;
-+		}
-+	}
-+	return 0;
-+
-+wait_to_die:
-+	/* Wait for kthread_stop */
-+	set_current_state(TASK_INTERRUPTIBLE);
-+	while (!kthread_should_stop()) {
-+		schedule();
-+		set_current_state(TASK_INTERRUPTIBLE);
-+	}
-+	__set_current_state(TASK_RUNNING);
-+	return 0;
-+}
-+
-+static inline int __fastpath_timer_check(struct task_struct *tsk)
-+{
-+	/* tsk == current, ensure it is safe to use ->signal/sighand */
-+	if (unlikely(tsk->exit_state))
-+		return 0;
-+
-+	if (!task_cputime_zero(&tsk->cputime_expires))
-+			return 1;
-+
-+	if (!task_cputime_zero(&tsk->signal->cputime_expires))
-+			return 1;
-+
-+	return 0;
-+}
-+
-+void run_posix_cpu_timers(struct task_struct *tsk)
-+{
-+	unsigned long cpu = smp_processor_id();
-+	struct task_struct *tasklist;
-+
-+	BUG_ON(!irqs_disabled());
-+	if(!per_cpu(posix_timer_task, cpu))
-+		return;
-+	/* get per-cpu references */
-+	tasklist = per_cpu(posix_timer_tasklist, cpu);
-+
-+	/* check to see if we're already queued */
-+	if (!tsk->posix_timer_list && __fastpath_timer_check(tsk)) {
-+		get_task_struct(tsk);
-+		if (tasklist) {
-+			tsk->posix_timer_list = tasklist;
-+		} else {
-+			/*
-+			 * The list is terminated by a self-pointing
-+			 * task_struct
-+			 */
-+			tsk->posix_timer_list = tsk;
-+		}
-+		per_cpu(posix_timer_tasklist, cpu) = tsk;
-+
-+		wake_up_process(per_cpu(posix_timer_task, cpu));
-+	}
-+}
-+
-+/*
-+ * posix_cpu_thread_call - callback that gets triggered when a CPU is added.
-+ * Here we can start up the necessary migration thread for the new CPU.
-+ */
-+static int posix_cpu_thread_call(struct notifier_block *nfb,
-+				 unsigned long action, void *hcpu)
-+{
-+	int cpu = (long)hcpu;
-+	struct task_struct *p;
-+	struct sched_param param;
-+
-+	switch (action) {
-+	case CPU_UP_PREPARE:
-+		p = kthread_create(posix_cpu_timers_thread, hcpu,
-+					"posixcputmr/%d",cpu);
-+		if (IS_ERR(p))
-+			return NOTIFY_BAD;
-+		p->flags |= PF_NOFREEZE;
-+		kthread_bind(p, cpu);
-+		/* Must be high prio to avoid getting starved */
-+		param.sched_priority = MAX_RT_PRIO-1;
-+		sched_setscheduler(p, SCHED_FIFO, &param);
-+		per_cpu(posix_timer_task,cpu) = p;
-+		break;
-+	case CPU_ONLINE:
-+		/* Strictly unneccessary, as first user will wake it. */
-+		wake_up_process(per_cpu(posix_timer_task,cpu));
-+		break;
-+#ifdef CONFIG_HOTPLUG_CPU
-+	case CPU_UP_CANCELED:
-+		/* Unbind it from offline cpu so it can run.  Fall thru. */
-+		kthread_bind(per_cpu(posix_timer_task,cpu),
-+			     any_online_cpu(cpu_online_map));
-+		kthread_stop(per_cpu(posix_timer_task,cpu));
-+		per_cpu(posix_timer_task,cpu) = NULL;
-+		break;
-+	case CPU_DEAD:
-+		kthread_stop(per_cpu(posix_timer_task,cpu));
-+		per_cpu(posix_timer_task,cpu) = NULL;
-+		break;
-+#endif
-+	}
-+	return NOTIFY_OK;
-+}
-+
-+/* Register at highest priority so that task migration (migrate_all_tasks)
-+ * happens before everything else.
-+ */
-+static struct notifier_block __devinitdata posix_cpu_thread_notifier = {
-+	.notifier_call = posix_cpu_thread_call,
-+	.priority = 10
-+};
-+
-+static int __init posix_cpu_thread_init(void)
-+{
-+	void *hcpu = (void *)(long)smp_processor_id();
-+	/* Start one for boot CPU. */
-+	unsigned long cpu;
-+
-+	/* init the per-cpu posix_timer_tasklets */
-+	for_each_cpu_mask(cpu, cpu_possible_map)
-+		per_cpu(posix_timer_tasklist, cpu) = NULL;
-+
-+	posix_cpu_thread_call(&posix_cpu_thread_notifier, CPU_UP_PREPARE, hcpu);
-+	posix_cpu_thread_call(&posix_cpu_thread_notifier, CPU_ONLINE, hcpu);
-+	register_cpu_notifier(&posix_cpu_thread_notifier);
-+	return 0;
-+}
-+early_initcall(posix_cpu_thread_init);
-+#else /* CONFIG_PREEMPT_RT_BASE */
-+void run_posix_cpu_timers(struct task_struct *tsk)
-+{
-+	__run_posix_cpu_timers(tsk);
-+}
-+#endif /* CONFIG_PREEMPT_RT_BASE */
-+
- /*
-  * Set one of the process-wide special case CPU timers or RLIMIT_CPU.
-  * The tsk->sighand->siglock must be held by the caller.
-Index: linux-2.6/kernel/sched_stats.h
-===================================================================
---- linux-2.6.orig/kernel/sched_stats.h
-+++ linux-2.6/kernel/sched_stats.h
-@@ -282,10 +282,10 @@ static inline void account_group_user_ti
- 	if (!cputimer->running)
- 		return;
- 
--	spin_lock(&cputimer->lock);
-+	raw_spin_lock(&cputimer->lock);
- 	cputimer->cputime.utime =
- 		cputime_add(cputimer->cputime.utime, cputime);
--	spin_unlock(&cputimer->lock);
-+	raw_spin_unlock(&cputimer->lock);
- }
- 
- /**
-@@ -306,10 +306,10 @@ static inline void account_group_system_
- 	if (!cputimer->running)
- 		return;
- 
--	spin_lock(&cputimer->lock);
-+	raw_spin_lock(&cputimer->lock);
- 	cputimer->cputime.stime =
- 		cputime_add(cputimer->cputime.stime, cputime);
--	spin_unlock(&cputimer->lock);
-+	raw_spin_unlock(&cputimer->lock);
- }
- 
- /**
-@@ -330,7 +330,7 @@ static inline void account_group_exec_ru
- 	if (!cputimer->running)
- 		return;
- 
--	spin_lock(&cputimer->lock);
-+	raw_spin_lock(&cputimer->lock);
- 	cputimer->cputime.sum_exec_runtime += ns;
--	spin_unlock(&cputimer->lock);
-+	raw_spin_unlock(&cputimer->lock);
- }
-Index: linux-2.6/include/linux/semaphore.h
-===================================================================
---- linux-2.6.orig/include/linux/semaphore.h
-+++ linux-2.6/include/linux/semaphore.h
-@@ -14,14 +14,14 @@
- 
- /* Please don't access any members of this structure directly */
- struct semaphore {
--	spinlock_t		lock;
-+	raw_spinlock_t		lock;
- 	unsigned int		count;
- 	struct list_head	wait_list;
- };
- 
- #define __SEMAPHORE_INITIALIZER(name, n)				\
- {									\
--	.lock		= __SPIN_LOCK_UNLOCKED((name).lock),		\
-+	.lock		= __RAW_SPIN_LOCK_UNLOCKED((name).lock),	\
- 	.count		= n,						\
- 	.wait_list	= LIST_HEAD_INIT((name).wait_list),		\
- }
-Index: linux-2.6/kernel/semaphore.c
-===================================================================
---- linux-2.6.orig/kernel/semaphore.c
-+++ linux-2.6/kernel/semaphore.c
-@@ -54,12 +54,12 @@ void down(struct semaphore *sem)
- {
- 	unsigned long flags;
- 
--	spin_lock_irqsave(&sem->lock, flags);
-+	raw_spin_lock_irqsave(&sem->lock, flags);
- 	if (likely(sem->count > 0))
- 		sem->count--;
- 	else
- 		__down(sem);
--	spin_unlock_irqrestore(&sem->lock, flags);
-+	raw_spin_unlock_irqrestore(&sem->lock, flags);
- }
- EXPORT_SYMBOL(down);
- 
-@@ -77,12 +77,12 @@ int down_interruptible(struct semaphore 
- 	unsigned long flags;
- 	int result = 0;
- 
--	spin_lock_irqsave(&sem->lock, flags);
-+	raw_spin_lock_irqsave(&sem->lock, flags);
- 	if (likely(sem->count > 0))
- 		sem->count--;
- 	else
- 		result = __down_interruptible(sem);
--	spin_unlock_irqrestore(&sem->lock, flags);
-+	raw_spin_unlock_irqrestore(&sem->lock, flags);
- 
- 	return result;
- }
-@@ -103,12 +103,12 @@ int down_killable(struct semaphore *sem)
- 	unsigned long flags;
- 	int result = 0;
- 
--	spin_lock_irqsave(&sem->lock, flags);
-+	raw_spin_lock_irqsave(&sem->lock, flags);
- 	if (likely(sem->count > 0))
- 		sem->count--;
- 	else
- 		result = __down_killable(sem);
--	spin_unlock_irqrestore(&sem->lock, flags);
-+	raw_spin_unlock_irqrestore(&sem->lock, flags);
- 
- 	return result;
- }
-@@ -132,11 +132,11 @@ int down_trylock(struct semaphore *sem)
- 	unsigned long flags;
- 	int count;
- 
--	spin_lock_irqsave(&sem->lock, flags);
-+	raw_spin_lock_irqsave(&sem->lock, flags);
- 	count = sem->count - 1;
- 	if (likely(count >= 0))
- 		sem->count = count;
--	spin_unlock_irqrestore(&sem->lock, flags);
-+	raw_spin_unlock_irqrestore(&sem->lock, flags);
- 
- 	return (count < 0);
- }
-@@ -157,12 +157,12 @@ int down_timeout(struct semaphore *sem, 
- 	unsigned long flags;
- 	int result = 0;
- 
--	spin_lock_irqsave(&sem->lock, flags);
-+	raw_spin_lock_irqsave(&sem->lock, flags);
- 	if (likely(sem->count > 0))
- 		sem->count--;
- 	else
- 		result = __down_timeout(sem, jiffies);
--	spin_unlock_irqrestore(&sem->lock, flags);
-+	raw_spin_unlock_irqrestore(&sem->lock, flags);
- 
- 	return result;
- }
-@@ -179,12 +179,12 @@ void up(struct semaphore *sem)
- {
- 	unsigned long flags;
- 
--	spin_lock_irqsave(&sem->lock, flags);
-+	raw_spin_lock_irqsave(&sem->lock, flags);
- 	if (likely(list_empty(&sem->wait_list)))
- 		sem->count++;
- 	else
- 		__up(sem);
--	spin_unlock_irqrestore(&sem->lock, flags);
-+	raw_spin_unlock_irqrestore(&sem->lock, flags);
- }
- EXPORT_SYMBOL(up);
- 
-@@ -217,9 +217,9 @@ static inline int __sched __down_common(
- 		if (timeout <= 0)
- 			goto timed_out;
- 		__set_task_state(task, state);
--		spin_unlock_irq(&sem->lock);
-+		raw_spin_unlock_irq(&sem->lock);
- 		timeout = schedule_timeout(timeout);
--		spin_lock_irq(&sem->lock);
-+		raw_spin_lock_irq(&sem->lock);
- 		if (waiter.up)
- 			return 0;
- 	}
-Index: linux-2.6/include/linux/rwsem-spinlock.h
-===================================================================
---- linux-2.6.orig/include/linux/rwsem-spinlock.h
-+++ linux-2.6/include/linux/rwsem-spinlock.h
-@@ -20,26 +20,42 @@
-  * - if activity is -1 then there is one active writer
-  * - if wait_list is not empty, then there are processes waiting for the semaphore
-  */
-+struct rw_anon_semaphore {
-+	__s32			activity;
-+	raw_spinlock_t		wait_lock;
-+	struct list_head	wait_list;
-+#ifdef CONFIG_DEBUG_LOCK_ALLOC
-+	struct lockdep_map dep_map;
-+#endif
-+};
-+
-+#ifndef CONFIG_PREEMPT_RT_FULL
-+/*
-+ * Non preempt-rt implementation of rw_semaphore. Same as above, but
-+ * restricted vs. ownership. i.e. ownerless locked state and non owner
-+ * release not allowed.
-+ */
- struct rw_semaphore {
- 	__s32			activity;
--	spinlock_t		wait_lock;
-+	raw_spinlock_t		wait_lock;
- 	struct list_head	wait_list;
- #ifdef CONFIG_DEBUG_LOCK_ALLOC
- 	struct lockdep_map dep_map;
- #endif
- };
-+#endif /* PREEMPT_RT_FULL */
- 
- #define RWSEM_UNLOCKED_VALUE		0x00000000
- 
--extern void __down_read(struct rw_semaphore *sem);
--extern int __down_read_trylock(struct rw_semaphore *sem);
--extern void __down_write(struct rw_semaphore *sem);
--extern void __down_write_nested(struct rw_semaphore *sem, int subclass);
--extern int __down_write_trylock(struct rw_semaphore *sem);
--extern void __up_read(struct rw_semaphore *sem);
--extern void __up_write(struct rw_semaphore *sem);
--extern void __downgrade_write(struct rw_semaphore *sem);
--extern int rwsem_is_locked(struct rw_semaphore *sem);
-+extern void __down_read(struct rw_anon_semaphore *sem);
-+extern int __down_read_trylock(struct rw_anon_semaphore *sem);
-+extern void __down_write(struct rw_anon_semaphore *sem);
-+extern void __down_write_nested(struct rw_anon_semaphore *sem, int subclass);
-+extern int __down_write_trylock(struct rw_anon_semaphore *sem);
-+extern void __up_read(struct rw_anon_semaphore *sem);
-+extern void __up_write(struct rw_anon_semaphore *sem);
-+extern void __downgrade_write(struct rw_anon_semaphore *sem);
-+extern int anon_rwsem_is_locked(struct rw_anon_semaphore *sem);
- 
- #endif /* __KERNEL__ */
- #endif /* _LINUX_RWSEM_SPINLOCK_H */
-Index: linux-2.6/include/linux/rwsem.h
-===================================================================
---- linux-2.6.orig/include/linux/rwsem.h
-+++ linux-2.6/include/linux/rwsem.h
-@@ -17,37 +17,50 @@
- #include <asm/system.h>
- #include <asm/atomic.h>
- 
-+struct rw_anon_semaphore;
- struct rw_semaphore;
- 
- #ifdef CONFIG_RWSEM_GENERIC_SPINLOCK
- #include <linux/rwsem-spinlock.h> /* use a generic implementation */
--#else
-+#else /* RWSEM_GENERIC_SPINLOCK */
-+
- /* All arch specific implementations share the same struct */
--struct rw_semaphore {
-+struct rw_anon_semaphore {
- 	long			count;
--	spinlock_t		wait_lock;
-+	raw_spinlock_t		wait_lock;
- 	struct list_head	wait_list;
- #ifdef CONFIG_DEBUG_LOCK_ALLOC
- 	struct lockdep_map	dep_map;
- #endif
- };
- 
--extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *sem);
--extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem);
--extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *);
--extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem);
-+extern struct rw_anon_semaphore *rwsem_down_read_failed(struct rw_anon_semaphore *sem);
-+extern struct rw_anon_semaphore *rwsem_down_write_failed(struct rw_anon_semaphore *sem);
-+extern struct rw_anon_semaphore *rwsem_wake(struct rw_anon_semaphore *);
-+extern struct rw_anon_semaphore *rwsem_downgrade_wake(struct rw_anon_semaphore *sem);
- 
- /* Include the arch specific part */
- #include <asm/rwsem.h>
- 
- /* In all implementations count != 0 means locked */
--static inline int rwsem_is_locked(struct rw_semaphore *sem)
-+static inline int anon_rwsem_is_locked(struct rw_anon_semaphore *sem)
- {
- 	return sem->count != 0;
- }
- 
-+#ifndef CONFIG_PREEMPT_RT_FULL
-+struct rw_semaphore {
-+	long			count;
-+	raw_spinlock_t		wait_lock;
-+	struct list_head	wait_list;
-+#ifdef CONFIG_DEBUG_LOCK_ALLOC
-+	struct lockdep_map	dep_map;
-+#endif
-+};
- #endif
- 
-+#endif /* !RWSEM_GENERIC_SPINLOCK */
-+
- /* Common initializer macros and functions */
- 
- #ifdef CONFIG_DEBUG_LOCK_ALLOC
-@@ -56,57 +69,59 @@ static inline int rwsem_is_locked(struct
- # define __RWSEM_DEP_MAP_INIT(lockname)
- #endif
- 
--#define __RWSEM_INITIALIZER(name) \
--	{ RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED(name.wait_lock),	\
--	  LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) }
-+#define __RWSEM_ANON_INITIALIZER(name)			\
-+	{ RWSEM_UNLOCKED_VALUE,				\
-+	  __RAW_SPIN_LOCK_UNLOCKED(name.wait_lock),	\
-+	  LIST_HEAD_INIT((name).wait_list)		\
-+	  __RWSEM_DEP_MAP_INIT(name) }
- 
--#define DECLARE_RWSEM(name) \
--	struct rw_semaphore name = __RWSEM_INITIALIZER(name)
-+#define DECLARE_ANON_RWSEM(name) \
-+	struct rw_anon_semaphore name = __RWSEM_INITIALIZER(name)
- 
--extern void __init_rwsem(struct rw_semaphore *sem, const char *name,
--			 struct lock_class_key *key);
-+extern void __init_anon_rwsem(struct rw_anon_semaphore *sem, const char *name,
-+			      struct lock_class_key *key);
- 
--#define init_rwsem(sem)						\
-+#define init_anon_rwsem(sem)					\
- do {								\
- 	static struct lock_class_key __key;			\
- 								\
--	__init_rwsem((sem), #sem, &__key);			\
-+	__init_anon_rwsem((sem), #sem, &__key);			\
- } while (0)
- 
- /*
-  * lock for reading
-  */
--extern void down_read(struct rw_semaphore *sem);
-+extern void anon_down_read(struct rw_anon_semaphore *sem);
- 
- /*
-  * trylock for reading -- returns 1 if successful, 0 if contention
-  */
--extern int down_read_trylock(struct rw_semaphore *sem);
-+extern int anon_down_read_trylock(struct rw_anon_semaphore *sem);
- 
- /*
-  * lock for writing
-  */
--extern void down_write(struct rw_semaphore *sem);
-+extern void anon_down_write(struct rw_anon_semaphore *sem);
- 
- /*
-  * trylock for writing -- returns 1 if successful, 0 if contention
-  */
--extern int down_write_trylock(struct rw_semaphore *sem);
-+extern int anon_down_write_trylock(struct rw_anon_semaphore *sem);
- 
- /*
-  * release a read lock
-  */
--extern void up_read(struct rw_semaphore *sem);
-+extern void anon_up_read(struct rw_anon_semaphore *sem);
- 
- /*
-  * release a write lock
-  */
--extern void up_write(struct rw_semaphore *sem);
-+extern void anon_up_write(struct rw_anon_semaphore *sem);
- 
- /*
-  * downgrade write lock to read lock
-  */
--extern void downgrade_write(struct rw_semaphore *sem);
-+extern void anon_downgrade_write(struct rw_anon_semaphore *sem);
- 
- #ifdef CONFIG_DEBUG_LOCK_ALLOC
- /*
-@@ -122,21 +137,101 @@ extern void downgrade_write(struct rw_se
-  * lockdep_set_class() at lock initialization time.
-  * See Documentation/lockdep-design.txt for more details.)
-  */
--extern void down_read_nested(struct rw_semaphore *sem, int subclass);
--extern void down_write_nested(struct rw_semaphore *sem, int subclass);
-+extern void anon_down_read_nested(struct rw_anon_semaphore *sem, int subclass);
-+extern void anon_down_write_nested(struct rw_anon_semaphore *sem, int subclass);
- /*
-  * Take/release a lock when not the owner will release it.
-  *
-  * [ This API should be avoided as much as possible - the
-  *   proper abstraction for this case is completions. ]
-  */
--extern void down_read_non_owner(struct rw_semaphore *sem);
--extern void up_read_non_owner(struct rw_semaphore *sem);
-+extern void anon_down_read_non_owner(struct rw_anon_semaphore *sem);
-+extern void anon_up_read_non_owner(struct rw_anon_semaphore *sem);
- #else
--# define down_read_nested(sem, subclass)		down_read(sem)
--# define down_write_nested(sem, subclass)	down_write(sem)
--# define down_read_non_owner(sem)		down_read(sem)
--# define up_read_non_owner(sem)			up_read(sem)
-+# define anon_down_read_nested(sem, subclass)	anon_down_read(sem)
-+# define anon_down_write_nested(sem, subclass)	anon_down_write(sem)
-+# define anon_down_read_non_owner(sem)		anon_down_read(sem)
-+# define anon_up_read_non_owner(sem)		anon_up_read(sem)
- #endif
- 
-+#ifdef CONFIG_PREEMPT_RT_FULL
-+#include <linux/rwsem_rt.h>
-+#else /* PREEMPT_RT_FULL */
-+/*
-+ * Non preempt-rt implementations
-+ */
-+#define __RWSEM_INITIALIZER(name)			\
-+	{ RWSEM_UNLOCKED_VALUE,				\
-+	  __RAW_SPIN_LOCK_UNLOCKED(name.wait_lock),	\
-+	  LIST_HEAD_INIT((name).wait_list)		\
-+	  __RWSEM_DEP_MAP_INIT(name) }
-+
-+#define DECLARE_RWSEM(name) \
-+	struct rw_semaphore name = __RWSEM_INITIALIZER(name)
-+
-+static inline void __init_rwsem(struct rw_semaphore *sem, const char *name,
-+				struct lock_class_key *key)
-+{
-+	__init_anon_rwsem((struct rw_anon_semaphore *)sem, name, key);
-+}
-+
-+#define init_rwsem(sem)						\
-+do {								\
-+	static struct lock_class_key __key;			\
-+								\
-+	__init_rwsem((sem), #sem, &__key);			\
-+} while (0)
-+
-+static inline void down_read(struct rw_semaphore *sem)
-+{
-+	anon_down_read((struct rw_anon_semaphore *)sem);
-+}
-+
-+static inline int down_read_trylock(struct rw_semaphore *sem)
-+{
-+	return anon_down_read_trylock((struct rw_anon_semaphore *)sem);
-+}
-+
-+static inline void down_write(struct rw_semaphore *sem)
-+{
-+	anon_down_write((struct rw_anon_semaphore *)sem);
-+}
-+
-+static inline int down_write_trylock(struct rw_semaphore *sem)
-+{
-+	return anon_down_write_trylock((struct rw_anon_semaphore *)sem);
-+}
-+
-+static inline void up_read(struct rw_semaphore *sem)
-+{
-+	anon_up_read((struct rw_anon_semaphore *)sem);
-+}
-+
-+static inline void up_write(struct rw_semaphore *sem)
-+{
-+	anon_up_write((struct rw_anon_semaphore *)sem);
-+}
-+
-+static inline void downgrade_write(struct rw_semaphore *sem)
-+{
-+	anon_downgrade_write((struct rw_anon_semaphore *)sem);
-+}
-+
-+static inline void down_read_nested(struct rw_semaphore *sem, int subclass)
-+{
-+	return anon_down_read_nested((struct rw_anon_semaphore *)sem, subclass);
-+}
-+
-+static inline void down_write_nested(struct rw_semaphore *sem, int subclass)
-+{
-+	anon_down_write_nested((struct rw_anon_semaphore *)sem, subclass);
-+}
-+
-+static inline int rwsem_is_locked(struct rw_semaphore *sem)
-+{
-+	return anon_rwsem_is_locked((struct rw_anon_semaphore *)sem);
-+}
-+#endif /* !PREEMPT_RT_FULL */
-+
- #endif /* _LINUX_RWSEM_H */
-+
-Index: linux-2.6/lib/rwsem-spinlock.c
-===================================================================
---- linux-2.6.orig/lib/rwsem-spinlock.c
-+++ linux-2.6/lib/rwsem-spinlock.c
-@@ -17,24 +17,24 @@ struct rwsem_waiter {
- #define RWSEM_WAITING_FOR_WRITE	0x00000002
- };
- 
--int rwsem_is_locked(struct rw_semaphore *sem)
-+int anon_rwsem_is_locked(struct rw_anon_semaphore *sem)
- {
- 	int ret = 1;
- 	unsigned long flags;
- 
--	if (spin_trylock_irqsave(&sem->wait_lock, flags)) {
-+	if (raw_spin_trylock_irqsave(&sem->wait_lock, flags)) {
- 		ret = (sem->activity != 0);
--		spin_unlock_irqrestore(&sem->wait_lock, flags);
-+		raw_spin_unlock_irqrestore(&sem->wait_lock, flags);
- 	}
- 	return ret;
- }
--EXPORT_SYMBOL(rwsem_is_locked);
-+EXPORT_SYMBOL(anon_rwsem_is_locked);
- 
- /*
-  * initialise the semaphore
-  */
--void __init_rwsem(struct rw_semaphore *sem, const char *name,
--		  struct lock_class_key *key)
-+void __init_anon_rwsem(struct rw_anon_semaphore *sem, const char *name,
-+		       struct lock_class_key *key)
- {
- #ifdef CONFIG_DEBUG_LOCK_ALLOC
- 	/*
-@@ -44,10 +44,10 @@ void __init_rwsem(struct rw_semaphore *s
- 	lockdep_init_map(&sem->dep_map, name, key, 0);
- #endif
- 	sem->activity = 0;
--	spin_lock_init(&sem->wait_lock);
-+	raw_spin_lock_init(&sem->wait_lock);
- 	INIT_LIST_HEAD(&sem->wait_list);
- }
 -EXPORT_SYMBOL(__init_rwsem);
 +EXPORT_SYMBOL(__init_anon_rwsem);
  
- /*
-  * handle the lock release when processes blocked on it that can now run
-@@ -58,8 +58,8 @@ EXPORT_SYMBOL(__init_rwsem);
+ struct rwsem_waiter {
+ 	struct list_head list;
+@@ -54,8 +54,8 @@ struct rwsem_waiter {
   * - woken process blocks are discarded from the list after having task zeroed
-  * - writers are only woken if wakewrite is non-zero
+  * - writers are only woken if downgrading is false
   */
--static inline struct rw_semaphore *
--__rwsem_do_wake(struct rw_semaphore *sem, int wakewrite)
-+static inline struct rw_anon_semaphore *
-+__rwsem_do_wake(struct rw_anon_semaphore *sem, int wakewrite)
+-static struct rw_semaphore *
+-__rwsem_do_wake(struct rw_semaphore *sem, int wake_type)
++static struct rw_anon_semaphore *
++__rwsem_do_wake(struct rw_anon_semaphore *sem, int wake_type)
  {
  	struct rwsem_waiter *waiter;
  	struct task_struct *tsk;
-@@ -117,8 +117,8 @@ __rwsem_do_wake(struct rw_semaphore *sem
+@@ -169,8 +169,8 @@ __rwsem_do_wake(struct rw_semaphore *sem
  /*
-  * wake a single writer
+  * wait for a lock to be granted
   */
--static inline struct rw_semaphore *
--__rwsem_wake_one_writer(struct rw_semaphore *sem)
-+static inline struct rw_anon_semaphore *
-+__rwsem_wake_one_writer(struct rw_anon_semaphore *sem)
+-static struct rw_semaphore __sched *
+-rwsem_down_failed_common(struct rw_semaphore *sem,
++static struct rw_anon_semaphore __sched *
++rwsem_down_failed_common(struct rw_anon_semaphore *sem,
+ 			 unsigned int flags, signed long adjustment)
  {
- 	struct rwsem_waiter *waiter;
- 	struct task_struct *tsk;
-@@ -139,18 +139,18 @@ __rwsem_wake_one_writer(struct rw_semaph
+ 	struct rwsem_waiter waiter;
+@@ -180,7 +180,7 @@ rwsem_down_failed_common(struct rw_semap
+ 	set_task_state(tsk, TASK_UNINTERRUPTIBLE);
+ 
+ 	/* set up my own style of waitqueue */
+-	spin_lock_irq(&sem->wait_lock);
++	raw_spin_lock_irq(&sem->wait_lock);
+ 	waiter.task = tsk;
+ 	waiter.flags = flags;
+ 	get_task_struct(tsk);
+@@ -204,7 +204,7 @@ rwsem_down_failed_common(struct rw_semap
+ 		 adjustment == -RWSEM_ACTIVE_WRITE_BIAS)
+ 		sem = __rwsem_do_wake(sem, RWSEM_WAKE_READ_OWNED);
+ 
+-	spin_unlock_irq(&sem->wait_lock);
++	raw_spin_unlock_irq(&sem->wait_lock);
+ 
+ 	/* wait to be given the lock */
+ 	for (;;) {
+@@ -222,7 +222,8 @@ rwsem_down_failed_common(struct rw_semap
  /*
-  * get a read lock on the semaphore
+  * wait for the read lock to be granted
   */
--void __sched __down_read(struct rw_semaphore *sem)
-+void __sched __down_read(struct rw_anon_semaphore *sem)
+-struct rw_semaphore __sched *rwsem_down_read_failed(struct rw_semaphore *sem)
++struct rw_anon_semaphore __sched *
++rwsem_down_read_failed(struct rw_anon_semaphore *sem)
+ {
+ 	return rwsem_down_failed_common(sem, RWSEM_WAITING_FOR_READ,
+ 					-RWSEM_ACTIVE_READ_BIAS);
+@@ -231,7 +232,8 @@ struct rw_semaphore __sched *rwsem_down_
+ /*
+  * wait for the write lock to be granted
+  */
+-struct rw_semaphore __sched *rwsem_down_write_failed(struct rw_semaphore *sem)
++struct rw_anon_semaphore __sched *
++rwsem_down_write_failed(struct rw_anon_semaphore *sem)
+ {
+ 	return rwsem_down_failed_common(sem, RWSEM_WAITING_FOR_WRITE,
+ 					-RWSEM_ACTIVE_WRITE_BIAS);
+@@ -241,17 +243,17 @@ struct rw_semaphore __sched *rwsem_down_
+  * handle waking up a waiter on the semaphore
+  * - up_read/up_write has decremented the active part of count if we come here
+  */
+-struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem)
++struct rw_anon_semaphore *rwsem_wake(struct rw_anon_semaphore *sem)
  {
- 	struct rwsem_waiter waiter;
- 	struct task_struct *tsk;
  	unsigned long flags;
  
 -	spin_lock_irqsave(&sem->wait_lock, flags);
 +	raw_spin_lock_irqsave(&sem->wait_lock, flags);
  
- 	if (sem->activity >= 0 && list_empty(&sem->wait_list)) {
- 		/* granted */
- 		sem->activity++;
--		spin_unlock_irqrestore(&sem->wait_lock, flags);
-+		raw_spin_unlock_irqrestore(&sem->wait_lock, flags);
- 		goto out;
+ 	/* do nothing if list empty */
+ 	if (!list_empty(&sem->wait_list))
+ 		sem = __rwsem_do_wake(sem, RWSEM_WAKE_ANY);
+ 
+-	spin_unlock_irqrestore(&sem->wait_lock, flags);
++	raw_spin_unlock_irqrestore(&sem->wait_lock, flags);
+ 
+ 	return sem;
+ }
+@@ -261,17 +263,17 @@ struct rw_semaphore *rwsem_wake(struct r
+  * - caller incremented waiting part of count and discovered it still negative
+  * - just wake up any readers at the front of the queue
+  */
+-struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem)
++struct rw_anon_semaphore *rwsem_downgrade_wake(struct rw_anon_semaphore *sem)
+ {
+ 	unsigned long flags;
+ 
+-	spin_lock_irqsave(&sem->wait_lock, flags);
++	raw_spin_lock_irqsave(&sem->wait_lock, flags);
+ 
+ 	/* do nothing if list empty */
+ 	if (!list_empty(&sem->wait_list))
+ 		sem = __rwsem_do_wake(sem, RWSEM_WAKE_READ_OWNED);
+ 
+-	spin_unlock_irqrestore(&sem->wait_lock, flags);
++	raw_spin_unlock_irqrestore(&sem->wait_lock, flags);
+ 
+ 	return sem;
+ }
+Index: linux-2.6/kernel/time/timer_stats.c
+===================================================================
+--- linux-2.6.orig/kernel/time/timer_stats.c
++++ linux-2.6/kernel/time/timer_stats.c
+@@ -81,7 +81,7 @@ struct entry {
+ /*
+  * Spinlock protecting the tables - not taken during lookup:
+  */
+-static DEFINE_SPINLOCK(table_lock);
++static DEFINE_RAW_SPINLOCK(table_lock);
+ 
+ /*
+  * Per-CPU lookup locks for fast hash lookup:
+@@ -188,7 +188,7 @@ static struct entry *tstat_lookup(struct
+ 	prev = NULL;
+ 	curr = *head;
+ 
+-	spin_lock(&table_lock);
++	raw_spin_lock(&table_lock);
+ 	/*
+ 	 * Make sure we have not raced with another CPU:
+ 	 */
+@@ -215,7 +215,7 @@ static struct entry *tstat_lookup(struct
+ 			*head = curr;
  	}
+  out_unlock:
+-	spin_unlock(&table_lock);
++	raw_spin_unlock(&table_lock);
+ 
+ 	return curr;
+ }
+Index: linux-2.6/kernel/latencytop.c
+===================================================================
+--- linux-2.6.orig/kernel/latencytop.c
++++ linux-2.6/kernel/latencytop.c
+@@ -58,7 +58,7 @@
+ #include <linux/list.h>
+ #include <linux/stacktrace.h>
+ 
+-static DEFINE_SPINLOCK(latency_lock);
++static DEFINE_RAW_SPINLOCK(latency_lock);
+ 
+ #define MAXLR 128
+ static struct latency_record latency_record[MAXLR];
+@@ -72,19 +72,19 @@ void clear_all_latency_tracing(struct ta
+ 	if (!latencytop_enabled)
+ 		return;
+ 
+-	spin_lock_irqsave(&latency_lock, flags);
++	raw_spin_lock_irqsave(&latency_lock, flags);
+ 	memset(&p->latency_record, 0, sizeof(p->latency_record));
+ 	p->latency_record_count = 0;
+-	spin_unlock_irqrestore(&latency_lock, flags);
++	raw_spin_unlock_irqrestore(&latency_lock, flags);
+ }
+ 
+ static void clear_global_latency_tracing(void)
+ {
+ 	unsigned long flags;
+ 
+-	spin_lock_irqsave(&latency_lock, flags);
++	raw_spin_lock_irqsave(&latency_lock, flags);
+ 	memset(&latency_record, 0, sizeof(latency_record));
+-	spin_unlock_irqrestore(&latency_lock, flags);
++	raw_spin_unlock_irqrestore(&latency_lock, flags);
+ }
+ 
+ static void __sched
+@@ -190,7 +190,7 @@ __account_scheduler_latency(struct task_
+ 	lat.max = usecs;
+ 	store_stacktrace(tsk, &lat);
+ 
+-	spin_lock_irqsave(&latency_lock, flags);
++	raw_spin_lock_irqsave(&latency_lock, flags);
+ 
+ 	account_global_scheduler_latency(tsk, &lat);
+ 
+@@ -231,7 +231,7 @@ __account_scheduler_latency(struct task_
+ 	memcpy(&tsk->latency_record[i], &lat, sizeof(struct latency_record));
+ 
+ out_unlock:
+-	spin_unlock_irqrestore(&latency_lock, flags);
++	raw_spin_unlock_irqrestore(&latency_lock, flags);
+ }
+ 
+ static int lstats_show(struct seq_file *m, void *v)
+Index: linux-2.6/drivers/video/console/vgacon.c
+===================================================================
+--- linux-2.6.orig/drivers/video/console/vgacon.c
++++ linux-2.6/drivers/video/console/vgacon.c
+@@ -50,7 +50,7 @@
+ #include <video/vga.h>
+ #include <asm/io.h>
+ 
+-static DEFINE_SPINLOCK(vga_lock);
++static DEFINE_RAW_SPINLOCK(vga_lock);
+ static int cursor_size_lastfrom;
+ static int cursor_size_lastto;
+ static u32 vgacon_xres;
+@@ -157,7 +157,7 @@ static inline void write_vga(unsigned ch
+ 	 * ddprintk might set the console position from interrupt
+ 	 * handlers, thus the write has to be IRQ-atomic.
+ 	 */
+-	spin_lock_irqsave(&vga_lock, flags);
++	raw_spin_lock_irqsave(&vga_lock, flags);
  
-@@ -165,7 +165,7 @@ void __sched __down_read(struct rw_semap
- 	list_add_tail(&waiter.list, &sem->wait_list);
+ #ifndef SLOW_VGA
+ 	v1 = reg + (val & 0xff00);
+@@ -170,7 +170,7 @@ static inline void write_vga(unsigned ch
+ 	outb_p(reg + 1, vga_video_port_reg);
+ 	outb_p(val & 0xff, vga_video_port_val);
+ #endif
+-	spin_unlock_irqrestore(&vga_lock, flags);
++	raw_spin_unlock_irqrestore(&vga_lock, flags);
+ }
  
- 	/* we don't need to touch the semaphore struct anymore */
--	spin_unlock_irqrestore(&sem->wait_lock, flags);
-+	raw_spin_unlock_irqrestore(&sem->wait_lock, flags);
+ static inline void vga_set_mem_top(struct vc_data *c)
+@@ -664,7 +664,7 @@ static void vgacon_set_cursor_size(int x
+ 	cursor_size_lastfrom = from;
+ 	cursor_size_lastto = to;
  
- 	/* wait to be given the lock */
- 	for (;;) {
-@@ -183,13 +183,13 @@ void __sched __down_read(struct rw_semap
- /*
-  * trylock for reading -- returns 1 if successful, 0 if contention
-  */
--int __down_read_trylock(struct rw_semaphore *sem)
-+int __down_read_trylock(struct rw_anon_semaphore *sem)
- {
- 	unsigned long flags;
- 	int ret = 0;
+-	spin_lock_irqsave(&vga_lock, flags);
++	raw_spin_lock_irqsave(&vga_lock, flags);
+ 	if (vga_video_type >= VIDEO_TYPE_VGAC) {
+ 		outb_p(VGA_CRTC_CURSOR_START, vga_video_port_reg);
+ 		curs = inb_p(vga_video_port_val);
+@@ -682,7 +682,7 @@ static void vgacon_set_cursor_size(int x
+ 	outb_p(curs, vga_video_port_val);
+ 	outb_p(VGA_CRTC_CURSOR_END, vga_video_port_reg);
+ 	outb_p(cure, vga_video_port_val);
+-	spin_unlock_irqrestore(&vga_lock, flags);
++	raw_spin_unlock_irqrestore(&vga_lock, flags);
+ }
  
+ static void vgacon_cursor(struct vc_data *c, int mode)
+@@ -757,7 +757,7 @@ static int vgacon_doresize(struct vc_dat
+ 	unsigned int scanlines = height * c->vc_font.height;
+ 	u8 scanlines_lo = 0, r7 = 0, vsync_end = 0, mode, max_scan;
  
--	spin_lock_irqsave(&sem->wait_lock, flags);
-+	raw_spin_lock_irqsave(&sem->wait_lock, flags);
+-	spin_lock_irqsave(&vga_lock, flags);
++	raw_spin_lock_irqsave(&vga_lock, flags);
  
- 	if (sem->activity >= 0 && list_empty(&sem->wait_list)) {
- 		/* granted */
-@@ -197,7 +197,7 @@ int __down_read_trylock(struct rw_semaph
- 		ret = 1;
+ 	vgacon_xres = width * VGA_FONTWIDTH;
+ 	vgacon_yres = height * c->vc_font.height;
+@@ -808,7 +808,7 @@ static int vgacon_doresize(struct vc_dat
+ 		outb_p(vsync_end, vga_video_port_val);
  	}
  
--	spin_unlock_irqrestore(&sem->wait_lock, flags);
-+	raw_spin_unlock_irqrestore(&sem->wait_lock, flags);
- 
- 	return ret;
+-	spin_unlock_irqrestore(&vga_lock, flags);
++	raw_spin_unlock_irqrestore(&vga_lock, flags);
+ 	return 0;
  }
-@@ -206,18 +206,18 @@ int __down_read_trylock(struct rw_semaph
-  * get a write lock on the semaphore
-  * - we increment the waiting count anyway to indicate an exclusive lock
-  */
--void __sched __down_write_nested(struct rw_semaphore *sem, int subclass)
-+void __sched __down_write_nested(struct rw_anon_semaphore *sem, int subclass)
- {
- 	struct rwsem_waiter waiter;
- 	struct task_struct *tsk;
- 	unsigned long flags;
- 
--	spin_lock_irqsave(&sem->wait_lock, flags);
-+	raw_spin_lock_irqsave(&sem->wait_lock, flags);
  
- 	if (sem->activity == 0 && list_empty(&sem->wait_list)) {
- 		/* granted */
- 		sem->activity = -1;
--		spin_unlock_irqrestore(&sem->wait_lock, flags);
-+		raw_spin_unlock_irqrestore(&sem->wait_lock, flags);
- 		goto out;
- 	}
+@@ -891,11 +891,11 @@ static void vga_vesa_blank(struct vgasta
+ {
+ 	/* save original values of VGA controller registers */
+ 	if (!vga_vesa_blanked) {
+-		spin_lock_irq(&vga_lock);
++		raw_spin_lock_irq(&vga_lock);
+ 		vga_state.SeqCtrlIndex = vga_r(state->vgabase, VGA_SEQ_I);
+ 		vga_state.CrtCtrlIndex = inb_p(vga_video_port_reg);
+ 		vga_state.CrtMiscIO = vga_r(state->vgabase, VGA_MIS_R);
+-		spin_unlock_irq(&vga_lock);
++		raw_spin_unlock_irq(&vga_lock);
  
-@@ -232,7 +232,7 @@ void __sched __down_write_nested(struct 
- 	list_add_tail(&waiter.list, &sem->wait_list);
+ 		outb_p(0x00, vga_video_port_reg);	/* HorizontalTotal */
+ 		vga_state.HorizontalTotal = inb_p(vga_video_port_val);
+@@ -918,7 +918,7 @@ static void vga_vesa_blank(struct vgasta
  
- 	/* we don't need to touch the semaphore struct anymore */
--	spin_unlock_irqrestore(&sem->wait_lock, flags);
-+	raw_spin_unlock_irqrestore(&sem->wait_lock, flags);
+ 	/* assure that video is enabled */
+ 	/* "0x20" is VIDEO_ENABLE_bit in register 01 of sequencer */
+-	spin_lock_irq(&vga_lock);
++	raw_spin_lock_irq(&vga_lock);
+ 	vga_wseq(state->vgabase, VGA_SEQ_CLOCK_MODE, vga_state.ClockingMode | 0x20);
  
- 	/* wait to be given the lock */
- 	for (;;) {
-@@ -247,7 +247,7 @@ void __sched __down_write_nested(struct 
- 	;
+ 	/* test for vertical retrace in process.... */
+@@ -954,13 +954,13 @@ static void vga_vesa_blank(struct vgasta
+ 	/* restore both index registers */
+ 	vga_w(state->vgabase, VGA_SEQ_I, vga_state.SeqCtrlIndex);
+ 	outb_p(vga_state.CrtCtrlIndex, vga_video_port_reg);
+-	spin_unlock_irq(&vga_lock);
++	raw_spin_unlock_irq(&vga_lock);
  }
  
--void __sched __down_write(struct rw_semaphore *sem)
-+void __sched __down_write(struct rw_anon_semaphore *sem)
+ static void vga_vesa_unblank(struct vgastate *state)
  {
- 	__down_write_nested(sem, 0);
+ 	/* restore original values of VGA controller registers */
+-	spin_lock_irq(&vga_lock);
++	raw_spin_lock_irq(&vga_lock);
+ 	vga_w(state->vgabase, VGA_MIS_W, vga_state.CrtMiscIO);
+ 
+ 	outb_p(0x00, vga_video_port_reg);	/* HorizontalTotal */
+@@ -985,7 +985,7 @@ static void vga_vesa_unblank(struct vgas
+ 	/* restore index/control registers */
+ 	vga_w(state->vgabase, VGA_SEQ_I, vga_state.SeqCtrlIndex);
+ 	outb_p(vga_state.CrtCtrlIndex, vga_video_port_reg);
+-	spin_unlock_irq(&vga_lock);
++	raw_spin_unlock_irq(&vga_lock);
  }
-@@ -255,12 +255,12 @@ void __sched __down_write(struct rw_sema
- /*
-  * trylock for writing -- returns 1 if successful, 0 if contention
-  */
--int __down_write_trylock(struct rw_semaphore *sem)
-+int __down_write_trylock(struct rw_anon_semaphore *sem)
- {
- 	unsigned long flags;
- 	int ret = 0;
  
--	spin_lock_irqsave(&sem->wait_lock, flags);
-+	raw_spin_lock_irqsave(&sem->wait_lock, flags);
+ static void vga_pal_blank(struct vgastate *state)
+@@ -1104,7 +1104,7 @@ static int vgacon_do_font_op(struct vgas
+ 		charmap += 4 * cmapsz;
+ #endif
  
- 	if (sem->activity == 0 && list_empty(&sem->wait_list)) {
- 		/* granted */
-@@ -268,7 +268,7 @@ int __down_write_trylock(struct rw_semap
- 		ret = 1;
- 	}
+-	spin_lock_irq(&vga_lock);
++	raw_spin_lock_irq(&vga_lock);
+ 	/* First, the Sequencer */
+ 	vga_wseq(state->vgabase, VGA_SEQ_RESET, 0x1);
+ 	/* CPU writes only to map 2 */
+@@ -1120,7 +1120,7 @@ static int vgacon_do_font_op(struct vgas
+ 	vga_wgfx(state->vgabase, VGA_GFX_MODE, 0x00);
+ 	/* map start at A000:0000 */
+ 	vga_wgfx(state->vgabase, VGA_GFX_MISC, 0x00);
+-	spin_unlock_irq(&vga_lock);
++	raw_spin_unlock_irq(&vga_lock);
  
--	spin_unlock_irqrestore(&sem->wait_lock, flags);
-+	raw_spin_unlock_irqrestore(&sem->wait_lock, flags);
+ 	if (arg) {
+ 		if (set)
+@@ -1147,7 +1147,7 @@ static int vgacon_do_font_op(struct vgas
+ 		}
+ 	}
  
- 	return ret;
+-	spin_lock_irq(&vga_lock);
++	raw_spin_lock_irq(&vga_lock);
+ 	/* First, the sequencer, Synchronous reset */
+ 	vga_wseq(state->vgabase, VGA_SEQ_RESET, 0x01);	
+ 	/* CPU writes to maps 0 and 1 */
+@@ -1186,7 +1186,7 @@ static int vgacon_do_font_op(struct vgas
+ 		inb_p(video_port_status);
+ 		vga_wattr(state->vgabase, VGA_AR_ENABLE_DISPLAY, 0);	
+ 	}
+-	spin_unlock_irq(&vga_lock);
++	raw_spin_unlock_irq(&vga_lock);
+ 	return 0;
  }
-@@ -276,48 +276,48 @@ int __down_write_trylock(struct rw_semap
- /*
-  * release a read lock on the semaphore
-  */
--void __up_read(struct rw_semaphore *sem)
-+void __up_read(struct rw_anon_semaphore *sem)
- {
- 	unsigned long flags;
  
--	spin_lock_irqsave(&sem->wait_lock, flags);
-+	raw_spin_lock_irqsave(&sem->wait_lock, flags);
+@@ -1211,26 +1211,26 @@ static int vgacon_adjust_height(struct v
+ 	   registers; they are write-only on EGA, but it appears that they
+ 	   are all don't care bits on EGA, so I guess it doesn't matter. */
  
- 	if (--sem->activity == 0 && !list_empty(&sem->wait_list))
- 		sem = __rwsem_wake_one_writer(sem);
+-	spin_lock_irq(&vga_lock);
++	raw_spin_lock_irq(&vga_lock);
+ 	outb_p(0x07, vga_video_port_reg);	/* CRTC overflow register */
+ 	ovr = inb_p(vga_video_port_val);
+ 	outb_p(0x09, vga_video_port_reg);	/* Font size register */
+ 	fsr = inb_p(vga_video_port_val);
+-	spin_unlock_irq(&vga_lock);
++	raw_spin_unlock_irq(&vga_lock);
  
--	spin_unlock_irqrestore(&sem->wait_lock, flags);
-+	raw_spin_unlock_irqrestore(&sem->wait_lock, flags);
- }
+ 	vde = maxscan & 0xff;	/* Vertical display end reg */
+ 	ovr = (ovr & 0xbd) +	/* Overflow register */
+ 	    ((maxscan & 0x100) >> 7) + ((maxscan & 0x200) >> 3);
+ 	fsr = (fsr & 0xe0) + (fontheight - 1);	/*  Font size register */
  
- /*
-  * release a write lock on the semaphore
-  */
--void __up_write(struct rw_semaphore *sem)
-+void __up_write(struct rw_anon_semaphore *sem)
+-	spin_lock_irq(&vga_lock);
++	raw_spin_lock_irq(&vga_lock);
+ 	outb_p(0x07, vga_video_port_reg);	/* CRTC overflow register */
+ 	outb_p(ovr, vga_video_port_val);
+ 	outb_p(0x09, vga_video_port_reg);	/* Font size */
+ 	outb_p(fsr, vga_video_port_val);
+ 	outb_p(0x12, vga_video_port_reg);	/* Vertical display limit */
+ 	outb_p(vde, vga_video_port_val);
+-	spin_unlock_irq(&vga_lock);
++	raw_spin_unlock_irq(&vga_lock);
+ 	vga_video_font_height = fontheight;
+ 
+ 	for (i = 0; i < MAX_NR_CONSOLES; i++) {
+Index: linux-2.6/arch/x86/oprofile/nmi_int.c
+===================================================================
+--- linux-2.6.orig/arch/x86/oprofile/nmi_int.c
++++ linux-2.6/arch/x86/oprofile/nmi_int.c
+@@ -355,10 +355,10 @@ static void nmi_cpu_setup(void *dummy)
+ 	int cpu = smp_processor_id();
+ 	struct op_msrs *msrs = &per_cpu(cpu_msrs, cpu);
+ 	nmi_cpu_save_registers(msrs);
+-	spin_lock(&oprofilefs_lock);
++	raw_spin_lock(&oprofilefs_lock);
+ 	model->setup_ctrs(model, msrs);
+ 	nmi_cpu_setup_mux(cpu, msrs);
+-	spin_unlock(&oprofilefs_lock);
++	raw_spin_unlock(&oprofilefs_lock);
+ 	per_cpu(saved_lvtpc, cpu) = apic_read(APIC_LVTPC);
+ 	apic_write(APIC_LVTPC, APIC_DM_NMI);
+ }
+Index: linux-2.6/drivers/oprofile/event_buffer.c
+===================================================================
+--- linux-2.6.orig/drivers/oprofile/event_buffer.c
++++ linux-2.6/drivers/oprofile/event_buffer.c
+@@ -82,10 +82,10 @@ int alloc_event_buffer(void)
  {
  	unsigned long flags;
  
--	spin_lock_irqsave(&sem->wait_lock, flags);
-+	raw_spin_lock_irqsave(&sem->wait_lock, flags);
+-	spin_lock_irqsave(&oprofilefs_lock, flags);
++	raw_spin_lock_irqsave(&oprofilefs_lock, flags);
+ 	buffer_size = oprofile_buffer_size;
+ 	buffer_watershed = oprofile_buffer_watershed;
+-	spin_unlock_irqrestore(&oprofilefs_lock, flags);
++	raw_spin_unlock_irqrestore(&oprofilefs_lock, flags);
  
- 	sem->activity = 0;
- 	if (!list_empty(&sem->wait_list))
- 		sem = __rwsem_do_wake(sem, 1);
+ 	if (buffer_watershed >= buffer_size)
+ 		return -EINVAL;
+Index: linux-2.6/drivers/oprofile/oprofile_perf.c
+===================================================================
+--- linux-2.6.orig/drivers/oprofile/oprofile_perf.c
++++ linux-2.6/drivers/oprofile/oprofile_perf.c
+@@ -160,9 +160,9 @@ static int oprofile_perf_create_files(st
  
--	spin_unlock_irqrestore(&sem->wait_lock, flags);
-+	raw_spin_unlock_irqrestore(&sem->wait_lock, flags);
+ static int oprofile_perf_setup(void)
+ {
+-	spin_lock(&oprofilefs_lock);
++	raw_spin_lock(&oprofilefs_lock);
+ 	op_perf_setup();
+-	spin_unlock(&oprofilefs_lock);
++	raw_spin_unlock(&oprofilefs_lock);
+ 	return 0;
  }
  
- /*
-  * downgrade a write lock into a read lock
-  * - just wake up any readers at the front of the queue
-  */
--void __downgrade_write(struct rw_semaphore *sem)
-+void __downgrade_write(struct rw_anon_semaphore *sem)
- {
- 	unsigned long flags;
+Index: linux-2.6/drivers/oprofile/oprofilefs.c
+===================================================================
+--- linux-2.6.orig/drivers/oprofile/oprofilefs.c
++++ linux-2.6/drivers/oprofile/oprofilefs.c
+@@ -21,7 +21,7 @@
  
--	spin_lock_irqsave(&sem->wait_lock, flags);
-+	raw_spin_lock_irqsave(&sem->wait_lock, flags);
+ #define OPROFILEFS_MAGIC 0x6f70726f
  
- 	sem->activity = 1;
- 	if (!list_empty(&sem->wait_list))
- 		sem = __rwsem_do_wake(sem, 0);
+-DEFINE_SPINLOCK(oprofilefs_lock);
++DEFINE_RAW_SPINLOCK(oprofilefs_lock);
  
--	spin_unlock_irqrestore(&sem->wait_lock, flags);
-+	raw_spin_unlock_irqrestore(&sem->wait_lock, flags);
+ static struct inode *oprofilefs_get_inode(struct super_block *sb, int mode)
+ {
+@@ -76,9 +76,9 @@ int oprofilefs_ulong_from_user(unsigned 
+ 	if (copy_from_user(tmpbuf, buf, count))
+ 		return -EFAULT;
+ 
+-	spin_lock_irqsave(&oprofilefs_lock, flags);
++	raw_spin_lock_irqsave(&oprofilefs_lock, flags);
+ 	*val = simple_strtoul(tmpbuf, NULL, 0);
+-	spin_unlock_irqrestore(&oprofilefs_lock, flags);
++	raw_spin_unlock_irqrestore(&oprofilefs_lock, flags);
+ 	return 0;
  }
  
-Index: linux-2.6/lib/rwsem.c
+Index: linux-2.6/include/linux/oprofile.h
 ===================================================================
---- linux-2.6.orig/lib/rwsem.c
-+++ linux-2.6/lib/rwsem.c
-@@ -11,8 +11,8 @@
- /*
-  * Initialize an rwsem:
-  */
--void __init_rwsem(struct rw_semaphore *sem, const char *name,
--		  struct lock_class_key *key)
-+void __init_anon_rwsem(struct rw_anon_semaphore *sem, const char *name,
-+		       struct lock_class_key *key)
- {
- #ifdef CONFIG_DEBUG_LOCK_ALLOC
- 	/*
-@@ -22,11 +22,11 @@ void __init_rwsem(struct rw_semaphore *s
- 	lockdep_init_map(&sem->dep_map, name, key, 0);
- #endif
- 	sem->count = RWSEM_UNLOCKED_VALUE;
--	spin_lock_init(&sem->wait_lock);
-+	raw_spin_lock_init(&sem->wait_lock);
- 	INIT_LIST_HEAD(&sem->wait_list);
+--- linux-2.6.orig/include/linux/oprofile.h
++++ linux-2.6/include/linux/oprofile.h
+@@ -166,7 +166,7 @@ ssize_t oprofilefs_ulong_to_user(unsigne
+ int oprofilefs_ulong_from_user(unsigned long * val, char const __user * buf, size_t count);
+ 
+ /** lock for read/write safety */
+-extern spinlock_t oprofilefs_lock;
++extern raw_spinlock_t oprofilefs_lock;
+ 
+ /**
+  * Add the contents of a circular buffer to the event buffer.
+Index: linux-2.6/drivers/acpi/processor_idle.c
+===================================================================
+--- linux-2.6.orig/drivers/acpi/processor_idle.c
++++ linux-2.6/drivers/acpi/processor_idle.c
+@@ -852,7 +852,7 @@ static int acpi_idle_enter_simple(struct
  }
  
--EXPORT_SYMBOL(__init_rwsem);
-+EXPORT_SYMBOL(__init_anon_rwsem);
+ static int c3_cpu_count;
+-static DEFINE_SPINLOCK(c3_lock);
++static DEFINE_RAW_SPINLOCK(c3_lock);
  
- struct rwsem_waiter {
- 	struct list_head list;
-@@ -54,8 +54,8 @@ struct rwsem_waiter {
-  * - woken process blocks are discarded from the list after having task zeroed
-  * - writers are only woken if downgrading is false
-  */
--static struct rw_semaphore *
--__rwsem_do_wake(struct rw_semaphore *sem, int wake_type)
-+static struct rw_anon_semaphore *
-+__rwsem_do_wake(struct rw_anon_semaphore *sem, int wake_type)
- {
- 	struct rwsem_waiter *waiter;
- 	struct task_struct *tsk;
-@@ -169,8 +169,8 @@ __rwsem_do_wake(struct rw_semaphore *sem
- /*
-  * wait for a lock to be granted
+ /**
+  * acpi_idle_enter_bm - enters C3 with proper BM handling
+@@ -930,12 +930,12 @@ static int acpi_idle_enter_bm(struct cpu
+ 	 * without doing anything.
+ 	 */
+ 	if (pr->flags.bm_check && pr->flags.bm_control) {
+-		spin_lock(&c3_lock);
++		raw_spin_lock(&c3_lock);
+ 		c3_cpu_count++;
+ 		/* Disable bus master arbitration when all CPUs are in C3 */
+ 		if (c3_cpu_count == num_online_cpus())
+ 			acpi_write_bit_register(ACPI_BITREG_ARB_DISABLE, 1);
+-		spin_unlock(&c3_lock);
++		raw_spin_unlock(&c3_lock);
+ 	} else if (!pr->flags.bm_check) {
+ 		ACPI_FLUSH_CPU_CACHE();
+ 	}
+@@ -944,10 +944,10 @@ static int acpi_idle_enter_bm(struct cpu
+ 
+ 	/* Re-enable bus master arbitration */
+ 	if (pr->flags.bm_check && pr->flags.bm_control) {
+-		spin_lock(&c3_lock);
++		raw_spin_lock(&c3_lock);
+ 		acpi_write_bit_register(ACPI_BITREG_ARB_DISABLE, 0);
+ 		c3_cpu_count--;
+-		spin_unlock(&c3_lock);
++		raw_spin_unlock(&c3_lock);
+ 	}
+ 	kt2 = ktime_get_real();
+ 	idle_time_ns = ktime_to_ns(ktime_sub(kt2, kt1));
+Index: linux-2.6/arch/x86/kernel/cpu/mcheck/mce_intel.c
+===================================================================
+--- linux-2.6.orig/arch/x86/kernel/cpu/mcheck/mce_intel.c
++++ linux-2.6/arch/x86/kernel/cpu/mcheck/mce_intel.c
+@@ -28,7 +28,7 @@ static DEFINE_PER_CPU(mce_banks_t, mce_b
+  * cmci_discover_lock protects against parallel discovery attempts
+  * which could race against each other.
   */
--static struct rw_semaphore __sched *
--rwsem_down_failed_common(struct rw_semaphore *sem,
-+static struct rw_anon_semaphore __sched *
-+rwsem_down_failed_common(struct rw_anon_semaphore *sem,
- 			 unsigned int flags, signed long adjustment)
- {
- 	struct rwsem_waiter waiter;
-@@ -180,7 +180,7 @@ rwsem_down_failed_common(struct rw_semap
- 	set_task_state(tsk, TASK_UNINTERRUPTIBLE);
+-static DEFINE_SPINLOCK(cmci_discover_lock);
++static DEFINE_RAW_SPINLOCK(cmci_discover_lock);
  
- 	/* set up my own style of waitqueue */
--	spin_lock_irq(&sem->wait_lock);
-+	raw_spin_lock_irq(&sem->wait_lock);
- 	waiter.task = tsk;
- 	waiter.flags = flags;
- 	get_task_struct(tsk);
-@@ -204,7 +204,7 @@ rwsem_down_failed_common(struct rw_semap
- 		 adjustment == -RWSEM_ACTIVE_WRITE_BIAS)
- 		sem = __rwsem_do_wake(sem, RWSEM_WAKE_READ_OWNED);
+ #define CMCI_THRESHOLD 1
  
--	spin_unlock_irq(&sem->wait_lock);
-+	raw_spin_unlock_irq(&sem->wait_lock);
+@@ -85,7 +85,7 @@ static void cmci_discover(int banks, int
+ 	int hdr = 0;
+ 	int i;
  
- 	/* wait to be given the lock */
- 	for (;;) {
-@@ -222,7 +222,8 @@ rwsem_down_failed_common(struct rw_semap
- /*
-  * wait for the read lock to be granted
-  */
--struct rw_semaphore __sched *rwsem_down_read_failed(struct rw_semaphore *sem)
-+struct rw_anon_semaphore __sched *
-+rwsem_down_read_failed(struct rw_anon_semaphore *sem)
- {
- 	return rwsem_down_failed_common(sem, RWSEM_WAITING_FOR_READ,
- 					-RWSEM_ACTIVE_READ_BIAS);
-@@ -231,7 +232,8 @@ struct rw_semaphore __sched *rwsem_down_
- /*
-  * wait for the write lock to be granted
-  */
--struct rw_semaphore __sched *rwsem_down_write_failed(struct rw_semaphore *sem)
-+struct rw_anon_semaphore __sched *
-+rwsem_down_write_failed(struct rw_anon_semaphore *sem)
- {
- 	return rwsem_down_failed_common(sem, RWSEM_WAITING_FOR_WRITE,
- 					-RWSEM_ACTIVE_WRITE_BIAS);
-@@ -241,17 +243,17 @@ struct rw_semaphore __sched *rwsem_down_
-  * handle waking up a waiter on the semaphore
-  * - up_read/up_write has decremented the active part of count if we come here
-  */
--struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem)
-+struct rw_anon_semaphore *rwsem_wake(struct rw_anon_semaphore *sem)
- {
- 	unsigned long flags;
+-	spin_lock_irqsave(&cmci_discover_lock, flags);
++	raw_spin_lock_irqsave(&cmci_discover_lock, flags);
+ 	for (i = 0; i < banks; i++) {
+ 		u64 val;
  
--	spin_lock_irqsave(&sem->wait_lock, flags);
-+	raw_spin_lock_irqsave(&sem->wait_lock, flags);
+@@ -116,7 +116,7 @@ static void cmci_discover(int banks, int
+ 			WARN_ON(!test_bit(i, __get_cpu_var(mce_poll_banks)));
+ 		}
+ 	}
+-	spin_unlock_irqrestore(&cmci_discover_lock, flags);
++	raw_spin_unlock_irqrestore(&cmci_discover_lock, flags);
+ 	if (hdr)
+ 		printk(KERN_CONT "\n");
+ }
+@@ -150,7 +150,7 @@ void cmci_clear(void)
+ 
+ 	if (!cmci_supported(&banks))
+ 		return;
+-	spin_lock_irqsave(&cmci_discover_lock, flags);
++	raw_spin_lock_irqsave(&cmci_discover_lock, flags);
+ 	for (i = 0; i < banks; i++) {
+ 		if (!test_bit(i, __get_cpu_var(mce_banks_owned)))
+ 			continue;
+@@ -160,7 +160,7 @@ void cmci_clear(void)
+ 		wrmsrl(MSR_IA32_MCx_CTL2(i), val);
+ 		__clear_bit(i, __get_cpu_var(mce_banks_owned));
+ 	}
+-	spin_unlock_irqrestore(&cmci_discover_lock, flags);
++	raw_spin_unlock_irqrestore(&cmci_discover_lock, flags);
+ }
+ 
+ /*
+Index: linux-2.6/arch/powerpc/sysdev/uic.c
+===================================================================
+--- linux-2.6.orig/arch/powerpc/sysdev/uic.c
++++ linux-2.6/arch/powerpc/sysdev/uic.c
+@@ -47,7 +47,7 @@ struct uic {
+ 	int index;
+ 	int dcrbase;
  
- 	/* do nothing if list empty */
- 	if (!list_empty(&sem->wait_list))
- 		sem = __rwsem_do_wake(sem, RWSEM_WAKE_ANY);
+-	spinlock_t lock;
++	raw_spinlock_t lock;
  
--	spin_unlock_irqrestore(&sem->wait_lock, flags);
-+	raw_spin_unlock_irqrestore(&sem->wait_lock, flags);
+ 	/* The remapper for this UIC */
+ 	struct irq_host	*irqhost;
+@@ -61,14 +61,14 @@ static void uic_unmask_irq(struct irq_da
+ 	u32 er, sr;
  
- 	return sem;
+ 	sr = 1 << (31-src);
+-	spin_lock_irqsave(&uic->lock, flags);
++	raw_spin_lock_irqsave(&uic->lock, flags);
+ 	/* ack level-triggered interrupts here */
+ 	if (irqd_is_level_type(d))
+ 		mtdcr(uic->dcrbase + UIC_SR, sr);
+ 	er = mfdcr(uic->dcrbase + UIC_ER);
+ 	er |= sr;
+ 	mtdcr(uic->dcrbase + UIC_ER, er);
+-	spin_unlock_irqrestore(&uic->lock, flags);
++	raw_spin_unlock_irqrestore(&uic->lock, flags);
  }
-@@ -261,17 +263,17 @@ struct rw_semaphore *rwsem_wake(struct r
-  * - caller incremented waiting part of count and discovered it still negative
-  * - just wake up any readers at the front of the queue
-  */
--struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem)
-+struct rw_anon_semaphore *rwsem_downgrade_wake(struct rw_anon_semaphore *sem)
- {
- 	unsigned long flags;
  
--	spin_lock_irqsave(&sem->wait_lock, flags);
-+	raw_spin_lock_irqsave(&sem->wait_lock, flags);
+ static void uic_mask_irq(struct irq_data *d)
+@@ -78,11 +78,11 @@ static void uic_mask_irq(struct irq_data
+ 	unsigned long flags;
+ 	u32 er;
  
- 	/* do nothing if list empty */
- 	if (!list_empty(&sem->wait_list))
- 		sem = __rwsem_do_wake(sem, RWSEM_WAKE_READ_OWNED);
+-	spin_lock_irqsave(&uic->lock, flags);
++	raw_spin_lock_irqsave(&uic->lock, flags);
+ 	er = mfdcr(uic->dcrbase + UIC_ER);
+ 	er &= ~(1 << (31 - src));
+ 	mtdcr(uic->dcrbase + UIC_ER, er);
+-	spin_unlock_irqrestore(&uic->lock, flags);
++	raw_spin_unlock_irqrestore(&uic->lock, flags);
+ }
  
--	spin_unlock_irqrestore(&sem->wait_lock, flags);
-+	raw_spin_unlock_irqrestore(&sem->wait_lock, flags);
+ static void uic_ack_irq(struct irq_data *d)
+@@ -91,9 +91,9 @@ static void uic_ack_irq(struct irq_data 
+ 	unsigned int src = irqd_to_hwirq(d);
+ 	unsigned long flags;
  
- 	return sem;
+-	spin_lock_irqsave(&uic->lock, flags);
++	raw_spin_lock_irqsave(&uic->lock, flags);
+ 	mtdcr(uic->dcrbase + UIC_SR, 1 << (31-src));
+-	spin_unlock_irqrestore(&uic->lock, flags);
++	raw_spin_unlock_irqrestore(&uic->lock, flags);
  }
-Index: linux-2.6/kernel/time/timer_stats.c
-===================================================================
---- linux-2.6.orig/kernel/time/timer_stats.c
-+++ linux-2.6/kernel/time/timer_stats.c
-@@ -81,7 +81,7 @@ struct entry {
- /*
-  * Spinlock protecting the tables - not taken during lookup:
-  */
--static DEFINE_SPINLOCK(table_lock);
-+static DEFINE_RAW_SPINLOCK(table_lock);
  
- /*
-  * Per-CPU lookup locks for fast hash lookup:
-@@ -188,7 +188,7 @@ static struct entry *tstat_lookup(struct
- 	prev = NULL;
- 	curr = *head;
+ static void uic_mask_ack_irq(struct irq_data *d)
+@@ -104,7 +104,7 @@ static void uic_mask_ack_irq(struct irq_
+ 	u32 er, sr;
  
--	spin_lock(&table_lock);
-+	raw_spin_lock(&table_lock);
- 	/*
- 	 * Make sure we have not raced with another CPU:
+ 	sr = 1 << (31-src);
+-	spin_lock_irqsave(&uic->lock, flags);
++	raw_spin_lock_irqsave(&uic->lock, flags);
+ 	er = mfdcr(uic->dcrbase + UIC_ER);
+ 	er &= ~sr;
+ 	mtdcr(uic->dcrbase + UIC_ER, er);
+@@ -118,7 +118,7 @@ static void uic_mask_ack_irq(struct irq_
  	 */
-@@ -215,7 +215,7 @@ static struct entry *tstat_lookup(struct
- 			*head = curr;
- 	}
-  out_unlock:
--	spin_unlock(&table_lock);
-+	raw_spin_unlock(&table_lock);
+ 	if (!irqd_is_level_type(d))
+ 		mtdcr(uic->dcrbase + UIC_SR, sr);
+-	spin_unlock_irqrestore(&uic->lock, flags);
++	raw_spin_unlock_irqrestore(&uic->lock, flags);
+ }
  
- 	return curr;
+ static int uic_set_irq_type(struct irq_data *d, unsigned int flow_type)
+@@ -152,7 +152,7 @@ static int uic_set_irq_type(struct irq_d
+ 
+ 	mask = ~(1 << (31 - src));
+ 
+-	spin_lock_irqsave(&uic->lock, flags);
++	raw_spin_lock_irqsave(&uic->lock, flags);
+ 	tr = mfdcr(uic->dcrbase + UIC_TR);
+ 	pr = mfdcr(uic->dcrbase + UIC_PR);
+ 	tr = (tr & mask) | (trigger << (31-src));
+@@ -161,7 +161,7 @@ static int uic_set_irq_type(struct irq_d
+ 	mtdcr(uic->dcrbase + UIC_PR, pr);
+ 	mtdcr(uic->dcrbase + UIC_TR, tr);
+ 
+-	spin_unlock_irqrestore(&uic->lock, flags);
++	raw_spin_unlock_irqrestore(&uic->lock, flags);
+ 
+ 	return 0;
  }
-Index: linux-2.6/kernel/latencytop.c
+@@ -254,7 +254,7 @@ static struct uic * __init uic_init_one(
+ 	if (! uic)
+ 		return NULL; /* FIXME: panic? */
+ 
+-	spin_lock_init(&uic->lock);
++	raw_spin_lock_init(&uic->lock);
+ 	indexp = of_get_property(node, "cell-index", &len);
+ 	if (!indexp || (len != sizeof(u32))) {
+ 		printk(KERN_ERR "uic: Device node %s has missing or invalid "
+Index: linux-2.6/drivers/dca/dca-core.c
 ===================================================================
---- linux-2.6.orig/kernel/latencytop.c
-+++ linux-2.6/kernel/latencytop.c
-@@ -58,7 +58,7 @@
- #include <linux/list.h>
- #include <linux/stacktrace.h>
+--- linux-2.6.orig/drivers/dca/dca-core.c
++++ linux-2.6/drivers/dca/dca-core.c
+@@ -35,7 +35,7 @@ MODULE_VERSION(DCA_VERSION);
+ MODULE_LICENSE("GPL");
+ MODULE_AUTHOR("Intel Corporation");
  
--static DEFINE_SPINLOCK(latency_lock);
-+static DEFINE_RAW_SPINLOCK(latency_lock);
+-static DEFINE_SPINLOCK(dca_lock);
++static DEFINE_RAW_SPINLOCK(dca_lock);
  
- #define MAXLR 128
- static struct latency_record latency_record[MAXLR];
-@@ -72,19 +72,19 @@ void clear_all_latency_tracing(struct ta
- 	if (!latencytop_enabled)
- 		return;
+ static LIST_HEAD(dca_domains);
  
--	spin_lock_irqsave(&latency_lock, flags);
-+	raw_spin_lock_irqsave(&latency_lock, flags);
- 	memset(&p->latency_record, 0, sizeof(p->latency_record));
- 	p->latency_record_count = 0;
--	spin_unlock_irqrestore(&latency_lock, flags);
-+	raw_spin_unlock_irqrestore(&latency_lock, flags);
- }
+@@ -101,10 +101,10 @@ static void unregister_dca_providers(voi
  
- static void clear_global_latency_tracing(void)
- {
- 	unsigned long flags;
+ 	INIT_LIST_HEAD(&unregistered_providers);
  
--	spin_lock_irqsave(&latency_lock, flags);
-+	raw_spin_lock_irqsave(&latency_lock, flags);
- 	memset(&latency_record, 0, sizeof(latency_record));
--	spin_unlock_irqrestore(&latency_lock, flags);
-+	raw_spin_unlock_irqrestore(&latency_lock, flags);
- }
+-	spin_lock_irqsave(&dca_lock, flags);
++	raw_spin_lock_irqsave(&dca_lock, flags);
  
- static void __sched
-@@ -190,7 +190,7 @@ __account_scheduler_latency(struct task_
- 	lat.max = usecs;
- 	store_stacktrace(tsk, &lat);
+ 	if (list_empty(&dca_domains)) {
+-		spin_unlock_irqrestore(&dca_lock, flags);
++		raw_spin_unlock_irqrestore(&dca_lock, flags);
+ 		return;
+ 	}
  
--	spin_lock_irqsave(&latency_lock, flags);
-+	raw_spin_lock_irqsave(&latency_lock, flags);
+@@ -116,7 +116,7 @@ static void unregister_dca_providers(voi
  
- 	account_global_scheduler_latency(tsk, &lat);
+ 	dca_free_domain(domain);
  
-@@ -231,7 +231,7 @@ __account_scheduler_latency(struct task_
- 	memcpy(&tsk->latency_record[i], &lat, sizeof(struct latency_record));
+-	spin_unlock_irqrestore(&dca_lock, flags);
++	raw_spin_unlock_irqrestore(&dca_lock, flags);
  
- out_unlock:
--	spin_unlock_irqrestore(&latency_lock, flags);
-+	raw_spin_unlock_irqrestore(&latency_lock, flags);
- }
+ 	list_for_each_entry_safe(dca, _dca, &unregistered_providers, node) {
+ 		dca_sysfs_remove_provider(dca);
+@@ -144,13 +144,8 @@ static struct dca_domain *dca_get_domain
+ 	domain = dca_find_domain(rc);
  
- static int lstats_show(struct seq_file *m, void *v)
-Index: linux-2.6/drivers/video/console/vgacon.c
-===================================================================
---- linux-2.6.orig/drivers/video/console/vgacon.c
-+++ linux-2.6/drivers/video/console/vgacon.c
-@@ -50,7 +50,7 @@
- #include <video/vga.h>
- #include <asm/io.h>
+ 	if (!domain) {
+-		if (dca_provider_ioat_ver_3_0(dev) && !list_empty(&dca_domains)) {
++		if (dca_provider_ioat_ver_3_0(dev) && !list_empty(&dca_domains))
+ 			dca_providers_blocked = 1;
+-		} else {
+-			domain = dca_allocate_domain(rc);
+-			if (domain)
+-				list_add(&domain->node, &dca_domains);
+-		}
+ 	}
  
--static DEFINE_SPINLOCK(vga_lock);
-+static DEFINE_RAW_SPINLOCK(vga_lock);
- static int cursor_size_lastfrom;
- static int cursor_size_lastto;
- static u32 vgacon_xres;
-@@ -157,7 +157,7 @@ static inline void write_vga(unsigned ch
- 	 * ddprintk might set the console position from interrupt
- 	 * handlers, thus the write has to be IRQ-atomic.
- 	 */
--	spin_lock_irqsave(&vga_lock, flags);
-+	raw_spin_lock_irqsave(&vga_lock, flags);
+ 	return domain;
+@@ -198,19 +193,19 @@ int dca_add_requester(struct device *dev
+ 	if (!dev)
+ 		return -EFAULT;
  
- #ifndef SLOW_VGA
- 	v1 = reg + (val & 0xff00);
-@@ -170,7 +170,7 @@ static inline void write_vga(unsigned ch
- 	outb_p(reg + 1, vga_video_port_reg);
- 	outb_p(val & 0xff, vga_video_port_val);
- #endif
--	spin_unlock_irqrestore(&vga_lock, flags);
-+	raw_spin_unlock_irqrestore(&vga_lock, flags);
- }
+-	spin_lock_irqsave(&dca_lock, flags);
++	raw_spin_lock_irqsave(&dca_lock, flags);
  
- static inline void vga_set_mem_top(struct vc_data *c)
-@@ -664,7 +664,7 @@ static void vgacon_set_cursor_size(int x
- 	cursor_size_lastfrom = from;
- 	cursor_size_lastto = to;
+ 	/* check if the requester has not been added already */
+ 	dca = dca_find_provider_by_dev(dev);
+ 	if (dca) {
+-		spin_unlock_irqrestore(&dca_lock, flags);
++		raw_spin_unlock_irqrestore(&dca_lock, flags);
+ 		return -EEXIST;
+ 	}
  
--	spin_lock_irqsave(&vga_lock, flags);
-+	raw_spin_lock_irqsave(&vga_lock, flags);
- 	if (vga_video_type >= VIDEO_TYPE_VGAC) {
- 		outb_p(VGA_CRTC_CURSOR_START, vga_video_port_reg);
- 		curs = inb_p(vga_video_port_val);
-@@ -682,7 +682,7 @@ static void vgacon_set_cursor_size(int x
- 	outb_p(curs, vga_video_port_val);
- 	outb_p(VGA_CRTC_CURSOR_END, vga_video_port_reg);
- 	outb_p(cure, vga_video_port_val);
--	spin_unlock_irqrestore(&vga_lock, flags);
-+	raw_spin_unlock_irqrestore(&vga_lock, flags);
- }
+ 	pci_rc = dca_pci_rc_from_dev(dev);
+ 	domain = dca_find_domain(pci_rc);
+ 	if (!domain) {
+-		spin_unlock_irqrestore(&dca_lock, flags);
++		raw_spin_unlock_irqrestore(&dca_lock, flags);
+ 		return -ENODEV;
+ 	}
  
- static void vgacon_cursor(struct vc_data *c, int mode)
-@@ -757,7 +757,7 @@ static int vgacon_doresize(struct vc_dat
- 	unsigned int scanlines = height * c->vc_font.height;
- 	u8 scanlines_lo = 0, r7 = 0, vsync_end = 0, mode, max_scan;
+@@ -220,17 +215,17 @@ int dca_add_requester(struct device *dev
+ 			break;
+ 	}
  
--	spin_lock_irqsave(&vga_lock, flags);
-+	raw_spin_lock_irqsave(&vga_lock, flags);
+-	spin_unlock_irqrestore(&dca_lock, flags);
++	raw_spin_unlock_irqrestore(&dca_lock, flags);
  
- 	vgacon_xres = width * VGA_FONTWIDTH;
- 	vgacon_yres = height * c->vc_font.height;
-@@ -808,7 +808,7 @@ static int vgacon_doresize(struct vc_dat
- 		outb_p(vsync_end, vga_video_port_val);
+ 	if (slot < 0)
+ 		return slot;
+ 
+ 	err = dca_sysfs_add_req(dca, dev, slot);
+ 	if (err) {
+-		spin_lock_irqsave(&dca_lock, flags);
++		raw_spin_lock_irqsave(&dca_lock, flags);
+ 		if (dca == dca_find_provider_by_dev(dev))
+ 			dca->ops->remove_requester(dca, dev);
+-		spin_unlock_irqrestore(&dca_lock, flags);
++		raw_spin_unlock_irqrestore(&dca_lock, flags);
+ 		return err;
  	}
  
--	spin_unlock_irqrestore(&vga_lock, flags);
-+	raw_spin_unlock_irqrestore(&vga_lock, flags);
- 	return 0;
- }
+@@ -251,14 +246,14 @@ int dca_remove_requester(struct device *
+ 	if (!dev)
+ 		return -EFAULT;
  
-@@ -891,11 +891,11 @@ static void vga_vesa_blank(struct vgasta
- {
- 	/* save original values of VGA controller registers */
- 	if (!vga_vesa_blanked) {
--		spin_lock_irq(&vga_lock);
-+		raw_spin_lock_irq(&vga_lock);
- 		vga_state.SeqCtrlIndex = vga_r(state->vgabase, VGA_SEQ_I);
- 		vga_state.CrtCtrlIndex = inb_p(vga_video_port_reg);
- 		vga_state.CrtMiscIO = vga_r(state->vgabase, VGA_MIS_R);
--		spin_unlock_irq(&vga_lock);
-+		raw_spin_unlock_irq(&vga_lock);
+-	spin_lock_irqsave(&dca_lock, flags);
++	raw_spin_lock_irqsave(&dca_lock, flags);
+ 	dca = dca_find_provider_by_dev(dev);
+ 	if (!dca) {
+-		spin_unlock_irqrestore(&dca_lock, flags);
++		raw_spin_unlock_irqrestore(&dca_lock, flags);
+ 		return -ENODEV;
+ 	}
+ 	slot = dca->ops->remove_requester(dca, dev);
+-	spin_unlock_irqrestore(&dca_lock, flags);
++	raw_spin_unlock_irqrestore(&dca_lock, flags);
  
- 		outb_p(0x00, vga_video_port_reg);	/* HorizontalTotal */
- 		vga_state.HorizontalTotal = inb_p(vga_video_port_val);
-@@ -918,7 +918,7 @@ static void vga_vesa_blank(struct vgasta
+ 	if (slot < 0)
+ 		return slot;
+@@ -280,16 +275,16 @@ u8 dca_common_get_tag(struct device *dev
+ 	u8 tag;
+ 	unsigned long flags;
  
- 	/* assure that video is enabled */
- 	/* "0x20" is VIDEO_ENABLE_bit in register 01 of sequencer */
--	spin_lock_irq(&vga_lock);
-+	raw_spin_lock_irq(&vga_lock);
- 	vga_wseq(state->vgabase, VGA_SEQ_CLOCK_MODE, vga_state.ClockingMode | 0x20);
+-	spin_lock_irqsave(&dca_lock, flags);
++	raw_spin_lock_irqsave(&dca_lock, flags);
  
- 	/* test for vertical retrace in process.... */
-@@ -954,13 +954,13 @@ static void vga_vesa_blank(struct vgasta
- 	/* restore both index registers */
- 	vga_w(state->vgabase, VGA_SEQ_I, vga_state.SeqCtrlIndex);
- 	outb_p(vga_state.CrtCtrlIndex, vga_video_port_reg);
--	spin_unlock_irq(&vga_lock);
-+	raw_spin_unlock_irq(&vga_lock);
+ 	dca = dca_find_provider_by_dev(dev);
+ 	if (!dca) {
+-		spin_unlock_irqrestore(&dca_lock, flags);
++		raw_spin_unlock_irqrestore(&dca_lock, flags);
+ 		return -ENODEV;
+ 	}
+ 	tag = dca->ops->get_tag(dca, dev, cpu);
+ 
+-	spin_unlock_irqrestore(&dca_lock, flags);
++	raw_spin_unlock_irqrestore(&dca_lock, flags);
+ 	return tag;
  }
  
- static void vga_vesa_unblank(struct vgastate *state)
+@@ -360,36 +355,51 @@ int register_dca_provider(struct dca_pro
  {
- 	/* restore original values of VGA controller registers */
--	spin_lock_irq(&vga_lock);
-+	raw_spin_lock_irq(&vga_lock);
- 	vga_w(state->vgabase, VGA_MIS_W, vga_state.CrtMiscIO);
- 
- 	outb_p(0x00, vga_video_port_reg);	/* HorizontalTotal */
-@@ -985,7 +985,7 @@ static void vga_vesa_unblank(struct vgas
- 	/* restore index/control registers */
- 	vga_w(state->vgabase, VGA_SEQ_I, vga_state.SeqCtrlIndex);
- 	outb_p(vga_state.CrtCtrlIndex, vga_video_port_reg);
--	spin_unlock_irq(&vga_lock);
-+	raw_spin_unlock_irq(&vga_lock);
- }
+ 	int err;
+ 	unsigned long flags;
+-	struct dca_domain *domain;
++	struct dca_domain *domain, *newdomain = NULL;
  
- static void vga_pal_blank(struct vgastate *state)
-@@ -1104,7 +1104,7 @@ static int vgacon_do_font_op(struct vgas
- 		charmap += 4 * cmapsz;
- #endif
+-	spin_lock_irqsave(&dca_lock, flags);
++	raw_spin_lock_irqsave(&dca_lock, flags);
+ 	if (dca_providers_blocked) {
+-		spin_unlock_irqrestore(&dca_lock, flags);
++		raw_spin_unlock_irqrestore(&dca_lock, flags);
+ 		return -ENODEV;
+ 	}
+-	spin_unlock_irqrestore(&dca_lock, flags);
++	raw_spin_unlock_irqrestore(&dca_lock, flags);
  
--	spin_lock_irq(&vga_lock);
-+	raw_spin_lock_irq(&vga_lock);
- 	/* First, the Sequencer */
- 	vga_wseq(state->vgabase, VGA_SEQ_RESET, 0x1);
- 	/* CPU writes only to map 2 */
-@@ -1120,7 +1120,7 @@ static int vgacon_do_font_op(struct vgas
- 	vga_wgfx(state->vgabase, VGA_GFX_MODE, 0x00);
- 	/* map start at A000:0000 */
- 	vga_wgfx(state->vgabase, VGA_GFX_MISC, 0x00);
--	spin_unlock_irq(&vga_lock);
-+	raw_spin_unlock_irq(&vga_lock);
+ 	err = dca_sysfs_add_provider(dca, dev);
+ 	if (err)
+ 		return err;
  
- 	if (arg) {
- 		if (set)
-@@ -1147,7 +1147,7 @@ static int vgacon_do_font_op(struct vgas
+-	spin_lock_irqsave(&dca_lock, flags);
++	raw_spin_lock_irqsave(&dca_lock, flags);
+ 	domain = dca_get_domain(dev);
+ 	if (!domain) {
++		struct pci_bus *rc;
++
+ 		if (dca_providers_blocked) {
+-			spin_unlock_irqrestore(&dca_lock, flags);
++			raw_spin_unlock_irqrestore(&dca_lock, flags);
+ 			dca_sysfs_remove_provider(dca);
+ 			unregister_dca_providers();
+-		} else {
+-			spin_unlock_irqrestore(&dca_lock, flags);
++			return -ENODEV;
++		}
++
++		raw_spin_unlock_irqrestore(&dca_lock, flags);
++		rc = dca_pci_rc_from_dev(dev);
++		newdomain = dca_allocate_domain(rc);
++		if (!newdomain)
++			return -ENODEV;
++		raw_spin_lock_irqsave(&dca_lock, flags);
++		/* Recheck, we might have raced after dropping the lock */
++		domain = dca_get_domain(dev);
++		if (!domain) {
++			domain = newdomain;
++			newdomain = NULL;
++			list_add(&domain->node, &dca_domains);
  		}
+-		return -ENODEV;
  	}
+ 	list_add(&dca->node, &domain->dca_providers);
+-	spin_unlock_irqrestore(&dca_lock, flags);
++	raw_spin_unlock_irqrestore(&dca_lock, flags);
  
--	spin_lock_irq(&vga_lock);
-+	raw_spin_lock_irq(&vga_lock);
- 	/* First, the sequencer, Synchronous reset */
- 	vga_wseq(state->vgabase, VGA_SEQ_RESET, 0x01);	
- 	/* CPU writes to maps 0 and 1 */
-@@ -1186,7 +1186,7 @@ static int vgacon_do_font_op(struct vgas
- 		inb_p(video_port_status);
- 		vga_wattr(state->vgabase, VGA_AR_ENABLE_DISPLAY, 0);	
- 	}
--	spin_unlock_irq(&vga_lock);
-+	raw_spin_unlock_irq(&vga_lock);
+ 	blocking_notifier_call_chain(&dca_provider_chain,
+ 				     DCA_PROVIDER_ADD, NULL);
++	kfree(newdomain);
  	return 0;
  }
+ EXPORT_SYMBOL_GPL(register_dca_provider);
+@@ -407,7 +417,7 @@ void unregister_dca_provider(struct dca_
+ 	blocking_notifier_call_chain(&dca_provider_chain,
+ 				     DCA_PROVIDER_REMOVE, NULL);
  
-@@ -1211,26 +1211,26 @@ static int vgacon_adjust_height(struct v
- 	   registers; they are write-only on EGA, but it appears that they
- 	   are all don't care bits on EGA, so I guess it doesn't matter. */
- 
--	spin_lock_irq(&vga_lock);
-+	raw_spin_lock_irq(&vga_lock);
- 	outb_p(0x07, vga_video_port_reg);	/* CRTC overflow register */
- 	ovr = inb_p(vga_video_port_val);
- 	outb_p(0x09, vga_video_port_reg);	/* Font size register */
- 	fsr = inb_p(vga_video_port_val);
--	spin_unlock_irq(&vga_lock);
-+	raw_spin_unlock_irq(&vga_lock);
- 
- 	vde = maxscan & 0xff;	/* Vertical display end reg */
- 	ovr = (ovr & 0xbd) +	/* Overflow register */
- 	    ((maxscan & 0x100) >> 7) + ((maxscan & 0x200) >> 3);
- 	fsr = (fsr & 0xe0) + (fontheight - 1);	/*  Font size register */
+-	spin_lock_irqsave(&dca_lock, flags);
++	raw_spin_lock_irqsave(&dca_lock, flags);
  
--	spin_lock_irq(&vga_lock);
-+	raw_spin_lock_irq(&vga_lock);
- 	outb_p(0x07, vga_video_port_reg);	/* CRTC overflow register */
- 	outb_p(ovr, vga_video_port_val);
- 	outb_p(0x09, vga_video_port_reg);	/* Font size */
- 	outb_p(fsr, vga_video_port_val);
- 	outb_p(0x12, vga_video_port_reg);	/* Vertical display limit */
- 	outb_p(vde, vga_video_port_val);
--	spin_unlock_irq(&vga_lock);
-+	raw_spin_unlock_irq(&vga_lock);
- 	vga_video_font_height = fontheight;
+ 	list_del(&dca->node);
  
- 	for (i = 0; i < MAX_NR_CONSOLES; i++) {
-Index: linux-2.6/arch/x86/oprofile/nmi_int.c
-===================================================================
---- linux-2.6.orig/arch/x86/oprofile/nmi_int.c
-+++ linux-2.6/arch/x86/oprofile/nmi_int.c
-@@ -355,10 +355,10 @@ static void nmi_cpu_setup(void *dummy)
- 	int cpu = smp_processor_id();
- 	struct op_msrs *msrs = &per_cpu(cpu_msrs, cpu);
- 	nmi_cpu_save_registers(msrs);
--	spin_lock(&oprofilefs_lock);
-+	raw_spin_lock(&oprofilefs_lock);
- 	model->setup_ctrs(model, msrs);
- 	nmi_cpu_setup_mux(cpu, msrs);
--	spin_unlock(&oprofilefs_lock);
-+	raw_spin_unlock(&oprofilefs_lock);
- 	per_cpu(saved_lvtpc, cpu) = apic_read(APIC_LVTPC);
- 	apic_write(APIC_LVTPC, APIC_DM_NMI);
+@@ -416,7 +426,7 @@ void unregister_dca_provider(struct dca_
+ 	if (list_empty(&domain->dca_providers))
+ 		dca_free_domain(domain);
+ 
+-	spin_unlock_irqrestore(&dca_lock, flags);
++	raw_spin_unlock_irqrestore(&dca_lock, flags);
+ 
+ 	dca_sysfs_remove_provider(dca);
  }
-Index: linux-2.6/drivers/oprofile/event_buffer.c
+Index: linux-2.6/arch/arm/common/gic.c
 ===================================================================
---- linux-2.6.orig/drivers/oprofile/event_buffer.c
-+++ linux-2.6/drivers/oprofile/event_buffer.c
-@@ -82,10 +82,10 @@ int alloc_event_buffer(void)
- {
- 	unsigned long flags;
+--- linux-2.6.orig/arch/arm/common/gic.c
++++ linux-2.6/arch/arm/common/gic.c
+@@ -33,7 +33,7 @@
+ #include <asm/mach/irq.h>
+ #include <asm/hardware/gic.h>
  
--	spin_lock_irqsave(&oprofilefs_lock, flags);
-+	raw_spin_lock_irqsave(&oprofilefs_lock, flags);
- 	buffer_size = oprofile_buffer_size;
- 	buffer_watershed = oprofile_buffer_watershed;
--	spin_unlock_irqrestore(&oprofilefs_lock, flags);
-+	raw_spin_unlock_irqrestore(&oprofilefs_lock, flags);
+-static DEFINE_SPINLOCK(irq_controller_lock);
++static DEFINE_RAW_SPINLOCK(irq_controller_lock);
  
- 	if (buffer_watershed >= buffer_size)
- 		return -EINVAL;
-Index: linux-2.6/drivers/oprofile/oprofile_perf.c
-===================================================================
---- linux-2.6.orig/drivers/oprofile/oprofile_perf.c
-+++ linux-2.6/drivers/oprofile/oprofile_perf.c
-@@ -160,9 +160,9 @@ static int oprofile_perf_create_files(st
+ /* Address of GIC 0 CPU interface */
+ void __iomem *gic_cpu_base_addr __read_mostly;
+@@ -88,30 +88,30 @@ static void gic_mask_irq(struct irq_data
+ {
+ 	u32 mask = 1 << (d->irq % 32);
  
- static int oprofile_perf_setup(void)
+-	spin_lock(&irq_controller_lock);
++	raw_spin_lock(&irq_controller_lock);
+ 	writel_relaxed(mask, gic_dist_base(d) + GIC_DIST_ENABLE_CLEAR + (gic_irq(d) / 32) * 4);
+ 	if (gic_arch_extn.irq_mask)
+ 		gic_arch_extn.irq_mask(d);
+-	spin_unlock(&irq_controller_lock);
++	raw_spin_unlock(&irq_controller_lock);
+ }
+ 
+ static void gic_unmask_irq(struct irq_data *d)
  {
--	spin_lock(&oprofilefs_lock);
-+	raw_spin_lock(&oprofilefs_lock);
- 	op_perf_setup();
--	spin_unlock(&oprofilefs_lock);
-+	raw_spin_unlock(&oprofilefs_lock);
- 	return 0;
+ 	u32 mask = 1 << (d->irq % 32);
+ 
+-	spin_lock(&irq_controller_lock);
++	raw_spin_lock(&irq_controller_lock);
+ 	if (gic_arch_extn.irq_unmask)
+ 		gic_arch_extn.irq_unmask(d);
+ 	writel_relaxed(mask, gic_dist_base(d) + GIC_DIST_ENABLE_SET + (gic_irq(d) / 32) * 4);
+-	spin_unlock(&irq_controller_lock);
++	raw_spin_unlock(&irq_controller_lock);
  }
  
-Index: linux-2.6/drivers/oprofile/oprofilefs.c
-===================================================================
---- linux-2.6.orig/drivers/oprofile/oprofilefs.c
-+++ linux-2.6/drivers/oprofile/oprofilefs.c
-@@ -21,7 +21,7 @@
+ static void gic_eoi_irq(struct irq_data *d)
+ {
+ 	if (gic_arch_extn.irq_eoi) {
+-		spin_lock(&irq_controller_lock);
++		raw_spin_lock(&irq_controller_lock);
+ 		gic_arch_extn.irq_eoi(d);
+-		spin_unlock(&irq_controller_lock);
++		raw_spin_unlock(&irq_controller_lock);
+ 	}
  
- #define OPROFILEFS_MAGIC 0x6f70726f
+ 	writel_relaxed(gic_irq(d), gic_cpu_base(d) + GIC_CPU_EOI);
+@@ -135,7 +135,7 @@ static int gic_set_type(struct irq_data 
+ 	if (type != IRQ_TYPE_LEVEL_HIGH && type != IRQ_TYPE_EDGE_RISING)
+ 		return -EINVAL;
  
--DEFINE_SPINLOCK(oprofilefs_lock);
-+DEFINE_RAW_SPINLOCK(oprofilefs_lock);
+-	spin_lock(&irq_controller_lock);
++	raw_spin_lock(&irq_controller_lock);
  
- static struct inode *oprofilefs_get_inode(struct super_block *sb, int mode)
- {
-@@ -76,9 +76,9 @@ int oprofilefs_ulong_from_user(unsigned 
- 	if (copy_from_user(tmpbuf, buf, count))
- 		return -EFAULT;
+ 	if (gic_arch_extn.irq_set_type)
+ 		gic_arch_extn.irq_set_type(d, type);
+@@ -160,7 +160,7 @@ static int gic_set_type(struct irq_data 
+ 	if (enabled)
+ 		writel_relaxed(enablemask, base + GIC_DIST_ENABLE_SET + enableoff);
+ 
+-	spin_unlock(&irq_controller_lock);
++	raw_spin_unlock(&irq_controller_lock);
  
--	spin_lock_irqsave(&oprofilefs_lock, flags);
-+	raw_spin_lock_irqsave(&oprofilefs_lock, flags);
- 	*val = simple_strtoul(tmpbuf, NULL, 0);
--	spin_unlock_irqrestore(&oprofilefs_lock, flags);
-+	raw_spin_unlock_irqrestore(&oprofilefs_lock, flags);
  	return 0;
  }
+@@ -188,11 +188,11 @@ static int gic_set_affinity(struct irq_d
+ 	mask = 0xff << shift;
+ 	bit = 1 << (cpu + shift);
  
-Index: linux-2.6/include/linux/oprofile.h
-===================================================================
---- linux-2.6.orig/include/linux/oprofile.h
-+++ linux-2.6/include/linux/oprofile.h
-@@ -166,7 +166,7 @@ ssize_t oprofilefs_ulong_to_user(unsigne
- int oprofilefs_ulong_from_user(unsigned long * val, char const __user * buf, size_t count);
+-	spin_lock(&irq_controller_lock);
++	raw_spin_lock(&irq_controller_lock);
+ 	d->node = cpu;
+ 	val = readl_relaxed(reg) & ~mask;
+ 	writel_relaxed(val | bit, reg);
+-	spin_unlock(&irq_controller_lock);
++	raw_spin_unlock(&irq_controller_lock);
  
- /** lock for read/write safety */
--extern spinlock_t oprofilefs_lock;
-+extern raw_spinlock_t oprofilefs_lock;
+ 	return 0;
+ }
+@@ -222,9 +222,9 @@ static void gic_handle_cascade_irq(unsig
  
- /**
-  * Add the contents of a circular buffer to the event buffer.
-Index: linux-2.6/drivers/acpi/processor_idle.c
+ 	chained_irq_enter(chip, desc);
+ 
+-	spin_lock(&irq_controller_lock);
++	raw_spin_lock(&irq_controller_lock);
+ 	status = readl_relaxed(chip_data->cpu_base + GIC_CPU_INTACK);
+-	spin_unlock(&irq_controller_lock);
++	raw_spin_unlock(&irq_controller_lock);
+ 
+ 	gic_irq = (status & 0x3ff);
+ 	if (gic_irq == 1023)
+Index: linux-2.6/arch/arm/include/asm/dma.h
 ===================================================================
---- linux-2.6.orig/drivers/acpi/processor_idle.c
-+++ linux-2.6/drivers/acpi/processor_idle.c
-@@ -852,7 +852,7 @@ static int acpi_idle_enter_simple(struct
- }
+--- linux-2.6.orig/arch/arm/include/asm/dma.h
++++ linux-2.6/arch/arm/include/asm/dma.h
+@@ -33,18 +33,18 @@
+ #define DMA_MODE_CASCADE 0xc0
+ #define DMA_AUTOINIT	 0x10
  
- static int c3_cpu_count;
--static DEFINE_SPINLOCK(c3_lock);
-+static DEFINE_RAW_SPINLOCK(c3_lock);
+-extern spinlock_t  dma_spin_lock;
++extern raw_spinlock_t  dma_spin_lock;
  
- /**
-  * acpi_idle_enter_bm - enters C3 with proper BM handling
-@@ -930,12 +930,12 @@ static int acpi_idle_enter_bm(struct cpu
- 	 * without doing anything.
- 	 */
- 	if (pr->flags.bm_check && pr->flags.bm_control) {
--		spin_lock(&c3_lock);
-+		raw_spin_lock(&c3_lock);
- 		c3_cpu_count++;
- 		/* Disable bus master arbitration when all CPUs are in C3 */
- 		if (c3_cpu_count == num_online_cpus())
- 			acpi_write_bit_register(ACPI_BITREG_ARB_DISABLE, 1);
--		spin_unlock(&c3_lock);
-+		raw_spin_unlock(&c3_lock);
- 	} else if (!pr->flags.bm_check) {
- 		ACPI_FLUSH_CPU_CACHE();
- 	}
-@@ -944,10 +944,10 @@ static int acpi_idle_enter_bm(struct cpu
+ static inline unsigned long claim_dma_lock(void)
+ {
+ 	unsigned long flags;
+-	spin_lock_irqsave(&dma_spin_lock, flags);
++	raw_spin_lock_irqsave(&dma_spin_lock, flags);
+ 	return flags;
+ }
  
- 	/* Re-enable bus master arbitration */
- 	if (pr->flags.bm_check && pr->flags.bm_control) {
--		spin_lock(&c3_lock);
-+		raw_spin_lock(&c3_lock);
- 		acpi_write_bit_register(ACPI_BITREG_ARB_DISABLE, 0);
- 		c3_cpu_count--;
--		spin_unlock(&c3_lock);
-+		raw_spin_unlock(&c3_lock);
- 	}
- 	kt2 = ktime_get_real();
- 	idle_time_ns = ktime_to_ns(ktime_sub(kt2, kt1));
-Index: linux-2.6/arch/x86/kernel/cpu/mcheck/mce_intel.c
+ static inline void release_dma_lock(unsigned long flags)
+ {
+-	spin_unlock_irqrestore(&dma_spin_lock, flags);
++	raw_spin_unlock_irqrestore(&dma_spin_lock, flags);
+ }
+ 
+ /* Clear the 'DMA Pointer Flip Flop'.
+Index: linux-2.6/arch/arm/include/asm/mmu.h
 ===================================================================
---- linux-2.6.orig/arch/x86/kernel/cpu/mcheck/mce_intel.c
-+++ linux-2.6/arch/x86/kernel/cpu/mcheck/mce_intel.c
-@@ -28,7 +28,7 @@ static DEFINE_PER_CPU(mce_banks_t, mce_b
-  * cmci_discover_lock protects against parallel discovery attempts
-  * which could race against each other.
-  */
--static DEFINE_SPINLOCK(cmci_discover_lock);
-+static DEFINE_RAW_SPINLOCK(cmci_discover_lock);
+--- linux-2.6.orig/arch/arm/include/asm/mmu.h
++++ linux-2.6/arch/arm/include/asm/mmu.h
+@@ -6,7 +6,7 @@
+ typedef struct {
+ #ifdef CONFIG_CPU_HAS_ASID
+ 	unsigned int id;
+-	spinlock_t id_lock;
++	raw_spinlock_t id_lock;
+ #endif
+ 	unsigned int kvm_seq;
+ } mm_context_t;
+@@ -16,7 +16,7 @@ typedef struct {
  
- #define CMCI_THRESHOLD 1
+ /* init_mm.context.id_lock should be initialized. */
+ #define INIT_MM_CONTEXT(name)                                                 \
+-	.context.id_lock    = __SPIN_LOCK_UNLOCKED(name.context.id_lock),
++	.context.id_lock    = __RAW_SPIN_LOCK_UNLOCKED(name.context.id_lock),
+ #else
+ #define ASID(mm)	(0)
+ #endif
+Index: linux-2.6/arch/arm/kernel/dma.c
+===================================================================
+--- linux-2.6.orig/arch/arm/kernel/dma.c
++++ linux-2.6/arch/arm/kernel/dma.c
+@@ -23,7 +23,7 @@
  
-@@ -85,7 +85,7 @@ static void cmci_discover(int banks, int
- 	int hdr = 0;
- 	int i;
+ #include <asm/mach/dma.h>
  
--	spin_lock_irqsave(&cmci_discover_lock, flags);
-+	raw_spin_lock_irqsave(&cmci_discover_lock, flags);
- 	for (i = 0; i < banks; i++) {
- 		u64 val;
+-DEFINE_SPINLOCK(dma_spin_lock);
++DEFINE_RAW_SPINLOCK(dma_spin_lock);
+ EXPORT_SYMBOL(dma_spin_lock);
  
-@@ -116,7 +116,7 @@ static void cmci_discover(int banks, int
- 			WARN_ON(!test_bit(i, __get_cpu_var(mce_poll_banks)));
- 		}
- 	}
--	spin_unlock_irqrestore(&cmci_discover_lock, flags);
-+	raw_spin_unlock_irqrestore(&cmci_discover_lock, flags);
- 	if (hdr)
- 		printk(KERN_CONT "\n");
+ static dma_t *dma_chan[MAX_DMA_CHANNELS];
+Index: linux-2.6/arch/arm/kernel/traps.c
+===================================================================
+--- linux-2.6.orig/arch/arm/kernel/traps.c
++++ linux-2.6/arch/arm/kernel/traps.c
+@@ -255,7 +255,7 @@ static int __die(const char *str, int er
+ 	return ret;
  }
-@@ -150,7 +150,7 @@ void cmci_clear(void)
  
- 	if (!cmci_supported(&banks))
- 		return;
--	spin_lock_irqsave(&cmci_discover_lock, flags);
-+	raw_spin_lock_irqsave(&cmci_discover_lock, flags);
- 	for (i = 0; i < banks; i++) {
- 		if (!test_bit(i, __get_cpu_var(mce_banks_owned)))
- 			continue;
-@@ -160,7 +160,7 @@ void cmci_clear(void)
- 		wrmsrl(MSR_IA32_MCx_CTL2(i), val);
- 		__clear_bit(i, __get_cpu_var(mce_banks_owned));
- 	}
--	spin_unlock_irqrestore(&cmci_discover_lock, flags);
-+	raw_spin_unlock_irqrestore(&cmci_discover_lock, flags);
- }
+-static DEFINE_SPINLOCK(die_lock);
++static DEFINE_RAW_SPINLOCK(die_lock);
  
  /*
-Index: linux-2.6/arch/powerpc/sysdev/uic.c
-===================================================================
---- linux-2.6.orig/arch/powerpc/sysdev/uic.c
-+++ linux-2.6/arch/powerpc/sysdev/uic.c
-@@ -47,7 +47,7 @@ struct uic {
- 	int index;
- 	int dcrbase;
+  * This function is protected against re-entrancy.
+@@ -267,7 +267,7 @@ void die(const char *str, struct pt_regs
  
--	spinlock_t lock;
-+	raw_spinlock_t lock;
+ 	oops_enter();
  
- 	/* The remapper for this UIC */
- 	struct irq_host	*irqhost;
-@@ -61,14 +61,14 @@ static void uic_unmask_irq(struct irq_da
- 	u32 er, sr;
+-	spin_lock_irq(&die_lock);
++	raw_spin_lock_irq(&die_lock);
+ 	console_verbose();
+ 	bust_spinlocks(1);
+ 	ret = __die(str, err, thread, regs);
+@@ -277,7 +277,7 @@ void die(const char *str, struct pt_regs
  
- 	sr = 1 << (31-src);
--	spin_lock_irqsave(&uic->lock, flags);
-+	raw_spin_lock_irqsave(&uic->lock, flags);
- 	/* ack level-triggered interrupts here */
- 	if (irqd_is_level_type(d))
- 		mtdcr(uic->dcrbase + UIC_SR, sr);
- 	er = mfdcr(uic->dcrbase + UIC_ER);
- 	er |= sr;
- 	mtdcr(uic->dcrbase + UIC_ER, er);
--	spin_unlock_irqrestore(&uic->lock, flags);
-+	raw_spin_unlock_irqrestore(&uic->lock, flags);
+ 	bust_spinlocks(0);
+ 	add_taint(TAINT_DIE);
+-	spin_unlock_irq(&die_lock);
++	raw_spin_unlock_irq(&die_lock);
+ 	oops_exit();
+ 
+ 	if (in_interrupt())
+@@ -302,24 +302,24 @@ void arm_notify_die(const char *str, str
  }
  
- static void uic_mask_irq(struct irq_data *d)
-@@ -78,11 +78,11 @@ static void uic_mask_irq(struct irq_data
+ static LIST_HEAD(undef_hook);
+-static DEFINE_SPINLOCK(undef_lock);
++static DEFINE_RAW_SPINLOCK(undef_lock);
+ 
+ void register_undef_hook(struct undef_hook *hook)
+ {
  	unsigned long flags;
- 	u32 er;
  
--	spin_lock_irqsave(&uic->lock, flags);
-+	raw_spin_lock_irqsave(&uic->lock, flags);
- 	er = mfdcr(uic->dcrbase + UIC_ER);
- 	er &= ~(1 << (31 - src));
- 	mtdcr(uic->dcrbase + UIC_ER, er);
--	spin_unlock_irqrestore(&uic->lock, flags);
-+	raw_spin_unlock_irqrestore(&uic->lock, flags);
+-	spin_lock_irqsave(&undef_lock, flags);
++	raw_spin_lock_irqsave(&undef_lock, flags);
+ 	list_add(&hook->node, &undef_hook);
+-	spin_unlock_irqrestore(&undef_lock, flags);
++	raw_spin_unlock_irqrestore(&undef_lock, flags);
  }
  
- static void uic_ack_irq(struct irq_data *d)
-@@ -91,9 +91,9 @@ static void uic_ack_irq(struct irq_data 
- 	unsigned int src = irqd_to_hwirq(d);
+ void unregister_undef_hook(struct undef_hook *hook)
+ {
  	unsigned long flags;
  
--	spin_lock_irqsave(&uic->lock, flags);
-+	raw_spin_lock_irqsave(&uic->lock, flags);
- 	mtdcr(uic->dcrbase + UIC_SR, 1 << (31-src));
--	spin_unlock_irqrestore(&uic->lock, flags);
-+	raw_spin_unlock_irqrestore(&uic->lock, flags);
+-	spin_lock_irqsave(&undef_lock, flags);
++	raw_spin_lock_irqsave(&undef_lock, flags);
+ 	list_del(&hook->node);
+-	spin_unlock_irqrestore(&undef_lock, flags);
++	raw_spin_unlock_irqrestore(&undef_lock, flags);
  }
  
- static void uic_mask_ack_irq(struct irq_data *d)
-@@ -104,7 +104,7 @@ static void uic_mask_ack_irq(struct irq_
- 	u32 er, sr;
+ static int call_undef_hook(struct pt_regs *regs, unsigned int instr)
+@@ -328,12 +328,12 @@ static int call_undef_hook(struct pt_reg
+ 	unsigned long flags;
+ 	int (*fn)(struct pt_regs *regs, unsigned int instr) = NULL;
  
- 	sr = 1 << (31-src);
--	spin_lock_irqsave(&uic->lock, flags);
-+	raw_spin_lock_irqsave(&uic->lock, flags);
- 	er = mfdcr(uic->dcrbase + UIC_ER);
- 	er &= ~sr;
- 	mtdcr(uic->dcrbase + UIC_ER, er);
-@@ -118,7 +118,7 @@ static void uic_mask_ack_irq(struct irq_
- 	 */
- 	if (!irqd_is_level_type(d))
- 		mtdcr(uic->dcrbase + UIC_SR, sr);
--	spin_unlock_irqrestore(&uic->lock, flags);
-+	raw_spin_unlock_irqrestore(&uic->lock, flags);
+-	spin_lock_irqsave(&undef_lock, flags);
++	raw_spin_lock_irqsave(&undef_lock, flags);
+ 	list_for_each_entry(hook, &undef_hook, node)
+ 		if ((instr & hook->instr_mask) == hook->instr_val &&
+ 		    (regs->ARM_cpsr & hook->cpsr_mask) == hook->cpsr_val)
+ 			fn = hook->fn;
+-	spin_unlock_irqrestore(&undef_lock, flags);
++	raw_spin_unlock_irqrestore(&undef_lock, flags);
+ 
+ 	return fn ? fn(regs, instr) : 1;
  }
+Index: linux-2.6/arch/arm/mach-footbridge/include/mach/hardware.h
+===================================================================
+--- linux-2.6.orig/arch/arm/mach-footbridge/include/mach/hardware.h
++++ linux-2.6/arch/arm/mach-footbridge/include/mach/hardware.h
+@@ -93,7 +93,7 @@
+ #define CPLD_FLASH_WR_ENABLE	1
  
- static int uic_set_irq_type(struct irq_data *d, unsigned int flow_type)
-@@ -152,7 +152,7 @@ static int uic_set_irq_type(struct irq_d
+ #ifndef __ASSEMBLY__
+-extern spinlock_t nw_gpio_lock;
++extern raw_spinlock_t nw_gpio_lock;
+ extern void nw_gpio_modify_op(unsigned int mask, unsigned int set);
+ extern void nw_gpio_modify_io(unsigned int mask, unsigned int in);
+ extern unsigned int nw_gpio_read(void);
+Index: linux-2.6/arch/arm/mach-footbridge/netwinder-hw.c
+===================================================================
+--- linux-2.6.orig/arch/arm/mach-footbridge/netwinder-hw.c
++++ linux-2.6/arch/arm/mach-footbridge/netwinder-hw.c
+@@ -68,7 +68,7 @@ static inline void wb977_ww(int reg, int
+ /*
+  * This is a lock for accessing ports GP1_IO_BASE and GP2_IO_BASE
+  */
+-DEFINE_SPINLOCK(nw_gpio_lock);
++DEFINE_RAW_SPINLOCK(nw_gpio_lock);
+ EXPORT_SYMBOL(nw_gpio_lock);
  
- 	mask = ~(1 << (31 - src));
+ static unsigned int current_gpio_op;
+@@ -327,9 +327,9 @@ static inline void wb977_init_gpio(void)
+ 	/*
+ 	 * Set Group1/Group2 outputs
+ 	 */
+-	spin_lock_irqsave(&nw_gpio_lock, flags);
++	raw_spin_lock_irqsave(&nw_gpio_lock, flags);
+ 	nw_gpio_modify_op(-1, GPIO_RED_LED | GPIO_FAN);
+-	spin_unlock_irqrestore(&nw_gpio_lock, flags);
++	raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
+ }
  
--	spin_lock_irqsave(&uic->lock, flags);
-+	raw_spin_lock_irqsave(&uic->lock, flags);
- 	tr = mfdcr(uic->dcrbase + UIC_TR);
- 	pr = mfdcr(uic->dcrbase + UIC_PR);
- 	tr = (tr & mask) | (trigger << (31-src));
-@@ -161,7 +161,7 @@ static int uic_set_irq_type(struct irq_d
- 	mtdcr(uic->dcrbase + UIC_PR, pr);
- 	mtdcr(uic->dcrbase + UIC_TR, tr);
+ /*
+@@ -390,9 +390,9 @@ static void __init cpld_init(void)
+ {
+ 	unsigned long flags;
  
--	spin_unlock_irqrestore(&uic->lock, flags);
-+	raw_spin_unlock_irqrestore(&uic->lock, flags);
+-	spin_lock_irqsave(&nw_gpio_lock, flags);
++	raw_spin_lock_irqsave(&nw_gpio_lock, flags);
+ 	nw_cpld_modify(-1, CPLD_UNMUTE | CPLD_7111_DISABLE);
+-	spin_unlock_irqrestore(&nw_gpio_lock, flags);
++	raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
+ }
+ 
+ static unsigned char rwa_unlock[] __initdata =
+@@ -616,9 +616,9 @@ static int __init nw_hw_init(void)
+ 		cpld_init();
+ 		rwa010_init();
  
+-		spin_lock_irqsave(&nw_gpio_lock, flags);
++		raw_spin_lock_irqsave(&nw_gpio_lock, flags);
+ 		nw_gpio_modify_op(GPIO_RED_LED|GPIO_GREEN_LED, DEFAULT_LEDS);
+-		spin_unlock_irqrestore(&nw_gpio_lock, flags);
++		raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
+ 	}
  	return 0;
  }
-@@ -254,7 +254,7 @@ static struct uic * __init uic_init_one(
- 	if (! uic)
- 		return NULL; /* FIXME: panic? */
- 
--	spin_lock_init(&uic->lock);
-+	raw_spin_lock_init(&uic->lock);
- 	indexp = of_get_property(node, "cell-index", &len);
- 	if (!indexp || (len != sizeof(u32))) {
- 		printk(KERN_ERR "uic: Device node %s has missing or invalid "
-Index: linux-2.6/drivers/dca/dca-core.c
+Index: linux-2.6/arch/arm/mach-footbridge/netwinder-leds.c
 ===================================================================
---- linux-2.6.orig/drivers/dca/dca-core.c
-+++ linux-2.6/drivers/dca/dca-core.c
-@@ -35,7 +35,7 @@ MODULE_VERSION(DCA_VERSION);
- MODULE_LICENSE("GPL");
- MODULE_AUTHOR("Intel Corporation");
+--- linux-2.6.orig/arch/arm/mach-footbridge/netwinder-leds.c
++++ linux-2.6/arch/arm/mach-footbridge/netwinder-leds.c
+@@ -31,13 +31,13 @@
+ static char led_state;
+ static char hw_led_state;
  
--static DEFINE_SPINLOCK(dca_lock);
-+static DEFINE_RAW_SPINLOCK(dca_lock);
+-static DEFINE_SPINLOCK(leds_lock);
++static DEFINE_RAW_SPINLOCK(leds_lock);
  
- static LIST_HEAD(dca_domains);
+ static void netwinder_leds_event(led_event_t evt)
+ {
+ 	unsigned long flags;
  
-@@ -101,10 +101,10 @@ static void unregister_dca_providers(voi
+-	spin_lock_irqsave(&leds_lock, flags);
++	raw_spin_lock_irqsave(&leds_lock, flags);
  
- 	INIT_LIST_HEAD(&unregistered_providers);
+ 	switch (evt) {
+ 	case led_start:
+@@ -117,12 +117,12 @@ static void netwinder_leds_event(led_eve
+ 		break;
+ 	}
  
--	spin_lock_irqsave(&dca_lock, flags);
-+	raw_spin_lock_irqsave(&dca_lock, flags);
+-	spin_unlock_irqrestore(&leds_lock, flags);
++	raw_spin_unlock_irqrestore(&leds_lock, flags);
  
- 	if (list_empty(&dca_domains)) {
--		spin_unlock_irqrestore(&dca_lock, flags);
-+		raw_spin_unlock_irqrestore(&dca_lock, flags);
- 		return;
+ 	if  (led_state & LED_STATE_ENABLED) {
+-		spin_lock_irqsave(&nw_gpio_lock, flags);
++		raw_spin_lock_irqsave(&nw_gpio_lock, flags);
+ 		nw_gpio_modify_op(GPIO_RED_LED | GPIO_GREEN_LED, hw_led_state);
+-		spin_unlock_irqrestore(&nw_gpio_lock, flags);
++		raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
  	}
+ }
  
-@@ -116,7 +116,7 @@ static void unregister_dca_providers(voi
+Index: linux-2.6/arch/arm/mach-integrator/core.c
+===================================================================
+--- linux-2.6.orig/arch/arm/mach-integrator/core.c
++++ linux-2.6/arch/arm/mach-integrator/core.c
+@@ -205,7 +205,7 @@ static struct amba_pl010_data integrator
  
- 	dca_free_domain(domain);
+ #define CM_CTRL	IO_ADDRESS(INTEGRATOR_HDR_CTRL)
  
--	spin_unlock_irqrestore(&dca_lock, flags);
-+	raw_spin_unlock_irqrestore(&dca_lock, flags);
+-static DEFINE_SPINLOCK(cm_lock);
++static DEFINE_RAW_SPINLOCK(cm_lock);
  
- 	list_for_each_entry_safe(dca, _dca, &unregistered_providers, node) {
- 		dca_sysfs_remove_provider(dca);
-@@ -144,13 +144,8 @@ static struct dca_domain *dca_get_domain
- 	domain = dca_find_domain(rc);
+ /**
+  * cm_control - update the CM_CTRL register.
+@@ -217,10 +217,10 @@ void cm_control(u32 mask, u32 set)
+ 	unsigned long flags;
+ 	u32 val;
  
- 	if (!domain) {
--		if (dca_provider_ioat_ver_3_0(dev) && !list_empty(&dca_domains)) {
-+		if (dca_provider_ioat_ver_3_0(dev) && !list_empty(&dca_domains))
- 			dca_providers_blocked = 1;
--		} else {
--			domain = dca_allocate_domain(rc);
--			if (domain)
--				list_add(&domain->node, &dca_domains);
--		}
- 	}
+-	spin_lock_irqsave(&cm_lock, flags);
++	raw_spin_lock_irqsave(&cm_lock, flags);
+ 	val = readl(CM_CTRL) & ~mask;
+ 	writel(val | set, CM_CTRL);
+-	spin_unlock_irqrestore(&cm_lock, flags);
++	raw_spin_unlock_irqrestore(&cm_lock, flags);
+ }
  
- 	return domain;
-@@ -198,19 +193,19 @@ int dca_add_requester(struct device *dev
- 	if (!dev)
- 		return -EFAULT;
+ EXPORT_SYMBOL(cm_control);
+Index: linux-2.6/arch/arm/mach-integrator/pci_v3.c
+===================================================================
+--- linux-2.6.orig/arch/arm/mach-integrator/pci_v3.c
++++ linux-2.6/arch/arm/mach-integrator/pci_v3.c
+@@ -163,7 +163,7 @@
+  *	 7:2	register number
+  *  
+  */
+-static DEFINE_SPINLOCK(v3_lock);
++static DEFINE_RAW_SPINLOCK(v3_lock);
  
--	spin_lock_irqsave(&dca_lock, flags);
-+	raw_spin_lock_irqsave(&dca_lock, flags);
+ #define PCI_BUS_NONMEM_START	0x00000000
+ #define PCI_BUS_NONMEM_SIZE	SZ_256M
+@@ -284,7 +284,7 @@ static int v3_read_config(struct pci_bus
+ 	unsigned long flags;
+ 	u32 v;
  
- 	/* check if the requester has not been added already */
- 	dca = dca_find_provider_by_dev(dev);
- 	if (dca) {
--		spin_unlock_irqrestore(&dca_lock, flags);
-+		raw_spin_unlock_irqrestore(&dca_lock, flags);
- 		return -EEXIST;
- 	}
+-	spin_lock_irqsave(&v3_lock, flags);
++	raw_spin_lock_irqsave(&v3_lock, flags);
+ 	addr = v3_open_config_window(bus, devfn, where);
  
- 	pci_rc = dca_pci_rc_from_dev(dev);
- 	domain = dca_find_domain(pci_rc);
- 	if (!domain) {
--		spin_unlock_irqrestore(&dca_lock, flags);
-+		raw_spin_unlock_irqrestore(&dca_lock, flags);
- 		return -ENODEV;
+ 	switch (size) {
+@@ -302,7 +302,7 @@ static int v3_read_config(struct pci_bus
  	}
  
-@@ -220,17 +215,17 @@ int dca_add_requester(struct device *dev
- 			break;
- 	}
+ 	v3_close_config_window();
+-	spin_unlock_irqrestore(&v3_lock, flags);
++	raw_spin_unlock_irqrestore(&v3_lock, flags);
  
--	spin_unlock_irqrestore(&dca_lock, flags);
-+	raw_spin_unlock_irqrestore(&dca_lock, flags);
+ 	*val = v;
+ 	return PCIBIOS_SUCCESSFUL;
+@@ -314,7 +314,7 @@ static int v3_write_config(struct pci_bu
+ 	unsigned long addr;
+ 	unsigned long flags;
  
- 	if (slot < 0)
- 		return slot;
+-	spin_lock_irqsave(&v3_lock, flags);
++	raw_spin_lock_irqsave(&v3_lock, flags);
+ 	addr = v3_open_config_window(bus, devfn, where);
  
- 	err = dca_sysfs_add_req(dca, dev, slot);
- 	if (err) {
--		spin_lock_irqsave(&dca_lock, flags);
-+		raw_spin_lock_irqsave(&dca_lock, flags);
- 		if (dca == dca_find_provider_by_dev(dev))
- 			dca->ops->remove_requester(dca, dev);
--		spin_unlock_irqrestore(&dca_lock, flags);
-+		raw_spin_unlock_irqrestore(&dca_lock, flags);
- 		return err;
+ 	switch (size) {
+@@ -335,7 +335,7 @@ static int v3_write_config(struct pci_bu
  	}
  
-@@ -251,14 +246,14 @@ int dca_remove_requester(struct device *
- 	if (!dev)
- 		return -EFAULT;
- 
--	spin_lock_irqsave(&dca_lock, flags);
-+	raw_spin_lock_irqsave(&dca_lock, flags);
- 	dca = dca_find_provider_by_dev(dev);
- 	if (!dca) {
--		spin_unlock_irqrestore(&dca_lock, flags);
-+		raw_spin_unlock_irqrestore(&dca_lock, flags);
- 		return -ENODEV;
- 	}
- 	slot = dca->ops->remove_requester(dca, dev);
--	spin_unlock_irqrestore(&dca_lock, flags);
-+	raw_spin_unlock_irqrestore(&dca_lock, flags);
+ 	v3_close_config_window();
+-	spin_unlock_irqrestore(&v3_lock, flags);
++	raw_spin_unlock_irqrestore(&v3_lock, flags);
  
- 	if (slot < 0)
- 		return slot;
-@@ -280,16 +275,16 @@ u8 dca_common_get_tag(struct device *dev
- 	u8 tag;
- 	unsigned long flags;
+ 	return PCIBIOS_SUCCESSFUL;
+ }
+@@ -510,7 +510,7 @@ void __init pci_v3_preinit(void)
+ 	hook_fault_code(8, v3_pci_fault, SIGBUS, 0, "external abort on non-linefetch");
+ 	hook_fault_code(10, v3_pci_fault, SIGBUS, 0, "external abort on non-linefetch");
  
--	spin_lock_irqsave(&dca_lock, flags);
-+	raw_spin_lock_irqsave(&dca_lock, flags);
+-	spin_lock_irqsave(&v3_lock, flags);
++	raw_spin_lock_irqsave(&v3_lock, flags);
  
- 	dca = dca_find_provider_by_dev(dev);
- 	if (!dca) {
--		spin_unlock_irqrestore(&dca_lock, flags);
-+		raw_spin_unlock_irqrestore(&dca_lock, flags);
- 		return -ENODEV;
- 	}
- 	tag = dca->ops->get_tag(dca, dev, cpu);
+ 	/*
+ 	 * Unlock V3 registers, but only if they were previously locked.
+@@ -583,7 +583,7 @@ void __init pci_v3_preinit(void)
+ 		printk(KERN_ERR "PCI: unable to grab PCI error "
+ 		       "interrupt: %d\n", ret);
  
--	spin_unlock_irqrestore(&dca_lock, flags);
-+	raw_spin_unlock_irqrestore(&dca_lock, flags);
- 	return tag;
+-	spin_unlock_irqrestore(&v3_lock, flags);
++	raw_spin_unlock_irqrestore(&v3_lock, flags);
  }
  
-@@ -360,36 +355,51 @@ int register_dca_provider(struct dca_pro
+ void __init pci_v3_postinit(void)
+Index: linux-2.6/arch/arm/mach-ixp4xx/common-pci.c
+===================================================================
+--- linux-2.6.orig/arch/arm/mach-ixp4xx/common-pci.c
++++ linux-2.6/arch/arm/mach-ixp4xx/common-pci.c
+@@ -54,7 +54,7 @@ unsigned long ixp4xx_pci_reg_base = 0;
+  * these transactions are atomic or we will end up
+  * with corrupt data on the bus or in a driver.
+  */
+-static DEFINE_SPINLOCK(ixp4xx_pci_lock);
++static DEFINE_RAW_SPINLOCK(ixp4xx_pci_lock);
+ 
+ /*
+  * Read from PCI config space
+@@ -62,10 +62,10 @@ static DEFINE_SPINLOCK(ixp4xx_pci_lock);
+ static void crp_read(u32 ad_cbe, u32 *data)
  {
- 	int err;
  	unsigned long flags;
--	struct dca_domain *domain;
-+	struct dca_domain *domain, *newdomain = NULL;
+-	spin_lock_irqsave(&ixp4xx_pci_lock, flags);
++	raw_spin_lock_irqsave(&ixp4xx_pci_lock, flags);
+ 	*PCI_CRP_AD_CBE = ad_cbe;
+ 	*data = *PCI_CRP_RDATA;
+-	spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
++	raw_spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
+ }
  
--	spin_lock_irqsave(&dca_lock, flags);
-+	raw_spin_lock_irqsave(&dca_lock, flags);
- 	if (dca_providers_blocked) {
--		spin_unlock_irqrestore(&dca_lock, flags);
-+		raw_spin_unlock_irqrestore(&dca_lock, flags);
- 		return -ENODEV;
- 	}
--	spin_unlock_irqrestore(&dca_lock, flags);
-+	raw_spin_unlock_irqrestore(&dca_lock, flags);
+ /*
+@@ -74,10 +74,10 @@ static void crp_read(u32 ad_cbe, u32 *da
+ static void crp_write(u32 ad_cbe, u32 data)
+ { 
+ 	unsigned long flags;
+-	spin_lock_irqsave(&ixp4xx_pci_lock, flags);
++	raw_spin_lock_irqsave(&ixp4xx_pci_lock, flags);
+ 	*PCI_CRP_AD_CBE = CRP_AD_CBE_WRITE | ad_cbe;
+ 	*PCI_CRP_WDATA = data;
+-	spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
++	raw_spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
+ }
  
- 	err = dca_sysfs_add_provider(dca, dev);
- 	if (err)
- 		return err;
+ static inline int check_master_abort(void)
+@@ -101,7 +101,7 @@ int ixp4xx_pci_read_errata(u32 addr, u32
+ 	int retval = 0;
+ 	int i;
  
--	spin_lock_irqsave(&dca_lock, flags);
-+	raw_spin_lock_irqsave(&dca_lock, flags);
- 	domain = dca_get_domain(dev);
- 	if (!domain) {
-+		struct pci_bus *rc;
-+
- 		if (dca_providers_blocked) {
--			spin_unlock_irqrestore(&dca_lock, flags);
-+			raw_spin_unlock_irqrestore(&dca_lock, flags);
- 			dca_sysfs_remove_provider(dca);
- 			unregister_dca_providers();
--		} else {
--			spin_unlock_irqrestore(&dca_lock, flags);
-+			return -ENODEV;
-+		}
-+
-+		raw_spin_unlock_irqrestore(&dca_lock, flags);
-+		rc = dca_pci_rc_from_dev(dev);
-+		newdomain = dca_allocate_domain(rc);
-+		if (!newdomain)
-+			return -ENODEV;
-+		raw_spin_lock_irqsave(&dca_lock, flags);
-+		/* Recheck, we might have raced after dropping the lock */
-+		domain = dca_get_domain(dev);
-+		if (!domain) {
-+			domain = newdomain;
-+			newdomain = NULL;
-+			list_add(&domain->node, &dca_domains);
- 		}
--		return -ENODEV;
- 	}
- 	list_add(&dca->node, &domain->dca_providers);
--	spin_unlock_irqrestore(&dca_lock, flags);
-+	raw_spin_unlock_irqrestore(&dca_lock, flags);
+-	spin_lock_irqsave(&ixp4xx_pci_lock, flags);
++	raw_spin_lock_irqsave(&ixp4xx_pci_lock, flags);
  
- 	blocking_notifier_call_chain(&dca_provider_chain,
- 				     DCA_PROVIDER_ADD, NULL);
-+	kfree(newdomain);
- 	return 0;
- }
- EXPORT_SYMBOL_GPL(register_dca_provider);
-@@ -407,7 +417,7 @@ void unregister_dca_provider(struct dca_
- 	blocking_notifier_call_chain(&dca_provider_chain,
- 				     DCA_PROVIDER_REMOVE, NULL);
+ 	*PCI_NP_AD = addr;
+ 
+@@ -118,7 +118,7 @@ int ixp4xx_pci_read_errata(u32 addr, u32
+ 	if(check_master_abort())
+ 		retval = 1;
+ 
+-	spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
++	raw_spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
+ 	return retval;
+ }
  
--	spin_lock_irqsave(&dca_lock, flags);
-+	raw_spin_lock_irqsave(&dca_lock, flags);
+@@ -127,7 +127,7 @@ int ixp4xx_pci_read_no_errata(u32 addr, 
+ 	unsigned long flags;
+ 	int retval = 0;
  
- 	list_del(&dca->node);
+-	spin_lock_irqsave(&ixp4xx_pci_lock, flags);
++	raw_spin_lock_irqsave(&ixp4xx_pci_lock, flags);
  
-@@ -416,7 +426,7 @@ void unregister_dca_provider(struct dca_
- 	if (list_empty(&domain->dca_providers))
- 		dca_free_domain(domain);
+ 	*PCI_NP_AD = addr;
  
--	spin_unlock_irqrestore(&dca_lock, flags);
-+	raw_spin_unlock_irqrestore(&dca_lock, flags);
+@@ -140,7 +140,7 @@ int ixp4xx_pci_read_no_errata(u32 addr, 
+ 	if(check_master_abort())
+ 		retval = 1;
  
- 	dca_sysfs_remove_provider(dca);
+-	spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
++	raw_spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
+ 	return retval;
  }
-Index: linux-2.6/arch/arm/common/gic.c
-===================================================================
---- linux-2.6.orig/arch/arm/common/gic.c
-+++ linux-2.6/arch/arm/common/gic.c
-@@ -33,7 +33,7 @@
- #include <asm/mach/irq.h>
- #include <asm/hardware/gic.h>
  
--static DEFINE_SPINLOCK(irq_controller_lock);
-+static DEFINE_RAW_SPINLOCK(irq_controller_lock);
+@@ -149,7 +149,7 @@ int ixp4xx_pci_write(u32 addr, u32 cmd, 
+ 	unsigned long flags;
+ 	int retval = 0;
  
- /* Address of GIC 0 CPU interface */
- void __iomem *gic_cpu_base_addr __read_mostly;
-@@ -88,30 +88,30 @@ static void gic_mask_irq(struct irq_data
- {
- 	u32 mask = 1 << (d->irq % 32);
+-	spin_lock_irqsave(&ixp4xx_pci_lock, flags);
++	raw_spin_lock_irqsave(&ixp4xx_pci_lock, flags);
  
--	spin_lock(&irq_controller_lock);
-+	raw_spin_lock(&irq_controller_lock);
- 	writel_relaxed(mask, gic_dist_base(d) + GIC_DIST_ENABLE_CLEAR + (gic_irq(d) / 32) * 4);
- 	if (gic_arch_extn.irq_mask)
- 		gic_arch_extn.irq_mask(d);
--	spin_unlock(&irq_controller_lock);
-+	raw_spin_unlock(&irq_controller_lock);
- }
+ 	*PCI_NP_AD = addr;
  
- static void gic_unmask_irq(struct irq_data *d)
- {
- 	u32 mask = 1 << (d->irq % 32);
+@@ -162,7 +162,7 @@ int ixp4xx_pci_write(u32 addr, u32 cmd, 
+ 	if(check_master_abort())
+ 		retval = 1;
  
--	spin_lock(&irq_controller_lock);
-+	raw_spin_lock(&irq_controller_lock);
- 	if (gic_arch_extn.irq_unmask)
- 		gic_arch_extn.irq_unmask(d);
- 	writel_relaxed(mask, gic_dist_base(d) + GIC_DIST_ENABLE_SET + (gic_irq(d) / 32) * 4);
--	spin_unlock(&irq_controller_lock);
-+	raw_spin_unlock(&irq_controller_lock);
+-	spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
++	raw_spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
+ 	return retval;
  }
  
- static void gic_eoi_irq(struct irq_data *d)
- {
- 	if (gic_arch_extn.irq_eoi) {
--		spin_lock(&irq_controller_lock);
-+		raw_spin_lock(&irq_controller_lock);
- 		gic_arch_extn.irq_eoi(d);
--		spin_unlock(&irq_controller_lock);
-+		raw_spin_unlock(&irq_controller_lock);
- 	}
+Index: linux-2.6/arch/arm/mach-shark/leds.c
+===================================================================
+--- linux-2.6.orig/arch/arm/mach-shark/leds.c
++++ linux-2.6/arch/arm/mach-shark/leds.c
+@@ -36,7 +36,7 @@ static char led_state;
+ static short hw_led_state;
+ static short saved_state;
  
- 	writel_relaxed(gic_irq(d), gic_cpu_base(d) + GIC_CPU_EOI);
-@@ -135,7 +135,7 @@ static int gic_set_type(struct irq_data 
- 	if (type != IRQ_TYPE_LEVEL_HIGH && type != IRQ_TYPE_EDGE_RISING)
- 		return -EINVAL;
+-static DEFINE_SPINLOCK(leds_lock);
++static DEFINE_RAW_SPINLOCK(leds_lock);
  
--	spin_lock(&irq_controller_lock);
-+	raw_spin_lock(&irq_controller_lock);
+ short sequoia_read(int addr) {
+   outw(addr,0x24);
+@@ -52,7 +52,7 @@ static void sequoia_leds_event(led_event
+ {
+ 	unsigned long flags;
  
- 	if (gic_arch_extn.irq_set_type)
- 		gic_arch_extn.irq_set_type(d, type);
-@@ -160,7 +160,7 @@ static int gic_set_type(struct irq_data 
- 	if (enabled)
- 		writel_relaxed(enablemask, base + GIC_DIST_ENABLE_SET + enableoff);
+-	spin_lock_irqsave(&leds_lock, flags);
++	raw_spin_lock_irqsave(&leds_lock, flags);
  
--	spin_unlock(&irq_controller_lock);
-+	raw_spin_unlock(&irq_controller_lock);
+ 	hw_led_state = sequoia_read(0x09);
  
- 	return 0;
+@@ -144,7 +144,7 @@ static void sequoia_leds_event(led_event
+ 	if  (led_state & LED_STATE_ENABLED)
+ 		sequoia_write(hw_led_state,0x09);
+ 
+-	spin_unlock_irqrestore(&leds_lock, flags);
++	raw_spin_unlock_irqrestore(&leds_lock, flags);
  }
-@@ -188,11 +188,11 @@ static int gic_set_affinity(struct irq_d
- 	mask = 0xff << shift;
- 	bit = 1 << (cpu + shift);
  
--	spin_lock(&irq_controller_lock);
-+	raw_spin_lock(&irq_controller_lock);
- 	d->node = cpu;
- 	val = readl_relaxed(reg) & ~mask;
- 	writel_relaxed(val | bit, reg);
--	spin_unlock(&irq_controller_lock);
-+	raw_spin_unlock(&irq_controller_lock);
+ static int __init leds_init(void)
+Index: linux-2.6/arch/arm/mm/cache-l2x0.c
+===================================================================
+--- linux-2.6.orig/arch/arm/mm/cache-l2x0.c
++++ linux-2.6/arch/arm/mm/cache-l2x0.c
+@@ -26,7 +26,7 @@
+ #define CACHE_LINE_SIZE		32
  
- 	return 0;
- }
-@@ -222,9 +222,9 @@ static void gic_handle_cascade_irq(unsig
+ static void __iomem *l2x0_base;
+-static DEFINE_SPINLOCK(l2x0_lock);
++static DEFINE_RAW_SPINLOCK(l2x0_lock);
+ static uint32_t l2x0_way_mask;	/* Bitmask of active ways */
+ static uint32_t l2x0_size;
  
- 	chained_irq_enter(chip, desc);
+@@ -115,9 +115,9 @@ static void l2x0_cache_sync(void)
+ {
+ 	unsigned long flags;
  
--	spin_lock(&irq_controller_lock);
-+	raw_spin_lock(&irq_controller_lock);
- 	status = readl_relaxed(chip_data->cpu_base + GIC_CPU_INTACK);
--	spin_unlock(&irq_controller_lock);
-+	raw_spin_unlock(&irq_controller_lock);
+-	spin_lock_irqsave(&l2x0_lock, flags);
++	raw_spin_lock_irqsave(&l2x0_lock, flags);
+ 	cache_sync();
+-	spin_unlock_irqrestore(&l2x0_lock, flags);
++	raw_spin_unlock_irqrestore(&l2x0_lock, flags);
+ }
  
- 	gic_irq = (status & 0x3ff);
- 	if (gic_irq == 1023)
-Index: linux-2.6/arch/arm/include/asm/dma.h
-===================================================================
---- linux-2.6.orig/arch/arm/include/asm/dma.h
-+++ linux-2.6/arch/arm/include/asm/dma.h
-@@ -33,18 +33,18 @@
- #define DMA_MODE_CASCADE 0xc0
- #define DMA_AUTOINIT	 0x10
+ static void __l2x0_flush_all(void)
+@@ -134,9 +134,9 @@ static void l2x0_flush_all(void)
+ 	unsigned long flags;
  
--extern spinlock_t  dma_spin_lock;
-+extern raw_spinlock_t  dma_spin_lock;
+ 	/* clean all ways */
+-	spin_lock_irqsave(&l2x0_lock, flags);
++	raw_spin_lock_irqsave(&l2x0_lock, flags);
+ 	__l2x0_flush_all();
+-	spin_unlock_irqrestore(&l2x0_lock, flags);
++	raw_spin_unlock_irqrestore(&l2x0_lock, flags);
+ }
  
- static inline unsigned long claim_dma_lock(void)
- {
+ static void l2x0_clean_all(void)
+@@ -144,11 +144,11 @@ static void l2x0_clean_all(void)
  	unsigned long flags;
--	spin_lock_irqsave(&dma_spin_lock, flags);
-+	raw_spin_lock_irqsave(&dma_spin_lock, flags);
- 	return flags;
+ 
+ 	/* clean all ways */
+-	spin_lock_irqsave(&l2x0_lock, flags);
++	raw_spin_lock_irqsave(&l2x0_lock, flags);
+ 	writel_relaxed(l2x0_way_mask, l2x0_base + L2X0_CLEAN_WAY);
+ 	cache_wait_way(l2x0_base + L2X0_CLEAN_WAY, l2x0_way_mask);
+ 	cache_sync();
+-	spin_unlock_irqrestore(&l2x0_lock, flags);
++	raw_spin_unlock_irqrestore(&l2x0_lock, flags);
  }
  
- static inline void release_dma_lock(unsigned long flags)
- {
--	spin_unlock_irqrestore(&dma_spin_lock, flags);
-+	raw_spin_unlock_irqrestore(&dma_spin_lock, flags);
+ static void l2x0_inv_all(void)
+@@ -156,13 +156,13 @@ static void l2x0_inv_all(void)
+ 	unsigned long flags;
+ 
+ 	/* invalidate all ways */
+-	spin_lock_irqsave(&l2x0_lock, flags);
++	raw_spin_lock_irqsave(&l2x0_lock, flags);
+ 	/* Invalidating when L2 is enabled is a nono */
+ 	BUG_ON(readl(l2x0_base + L2X0_CTRL) & 1);
+ 	writel_relaxed(l2x0_way_mask, l2x0_base + L2X0_INV_WAY);
+ 	cache_wait_way(l2x0_base + L2X0_INV_WAY, l2x0_way_mask);
+ 	cache_sync();
+-	spin_unlock_irqrestore(&l2x0_lock, flags);
++	raw_spin_unlock_irqrestore(&l2x0_lock, flags);
  }
  
- /* Clear the 'DMA Pointer Flip Flop'.
-Index: linux-2.6/arch/arm/include/asm/mmu.h
-===================================================================
---- linux-2.6.orig/arch/arm/include/asm/mmu.h
-+++ linux-2.6/arch/arm/include/asm/mmu.h
-@@ -6,7 +6,7 @@
- typedef struct {
- #ifdef CONFIG_CPU_HAS_ASID
- 	unsigned int id;
--	spinlock_t id_lock;
-+	raw_spinlock_t id_lock;
- #endif
- 	unsigned int kvm_seq;
- } mm_context_t;
-@@ -16,7 +16,7 @@ typedef struct {
+ static void l2x0_inv_range(unsigned long start, unsigned long end)
+@@ -170,7 +170,7 @@ static void l2x0_inv_range(unsigned long
+ 	void __iomem *base = l2x0_base;
+ 	unsigned long flags;
  
- /* init_mm.context.id_lock should be initialized. */
- #define INIT_MM_CONTEXT(name)                                                 \
--	.context.id_lock    = __SPIN_LOCK_UNLOCKED(name.context.id_lock),
-+	.context.id_lock    = __RAW_SPIN_LOCK_UNLOCKED(name.context.id_lock),
- #else
- #define ASID(mm)	(0)
- #endif
-Index: linux-2.6/arch/arm/kernel/dma.c
-===================================================================
---- linux-2.6.orig/arch/arm/kernel/dma.c
-+++ linux-2.6/arch/arm/kernel/dma.c
-@@ -23,7 +23,7 @@
+-	spin_lock_irqsave(&l2x0_lock, flags);
++	raw_spin_lock_irqsave(&l2x0_lock, flags);
+ 	if (start & (CACHE_LINE_SIZE - 1)) {
+ 		start &= ~(CACHE_LINE_SIZE - 1);
+ 		debug_writel(0x03);
+@@ -195,13 +195,13 @@ static void l2x0_inv_range(unsigned long
+ 		}
+ 
+ 		if (blk_end < end) {
+-			spin_unlock_irqrestore(&l2x0_lock, flags);
+-			spin_lock_irqsave(&l2x0_lock, flags);
++			raw_spin_unlock_irqrestore(&l2x0_lock, flags);
++			raw_spin_lock_irqsave(&l2x0_lock, flags);
+ 		}
+ 	}
+ 	cache_wait(base + L2X0_INV_LINE_PA, 1);
+ 	cache_sync();
+-	spin_unlock_irqrestore(&l2x0_lock, flags);
++	raw_spin_unlock_irqrestore(&l2x0_lock, flags);
+ }
  
- #include <asm/mach/dma.h>
+ static void l2x0_clean_range(unsigned long start, unsigned long end)
+@@ -214,7 +214,7 @@ static void l2x0_clean_range(unsigned lo
+ 		return;
+ 	}
  
--DEFINE_SPINLOCK(dma_spin_lock);
-+DEFINE_RAW_SPINLOCK(dma_spin_lock);
- EXPORT_SYMBOL(dma_spin_lock);
+-	spin_lock_irqsave(&l2x0_lock, flags);
++	raw_spin_lock_irqsave(&l2x0_lock, flags);
+ 	start &= ~(CACHE_LINE_SIZE - 1);
+ 	while (start < end) {
+ 		unsigned long blk_end = start + min(end - start, 4096UL);
+@@ -225,13 +225,13 @@ static void l2x0_clean_range(unsigned lo
+ 		}
  
- static dma_t *dma_chan[MAX_DMA_CHANNELS];
-Index: linux-2.6/arch/arm/kernel/traps.c
-===================================================================
---- linux-2.6.orig/arch/arm/kernel/traps.c
-+++ linux-2.6/arch/arm/kernel/traps.c
-@@ -255,7 +255,7 @@ static int __die(const char *str, int er
- 	return ret;
+ 		if (blk_end < end) {
+-			spin_unlock_irqrestore(&l2x0_lock, flags);
+-			spin_lock_irqsave(&l2x0_lock, flags);
++			raw_spin_unlock_irqrestore(&l2x0_lock, flags);
++			raw_spin_lock_irqsave(&l2x0_lock, flags);
+ 		}
+ 	}
+ 	cache_wait(base + L2X0_CLEAN_LINE_PA, 1);
+ 	cache_sync();
+-	spin_unlock_irqrestore(&l2x0_lock, flags);
++	raw_spin_unlock_irqrestore(&l2x0_lock, flags);
  }
  
--static DEFINE_SPINLOCK(die_lock);
-+static DEFINE_RAW_SPINLOCK(die_lock);
- 
- /*
-  * This function is protected against re-entrancy.
-@@ -267,7 +267,7 @@ void die(const char *str, struct pt_regs
+ static void l2x0_flush_range(unsigned long start, unsigned long end)
+@@ -244,7 +244,7 @@ static void l2x0_flush_range(unsigned lo
+ 		return;
+ 	}
  
- 	oops_enter();
+-	spin_lock_irqsave(&l2x0_lock, flags);
++	raw_spin_lock_irqsave(&l2x0_lock, flags);
+ 	start &= ~(CACHE_LINE_SIZE - 1);
+ 	while (start < end) {
+ 		unsigned long blk_end = start + min(end - start, 4096UL);
+@@ -257,24 +257,24 @@ static void l2x0_flush_range(unsigned lo
+ 		debug_writel(0x00);
  
--	spin_lock_irq(&die_lock);
-+	raw_spin_lock_irq(&die_lock);
- 	console_verbose();
- 	bust_spinlocks(1);
- 	ret = __die(str, err, thread, regs);
-@@ -277,7 +277,7 @@ void die(const char *str, struct pt_regs
+ 		if (blk_end < end) {
+-			spin_unlock_irqrestore(&l2x0_lock, flags);
+-			spin_lock_irqsave(&l2x0_lock, flags);
++			raw_spin_unlock_irqrestore(&l2x0_lock, flags);
++			raw_spin_lock_irqsave(&l2x0_lock, flags);
+ 		}
+ 	}
+ 	cache_wait(base + L2X0_CLEAN_INV_LINE_PA, 1);
+ 	cache_sync();
+-	spin_unlock_irqrestore(&l2x0_lock, flags);
++	raw_spin_unlock_irqrestore(&l2x0_lock, flags);
+ }
  
- 	bust_spinlocks(0);
- 	add_taint(TAINT_DIE);
--	spin_unlock_irq(&die_lock);
-+	raw_spin_unlock_irq(&die_lock);
- 	oops_exit();
+ static void l2x0_disable(void)
+ {
+ 	unsigned long flags;
  
- 	if (in_interrupt())
-@@ -302,24 +302,24 @@ void arm_notify_die(const char *str, str
+-	spin_lock_irqsave(&l2x0_lock, flags);
++	raw_spin_lock_irqsave(&l2x0_lock, flags);
+ 	__l2x0_flush_all();
+ 	writel_relaxed(0, l2x0_base + L2X0_CTRL);
+ 	dsb();
+-	spin_unlock_irqrestore(&l2x0_lock, flags);
++	raw_spin_unlock_irqrestore(&l2x0_lock, flags);
  }
  
- static LIST_HEAD(undef_hook);
--static DEFINE_SPINLOCK(undef_lock);
-+static DEFINE_RAW_SPINLOCK(undef_lock);
+ void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask)
+Index: linux-2.6/arch/arm/mm/context.c
+===================================================================
+--- linux-2.6.orig/arch/arm/mm/context.c
++++ linux-2.6/arch/arm/mm/context.c
+@@ -16,7 +16,7 @@
+ #include <asm/mmu_context.h>
+ #include <asm/tlbflush.h>
  
- void register_undef_hook(struct undef_hook *hook)
+-static DEFINE_SPINLOCK(cpu_asid_lock);
++static DEFINE_RAW_SPINLOCK(cpu_asid_lock);
+ unsigned int cpu_last_asid = ASID_FIRST_VERSION;
+ #ifdef CONFIG_SMP
+ DEFINE_PER_CPU(struct mm_struct *, current_mm);
+@@ -31,7 +31,7 @@ DEFINE_PER_CPU(struct mm_struct *, curre
+ void __init_new_context(struct task_struct *tsk, struct mm_struct *mm)
  {
- 	unsigned long flags;
- 
--	spin_lock_irqsave(&undef_lock, flags);
-+	raw_spin_lock_irqsave(&undef_lock, flags);
- 	list_add(&hook->node, &undef_hook);
--	spin_unlock_irqrestore(&undef_lock, flags);
-+	raw_spin_unlock_irqrestore(&undef_lock, flags);
+ 	mm->context.id = 0;
+-	spin_lock_init(&mm->context.id_lock);
++	raw_spin_lock_init(&mm->context.id_lock);
  }
  
- void unregister_undef_hook(struct undef_hook *hook)
+ static void flush_context(void)
+@@ -58,7 +58,7 @@ static void set_mm_context(struct mm_str
+ 	 * the broadcast. This function is also called via IPI so the
+ 	 * mm->context.id_lock has to be IRQ-safe.
+ 	 */
+-	spin_lock_irqsave(&mm->context.id_lock, flags);
++	raw_spin_lock_irqsave(&mm->context.id_lock, flags);
+ 	if (likely((mm->context.id ^ cpu_last_asid) >> ASID_BITS)) {
+ 		/*
+ 		 * Old version of ASID found. Set the new one and
+@@ -67,7 +67,7 @@ static void set_mm_context(struct mm_str
+ 		mm->context.id = asid;
+ 		cpumask_clear(mm_cpumask(mm));
+ 	}
+-	spin_unlock_irqrestore(&mm->context.id_lock, flags);
++	raw_spin_unlock_irqrestore(&mm->context.id_lock, flags);
+ 
+ 	/*
+ 	 * Set the mm_cpumask(mm) bit for the current CPU.
+@@ -117,7 +117,7 @@ void __new_context(struct mm_struct *mm)
  {
- 	unsigned long flags;
+ 	unsigned int asid;
  
--	spin_lock_irqsave(&undef_lock, flags);
-+	raw_spin_lock_irqsave(&undef_lock, flags);
- 	list_del(&hook->node);
--	spin_unlock_irqrestore(&undef_lock, flags);
-+	raw_spin_unlock_irqrestore(&undef_lock, flags);
+-	spin_lock(&cpu_asid_lock);
++	raw_spin_lock(&cpu_asid_lock);
+ #ifdef CONFIG_SMP
+ 	/*
+ 	 * Check the ASID again, in case the change was broadcast from
+@@ -125,7 +125,7 @@ void __new_context(struct mm_struct *mm)
+ 	 */
+ 	if (unlikely(((mm->context.id ^ cpu_last_asid) >> ASID_BITS) == 0)) {
+ 		cpumask_set_cpu(smp_processor_id(), mm_cpumask(mm));
+-		spin_unlock(&cpu_asid_lock);
++		raw_spin_unlock(&cpu_asid_lock);
+ 		return;
+ 	}
+ #endif
+@@ -153,5 +153,5 @@ void __new_context(struct mm_struct *mm)
+ 	}
+ 
+ 	set_mm_context(mm, asid);
+-	spin_unlock(&cpu_asid_lock);
++	raw_spin_unlock(&cpu_asid_lock);
  }
+Index: linux-2.6/arch/arm/mm/copypage-v4mc.c
+===================================================================
+--- linux-2.6.orig/arch/arm/mm/copypage-v4mc.c
++++ linux-2.6/arch/arm/mm/copypage-v4mc.c
+@@ -30,7 +30,7 @@
+ #define minicache_pgprot __pgprot(L_PTE_PRESENT | L_PTE_YOUNG | \
+ 				  L_PTE_MT_MINICACHE)
  
- static int call_undef_hook(struct pt_regs *regs, unsigned int instr)
-@@ -328,12 +328,12 @@ static int call_undef_hook(struct pt_reg
- 	unsigned long flags;
- 	int (*fn)(struct pt_regs *regs, unsigned int instr) = NULL;
+-static DEFINE_SPINLOCK(minicache_lock);
++static DEFINE_RAW_SPINLOCK(minicache_lock);
  
--	spin_lock_irqsave(&undef_lock, flags);
-+	raw_spin_lock_irqsave(&undef_lock, flags);
- 	list_for_each_entry(hook, &undef_hook, node)
- 		if ((instr & hook->instr_mask) == hook->instr_val &&
- 		    (regs->ARM_cpsr & hook->cpsr_mask) == hook->cpsr_val)
- 			fn = hook->fn;
--	spin_unlock_irqrestore(&undef_lock, flags);
-+	raw_spin_unlock_irqrestore(&undef_lock, flags);
+ /*
+  * ARMv4 mini-dcache optimised copy_user_highpage
+@@ -76,14 +76,14 @@ void v4_mc_copy_user_highpage(struct pag
+ 	if (!test_and_set_bit(PG_dcache_clean, &from->flags))
+ 		__flush_dcache_page(page_mapping(from), from);
  
- 	return fn ? fn(regs, instr) : 1;
+-	spin_lock(&minicache_lock);
++	raw_spin_lock(&minicache_lock);
+ 
+ 	set_pte_ext(TOP_PTE(0xffff8000), pfn_pte(page_to_pfn(from), minicache_pgprot), 0);
+ 	flush_tlb_kernel_page(0xffff8000);
+ 
+ 	mc_copy_user_page((void *)0xffff8000, kto);
+ 
+-	spin_unlock(&minicache_lock);
++	raw_spin_unlock(&minicache_lock);
+ 
+ 	kunmap_atomic(kto, KM_USER1);
  }
-Index: linux-2.6/arch/arm/mach-footbridge/include/mach/hardware.h
+Index: linux-2.6/arch/arm/mm/copypage-v6.c
 ===================================================================
---- linux-2.6.orig/arch/arm/mach-footbridge/include/mach/hardware.h
-+++ linux-2.6/arch/arm/mach-footbridge/include/mach/hardware.h
-@@ -93,7 +93,7 @@
- #define CPLD_FLASH_WR_ENABLE	1
+--- linux-2.6.orig/arch/arm/mm/copypage-v6.c
++++ linux-2.6/arch/arm/mm/copypage-v6.c
+@@ -27,7 +27,7 @@
+ #define from_address	(0xffff8000)
+ #define to_address	(0xffffc000)
  
- #ifndef __ASSEMBLY__
--extern spinlock_t nw_gpio_lock;
-+extern raw_spinlock_t nw_gpio_lock;
- extern void nw_gpio_modify_op(unsigned int mask, unsigned int set);
- extern void nw_gpio_modify_io(unsigned int mask, unsigned int in);
- extern unsigned int nw_gpio_read(void);
-Index: linux-2.6/arch/arm/mach-footbridge/netwinder-hw.c
-===================================================================
---- linux-2.6.orig/arch/arm/mach-footbridge/netwinder-hw.c
-+++ linux-2.6/arch/arm/mach-footbridge/netwinder-hw.c
-@@ -68,7 +68,7 @@ static inline void wb977_ww(int reg, int
- /*
-  * This is a lock for accessing ports GP1_IO_BASE and GP2_IO_BASE
-  */
--DEFINE_SPINLOCK(nw_gpio_lock);
-+DEFINE_RAW_SPINLOCK(nw_gpio_lock);
- EXPORT_SYMBOL(nw_gpio_lock);
+-static DEFINE_SPINLOCK(v6_lock);
++static DEFINE_RAW_SPINLOCK(v6_lock);
  
- static unsigned int current_gpio_op;
-@@ -327,9 +327,9 @@ static inline void wb977_init_gpio(void)
- 	/*
- 	 * Set Group1/Group2 outputs
+ /*
+  * Copy the user page.  No aliasing to deal with so we can just
+@@ -89,7 +89,7 @@ static void v6_copy_user_highpage_aliasi
+ 	 * Now copy the page using the same cache colour as the
+ 	 * pages ultimate destination.
  	 */
--	spin_lock_irqsave(&nw_gpio_lock, flags);
-+	raw_spin_lock_irqsave(&nw_gpio_lock, flags);
- 	nw_gpio_modify_op(-1, GPIO_RED_LED | GPIO_FAN);
--	spin_unlock_irqrestore(&nw_gpio_lock, flags);
-+	raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
+-	spin_lock(&v6_lock);
++	raw_spin_lock(&v6_lock);
+ 
+ 	set_pte_ext(TOP_PTE(from_address) + offset, pfn_pte(page_to_pfn(from), PAGE_KERNEL), 0);
+ 	set_pte_ext(TOP_PTE(to_address) + offset, pfn_pte(page_to_pfn(to), PAGE_KERNEL), 0);
+@@ -102,7 +102,7 @@ static void v6_copy_user_highpage_aliasi
+ 
+ 	copy_page((void *)kto, (void *)kfrom);
+ 
+-	spin_unlock(&v6_lock);
++	raw_spin_unlock(&v6_lock);
  }
  
  /*
-@@ -390,9 +390,9 @@ static void __init cpld_init(void)
- {
- 	unsigned long flags;
+@@ -122,13 +122,13 @@ static void v6_clear_user_highpage_alias
+ 	 * Now clear the page using the same cache colour as
+ 	 * the pages ultimate destination.
+ 	 */
+-	spin_lock(&v6_lock);
++	raw_spin_lock(&v6_lock);
  
--	spin_lock_irqsave(&nw_gpio_lock, flags);
-+	raw_spin_lock_irqsave(&nw_gpio_lock, flags);
- 	nw_cpld_modify(-1, CPLD_UNMUTE | CPLD_7111_DISABLE);
--	spin_unlock_irqrestore(&nw_gpio_lock, flags);
-+	raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
+ 	set_pte_ext(TOP_PTE(to_address) + offset, pfn_pte(page_to_pfn(page), PAGE_KERNEL), 0);
+ 	flush_tlb_kernel_page(to);
+ 	clear_page((void *)to);
+ 
+-	spin_unlock(&v6_lock);
++	raw_spin_unlock(&v6_lock);
  }
  
- static unsigned char rwa_unlock[] __initdata =
-@@ -616,9 +616,9 @@ static int __init nw_hw_init(void)
- 		cpld_init();
- 		rwa010_init();
+ struct cpu_user_fns v6_user_fns __initdata = {
+Index: linux-2.6/arch/arm/mm/copypage-xscale.c
+===================================================================
+--- linux-2.6.orig/arch/arm/mm/copypage-xscale.c
++++ linux-2.6/arch/arm/mm/copypage-xscale.c
+@@ -32,7 +32,7 @@
+ #define minicache_pgprot __pgprot(L_PTE_PRESENT | L_PTE_YOUNG | \
+ 				  L_PTE_MT_MINICACHE)
  
--		spin_lock_irqsave(&nw_gpio_lock, flags);
-+		raw_spin_lock_irqsave(&nw_gpio_lock, flags);
- 		nw_gpio_modify_op(GPIO_RED_LED|GPIO_GREEN_LED, DEFAULT_LEDS);
--		spin_unlock_irqrestore(&nw_gpio_lock, flags);
-+		raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
- 	}
- 	return 0;
+-static DEFINE_SPINLOCK(minicache_lock);
++static DEFINE_RAW_SPINLOCK(minicache_lock);
+ 
+ /*
+  * XScale mini-dcache optimised copy_user_highpage
+@@ -98,14 +98,14 @@ void xscale_mc_copy_user_highpage(struct
+ 	if (!test_and_set_bit(PG_dcache_clean, &from->flags))
+ 		__flush_dcache_page(page_mapping(from), from);
+ 
+-	spin_lock(&minicache_lock);
++	raw_spin_lock(&minicache_lock);
+ 
+ 	set_pte_ext(TOP_PTE(COPYPAGE_MINICACHE), pfn_pte(page_to_pfn(from), minicache_pgprot), 0);
+ 	flush_tlb_kernel_page(COPYPAGE_MINICACHE);
+ 
+ 	mc_copy_user_page((void *)COPYPAGE_MINICACHE, kto);
+ 
+-	spin_unlock(&minicache_lock);
++	raw_spin_unlock(&minicache_lock);
+ 
+ 	kunmap_atomic(kto, KM_USER1);
  }
-Index: linux-2.6/arch/arm/mach-footbridge/netwinder-leds.c
+Index: linux-2.6/drivers/dma/ipu/ipu_irq.c
 ===================================================================
---- linux-2.6.orig/arch/arm/mach-footbridge/netwinder-leds.c
-+++ linux-2.6/arch/arm/mach-footbridge/netwinder-leds.c
-@@ -31,13 +31,13 @@
- static char led_state;
- static char hw_led_state;
- 
--static DEFINE_SPINLOCK(leds_lock);
-+static DEFINE_RAW_SPINLOCK(leds_lock);
+--- linux-2.6.orig/drivers/dma/ipu/ipu_irq.c
++++ linux-2.6/drivers/dma/ipu/ipu_irq.c
+@@ -81,7 +81,7 @@ static struct ipu_irq_map irq_map[CONFIG
+ /* Protects allocations from the above array of maps */
+ static DEFINE_MUTEX(map_lock);
+ /* Protects register accesses and individual mappings */
+-static DEFINE_SPINLOCK(bank_lock);
++static DEFINE_RAW_SPINLOCK(bank_lock);
  
- static void netwinder_leds_event(led_event_t evt)
+ static struct ipu_irq_map *src2map(unsigned int src)
  {
- 	unsigned long flags;
+@@ -101,11 +101,11 @@ static void ipu_irq_unmask(struct irq_da
+ 	uint32_t reg;
+ 	unsigned long lock_flags;
  
--	spin_lock_irqsave(&leds_lock, flags);
-+	raw_spin_lock_irqsave(&leds_lock, flags);
+-	spin_lock_irqsave(&bank_lock, lock_flags);
++	raw_spin_lock_irqsave(&bank_lock, lock_flags);
  
- 	switch (evt) {
- 	case led_start:
-@@ -117,12 +117,12 @@ static void netwinder_leds_event(led_eve
- 		break;
+ 	bank = map->bank;
+ 	if (!bank) {
+-		spin_unlock_irqrestore(&bank_lock, lock_flags);
++		raw_spin_unlock_irqrestore(&bank_lock, lock_flags);
+ 		pr_err("IPU: %s(%u) - unmapped!\n", __func__, d->irq);
+ 		return;
  	}
+@@ -114,7 +114,7 @@ static void ipu_irq_unmask(struct irq_da
+ 	reg |= (1UL << (map->source & 31));
+ 	ipu_write_reg(bank->ipu, reg, bank->control);
  
--	spin_unlock_irqrestore(&leds_lock, flags);
-+	raw_spin_unlock_irqrestore(&leds_lock, flags);
+-	spin_unlock_irqrestore(&bank_lock, lock_flags);
++	raw_spin_unlock_irqrestore(&bank_lock, lock_flags);
+ }
  
- 	if  (led_state & LED_STATE_ENABLED) {
--		spin_lock_irqsave(&nw_gpio_lock, flags);
-+		raw_spin_lock_irqsave(&nw_gpio_lock, flags);
- 		nw_gpio_modify_op(GPIO_RED_LED | GPIO_GREEN_LED, hw_led_state);
--		spin_unlock_irqrestore(&nw_gpio_lock, flags);
-+		raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
+ static void ipu_irq_mask(struct irq_data *d)
+@@ -124,11 +124,11 @@ static void ipu_irq_mask(struct irq_data
+ 	uint32_t reg;
+ 	unsigned long lock_flags;
+ 
+-	spin_lock_irqsave(&bank_lock, lock_flags);
++	raw_spin_lock_irqsave(&bank_lock, lock_flags);
+ 
+ 	bank = map->bank;
+ 	if (!bank) {
+-		spin_unlock_irqrestore(&bank_lock, lock_flags);
++		raw_spin_unlock_irqrestore(&bank_lock, lock_flags);
+ 		pr_err("IPU: %s(%u) - unmapped!\n", __func__, d->irq);
+ 		return;
  	}
+@@ -137,7 +137,7 @@ static void ipu_irq_mask(struct irq_data
+ 	reg &= ~(1UL << (map->source & 31));
+ 	ipu_write_reg(bank->ipu, reg, bank->control);
+ 
+-	spin_unlock_irqrestore(&bank_lock, lock_flags);
++	raw_spin_unlock_irqrestore(&bank_lock, lock_flags);
  }
  
-Index: linux-2.6/arch/arm/mach-integrator/core.c
-===================================================================
---- linux-2.6.orig/arch/arm/mach-integrator/core.c
-+++ linux-2.6/arch/arm/mach-integrator/core.c
-@@ -205,7 +205,7 @@ static struct amba_pl010_data integrator
+ static void ipu_irq_ack(struct irq_data *d)
+@@ -146,17 +146,17 @@ static void ipu_irq_ack(struct irq_data 
+ 	struct ipu_irq_bank *bank;
+ 	unsigned long lock_flags;
  
- #define CM_CTRL	IO_ADDRESS(INTEGRATOR_HDR_CTRL)
+-	spin_lock_irqsave(&bank_lock, lock_flags);
++	raw_spin_lock_irqsave(&bank_lock, lock_flags);
  
--static DEFINE_SPINLOCK(cm_lock);
-+static DEFINE_RAW_SPINLOCK(cm_lock);
+ 	bank = map->bank;
+ 	if (!bank) {
+-		spin_unlock_irqrestore(&bank_lock, lock_flags);
++		raw_spin_unlock_irqrestore(&bank_lock, lock_flags);
+ 		pr_err("IPU: %s(%u) - unmapped!\n", __func__, d->irq);
+ 		return;
+ 	}
+ 
+ 	ipu_write_reg(bank->ipu, 1UL << (map->source & 31), bank->status);
+-	spin_unlock_irqrestore(&bank_lock, lock_flags);
++	raw_spin_unlock_irqrestore(&bank_lock, lock_flags);
+ }
  
  /**
-  * cm_control - update the CM_CTRL register.
-@@ -217,10 +217,10 @@ void cm_control(u32 mask, u32 set)
- 	unsigned long flags;
- 	u32 val;
+@@ -172,11 +172,11 @@ bool ipu_irq_status(unsigned int irq)
+ 	unsigned long lock_flags;
+ 	bool ret;
  
--	spin_lock_irqsave(&cm_lock, flags);
-+	raw_spin_lock_irqsave(&cm_lock, flags);
- 	val = readl(CM_CTRL) & ~mask;
- 	writel(val | set, CM_CTRL);
--	spin_unlock_irqrestore(&cm_lock, flags);
-+	raw_spin_unlock_irqrestore(&cm_lock, flags);
+-	spin_lock_irqsave(&bank_lock, lock_flags);
++	raw_spin_lock_irqsave(&bank_lock, lock_flags);
+ 	bank = map->bank;
+ 	ret = bank && ipu_read_reg(bank->ipu, bank->status) &
+ 		(1UL << (map->source & 31));
+-	spin_unlock_irqrestore(&bank_lock, lock_flags);
++	raw_spin_unlock_irqrestore(&bank_lock, lock_flags);
+ 
+ 	return ret;
  }
+@@ -213,10 +213,10 @@ int ipu_irq_map(unsigned int source)
+ 		if (irq_map[i].source < 0) {
+ 			unsigned long lock_flags;
  
- EXPORT_SYMBOL(cm_control);
-Index: linux-2.6/arch/arm/mach-integrator/pci_v3.c
-===================================================================
---- linux-2.6.orig/arch/arm/mach-integrator/pci_v3.c
-+++ linux-2.6/arch/arm/mach-integrator/pci_v3.c
-@@ -163,7 +163,7 @@
-  *	 7:2	register number
-  *  
-  */
--static DEFINE_SPINLOCK(v3_lock);
-+static DEFINE_RAW_SPINLOCK(v3_lock);
+-			spin_lock_irqsave(&bank_lock, lock_flags);
++			raw_spin_lock_irqsave(&bank_lock, lock_flags);
+ 			irq_map[i].source = source;
+ 			irq_map[i].bank = irq_bank + source / 32;
+-			spin_unlock_irqrestore(&bank_lock, lock_flags);
++			raw_spin_unlock_irqrestore(&bank_lock, lock_flags);
  
- #define PCI_BUS_NONMEM_START	0x00000000
- #define PCI_BUS_NONMEM_SIZE	SZ_256M
-@@ -284,7 +284,7 @@ static int v3_read_config(struct pci_bus
- 	unsigned long flags;
- 	u32 v;
+ 			ret = irq_map[i].irq;
+ 			pr_debug("IPU: mapped source %u to IRQ %u\n",
+@@ -252,10 +252,10 @@ int ipu_irq_unmap(unsigned int source)
+ 			pr_debug("IPU: unmapped source %u from IRQ %u\n",
+ 				 source, irq_map[i].irq);
  
--	spin_lock_irqsave(&v3_lock, flags);
-+	raw_spin_lock_irqsave(&v3_lock, flags);
- 	addr = v3_open_config_window(bus, devfn, where);
+-			spin_lock_irqsave(&bank_lock, lock_flags);
++			raw_spin_lock_irqsave(&bank_lock, lock_flags);
+ 			irq_map[i].source = -EINVAL;
+ 			irq_map[i].bank = NULL;
+-			spin_unlock_irqrestore(&bank_lock, lock_flags);
++			raw_spin_unlock_irqrestore(&bank_lock, lock_flags);
  
- 	switch (size) {
-@@ -302,7 +302,7 @@ static int v3_read_config(struct pci_bus
- 	}
+ 			ret = 0;
+ 			break;
+@@ -276,7 +276,7 @@ static void ipu_irq_err(unsigned int irq
+ 	for (i = IPU_IRQ_NR_FN_BANKS; i < IPU_IRQ_NR_BANKS; i++) {
+ 		struct ipu_irq_bank *bank = irq_bank + i;
+ 
+-		spin_lock(&bank_lock);
++		raw_spin_lock(&bank_lock);
+ 		status = ipu_read_reg(ipu, bank->status);
+ 		/*
+ 		 * Don't think we have to clear all interrupts here, they will
+@@ -284,18 +284,18 @@ static void ipu_irq_err(unsigned int irq
+ 		 * might want to clear unhandled interrupts after the loop...
+ 		 */
+ 		status &= ipu_read_reg(ipu, bank->control);
+-		spin_unlock(&bank_lock);
++		raw_spin_unlock(&bank_lock);
+ 		while ((line = ffs(status))) {
+ 			struct ipu_irq_map *map;
+ 
+ 			line--;
+ 			status &= ~(1UL << line);
+ 
+-			spin_lock(&bank_lock);
++			raw_spin_lock(&bank_lock);
+ 			map = src2map(32 * i + line);
+ 			if (map)
+ 				irq = map->irq;
+-			spin_unlock(&bank_lock);
++			raw_spin_unlock(&bank_lock);
  
- 	v3_close_config_window();
--	spin_unlock_irqrestore(&v3_lock, flags);
-+	raw_spin_unlock_irqrestore(&v3_lock, flags);
+ 			if (!map) {
+ 				pr_err("IPU: Interrupt on unmapped source %u bank %d\n",
+@@ -317,22 +317,22 @@ static void ipu_irq_fn(unsigned int irq,
+ 	for (i = 0; i < IPU_IRQ_NR_FN_BANKS; i++) {
+ 		struct ipu_irq_bank *bank = irq_bank + i;
  
- 	*val = v;
- 	return PCIBIOS_SUCCESSFUL;
-@@ -314,7 +314,7 @@ static int v3_write_config(struct pci_bu
- 	unsigned long addr;
- 	unsigned long flags;
+-		spin_lock(&bank_lock);
++		raw_spin_lock(&bank_lock);
+ 		status = ipu_read_reg(ipu, bank->status);
+ 		/* Not clearing all interrupts, see above */
+ 		status &= ipu_read_reg(ipu, bank->control);
+-		spin_unlock(&bank_lock);
++		raw_spin_unlock(&bank_lock);
+ 		while ((line = ffs(status))) {
+ 			struct ipu_irq_map *map;
  
--	spin_lock_irqsave(&v3_lock, flags);
-+	raw_spin_lock_irqsave(&v3_lock, flags);
- 	addr = v3_open_config_window(bus, devfn, where);
+ 			line--;
+ 			status &= ~(1UL << line);
  
- 	switch (size) {
-@@ -335,7 +335,7 @@ static int v3_write_config(struct pci_bu
- 	}
+-			spin_lock(&bank_lock);
++			raw_spin_lock(&bank_lock);
+ 			map = src2map(32 * i + line);
+ 			if (map)
+ 				irq = map->irq;
+-			spin_unlock(&bank_lock);
++			raw_spin_unlock(&bank_lock);
  
- 	v3_close_config_window();
--	spin_unlock_irqrestore(&v3_lock, flags);
-+	raw_spin_unlock_irqrestore(&v3_lock, flags);
+ 			if (!map) {
+ 				pr_err("IPU: Interrupt on unmapped source %u bank %d\n",
+Index: linux-2.6/drivers/pci/intel-iommu.c
+===================================================================
+--- linux-2.6.orig/drivers/pci/intel-iommu.c
++++ linux-2.6/drivers/pci/intel-iommu.c
+@@ -933,7 +933,7 @@ static void iommu_set_root_entry(struct 
  
- 	return PCIBIOS_SUCCESSFUL;
- }
-@@ -510,7 +510,7 @@ void __init pci_v3_preinit(void)
- 	hook_fault_code(8, v3_pci_fault, SIGBUS, 0, "external abort on non-linefetch");
- 	hook_fault_code(10, v3_pci_fault, SIGBUS, 0, "external abort on non-linefetch");
+ 	addr = iommu->root_entry;
  
--	spin_lock_irqsave(&v3_lock, flags);
-+	raw_spin_lock_irqsave(&v3_lock, flags);
+-	spin_lock_irqsave(&iommu->register_lock, flag);
++	raw_spin_lock_irqsave(&iommu->register_lock, flag);
+ 	dmar_writeq(iommu->reg + DMAR_RTADDR_REG, virt_to_phys(addr));
  
- 	/*
- 	 * Unlock V3 registers, but only if they were previously locked.
-@@ -583,7 +583,7 @@ void __init pci_v3_preinit(void)
- 		printk(KERN_ERR "PCI: unable to grab PCI error "
- 		       "interrupt: %d\n", ret);
+ 	writel(iommu->gcmd | DMA_GCMD_SRTP, iommu->reg + DMAR_GCMD_REG);
+@@ -942,7 +942,7 @@ static void iommu_set_root_entry(struct 
+ 	IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG,
+ 		      readl, (sts & DMA_GSTS_RTPS), sts);
  
--	spin_unlock_irqrestore(&v3_lock, flags);
-+	raw_spin_unlock_irqrestore(&v3_lock, flags);
+-	spin_unlock_irqrestore(&iommu->register_lock, flag);
++	raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
  }
  
- void __init pci_v3_postinit(void)
-Index: linux-2.6/arch/arm/mach-ixp4xx/common-pci.c
-===================================================================
---- linux-2.6.orig/arch/arm/mach-ixp4xx/common-pci.c
-+++ linux-2.6/arch/arm/mach-ixp4xx/common-pci.c
-@@ -54,7 +54,7 @@ unsigned long ixp4xx_pci_reg_base = 0;
-  * these transactions are atomic or we will end up
-  * with corrupt data on the bus or in a driver.
-  */
--static DEFINE_SPINLOCK(ixp4xx_pci_lock);
-+static DEFINE_RAW_SPINLOCK(ixp4xx_pci_lock);
+ static void iommu_flush_write_buffer(struct intel_iommu *iommu)
+@@ -953,14 +953,14 @@ static void iommu_flush_write_buffer(str
+ 	if (!rwbf_quirk && !cap_rwbf(iommu->cap))
+ 		return;
  
- /*
-  * Read from PCI config space
-@@ -62,10 +62,10 @@ static DEFINE_SPINLOCK(ixp4xx_pci_lock);
- static void crp_read(u32 ad_cbe, u32 *data)
- {
- 	unsigned long flags;
--	spin_lock_irqsave(&ixp4xx_pci_lock, flags);
-+	raw_spin_lock_irqsave(&ixp4xx_pci_lock, flags);
- 	*PCI_CRP_AD_CBE = ad_cbe;
- 	*data = *PCI_CRP_RDATA;
--	spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
-+	raw_spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
- }
+-	spin_lock_irqsave(&iommu->register_lock, flag);
++	raw_spin_lock_irqsave(&iommu->register_lock, flag);
+ 	writel(iommu->gcmd | DMA_GCMD_WBF, iommu->reg + DMAR_GCMD_REG);
  
- /*
-@@ -74,10 +74,10 @@ static void crp_read(u32 ad_cbe, u32 *da
- static void crp_write(u32 ad_cbe, u32 data)
- { 
- 	unsigned long flags;
--	spin_lock_irqsave(&ixp4xx_pci_lock, flags);
-+	raw_spin_lock_irqsave(&ixp4xx_pci_lock, flags);
- 	*PCI_CRP_AD_CBE = CRP_AD_CBE_WRITE | ad_cbe;
- 	*PCI_CRP_WDATA = data;
--	spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
-+	raw_spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
- }
+ 	/* Make sure hardware complete it */
+ 	IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG,
+ 		      readl, (!(val & DMA_GSTS_WBFS)), val);
  
- static inline int check_master_abort(void)
-@@ -101,7 +101,7 @@ int ixp4xx_pci_read_errata(u32 addr, u32
- 	int retval = 0;
- 	int i;
+-	spin_unlock_irqrestore(&iommu->register_lock, flag);
++	raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
+ }
  
--	spin_lock_irqsave(&ixp4xx_pci_lock, flags);
-+	raw_spin_lock_irqsave(&ixp4xx_pci_lock, flags);
+ /* return value determine if we need a write buffer flush */
+@@ -987,14 +987,14 @@ static void __iommu_flush_context(struct
+ 	}
+ 	val |= DMA_CCMD_ICC;
  
- 	*PCI_NP_AD = addr;
+-	spin_lock_irqsave(&iommu->register_lock, flag);
++	raw_spin_lock_irqsave(&iommu->register_lock, flag);
+ 	dmar_writeq(iommu->reg + DMAR_CCMD_REG, val);
  
-@@ -118,7 +118,7 @@ int ixp4xx_pci_read_errata(u32 addr, u32
- 	if(check_master_abort())
- 		retval = 1;
+ 	/* Make sure hardware complete it */
+ 	IOMMU_WAIT_OP(iommu, DMAR_CCMD_REG,
+ 		dmar_readq, (!(val & DMA_CCMD_ICC)), val);
  
--	spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
-+	raw_spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
- 	return retval;
+-	spin_unlock_irqrestore(&iommu->register_lock, flag);
++	raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
  }
  
-@@ -127,7 +127,7 @@ int ixp4xx_pci_read_no_errata(u32 addr, 
- 	unsigned long flags;
- 	int retval = 0;
+ /* return value determine if we need a write buffer flush */
+@@ -1033,7 +1033,7 @@ static void __iommu_flush_iotlb(struct i
+ 	if (cap_write_drain(iommu->cap))
+ 		val |= DMA_TLB_WRITE_DRAIN;
  
--	spin_lock_irqsave(&ixp4xx_pci_lock, flags);
-+	raw_spin_lock_irqsave(&ixp4xx_pci_lock, flags);
+-	spin_lock_irqsave(&iommu->register_lock, flag);
++	raw_spin_lock_irqsave(&iommu->register_lock, flag);
+ 	/* Note: Only uses first TLB reg currently */
+ 	if (val_iva)
+ 		dmar_writeq(iommu->reg + tlb_offset, val_iva);
+@@ -1043,7 +1043,7 @@ static void __iommu_flush_iotlb(struct i
+ 	IOMMU_WAIT_OP(iommu, tlb_offset + 8,
+ 		dmar_readq, (!(val & DMA_TLB_IVT)), val);
  
- 	*PCI_NP_AD = addr;
+-	spin_unlock_irqrestore(&iommu->register_lock, flag);
++	raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
  
-@@ -140,7 +140,7 @@ int ixp4xx_pci_read_no_errata(u32 addr, 
- 	if(check_master_abort())
- 		retval = 1;
+ 	/* check IOTLB invalidation granularity */
+ 	if (DMA_TLB_IAIG(val) == 0)
+@@ -1159,7 +1159,7 @@ static void iommu_disable_protect_mem_re
+ 	u32 pmen;
+ 	unsigned long flags;
  
--	spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
-+	raw_spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
- 	return retval;
+-	spin_lock_irqsave(&iommu->register_lock, flags);
++	raw_spin_lock_irqsave(&iommu->register_lock, flags);
+ 	pmen = readl(iommu->reg + DMAR_PMEN_REG);
+ 	pmen &= ~DMA_PMEN_EPM;
+ 	writel(pmen, iommu->reg + DMAR_PMEN_REG);
+@@ -1168,7 +1168,7 @@ static void iommu_disable_protect_mem_re
+ 	IOMMU_WAIT_OP(iommu, DMAR_PMEN_REG,
+ 		readl, !(pmen & DMA_PMEN_PRS), pmen);
+ 
+-	spin_unlock_irqrestore(&iommu->register_lock, flags);
++	raw_spin_unlock_irqrestore(&iommu->register_lock, flags);
  }
  
-@@ -149,7 +149,7 @@ int ixp4xx_pci_write(u32 addr, u32 cmd, 
+ static int iommu_enable_translation(struct intel_iommu *iommu)
+@@ -1176,7 +1176,7 @@ static int iommu_enable_translation(stru
+ 	u32 sts;
  	unsigned long flags;
- 	int retval = 0;
- 
--	spin_lock_irqsave(&ixp4xx_pci_lock, flags);
-+	raw_spin_lock_irqsave(&ixp4xx_pci_lock, flags);
  
- 	*PCI_NP_AD = addr;
+-	spin_lock_irqsave(&iommu->register_lock, flags);
++	raw_spin_lock_irqsave(&iommu->register_lock, flags);
+ 	iommu->gcmd |= DMA_GCMD_TE;
+ 	writel(iommu->gcmd, iommu->reg + DMAR_GCMD_REG);
  
-@@ -162,7 +162,7 @@ int ixp4xx_pci_write(u32 addr, u32 cmd, 
- 	if(check_master_abort())
- 		retval = 1;
+@@ -1184,7 +1184,7 @@ static int iommu_enable_translation(stru
+ 	IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG,
+ 		      readl, (sts & DMA_GSTS_TES), sts);
  
--	spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
-+	raw_spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
- 	return retval;
+-	spin_unlock_irqrestore(&iommu->register_lock, flags);
++	raw_spin_unlock_irqrestore(&iommu->register_lock, flags);
+ 	return 0;
  }
  
-Index: linux-2.6/arch/arm/mach-shark/leds.c
-===================================================================
---- linux-2.6.orig/arch/arm/mach-shark/leds.c
-+++ linux-2.6/arch/arm/mach-shark/leds.c
-@@ -36,7 +36,7 @@ static char led_state;
- static short hw_led_state;
- static short saved_state;
- 
--static DEFINE_SPINLOCK(leds_lock);
-+static DEFINE_RAW_SPINLOCK(leds_lock);
+@@ -1193,7 +1193,7 @@ static int iommu_disable_translation(str
+ 	u32 sts;
+ 	unsigned long flag;
  
- short sequoia_read(int addr) {
-   outw(addr,0x24);
-@@ -52,7 +52,7 @@ static void sequoia_leds_event(led_event
- {
- 	unsigned long flags;
+-	spin_lock_irqsave(&iommu->register_lock, flag);
++	raw_spin_lock_irqsave(&iommu->register_lock, flag);
+ 	iommu->gcmd &= ~DMA_GCMD_TE;
+ 	writel(iommu->gcmd, iommu->reg + DMAR_GCMD_REG);
  
--	spin_lock_irqsave(&leds_lock, flags);
-+	raw_spin_lock_irqsave(&leds_lock, flags);
+@@ -1201,7 +1201,7 @@ static int iommu_disable_translation(str
+ 	IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG,
+ 		      readl, (!(sts & DMA_GSTS_TES)), sts);
  
- 	hw_led_state = sequoia_read(0x09);
+-	spin_unlock_irqrestore(&iommu->register_lock, flag);
++	raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
+ 	return 0;
+ }
  
-@@ -144,7 +144,7 @@ static void sequoia_leds_event(led_event
- 	if  (led_state & LED_STATE_ENABLED)
- 		sequoia_write(hw_led_state,0x09);
+@@ -3321,7 +3321,7 @@ static int iommu_suspend(void)
+ 	for_each_active_iommu(iommu, drhd) {
+ 		iommu_disable_translation(iommu);
  
--	spin_unlock_irqrestore(&leds_lock, flags);
-+	raw_spin_unlock_irqrestore(&leds_lock, flags);
- }
+-		spin_lock_irqsave(&iommu->register_lock, flag);
++		raw_spin_lock_irqsave(&iommu->register_lock, flag);
  
- static int __init leds_init(void)
-Index: linux-2.6/arch/arm/mm/cache-l2x0.c
-===================================================================
---- linux-2.6.orig/arch/arm/mm/cache-l2x0.c
-+++ linux-2.6/arch/arm/mm/cache-l2x0.c
-@@ -26,7 +26,7 @@
- #define CACHE_LINE_SIZE		32
+ 		iommu->iommu_state[SR_DMAR_FECTL_REG] =
+ 			readl(iommu->reg + DMAR_FECTL_REG);
+@@ -3332,7 +3332,7 @@ static int iommu_suspend(void)
+ 		iommu->iommu_state[SR_DMAR_FEUADDR_REG] =
+ 			readl(iommu->reg + DMAR_FEUADDR_REG);
  
- static void __iomem *l2x0_base;
--static DEFINE_SPINLOCK(l2x0_lock);
-+static DEFINE_RAW_SPINLOCK(l2x0_lock);
- static uint32_t l2x0_way_mask;	/* Bitmask of active ways */
- static uint32_t l2x0_size;
+-		spin_unlock_irqrestore(&iommu->register_lock, flag);
++		raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
+ 	}
+ 	return 0;
  
-@@ -115,9 +115,9 @@ static void l2x0_cache_sync(void)
- {
- 	unsigned long flags;
+@@ -3359,7 +3359,7 @@ static void iommu_resume(void)
  
--	spin_lock_irqsave(&l2x0_lock, flags);
-+	raw_spin_lock_irqsave(&l2x0_lock, flags);
- 	cache_sync();
--	spin_unlock_irqrestore(&l2x0_lock, flags);
-+	raw_spin_unlock_irqrestore(&l2x0_lock, flags);
- }
+ 	for_each_active_iommu(iommu, drhd) {
  
- static void __l2x0_flush_all(void)
-@@ -134,9 +134,9 @@ static void l2x0_flush_all(void)
- 	unsigned long flags;
+-		spin_lock_irqsave(&iommu->register_lock, flag);
++		raw_spin_lock_irqsave(&iommu->register_lock, flag);
  
- 	/* clean all ways */
--	spin_lock_irqsave(&l2x0_lock, flags);
-+	raw_spin_lock_irqsave(&l2x0_lock, flags);
- 	__l2x0_flush_all();
--	spin_unlock_irqrestore(&l2x0_lock, flags);
-+	raw_spin_unlock_irqrestore(&l2x0_lock, flags);
- }
+ 		writel(iommu->iommu_state[SR_DMAR_FECTL_REG],
+ 			iommu->reg + DMAR_FECTL_REG);
+@@ -3370,7 +3370,7 @@ static void iommu_resume(void)
+ 		writel(iommu->iommu_state[SR_DMAR_FEUADDR_REG],
+ 			iommu->reg + DMAR_FEUADDR_REG);
  
- static void l2x0_clean_all(void)
-@@ -144,11 +144,11 @@ static void l2x0_clean_all(void)
- 	unsigned long flags;
+-		spin_unlock_irqrestore(&iommu->register_lock, flag);
++		raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
+ 	}
  
- 	/* clean all ways */
--	spin_lock_irqsave(&l2x0_lock, flags);
-+	raw_spin_lock_irqsave(&l2x0_lock, flags);
- 	writel_relaxed(l2x0_way_mask, l2x0_base + L2X0_CLEAN_WAY);
- 	cache_wait_way(l2x0_base + L2X0_CLEAN_WAY, l2x0_way_mask);
- 	cache_sync();
--	spin_unlock_irqrestore(&l2x0_lock, flags);
-+	raw_spin_unlock_irqrestore(&l2x0_lock, flags);
+ 	for_each_active_iommu(iommu, drhd)
+Index: linux-2.6/drivers/pci/intr_remapping.c
+===================================================================
+--- linux-2.6.orig/drivers/pci/intr_remapping.c
++++ linux-2.6/drivers/pci/intr_remapping.c
+@@ -46,7 +46,7 @@ static __init int setup_intremap(char *s
  }
+ early_param("intremap", setup_intremap);
  
- static void l2x0_inv_all(void)
-@@ -156,13 +156,13 @@ static void l2x0_inv_all(void)
- 	unsigned long flags;
+-static DEFINE_SPINLOCK(irq_2_ir_lock);
++static DEFINE_RAW_SPINLOCK(irq_2_ir_lock);
  
- 	/* invalidate all ways */
--	spin_lock_irqsave(&l2x0_lock, flags);
-+	raw_spin_lock_irqsave(&l2x0_lock, flags);
- 	/* Invalidating when L2 is enabled is a nono */
- 	BUG_ON(readl(l2x0_base + L2X0_CTRL) & 1);
- 	writel_relaxed(l2x0_way_mask, l2x0_base + L2X0_INV_WAY);
- 	cache_wait_way(l2x0_base + L2X0_INV_WAY, l2x0_way_mask);
- 	cache_sync();
--	spin_unlock_irqrestore(&l2x0_lock, flags);
-+	raw_spin_unlock_irqrestore(&l2x0_lock, flags);
- }
+ static struct irq_2_iommu *irq_2_iommu(unsigned int irq)
+ {
+@@ -63,12 +63,12 @@ int get_irte(int irq, struct irte *entry
+ 	if (!entry || !irq_iommu)
+ 		return -1;
  
- static void l2x0_inv_range(unsigned long start, unsigned long end)
-@@ -170,7 +170,7 @@ static void l2x0_inv_range(unsigned long
- 	void __iomem *base = l2x0_base;
- 	unsigned long flags;
+-	spin_lock_irqsave(&irq_2_ir_lock, flags);
++	raw_spin_lock_irqsave(&irq_2_ir_lock, flags);
  
--	spin_lock_irqsave(&l2x0_lock, flags);
-+	raw_spin_lock_irqsave(&l2x0_lock, flags);
- 	if (start & (CACHE_LINE_SIZE - 1)) {
- 		start &= ~(CACHE_LINE_SIZE - 1);
- 		debug_writel(0x03);
-@@ -195,13 +195,13 @@ static void l2x0_inv_range(unsigned long
- 		}
+ 	index = irq_iommu->irte_index + irq_iommu->sub_handle;
+ 	*entry = *(irq_iommu->iommu->ir_table->base + index);
  
- 		if (blk_end < end) {
--			spin_unlock_irqrestore(&l2x0_lock, flags);
--			spin_lock_irqsave(&l2x0_lock, flags);
-+			raw_spin_unlock_irqrestore(&l2x0_lock, flags);
-+			raw_spin_lock_irqsave(&l2x0_lock, flags);
- 		}
- 	}
- 	cache_wait(base + L2X0_INV_LINE_PA, 1);
- 	cache_sync();
--	spin_unlock_irqrestore(&l2x0_lock, flags);
-+	raw_spin_unlock_irqrestore(&l2x0_lock, flags);
+-	spin_unlock_irqrestore(&irq_2_ir_lock, flags);
++	raw_spin_unlock_irqrestore(&irq_2_ir_lock, flags);
+ 	return 0;
  }
  
- static void l2x0_clean_range(unsigned long start, unsigned long end)
-@@ -214,7 +214,7 @@ static void l2x0_clean_range(unsigned lo
- 		return;
+@@ -102,7 +102,7 @@ int alloc_irte(struct intel_iommu *iommu
+ 		return -1;
  	}
  
--	spin_lock_irqsave(&l2x0_lock, flags);
-+	raw_spin_lock_irqsave(&l2x0_lock, flags);
- 	start &= ~(CACHE_LINE_SIZE - 1);
- 	while (start < end) {
- 		unsigned long blk_end = start + min(end - start, 4096UL);
-@@ -225,13 +225,13 @@ static void l2x0_clean_range(unsigned lo
- 		}
+-	spin_lock_irqsave(&irq_2_ir_lock, flags);
++	raw_spin_lock_irqsave(&irq_2_ir_lock, flags);
+ 	do {
+ 		for (i = index; i < index + count; i++)
+ 			if  (table->base[i].present)
+@@ -114,7 +114,7 @@ int alloc_irte(struct intel_iommu *iommu
+ 		index = (index + count) % INTR_REMAP_TABLE_ENTRIES;
  
- 		if (blk_end < end) {
--			spin_unlock_irqrestore(&l2x0_lock, flags);
--			spin_lock_irqsave(&l2x0_lock, flags);
-+			raw_spin_unlock_irqrestore(&l2x0_lock, flags);
-+			raw_spin_lock_irqsave(&l2x0_lock, flags);
+ 		if (index == start_index) {
+-			spin_unlock_irqrestore(&irq_2_ir_lock, flags);
++			raw_spin_unlock_irqrestore(&irq_2_ir_lock, flags);
+ 			printk(KERN_ERR "can't allocate an IRTE\n");
+ 			return -1;
  		}
- 	}
- 	cache_wait(base + L2X0_CLEAN_LINE_PA, 1);
- 	cache_sync();
--	spin_unlock_irqrestore(&l2x0_lock, flags);
-+	raw_spin_unlock_irqrestore(&l2x0_lock, flags);
- }
+@@ -128,7 +128,7 @@ int alloc_irte(struct intel_iommu *iommu
+ 	irq_iommu->sub_handle = 0;
+ 	irq_iommu->irte_mask = mask;
  
- static void l2x0_flush_range(unsigned long start, unsigned long end)
-@@ -244,7 +244,7 @@ static void l2x0_flush_range(unsigned lo
- 		return;
- 	}
+-	spin_unlock_irqrestore(&irq_2_ir_lock, flags);
++	raw_spin_unlock_irqrestore(&irq_2_ir_lock, flags);
  
--	spin_lock_irqsave(&l2x0_lock, flags);
-+	raw_spin_lock_irqsave(&l2x0_lock, flags);
- 	start &= ~(CACHE_LINE_SIZE - 1);
- 	while (start < end) {
- 		unsigned long blk_end = start + min(end - start, 4096UL);
-@@ -257,24 +257,24 @@ static void l2x0_flush_range(unsigned lo
- 		debug_writel(0x00);
+ 	return index;
+ }
+@@ -153,10 +153,10 @@ int map_irq_to_irte_handle(int irq, u16 
+ 	if (!irq_iommu)
+ 		return -1;
  
- 		if (blk_end < end) {
--			spin_unlock_irqrestore(&l2x0_lock, flags);
--			spin_lock_irqsave(&l2x0_lock, flags);
-+			raw_spin_unlock_irqrestore(&l2x0_lock, flags);
-+			raw_spin_lock_irqsave(&l2x0_lock, flags);
- 		}
- 	}
- 	cache_wait(base + L2X0_CLEAN_INV_LINE_PA, 1);
- 	cache_sync();
--	spin_unlock_irqrestore(&l2x0_lock, flags);
-+	raw_spin_unlock_irqrestore(&l2x0_lock, flags);
+-	spin_lock_irqsave(&irq_2_ir_lock, flags);
++	raw_spin_lock_irqsave(&irq_2_ir_lock, flags);
+ 	*sub_handle = irq_iommu->sub_handle;
+ 	index = irq_iommu->irte_index;
+-	spin_unlock_irqrestore(&irq_2_ir_lock, flags);
++	raw_spin_unlock_irqrestore(&irq_2_ir_lock, flags);
+ 	return index;
  }
  
- static void l2x0_disable(void)
- {
- 	unsigned long flags;
+@@ -168,14 +168,14 @@ int set_irte_irq(int irq, struct intel_i
+ 	if (!irq_iommu)
+ 		return -1;
  
--	spin_lock_irqsave(&l2x0_lock, flags);
-+	raw_spin_lock_irqsave(&l2x0_lock, flags);
- 	__l2x0_flush_all();
- 	writel_relaxed(0, l2x0_base + L2X0_CTRL);
- 	dsb();
--	spin_unlock_irqrestore(&l2x0_lock, flags);
-+	raw_spin_unlock_irqrestore(&l2x0_lock, flags);
- }
+-	spin_lock_irqsave(&irq_2_ir_lock, flags);
++	raw_spin_lock_irqsave(&irq_2_ir_lock, flags);
  
- void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask)
-Index: linux-2.6/arch/arm/mm/context.c
-===================================================================
---- linux-2.6.orig/arch/arm/mm/context.c
-+++ linux-2.6/arch/arm/mm/context.c
-@@ -16,7 +16,7 @@
- #include <asm/mmu_context.h>
- #include <asm/tlbflush.h>
+ 	irq_iommu->iommu = iommu;
+ 	irq_iommu->irte_index = index;
+ 	irq_iommu->sub_handle = subhandle;
+ 	irq_iommu->irte_mask = 0;
  
--static DEFINE_SPINLOCK(cpu_asid_lock);
-+static DEFINE_RAW_SPINLOCK(cpu_asid_lock);
- unsigned int cpu_last_asid = ASID_FIRST_VERSION;
- #ifdef CONFIG_SMP
- DEFINE_PER_CPU(struct mm_struct *, current_mm);
-@@ -31,7 +31,7 @@ DEFINE_PER_CPU(struct mm_struct *, curre
- void __init_new_context(struct task_struct *tsk, struct mm_struct *mm)
- {
- 	mm->context.id = 0;
--	spin_lock_init(&mm->context.id_lock);
-+	raw_spin_lock_init(&mm->context.id_lock);
- }
+-	spin_unlock_irqrestore(&irq_2_ir_lock, flags);
++	raw_spin_unlock_irqrestore(&irq_2_ir_lock, flags);
  
- static void flush_context(void)
-@@ -58,7 +58,7 @@ static void set_mm_context(struct mm_str
- 	 * the broadcast. This function is also called via IPI so the
- 	 * mm->context.id_lock has to be IRQ-safe.
- 	 */
--	spin_lock_irqsave(&mm->context.id_lock, flags);
-+	raw_spin_lock_irqsave(&mm->context.id_lock, flags);
- 	if (likely((mm->context.id ^ cpu_last_asid) >> ASID_BITS)) {
- 		/*
- 		 * Old version of ASID found. Set the new one and
-@@ -67,7 +67,7 @@ static void set_mm_context(struct mm_str
- 		mm->context.id = asid;
- 		cpumask_clear(mm_cpumask(mm));
- 	}
--	spin_unlock_irqrestore(&mm->context.id_lock, flags);
-+	raw_spin_unlock_irqrestore(&mm->context.id_lock, flags);
+ 	return 0;
+ }
+@@ -191,7 +191,7 @@ int modify_irte(int irq, struct irte *ir
+ 	if (!irq_iommu)
+ 		return -1;
  
- 	/*
- 	 * Set the mm_cpumask(mm) bit for the current CPU.
-@@ -117,7 +117,7 @@ void __new_context(struct mm_struct *mm)
- {
- 	unsigned int asid;
+-	spin_lock_irqsave(&irq_2_ir_lock, flags);
++	raw_spin_lock_irqsave(&irq_2_ir_lock, flags);
  
--	spin_lock(&cpu_asid_lock);
-+	raw_spin_lock(&cpu_asid_lock);
- #ifdef CONFIG_SMP
- 	/*
- 	 * Check the ASID again, in case the change was broadcast from
-@@ -125,7 +125,7 @@ void __new_context(struct mm_struct *mm)
- 	 */
- 	if (unlikely(((mm->context.id ^ cpu_last_asid) >> ASID_BITS) == 0)) {
- 		cpumask_set_cpu(smp_processor_id(), mm_cpumask(mm));
--		spin_unlock(&cpu_asid_lock);
-+		raw_spin_unlock(&cpu_asid_lock);
- 		return;
- 	}
- #endif
-@@ -153,5 +153,5 @@ void __new_context(struct mm_struct *mm)
- 	}
+ 	iommu = irq_iommu->iommu;
  
- 	set_mm_context(mm, asid);
--	spin_unlock(&cpu_asid_lock);
-+	raw_spin_unlock(&cpu_asid_lock);
- }
-Index: linux-2.6/arch/arm/mm/copypage-v4mc.c
-===================================================================
---- linux-2.6.orig/arch/arm/mm/copypage-v4mc.c
-+++ linux-2.6/arch/arm/mm/copypage-v4mc.c
-@@ -30,7 +30,7 @@
- #define minicache_pgprot __pgprot(L_PTE_PRESENT | L_PTE_YOUNG | \
- 				  L_PTE_MT_MINICACHE)
+@@ -203,7 +203,7 @@ int modify_irte(int irq, struct irte *ir
+ 	__iommu_flush_cache(iommu, irte, sizeof(*irte));
  
--static DEFINE_SPINLOCK(minicache_lock);
-+static DEFINE_RAW_SPINLOCK(minicache_lock);
+ 	rc = qi_flush_iec(iommu, index, 0);
+-	spin_unlock_irqrestore(&irq_2_ir_lock, flags);
++	raw_spin_unlock_irqrestore(&irq_2_ir_lock, flags);
  
- /*
-  * ARMv4 mini-dcache optimised copy_user_highpage
-@@ -76,14 +76,14 @@ void v4_mc_copy_user_highpage(struct pag
- 	if (!test_and_set_bit(PG_dcache_clean, &from->flags))
- 		__flush_dcache_page(page_mapping(from), from);
+ 	return rc;
+ }
+@@ -271,7 +271,7 @@ int free_irte(int irq)
+ 	if (!irq_iommu)
+ 		return -1;
  
--	spin_lock(&minicache_lock);
-+	raw_spin_lock(&minicache_lock);
+-	spin_lock_irqsave(&irq_2_ir_lock, flags);
++	raw_spin_lock_irqsave(&irq_2_ir_lock, flags);
  
- 	set_pte_ext(TOP_PTE(0xffff8000), pfn_pte(page_to_pfn(from), minicache_pgprot), 0);
- 	flush_tlb_kernel_page(0xffff8000);
+ 	rc = clear_entries(irq_iommu);
  
- 	mc_copy_user_page((void *)0xffff8000, kto);
+@@ -280,7 +280,7 @@ int free_irte(int irq)
+ 	irq_iommu->sub_handle = 0;
+ 	irq_iommu->irte_mask = 0;
  
--	spin_unlock(&minicache_lock);
-+	raw_spin_unlock(&minicache_lock);
+-	spin_unlock_irqrestore(&irq_2_ir_lock, flags);
++	raw_spin_unlock_irqrestore(&irq_2_ir_lock, flags);
  
- 	kunmap_atomic(kto, KM_USER1);
+ 	return rc;
  }
-Index: linux-2.6/arch/arm/mm/copypage-v6.c
-===================================================================
---- linux-2.6.orig/arch/arm/mm/copypage-v6.c
-+++ linux-2.6/arch/arm/mm/copypage-v6.c
-@@ -27,7 +27,7 @@
- #define from_address	(0xffff8000)
- #define to_address	(0xffffc000)
+@@ -410,7 +410,7 @@ static void iommu_set_intr_remapping(str
  
--static DEFINE_SPINLOCK(v6_lock);
-+static DEFINE_RAW_SPINLOCK(v6_lock);
+ 	addr = virt_to_phys((void *)iommu->ir_table->base);
  
- /*
-  * Copy the user page.  No aliasing to deal with so we can just
-@@ -89,7 +89,7 @@ static void v6_copy_user_highpage_aliasi
- 	 * Now copy the page using the same cache colour as the
- 	 * pages ultimate destination.
+-	spin_lock_irqsave(&iommu->register_lock, flags);
++	raw_spin_lock_irqsave(&iommu->register_lock, flags);
+ 
+ 	dmar_writeq(iommu->reg + DMAR_IRTA_REG,
+ 		    (addr) | IR_X2APIC_MODE(mode) | INTR_REMAP_TABLE_REG_SIZE);
+@@ -421,7 +421,7 @@ static void iommu_set_intr_remapping(str
+ 
+ 	IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG,
+ 		      readl, (sts & DMA_GSTS_IRTPS), sts);
+-	spin_unlock_irqrestore(&iommu->register_lock, flags);
++	raw_spin_unlock_irqrestore(&iommu->register_lock, flags);
+ 
+ 	/*
+ 	 * global invalidation of interrupt entry cache before enabling
+@@ -429,7 +429,7 @@ static void iommu_set_intr_remapping(str
  	 */
--	spin_lock(&v6_lock);
-+	raw_spin_lock(&v6_lock);
+ 	qi_global_iec(iommu);
  
- 	set_pte_ext(TOP_PTE(from_address) + offset, pfn_pte(page_to_pfn(from), PAGE_KERNEL), 0);
- 	set_pte_ext(TOP_PTE(to_address) + offset, pfn_pte(page_to_pfn(to), PAGE_KERNEL), 0);
-@@ -102,7 +102,7 @@ static void v6_copy_user_highpage_aliasi
+-	spin_lock_irqsave(&iommu->register_lock, flags);
++	raw_spin_lock_irqsave(&iommu->register_lock, flags);
  
- 	copy_page((void *)kto, (void *)kfrom);
+ 	/* Enable interrupt-remapping */
+ 	iommu->gcmd |= DMA_GCMD_IRE;
+@@ -438,7 +438,7 @@ static void iommu_set_intr_remapping(str
+ 	IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG,
+ 		      readl, (sts & DMA_GSTS_IRES), sts);
  
--	spin_unlock(&v6_lock);
-+	raw_spin_unlock(&v6_lock);
+-	spin_unlock_irqrestore(&iommu->register_lock, flags);
++	raw_spin_unlock_irqrestore(&iommu->register_lock, flags);
  }
  
- /*
-@@ -122,13 +122,13 @@ static void v6_clear_user_highpage_alias
- 	 * Now clear the page using the same cache colour as
- 	 * the pages ultimate destination.
+ 
+@@ -486,7 +486,7 @@ static void iommu_disable_intr_remapping
  	 */
--	spin_lock(&v6_lock);
-+	raw_spin_lock(&v6_lock);
+ 	qi_global_iec(iommu);
  
- 	set_pte_ext(TOP_PTE(to_address) + offset, pfn_pte(page_to_pfn(page), PAGE_KERNEL), 0);
- 	flush_tlb_kernel_page(to);
- 	clear_page((void *)to);
+-	spin_lock_irqsave(&iommu->register_lock, flags);
++	raw_spin_lock_irqsave(&iommu->register_lock, flags);
  
--	spin_unlock(&v6_lock);
-+	raw_spin_unlock(&v6_lock);
+ 	sts = dmar_readq(iommu->reg + DMAR_GSTS_REG);
+ 	if (!(sts & DMA_GSTS_IRES))
+@@ -499,7 +499,7 @@ static void iommu_disable_intr_remapping
+ 		      readl, !(sts & DMA_GSTS_IRES), sts);
+ 
+ end:
+-	spin_unlock_irqrestore(&iommu->register_lock, flags);
++	raw_spin_unlock_irqrestore(&iommu->register_lock, flags);
  }
  
- struct cpu_user_fns v6_user_fns __initdata = {
-Index: linux-2.6/arch/arm/mm/copypage-xscale.c
+ int __init intr_remapping_supported(void)
+Index: linux-2.6/include/linux/intel-iommu.h
 ===================================================================
---- linux-2.6.orig/arch/arm/mm/copypage-xscale.c
-+++ linux-2.6/arch/arm/mm/copypage-xscale.c
-@@ -32,7 +32,7 @@
- #define minicache_pgprot __pgprot(L_PTE_PRESENT | L_PTE_YOUNG | \
- 				  L_PTE_MT_MINICACHE)
- 
--static DEFINE_SPINLOCK(minicache_lock);
-+static DEFINE_RAW_SPINLOCK(minicache_lock);
- 
- /*
-  * XScale mini-dcache optimised copy_user_highpage
-@@ -98,14 +98,14 @@ void xscale_mc_copy_user_highpage(struct
- 	if (!test_and_set_bit(PG_dcache_clean, &from->flags))
- 		__flush_dcache_page(page_mapping(from), from);
+--- linux-2.6.orig/include/linux/intel-iommu.h
++++ linux-2.6/include/linux/intel-iommu.h
+@@ -271,7 +271,7 @@ struct qi_desc {
+ };
  
--	spin_lock(&minicache_lock);
-+	raw_spin_lock(&minicache_lock);
+ struct q_inval {
+-	spinlock_t      q_lock;
++	raw_spinlock_t  q_lock;
+ 	struct qi_desc  *desc;          /* invalidation queue */
+ 	int             *desc_status;   /* desc status */
+ 	int             free_head;      /* first free entry */
+@@ -311,7 +311,7 @@ struct intel_iommu {
+ 	u64		cap;
+ 	u64		ecap;
+ 	u32		gcmd; /* Holds TE, EAFL. Don't need SRTP, SFL, WBF */
+-	spinlock_t	register_lock; /* protect register handling */
++	raw_spinlock_t	register_lock; /* protect register handling */
+ 	int		seq_id;	/* sequence id of the iommu */
+ 	int		agaw; /* agaw of this iommu */
+ 	int		msagaw; /* max sagaw of this iommu */
+Index: linux-2.6/lib/atomic64.c
+===================================================================
+--- linux-2.6.orig/lib/atomic64.c
++++ linux-2.6/lib/atomic64.c
+@@ -29,11 +29,11 @@
+  * Ensure each lock is in a separate cacheline.
+  */
+ static union {
+-	spinlock_t lock;
++	raw_spinlock_t lock;
+ 	char pad[L1_CACHE_BYTES];
+ } atomic64_lock[NR_LOCKS] __cacheline_aligned_in_smp;
  
- 	set_pte_ext(TOP_PTE(COPYPAGE_MINICACHE), pfn_pte(page_to_pfn(from), minicache_pgprot), 0);
- 	flush_tlb_kernel_page(COPYPAGE_MINICACHE);
+-static inline spinlock_t *lock_addr(const atomic64_t *v)
++static inline raw_spinlock_t *lock_addr(const atomic64_t *v)
+ {
+ 	unsigned long addr = (unsigned long) v;
  
- 	mc_copy_user_page((void *)COPYPAGE_MINICACHE, kto);
+@@ -45,12 +45,12 @@ static inline spinlock_t *lock_addr(cons
+ long long atomic64_read(const atomic64_t *v)
+ {
+ 	unsigned long flags;
+-	spinlock_t *lock = lock_addr(v);
++	raw_spinlock_t *lock = lock_addr(v);
+ 	long long val;
  
--	spin_unlock(&minicache_lock);
-+	raw_spin_unlock(&minicache_lock);
+-	spin_lock_irqsave(lock, flags);
++	raw_spin_lock_irqsave(lock, flags);
+ 	val = v->counter;
+-	spin_unlock_irqrestore(lock, flags);
++	raw_spin_unlock_irqrestore(lock, flags);
+ 	return val;
+ }
+ EXPORT_SYMBOL(atomic64_read);
+@@ -58,34 +58,34 @@ EXPORT_SYMBOL(atomic64_read);
+ void atomic64_set(atomic64_t *v, long long i)
+ {
+ 	unsigned long flags;
+-	spinlock_t *lock = lock_addr(v);
++	raw_spinlock_t *lock = lock_addr(v);
  
- 	kunmap_atomic(kto, KM_USER1);
+-	spin_lock_irqsave(lock, flags);
++	raw_spin_lock_irqsave(lock, flags);
+ 	v->counter = i;
+-	spin_unlock_irqrestore(lock, flags);
++	raw_spin_unlock_irqrestore(lock, flags);
  }
-Index: linux-2.6/drivers/dma/ipu/ipu_irq.c
-===================================================================
---- linux-2.6.orig/drivers/dma/ipu/ipu_irq.c
-+++ linux-2.6/drivers/dma/ipu/ipu_irq.c
-@@ -81,7 +81,7 @@ static struct ipu_irq_map irq_map[CONFIG
- /* Protects allocations from the above array of maps */
- static DEFINE_MUTEX(map_lock);
- /* Protects register accesses and individual mappings */
--static DEFINE_SPINLOCK(bank_lock);
-+static DEFINE_RAW_SPINLOCK(bank_lock);
+ EXPORT_SYMBOL(atomic64_set);
  
- static struct ipu_irq_map *src2map(unsigned int src)
+ void atomic64_add(long long a, atomic64_t *v)
  {
-@@ -101,11 +101,11 @@ static void ipu_irq_unmask(struct irq_da
- 	uint32_t reg;
- 	unsigned long lock_flags;
+ 	unsigned long flags;
+-	spinlock_t *lock = lock_addr(v);
++	raw_spinlock_t *lock = lock_addr(v);
  
--	spin_lock_irqsave(&bank_lock, lock_flags);
-+	raw_spin_lock_irqsave(&bank_lock, lock_flags);
+-	spin_lock_irqsave(lock, flags);
++	raw_spin_lock_irqsave(lock, flags);
+ 	v->counter += a;
+-	spin_unlock_irqrestore(lock, flags);
++	raw_spin_unlock_irqrestore(lock, flags);
+ }
+ EXPORT_SYMBOL(atomic64_add);
  
- 	bank = map->bank;
- 	if (!bank) {
--		spin_unlock_irqrestore(&bank_lock, lock_flags);
-+		raw_spin_unlock_irqrestore(&bank_lock, lock_flags);
- 		pr_err("IPU: %s(%u) - unmapped!\n", __func__, d->irq);
- 		return;
- 	}
-@@ -114,7 +114,7 @@ static void ipu_irq_unmask(struct irq_da
- 	reg |= (1UL << (map->source & 31));
- 	ipu_write_reg(bank->ipu, reg, bank->control);
+ long long atomic64_add_return(long long a, atomic64_t *v)
+ {
+ 	unsigned long flags;
+-	spinlock_t *lock = lock_addr(v);
++	raw_spinlock_t *lock = lock_addr(v);
+ 	long long val;
  
--	spin_unlock_irqrestore(&bank_lock, lock_flags);
-+	raw_spin_unlock_irqrestore(&bank_lock, lock_flags);
+-	spin_lock_irqsave(lock, flags);
++	raw_spin_lock_irqsave(lock, flags);
+ 	val = v->counter += a;
+-	spin_unlock_irqrestore(lock, flags);
++	raw_spin_unlock_irqrestore(lock, flags);
+ 	return val;
  }
+ EXPORT_SYMBOL(atomic64_add_return);
+@@ -93,23 +93,23 @@ EXPORT_SYMBOL(atomic64_add_return);
+ void atomic64_sub(long long a, atomic64_t *v)
+ {
+ 	unsigned long flags;
+-	spinlock_t *lock = lock_addr(v);
++	raw_spinlock_t *lock = lock_addr(v);
  
- static void ipu_irq_mask(struct irq_data *d)
-@@ -124,11 +124,11 @@ static void ipu_irq_mask(struct irq_data
- 	uint32_t reg;
- 	unsigned long lock_flags;
+-	spin_lock_irqsave(lock, flags);
++	raw_spin_lock_irqsave(lock, flags);
+ 	v->counter -= a;
+-	spin_unlock_irqrestore(lock, flags);
++	raw_spin_unlock_irqrestore(lock, flags);
+ }
+ EXPORT_SYMBOL(atomic64_sub);
  
--	spin_lock_irqsave(&bank_lock, lock_flags);
-+	raw_spin_lock_irqsave(&bank_lock, lock_flags);
+ long long atomic64_sub_return(long long a, atomic64_t *v)
+ {
+ 	unsigned long flags;
+-	spinlock_t *lock = lock_addr(v);
++	raw_spinlock_t *lock = lock_addr(v);
+ 	long long val;
  
- 	bank = map->bank;
- 	if (!bank) {
--		spin_unlock_irqrestore(&bank_lock, lock_flags);
-+		raw_spin_unlock_irqrestore(&bank_lock, lock_flags);
- 		pr_err("IPU: %s(%u) - unmapped!\n", __func__, d->irq);
- 		return;
- 	}
-@@ -137,7 +137,7 @@ static void ipu_irq_mask(struct irq_data
- 	reg &= ~(1UL << (map->source & 31));
- 	ipu_write_reg(bank->ipu, reg, bank->control);
+-	spin_lock_irqsave(lock, flags);
++	raw_spin_lock_irqsave(lock, flags);
+ 	val = v->counter -= a;
+-	spin_unlock_irqrestore(lock, flags);
++	raw_spin_unlock_irqrestore(lock, flags);
+ 	return val;
+ }
+ EXPORT_SYMBOL(atomic64_sub_return);
+@@ -117,14 +117,14 @@ EXPORT_SYMBOL(atomic64_sub_return);
+ long long atomic64_dec_if_positive(atomic64_t *v)
+ {
+ 	unsigned long flags;
+-	spinlock_t *lock = lock_addr(v);
++	raw_spinlock_t *lock = lock_addr(v);
+ 	long long val;
  
--	spin_unlock_irqrestore(&bank_lock, lock_flags);
-+	raw_spin_unlock_irqrestore(&bank_lock, lock_flags);
+-	spin_lock_irqsave(lock, flags);
++	raw_spin_lock_irqsave(lock, flags);
+ 	val = v->counter - 1;
+ 	if (val >= 0)
+ 		v->counter = val;
+-	spin_unlock_irqrestore(lock, flags);
++	raw_spin_unlock_irqrestore(lock, flags);
+ 	return val;
  }
+ EXPORT_SYMBOL(atomic64_dec_if_positive);
+@@ -132,14 +132,14 @@ EXPORT_SYMBOL(atomic64_dec_if_positive);
+ long long atomic64_cmpxchg(atomic64_t *v, long long o, long long n)
+ {
+ 	unsigned long flags;
+-	spinlock_t *lock = lock_addr(v);
++	raw_spinlock_t *lock = lock_addr(v);
+ 	long long val;
  
- static void ipu_irq_ack(struct irq_data *d)
-@@ -146,17 +146,17 @@ static void ipu_irq_ack(struct irq_data 
- 	struct ipu_irq_bank *bank;
- 	unsigned long lock_flags;
+-	spin_lock_irqsave(lock, flags);
++	raw_spin_lock_irqsave(lock, flags);
+ 	val = v->counter;
+ 	if (val == o)
+ 		v->counter = n;
+-	spin_unlock_irqrestore(lock, flags);
++	raw_spin_unlock_irqrestore(lock, flags);
+ 	return val;
+ }
+ EXPORT_SYMBOL(atomic64_cmpxchg);
+@@ -147,13 +147,13 @@ EXPORT_SYMBOL(atomic64_cmpxchg);
+ long long atomic64_xchg(atomic64_t *v, long long new)
+ {
+ 	unsigned long flags;
+-	spinlock_t *lock = lock_addr(v);
++	raw_spinlock_t *lock = lock_addr(v);
+ 	long long val;
  
--	spin_lock_irqsave(&bank_lock, lock_flags);
-+	raw_spin_lock_irqsave(&bank_lock, lock_flags);
+-	spin_lock_irqsave(lock, flags);
++	raw_spin_lock_irqsave(lock, flags);
+ 	val = v->counter;
+ 	v->counter = new;
+-	spin_unlock_irqrestore(lock, flags);
++	raw_spin_unlock_irqrestore(lock, flags);
+ 	return val;
+ }
+ EXPORT_SYMBOL(atomic64_xchg);
+@@ -161,15 +161,15 @@ EXPORT_SYMBOL(atomic64_xchg);
+ int atomic64_add_unless(atomic64_t *v, long long a, long long u)
+ {
+ 	unsigned long flags;
+-	spinlock_t *lock = lock_addr(v);
++	raw_spinlock_t *lock = lock_addr(v);
+ 	int ret = 0;
  
- 	bank = map->bank;
- 	if (!bank) {
--		spin_unlock_irqrestore(&bank_lock, lock_flags);
-+		raw_spin_unlock_irqrestore(&bank_lock, lock_flags);
- 		pr_err("IPU: %s(%u) - unmapped!\n", __func__, d->irq);
- 		return;
+-	spin_lock_irqsave(lock, flags);
++	raw_spin_lock_irqsave(lock, flags);
+ 	if (v->counter != u) {
+ 		v->counter += a;
+ 		ret = 1;
  	}
+-	spin_unlock_irqrestore(lock, flags);
++	raw_spin_unlock_irqrestore(lock, flags);
+ 	return ret;
+ }
+ EXPORT_SYMBOL(atomic64_add_unless);
+@@ -179,7 +179,7 @@ static int init_atomic64_lock(void)
+ 	int i;
  
- 	ipu_write_reg(bank->ipu, 1UL << (map->source & 31), bank->status);
--	spin_unlock_irqrestore(&bank_lock, lock_flags);
-+	raw_spin_unlock_irqrestore(&bank_lock, lock_flags);
+ 	for (i = 0; i < NR_LOCKS; ++i)
+-		spin_lock_init(&atomic64_lock[i].lock);
++		raw_spin_lock_init(&atomic64_lock[i].lock);
+ 	return 0;
  }
  
- /**
-@@ -172,11 +172,11 @@ bool ipu_irq_status(unsigned int irq)
- 	unsigned long lock_flags;
- 	bool ret;
+Index: linux-2.6/arch/x86/kernel/cpu/intel_cacheinfo.c
+===================================================================
+--- linux-2.6.orig/arch/x86/kernel/cpu/intel_cacheinfo.c
++++ linux-2.6/arch/x86/kernel/cpu/intel_cacheinfo.c
+@@ -151,28 +151,17 @@ union _cpuid4_leaf_ecx {
+ 	u32 full;
+ };
  
--	spin_lock_irqsave(&bank_lock, lock_flags);
-+	raw_spin_lock_irqsave(&bank_lock, lock_flags);
- 	bank = map->bank;
- 	ret = bank && ipu_read_reg(bank->ipu, bank->status) &
- 		(1UL << (map->source & 31));
--	spin_unlock_irqrestore(&bank_lock, lock_flags);
-+	raw_spin_unlock_irqrestore(&bank_lock, lock_flags);
+-struct amd_l3_cache {
+-	struct	 amd_northbridge *nb;
+-	unsigned indices;
+-	u8	 subcaches[4];
+-};
+-
+-struct _cpuid4_info {
++struct _cpuid4_info_regs {
+ 	union _cpuid4_leaf_eax eax;
+ 	union _cpuid4_leaf_ebx ebx;
+ 	union _cpuid4_leaf_ecx ecx;
+ 	unsigned long size;
+-	struct amd_l3_cache *l3;
+-	DECLARE_BITMAP(shared_cpu_map, NR_CPUS);
++	struct amd_northbridge *nb;
+ };
  
- 	return ret;
- }
-@@ -213,10 +213,10 @@ int ipu_irq_map(unsigned int source)
- 		if (irq_map[i].source < 0) {
- 			unsigned long lock_flags;
+-/* subset of above _cpuid4_info w/o shared_cpu_map */
+-struct _cpuid4_info_regs {
+-	union _cpuid4_leaf_eax eax;
+-	union _cpuid4_leaf_ebx ebx;
+-	union _cpuid4_leaf_ecx ecx;
+-	unsigned long size;
+-	struct amd_l3_cache *l3;
++struct _cpuid4_info {
++	struct _cpuid4_info_regs base;
++	DECLARE_BITMAP(shared_cpu_map, NR_CPUS);
+ };
  
--			spin_lock_irqsave(&bank_lock, lock_flags);
-+			raw_spin_lock_irqsave(&bank_lock, lock_flags);
- 			irq_map[i].source = source;
- 			irq_map[i].bank = irq_bank + source / 32;
--			spin_unlock_irqrestore(&bank_lock, lock_flags);
-+			raw_spin_unlock_irqrestore(&bank_lock, lock_flags);
+ unsigned short			num_cache_leaves;
+@@ -314,12 +303,13 @@ struct _cache_attr {
+ /*
+  * L3 cache descriptors
+  */
+-static void __cpuinit amd_calc_l3_indices(struct amd_l3_cache *l3)
++static void __cpuinit amd_calc_l3_indices(struct amd_northbridge *nb)
+ {
++	struct amd_l3_cache *l3 = &nb->l3_cache;
+ 	unsigned int sc0, sc1, sc2, sc3;
+ 	u32 val = 0;
  
- 			ret = irq_map[i].irq;
- 			pr_debug("IPU: mapped source %u to IRQ %u\n",
-@@ -252,10 +252,10 @@ int ipu_irq_unmap(unsigned int source)
- 			pr_debug("IPU: unmapped source %u from IRQ %u\n",
- 				 source, irq_map[i].irq);
+-	pci_read_config_dword(l3->nb->misc, 0x1C4, &val);
++	pci_read_config_dword(nb->misc, 0x1C4, &val);
  
--			spin_lock_irqsave(&bank_lock, lock_flags);
-+			raw_spin_lock_irqsave(&bank_lock, lock_flags);
- 			irq_map[i].source = -EINVAL;
- 			irq_map[i].bank = NULL;
--			spin_unlock_irqrestore(&bank_lock, lock_flags);
-+			raw_spin_unlock_irqrestore(&bank_lock, lock_flags);
+ 	/* calculate subcache sizes */
+ 	l3->subcaches[0] = sc0 = !(val & BIT(0));
+@@ -333,33 +323,16 @@ static void __cpuinit amd_calc_l3_indice
+ static void __cpuinit amd_init_l3_cache(struct _cpuid4_info_regs *this_leaf,
+ 					int index)
+ {
+-	static struct amd_l3_cache *__cpuinitdata l3_caches;
+ 	int node;
  
- 			ret = 0;
- 			break;
-@@ -276,7 +276,7 @@ static void ipu_irq_err(unsigned int irq
- 	for (i = IPU_IRQ_NR_FN_BANKS; i < IPU_IRQ_NR_BANKS; i++) {
- 		struct ipu_irq_bank *bank = irq_bank + i;
+ 	/* only for L3, and not in virtualized environments */
+-	if (index < 3 || amd_nb_num() == 0)
++	if (index < 3)
+ 		return;
  
--		spin_lock(&bank_lock);
-+		raw_spin_lock(&bank_lock);
- 		status = ipu_read_reg(ipu, bank->status);
- 		/*
- 		 * Don't think we have to clear all interrupts here, they will
-@@ -284,18 +284,18 @@ static void ipu_irq_err(unsigned int irq
- 		 * might want to clear unhandled interrupts after the loop...
- 		 */
- 		status &= ipu_read_reg(ipu, bank->control);
--		spin_unlock(&bank_lock);
-+		raw_spin_unlock(&bank_lock);
- 		while ((line = ffs(status))) {
- 			struct ipu_irq_map *map;
+-	/*
+-	 * Strictly speaking, the amount in @size below is leaked since it is
+-	 * never freed but this is done only on shutdown so it doesn't matter.
+-	 */
+-	if (!l3_caches) {
+-		int size = amd_nb_num() * sizeof(struct amd_l3_cache);
+-
+-		l3_caches = kzalloc(size, GFP_ATOMIC);
+-		if (!l3_caches)
+-			return;
+-	}
+-
+ 	node = amd_get_nb_id(smp_processor_id());
+-
+-	if (!l3_caches[node].nb) {
+-		l3_caches[node].nb = node_to_amd_nb(node);
+-		amd_calc_l3_indices(&l3_caches[node]);
+-	}
+-
+-	this_leaf->l3 = &l3_caches[node];
++	this_leaf->nb = node_to_amd_nb(node);
++	if (this_leaf->nb && !this_leaf->nb->l3_cache.indices)
++		amd_calc_l3_indices(this_leaf->nb);
+ }
+ 
+ /*
+@@ -369,11 +342,11 @@ static void __cpuinit amd_init_l3_cache(
+  *
+  * @returns: the disabled index if used or negative value if slot free.
+  */
+-int amd_get_l3_disable_slot(struct amd_l3_cache *l3, unsigned slot)
++int amd_get_l3_disable_slot(struct amd_northbridge *nb, unsigned slot)
+ {
+ 	unsigned int reg = 0;
  
- 			line--;
- 			status &= ~(1UL << line);
+-	pci_read_config_dword(l3->nb->misc, 0x1BC + slot * 4, &reg);
++	pci_read_config_dword(nb->misc, 0x1BC + slot * 4, &reg);
  
--			spin_lock(&bank_lock);
-+			raw_spin_lock(&bank_lock);
- 			map = src2map(32 * i + line);
- 			if (map)
- 				irq = map->irq;
--			spin_unlock(&bank_lock);
-+			raw_spin_unlock(&bank_lock);
+ 	/* check whether this slot is activated already */
+ 	if (reg & (3UL << 30))
+@@ -387,11 +360,10 @@ static ssize_t show_cache_disable(struct
+ {
+ 	int index;
  
- 			if (!map) {
- 				pr_err("IPU: Interrupt on unmapped source %u bank %d\n",
-@@ -317,22 +317,22 @@ static void ipu_irq_fn(unsigned int irq,
- 	for (i = 0; i < IPU_IRQ_NR_FN_BANKS; i++) {
- 		struct ipu_irq_bank *bank = irq_bank + i;
+-	if (!this_leaf->l3 ||
+-	    !amd_nb_has_feature(AMD_NB_L3_INDEX_DISABLE))
++	if (!this_leaf->base.nb || !amd_nb_has_feature(AMD_NB_L3_INDEX_DISABLE))
+ 		return -EINVAL;
  
--		spin_lock(&bank_lock);
-+		raw_spin_lock(&bank_lock);
- 		status = ipu_read_reg(ipu, bank->status);
- 		/* Not clearing all interrupts, see above */
- 		status &= ipu_read_reg(ipu, bank->control);
--		spin_unlock(&bank_lock);
-+		raw_spin_unlock(&bank_lock);
- 		while ((line = ffs(status))) {
- 			struct ipu_irq_map *map;
+-	index = amd_get_l3_disable_slot(this_leaf->l3, slot);
++	index = amd_get_l3_disable_slot(this_leaf->base.nb, slot);
+ 	if (index >= 0)
+ 		return sprintf(buf, "%d\n", index);
  
- 			line--;
- 			status &= ~(1UL << line);
+@@ -408,7 +380,7 @@ show_cache_disable_##slot(struct _cpuid4
+ SHOW_CACHE_DISABLE(0)
+ SHOW_CACHE_DISABLE(1)
  
--			spin_lock(&bank_lock);
-+			raw_spin_lock(&bank_lock);
- 			map = src2map(32 * i + line);
- 			if (map)
- 				irq = map->irq;
--			spin_unlock(&bank_lock);
-+			raw_spin_unlock(&bank_lock);
+-static void amd_l3_disable_index(struct amd_l3_cache *l3, int cpu,
++static void amd_l3_disable_index(struct amd_northbridge *nb, int cpu,
+ 				 unsigned slot, unsigned long idx)
+ {
+ 	int i;
+@@ -421,10 +393,10 @@ static void amd_l3_disable_index(struct 
+ 	for (i = 0; i < 4; i++) {
+ 		u32 reg = idx | (i << 20);
  
- 			if (!map) {
- 				pr_err("IPU: Interrupt on unmapped source %u bank %d\n",
-Index: linux-2.6/drivers/pci/dmar.c
-===================================================================
---- linux-2.6.orig/drivers/pci/dmar.c
-+++ linux-2.6/drivers/pci/dmar.c
-@@ -800,7 +800,7 @@ int alloc_iommu(struct dmar_drhd_unit *d
- 		(unsigned long long)iommu->cap,
- 		(unsigned long long)iommu->ecap);
+-		if (!l3->subcaches[i])
++		if (!nb->l3_cache.subcaches[i])
+ 			continue;
  
--	spin_lock_init(&iommu->register_lock);
-+	raw_spin_lock_init(&iommu->register_lock);
+-		pci_write_config_dword(l3->nb->misc, 0x1BC + slot * 4, reg);
++		pci_write_config_dword(nb->misc, 0x1BC + slot * 4, reg);
  
- 	drhd->iommu = iommu;
- 	return 0;
-@@ -921,11 +921,11 @@ int qi_submit_sync(struct qi_desc *desc,
- restart:
- 	rc = 0;
+ 		/*
+ 		 * We need to WBINVD on a core on the node containing the L3
+@@ -434,7 +406,7 @@ static void amd_l3_disable_index(struct 
+ 		wbinvd_on_cpu(cpu);
  
--	spin_lock_irqsave(&qi->q_lock, flags);
-+	raw_spin_lock_irqsave(&qi->q_lock, flags);
- 	while (qi->free_cnt < 3) {
--		spin_unlock_irqrestore(&qi->q_lock, flags);
-+		raw_spin_unlock_irqrestore(&qi->q_lock, flags);
- 		cpu_relax();
--		spin_lock_irqsave(&qi->q_lock, flags);
-+		raw_spin_lock_irqsave(&qi->q_lock, flags);
+ 		reg |= BIT(31);
+-		pci_write_config_dword(l3->nb->misc, 0x1BC + slot * 4, reg);
++		pci_write_config_dword(nb->misc, 0x1BC + slot * 4, reg);
  	}
+ }
  
- 	index = qi->free_head;
-@@ -965,15 +965,15 @@ restart:
- 		if (rc)
- 			break;
- 
--		spin_unlock(&qi->q_lock);
-+		raw_spin_unlock(&qi->q_lock);
- 		cpu_relax();
--		spin_lock(&qi->q_lock);
-+		raw_spin_lock(&qi->q_lock);
- 	}
+@@ -448,24 +420,24 @@ static void amd_l3_disable_index(struct 
+  *
+  * @return: 0 on success, error status on failure
+  */
+-int amd_set_l3_disable_slot(struct amd_l3_cache *l3, int cpu, unsigned slot,
++int amd_set_l3_disable_slot(struct amd_northbridge *nb, int cpu, unsigned slot,
+ 			    unsigned long index)
+ {
+ 	int ret = 0;
  
- 	qi->desc_status[index] = QI_DONE;
+ 	/*  check if @slot is already used or the index is already disabled */
+-	ret = amd_get_l3_disable_slot(l3, slot);
++	ret = amd_get_l3_disable_slot(nb, slot);
+ 	if (ret >= 0)
+ 		return -EINVAL;
  
- 	reclaim_free_desc(qi);
--	spin_unlock_irqrestore(&qi->q_lock, flags);
-+	raw_spin_unlock_irqrestore(&qi->q_lock, flags);
+-	if (index > l3->indices)
++	if (index > nb->l3_cache.indices)
+ 		return -EINVAL;
  
- 	if (rc == -EAGAIN)
- 		goto restart;
-@@ -1062,7 +1062,7 @@ void dmar_disable_qi(struct intel_iommu 
- 	if (!ecap_qis(iommu->ecap))
- 		return;
+ 	/* check whether the other slot has disabled the same index already */
+-	if (index == amd_get_l3_disable_slot(l3, !slot))
++	if (index == amd_get_l3_disable_slot(nb, !slot))
+ 		return -EINVAL;
  
--	spin_lock_irqsave(&iommu->register_lock, flags);
-+	raw_spin_lock_irqsave(&iommu->register_lock, flags);
+-	amd_l3_disable_index(l3, cpu, slot, index);
++	amd_l3_disable_index(nb, cpu, slot, index);
  
- 	sts =  dmar_readq(iommu->reg + DMAR_GSTS_REG);
- 	if (!(sts & DMA_GSTS_QIES))
-@@ -1082,7 +1082,7 @@ void dmar_disable_qi(struct intel_iommu 
- 	IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG, readl,
- 		      !(sts & DMA_GSTS_QIES), sts);
- end:
--	spin_unlock_irqrestore(&iommu->register_lock, flags);
-+	raw_spin_unlock_irqrestore(&iommu->register_lock, flags);
+ 	return 0;
  }
+@@ -480,8 +452,7 @@ static ssize_t store_cache_disable(struc
+ 	if (!capable(CAP_SYS_ADMIN))
+ 		return -EPERM;
  
- /*
-@@ -1097,7 +1097,7 @@ static void __dmar_enable_qi(struct inte
- 	qi->free_head = qi->free_tail = 0;
- 	qi->free_cnt = QI_LENGTH;
- 
--	spin_lock_irqsave(&iommu->register_lock, flags);
-+	raw_spin_lock_irqsave(&iommu->register_lock, flags);
+-	if (!this_leaf->l3 ||
+-	    !amd_nb_has_feature(AMD_NB_L3_INDEX_DISABLE))
++	if (!this_leaf->base.nb || !amd_nb_has_feature(AMD_NB_L3_INDEX_DISABLE))
+ 		return -EINVAL;
  
- 	/* write zero to the tail reg */
- 	writel(0, iommu->reg + DMAR_IQT_REG);
-@@ -1110,7 +1110,7 @@ static void __dmar_enable_qi(struct inte
- 	/* Make sure hardware complete it */
- 	IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG, readl, (sts & DMA_GSTS_QIES), sts);
+ 	cpu = cpumask_first(to_cpumask(this_leaf->shared_cpu_map));
+@@ -489,7 +460,7 @@ static ssize_t store_cache_disable(struc
+ 	if (strict_strtoul(buf, 10, &val) < 0)
+ 		return -EINVAL;
  
--	spin_unlock_irqrestore(&iommu->register_lock, flags);
-+	raw_spin_unlock_irqrestore(&iommu->register_lock, flags);
- }
+-	err = amd_set_l3_disable_slot(this_leaf->l3, cpu, slot, val);
++	err = amd_set_l3_disable_slot(this_leaf->base.nb, cpu, slot, val);
+ 	if (err) {
+ 		if (err == -EEXIST)
+ 			printk(KERN_WARNING "L3 disable slot %d in use!\n",
+@@ -518,7 +489,7 @@ static struct _cache_attr cache_disable_
+ static ssize_t
+ show_subcaches(struct _cpuid4_info *this_leaf, char *buf, unsigned int cpu)
+ {
+-	if (!this_leaf->l3 || !amd_nb_has_feature(AMD_NB_L3_PARTITIONING))
++	if (!this_leaf->base.nb || !amd_nb_has_feature(AMD_NB_L3_PARTITIONING))
+ 		return -EINVAL;
  
- /*
-@@ -1159,7 +1159,7 @@ int dmar_enable_qi(struct intel_iommu *i
- 	qi->free_head = qi->free_tail = 0;
- 	qi->free_cnt = QI_LENGTH;
+ 	return sprintf(buf, "%x\n", amd_get_subcaches(cpu));
+@@ -533,7 +504,7 @@ store_subcaches(struct _cpuid4_info *thi
+ 	if (!capable(CAP_SYS_ADMIN))
+ 		return -EPERM;
  
--	spin_lock_init(&qi->q_lock);
-+	raw_spin_lock_init(&qi->q_lock);
+-	if (!this_leaf->l3 || !amd_nb_has_feature(AMD_NB_L3_PARTITIONING))
++	if (!this_leaf->base.nb || !amd_nb_has_feature(AMD_NB_L3_PARTITIONING))
+ 		return -EINVAL;
  
- 	__dmar_enable_qi(iommu);
+ 	if (strict_strtoul(buf, 16, &val) < 0)
+@@ -769,7 +740,7 @@ static void __cpuinit cache_shared_cpu_m
+ 		return;
+ 	}
+ 	this_leaf = CPUID4_INFO_IDX(cpu, index);
+-	num_threads_sharing = 1 + this_leaf->eax.split.num_threads_sharing;
++	num_threads_sharing = 1 + this_leaf->base.eax.split.num_threads_sharing;
  
-@@ -1225,11 +1225,11 @@ void dmar_msi_unmask(struct irq_data *da
- 	unsigned long flag;
+ 	if (num_threads_sharing == 1)
+ 		cpumask_set_cpu(cpu, to_cpumask(this_leaf->shared_cpu_map));
+@@ -820,29 +791,19 @@ static void __cpuinit free_cache_attribu
+ 	for (i = 0; i < num_cache_leaves; i++)
+ 		cache_remove_shared_cpu_map(cpu, i);
  
- 	/* unmask it */
--	spin_lock_irqsave(&iommu->register_lock, flag);
-+	raw_spin_lock_irqsave(&iommu->register_lock, flag);
- 	writel(0, iommu->reg + DMAR_FECTL_REG);
- 	/* Read a reg to force flush the post write */
- 	readl(iommu->reg + DMAR_FECTL_REG);
--	spin_unlock_irqrestore(&iommu->register_lock, flag);
-+	raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
+-	kfree(per_cpu(ici_cpuid4_info, cpu)->l3);
+ 	kfree(per_cpu(ici_cpuid4_info, cpu));
+ 	per_cpu(ici_cpuid4_info, cpu) = NULL;
  }
  
- void dmar_msi_mask(struct irq_data *data)
-@@ -1238,11 +1238,11 @@ void dmar_msi_mask(struct irq_data *data
- 	struct intel_iommu *iommu = irq_data_get_irq_handler_data(data);
- 
- 	/* mask it */
--	spin_lock_irqsave(&iommu->register_lock, flag);
-+	raw_spin_lock_irqsave(&iommu->register_lock, flag);
- 	writel(DMA_FECTL_IM, iommu->reg + DMAR_FECTL_REG);
- 	/* Read a reg to force flush the post write */
- 	readl(iommu->reg + DMAR_FECTL_REG);
--	spin_unlock_irqrestore(&iommu->register_lock, flag);
-+	raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
- }
+-static int
+-__cpuinit cpuid4_cache_lookup(int index, struct _cpuid4_info *this_leaf)
+-{
+-	struct _cpuid4_info_regs *leaf_regs =
+-		(struct _cpuid4_info_regs *)this_leaf;
+-
+-	return cpuid4_cache_lookup_regs(index, leaf_regs);
+-}
+-
+ static void __cpuinit get_cpu_leaves(void *_retval)
+ {
+ 	int j, *retval = _retval, cpu = smp_processor_id();
  
- void dmar_msi_write(int irq, struct msi_msg *msg)
-@@ -1250,11 +1250,11 @@ void dmar_msi_write(int irq, struct msi_
- 	struct intel_iommu *iommu = irq_get_handler_data(irq);
- 	unsigned long flag;
+ 	/* Do cpuid and store the results */
+ 	for (j = 0; j < num_cache_leaves; j++) {
+-		struct _cpuid4_info *this_leaf;
+-		this_leaf = CPUID4_INFO_IDX(cpu, j);
+-		*retval = cpuid4_cache_lookup(j, this_leaf);
++		struct _cpuid4_info *this_leaf = CPUID4_INFO_IDX(cpu, j);
++
++		*retval = cpuid4_cache_lookup_regs(j, &this_leaf->base);
+ 		if (unlikely(*retval < 0)) {
+ 			int i;
  
--	spin_lock_irqsave(&iommu->register_lock, flag);
-+	raw_spin_lock_irqsave(&iommu->register_lock, flag);
- 	writel(msg->data, iommu->reg + DMAR_FEDATA_REG);
- 	writel(msg->address_lo, iommu->reg + DMAR_FEADDR_REG);
- 	writel(msg->address_hi, iommu->reg + DMAR_FEUADDR_REG);
--	spin_unlock_irqrestore(&iommu->register_lock, flag);
-+	raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
+@@ -900,16 +861,16 @@ static ssize_t show_##file_name(struct _
+ 	return sprintf(buf, "%lu\n", (unsigned long)this_leaf->object + val); \
  }
  
- void dmar_msi_read(int irq, struct msi_msg *msg)
-@@ -1262,11 +1262,11 @@ void dmar_msi_read(int irq, struct msi_m
- 	struct intel_iommu *iommu = irq_get_handler_data(irq);
- 	unsigned long flag;
+-show_one_plus(level, eax.split.level, 0);
+-show_one_plus(coherency_line_size, ebx.split.coherency_line_size, 1);
+-show_one_plus(physical_line_partition, ebx.split.physical_line_partition, 1);
+-show_one_plus(ways_of_associativity, ebx.split.ways_of_associativity, 1);
+-show_one_plus(number_of_sets, ecx.split.number_of_sets, 1);
++show_one_plus(level, base.eax.split.level, 0);
++show_one_plus(coherency_line_size, base.ebx.split.coherency_line_size, 1);
++show_one_plus(physical_line_partition, base.ebx.split.physical_line_partition, 1);
++show_one_plus(ways_of_associativity, base.ebx.split.ways_of_associativity, 1);
++show_one_plus(number_of_sets, base.ecx.split.number_of_sets, 1);
  
--	spin_lock_irqsave(&iommu->register_lock, flag);
-+	raw_spin_lock_irqsave(&iommu->register_lock, flag);
- 	msg->data = readl(iommu->reg + DMAR_FEDATA_REG);
- 	msg->address_lo = readl(iommu->reg + DMAR_FEADDR_REG);
- 	msg->address_hi = readl(iommu->reg + DMAR_FEUADDR_REG);
--	spin_unlock_irqrestore(&iommu->register_lock, flag);
-+	raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
+ static ssize_t show_size(struct _cpuid4_info *this_leaf, char *buf,
+ 			 unsigned int cpu)
+ {
+-	return sprintf(buf, "%luK\n", this_leaf->size / 1024);
++	return sprintf(buf, "%luK\n", this_leaf->base.size / 1024);
  }
  
- static int dmar_fault_do_one(struct intel_iommu *iommu, int type,
-@@ -1303,7 +1303,7 @@ irqreturn_t dmar_fault(int irq, void *de
- 	u32 fault_status;
- 	unsigned long flag;
+ static ssize_t show_shared_cpu_map_func(struct _cpuid4_info *this_leaf,
+@@ -946,7 +907,7 @@ static inline ssize_t show_shared_cpu_li
+ static ssize_t show_type(struct _cpuid4_info *this_leaf, char *buf,
+ 			 unsigned int cpu)
+ {
+-	switch (this_leaf->eax.split.type) {
++	switch (this_leaf->base.eax.split.type) {
+ 	case CACHE_TYPE_DATA:
+ 		return sprintf(buf, "Data\n");
+ 	case CACHE_TYPE_INST:
+@@ -1135,7 +1096,7 @@ static int __cpuinit cache_add_dev(struc
  
--	spin_lock_irqsave(&iommu->register_lock, flag);
-+	raw_spin_lock_irqsave(&iommu->register_lock, flag);
- 	fault_status = readl(iommu->reg + DMAR_FSTS_REG);
- 	if (fault_status)
- 		printk(KERN_ERR "DRHD: handling fault status reg %x\n",
-@@ -1342,7 +1342,7 @@ irqreturn_t dmar_fault(int irq, void *de
- 		writel(DMA_FRCD_F, iommu->reg + reg +
- 			fault_index * PRIMARY_FAULT_REG_LEN + 12);
+ 		ktype_cache.default_attrs = default_attrs;
+ #ifdef CONFIG_AMD_NB
+-		if (this_leaf->l3)
++		if (this_leaf->base.nb)
+ 			ktype_cache.default_attrs = amd_l3_attrs();
+ #endif
+ 		retval = kobject_init_and_add(&(this_object->kobj),
+Index: linux-2.6/arch/x86/include/asm/amd_nb.h
+===================================================================
+--- linux-2.6.orig/arch/x86/include/asm/amd_nb.h
++++ linux-2.6/arch/x86/include/asm/amd_nb.h
+@@ -19,9 +19,15 @@ extern int amd_numa_init(void);
+ extern int amd_get_subcaches(int);
+ extern int amd_set_subcaches(int, int);
  
--		spin_unlock_irqrestore(&iommu->register_lock, flag);
-+		raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
++struct amd_l3_cache {
++	unsigned indices;
++	u8	 subcaches[4];
++};
++
+ struct amd_northbridge {
+ 	struct pci_dev *misc;
+ 	struct pci_dev *link;
++	struct amd_l3_cache l3_cache;
+ };
  
- 		dmar_fault_do_one(iommu, type, fault_reason,
- 				source_id, guest_addr);
-@@ -1350,14 +1350,14 @@ irqreturn_t dmar_fault(int irq, void *de
- 		fault_index++;
- 		if (fault_index >= cap_num_fault_regs(iommu->cap))
- 			fault_index = 0;
--		spin_lock_irqsave(&iommu->register_lock, flag);
-+		raw_spin_lock_irqsave(&iommu->register_lock, flag);
- 	}
- clear_rest:
- 	/* clear all the other faults */
- 	fault_status = readl(iommu->reg + DMAR_FSTS_REG);
- 	writel(fault_status, iommu->reg + DMAR_FSTS_REG);
+ struct amd_northbridge_info {
+Index: linux-2.6/arch/arm/kernel/perf_event.c
+===================================================================
+--- linux-2.6.orig/arch/arm/kernel/perf_event.c
++++ linux-2.6/arch/arm/kernel/perf_event.c
+@@ -420,7 +420,7 @@ armpmu_reserve_hardware(void)
+ 			continue;
  
--	spin_unlock_irqrestore(&iommu->register_lock, flag);
-+	raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
- 	return IRQ_HANDLED;
- }
+ 		err = request_irq(irq, handle_irq,
+-				  IRQF_DISABLED | IRQF_NOBALANCING,
++				  IRQF_NOBALANCING | IRQF_NO_THREAD,
+ 				  "armpmu", NULL);
+ 		if (err) {
+ 			pr_warning("unable to request IRQ%d for ARM perf "
+Index: linux-2.6/arch/arm/Kconfig
+===================================================================
+--- linux-2.6.orig/arch/arm/Kconfig
++++ linux-2.6/arch/arm/Kconfig
+@@ -29,6 +29,7 @@ config ARM
+ 	select HAVE_GENERIC_HARDIRQS
+ 	select HAVE_SPARSE_IRQ
+ 	select GENERIC_IRQ_SHOW
++	select IRQ_FORCED_THREADING
+ 	help
+ 	  The ARM series is a line of low-power-consumption RISC chip designs
+ 	  licensed by ARM Ltd and targeted at embedded applications and
+@@ -1510,7 +1511,7 @@ config HAVE_ARCH_PFN_VALID
  
-@@ -1388,7 +1388,7 @@ int dmar_set_interrupt(struct intel_iomm
- 		return ret;
- 	}
+ config HIGHMEM
+ 	bool "High Memory Support"
+-	depends on MMU
++	depends on MMU && !PREEMPT_RT_FULL
+ 	help
+ 	  The address space of ARM processors is only 4 Gigabytes large
+ 	  and it has to accommodate user address space, kernel address
+Index: linux-2.6/arch/powerpc/platforms/85xx/mpc85xx_cds.c
+===================================================================
+--- linux-2.6.orig/arch/powerpc/platforms/85xx/mpc85xx_cds.c
++++ linux-2.6/arch/powerpc/platforms/85xx/mpc85xx_cds.c
+@@ -178,7 +178,7 @@ static irqreturn_t mpc85xx_8259_cascade_
  
--	ret = request_irq(irq, dmar_fault, 0, iommu->name, iommu);
-+	ret = request_irq(irq, dmar_fault, IRQF_NO_THREAD, iommu->name, iommu);
- 	if (ret)
- 		printk(KERN_ERR "IOMMU: can't request irq\n");
- 	return ret;
-Index: linux-2.6/drivers/pci/intel-iommu.c
+ static struct irqaction mpc85xxcds_8259_irqaction = {
+ 	.handler = mpc85xx_8259_cascade_action,
+-	.flags = IRQF_SHARED,
++	.flags = IRQF_SHARED | IRQF_NO_THREAD,
+ 	.name = "8259 cascade",
+ };
+ #endif /* PPC_I8259 */
+Index: linux-2.6/arch/powerpc/Kconfig
 ===================================================================
---- linux-2.6.orig/drivers/pci/intel-iommu.c
-+++ linux-2.6/drivers/pci/intel-iommu.c
-@@ -933,7 +933,7 @@ static void iommu_set_root_entry(struct 
+--- linux-2.6.orig/arch/powerpc/Kconfig
++++ linux-2.6/arch/powerpc/Kconfig
+@@ -69,10 +69,11 @@ config LOCKDEP_SUPPORT
  
- 	addr = iommu->root_entry;
+ config RWSEM_GENERIC_SPINLOCK
+ 	bool
++	default y if PREEMPT_RT_FULL
  
--	spin_lock_irqsave(&iommu->register_lock, flag);
-+	raw_spin_lock_irqsave(&iommu->register_lock, flag);
- 	dmar_writeq(iommu->reg + DMAR_RTADDR_REG, virt_to_phys(addr));
+ config RWSEM_XCHGADD_ALGORITHM
+ 	bool
+-	default y
++	default y if !PREEMPT_RT_FULL
  
- 	writel(iommu->gcmd | DMA_GCMD_SRTP, iommu->reg + DMAR_GCMD_REG);
-@@ -942,7 +942,7 @@ static void iommu_set_root_entry(struct 
- 	IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG,
- 		      readl, (sts & DMA_GSTS_RTPS), sts);
+ config GENERIC_LOCKBREAK
+ 	bool
+@@ -134,6 +135,7 @@ config PPC
+ 	select GENERIC_IRQ_SHOW_LEVEL
+ 	select HAVE_RCU_TABLE_FREE if SMP
+ 	select HAVE_SYSCALL_TRACEPOINTS
++	select IRQ_FORCED_THREADING
  
--	spin_unlock_irqrestore(&iommu->register_lock, flag);
-+	raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
- }
+ config EARLY_PRINTK
+ 	bool
+@@ -271,7 +273,7 @@ menu "Kernel options"
  
- static void iommu_flush_write_buffer(struct intel_iommu *iommu)
-@@ -953,14 +953,14 @@ static void iommu_flush_write_buffer(str
- 	if (!rwbf_quirk && !cap_rwbf(iommu->cap))
- 		return;
+ config HIGHMEM
+ 	bool "High memory support"
+-	depends on PPC32
++	depends on PPC32 && !PREEMPT_RT_FULL
  
--	spin_lock_irqsave(&iommu->register_lock, flag);
-+	raw_spin_lock_irqsave(&iommu->register_lock, flag);
- 	writel(iommu->gcmd | DMA_GCMD_WBF, iommu->reg + DMAR_GCMD_REG);
+ source kernel/time/Kconfig
+ source kernel/Kconfig.hz
+Index: linux-2.6/arch/arm/kernel/process.c
+===================================================================
+--- linux-2.6.orig/arch/arm/kernel/process.c
++++ linux-2.6/arch/arm/kernel/process.c
+@@ -209,9 +209,7 @@ void cpu_idle(void)
+ 		}
+ 		leds_event(led_idle_end);
+ 		tick_nohz_restart_sched_tick();
+-		preempt_enable_no_resched();
+-		schedule();
+-		preempt_disable();
++		schedule_preempt_disabled();
+ 	}
+ }
  
- 	/* Make sure hardware complete it */
- 	IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG,
- 		      readl, (!(val & DMA_GSTS_WBFS)), val);
+Index: linux-2.6/arch/avr32/kernel/process.c
+===================================================================
+--- linux-2.6.orig/arch/avr32/kernel/process.c
++++ linux-2.6/arch/avr32/kernel/process.c
+@@ -38,9 +38,7 @@ void cpu_idle(void)
+ 		while (!need_resched())
+ 			cpu_idle_sleep();
+ 		tick_nohz_restart_sched_tick();
+-		preempt_enable_no_resched();
+-		schedule();
+-		preempt_disable();
++		schedule_preempt_disabled();
+ 	}
+ }
  
--	spin_unlock_irqrestore(&iommu->register_lock, flag);
-+	raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
+Index: linux-2.6/arch/blackfin/kernel/process.c
+===================================================================
+--- linux-2.6.orig/arch/blackfin/kernel/process.c
++++ linux-2.6/arch/blackfin/kernel/process.c
+@@ -92,9 +92,7 @@ void cpu_idle(void)
+ 		while (!need_resched())
+ 			idle();
+ 		tick_nohz_restart_sched_tick();
+-		preempt_enable_no_resched();
+-		schedule();
+-		preempt_disable();
++		schedule_preempt_disabled();
+ 	}
  }
  
- /* return value determine if we need a write buffer flush */
-@@ -987,14 +987,14 @@ static void __iommu_flush_context(struct
+Index: linux-2.6/arch/cris/kernel/process.c
+===================================================================
+--- linux-2.6.orig/arch/cris/kernel/process.c
++++ linux-2.6/arch/cris/kernel/process.c
+@@ -115,9 +115,7 @@ void cpu_idle (void)
+ 				idle = default_idle;
+ 			idle();
+ 		}
+-		preempt_enable_no_resched();
+-		schedule();
+-		preempt_disable();
++		schedule_preempt_disabled();
  	}
- 	val |= DMA_CCMD_ICC;
- 
--	spin_lock_irqsave(&iommu->register_lock, flag);
-+	raw_spin_lock_irqsave(&iommu->register_lock, flag);
- 	dmar_writeq(iommu->reg + DMAR_CCMD_REG, val);
- 
- 	/* Make sure hardware complete it */
- 	IOMMU_WAIT_OP(iommu, DMAR_CCMD_REG,
- 		dmar_readq, (!(val & DMA_CCMD_ICC)), val);
- 
--	spin_unlock_irqrestore(&iommu->register_lock, flag);
-+	raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
  }
  
- /* return value determine if we need a write buffer flush */
-@@ -1033,7 +1033,7 @@ static void __iommu_flush_iotlb(struct i
- 	if (cap_write_drain(iommu->cap))
- 		val |= DMA_TLB_WRITE_DRAIN;
- 
--	spin_lock_irqsave(&iommu->register_lock, flag);
-+	raw_spin_lock_irqsave(&iommu->register_lock, flag);
- 	/* Note: Only uses first TLB reg currently */
- 	if (val_iva)
- 		dmar_writeq(iommu->reg + tlb_offset, val_iva);
-@@ -1043,7 +1043,7 @@ static void __iommu_flush_iotlb(struct i
- 	IOMMU_WAIT_OP(iommu, tlb_offset + 8,
- 		dmar_readq, (!(val & DMA_TLB_IVT)), val);
- 
--	spin_unlock_irqrestore(&iommu->register_lock, flag);
-+	raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
- 
- 	/* check IOTLB invalidation granularity */
- 	if (DMA_TLB_IAIG(val) == 0)
-@@ -1159,7 +1159,7 @@ static void iommu_disable_protect_mem_re
- 	u32 pmen;
- 	unsigned long flags;
- 
--	spin_lock_irqsave(&iommu->register_lock, flags);
-+	raw_spin_lock_irqsave(&iommu->register_lock, flags);
- 	pmen = readl(iommu->reg + DMAR_PMEN_REG);
- 	pmen &= ~DMA_PMEN_EPM;
- 	writel(pmen, iommu->reg + DMAR_PMEN_REG);
-@@ -1168,7 +1168,7 @@ static void iommu_disable_protect_mem_re
- 	IOMMU_WAIT_OP(iommu, DMAR_PMEN_REG,
- 		readl, !(pmen & DMA_PMEN_PRS), pmen);
+Index: linux-2.6/arch/frv/kernel/process.c
+===================================================================
+--- linux-2.6.orig/arch/frv/kernel/process.c
++++ linux-2.6/arch/frv/kernel/process.c
+@@ -92,9 +92,7 @@ void cpu_idle(void)
+ 				idle();
+ 		}
  
--	spin_unlock_irqrestore(&iommu->register_lock, flags);
-+	raw_spin_unlock_irqrestore(&iommu->register_lock, flags);
+-		preempt_enable_no_resched();
+-		schedule();
+-		preempt_disable();
++		schedule_preempt_disabled();
+ 	}
  }
  
- static int iommu_enable_translation(struct intel_iommu *iommu)
-@@ -1176,7 +1176,7 @@ static int iommu_enable_translation(stru
- 	u32 sts;
- 	unsigned long flags;
- 
--	spin_lock_irqsave(&iommu->register_lock, flags);
-+	raw_spin_lock_irqsave(&iommu->register_lock, flags);
- 	iommu->gcmd |= DMA_GCMD_TE;
- 	writel(iommu->gcmd, iommu->reg + DMAR_GCMD_REG);
+Index: linux-2.6/arch/h8300/kernel/process.c
+===================================================================
+--- linux-2.6.orig/arch/h8300/kernel/process.c
++++ linux-2.6/arch/h8300/kernel/process.c
+@@ -81,9 +81,7 @@ void cpu_idle(void)
+ 	while (1) {
+ 		while (!need_resched())
+ 			idle();
+-		preempt_enable_no_resched();
+-		schedule();
+-		preempt_disable();
++		schedule_preempt_disabled();
+ 	}
+ }
  
-@@ -1184,7 +1184,7 @@ static int iommu_enable_translation(stru
- 	IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG,
- 		      readl, (sts & DMA_GSTS_TES), sts);
+Index: linux-2.6/arch/ia64/kernel/process.c
+===================================================================
+--- linux-2.6.orig/arch/ia64/kernel/process.c
++++ linux-2.6/arch/ia64/kernel/process.c
+@@ -330,9 +330,7 @@ cpu_idle (void)
+ 			normal_xtp();
+ #endif
+ 		}
+-		preempt_enable_no_resched();
+-		schedule();
+-		preempt_disable();
++		schedule_preempt_disabled();
+ 		check_pgt_cache();
+ 		if (cpu_is_offline(cpu))
+ 			play_dead();
+Index: linux-2.6/arch/m32r/kernel/process.c
+===================================================================
+--- linux-2.6.orig/arch/m32r/kernel/process.c
++++ linux-2.6/arch/m32r/kernel/process.c
+@@ -90,9 +90,7 @@ void cpu_idle (void)
  
--	spin_unlock_irqrestore(&iommu->register_lock, flags);
-+	raw_spin_unlock_irqrestore(&iommu->register_lock, flags);
- 	return 0;
+ 			idle();
+ 		}
+-		preempt_enable_no_resched();
+-		schedule();
+-		preempt_disable();
++		schedule_preempt_disabled();
+ 	}
  }
  
-@@ -1193,7 +1193,7 @@ static int iommu_disable_translation(str
- 	u32 sts;
- 	unsigned long flag;
+Index: linux-2.6/arch/m68k/kernel/process_mm.c
+===================================================================
+--- linux-2.6.orig/arch/m68k/kernel/process_mm.c
++++ linux-2.6/arch/m68k/kernel/process_mm.c
+@@ -94,9 +94,7 @@ void cpu_idle(void)
+ 	while (1) {
+ 		while (!need_resched())
+ 			idle();
+-		preempt_enable_no_resched();
+-		schedule();
+-		preempt_disable();
++		schedule_preempt_disabled();
+ 	}
+ }
  
--	spin_lock_irqsave(&iommu->register_lock, flag);
-+	raw_spin_lock_irqsave(&iommu->register_lock, flag);
- 	iommu->gcmd &= ~DMA_GCMD_TE;
- 	writel(iommu->gcmd, iommu->reg + DMAR_GCMD_REG);
+Index: linux-2.6/arch/m68k/kernel/process_no.c
+===================================================================
+--- linux-2.6.orig/arch/m68k/kernel/process_no.c
++++ linux-2.6/arch/m68k/kernel/process_no.c
+@@ -73,9 +73,7 @@ void cpu_idle(void)
+ 	/* endless idle loop with no priority at all */
+ 	while (1) {
+ 		idle();
+-		preempt_enable_no_resched();
+-		schedule();
+-		preempt_disable();
++		schedule_preempt_disabled();
+ 	}
+ }
  
-@@ -1201,7 +1201,7 @@ static int iommu_disable_translation(str
- 	IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG,
- 		      readl, (!(sts & DMA_GSTS_TES)), sts);
+Index: linux-2.6/arch/microblaze/kernel/process.c
+===================================================================
+--- linux-2.6.orig/arch/microblaze/kernel/process.c
++++ linux-2.6/arch/microblaze/kernel/process.c
+@@ -108,9 +108,7 @@ void cpu_idle(void)
+ 			idle();
+ 		tick_nohz_restart_sched_tick();
  
--	spin_unlock_irqrestore(&iommu->register_lock, flag);
-+	raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
- 	return 0;
+-		preempt_enable_no_resched();
+-		schedule();
+-		preempt_disable();
++		schedule_preempt_disabled();
+ 		check_pgt_cache();
+ 	}
+ }
+Index: linux-2.6/arch/mips/kernel/process.c
+===================================================================
+--- linux-2.6.orig/arch/mips/kernel/process.c
++++ linux-2.6/arch/mips/kernel/process.c
+@@ -78,9 +78,7 @@ void __noreturn cpu_idle(void)
+ 			play_dead();
+ #endif
+ 		tick_nohz_restart_sched_tick();
+-		preempt_enable_no_resched();
+-		schedule();
+-		preempt_disable();
++		schedule_preempt_disabled();
+ 	}
  }
  
-@@ -3321,7 +3321,7 @@ static int iommu_suspend(void)
- 	for_each_active_iommu(iommu, drhd) {
- 		iommu_disable_translation(iommu);
- 
--		spin_lock_irqsave(&iommu->register_lock, flag);
-+		raw_spin_lock_irqsave(&iommu->register_lock, flag);
+Index: linux-2.6/arch/mn10300/kernel/process.c
+===================================================================
+--- linux-2.6.orig/arch/mn10300/kernel/process.c
++++ linux-2.6/arch/mn10300/kernel/process.c
+@@ -123,9 +123,7 @@ void cpu_idle(void)
+ 			idle();
+ 		}
  
- 		iommu->iommu_state[SR_DMAR_FECTL_REG] =
- 			readl(iommu->reg + DMAR_FECTL_REG);
-@@ -3332,7 +3332,7 @@ static int iommu_suspend(void)
- 		iommu->iommu_state[SR_DMAR_FEUADDR_REG] =
- 			readl(iommu->reg + DMAR_FEUADDR_REG);
+-		preempt_enable_no_resched();
+-		schedule();
+-		preempt_disable();
++		schedule_preempt_disabled();
+ 	}
+ }
  
--		spin_unlock_irqrestore(&iommu->register_lock, flag);
-+		raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
+Index: linux-2.6/arch/parisc/kernel/process.c
+===================================================================
+--- linux-2.6.orig/arch/parisc/kernel/process.c
++++ linux-2.6/arch/parisc/kernel/process.c
+@@ -71,9 +71,7 @@ void cpu_idle(void)
+ 	while (1) {
+ 		while (!need_resched())
+ 			barrier();
+-		preempt_enable_no_resched();
+-		schedule();
+-		preempt_disable();
++		schedule_preempt_disabled();
+ 		check_pgt_cache();
+ 	}
+ }
+Index: linux-2.6/arch/powerpc/kernel/idle.c
+===================================================================
+--- linux-2.6.orig/arch/powerpc/kernel/idle.c
++++ linux-2.6/arch/powerpc/kernel/idle.c
+@@ -94,11 +94,11 @@ void cpu_idle(void)
+ 		HMT_medium();
+ 		ppc64_runlatch_on();
+ 		tick_nohz_restart_sched_tick();
+-		preempt_enable_no_resched();
+-		if (cpu_should_die())
++		if (cpu_should_die()) {
++			__preempt_enable_no_resched();
+ 			cpu_die();
+-		schedule();
+-		preempt_disable();
++		}
++		schedule_preempt_disabled();
  	}
- 	return 0;
- 
-@@ -3359,7 +3359,7 @@ static void iommu_resume(void)
+ }
  
- 	for_each_active_iommu(iommu, drhd) {
+Index: linux-2.6/arch/powerpc/platforms/iseries/setup.c
+===================================================================
+--- linux-2.6.orig/arch/powerpc/platforms/iseries/setup.c
++++ linux-2.6/arch/powerpc/platforms/iseries/setup.c
+@@ -581,9 +581,7 @@ static void iseries_shared_idle(void)
+ 		if (hvlpevent_is_pending())
+ 			process_iSeries_events();
  
--		spin_lock_irqsave(&iommu->register_lock, flag);
-+		raw_spin_lock_irqsave(&iommu->register_lock, flag);
+-		preempt_enable_no_resched();
+-		schedule();
+-		preempt_disable();
++		schedule_preempt_disabled();
+ 	}
+ }
  
- 		writel(iommu->iommu_state[SR_DMAR_FECTL_REG],
- 			iommu->reg + DMAR_FECTL_REG);
-@@ -3370,7 +3370,7 @@ static void iommu_resume(void)
- 		writel(iommu->iommu_state[SR_DMAR_FEUADDR_REG],
- 			iommu->reg + DMAR_FEUADDR_REG);
+@@ -610,9 +608,7 @@ static void iseries_dedicated_idle(void)
  
--		spin_unlock_irqrestore(&iommu->register_lock, flag);
-+		raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
+ 		ppc64_runlatch_on();
+ 		tick_nohz_restart_sched_tick();
+-		preempt_enable_no_resched();
+-		schedule();
+-		preempt_disable();
++		schedule_preempt_disabled();
  	}
+ }
  
- 	for_each_active_iommu(iommu, drhd)
-Index: linux-2.6/drivers/pci/intr_remapping.c
+Index: linux-2.6/arch/s390/kernel/process.c
 ===================================================================
---- linux-2.6.orig/drivers/pci/intr_remapping.c
-+++ linux-2.6/drivers/pci/intr_remapping.c
-@@ -46,7 +46,7 @@ static __init int setup_intremap(char *s
+--- linux-2.6.orig/arch/s390/kernel/process.c
++++ linux-2.6/arch/s390/kernel/process.c
+@@ -94,9 +94,7 @@ void cpu_idle(void)
+ 		while (!need_resched())
+ 			default_idle();
+ 		tick_nohz_restart_sched_tick();
+-		preempt_enable_no_resched();
+-		schedule();
+-		preempt_disable();
++		schedule_preempt_disabled();
+ 	}
  }
- early_param("intremap", setup_intremap);
- 
--static DEFINE_SPINLOCK(irq_2_ir_lock);
-+static DEFINE_RAW_SPINLOCK(irq_2_ir_lock);
  
- static struct irq_2_iommu *irq_2_iommu(unsigned int irq)
- {
-@@ -63,12 +63,12 @@ int get_irte(int irq, struct irte *entry
- 	if (!entry || !irq_iommu)
- 		return -1;
+Index: linux-2.6/arch/score/kernel/process.c
+===================================================================
+--- linux-2.6.orig/arch/score/kernel/process.c
++++ linux-2.6/arch/score/kernel/process.c
+@@ -53,9 +53,7 @@ void __noreturn cpu_idle(void)
+ 		while (!need_resched())
+ 			barrier();
  
--	spin_lock_irqsave(&irq_2_ir_lock, flags);
-+	raw_spin_lock_irqsave(&irq_2_ir_lock, flags);
+-		preempt_enable_no_resched();
+-		schedule();
+-		preempt_disable();
++		schedule_preempt_disabled();
+ 	}
+ }
  
- 	index = irq_iommu->irte_index + irq_iommu->sub_handle;
- 	*entry = *(irq_iommu->iommu->ir_table->base + index);
+Index: linux-2.6/arch/sh/kernel/idle.c
+===================================================================
+--- linux-2.6.orig/arch/sh/kernel/idle.c
++++ linux-2.6/arch/sh/kernel/idle.c
+@@ -110,9 +110,7 @@ void cpu_idle(void)
+ 		}
  
--	spin_unlock_irqrestore(&irq_2_ir_lock, flags);
-+	raw_spin_unlock_irqrestore(&irq_2_ir_lock, flags);
- 	return 0;
+ 		tick_nohz_restart_sched_tick();
+-		preempt_enable_no_resched();
+-		schedule();
+-		preempt_disable();
++		schedule_preempt_disabled();
+ 	}
  }
  
-@@ -102,7 +102,7 @@ int alloc_irte(struct intel_iommu *iommu
- 		return -1;
+Index: linux-2.6/arch/sparc/kernel/process_32.c
+===================================================================
+--- linux-2.6.orig/arch/sparc/kernel/process_32.c
++++ linux-2.6/arch/sparc/kernel/process_32.c
+@@ -113,9 +113,7 @@ void cpu_idle(void)
+ 			while (!need_resched())
+ 				cpu_relax();
+ 		}
+-		preempt_enable_no_resched();
+-		schedule();
+-		preempt_disable();
++		schedule_preempt_disabled();
+ 		check_pgt_cache();
  	}
- 
--	spin_lock_irqsave(&irq_2_ir_lock, flags);
-+	raw_spin_lock_irqsave(&irq_2_ir_lock, flags);
- 	do {
- 		for (i = index; i < index + count; i++)
- 			if  (table->base[i].present)
-@@ -114,7 +114,7 @@ int alloc_irte(struct intel_iommu *iommu
- 		index = (index + count) % INTR_REMAP_TABLE_ENTRIES;
- 
- 		if (index == start_index) {
--			spin_unlock_irqrestore(&irq_2_ir_lock, flags);
-+			raw_spin_unlock_irqrestore(&irq_2_ir_lock, flags);
- 			printk(KERN_ERR "can't allocate an IRTE\n");
- 			return -1;
+ }
+@@ -138,9 +136,7 @@ void cpu_idle(void)
+ 			while (!need_resched())
+ 				cpu_relax();
  		}
-@@ -128,7 +128,7 @@ int alloc_irte(struct intel_iommu *iommu
- 	irq_iommu->sub_handle = 0;
- 	irq_iommu->irte_mask = mask;
+-		preempt_enable_no_resched();
+-		schedule();
+-		preempt_disable();
++		schedule_preempt_disabled();
+ 		check_pgt_cache();
+ 	}
+ }
+Index: linux-2.6/arch/sparc/kernel/process_64.c
+===================================================================
+--- linux-2.6.orig/arch/sparc/kernel/process_64.c
++++ linux-2.6/arch/sparc/kernel/process_64.c
+@@ -102,15 +102,13 @@ void cpu_idle(void)
  
--	spin_unlock_irqrestore(&irq_2_ir_lock, flags);
-+	raw_spin_unlock_irqrestore(&irq_2_ir_lock, flags);
+ 		tick_nohz_restart_sched_tick();
  
- 	return index;
+-		preempt_enable_no_resched();
+-
+ #ifdef CONFIG_HOTPLUG_CPU
+-		if (cpu_is_offline(cpu))
++		if (cpu_is_offline(cpu)) {
++			__preempt_enable_no_resched();
+ 			cpu_play_dead();
++		}
+ #endif
+-
+-		schedule();
+-		preempt_disable();
++		schedule_preempt_disabled();
+ 	}
  }
-@@ -153,10 +153,10 @@ int map_irq_to_irte_handle(int irq, u16 
- 	if (!irq_iommu)
- 		return -1;
  
--	spin_lock_irqsave(&irq_2_ir_lock, flags);
-+	raw_spin_lock_irqsave(&irq_2_ir_lock, flags);
- 	*sub_handle = irq_iommu->sub_handle;
- 	index = irq_iommu->irte_index;
--	spin_unlock_irqrestore(&irq_2_ir_lock, flags);
-+	raw_spin_unlock_irqrestore(&irq_2_ir_lock, flags);
- 	return index;
+Index: linux-2.6/arch/tile/kernel/process.c
+===================================================================
+--- linux-2.6.orig/arch/tile/kernel/process.c
++++ linux-2.6/arch/tile/kernel/process.c
+@@ -106,9 +106,7 @@ void cpu_idle(void)
+ 			current_thread_info()->status |= TS_POLLING;
+ 		}
+ 		tick_nohz_restart_sched_tick();
+-		preempt_enable_no_resched();
+-		schedule();
+-		preempt_disable();
++		schedule_preempt_disabled();
+ 	}
  }
  
-@@ -168,14 +168,14 @@ int set_irte_irq(int irq, struct intel_i
- 	if (!irq_iommu)
- 		return -1;
- 
--	spin_lock_irqsave(&irq_2_ir_lock, flags);
-+	raw_spin_lock_irqsave(&irq_2_ir_lock, flags);
- 
- 	irq_iommu->iommu = iommu;
- 	irq_iommu->irte_index = index;
- 	irq_iommu->sub_handle = subhandle;
- 	irq_iommu->irte_mask = 0;
- 
--	spin_unlock_irqrestore(&irq_2_ir_lock, flags);
-+	raw_spin_unlock_irqrestore(&irq_2_ir_lock, flags);
+Index: linux-2.6/arch/x86/kernel/process_32.c
+===================================================================
+--- linux-2.6.orig/arch/x86/kernel/process_32.c
++++ linux-2.6/arch/x86/kernel/process_32.c
+@@ -38,6 +38,7 @@
+ #include <linux/uaccess.h>
+ #include <linux/io.h>
+ #include <linux/kdebug.h>
++#include <linux/highmem.h>
  
- 	return 0;
+ #include <asm/pgtable.h>
+ #include <asm/system.h>
+@@ -113,9 +114,7 @@ void cpu_idle(void)
+ 			start_critical_timings();
+ 		}
+ 		tick_nohz_restart_sched_tick();
+-		preempt_enable_no_resched();
+-		schedule();
+-		preempt_disable();
++		schedule_preempt_disabled();
+ 	}
  }
-@@ -191,7 +191,7 @@ int modify_irte(int irq, struct irte *ir
- 	if (!irq_iommu)
- 		return -1;
  
--	spin_lock_irqsave(&irq_2_ir_lock, flags);
-+	raw_spin_lock_irqsave(&irq_2_ir_lock, flags);
- 
- 	iommu = irq_iommu->iommu;
- 
-@@ -203,7 +203,7 @@ int modify_irte(int irq, struct irte *ir
- 	__iommu_flush_cache(iommu, irte, sizeof(*irte));
+@@ -348,6 +347,41 @@ __switch_to(struct task_struct *prev_p, 
+ 		     task_thread_info(next_p)->flags & _TIF_WORK_CTXSW_NEXT))
+ 		__switch_to_xtra(prev_p, next_p, tss);
  
- 	rc = qi_flush_iec(iommu, index, 0);
--	spin_unlock_irqrestore(&irq_2_ir_lock, flags);
-+	raw_spin_unlock_irqrestore(&irq_2_ir_lock, flags);
++#if defined CONFIG_PREEMPT_RT_FULL && defined CONFIG_HIGHMEM
++	/*
++	 * Save @prev's kmap_atomic stack
++	 */
++	prev_p->kmap_idx = __this_cpu_read(__kmap_atomic_idx);
++	if (unlikely(prev_p->kmap_idx)) {
++		int i;
++
++		for (i = 0; i < prev_p->kmap_idx; i++) {
++			int idx = i + KM_TYPE_NR * smp_processor_id();
++
++			pte_t *ptep = kmap_pte - idx;
++			prev_p->kmap_pte[i] = *ptep;
++			kpte_clear_flush(ptep, __fix_to_virt(FIX_KMAP_BEGIN + idx));
++		}
++
++		__this_cpu_write(__kmap_atomic_idx, 0);
++	}
++
++	/*
++	 * Restore @next_p's kmap_atomic stack
++	 */
++	if (unlikely(next_p->kmap_idx)) {
++		int i;
++
++		__this_cpu_write(__kmap_atomic_idx, next_p->kmap_idx);
++
++		for (i = 0; i < next_p->kmap_idx; i++) {
++			int idx = i + KM_TYPE_NR * smp_processor_id();
++
++			set_pte(kmap_pte - idx, next_p->kmap_pte[i]);
++		}
++	}
++#endif
++
+ 	/* If we're going to preload the fpu context, make sure clts
+ 	   is run while we're batching the cpu state updates. */
+ 	if (preload_fpu)
+Index: linux-2.6/arch/x86/kernel/process_64.c
+===================================================================
+--- linux-2.6.orig/arch/x86/kernel/process_64.c
++++ linux-2.6/arch/x86/kernel/process_64.c
+@@ -146,9 +146,7 @@ void cpu_idle(void)
+ 		}
  
- 	return rc;
+ 		tick_nohz_restart_sched_tick();
+-		preempt_enable_no_resched();
+-		schedule();
+-		preempt_disable();
++		schedule_preempt_disabled();
+ 	}
  }
-@@ -271,7 +271,7 @@ int free_irte(int irq)
- 	if (!irq_iommu)
- 		return -1;
- 
--	spin_lock_irqsave(&irq_2_ir_lock, flags);
-+	raw_spin_lock_irqsave(&irq_2_ir_lock, flags);
- 
- 	rc = clear_entries(irq_iommu);
  
-@@ -280,7 +280,7 @@ int free_irte(int irq)
- 	irq_iommu->sub_handle = 0;
- 	irq_iommu->irte_mask = 0;
- 
--	spin_unlock_irqrestore(&irq_2_ir_lock, flags);
-+	raw_spin_unlock_irqrestore(&irq_2_ir_lock, flags);
- 
- 	return rc;
+Index: linux-2.6/arch/xtensa/kernel/process.c
+===================================================================
+--- linux-2.6.orig/arch/xtensa/kernel/process.c
++++ linux-2.6/arch/xtensa/kernel/process.c
+@@ -113,9 +113,7 @@ void cpu_idle(void)
+ 	while (1) {
+ 		while (!need_resched())
+ 			platform_idle();
+-		preempt_enable_no_resched();
+-		schedule();
+-		preempt_disable();
++		schedule_preempt_disabled();
+ 	}
  }
-@@ -410,7 +410,7 @@ static void iommu_set_intr_remapping(str
- 
- 	addr = virt_to_phys((void *)iommu->ir_table->base);
  
--	spin_lock_irqsave(&iommu->register_lock, flags);
-+	raw_spin_lock_irqsave(&iommu->register_lock, flags);
- 
- 	dmar_writeq(iommu->reg + DMAR_IRTA_REG,
- 		    (addr) | IR_X2APIC_MODE(mode) | INTR_REMAP_TABLE_REG_SIZE);
-@@ -421,7 +421,7 @@ static void iommu_set_intr_remapping(str
+Index: linux-2.6/init/main.c
+===================================================================
+--- linux-2.6.orig/init/main.c
++++ linux-2.6/init/main.c
+@@ -68,6 +68,7 @@
+ #include <linux/shmem_fs.h>
+ #include <linux/slab.h>
+ #include <linux/perf_event.h>
++#include <linux/posix-timers.h>
  
- 	IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG,
- 		      readl, (sts & DMA_GSTS_IRTPS), sts);
--	spin_unlock_irqrestore(&iommu->register_lock, flags);
-+	raw_spin_unlock_irqrestore(&iommu->register_lock, flags);
+ #include <asm/io.h>
+ #include <asm/bugs.h>
+@@ -367,9 +368,7 @@ static noinline void __init_refok rest_i
+ 	 * at least once to get things moving:
+ 	 */
+ 	init_idle_bootup_task(current);
+-	preempt_enable_no_resched();
+-	schedule();
+-	preempt_disable();
++	schedule_preempt_disabled();
  
+ 	/* Call into cpu_idle with preempt disabled */
+ 	cpu_idle();
+@@ -501,6 +500,7 @@ asmlinkage void __init start_kernel(void
+ 	parse_args("Booting kernel", static_command_line, __start___param,
+ 		   __stop___param - __start___param,
+ 		   &unknown_bootoption);
++	softirq_early_init();
  	/*
- 	 * global invalidation of interrupt entry cache before enabling
-@@ -429,7 +429,7 @@ static void iommu_set_intr_remapping(str
- 	 */
- 	qi_global_iec(iommu);
+ 	 * These use large bootmem allocations and must precede
+ 	 * kmem_cache_init()
+Index: linux-2.6/kernel/mutex.c
+===================================================================
+--- linux-2.6.orig/kernel/mutex.c
++++ linux-2.6/kernel/mutex.c
+@@ -240,9 +240,7 @@ __mutex_lock_common(struct mutex *lock, 
  
--	spin_lock_irqsave(&iommu->register_lock, flags);
-+	raw_spin_lock_irqsave(&iommu->register_lock, flags);
+ 		/* didn't get the lock, go to sleep: */
+ 		spin_unlock_mutex(&lock->wait_lock, flags);
+-		preempt_enable_no_resched();
+-		schedule();
+-		preempt_disable();
++		schedule_preempt_disabled();
+ 		spin_lock_mutex(&lock->wait_lock, flags);
+ 	}
  
- 	/* Enable interrupt-remapping */
- 	iommu->gcmd |= DMA_GCMD_IRE;
-@@ -438,7 +438,7 @@ static void iommu_set_intr_remapping(str
- 	IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG,
- 		      readl, (sts & DMA_GSTS_IRES), sts);
+Index: linux-2.6/kernel/softirq.c
+===================================================================
+--- linux-2.6.orig/kernel/softirq.c
++++ linux-2.6/kernel/softirq.c
+@@ -24,6 +24,7 @@
+ #include <linux/ftrace.h>
+ #include <linux/smp.h>
+ #include <linux/tick.h>
++#include <linux/locallock.h>
  
--	spin_unlock_irqrestore(&iommu->register_lock, flags);
-+	raw_spin_unlock_irqrestore(&iommu->register_lock, flags);
+ #define CREATE_TRACE_POINTS
+ #include <trace/events/irq.h>
+@@ -61,6 +62,67 @@ char *softirq_to_name[NR_SOFTIRQS] = {
+ 	"TASKLET", "SCHED", "HRTIMER", "RCU"
+ };
+ 
++#ifdef CONFIG_NO_HZ
++# ifdef CONFIG_PREEMPT_RT_FULL
++/*
++ * On preempt-rt a softirq might be blocked on a lock. There might be
++ * no other runnable task on this CPU because the lock owner runs on
++ * some other CPU. So we have to go into idle with the pending bit
++ * set. Therefor we need to check this otherwise we warn about false
++ * positives which confuses users and defeats the whole purpose of
++ * this test.
++ *
++ * This code is called with interrupts disabled.
++ */
++void softirq_check_pending_idle(void)
++{
++	static int rate_limit;
++	u32 warnpending = 0, pending = local_softirq_pending();
++
++	if (rate_limit >= 10)
++		return;
++
++	if (pending) {
++		struct task_struct *tsk;
++
++		tsk = __get_cpu_var(ksoftirqd);
++		/*
++		 * The wakeup code in rtmutex.c wakes up the task
++		 * _before_ it sets pi_blocked_on to NULL under
++		 * tsk->pi_lock. So we need to check for both: state
++		 * and pi_blocked_on.
++		 */
++		raw_spin_lock(&tsk->pi_lock);
++
++		if (!tsk->pi_blocked_on && !(tsk->state == TASK_RUNNING))
++			warnpending = 1;
++
++		raw_spin_unlock(&tsk->pi_lock);
++	}
++
++	if (warnpending) {
++		printk(KERN_ERR "NOHZ: local_softirq_pending %02x\n",
++		       pending);
++		rate_limit++;
++	}
++}
++# else
++/*
++ * On !PREEMPT_RT we just printk rate limited:
++ */
++void softirq_check_pending_idle(void)
++{
++	static int rate_limit;
++
++	if (rate_limit < 10) {
++		printk(KERN_ERR "NOHZ: local_softirq_pending %02x\n",
++		       local_softirq_pending());
++		rate_limit++;
++	}
++}
++# endif
++#endif
++
+ /*
+  * we cannot loop indefinitely here to avoid userspace starvation,
+  * but we also don't want to introduce a worst case 1/HZ latency
+@@ -76,6 +138,35 @@ static void wakeup_softirqd(void)
+ 		wake_up_process(tsk);
  }
  
++static void handle_pending_softirqs(u32 pending, int cpu)
++{
++	struct softirq_action *h = softirq_vec;
++	unsigned int prev_count = preempt_count();
++
++	local_irq_enable();
++	for ( ; pending; h++, pending >>= 1) {
++		unsigned int vec_nr = h - softirq_vec;
++
++		if (!(pending & 1))
++			continue;
++
++		kstat_incr_softirqs_this_cpu(vec_nr);
++		trace_softirq_entry(vec_nr);
++		h->action(h);
++		trace_softirq_exit(vec_nr);
++		if (unlikely(prev_count != preempt_count())) {
++			printk(KERN_ERR
++ "huh, entered softirq %u %s %p with preempt_count %08x exited with %08x?\n",
++			       vec_nr, softirq_to_name[vec_nr], h->action,
++			       prev_count, (unsigned int) preempt_count());
++			preempt_count() = prev_count;
++		}
++		rcu_bh_qs(cpu);
++	}
++	local_irq_disable();
++}
++
++#ifndef CONFIG_PREEMPT_RT_FULL
+ /*
+  * preempt_count and SOFTIRQ_OFFSET usage:
+  * - preempt_count is changed by SOFTIRQ_OFFSET on entering or leaving
+@@ -206,7 +297,6 @@ EXPORT_SYMBOL(local_bh_enable_ip);
+ 
+ asmlinkage void __do_softirq(void)
+ {
+-	struct softirq_action *h;
+ 	__u32 pending;
+ 	int max_restart = MAX_SOFTIRQ_RESTART;
+ 	int cpu;
+@@ -215,7 +305,7 @@ asmlinkage void __do_softirq(void)
+ 	account_system_vtime(current);
  
-@@ -486,7 +486,7 @@ static void iommu_disable_intr_remapping
- 	 */
- 	qi_global_iec(iommu);
+ 	__local_bh_disable((unsigned long)__builtin_return_address(0),
+-				SOFTIRQ_OFFSET);
++			   SOFTIRQ_OFFSET);
+ 	lockdep_softirq_enter();
  
--	spin_lock_irqsave(&iommu->register_lock, flags);
-+	raw_spin_lock_irqsave(&iommu->register_lock, flags);
+ 	cpu = smp_processor_id();
+@@ -223,36 +313,7 @@ restart:
+ 	/* Reset the pending bitmask before enabling irqs */
+ 	set_softirq_pending(0);
  
- 	sts = dmar_readq(iommu->reg + DMAR_GSTS_REG);
- 	if (!(sts & DMA_GSTS_IRES))
-@@ -499,7 +499,7 @@ static void iommu_disable_intr_remapping
- 		      readl, !(sts & DMA_GSTS_IRES), sts);
+-	local_irq_enable();
+-
+-	h = softirq_vec;
+-
+-	do {
+-		if (pending & 1) {
+-			unsigned int vec_nr = h - softirq_vec;
+-			int prev_count = preempt_count();
+-
+-			kstat_incr_softirqs_this_cpu(vec_nr);
+-
+-			trace_softirq_entry(vec_nr);
+-			h->action(h);
+-			trace_softirq_exit(vec_nr);
+-			if (unlikely(prev_count != preempt_count())) {
+-				printk(KERN_ERR "huh, entered softirq %u %s %p"
+-				       "with preempt_count %08x,"
+-				       " exited with %08x?\n", vec_nr,
+-				       softirq_to_name[vec_nr], h->action,
+-				       prev_count, preempt_count());
+-				preempt_count() = prev_count;
+-			}
+-
+-			rcu_bh_qs(cpu);
+-		}
+-		h++;
+-		pending >>= 1;
+-	} while (pending);
+-
+-	local_irq_disable();
++	handle_pending_softirqs(pending, cpu);
  
- end:
--	spin_unlock_irqrestore(&iommu->register_lock, flags);
-+	raw_spin_unlock_irqrestore(&iommu->register_lock, flags);
+ 	pending = local_softirq_pending();
+ 	if (pending && --max_restart)
+@@ -267,6 +328,26 @@ restart:
+ 	__local_bh_enable(SOFTIRQ_OFFSET);
  }
  
- int __init intr_remapping_supported(void)
-Index: linux-2.6/include/linux/intel-iommu.h
-===================================================================
---- linux-2.6.orig/include/linux/intel-iommu.h
-+++ linux-2.6/include/linux/intel-iommu.h
-@@ -271,7 +271,7 @@ struct qi_desc {
- };
++/*
++ * Called with preemption disabled from run_ksoftirqd()
++ */
++static int ksoftirqd_do_softirq(int cpu)
++{
++	/*
++	 * Preempt disable stops cpu going offline.
++	 * If already offline, we'll be on wrong CPU:
++	 * don't process.
++	 */
++	if (cpu_is_offline(cpu))
++		return -1;
++
++	local_irq_disable();
++	if (local_softirq_pending())
++		__do_softirq();
++	local_irq_enable();
++	return 0;
++}
++
+ #ifndef __ARCH_HAS_DO_SOFTIRQ
  
- struct q_inval {
--	spinlock_t      q_lock;
-+	raw_spinlock_t  q_lock;
- 	struct qi_desc  *desc;          /* invalidation queue */
- 	int             *desc_status;   /* desc status */
- 	int             free_head;      /* first free entry */
-@@ -311,7 +311,7 @@ struct intel_iommu {
- 	u64		cap;
- 	u64		ecap;
- 	u32		gcmd; /* Holds TE, EAFL. Don't need SRTP, SFL, WBF */
--	spinlock_t	register_lock; /* protect register handling */
-+	raw_spinlock_t	register_lock; /* protect register handling */
- 	int		seq_id;	/* sequence id of the iommu */
- 	int		agaw; /* agaw of this iommu */
- 	int		msagaw; /* max sagaw of this iommu */
-Index: linux-2.6/lib/atomic64.c
-===================================================================
---- linux-2.6.orig/lib/atomic64.c
-+++ linux-2.6/lib/atomic64.c
-@@ -29,7 +29,7 @@
-  * Ensure each lock is in a separate cacheline.
+ asmlinkage void do_softirq(void)
+@@ -289,6 +370,178 @@ asmlinkage void do_softirq(void)
+ 
+ #endif
+ 
++static inline void local_bh_disable_nort(void) { local_bh_disable(); }
++static inline void _local_bh_enable_nort(void) { _local_bh_enable(); }
++static inline void ksoftirqd_set_sched_params(void) { }
++static inline void ksoftirqd_clr_sched_params(void) { }
++
++#else /* !PREEMPT_RT_FULL */
++
++/*
++ * On RT we serialize softirq execution with a cpu local lock
++ */
++static DEFINE_LOCAL_IRQ_LOCK(local_softirq_lock);
++static DEFINE_PER_CPU(struct task_struct *, local_softirq_runner);
++
++static void __do_softirq(void);
++
++void __init softirq_early_init(void)
++{
++	local_irq_lock_init(local_softirq_lock);
++}
++
++void local_bh_disable(void)
++{
++	migrate_disable();
++	current->softirq_nestcnt++;
++}
++EXPORT_SYMBOL(local_bh_disable);
++
++void local_bh_enable(void)
++{
++	if (WARN_ON(current->softirq_nestcnt == 0))
++		return;
++
++	if ((current->softirq_nestcnt == 1) &&
++	    local_softirq_pending() &&
++	    local_trylock(local_softirq_lock)) {
++
++		local_irq_disable();
++		if (local_softirq_pending())
++			__do_softirq();
++		local_unlock(local_softirq_lock);
++		local_irq_enable();
++		WARN_ON(current->softirq_nestcnt != 1);
++	}
++	current->softirq_nestcnt--;
++	migrate_enable();
++}
++EXPORT_SYMBOL(local_bh_enable);
++
++void local_bh_enable_ip(unsigned long ip)
++{
++	local_bh_enable();
++}
++EXPORT_SYMBOL(local_bh_enable_ip);
++
++/* For tracing */
++int notrace __in_softirq(void)
++{
++	if (__get_cpu_var(local_softirq_lock).owner == current)
++		return __get_cpu_var(local_softirq_lock).nestcnt;
++	return 0;
++}
++
++int in_serving_softirq(void)
++{
++	int res;
++
++	preempt_disable();
++	res = __get_cpu_var(local_softirq_runner) == current;
++	preempt_enable();
++	return res;
++}
++
++/*
++ * Called with bh and local interrupts disabled. For full RT cpu must
++ * be pinned.
++ */
++static void __do_softirq(void)
++{
++	u32 pending = local_softirq_pending();
++	int cpu = smp_processor_id();
++
++	current->softirq_nestcnt++;
++
++	/* Reset the pending bitmask before enabling irqs */
++	set_softirq_pending(0);
++
++	__get_cpu_var(local_softirq_runner) = current;
++
++	lockdep_softirq_enter();
++
++	handle_pending_softirqs(pending, cpu);
++
++	pending = local_softirq_pending();
++	if (pending)
++		wakeup_softirqd();
++
++	lockdep_softirq_exit();
++	__get_cpu_var(local_softirq_runner) = NULL;
++
++	current->softirq_nestcnt--;
++}
++
++static int __thread_do_softirq(int cpu)
++{
++	/*
++	 * Prevent the current cpu from going offline.
++	 * pin_current_cpu() can reenable preemption and block on the
++	 * hotplug mutex. When it returns, the current cpu is
++	 * pinned. It might be the wrong one, but the offline check
++	 * below catches that.
++	 */
++	pin_current_cpu();
++	/*
++	 * If called from ksoftirqd (cpu >= 0) we need to check
++	 * whether we are on the wrong cpu due to cpu offlining. If
++	 * called via thread_do_softirq() no action required.
++	 */
++	if (cpu >= 0 && cpu_is_offline(cpu)) {
++		unpin_current_cpu();
++		return -1;
++	}
++	preempt_enable();
++	local_lock(local_softirq_lock);
++	local_irq_disable();
++	/*
++	 * We cannot switch stacks on RT as we want to be able to
++	 * schedule!
++	 */
++	if (local_softirq_pending())
++		__do_softirq();
++	local_unlock(local_softirq_lock);
++	unpin_current_cpu();
++	preempt_disable();
++	local_irq_enable();
++	return 0;
++}
++
++/*
++ * Called from netif_rx_ni(). Preemption enabled.
++ */
++void thread_do_softirq(void)
++{
++	if (!in_serving_softirq()) {
++		preempt_disable();
++		__thread_do_softirq(-1);
++		preempt_enable();
++	}
++}
++
++static int ksoftirqd_do_softirq(int cpu)
++{
++	return __thread_do_softirq(cpu);
++}
++
++static inline void local_bh_disable_nort(void) { }
++static inline void _local_bh_enable_nort(void) { }
++
++static inline void ksoftirqd_set_sched_params(void)
++{
++	struct sched_param param = { .sched_priority = 1 };
++
++	sched_setscheduler(current, SCHED_FIFO, &param);
++}
++
++static inline void ksoftirqd_clr_sched_params(void)
++{
++	struct sched_param param = { .sched_priority = 0 };
++
++	sched_setscheduler(current, SCHED_NORMAL, &param);
++}
++
++#endif /* PREEMPT_RT_FULL */
+ /*
+  * Enter an interrupt context.
   */
- static union {
--	spinlock_t lock;
-+	raw_spinlock_t lock;
- 	char pad[L1_CACHE_BYTES];
- } atomic64_lock[NR_LOCKS] __cacheline_aligned_in_smp;
- 
-@@ -48,9 +48,9 @@ long long atomic64_read(const atomic64_t
- 	spinlock_t *lock = lock_addr(v);
- 	long long val;
- 
--	spin_lock_irqsave(lock, flags);
-+	raw_spin_lock_irqsave(lock, flags);
- 	val = v->counter;
--	spin_unlock_irqrestore(lock, flags);
-+	raw_spin_unlock_irqrestore(lock, flags);
- 	return val;
- }
- EXPORT_SYMBOL(atomic64_read);
-@@ -60,9 +60,9 @@ void atomic64_set(atomic64_t *v, long lo
- 	unsigned long flags;
- 	spinlock_t *lock = lock_addr(v);
- 
--	spin_lock_irqsave(lock, flags);
-+	raw_spin_lock_irqsave(lock, flags);
- 	v->counter = i;
--	spin_unlock_irqrestore(lock, flags);
-+	raw_spin_unlock_irqrestore(lock, flags);
- }
- EXPORT_SYMBOL(atomic64_set);
- 
-@@ -71,9 +71,9 @@ void atomic64_add(long long a, atomic64_
- 	unsigned long flags;
- 	spinlock_t *lock = lock_addr(v);
- 
--	spin_lock_irqsave(lock, flags);
-+	raw_spin_lock_irqsave(lock, flags);
- 	v->counter += a;
--	spin_unlock_irqrestore(lock, flags);
-+	raw_spin_unlock_irqrestore(lock, flags);
- }
- EXPORT_SYMBOL(atomic64_add);
- 
-@@ -83,9 +83,9 @@ long long atomic64_add_return(long long 
- 	spinlock_t *lock = lock_addr(v);
- 	long long val;
+@@ -302,9 +555,9 @@ void irq_enter(void)
+ 		 * Prevent raise_softirq from needlessly waking up ksoftirqd
+ 		 * here, as softirq will be serviced on return from interrupt.
+ 		 */
+-		local_bh_disable();
++		local_bh_disable_nort();
+ 		tick_check_idle(cpu);
+-		_local_bh_enable();
++		_local_bh_enable_nort();
+ 	}
  
--	spin_lock_irqsave(lock, flags);
-+	raw_spin_lock_irqsave(lock, flags);
- 	val = v->counter += a;
--	spin_unlock_irqrestore(lock, flags);
-+	raw_spin_unlock_irqrestore(lock, flags);
- 	return val;
+ 	__irq_enter();
+@@ -313,6 +566,7 @@ void irq_enter(void)
+ #ifdef __ARCH_IRQ_EXIT_IRQS_DISABLED
+ static inline void invoke_softirq(void)
+ {
++#ifndef CONFIG_PREEMPT_RT_FULL
+ 	if (!force_irqthreads)
+ 		__do_softirq();
+ 	else {
+@@ -321,10 +575,14 @@ static inline void invoke_softirq(void)
+ 		wakeup_softirqd();
+ 		__local_bh_enable(SOFTIRQ_OFFSET);
+ 	}
++#else
++	wakeup_softirqd();
++#endif
  }
- EXPORT_SYMBOL(atomic64_add_return);
-@@ -95,9 +95,9 @@ void atomic64_sub(long long a, atomic64_
- 	unsigned long flags;
- 	spinlock_t *lock = lock_addr(v);
- 
--	spin_lock_irqsave(lock, flags);
-+	raw_spin_lock_irqsave(lock, flags);
- 	v->counter -= a;
--	spin_unlock_irqrestore(lock, flags);
-+	raw_spin_unlock_irqrestore(lock, flags);
+ #else
+ static inline void invoke_softirq(void)
+ {
++#ifndef CONFIG_PREEMPT_RT_FULL
+ 	if (!force_irqthreads)
+ 		do_softirq();
+ 	else {
+@@ -333,6 +591,9 @@ static inline void invoke_softirq(void)
+ 		wakeup_softirqd();
+ 		__local_bh_enable(SOFTIRQ_OFFSET);
+ 	}
++#else
++	wakeup_softirqd();
++#endif
  }
- EXPORT_SYMBOL(atomic64_sub);
- 
-@@ -107,9 +107,9 @@ long long atomic64_sub_return(long long 
- 	spinlock_t *lock = lock_addr(v);
- 	long long val;
+ #endif
  
--	spin_lock_irqsave(lock, flags);
-+	raw_spin_lock_irqsave(lock, flags);
- 	val = v->counter -= a;
--	spin_unlock_irqrestore(lock, flags);
-+	raw_spin_unlock_irqrestore(lock, flags);
- 	return val;
+@@ -353,7 +614,7 @@ void irq_exit(void)
+ 	if (idle_cpu(smp_processor_id()) && !in_interrupt() && !need_resched())
+ 		tick_nohz_stop_sched_tick(0);
+ #endif
+-	preempt_enable_no_resched();
++	__preempt_enable_no_resched();
  }
- EXPORT_SYMBOL(atomic64_sub_return);
-@@ -120,11 +120,11 @@ long long atomic64_dec_if_positive(atomi
- 	spinlock_t *lock = lock_addr(v);
- 	long long val;
  
--	spin_lock_irqsave(lock, flags);
-+	raw_spin_lock_irqsave(lock, flags);
- 	val = v->counter - 1;
- 	if (val >= 0)
- 		v->counter = val;
--	spin_unlock_irqrestore(lock, flags);
-+	raw_spin_unlock_irqrestore(lock, flags);
- 	return val;
- }
- EXPORT_SYMBOL(atomic64_dec_if_positive);
-@@ -135,11 +135,11 @@ long long atomic64_cmpxchg(atomic64_t *v
- 	spinlock_t *lock = lock_addr(v);
- 	long long val;
+ /*
+@@ -739,29 +1000,21 @@ void __init softirq_init(void)
  
--	spin_lock_irqsave(lock, flags);
-+	raw_spin_lock_irqsave(lock, flags);
- 	val = v->counter;
- 	if (val == o)
- 		v->counter = n;
--	spin_unlock_irqrestore(lock, flags);
-+	raw_spin_unlock_irqrestore(lock, flags);
- 	return val;
- }
- EXPORT_SYMBOL(atomic64_cmpxchg);
-@@ -150,10 +150,10 @@ long long atomic64_xchg(atomic64_t *v, l
- 	spinlock_t *lock = lock_addr(v);
- 	long long val;
+ static int run_ksoftirqd(void * __bind_cpu)
+ {
++	ksoftirqd_set_sched_params();
++
+ 	set_current_state(TASK_INTERRUPTIBLE);
  
--	spin_lock_irqsave(lock, flags);
-+	raw_spin_lock_irqsave(lock, flags);
- 	val = v->counter;
- 	v->counter = new;
--	spin_unlock_irqrestore(lock, flags);
-+	raw_spin_unlock_irqrestore(lock, flags);
- 	return val;
- }
- EXPORT_SYMBOL(atomic64_xchg);
-@@ -164,12 +164,12 @@ int atomic64_add_unless(atomic64_t *v, l
- 	spinlock_t *lock = lock_addr(v);
- 	int ret = 0;
+ 	while (!kthread_should_stop()) {
+ 		preempt_disable();
+-		if (!local_softirq_pending()) {
+-			preempt_enable_no_resched();
+-			schedule();
+-			preempt_disable();
+-		}
++		if (!local_softirq_pending())
++			schedule_preempt_disabled();
  
--	spin_lock_irqsave(lock, flags);
-+	raw_spin_lock_irqsave(lock, flags);
- 	if (v->counter != u) {
- 		v->counter += a;
- 		ret = 1;
- 	}
--	spin_unlock_irqrestore(lock, flags);
-+	raw_spin_unlock_irqrestore(lock, flags);
- 	return ret;
- }
- EXPORT_SYMBOL(atomic64_add_unless);
-@@ -179,7 +179,7 @@ static int init_atomic64_lock(void)
- 	int i;
+ 		__set_current_state(TASK_RUNNING);
  
- 	for (i = 0; i < NR_LOCKS; ++i)
--		spin_lock_init(&atomic64_lock[i].lock);
-+		raw_spin_lock_init(&atomic64_lock[i].lock);
- 	return 0;
- }
+ 		while (local_softirq_pending()) {
+-			/* Preempt disable stops cpu going offline.
+-			   If already offline, we'll be on wrong CPU:
+-			   don't process */
+-			if (cpu_is_offline((long)__bind_cpu))
++			if (ksoftirqd_do_softirq((long) __bind_cpu))
+ 				goto wait_to_die;
+-			local_irq_disable();
+-			if (local_softirq_pending())
+-				__do_softirq();
+-			local_irq_enable();
+-			preempt_enable_no_resched();
++			__preempt_enable_no_resched();
+ 			cond_resched();
+ 			preempt_disable();
+ 			rcu_note_context_switch((long)__bind_cpu);
+@@ -774,6 +1027,7 @@ static int run_ksoftirqd(void * __bind_c
  
+ wait_to_die:
+ 	preempt_enable();
++	ksoftirqd_clr_sched_params();
+ 	/* Wait for kthread_stop */
+ 	set_current_state(TASK_INTERRUPTIBLE);
+ 	while (!kthread_should_stop()) {
 Index: linux-2.6/kernel/signal.c
 ===================================================================
 --- linux-2.6.orig/kernel/signal.c
@@ -9803,6 +9877,15 @@
  		if (rt_rq_throttled(rt_rq)) {
  			sched_rt_rq_dequeue(rt_rq);
  			return 1;
+@@ -1038,7 +1039,7 @@ select_task_rq_rt(struct task_struct *p,
+ 	 */
+ 	if (curr && unlikely(rt_task(curr)) &&
+ 	    (curr->rt.nr_cpus_allowed < 2 ||
+-	     curr->prio < p->prio) &&
++	     curr->prio <= p->prio) &&
+ 	    (p->rt.nr_cpus_allowed > 1)) {
+ 		int target = find_lowest_rq(p);
+ 
 @@ -1186,7 +1187,7 @@ static void deactivate_task(struct rq *r
  static int pick_rt_task(struct rq *rq, struct task_struct *p, int cpu)
  {
@@ -9821,6 +9904,15 @@
  				     task_running(rq, task) ||
  				     !task->on_rq)) {
  
+@@ -1569,7 +1570,7 @@ static void task_woken_rt(struct rq *rq,
+ 	    p->rt.nr_cpus_allowed > 1 &&
+ 	    rt_task(rq->curr) &&
+ 	    (rq->curr->rt.nr_cpus_allowed < 2 ||
+-	     rq->curr->prio < p->prio))
++	     rq->curr->prio <= p->prio))
+ 		push_rt_tasks(rq);
+ }
+ 
 @@ -1614,9 +1615,6 @@ static void set_cpus_allowed_rt(struct t
  
  		update_rt_migration(&rq->rt);
@@ -15148,7 +15240,7 @@
  	timerqueue_init(&timer->node);
  
  #ifdef CONFIG_TIMER_STATS
-@@ -1232,6 +1292,116 @@ static void __run_hrtimer(struct hrtimer
+@@ -1232,6 +1292,122 @@ static void __run_hrtimer(struct hrtimer
  	timer->state &= ~HRTIMER_STATE_CALLBACK;
  }
  
@@ -15174,7 +15266,11 @@
 +		if (!enqueue_hrtimer(timer, base))
 +			return;
 +
-+		if (hrtimer_reprogram(timer, base))
++#ifndef CONFIG_HIGH_RES_TIMERS
++	}
++#else
++		if (base->cpu_base->hres_active &&
++		    hrtimer_reprogram(timer, base))
 +			goto requeue;
 +
 +	} else if (hrtimer_active(timer)) {
@@ -15183,6 +15279,7 @@
 +		 * the event device.
 +		 */
 +		if (&timer->node == base->active.next &&
++		    base->cpu_base->hres_active &&
 +		    hrtimer_reprogram(timer, base))
 +			goto requeue;
 +	}
@@ -15195,6 +15292,7 @@
 +	 */
 +	__remove_hrtimer(timer, base, timer->state, 0);
 +	list_add_tail(&timer->cb_entry, &base->expired);
++#endif
 +}
 +
 +/*
@@ -15265,7 +15363,7 @@
  #ifdef CONFIG_HIGH_RES_TIMERS
  
  /*
-@@ -1242,7 +1412,7 @@ void hrtimer_interrupt(struct clock_even
+@@ -1242,7 +1418,7 @@ void hrtimer_interrupt(struct clock_even
  {
  	struct hrtimer_cpu_base *cpu_base = &__get_cpu_var(hrtimer_bases);
  	ktime_t expires_next, now, entry_time, delta;
@@ -15274,7 +15372,7 @@
  
  	BUG_ON(!cpu_base->hres_active);
  	cpu_base->nr_events++;
-@@ -1278,6 +1448,14 @@ retry:
+@@ -1278,6 +1454,14 @@ retry:
  
  			timer = container_of(node, struct hrtimer, node);
  
@@ -15289,7 +15387,7 @@
  			/*
  			 * The immediate goal for using the softexpires is
  			 * minimizing wakeups, not running timers at the
-@@ -1301,7 +1479,10 @@ retry:
+@@ -1301,7 +1485,10 @@ retry:
  				break;
  			}
  
@@ -15301,7 +15399,7 @@
  		}
  	}
  
-@@ -1316,6 +1497,10 @@ retry:
+@@ -1316,6 +1503,10 @@ retry:
  	if (expires_next.tv64 == KTIME_MAX ||
  	    !tick_program_event(expires_next, 0)) {
  		cpu_base->hang_detected = 0;
@@ -15312,7 +15410,7 @@
  		return;
  	}
  
-@@ -1391,17 +1576,17 @@ void hrtimer_peek_ahead_timers(void)
+@@ -1391,17 +1582,17 @@ void hrtimer_peek_ahead_timers(void)
  	local_irq_restore(flags);
  }
  
@@ -15335,7 +15433,7 @@
  /*
   * Called from timer softirq every jiffy, expire hrtimers:
   *
-@@ -1434,7 +1619,7 @@ void hrtimer_run_queues(void)
+@@ -1434,7 +1625,7 @@ void hrtimer_run_queues(void)
  	struct timerqueue_node *node;
  	struct hrtimer_cpu_base *cpu_base = &__get_cpu_var(hrtimer_bases);
  	struct hrtimer_clock_base *base;
@@ -15344,7 +15442,7 @@
  
  	if (hrtimer_hres_active())
  		return;
-@@ -1459,10 +1644,16 @@ void hrtimer_run_queues(void)
+@@ -1459,10 +1650,16 @@ void hrtimer_run_queues(void)
  					hrtimer_get_expires_tv64(timer))
  				break;
  
@@ -15362,7 +15460,7 @@
  }
  
  /*
-@@ -1484,6 +1675,7 @@ static enum hrtimer_restart hrtimer_wake
+@@ -1484,6 +1681,7 @@ static enum hrtimer_restart hrtimer_wake
  void hrtimer_init_sleeper(struct hrtimer_sleeper *sl, struct task_struct *task)
  {
  	sl->timer.function = hrtimer_wakeup;
@@ -15370,7 +15468,7 @@
  	sl->task = task;
  }
  EXPORT_SYMBOL_GPL(hrtimer_init_sleeper);
-@@ -1622,9 +1814,13 @@ static void __cpuinit init_hrtimers_cpu(
+@@ -1622,9 +1820,13 @@ static void __cpuinit init_hrtimers_cpu(
  	for (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++) {
  		cpu_base->clock_base[i].cpu_base = cpu_base;
  		timerqueue_init_head(&cpu_base->clock_base[i].active);
@@ -15384,7 +15482,7 @@
  }
  
  #ifdef CONFIG_HOTPLUG_CPU
-@@ -1737,9 +1933,7 @@ void __init hrtimers_init(void)
+@@ -1737,9 +1939,7 @@ void __init hrtimers_init(void)
  	hrtimer_cpu_notify(&hrtimers_nb, (unsigned long)CPU_UP_PREPARE,
  			  (void *)(long)smp_processor_id());
  	register_cpu_notifier(&hrtimers_nb);
@@ -18033,7 +18131,7 @@
 --- /dev/null
 +++ linux-2.6/localversion-rt
 @@ -0,0 +1 @@
-+-rt13
++-rt14
 Index: linux-2.6/arch/arm/kernel/early_printk.c
 ===================================================================
 --- linux-2.6.orig/arch/arm/kernel/early_printk.c
@@ -20896,6 +20994,25 @@
  
  /*
   * debug_rcu_head_queue()/debug_rcu_head_unqueue() are used internally
+Index: linux-2.6/kernel/sched_features.h
+===================================================================
+--- linux-2.6.orig/kernel/sched_features.h
++++ linux-2.6/kernel/sched_features.h
+@@ -65,10 +65,14 @@ SCHED_FEAT(OWNER_SPIN, 1)
+  */
+ SCHED_FEAT(NONIRQ_POWER, 1)
+ 
++#ifndef CONFIG_PREEMPT_RT_FULL
+ /*
+  * Queue remote wakeups on the target CPU and process them
+  * using the scheduler IPI. Reduces rq->lock contention/bounces.
+  */
+ SCHED_FEAT(TTWU_QUEUE, 1)
++#else
++SCHED_FEAT(TTWU_QUEUE, 0)
++#endif
+ 
+ SCHED_FEAT(FORCE_SD_OVERLAP, 0)
 Index: linux-2.6/kernel/stop_machine.c
 ===================================================================
 --- linux-2.6.orig/kernel/stop_machine.c
@@ -21343,15 +21460,17 @@
 ===================================================================
 --- linux-2.6.orig/kernel/sched_debug.c
 +++ linux-2.6/kernel/sched_debug.c
-@@ -235,6 +235,7 @@ void print_rt_rq(struct seq_file *m, int
+@@ -235,6 +235,9 @@ void print_rt_rq(struct seq_file *m, int
  	P(rt_throttled);
  	PN(rt_time);
  	PN(rt_runtime);
++#ifdef CONFIG_SMP
 +	P(rt_nr_migratory);
++#endif
  
  #undef PN
  #undef P
-@@ -484,6 +485,10 @@ void proc_sched_show_task(struct task_st
+@@ -484,6 +487,10 @@ void proc_sched_show_task(struct task_st
  	P(se.load.weight);
  	P(policy);
  	P(prio);
@@ -25079,6 +25198,48 @@
  	NULL
  };
  
+Index: linux-2.6/ipc/sem.c
+===================================================================
+--- linux-2.6.orig/ipc/sem.c
++++ linux-2.6/ipc/sem.c
+@@ -415,6 +415,13 @@ undo:
+ static void wake_up_sem_queue_prepare(struct list_head *pt,
+ 				struct sem_queue *q, int error)
+ {
++#ifdef CONFIG_PREEMPT_RT_BASE
++	struct task_struct *p = q->sleeper;
++	get_task_struct(p);
++	q->status = error;
++	wake_up_process(p);
++	put_task_struct(p);
++#else
+ 	if (list_empty(pt)) {
+ 		/*
+ 		 * Hold preempt off so that we don't get preempted and have the
+@@ -426,6 +433,7 @@ static void wake_up_sem_queue_prepare(st
+ 	q->pid = error;
+ 
+ 	list_add_tail(&q->simple_list, pt);
++#endif
+ }
+ 
+ /**
+@@ -439,6 +447,7 @@ static void wake_up_sem_queue_prepare(st
+  */
+ static void wake_up_sem_queue_do(struct list_head *pt)
+ {
++#ifndef CONFIG_PREEMPT_RT_BASE
+ 	struct sem_queue *q, *t;
+ 	int did_something;
+ 
+@@ -451,6 +460,7 @@ static void wake_up_sem_queue_do(struct 
+ 	}
+ 	if (did_something)
+ 		preempt_enable();
++#endif
+ }
+ 
+ static void unlink_queue(struct sem_array *sma, struct sem_queue *q)
 Index: linux-2.6/arch/Kconfig
 ===================================================================
 --- linux-2.6.orig/arch/Kconfig

Modified: dists/sid/linux-2.6/debian/patches/series/4-extra
==============================================================================
--- dists/sid/linux-2.6/debian/patches/series/4-extra	Tue Sep 13 20:32:53 2011	(r18089)
+++ dists/sid/linux-2.6/debian/patches/series/4-extra	Thu Sep 15 14:07:15 2011	(r18090)
@@ -1 +1 @@
-+ features/all/rt/patch-3.0.4-rt13.patch featureset=rt
++ features/all/rt/patch-3.0.4-rt14.patch featureset=rt



More information about the Kernel-svn-changes mailing list