Skip to contentSkip to conversation

rebased 2.6.16 I-pipe for i386

PATCH In review Jan Kiszka 2 participants 2 messages Nov 23, 2006

Subsystems (9)
lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 rebased 2.6.16 I-pipe for i386

Hi,

as a by-product of some other hack, here comes the simple rebase of latest i386-1.5-02 I-pipe patch over 2.6.16.33. Might be interesting for those users who plan to follow Adrian Bunk's stable 2.6.16 series.

Jan

Makefile +4 -0
Index: linux-2.6.16.33/Makefile
===================================================================
@@ -511,6 +511,10 @@ CFLAGS		+= $(call add-align,CONFIG_CC_AL
 CFLAGS		+= $(call add-align,CONFIG_CC_ALIGN_LOOPS,-loops)
 CFLAGS		+= $(call add-align,CONFIG_CC_ALIGN_JUMPS,-jumps)
 
+ifdef CONFIG_IPIPE_TRACE_MCOUNT
+CFLAGS          += -pg
+endif
+
 ifdef CONFIG_FRAME_POINTER
 CFLAGS		+= -fno-omit-frame-pointer $(call cc-option,-fno-optimize-sibling-calls,)
 else
arch/i386/Kconfig +2 -0
Index: linux-2.6.16.33/arch/i386/Kconfig
===================================================================
@@ -228,6 +228,8 @@ config SCHED_SMT
 
 source "kernel/Kconfig.preempt"
 
+source "kernel/ipipe/Kconfig"
+
 config X86_UP_APIC
 	bool "Local APIC support on uniprocessors"
 	depends on !SMP && !(X86_VISWS || X86_VOYAGER)
arch/i386/boot/compressed/misc.c +7 -1
Index: linux-2.6.16.33/arch/i386/boot/compressed/misc.c
===================================================================
@@ -15,6 +15,12 @@
 #include <asm/io.h>
 #include <asm/page.h>
 
+#ifdef CONFIG_IPIPE_TRACE_MCOUNT
+void __attribute__ ((no_instrument_function)) mcount(void)
+{
+}
+#endif
+
 /*
  * gzip declarations
  */
@@ -112,7 +118,7 @@ static long free_mem_end_ptr;
 #define INPLACE_MOVE_ROUTINE  0x1000
 #define LOW_BUFFER_START      0x2000
 #define LOW_BUFFER_MAX       0x90000
-#define HEAP_SIZE             0x3000
+#define HEAP_SIZE             0x4000
 static unsigned int low_buffer_end, low_buffer_size;
 static int high_loaded =0;
 static uch *high_buffer_start /* = (uch *)(((ulg)&end) + HEAP_SIZE)*/;
arch/i386/kernel/Makefile +2 -0
Index: linux-2.6.16.33/arch/i386/kernel/Makefile
===================================================================
@@ -31,6 +31,8 @@ obj-$(CONFIG_X86_SUMMIT_NUMA)	+= summit.
 obj-$(CONFIG_KPROBES)		+= kprobes.o
 obj-$(CONFIG_MODULES)		+= module.o
 obj-y				+= sysenter.o vsyscall.o
+obj-$(CONFIG_IPIPE)		+= ipipe-core.o ipipe-root.o
+obj-$(CONFIG_IPIPE_TRACE_MCOUNT)	+= ipipe-mcount.o
 obj-$(CONFIG_ACPI_SRAT) 	+= srat.o
 obj-$(CONFIG_HPET_TIMER) 	+= time_hpet.o
 obj-$(CONFIG_EFI) 		+= efi.o efi_stub.o
arch/i386/kernel/apic.c +5 -2
Index: linux-2.6.16.33/arch/i386/kernel/apic.c
===================================================================
@@ -78,7 +78,7 @@ void ack_bad_irq(unsigned int irq)
 	 * But only ack when the APIC is enabled -AK
 	 */
 	if (cpu_has_apic)
-		ack_APIC_irq();
+		__ack_APIC_irq();
 }
 
 void __init apic_intr_init(void)
@@ -1177,6 +1177,9 @@ inline void smp_local_timer_interrupt(st
 fastcall void smp_apic_timer_interrupt(struct pt_regs *regs)
 {
 	int cpu = smp_processor_id();
+#ifdef CONFIG_IPIPE
+	regs =  __ipipe_tick_regs + cpu;
+#endif /* CONFIG_IPIPE */
 
 	/*
 	 * the NMI deadlock-detector uses this.
@@ -1250,7 +1253,7 @@ fastcall void smp_spurious_interrupt(str
 	 */
 	v = apic_read(APIC_ISR + ((SPURIOUS_APIC_VECTOR & ~0x1f) >> 1));
 	if (v & (1 << (SPURIOUS_APIC_VECTOR & 0x1f)))
-		ack_APIC_irq();
+		__ack_APIC_irq();
 
 	/* see sw-dev-man vol 3, chapter 7.4.13.5 */
 	printk(KERN_INFO "spurious APIC interrupt on CPU#%d, should never happen.\n",
arch/i386/kernel/entry.S +143 -28

373 lines not on this page · raw message

arch/i386/kernel/i8259.c +23 -12
Index: linux-2.6.16.33/arch/i386/kernel/i8259.c
===================================================================
@@ -40,7 +40,7 @@ DEFINE_SPINLOCK(i8259A_lock);
 static void end_8259A_irq (unsigned int irq)
 {
 	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)) &&
-							irq_desc[irq].action)
+	     irq_desc[irq].action)
 		enable_8259A_irq(irq);
 }
 
