Skip to contentSkip to conversation

adeos-ipipe-2.6.17-i386-1.3.05

PATCH In review Jan Kiszka 2 participants 2 messages Jun 18, 2006 – Jun 20, 2006

Subsystems (8)
lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 adeos-ipipe-2.6.17-i386-1.3.05

Hi,

this is a rebased i386 ipipe patch for the new 2.6.17 kernel.

Again it was just about applying some failing hunks manually (and checking if that was legal). I also included my last two kgdb-over-ipipe patches, but they are of limited use as long as no kgdb is publicly available for the new kernel.

All is working fine so far. This mail was, e.g., posted from a Xenomai box running the patch, switchtest, and latency.

Jan

Binary files 2.6.16/arch/ia64/hp/sim/boot/bootloader and 2.6.16-ipipe/arch/ia64/hp/sim/boot/bootloader differ

drivers/pci/msi.c +18 -3
Index: linux-2.6.17/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/linux/hardirq.h +13 -0
Index: linux-2.6.17/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 */
 
 struct task_struct;
 
include/linux/ipipe.h new file +726 -0

726 lines not on this page · raw message

include/linux/linkage.h +4 -0
Index: linux-2.6.17/include/linux/linkage.h
===================================================================
@@ -61,4 +61,8 @@
 #define fastcall
 #endif
 
+#ifndef notrace
+#define notrace		__attribute__((no_instrument_function))
+#endif
+
 #endif
include/linux/preempt.h +30 -16

59 lines not on this page · raw message

include/linux/sched.h +9 -0
Index: linux-2.6.17/include/linux/sched.h
===================================================================
@@ -4,6 +4,7 @@
 #include <asm/param.h>	/* for HZ */
 
 #include <linux/config.h>
+#include <linux/ipipe.h>
 #include <linux/capability.h>
 #include <linux/threads.h>
 #include <linux/kernel.h>
@@ -131,6 +132,11 @@ extern unsigned long nr_iowait(void);
 #define EXIT_DEAD		32
 /* in tsk->state again */
 #define TASK_NONINTERACTIVE	64
+#ifdef CONFIG_IPIPE
+#define TASK_ATOMICSWITCH	512
+#else  /* !CONFIG_IPIPE */
+#define TASK_ATOMICSWITCH	0
+#endif /* CONFIG_IPIPE */
 
 #define __set_task_state(tsk, state_value)		\
 	do { (tsk)->state = (state_value); } while (0)
