Module: xenomai-head
Branch: master
Commit: 21977d732fc86c7fa7c90c96bbabd26fe022887a
URL:    
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=21977d732fc86c7fa7c90c96bbabd26fe022887a

Author: Philippe Gerum <r...@xenomai.org>
Date:   Sun Dec 20 16:59:28 2009 +0100

x86: upgrade I-pipe support to 2.6.30.8-x86-2.4-09

---

 ...patch => adeos-ipipe-2.6.30.8-x86-2.4-09.patch} |  256 +++++++++++++-------
 1 files changed, 170 insertions(+), 86 deletions(-)

diff --git a/ksrc/arch/x86/patches/adeos-ipipe-2.6.30.8-x86-2.4-06.patch 
b/ksrc/arch/x86/patches/adeos-ipipe-2.6.30.8-x86-2.4-09.patch
similarity index 98%
rename from ksrc/arch/x86/patches/adeos-ipipe-2.6.30.8-x86-2.4-06.patch
rename to ksrc/arch/x86/patches/adeos-ipipe-2.6.30.8-x86-2.4-09.patch
index b2ab1d8..44b8e0f 100644
--- a/ksrc/arch/x86/patches/adeos-ipipe-2.6.30.8-x86-2.4-06.patch
+++ b/ksrc/arch/x86/patches/adeos-ipipe-2.6.30.8-x86-2.4-09.patch
@@ -215,7 +215,7 @@ index 0b72282..6574056 100644
  /*
 diff --git a/arch/x86/include/asm/ipipe.h b/arch/x86/include/asm/ipipe.h
 new file mode 100644
-index 0000000..017417c
+index 0000000..3a531f5
 --- /dev/null
 +++ b/arch/x86/include/asm/ipipe.h
 @@ -0,0 +1,156 @@
@@ -246,7 +246,7 @@ index 0000000..017417c
 +#ifdef CONFIG_IPIPE
 +
 +#ifndef IPIPE_ARCH_STRING
-+#define IPIPE_ARCH_STRING     "2.4-06"
++#define IPIPE_ARCH_STRING     "2.4-09"
 +#define IPIPE_MAJOR_NUMBER    2
 +#define IPIPE_MINOR_NUMBER    4
 +#define IPIPE_PATCH_NUMBER    6
@@ -705,10 +705,10 @@ index 0000000..956c4de
 +#endif        /* !__X86_IPIPE_64_H */
 diff --git a/arch/x86/include/asm/ipipe_base.h 
b/arch/x86/include/asm/ipipe_base.h
 new file mode 100644
-index 0000000..05338e4
+index 0000000..e512c51
 --- /dev/null
 +++ b/arch/x86/include/asm/ipipe_base.h
-@@ -0,0 +1,97 @@
+@@ -0,0 +1,105 @@
 +/*   -*- linux-c -*-
 + *   arch/x86/include/asm/ipipe_base.h
 + *
@@ -762,7 +762,9 @@ index 0000000..05338e4
 +#define ex_do_simd_coprocessor_error          19
 +#define ex_do_iret_error                      32
 +
-+#if !defined(__ASSEMBLY__) && !defined(CONFIG_SMP)
++#ifndef __ASSEMBLY__
++
++#ifndef CONFIG_SMP
 +
 +#if __GNUC__ >= 4
 +/* Alias to ipipe_root_cpudom_var(status) */
@@ -803,7 +805,13 @@ index 0000000..05338e4
 +      return oldbit;
 +}
 +
-+#endif        /* !__ASSEMBLY__ && !CONFIG_SMP */
++#endif /* !CONFIG_SMP */
++
++void __ipipe_halt_root(void);
++
++void __ipipe_serial_debug(const char *fmt, ...);
++
++#endif        /* !__ASSEMBLY__ */
 +
 +#endif        /* !__X86_IPIPE_BASE_H */
 diff --git a/arch/x86/include/asm/ipipe_base_32.h 