@@ -89,13 +89,14 @@ void disable_8259A_irq(unsigned int irq)
 	unsigned int mask = 1 << irq;
 	unsigned long flags;
 
-	spin_lock_irqsave(&i8259A_lock, flags);
+	spin_lock_irqsave_hw(&i8259A_lock, flags);
+	ipipe_irq_lock(irq);
 	cached_irq_mask |= mask;
 	if (irq & 8)
 		outb(cached_slave_mask, PIC_SLAVE_IMR);
 	else
 		outb(cached_master_mask, PIC_MASTER_IMR);
-	spin_unlock_irqrestore(&i8259A_lock, flags);
+	spin_unlock_irqrestore_hw(&i8259A_lock, flags);
 }
 
 void enable_8259A_irq(unsigned int irq)
@@ -103,13 +104,14 @@ void enable_8259A_irq(unsigned int irq)
 	unsigned int mask = ~(1 << irq);
 	unsigned long flags;
 
-	spin_lock_irqsave(&i8259A_lock, flags);
+	spin_lock_irqsave_hw(&i8259A_lock, flags);
 	cached_irq_mask &= mask;
 	if (irq & 8)
 		outb(cached_slave_mask, PIC_SLAVE_IMR);
 	else
 		outb(cached_master_mask, PIC_MASTER_IMR);
-	spin_unlock_irqrestore(&i8259A_lock, flags);
+	ipipe_irq_unlock(irq);
+	spin_unlock_irqrestore_hw(&i8259A_lock, flags);
 }
 
 int i8259A_irq_pending(unsigned int irq)
@@ -118,12 +120,12 @@ int i8259A_irq_pending(unsigned int irq)
 	unsigned long flags;
 	int ret;
 
-	spin_lock_irqsave(&i8259A_lock, flags);
+	spin_lock_irqsave_hw(&i8259A_lock, flags);
 	if (irq < 8)
 		ret = inb(PIC_MASTER_CMD) & mask;
 	else
 		ret = inb(PIC_SLAVE_CMD) & (mask >> 8);
-	spin_unlock_irqrestore(&i8259A_lock, flags);
+	spin_unlock_irqrestore_hw(&i8259A_lock, flags);
 
 	return ret;
 }
@@ -170,7 +172,7 @@ static void mask_and_ack_8259A(unsigned 
 	unsigned int irqmask = 1 << irq;
 	unsigned long flags;
 
-	spin_lock_irqsave(&i8259A_lock, flags);
+	spin_lock_irqsave_hw(&i8259A_lock, flags);
 	/*
 	 * Lightweight spurious IRQ detection. We do not want
 	 * to overdo spurious IRQ handling - it's usually a sign
@@ -188,6 +190,15 @@ static void mask_and_ack_8259A(unsigned 
 	 */
 	if (cached_irq_mask & irqmask)
 		goto spurious_8259A_irq;
+#ifdef CONFIG_IPIPE
+	if (irq == 0) {
+	    /* Fast timer ack -- don't mask (unless supposedly
+	      spurious) */
+	    outb(0x20,PIC_MASTER_CMD);
+	    spin_unlock_irqrestore_hw(&i8259A_lock, flags);
+	    return;
+	}
+#endif /* CONFIG_IPIPE */
 	cached_irq_mask |= irqmask;
 
 handle_real_irq:
@@ -201,7 +212,7 @@ handle_real_irq:
 		outb(cached_master_mask, PIC_MASTER_IMR);
 		outb(0x60+irq,PIC_MASTER_CMD);	/* 'Specific EOI to master */
 	}
-	spin_unlock_irqrestore(&i8259A_lock, flags);
+	spin_unlock_irqrestore_hw(&i8259A_lock, flags);
 	return;
 
 spurious_8259A_irq:
@@ -302,7 +313,7 @@ void init_8259A(int auto_eoi)
 {
 	unsigned long flags;
 
-	spin_lock_irqsave(&i8259A_lock, flags);
+	spin_lock_irqsave_hw(&i8259A_lock, flags);
 
 	outb(0xff, PIC_MASTER_IMR);	/* mask all of 8259A-1 */
 	outb(0xff, PIC_SLAVE_IMR);	/* mask all of 8259A-2 */
@@ -336,7 +347,7 @@ void init_8259A(int auto_eoi)
 	outb(cached_master_mask, PIC_MASTER_IMR); /* restore master IRQ mask */
 	outb(cached_slave_mask, PIC_SLAVE_IMR);	  /* restore slave IRQ mask */
 
-	spin_unlock_irqrestore(&i8259A_lock, flags);
+	spin_unlock_irqrestore_hw(&i8259A_lock, flags);
 }
 
 /*
@@ -410,7 +421,7 @@ void __init init_IRQ(void)
 	 */
 	for (i = 0; i < (NR_VECTORS - FIRST_EXTERNAL_VECTOR); i++) {
 		int vector = FIRST_EXTERNAL_VECTOR + i;
-		if (i >= NR_IRQS)
+		if (i >= NR_XIRQS)
 			break;
 		if (vector != SYSCALL_VECTOR) 
 			set_intr_gate(vector, interrupt[i]);
arch/i386/kernel/io_apic.c +162 -56

492 lines not on this page · raw message

arch/i386/kernel/ipipe-core.c new file +306 -0

306 lines not on this page · raw message

arch/i386/kernel/ipipe-mcount.S new file +45 -0

45 lines not on this page · raw message

arch/i386/kernel/ipipe-root.c new file +648 -0

648 lines not on this page · raw message

arch/i386/kernel/nmi.c +10 -4
Index: linux-2.6.16.33/arch/i386/kernel/nmi.c
===================================================================
@@ -38,6 +38,7 @@ static unsigned int nmi_hz = HZ;
 static unsigned int nmi_perfctr_msr;	/* the MSR to reset in NMI handler */
 static unsigned int nmi_p4_cccr_val;
 extern void show_registers(struct pt_regs *regs);
+static void default_nmi_watchdog_tick (struct pt_regs * regs);
 
 /*
  * lapic_nmi_owner tracks the ownership of the lapic NMI hardware:
@@ -184,6 +185,7 @@ static int __init setup_nmi_watchdog(cha
 
 	if (nmi >= NMI_INVALID)
 		return 0;
+        nmi_watchdog_tick = default_nmi_watchdog_tick;
 	if (nmi == NMI_NONE)
 		nmi_watchdog = nmi;
 	/*
@@ -519,9 +521,7 @@ void touch_nmi_watchdog (void)
 	touch_softlockup_watchdog();
 }
 
-extern void die_nmi(struct pt_regs *, const char *msg);
-
-void nmi_watchdog_tick (struct pt_regs * regs)
+static void default_nmi_watchdog_tick (struct pt_regs * regs)
 {
 
 	/*
@@ -529,7 +529,12 @@ void nmi_watchdog_tick (struct pt_regs *
 	 * always switch the stack NMI-atomically, it's safe to use
 	 * smp_processor_id().
 	 */
-	int sum, cpu = smp_processor_id();
+	int sum;
+#ifdef CONFIG_IPIPE
+	int cpu = ipipe_processor_id();
+#else /* !CONFIG_IPIPE */
+	int cpu = smp_processor_id();
+#endif /* !CONFIG_IPIPE */
 
 	sum = per_cpu(irq_stat, cpu).apic_timer_irqs;
 
@@ -619,3 +624,4 @@ EXPORT_SYMBOL(reserve_lapic_nmi);
 EXPORT_SYMBOL(release_lapic_nmi);
 EXPORT_SYMBOL(disable_timer_nmi_watchdog);
 EXPORT_SYMBOL(enable_timer_nmi_watchdog);
+EXPORT_SYMBOL(touch_nmi_watchdog);
arch/i386/kernel/process.c +1 -0
Index: linux-2.6.16.33/arch/i386/kernel/process.c
===================================================================
@@ -195,6 +195,7 @@ void cpu_idle(void)
 				play_dead();
 
 			__get_cpu_var(irq_stat).idle_timestamp = jiffies;
+ 			ipipe_suspend_domain();
 			idle();
 		}
 		preempt_enable_no_resched();
arch/i386/kernel/smp.c +23 -5
Index: linux-2.6.16.33/arch/i386/kernel/smp.c
===================================================================
@@ -132,6 +132,9 @@ void __send_IPI_shortcut(unsigned int sh
 	 * to the APIC.
 	 */
 	unsigned int cfg;
+	unsigned long flags;
+
+	local_irq_save_hw_cond(flags);
 
 	/*
 	 * Wait for idle.
@@ -147,6 +150,8 @@ void __send_IPI_shortcut(unsigned int sh
 	 * Send the IPI. The write to APIC_ICR fires this off.
 	 */
 	apic_write_around(APIC_ICR, cfg);
+
+	local_irq_restore_hw_cond(flags);
 }
 
 void fastcall send_IPI_self(int vector)
@@ -163,7 +168,7 @@ void send_IPI_mask_bitmask(cpumask_t cpu
 	unsigned long cfg;
 	unsigned long flags;
 
-	local_irq_save(flags);
+	local_irq_save_hw(flags);
 	WARN_ON(mask & ~cpus_addr(cpu_online_map)[0]);
 	/*
 	 * Wait for idle.
@@ -186,7 +191,7 @@ void send_IPI_mask_bitmask(cpumask_t cpu
 	 */
 	apic_write_around(APIC_ICR, cfg);
 
-	local_irq_restore(flags);
+	local_irq_restore_hw(flags);
 }
 
 void send_IPI_mask_sequence(cpumask_t mask, int vector)