@@ -883,6 +889,9 @@ struct task_struct {
 
 	atomic_t fs_excl;	/* holding fs exclusive resources */
 	struct rcu_head rcu;
+#ifdef CONFIG_IPIPE
+	void *ptd[IPIPE_ROOT_NPTDKEYS];
+#endif
 
 	/*
 	 * cache last used pipe for splice
init/Kconfig +1 -0
Index: linux-2.6.17/init/Kconfig
===================================================================
@@ -58,6 +58,7 @@ menu "General setup"
 
 config LOCALVERSION
 	string "Local version - append to kernel release"
+	default "-ipipe"
 	help
 	  Append an extra string to the end of your kernel version.
 	  This will show up when you type uname, for example.
init/main.c +6 -0
Index: linux-2.6.17/init/main.c
===================================================================
@@ -490,6 +490,11 @@ asmlinkage void __init start_kernel(void
 	hrtimers_init();
 	softirq_init();
 	time_init();
+	/*
+	 * We need to wait for the interrupt and time subsystems to be
+	 * initialized before enabling the pipeline.
+	 */
+ 	ipipe_init();
 
 	/*
 	 * HACK ALERT! This is early. We're enabling the console before
@@ -623,6 +628,7 @@ static void __init do_basic_setup(void)
 #ifdef CONFIG_SYSCTL
 	sysctl_init();
 #endif
+	ipipe_init_proc();
 
 	do_initcalls();
 }
kernel/Makefile +1 -0
Index: linux-2.6.17/kernel/Makefile
===================================================================
@@ -38,6 +38,7 @@ obj-$(CONFIG_GENERIC_HARDIRQS) += irq/
 obj-$(CONFIG_SECCOMP) += seccomp.o
 obj-$(CONFIG_RCU_TORTURE_TEST) += rcutorture.o
 obj-$(CONFIG_RELAY) += relay.o
+obj-$(CONFIG_IPIPE) += ipipe/
 
 ifneq ($(CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER),y)
 # According to Alan Modra <[email protected]>, the -fno-omit-frame-pointer is
kernel/exit.c +1 -0
Index: linux-2.6.17/kernel/exit.c
===================================================================
@@ -905,6 +905,7 @@ fastcall NORET_TYPE void do_exit(long co
 #endif
 	if (unlikely(tsk->audit_context))
 		audit_free(tsk);
+	ipipe_exit_notify(tsk);
 	exit_mm(tsk);
 
 	exit_sem(tsk);
kernel/fork.c +9 -0
Index: linux-2.6.17/kernel/fork.c
===================================================================
@@ -369,6 +369,7 @@ void fastcall __mmdrop(struct mm_struct 
 void mmput(struct mm_struct *mm)
 {
 	if (atomic_dec_and_test(&mm->mm_users)) {
+		ipipe_cleanup_notify(mm);
 		exit_aio(mm);
 		exit_mmap(mm);
 		if (!list_empty(&mm->mmlist)) {
@@ -1214,6 +1215,14 @@ static task_t *copy_process(unsigned lon
 	spin_unlock(&current->sighand->siglock);
 	write_unlock_irq(&tasklist_lock);
 	proc_fork_connector(p);
+#ifdef CONFIG_IPIPE
+	{
+	int k;
+
+	for (k = 0; k < IPIPE_ROOT_NPTDKEYS; k++)
+		p->ptd[k] = NULL;
+	}
+#endif /* CONFIG_IPIPE */
 	return p;
 
 bad_fork_cleanup_namespace:
kernel/ipipe/Kconfig new file +6 -0
Index: linux-2.6.17/kernel/ipipe/Kconfig
===================================================================
@@ -0,0 +1,6 @@
+config IPIPE
+	bool "Interrupt pipeline"
+	default y
+	---help---
+	  Activate this option if you want the interrupt pipeline to be
+	  compiled in.
kernel/ipipe/Makefile new file +3 -0
Index: linux-2.6.17/kernel/ipipe/Makefile
===================================================================
@@ -0,0 +1,3 @@
+
+obj-$(CONFIG_IPIPE)	+= core.o generic.o
+obj-$(CONFIG_IPIPE_TRACE) += tracer.o
kernel/ipipe/core.c new file +1044 -0

1,044 lines not on this page · raw message

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

396 lines not on this page · raw message

kernel/irq/handle.c +15 -0
Index: linux-2.6.17/kernel/irq/handle.c
===================================================================
@@ -81,6 +81,17 @@ fastcall int handle_IRQ_event(unsigned i
 {
 	int ret, retval = 0, status = 0;
 
+#ifdef CONFIG_IPIPE
+	/*
+	 * If processing a timer tick, pass the original regs as
+	 * collected during preemption and not our phony - always
+	 * kernel-originated - frame, so that we don't wreck the
+	 * profiling code.
+	 */
+	if (__ipipe_tick_irq == irq)
+		regs = __ipipe_tick_regs + smp_processor_id();
+#endif /* CONFIG_IPIPE */
+
 	if (!(action->flags & SA_INTERRUPT))
 		local_irq_enable();
 
@@ -117,16 +128,20 @@ fastcall unsigned int __do_IRQ(unsigned 
 		/*
 		 * No locking required for CPU-local interrupts:
 		 */
+#ifndef CONFIG_IPIPE
 		if (desc->handler->ack)
 			desc->handler->ack(irq);
+#endif /* !CONFIG_IPIPE */
 		action_ret = handle_IRQ_event(irq, regs, desc->action);
 		desc->handler->end(irq);
 		return 1;
 	}
 
 	spin_lock(&desc->lock);
+#ifndef CONFIG_IPIPE
 	if (desc->handler->ack)
 		desc->handler->ack(irq);
+#endif /* !CONFIG_IPIPE */
 	/*
 	 * REPLAY is when Linux resends an IRQ that was dropped earlier
 	 * WAITING is used by probe to mark irqs that are being tested
kernel/printk.c +73 -0

85 lines not on this page · raw message

kernel/sched.c +72 -1

113 lines not on this page · raw message

kernel/signal.c +1 -0
Index: linux-2.6.17/kernel/signal.c
===================================================================
@@ -500,6 +500,7 @@ void signal_wake_up(struct task_struct *
 	unsigned int mask;
 
 	set_tsk_thread_flag(t, TIF_SIGPENDING);
+	ipipe_sigwake_notify(t); /* TIF_SIGPENDING must be set first. */
 
 	/*
 	 * For SIGKILL, we want to wake it up in the stopped/traced case.
lib/smp_processor_id.c +5 -0
Index: linux-2.6.17/lib/smp_processor_id.c
===================================================================
@@ -13,6 +13,11 @@ unsigned int debug_smp_processor_id(void
 	int this_cpu = raw_smp_processor_id();
 	cpumask_t this_mask;
 
+#ifdef CONFIG_IPIPE
+ 	if (ipipe_current_domain != ipipe_root_domain)
+	    return this_cpu;
+#endif /* CONFIG_IPIPE */
+
 	if (likely(preempt_count))
 		goto out;
 
lib/spinlock_debug.c +19 -0
Index: linux-2.6.17/lib/spinlock_debug.c
===================================================================
@@ -10,6 +10,7 @@
 #include <linux/spinlock.h>
 #include <linux/interrupt.h>
 #include <linux/delay.h>
+#include <linux/module.h>
 
 static void spin_bug(spinlock_t *lock, const char *msg)
 {
@@ -96,6 +97,8 @@ void _raw_spin_lock(spinlock_t *lock)
 	debug_spin_lock_after(lock);
 }
 
+EXPORT_SYMBOL(_raw_spin_lock);
+
 int _raw_spin_trylock(spinlock_t *lock)
 {
 	int ret = __raw_spin_trylock(&lock->raw_lock);
@@ -111,12 +114,16 @@ int _raw_spin_trylock(spinlock_t *lock)
 	return ret;
 }
 
+EXPORT_SYMBOL(_raw_spin_trylock);
+
 void _raw_spin_unlock(spinlock_t *lock)
 {
 	debug_spin_unlock(lock);
 	__raw_spin_unlock(&lock->raw_lock);
 }
 
+EXPORT_SYMBOL(_raw_spin_unlock);
+
 static void rwlock_bug(rwlock_t *lock, const char *msg)
 {
 	static long print_once = 1;
@@ -167,6 +174,8 @@ void _raw_read_lock(rwlock_t *lock)
 		__read_lock_debug(lock);
 }
 
+EXPORT_SYMBOL(_raw_read_lock);
+
 int _raw_read_trylock(rwlock_t *lock)
 {
 	int ret = __raw_read_trylock(&lock->raw_lock);
@@ -180,12 +189,16 @@ int _raw_read_trylock(rwlock_t *lock)
 	return ret;
 }
 
+EXPORT_SYMBOL(_raw_read_trylock);
+
 void _raw_read_unlock(rwlock_t *lock)
 {
 	RWLOCK_BUG_ON(lock->magic != RWLOCK_MAGIC, lock, "bad magic");
 	__raw_read_unlock(&lock->raw_lock);
 }
 
+EXPORT_SYMBOL(_raw_read_unlock);
+
 static inline void debug_write_lock_before(rwlock_t *lock)
 {
 	RWLOCK_BUG_ON(lock->magic != RWLOCK_MAGIC, lock, "bad magic");
@@ -241,6 +254,8 @@ void _raw_write_lock(rwlock_t *lock)
 	debug_write_lock_after(lock);
 }
 
+EXPORT_SYMBOL(_raw_write_lock);
+
 int _raw_write_trylock(rwlock_t *lock)
 {
 	int ret = __raw_write_trylock(&lock->raw_lock);
@@ -256,8 +271,12 @@ int _raw_write_trylock(rwlock_t *lock)
 	return ret;
 }
 
+EXPORT_SYMBOL(_raw_write_trylock);
+
 void _raw_write_unlock(rwlock_t *lock)
 {
 	debug_write_unlock(lock);
 	__raw_write_unlock(&lock->raw_lock);
 }
+
+EXPORT_SYMBOL(_raw_write_unlock);
mm/vmalloc.c +5 -0
Index: linux-2.6.17/mm/vmalloc.c
===================================================================
@@ -19,6 +19,7 @@
 
 #include <asm/uaccess.h>
 #include <asm/tlbflush.h>
+#include <asm/pgalloc.h>
 
 
 DEFINE_RWLOCK(vmlist_lock);
@@ -148,10 +149,14 @@ int map_vm_area(struct vm_struct *area, 
 	BUG_ON(addr >= end);
 	pgd = pgd_offset_k(addr);
 	do {
+		pgd_t oldpgd;
+		memcpy(&oldpgd,pgd,sizeof(pgd_t));
 		next = pgd_addr_end(addr, end);
 		err = vmap_pud_range(pgd, addr, next, prot, pages);
 		if (err)
 			break;
+		if (pgd_val(oldpgd) != pgd_val(*pgd))
+			set_pgdir(addr, *pgd);
 	} while (pgd++, addr = next, addr != end);
 	flush_cache_vmap((unsigned long) area->addr, end);
 	return err;
arch/i386/Kconfig +2 -1
Index: linux-2.6.17/arch/i386/Kconfig
===================================================================
@@ -242,6 +242,8 @@ config SCHED_MC
 
 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)
@@ -765,7 +767,6 @@ config HOTPLUG_CPU
 
 endmenu
 
-
 menu "Power management options (ACPI, APM)"
 	depends on !X86_VOYAGER
 
arch/i386/kernel/Makefile +2 -0
Index: linux-2.6.17/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)	+= 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.17/arch/i386/kernel/apic.c
===================================================================
@@ -91,7 +91,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)
@@ -1203,6 +1203,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.
@@ -1276,7 +1279,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

208 lines not on this page · raw message

arch/i386/kernel/i8259.c +25 -13
Index: linux-2.6.17/arch/i386/kernel/i8259.c
===================================================================

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

arch/i386/kernel/io_apic.c +164 -55

219 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-root.c new file +642 -0

642 lines not on this page · raw message

arch/i386/kernel/nmi.c +8 -3
Index: linux-2.6.17/arch/i386/kernel/nmi.c
===================================================================

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

arch/i386/kernel/process.c +1 -0
Index: linux-2.6.17/arch/i386/kernel/process.c
===================================================================

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

arch/i386/kernel/smp.c +23 -6
Index: linux-2.6.17/arch/i386/kernel/smp.c
===================================================================

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

arch/i386/kernel/smpboot.c +2 -0
Index: linux-2.6.17/arch/i386/kernel/smpboot.c
===================================================================

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

arch/i386/kernel/time.c +3 -2
Index: linux-2.6.17/arch/i386/kernel/time.c
===================================================================

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

arch/i386/kernel/timers/timer_pit.c +4 -0
Index: linux-2.6.17/arch/i386/kernel/timers/timer_pit.c
===================================================================

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

arch/i386/kernel/timers/timer_tsc.c +14 -0
Index: linux-2.6.17/arch/i386/kernel/timers/timer_tsc.c
===================================================================

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

arch/i386/kernel/traps.c +20 -0
Index: linux-2.6.17/arch/i386/kernel/traps.c
===================================================================

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

arch/i386/mach-visws/visws_apic.c +3 -3
Index: linux-2.6.17/arch/i386/mach-visws/visws_apic.c
===================================================================

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

arch/i386/mm/fault.c +2 -0
Index: linux-2.6.17/arch/i386/mm/fault.c
===================================================================

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

arch/i386/mm/ioremap.c +2 -0
Index: linux-2.6.17/arch/i386/mm/ioremap.c
===================================================================

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

include/asm-i386/apic.h +7 -1
Index: linux-2.6.17/include/asm-i386/apic.h
===================================================================

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

include/asm-i386/io_apic.h +12 -0
Index: linux-2.6.17/include/asm-i386/io_apic.h
===================================================================

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

include/asm-i386/ipipe.h new file +281 -0

281 lines not on this page · raw message

include/asm-i386/mach-default/do_timer.h +3 -2
Index: linux-2.6.17/include/asm-i386/mach-default/do_timer.h
===================================================================

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

include/asm-i386/mach-visws/do_timer.h +3 -2
Index: linux-2.6.17/include/asm-i386/mach-visws/do_timer.h
===================================================================

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

include/asm-i386/mmu_context.h +8 -3
Index: linux-2.6.17/include/asm-i386/mmu_context.h
===================================================================

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

include/asm-i386/nmi.h +2 -0
Index: linux-2.6.17/include/asm-i386/nmi.h
===================================================================

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

include/asm-i386/pgalloc.h +23 -0
Index: linux-2.6.17/include/asm-i386/pgalloc.h
===================================================================

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

include/asm-i386/spinlock.h +4 -0
Index: linux-2.6.17/include/asm-i386/spinlock.h
===================================================================

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

include/asm-i386/system.h +110 -0

110 lines not on this page · 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.

#1 lore raw
Quoted 11 lines · Jan Kiszka

Hi,

this is a rebased i386 ipipe patch for the new 2.6.17 kernel.

Again it was just about applying some failing hunks manually (and checking if that was legal). I also included my last two kgdb-over-ipipe patches, but they are of limited use as long as no kgdb is publicly available for the new kernel.

All is working fine so far. This mail was, e.g., posted from a Xenomai box running the patch, switchtest, and latency.

Tested here UP+SMP and committed. This will be part of the upcoming -rc3. Thanks.

Signature · 1 line
Philippe.