b/arch/x86/include/asm/ipipe_base_32.h
@@ -1083,7 +1091,7 @@ index 3cbd79b..79a5ea1 100644
  /*
   * Local APIC timer IRQ vector is on a different priority level,
 diff --git a/arch/x86/include/asm/irqflags.h b/arch/x86/include/asm/irqflags.h
-index c6ccbe7..71ede94 100644
+index c6ccbe7..da1e655 100644
 --- a/arch/x86/include/asm/irqflags.h
 +++ b/arch/x86/include/asm/irqflags.h
 @@ -4,6 +4,10 @@
@@ -1108,7 +1116,7 @@ index c6ccbe7..71ede94 100644
        /*
         * Note: this needs to be "=r" not "=rm", because we have the
         * stack offset from what gcc expects at the time the "pop" is
-@@ -23,30 +31,50 @@ static inline unsigned long native_save_fl(void)
+@@ -23,31 +31,53 @@ static inline unsigned long native_save_fl(void)
                     : "=r" (flags)
                     : /* no input */
                     : "memory");
@@ -1153,13 +1161,16 @@ index c6ccbe7..71ede94 100644
  
  static inline void native_safe_halt(void)
  {
-+#ifdef CONFIG_IPIPE_TRACE_IRQSOFF
-+      ipipe_trace_end(0x8000000E);
-+#endif
++#ifdef CONFIG_IPIPE
++      barrier();
++      __ipipe_halt_root();
++#else
        asm volatile("sti; hlt": : :"memory");
++#endif
  }
  
-@@ -72,6 +100,71 @@ static inline void raw_local_irq_restore(unsigned long 
flags)
+ static inline void native_halt(void)
+@@ -72,6 +102,71 @@ static inline void raw_local_irq_restore(unsigned long 
flags)
        native_restore_fl(flags);
  }
  