@@ -200,7 +205,7 @@ void send_IPI_mask_sequence(cpumask_t ma
 	 * should be modified to do 1 message per cluster ID - mbligh
 	 */ 
 
-	local_irq_save(flags);
+	local_irq_save_hw(flags);
 
 	for (query_cpu = 0; query_cpu < NR_CPUS; ++query_cpu) {
 		if (cpu_isset(query_cpu, mask)) {
@@ -227,7 +232,7 @@ void send_IPI_mask_sequence(cpumask_t ma
 			apic_write_around(APIC_ICR, cfg);
 		}
 	}
-	local_irq_restore(flags);
+	local_irq_restore_hw(flags);
 }
 
 #include <mach_ipi.h> /* must come after the send_IPI functions above for inlining */
@@ -311,7 +316,9 @@ static inline void leave_mm (unsigned lo
 
 fastcall void smp_invalidate_interrupt(struct pt_regs *regs)
 {
-	unsigned long cpu;
+    	unsigned long cpu, flags;
+
+	local_irq_save_hw_cond(flags);
 
 	cpu = get_cpu();
 
@@ -341,6 +348,7 @@ fastcall void smp_invalidate_interrupt(s
 	smp_mb__after_clear_bit();
 out:
 	put_cpu_no_resched();
+	local_irq_restore_hw_cond(flags);
 }
 
 static void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm,
@@ -401,14 +409,19 @@ void flush_tlb_current_task(void)
 {
 	struct mm_struct *mm = current->mm;
 	cpumask_t cpu_mask;
+	unsigned long flags;
 
 	preempt_disable();
+	local_irq_save_hw_cond(flags);
+
 	cpu_mask = mm->cpu_vm_mask;
 	cpu_clear(smp_processor_id(), cpu_mask);
 
 	local_flush_tlb();
 	if (!cpus_empty(cpu_mask))
 		flush_tlb_others(cpu_mask, mm, FLUSH_ALL);
+
+	local_irq_restore_hw_cond(flags);
 	preempt_enable();
 }
 
@@ -436,8 +449,11 @@ void flush_tlb_page(struct vm_area_struc
 {
 	struct mm_struct *mm = vma->vm_mm;
 	cpumask_t cpu_mask;
+	unsigned long flags;
 
 	preempt_disable();
+	local_irq_save_hw_cond(flags);
+
 	cpu_mask = mm->cpu_vm_mask;
 	cpu_clear(smp_processor_id(), cpu_mask);
 
@@ -448,6 +464,8 @@ void flush_tlb_page(struct vm_area_struc
 		 	leave_mm(smp_processor_id());
 	}
 
+	local_irq_restore_hw_cond(flags);
+
 	if (!cpus_empty(cpu_mask))
 		flush_tlb_others(cpu_mask, mm, va);
 
arch/i386/kernel/smpboot.c +2 -0
Index: linux-2.6.16.33/arch/i386/kernel/smpboot.c
===================================================================
@@ -899,6 +899,7 @@ static int __devinit do_boot_cpu(int api
 	unsigned short nmi_high = 0, nmi_low = 0;
 
 	++cpucount;
+	ipipe_note_apicid(apicid, cpu);
 
 	/*
 	 * We can't use kernel_thread since we must avoid to
@@ -1125,6 +1126,7 @@ static void __init smp_boot_cpus(unsigne
 	boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID));
 	boot_cpu_logical_apicid = logical_smp_processor_id();
 	x86_cpu_to_apicid[0] = boot_cpu_physical_apicid;
+	ipipe_note_apicid(boot_cpu_physical_apicid,0);
 
 	current_thread_info()->cpu = 0;
 	smp_tune_scheduling();
arch/i386/kernel/time.c +3 -2
Index: linux-2.6.16.33/arch/i386/kernel/time.c
===================================================================
@@ -255,11 +255,12 @@ static inline void do_timer_interrupt(in
 		 * This will also deassert NMI lines for the watchdog if run
 		 * on an 82489DX-based system.
 		 */
-		spin_lock(&i8259A_lock);
+		unsigned long flags;
+		spin_lock_irqsave_hw_cond(&i8259A_lock,flags);
 		outb(0x0c, PIC_MASTER_OCW3);
 		/* Ack the IRQ; AEOI will end it automatically. */
 		inb(PIC_MASTER_POLL);
-		spin_unlock(&i8259A_lock);
+		spin_unlock_irqrestore_hw_cond(&i8259A_lock,flags);
 	}
 #endif
 
arch/i386/kernel/timers/timer_pit.c +4 -0
Index: linux-2.6.16.33/arch/i386/kernel/timers/timer_pit.c
===================================================================
@@ -99,6 +99,10 @@ static unsigned long get_offset_pit(void
 	 */
 	unsigned long jiffies_t;
 
+#ifdef CONFIG_IPIPE
+	if (!__ipipe_pipeline_head_p(ipipe_root_domain))
+		return 0;	/* We don't really own the PIT. */
+#endif /* CONFIG_IPIPE */
 	spin_lock_irqsave(&i8253_lock, flags);
 	/* timer count may underflow right here */
 	outb_p(0x00, PIT_MODE);	/* latch the count ASAP */
arch/i386/kernel/timers/timer_tsc.c +14 -0
Index: linux-2.6.16.33/arch/i386/kernel/timers/timer_tsc.c
===================================================================
@@ -389,6 +389,20 @@ static void mark_offset_tsc(void)
 
 	rdtsc(last_tsc_low, last_tsc_high);
 
+#ifdef CONFIG_IPIPE
+	if (!__ipipe_pipeline_head_p(ipipe_root_domain)) {
+		/* If Linux does not actually own the timer, clock
+		   ticks will be posted by some higher level domain to
+		   us, and we expect it to do this right and never
+		   lose any of them; so we just need to update the
+		   monotonic base here. */
+		this_offset = ((unsigned long long)last_tsc_high<<32)|last_tsc_low;
+		monotonic_base += cycles_2_ns(this_offset - last_offset);
+		write_sequnlock(&monotonic_lock);
+		return;
+	}
+#endif /* CONFIG_IPIPE */
+
 	spin_lock(&i8253_lock);
 	outb_p(0x00, PIT_MODE);     /* latch the count ASAP */
 
arch/i386/kernel/traps.c +20 -0
Index: linux-2.6.16.33/arch/i386/kernel/traps.c
===================================================================
@@ -95,6 +95,9 @@ static int kstack_depth_to_print = 24;
 struct notifier_block *i386die_chain;
 static DEFINE_SPINLOCK(die_notifier_lock);
 
+void (*nmi_watchdog_tick) (struct pt_regs * regs);
+EXPORT_SYMBOL(nmi_watchdog_tick);
+
 int register_die_notifier(struct notifier_block *nb)
 {
 	int err = 0;
@@ -252,6 +255,11 @@ void show_registers(struct pt_regs *regs
 		regs->esi, regs->edi, regs->ebp, esp);
 	printk(KERN_EMERG "ds: %04x   es: %04x   ss: %04x\n",
 		regs->xds & 0xffff, regs->xes & 0xffff, ss);
+#ifdef CONFIG_IPIPE
+	if (ipipe_current_domain != ipipe_root_domain)
+		printk("I-pipe domain %s",ipipe_current_domain->name);
+	else
+#endif /* CONFIG_IPIPE */
 	printk(KERN_EMERG "Process %s (pid: %d, threadinfo=%p task=%p)",
 		current->comm, current->pid, current_thread_info(), current);
 	/*
@@ -630,13 +638,18 @@ void die_nmi (struct pt_regs *regs, cons
 
 	do_exit(SIGSEGV);
 }
+EXPORT_SYMBOL(die_nmi);
 
 static void default_do_nmi(struct pt_regs * regs)
 {
 	unsigned char reason = 0;
 
 	/* Only the BSP gets external NMIs from the system.  */
+#ifdef CONFIG_IPIPE
+	if (!ipipe_processor_id())
+#else /* !CONFIG_IPIPE */
 	if (!smp_processor_id())
+#endif /* !CONFIG_IPIPE */
 		reason = get_nmi_reason();
  
 	if (!(reason & 0xc0)) {
@@ -682,7 +695,11 @@ fastcall void do_nmi(struct pt_regs * re
 
 	nmi_enter();
 
+#ifdef CONFIG_IPIPE
+	cpu = ipipe_processor_id();
+#else /* !CONFIG_IPIPE */
 	cpu = smp_processor_id();
+#endif /* !CONFIG_IPIPE */
 
 	++nmi_count(cpu);
 
@@ -1009,12 +1026,15 @@ asmlinkage void math_state_restore(struc
 {
 	struct thread_info *thread = current_thread_info();
 	struct task_struct *tsk = thread->task;
+	unsigned long flags;
 
+	local_irq_save_hw_cond(flags);
 	clts();		/* Allow maths ops (or we recurse) */
 	if (!tsk_used_math(tsk))
 		init_fpu(tsk);
 	restore_fpu(tsk);
 	thread->status |= TS_USEDFPU;	/* So we fnsave on switch_to() */
+	local_irq_restore_hw_cond(flags);
 }
 
 #ifndef CONFIG_MATH_EMULATION
arch/i386/lib/mmx.c +1 -1
Index: linux-2.6.16.33/arch/i386/lib/mmx.c
===================================================================
@@ -32,7 +32,7 @@ void *_mmx_memcpy(void *to, const void *
 	void *p;
 	int i;
 
-	if (unlikely(in_interrupt()))
+	if (unlikely(!ipipe_root_domain_p || in_interrupt()))
 		return __memcpy(to, from, len);
 
 	p = to;
arch/i386/mach-visws/visws_apic.c +3 -3
Index: linux-2.6.16.33/arch/i386/mach-visws/visws_apic.c
===================================================================
@@ -198,7 +198,7 @@ static irqreturn_t piix4_master_intr(int
 	irq_desc_t *desc;
 	unsigned long flags;
 
-	spin_lock_irqsave(&i8259A_lock, flags);
+	spin_lock_irqsave_hw(&i8259A_lock, flags);
 
 	/* Find out what's interrupting in the PIIX4 master 8259 */
 	outb(0x0c, 0x20);		/* OCW3 Poll command */
@@ -235,7 +235,7 @@ static irqreturn_t piix4_master_intr(int
 		outb(0x60 + realirq, 0x20);
 	}
 
-	spin_unlock_irqrestore(&i8259A_lock, flags);
+	spin_unlock_irqrestore_hw(&i8259A_lock, flags);
 
 	desc = irq_desc + realirq;
 
@@ -253,7 +253,7 @@ static irqreturn_t piix4_master_intr(int
 	return IRQ_HANDLED;
 
 out_unlock:
-	spin_unlock_irqrestore(&i8259A_lock, flags);
+	spin_unlock_irqrestore_hw(&i8259A_lock, flags);
 	return IRQ_NONE;
 }
 
arch/i386/mm/fault.c +2 -0
Index: linux-2.6.16.33/arch/i386/mm/fault.c
===================================================================
@@ -237,6 +237,8 @@ fastcall void __kprobes do_page_fault(st
 	/* get the address */
         address = read_cr2();
 
+	local_irq_enable_hw_cond();
+
 	if (notify_die(DIE_PAGE_FAULT, "page fault", regs, error_code, 14,
 					SIGSEGV) == NOTIFY_STOP)
 		return;
arch/i386/mm/ioremap.c +2 -0
Index: linux-2.6.16.33/arch/i386/mm/ioremap.c
===================================================================
@@ -17,6 +17,7 @@
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
 #include <asm/pgtable.h>
+#include <asm/pgalloc.h>
 
 #define ISA_START_ADDRESS	0xa0000
 #define ISA_END_ADDRESS		0x100000
@@ -92,6 +93,7 @@ static int ioremap_page_range(unsigned l
 		err = ioremap_pud_range(pgd, addr, next, phys_addr+addr, flags);
 		if (err)
 			break;
+		set_pgdir(addr, *pgd);
 	} while (pgd++, addr = next, addr != end);
 	flush_tlb_all();
 	return err;
drivers/pci/msi.c +18 -3
Index: linux-2.6.16.33/drivers/pci/msi.c
===================================================================
@@ -151,6 +151,21 @@ static void unmask_MSI_irq(unsigned int 
 	msi_set_mask_bit(vector, 0);
 }
 
+#ifdef CONFIG_IPIPE
+static void ack_MSI_irq_w_maskbit(unsigned int vector)
+{
+    mask_MSI_irq(vector);
+    __ack_APIC_irq();
+}
+static void ack_MSI_irq_wo_maskbit(unsigned int vector)
+{
+    __ack_APIC_irq();
+}
+#else /* !CONFIG_IPIPE */
+#define ack_MSI_irq_wo_maskbit  do_nothing
+#define ack_MSI_irq_w_maskbit   mask_MSI_irq
+#endif /* CONFIG_IPIPE */
+
 static unsigned int startup_msi_irq_wo_maskbit(unsigned int vector)
 {
 	struct msi_desc *entry;
@@ -214,7 +229,7 @@ static struct hw_interrupt_type msix_irq
 	.shutdown	= shutdown_msi_irq,
 	.enable		= unmask_MSI_irq,
 	.disable	= mask_MSI_irq,
-	.ack		= mask_MSI_irq,
+	.ack		= ack_MSI_irq_w_maskbit,
 	.end		= end_msi_irq_w_maskbit,
 	.set_affinity	= set_msi_affinity
 };
@@ -230,7 +245,7 @@ static struct hw_interrupt_type msi_irq_
 	.shutdown	= shutdown_msi_irq,
 	.enable		= unmask_MSI_irq,
 	.disable	= mask_MSI_irq,
-	.ack		= mask_MSI_irq,
+	.ack		= ack_MSI_irq_w_maskbit,
 	.end		= end_msi_irq_w_maskbit,
 	.set_affinity	= set_msi_affinity
 };
@@ -246,7 +261,7 @@ static struct hw_interrupt_type msi_irq_
 	.shutdown	= shutdown_msi_irq,
 	.enable		= do_nothing,
 	.disable	= do_nothing,
-	.ack		= do_nothing,
+	.ack		= ack_MSI_irq_wo_maskbit,
 	.end		= end_msi_irq_wo_maskbit,
 	.set_affinity	= set_msi_affinity
 };
include/asm-i386/apic.h +7 -1
Index: linux-2.6.16.33/include/asm-i386/apic.h
===================================================================
@@ -82,7 +82,13 @@ int get_physical_broadcast(void);
 # define apic_write_around(x,y) apic_write_atomic((x),(y))
 #endif
 
+#ifdef CONFIG_IPIPE
+#define ack_APIC_irq() do { } while(0)
+static inline void __ack_APIC_irq(void)
+#else /* !CONFIG_IPIPE */
+#define __ack_APIC_irq() ack_APIC_irq()
 static inline void ack_APIC_irq(void)
+#endif /* CONFIG_IPIPE */
 {
 	/*
 	 * ack_APIC_irq() actually gets compiled as a single instruction:
@@ -117,7 +123,7 @@ extern int reserve_lapic_nmi(void);
 extern void release_lapic_nmi(void);
 extern void disable_timer_nmi_watchdog(void);
 extern void enable_timer_nmi_watchdog(void);
-extern void nmi_watchdog_tick (struct pt_regs * regs);
+extern void (*nmi_watchdog_tick) (struct pt_regs * regs);
 extern int APIC_init_uniprocessor (void);
 extern void disable_APIC_timer(void);
 extern void enable_APIC_timer(void);
include/asm-i386/io_apic.h +8 -0
Index: linux-2.6.16.33/include/asm-i386/io_apic.h
===================================================================
@@ -16,7 +16,9 @@
 #ifdef CONFIG_PCI_MSI
 static inline int use_pci_vector(void)	{return 1;}
 static inline void disable_edge_ioapic_vector(unsigned int vector) { }
+#ifndef CONFIG_IPIPE
 static inline void mask_and_ack_level_ioapic_vector(unsigned int vector) { }
+#endif /* CONFIG_IPIPE */
 static inline void end_edge_ioapic_vector (unsigned int vector) { }
 #define startup_level_ioapic	startup_level_ioapic_vector
 #define shutdown_level_ioapic	mask_IO_APIC_vector
@@ -35,8 +37,14 @@ static inline void end_edge_ioapic_vecto
 #else
 static inline int use_pci_vector(void)	{return 0;}
 static inline void disable_edge_ioapic_irq(unsigned int irq) { }
+#ifdef CONFIG_IPIPE
+#ifndef CONFIG_IRQBALANCE
+static inline void end_edge_ioapic_irq (unsigned int irq) { }
+#endif /* !CONFIG_IRQBALANCE */
+#else /* CONFIG_IPIPE */
 static inline void mask_and_ack_level_ioapic_irq(unsigned int irq) { }
 static inline void end_edge_ioapic_irq (unsigned int irq) { }
+#endif /* CONFIG_IPIPE */
 #define startup_level_ioapic	startup_level_ioapic_irq
 #define shutdown_level_ioapic	mask_IO_APIC_irq
 #define enable_level_ioapic	unmask_IO_APIC_irq
include/asm-i386/ipipe.h new file +287 -0

287 lines not on this page · raw message

include/asm-i386/mach-default/do_timer.h +3 -2
Index: linux-2.6.16.33/include/asm-i386/mach-default/do_timer.h
===================================================================
@@ -50,14 +50,15 @@ static inline void do_timer_interrupt_ho
 static inline int do_timer_overflow(int count)
 {
 	int i;
+	unsigned long flags;
 
-	spin_lock(&i8259A_lock);
+	spin_lock_irqsave_hw(&i8259A_lock, flags);
 	/*
 	 * This is tricky when I/O APICs are used;
 	 * see do_timer_interrupt().
 	 */
 	i = inb(0x20);
-	spin_unlock(&i8259A_lock);
+	spin_unlock_irqrestore_hw(&i8259A_lock, flags);
 	
 	/* assumption about timer being IRQ0 */
 	if (i & 0x01) {
include/asm-i386/mach-visws/do_timer.h +3 -2
Index: linux-2.6.16.33/include/asm-i386/mach-visws/do_timer.h
===================================================================
@@ -29,14 +29,15 @@ static inline void do_timer_interrupt_ho
 static inline int do_timer_overflow(int count)
 {
 	int i;
+	unsigned long flags;
 
-	spin_lock(&i8259A_lock);
+	spin_lock_irqsave_hw(&i8259A_lock, flags);
 	/*
 	 * This is tricky when I/O APICs are used;
 	 * see do_timer_interrupt().
 	 */
 	i = inb(0x20);
-	spin_unlock(&i8259A_lock);
+	spin_unlock_irqrestore_hw(&i8259A_lock, flags);
 	
 	/* assumption about timer being IRQ0 */
 	if (i & 0x01) {
include/asm-i386/mmu_context.h +8 -3
Index: linux-2.6.16.33/include/asm-i386/mmu_context.h
===================================================================
@@ -17,7 +17,7 @@ void destroy_context(struct mm_struct *m
 static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
 {
 #ifdef CONFIG_SMP
-	unsigned cpu = smp_processor_id();
+	unsigned cpu = smp_processor_id_hw();
 	if (per_cpu(cpu_tlbstate, cpu).state == TLBSTATE_OK)
 		per_cpu(cpu_tlbstate, cpu).state = TLBSTATE_LAZY;
 #endif
@@ -27,7 +27,7 @@ static inline void switch_mm(struct mm_s
 			     struct mm_struct *next,
 			     struct task_struct *tsk)
 {
-	int cpu = smp_processor_id();
+	int cpu = smp_processor_id_hw();
 
 	if (likely(prev != next)) {
 		/* stop flush ipis for the previous mm */
@@ -67,6 +67,11 @@ static inline void switch_mm(struct mm_s
 	asm("movl %0,%%fs ; movl %0,%%gs": :"r" (0))
 
 #define activate_mm(prev, next) \
-	switch_mm((prev),(next),NULL)
+do { \
+	unsigned long flags; \
+	local_irq_save_hw_cond(flags); \
+	switch_mm((prev),(next),NULL);		   \
+	local_irq_restore_hw_cond(flags);	   \
+} while(0)
 
 #endif
include/asm-i386/nmi.h +2 -0
Index: linux-2.6.16.33/include/asm-i386/nmi.h
===================================================================
@@ -25,4 +25,6 @@ void set_nmi_callback(nmi_callback_t cal
  */
 void unset_nmi_callback(void);
  
+void die_nmi(struct pt_regs *, const char *msg);
+
 #endif /* ASM_NMI_H */
include/asm-i386/pgalloc.h +23 -0
Index: linux-2.6.16.33/include/asm-i386/pgalloc.h
===================================================================
@@ -47,4 +47,27 @@ static inline void pte_free(struct page 
 
 #define check_pgt_cache()	do { } while (0)
 
+static inline void set_pgdir(unsigned long address, pgd_t entry)
+{
+#ifdef CONFIG_IPIPE
+	struct task_struct * p;
+	struct page *page;
+	pgd_t *pgd;
+
+	read_lock(&tasklist_lock);
+
+	for_each_process(p) {
+		if(p->mm)
+		    *pgd_offset(p->mm,address) = entry;
+	}
+
+	read_unlock(&tasklist_lock);
+
+	for (page = pgd_list; page; page = (struct page *)page->index) {
+		pgd = (pgd_t *)page_address(page);
+		pgd[address >> PGDIR_SHIFT] = entry;
+	}
+#endif /* CONFIG_IPIPE */
+}
+
 #endif /* _I386_PGALLOC_H */
include/asm-i386/spinlock.h +4 -0
Index: linux-2.6.16.33/include/asm-i386/spinlock.h
===================================================================
@@ -32,6 +32,9 @@
 	"jmp 1b\n" \
 	"3:\n\t"
 
+#ifdef CONFIG_IPIPE
+#define __raw_spin_lock_string_flags __raw_spin_lock_string
+#else /* !CONFIG_IPIPE */
 #define __raw_spin_lock_string_flags \
 	"\n1:\t" \
 	"lock ; decb %0\n\t" \
@@ -47,6 +50,7 @@
 	"cli\n\t" \
 	"jmp 1b\n" \
 	"4:\n\t"
+#endif /* CONFIG_IPIPE */
 
 static inline void __raw_spin_lock(raw_spinlock_t *lock)
 {
include/asm-i386/system.h +110 -0

122 lines not on this page · raw message

include/linux/hardirq.h +13 -0
Index: linux-2.6.16.33/include/linux/hardirq.h
===================================================================
@@ -87,8 +87,21 @@ extern void synchronize_irq(unsigned int
 # define synchronize_irq(irq)	barrier()
 #endif
 
+#ifdef CONFIG_IPIPE
+#define nmi_enter() \
+do { \
+    if (ipipe_current_domain == ipipe_root_domain) \
+	irq_enter(); \
+} while(0)
+#define nmi_exit() \
+do { \
+    if (ipipe_current_domain == ipipe_root_domain) \
+	sub_preempt_count(HARDIRQ_OFFSET); \
+} while(0)
+#else /* !CONFIG_IPIPE */
 #define nmi_enter()		irq_enter()
 #define nmi_exit()		sub_preempt_count(HARDIRQ_OFFSET)
+#endif /* CONFIG_IPIPE */
 
[… more lines in the raw message]

Lines of this file are not shown. View the raw message.

include/linux/ipipe.h new file +770 -0

770 lines not on this page · raw message

include/linux/ipipe_trace.h new file +40 -0
Index: linux-2.6.16.33/include/linux/ipipe_trace.h
===================================================================

Lines of this file are not shown. View the raw message.

include/linux/linkage.h +4 -0
Index: linux-2.6.16.33/include/linux/linkage.h
===================================================================

Lines of this file are not shown. View the raw message.

include/linux/preempt.h +31 -16

47 lines not on this page · raw message

include/linux/sched.h +16 -0
Index: linux-2.6.16.33/include/linux/sched.h
===================================================================

Lines of this file are not shown. View the raw message.

init/Kconfig +1 -0
Index: linux-2.6.16.33/init/Kconfig
===================================================================

Lines of this file are not shown. View the raw message.

init/main.c +6 -0
Index: linux-2.6.16.33/init/main.c
===================================================================

Lines of this file are not shown. View the raw message.

kernel/Makefile +1 -0
Index: linux-2.6.16.33/kernel/Makefile
===================================================================

Lines of this file are not shown. View the raw message.

kernel/exit.c +1 -0
Index: linux-2.6.16.33/kernel/exit.c
===================================================================

Lines of this file are not shown. View the raw message.

kernel/fork.c +10 -1
Index: linux-2.6.16.33/kernel/fork.c
===================================================================

Lines of this file are not shown. View the raw message.

kernel/ipipe/Kconfig new file +6 -0
Index: linux-2.6.16.33/kernel/ipipe/Kconfig
===================================================================

Lines of this file are not shown. View the raw message.

kernel/ipipe/Kconfig.debug new file +69 -0

69 lines not on this page · raw message

kernel/ipipe/Makefile new file +3 -0
Index: linux-2.6.16.33/kernel/ipipe/Makefile
===================================================================

Lines of this file are not shown. View the raw message.

kernel/ipipe/core.c new file +1051 -0

1,051 lines not on this page · raw message

kernel/ipipe/generic.c new file +424 -0

424 lines not on this page · raw message

kernel/ipipe/tracer.c new file +1243 -0

1,243 lines not on this page · raw message

kernel/irq/handle.c +15 -0
Index: linux-2.6.16.33/kernel/irq/handle.c
===================================================================

Lines of this file are not shown. View the raw message.

kernel/printk.c +73 -0

73 lines not on this page · raw message

kernel/sched.c +69 -3

72 lines not on this page · raw message

kernel/signal.c +1 -0
Index: linux-2.6.16.33/kernel/signal.c
===================================================================

Lines of this file are not shown. View the raw message.

lib/Kconfig.debug +2 -0
Index: linux-2.6.16.33/lib/Kconfig.debug
===================================================================

Lines of this file are not shown. View the raw message.

lib/smp_processor_id.c +5 -0
Index: linux-2.6.16.33/lib/smp_processor_id.c
===================================================================

Lines of this file are not shown. View the raw message.

lib/spinlock_debug.c +19 -0
Index: linux-2.6.16.33/lib/spinlock_debug.c
===================================================================

Lines of this file are not shown. View the raw message.

mm/vmalloc.c +5 -0
Index: linux-2.6.16.33/mm/vmalloc.c
===================================================================

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.