@@ -1231,7 +1242,7 @@ index c6ccbe7..71ede94 100644
  static inline void raw_local_irq_disable(void)
  {
        native_irq_disable();
-@@ -105,16 +198,38 @@ static inline void halt(void)
+@@ -105,16 +200,40 @@ static inline void halt(void)
   */
  static inline unsigned long __raw_local_irq_save(void)
  {
@@ -1260,19 +1271,21 @@ index c6ccbe7..71ede94 100644
 +#define ENABLE_INTERRUPTS(clobbers)   sti
 +#endif /* CONFIG_X86_64 */
 +#define ENABLE_INTERRUPTS_HW_COND     sti
++#define DISABLE_INTERRUPTS_HW_COND    cli
 +#define DISABLE_INTERRUPTS_HW(clobbers)       cli
 +#define ENABLE_INTERRUPTS_HW(clobbers)        sti
 +#else /* !CONFIG_IPIPE */
 +#define ENABLE_INTERRUPTS(x)          sti
 +#define DISABLE_INTERRUPTS(x)         cli
 +#define ENABLE_INTERRUPTS_HW_COND
++#define DISABLE_INTERRUPTS_HW_COND
 +#define DISABLE_INTERRUPTS_HW(clobbers)       DISABLE_INTERRUPTS(clobbers)
 +#define ENABLE_INTERRUPTS_HW(clobbers)        ENABLE_INTERRUPTS(clobbers)
 +#endif /* !CONFIG_IPIPE */
  
  #ifdef CONFIG_X86_64
  #define SWAPGS        swapgs
-@@ -157,8 +272,10 @@ static inline unsigned long __raw_local_irq_save(void)
+@@ -157,8 +276,10 @@ static inline unsigned long __raw_local_irq_save(void)
  #define raw_local_save_flags(flags)                           \
        do { (flags) = __raw_local_save_flags(); } while (0)
  
@@ -2605,7 +2618,7 @@ index c929add..f2e94fa 100644
        jmp error_code
        CFI_ENDPROC
 diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
-index 38946c6..66112f0 100644
+index 38946c6..8a67c34 100644
 --- a/arch/x86/kernel/entry_64.S
 +++ b/arch/x86/kernel/entry_64.S
 @@ -48,6 +48,7 @@
@@ -2779,16 +2792,24 @@ index 38946c6..66112f0 100644
  restore_args:
        RESTORE_ARGS 0,8,0
  
-@@ -952,7 +1022,7 @@ ENTRY(retint_kernel)
+@@ -952,7 +1022,15 @@ ENTRY(retint_kernel)
        jnc  retint_restore_args
        bt   $9,EFLAGS-ARGOFFSET(%rsp)  /* interrupts off? */
        jnc  retint_restore_args
 -      call preempt_schedule_irq
++#ifdef CONFIG_IPIPE
++      /*
++       * We may have preempted call_softirq before __do_softirq raised or
++       * after it lowered the preemption counter.
++       */
++      cmpl $0,PER_CPU_VAR(irq_count)
++      jge  retint_restore_args
++#endif
 +      PREEMPT_SCHEDULE_IRQ
        jmp exit_intr
  #endif
  
-@@ -962,16 +1032,31 @@ END(common_interrupt)
+@@ -962,16 +1040,31 @@ END(common_interrupt)
  /*
   * APIC interrupts.
   */
@@ -2821,7 +2842,7 @@ index 38946c6..66112f0 100644
  
  #ifdef CONFIG_SMP
  apicinterrupt IRQ_MOVE_CLEANUP_VECTOR \
-@@ -994,6 +1079,7 @@ apicinterrupt INVALIDATE_TLB_VECTOR_START+1 \
+@@ -994,6 +1087,7 @@ apicinterrupt INVALIDATE_TLB_VECTOR_START+1 \
        invalidate_interrupt1 smp_invalidate_interrupt
  apicinterrupt INVALIDATE_TLB_VECTOR_START+2 \
        invalidate_interrupt2 smp_invalidate_interrupt
@@ -2829,7 +2850,7 @@ index 38946c6..66112f0 100644
  apicinterrupt INVALIDATE_TLB_VECTOR_START+3 \
        invalidate_interrupt3 smp_invalidate_interrupt
  apicinterrupt INVALIDATE_TLB_VECTOR_START+4 \
-@@ -1004,6 +1090,7 @@ apicinterrupt INVALIDATE_TLB_VECTOR_START+6 \
+@@ -1004,6 +1098,7 @@ apicinterrupt INVALIDATE_TLB_VECTOR_START+6 \
        invalidate_interrupt6 smp_invalidate_interrupt
  apicinterrupt INVALIDATE_TLB_VECTOR_START+7 \
        invalidate_interrupt7 smp_invalidate_interrupt
@@ -2837,7 +2858,7 @@ index 38946c6..66112f0 100644
  #endif
  
  apicinterrupt THRESHOLD_APIC_VECTOR \
-@@ -1028,7 +1115,7 @@ apicinterrupt SPURIOUS_APIC_VECTOR \
+@@ -1028,7 +1123,7 @@ apicinterrupt SPURIOUS_APIC_VECTOR \
  /*
   * Exception entry points.
   */
@@ -2846,7 +2867,7 @@ index 38946c6..66112f0 100644
  ENTRY(\sym)
        INTR_FRAME
        PARAVIRT_ADJUST_EXCEPTION_FRAME
-@@ -1039,13 +1126,26 @@ ENTRY(\sym)
+@@ -1039,13 +1134,26 @@ ENTRY(\sym)
        DEFAULT_FRAME 0
        movq %rsp,%rdi          /* pt_regs pointer */
        xorl %esi,%esi          /* no error code */
@@ -2874,7 +2895,7 @@ index 38946c6..66112f0 100644
  ENTRY(\sym)
        INTR_FRAME
        PARAVIRT_ADJUST_EXCEPTION_FRAME
-@@ -1055,14 +1155,27 @@ ENTRY(\sym)
+@@ -1055,14 +1163,27 @@ ENTRY(\sym)
        call save_paranoid
        TRACE_IRQS_OFF
        movq %rsp,%rdi          /* pt_regs pointer */
@@ -2903,7 +2924,7 @@ index 38946c6..66112f0 100644
  ENTRY(\sym)
        INTR_FRAME
        PARAVIRT_ADJUST_EXCEPTION_FRAME
-@@ -1072,17 +1185,30 @@ ENTRY(\sym)
+@@ -1072,17 +1193,30 @@ ENTRY(\sym)
        call save_paranoid
        TRACE_IRQS_OFF
        movq %rsp,%rdi          /* pt_regs pointer */
@@ -2935,7 +2956,7 @@ index 38946c6..66112f0 100644
  ENTRY(\sym)
        XCPT_FRAME
        PARAVIRT_ADJUST_EXCEPTION_FRAME
-@@ -1093,14 +1219,27 @@ ENTRY(\sym)
+@@ -1093,14 +1227,27 @@ ENTRY(\sym)
        movq %rsp,%rdi                  /* pt_regs pointer */
        movq ORIG_RAX(%rsp),%rsi        /* get error code */
        movq $-1,ORIG_RAX(%rsp)         /* no syscall to restart */
@@ -2964,7 +2985,7 @@ index 38946c6..66112f0 100644
  ENTRY(\sym)
        XCPT_FRAME
        PARAVIRT_ADJUST_EXCEPTION_FRAME
-@@ -1110,27 +1249,40 @@ ENTRY(\sym)
+@@ -1110,27 +1257,40 @@ ENTRY(\sym)
        DEFAULT_FRAME 0
        TRACE_IRQS_OFF
        movq %rsp,%rdi                  /* pt_regs pointer */
@@ -3017,7 +3038,26 @@ index 38946c6..66112f0 100644
  
        /* Reload gs selector with exception handling */
        /* edi:  new selector */
-@@ -1376,11 +1528,11 @@ END(xen_failsafe_callback)
+@@ -1260,14 +1420,18 @@ ENTRY(call_softirq)
+       CFI_REL_OFFSET rbp,0
+       mov  %rsp,%rbp
+       CFI_DEF_CFA_REGISTER rbp
++      DISABLE_INTERRUPTS_HW_COND
+       incl PER_CPU_VAR(irq_count)
+       cmove PER_CPU_VAR(irq_stack_ptr),%rsp
++      ENABLE_INTERRUPTS_HW_COND
+       push  %rbp                      # backlink for old unwinder
+       call __do_softirq
++      DISABLE_INTERRUPTS_HW_COND
+       leaveq
+       CFI_DEF_CFA_REGISTER    rsp
+       CFI_ADJUST_CFA_OFFSET   -8
+       decl PER_CPU_VAR(irq_count)
++      ENABLE_INTERRUPTS_HW_COND
+       ret
+       CFI_ENDPROC
+ END(call_softirq)
+@@ -1376,11 +1540,11 @@ END(xen_failsafe_callback)
   */
        .pushsection .kprobes.text, "ax"
  
@@ -3033,7 +3073,7 @@ index 38946c6..66112f0 100644
  #ifdef CONFIG_X86_MCE
  paranoidzeroentry machine_check do_machine_check
  #endif
-@@ -1403,8 +1555,13 @@ ENTRY(paranoid_exit)
+@@ -1403,8 +1567,13 @@ ENTRY(paranoid_exit)
        INTR_FRAME
        DISABLE_INTERRUPTS(CLBR_NONE)
        TRACE_IRQS_OFF
@@ -3139,10 +3179,10 @@ index df89102..cfb29a2 100644
  handle_real_irq:
 diff --git a/arch/x86/kernel/ipipe.c b/arch/x86/kernel/ipipe.c
 new file mode 100644
-index 0000000..dcf9764
+index 0000000..c92592a
 --- /dev/null
 +++ b/arch/x86/kernel/ipipe.c
-@@ -0,0 +1,964 @@
+@@ -0,0 +1,991 @@
 +/*   -*- linux-c -*-
 + *   linux/arch/x86/kernel/ipipe.c
 + *
@@ -3725,6 +3765,29 @@ index 0000000..dcf9764
 +
 +#endif /* !CONFIG_X86_32 */
 +
++void __ipipe_halt_root(void)
++{
++      struct ipipe_percpu_domain_data *p;
++
++      /* Emulate sti+hlt sequence over the root domain. */
++
++      local_irq_disable_hw();
++
++      p = ipipe_root_cpudom_ptr();
++
++      clear_bit(IPIPE_STALL_FLAG, &p->status);
++
++      if (unlikely(p->irqpend_himask != 0)) {
++              __ipipe_sync_pipeline(IPIPE_IRQMASK_ANY);
++              local_irq_enable_hw();
++      } else {
++#ifdef CONFIG_IPIPE_TRACE_IRQSOFF
++              ipipe_trace_end(0x8000000E);
++#endif /* CONFIG_IPIPE_TRACE_IRQSOFF */
++              asm volatile("sti; hlt": : :"memory");
++      }
++}
++
 +static void do_machine_check_vector(struct pt_regs *regs, long error_code)
 +{
 +#ifdef CONFIG_X86_MCE
@@ -4097,16 +4160,20 @@ index 0000000..dcf9764
 +EXPORT_SYMBOL_GPL(__switch_to);
 +EXPORT_SYMBOL_GPL(show_stack);
 +
-+#ifdef CONFIG_X86_32
 +EXPORT_PER_CPU_SYMBOL_GPL(init_tss);
 +#ifdef CONFIG_SMP
 +EXPORT_PER_CPU_SYMBOL_GPL(cpu_tlbstate);
 +#endif /* CONFIG_SMP */
-+#endif /* !CONFIG_X86_32 */
 +
 +#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
 +EXPORT_SYMBOL(tasklist_lock);
 +#endif /* CONFIG_SMP || CONFIG_DEBUG_SPINLOCK */
++
++#ifdef CONFIG_CC_STACKPROTECTOR
++EXPORT_PER_CPU_SYMBOL_GPL(irq_stack_union);
++#endif
++
++EXPORT_SYMBOL(__ipipe_halt_root);
 diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
 index c3fe010..1c5ca71 100644
 --- a/arch/x86/kernel/irq.c
@@ -4242,18 +4309,10 @@ index ca98915..aa44a9e 100644
                 * One CPU supports mwait => All CPUs supports mwait
                 */
 diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
-index 76f8f84..2019f5f 100644
+index 76f8f84..6da32b6 100644
 --- a/arch/x86/kernel/process_32.c
 +++ b/arch/x86/kernel/process_32.c
-@@ -117,6 +117,7 @@ void cpu_idle(void)
-                       local_irq_disable();
-                       /* Don't trace irqs off for idle */
-                       stop_critical_timings();
-+                      ipipe_suspend_domain();
-                       pm_idle();
-                       start_critical_timings();
-               }
-@@ -310,10 +311,12 @@ start_thread(struct pt_regs *regs, unsigned long new_ip, 
unsigned long new_sp)
+@@ -310,10 +310,12 @@ start_thread(struct pt_regs *regs, unsigned long new_ip, 
unsigned long new_sp)
        regs->cs                = __USER_CS;
        regs->ip                = new_ip;
        regs->sp                = new_sp;
@@ -4266,7 +4325,7 @@ index 76f8f84..2019f5f 100644
  }
  EXPORT_SYMBOL_GPL(start_thread);
  
-@@ -350,7 +353,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct 
*next_p)
+@@ -350,7 +352,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct 
*next_p)
  {
        struct thread_struct *prev = &prev_p->thread,
                                 *next = &next_p->thread;
@@ -4276,7 +4335,7 @@ index 76f8f84..2019f5f 100644
  
        /* never put a printk in __switch_to... printk() calls wake_up*() 
indirectly */
 diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
-index b751a41..b6c779b 100644
+index b751a41..78b1b99 100644
 --- a/arch/x86/kernel/process_64.c
 +++ b/arch/x86/kernel/process_64.c
 @@ -64,6 +64,8 @@ EXPORT_PER_CPU_SYMBOL(current_task);
@@ -4288,15 +4347,7 @@ index b751a41..b6c779b 100644
  unsigned long kernel_thread_flags = CLONE_VM | CLONE_UNTRACED;
  
  static ATOMIC_NOTIFIER_HEAD(idle_notifier);
-@@ -146,6 +148,7 @@ void cpu_idle(void)
-                       enter_idle();
-                       /* Don't trace irqs off for idle */
-                       stop_critical_timings();
-+                      ipipe_suspend_domain();
-                       pm_idle();
-                       start_critical_timings();
-                       /* In many cases the interrupt that ended idle
-@@ -298,6 +301,7 @@ int copy_thread(unsigned long clone_flags, unsigned long 
sp,
+@@ -298,6 +300,7 @@ int copy_thread(unsigned long clone_flags, unsigned long 
sp,
        p->thread.sp = (unsigned long) childregs;
        p->thread.sp0 = (unsigned long) (childregs+1);
        p->thread.usersp = me->thread.usersp;
@@ -4304,7 +4355,7 @@ index b751a41..b6c779b 100644
  
        set_tsk_thread_flag(p, TIF_FORK);
  
-@@ -363,10 +367,12 @@ start_thread(struct pt_regs *regs, unsigned long new_ip, 
unsigned long new_sp)
+@@ -363,10 +366,12 @@ start_thread(struct pt_regs *regs, unsigned long new_ip, 
unsigned long new_sp)
        regs->ss                = __USER_DS;
        regs->flags             = 0x200;
        set_fs(USER_DS);
@@ -4317,7 +4368,7 @@ index b751a41..b6c779b 100644
  }
  EXPORT_SYMBOL_GPL(start_thread);
  
-@@ -385,7 +391,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct 
*next_p)
+@@ -385,7 +390,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct 
*next_p)
  {
        struct thread_struct *prev = &prev_p->thread;
        struct thread_struct *next = &next_p->thread;
@@ -4804,6 +4855,35 @@ index 42414e5..4d1fc09 100644
        task_unlock(tsk);
        arch_pick_mmap_layout(mm);
        if (old_mm) {
+diff --git a/include/asm-generic/bitops/atomic.h 
b/include/asm-generic/bitops/atomic.h
+index 4657f3e..4b23b45 100644
+--- a/include/asm-generic/bitops/atomic.h
++++ b/include/asm-generic/bitops/atomic.h
+@@ -20,20 +20,20 @@ extern raw_spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] 
__lock_aligned;
+  * this is the substitute */
+ #define _atomic_spin_lock_irqsave(l,f) do {   \
+       raw_spinlock_t *s = ATOMIC_HASH(l);     \
+-      local_irq_save(f);                      \
++      local_irq_save_hw(f);                   \
+       __raw_spin_lock(s);                     \
+ } while(0)
+ 
+ #define _atomic_spin_unlock_irqrestore(l,f) do {      \
+       raw_spinlock_t *s = ATOMIC_HASH(l);             \
+       __raw_spin_unlock(s);                           \
+-      local_irq_restore(f);                           \
++      local_irq_restore_hw(f);                        \
+ } while(0)
+ 
+ 
+ #else
+-#  define _atomic_spin_lock_irqsave(l,f) do { local_irq_save(f); } while (0)
+-#  define _atomic_spin_unlock_irqrestore(l,f) do { local_irq_restore(f); } 
while (0)
++#  define _atomic_spin_lock_irqsave(l,f) do { local_irq_save_hw(f); } while 
(0)
++#  define _atomic_spin_unlock_irqrestore(l,f) do { local_irq_restore_hw(f); } 
while (0)
+ #endif
+ 
+ /*
 diff --git a/include/asm-generic/cmpxchg-local.h 
b/include/asm-generic/cmpxchg-local.h
 index b2ba2fc..ed01ab9 100644
 --- a/include/asm-generic/cmpxchg-local.h
@@ -4924,7 +5004,7 @@ index 4525747..0ceffc3 100644
  #endif /* LINUX_HARDIRQ_H */
 diff --git a/include/linux/ipipe.h b/include/linux/ipipe.h
 new file mode 100644
-index 0000000..8983e2c
+index 0000000..8cbcb53
 --- /dev/null
 +++ b/include/linux/ipipe.h
 @@ -0,0 +1,688 @@
@@ -5087,7 +5167,7 @@ index 0000000..8983e2c
 +      ipipe_event_handler_t evhand[IPIPE_NR_EVENTS]; /* Event handlers. */
 +      unsigned long long evself;      /* Self-monitored event bits. */
 +
-+      struct {
++      struct ipipe_irqdesc {
 +              unsigned long control;
 +              ipipe_irq_ackfn_t acknowledge;
 +              ipipe_irq_handler_t handler;
@@ -5618,10 +5698,10 @@ index 0000000..8983e2c
 +#endif        /* !__LINUX_IPIPE_H */
 diff --git a/include/linux/ipipe_base.h b/include/linux/ipipe_base.h
 new file mode 100644
-index 0000000..2960ecf
+index 0000000..6ade9d6
 --- /dev/null
 +++ b/include/linux/ipipe_base.h
-@@ -0,0 +1,89 @@
+@@ -0,0 +1,102 @@
 +/* -*- linux-c -*-
 + * include/linux/ipipe_base.h
 + *
@@ -5683,8 +5763,21 @@ index 0000000..2960ecf
 +
 +void __ipipe_restore_root(unsigned long x);
 +
-+#define ipipe_preempt_disable(flags)  local_irq_save_hw(flags)
-+#define ipipe_preempt_enable(flags)   local_irq_restore_hw(flags)
++#define ipipe_preempt_disable(flags)          \
++      do {                                    \
++              local_irq_save_hw(flags);       \
++              if (__ipipe_root_domain_p)      \
++                      preempt_disable();      \
++      } while (0)
++#define ipipe_preempt_enable(flags)                   \
++      do {                                            \
++              if (__ipipe_root_domain_p) {            \
++                      preempt_enable_no_resched();    \
++                      local_irq_restore_hw(flags);    \
++                      preempt_check_resched();        \
++              } else                                  \
++                      local_irq_restore_hw(flags);    \
++      } while (0)
 + 
 +#ifdef CONFIG_IPIPE_DEBUG_CONTEXT
 +void ipipe_check_context(struct ipipe_domain *border_ipd);
@@ -6630,10 +6723,10 @@ index f4be1ee..1ac44c0 100644
  
 diff --git a/kernel/ipipe/Kconfig b/kernel/ipipe/Kconfig
 new file mode 100644
-index 0000000..de5e6a3
+index 0000000..934d57c
 --- /dev/null
 +++ b/kernel/ipipe/Kconfig
-@@ -0,0 +1,35 @@
+@@ -0,0 +1,30 @@
 +config IPIPE
 +      bool "Interrupt pipeline"
 +      default y
@@ -6664,11 +6757,6 @@ index 0000000..de5e6a3
 +       bool
 +       depends on IPIPE
 +       default n
-+
-+config IPIPE_UNMASKED_CONTEXT_SWITCH
-+       bool
-+       depends on IPIPE
-+       default n
 diff --git a/kernel/ipipe/Kconfig.debug b/kernel/ipipe/Kconfig.debug
 new file mode 100644
 index 0000000..c9b8abc
@@ -6782,7 +6870,7 @@ index 0000000..6257dfa
 +obj-$(CONFIG_IPIPE_TRACE) += tracer.o
 diff --git a/kernel/ipipe/core.c b/kernel/ipipe/core.c
 new file mode 100644
-index 0000000..ffaceaa
+index 0000000..aa2e5a0
 --- /dev/null
 +++ b/kernel/ipipe/core.c
 @@ -0,0 +1,1794 @@
@@ -7100,7 +7188,7 @@ index 0000000..ffaceaa
 +
 +#ifdef CONFIG_IPIPE_DEBUG_INTERNAL
 +      /* This helps catching bad usage from assembly call sites. */
-+      BUG_ON(!__ipipe_root_domain_p);
++      BUG_ON(!__ipipe_root_domain_p && !oops_in_progress);
 +#endif
 +
 +      p = ipipe_root_cpudom_ptr();
@@ -7116,7 +7204,7 @@ index 0000000..ffaceaa
 +void __ipipe_restore_root(unsigned long x)
 +{
 +#ifdef CONFIG_IPIPE_DEBUG_INTERNAL
-+      BUG_ON(!ipipe_root_domain_p);
++      BUG_ON(!ipipe_root_domain_p && !oops_in_progress);
 +#endif
 +
 +      if (x)
@@ -8464,7 +8552,7 @@ index 0000000..ffaceaa
 +
 +      ipipe_context_check_off();
 +      ipipe_trace_panic_freeze();
-+      ipipe_set_printk_sync(__ipipe_current_domain);
++      oops_in_progress = 1;
 +
 +      if (this_domain->priority > border_domain->priority)
 +              printk(KERN_ERR "I-pipe: Detected illicit call from domain "
@@ -10823,7 +10911,7 @@ index cffffad..0a3eac6 100644
   * This function runs timers and the timer-tq in bottom half context.
   */
 diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
-index f1ed080..aa45f71 100644
+index f1ed080..28fbd5b 100644
 --- a/kernel/trace/ftrace.c
 +++ b/kernel/trace/ftrace.c
 @@ -28,6 +28,7 @@
@@ -10858,30 +10946,26 @@ index f1ed080..aa45f71 100644
  
        ret = ftrace_arch_code_modify_post_process();
        FTRACE_WARN_ON(ret);
-@@ -2189,9 +2199,9 @@ static int ftrace_convert_nops(struct module *mod,
-       }
+@@ -2190,7 +2200,9 @@ static int ftrace_convert_nops(struct module *mod,
  
        /* disable interrupts to prevent kstop machine */
--      local_irq_save(flags);
-+      local_irq_save_hw_notrace(flags);
+       local_irq_save(flags);
++      local_irq_disable_hw();
        ftrace_update_code(mod);
--      local_irq_restore(flags);
-+      local_irq_restore_hw_notrace(flags);
++      local_irq_enable_hw();
+       local_irq_restore(flags);
        mutex_unlock(&ftrace_lock);
  
-       return 0;
-@@ -2216,9 +2226,9 @@ void __init ftrace_init(void)
-       /* Keep the ftrace pointer to the stub */
+@@ -2217,7 +2229,9 @@ void __init ftrace_init(void)
        addr = (unsigned long)ftrace_stub;
  
--      local_irq_save(flags);
-+      local_irq_save_hw_notrace(flags);
+       local_irq_save(flags);
++      local_irq_disable_hw();
        ftrace_dyn_arch_init(&addr);
--      local_irq_restore(flags);
-+      local_irq_restore_hw_notrace(flags);
++      local_irq_enable_hw();
+       local_irq_restore(flags);
  
        /* ftrace_dyn_arch_init places the return code in addr */
-       if (addr)
 diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
 index 3be4b7c..c970fab 100644
 --- a/lib/Kconfig.debug


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to