Module: xenomai-3 Branch: next Commit: 1e48be22d3ec9a7450b2354a638df911d3c29175 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=1e48be22d3ec9a7450b2354a638df911d3c29175
Author: Philippe Gerum <r...@xenomai.org> Date: Thu Feb 5 09:04:08 2015 +0100 cobalt/x86: upgrade I-pipe support --- ...-x86-6.patch => ipipe-core-3.14.28-x86-7.patch} | 404 ++++++++++++-------- 1 file changed, 252 insertions(+), 152 deletions(-) diff --git a/kernel/cobalt/arch/x86/patches/ipipe-core-3.14.17-x86-6.patch b/kernel/cobalt/arch/x86/patches/ipipe-core-3.14.28-x86-7.patch similarity index 97% rename from kernel/cobalt/arch/x86/patches/ipipe-core-3.14.17-x86-6.patch rename to kernel/cobalt/arch/x86/patches/ipipe-core-3.14.28-x86-7.patch index 09fef49..0086f76 100644 --- a/kernel/cobalt/arch/x86/patches/ipipe-core-3.14.17-x86-6.patch +++ b/kernel/cobalt/arch/x86/patches/ipipe-core-3.14.28-x86-7.patch @@ -1,5 +1,5 @@ diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig -index c718d9f..a48da09 100644 +index 98aa930..91e382d 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -9,6 +9,7 @@ config 64BIT @@ -52,7 +52,7 @@ index c718d9f..a48da09 100644 bool "Local APIC support on uniprocessors" depends on X86_32 && !SMP && !X86_32_NON_STANDARD && !PCI_MSI diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S -index 4299eb0..f55a4f0 100644 +index 92a2e93..56aa429 100644 --- a/arch/x86/ia32/ia32entry.S +++ b/arch/x86/ia32/ia32entry.S @@ -83,6 +83,43 @@ @@ -99,15 +99,15 @@ index 4299eb0..f55a4f0 100644 #ifdef CONFIG_PARAVIRT ENTRY(native_usergs_sysret32) swapgs -@@ -152,6 +189,7 @@ ENTRY(ia32_sysenter_target) - _ASM_EXTABLE(1b,ia32_badarg) - ASM_CLAC +@@ -162,6 +199,7 @@ ENTRY(ia32_sysenter_target) + sysenter_flags_fixed: + orl $TS_COMPAT,TI_status+THREAD_INFO(%rsp,RIP-ARGOFFSET) + IPIPE_IA32_SYSCALL %rax sysexit_from_sys_call sysexit_work testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET) CFI_REMEMBER_STATE jnz sysenter_tracesys -@@ -162,6 +200,7 @@ sysenter_do_call: +@@ -172,6 +210,7 @@ sysenter_do_call: sysenter_dispatch: call *ia32_sys_call_table(,%rax,8) movq %rax,RAX-ARGOFFSET(%rsp) @@ -115,7 +115,7 @@ index 4299eb0..f55a4f0 100644 DISABLE_INTERRUPTS(CLBR_NONE) TRACE_IRQS_OFF testl $_TIF_ALLWORK_MASK,TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET) -@@ -309,6 +348,7 @@ ENTRY(ia32_cstar_target) +@@ -325,6 +364,7 @@ ENTRY(ia32_cstar_target) _ASM_EXTABLE(1b,ia32_badarg) ASM_CLAC orl $TS_COMPAT,TI_status+THREAD_INFO(%rsp,RIP-ARGOFFSET) @@ -123,7 +123,7 @@ index 4299eb0..f55a4f0 100644 testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET) CFI_REMEMBER_STATE jnz cstar_tracesys -@@ -319,6 +359,7 @@ cstar_do_call: +@@ -335,6 +375,7 @@ cstar_do_call: cstar_dispatch: call *ia32_sys_call_table(,%rax,8) movq %rax,RAX-ARGOFFSET(%rsp) @@ -131,7 +131,7 @@ index 4299eb0..f55a4f0 100644 DISABLE_INTERRUPTS(CLBR_NONE) TRACE_IRQS_OFF testl $_TIF_ALLWORK_MASK,TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET) -@@ -419,6 +460,7 @@ ENTRY(ia32_syscall) +@@ -435,6 +476,7 @@ ENTRY(ia32_syscall) this could be a problem. */ SAVE_ARGS 0,1,0 orl $TS_COMPAT,TI_status+THREAD_INFO(%rsp,RIP-ARGOFFSET) @@ -139,7 +139,7 @@ index 4299eb0..f55a4f0 100644 testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET) jnz ia32_tracesys cmpq $(IA32_NR_syscalls-1),%rax -@@ -430,7 +472,10 @@ ia32_sysret: +@@ -446,7 +488,10 @@ ia32_sysret: movq %rax,RAX-ARGOFFSET(%rsp) ia32_ret_from_sys_call: CLEAR_RREGS -ARGOFFSET @@ -442,7 +442,7 @@ index 615fa90..e0a62ab 100644 extern void default_send_IPI_mask_sequence_phys(const struct cpumask *mask, diff --git a/arch/x86/include/asm/ipipe.h b/arch/x86/include/asm/ipipe.h new file mode 100644 -index 0000000..3e8492a +index 0000000..f6df562 --- /dev/null +++ b/arch/x86/include/asm/ipipe.h @@ -0,0 +1,96 @@ @@ -472,7 +472,7 @@ index 0000000..3e8492a + +#ifdef CONFIG_IPIPE + -+#define IPIPE_CORE_RELEASE 6 ++#define IPIPE_CORE_RELEASE 7 + +struct ipipe_domain; + @@ -1315,7 +1315,7 @@ index be12c53..4720e61 100644 #ifdef CONFIG_X86_32 diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h -index 8de6d9c..8ef5e27 100644 +index d54d1ee..66886e5 100644 --- a/arch/x86/include/asm/page_64_types.h +++ b/arch/x86/include/asm/page_64_types.h @@ -1,7 +1,11 @@ @@ -1433,7 +1433,7 @@ index d7f3b3b..310e55c 100644 [_tif_fork] "i" (_TIF_FORK), \ [thread_info] "i" (offsetof(struct task_struct, stack)), \ diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h -index e1940c0..270922b 100644 +index e870ea9..28df5ac 100644 --- a/arch/x86/include/asm/thread_info.h +++ b/arch/x86/include/asm/thread_info.h @@ -21,6 +21,7 @@ struct task_struct; @@ -1480,10 +1480,10 @@ index e1940c0..270922b 100644 #ifndef __ASSEMBLY__ diff --git a/arch/x86/include/asm/traps.h b/arch/x86/include/asm/traps.h -index 58d66fe..c062139 100644 +index b409b17..4d316b3 100644 --- a/arch/x86/include/asm/traps.h +++ b/arch/x86/include/asm/traps.h -@@ -101,9 +101,9 @@ extern int panic_on_unrecovered_nmi; +@@ -102,9 +102,9 @@ extern int panic_on_unrecovered_nmi; void math_error(struct pt_regs *, int, int); void math_emulate(struct math_emu_info *); #ifndef CONFIG_X86_32 @@ -1529,7 +1529,7 @@ index 56bac86..ab267ad 100644 obj-$(CONFIG_APM) += apm.o obj-$(CONFIG_SMP) += smp.o diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c -index 7f26c9a..935e6e3 100644 +index 523f147..131b5eb 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -34,6 +34,7 @@ @@ -2268,10 +2268,10 @@ index 9f6b934..ef8626a 100644 BLANK(); OFFSET(crypto_tfm_ctx_offset, crypto_tfm, __crt_ctx); diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c -index 8e28bf2..e8c1d54 100644 +index e6bddd5..6a5e441 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c -@@ -1151,6 +1151,7 @@ void syscall_init(void) +@@ -1153,6 +1153,7 @@ void syscall_init(void) DEFINE_PER_CPU(struct orig_ist, orig_ist); static DEFINE_PER_CPU(unsigned long, debug_stack_addr); @@ -2279,7 +2279,7 @@ index 8e28bf2..e8c1d54 100644 DEFINE_PER_CPU(int, debug_stack_usage); int is_debug_stack(unsigned long addr) -@@ -1175,6 +1176,7 @@ void debug_stack_reset(void) +@@ -1177,6 +1178,7 @@ void debug_stack_reset(void) if (this_cpu_dec_return(debug_idt_ctr) == 0) load_current_idt(); } @@ -2417,10 +2417,10 @@ index f2a1770..c1dcd93 100644 /* * When in-kernel, we also print out the stack and code at the diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c -index addb207..8bec33c 100644 +index 66e274a..9ce7358 100644 --- a/arch/x86/kernel/dumpstack_64.c +++ b/arch/x86/kernel/dumpstack_64.c -@@ -253,6 +253,9 @@ void show_regs(struct pt_regs *regs) +@@ -252,6 +252,9 @@ void show_regs(struct pt_regs *regs) sp = regs->sp; show_regs_print_info(KERN_DEFAULT); __show_regs(regs, 1); @@ -2899,7 +2899,7 @@ index c5a9cb9..1a8704f 100644 CFI_ENDPROC END(general_protection) diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S -index 03cd2a8..728146f 100644 +index 02553d6..7469c53 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S @@ -50,6 +50,7 @@ @@ -2971,7 +2971,7 @@ index 03cd2a8..728146f 100644 call schedule_tail # rdi: 'prev' task parameter -@@ -616,15 +638,60 @@ GLOBAL(system_call_after_swapgs) +@@ -616,15 +638,61 @@ GLOBAL(system_call_after_swapgs) movq %rax,ORIG_RAX-ARGOFFSET(%rsp) movq %rcx,RIP-ARGOFFSET(%rsp) CFI_REL_OFFSET rip,RIP-ARGOFFSET @@ -2989,6 +2989,7 @@ index 03cd2a8..728146f 100644 + jz root_fastexit + testl $_TIP_MAYDAY,TI_ipipe+THREAD_INFO(%rsp,RIP-ARGOFFSET) + jz pipeline_leave ++ leaq -ARGOFFSET(%rsp),%rdi + call __ipipe_call_mayday + jmp pipeline_leave +root_fastexit: @@ -3038,7 +3039,7 @@ index 03cd2a8..728146f 100644 ja badsys movq %r10,%rcx call *sys_call_table(,%rax,8) # XXX: rip relative -@@ -648,6 +715,7 @@ sysret_check: +@@ -648,6 +716,7 @@ sysret_check: * sysretq will re-enable interrupts: */ TRACE_IRQS_ON @@ -3046,7 +3047,7 @@ index 03cd2a8..728146f 100644 movq RIP-ARGOFFSET(%rsp),%rcx CFI_REGISTER rip,rcx RESTORE_ARGS 1,-ARG_SKIP,0 -@@ -659,6 +727,8 @@ sysret_check: +@@ -659,6 +728,8 @@ sysret_check: /* Handle reschedules */ /* edx: work, edi: workmask */ sysret_careful: @@ -3055,7 +3056,7 @@ index 03cd2a8..728146f 100644 bt $TIF_NEED_RESCHED,%edx jnc sysret_signal TRACE_IRQS_ON -@@ -668,6 +738,16 @@ sysret_careful: +@@ -668,6 +739,16 @@ sysret_careful: popq_cfi %rdi jmp sysret_check @@ -3072,7 +3073,7 @@ index 03cd2a8..728146f 100644 /* Handle a signal */ sysret_signal: TRACE_IRQS_ON -@@ -765,9 +845,15 @@ GLOBAL(int_with_check) +@@ -765,9 +846,15 @@ GLOBAL(int_with_check) movl TI_flags(%rcx),%edx andl %edi,%edx jnz int_careful @@ -3088,7 +3089,7 @@ index 03cd2a8..728146f 100644 /* Either reschedule or signal or syscall exit tracking needed. */ /* First do a reschedule test. */ /* edx: work, edi: workmask */ -@@ -973,7 +1059,31 @@ END(interrupt) +@@ -973,7 +1060,31 @@ END(interrupt) subq $ORIG_RAX-RBP, %rsp CFI_ADJUST_CFA_OFFSET ORIG_RAX-RBP SAVE_ARGS_IRQ @@ -3120,7 +3121,7 @@ index 03cd2a8..728146f 100644 .endm /* -@@ -986,10 +1096,27 @@ END(interrupt) +@@ -986,10 +1097,27 @@ END(interrupt) */ .p2align CONFIG_X86_L1_CACHE_SHIFT common_interrupt: @@ -3148,7 +3149,7 @@ index 03cd2a8..728146f 100644 /* 0(%rsp): old_rsp-ARGOFFSET */ ret_from_intr: DISABLE_INTERRUPTS(CLBR_NONE) -@@ -1003,7 +1130,7 @@ ret_from_intr: +@@ -1003,7 +1131,7 @@ ret_from_intr: CFI_DEF_CFA_REGISTER rsp CFI_ADJUST_CFA_OFFSET RBP-ARGOFFSET @@ -3157,7 +3158,7 @@ index 03cd2a8..728146f 100644 GET_THREAD_INFO(%rcx) testl $3,CS-ARGOFFSET(%rsp) je retint_kernel -@@ -1023,20 +1150,20 @@ retint_check: +@@ -1023,20 +1151,20 @@ retint_check: jnz retint_careful retint_swapgs: /* return to user-space */ @@ -3182,7 +3183,7 @@ index 03cd2a8..728146f 100644 restore_args: RESTORE_ARGS 1,8,1 -@@ -1141,7 +1268,15 @@ ENTRY(retint_kernel) +@@ -1128,7 +1256,15 @@ ENTRY(retint_kernel) jnz retint_restore_args bt $9,EFLAGS-ARGOFFSET(%rsp) /* interrupts off? */ jnc retint_restore_args @@ -3199,7 +3200,7 @@ index 03cd2a8..728146f 100644 jmp exit_intr #endif CFI_ENDPROC -@@ -1186,6 +1321,31 @@ END(__do_double_fault) +@@ -1142,6 +1278,31 @@ END(common_interrupt) /* * APIC interrupts. */ @@ -3231,7 +3232,7 @@ index 03cd2a8..728146f 100644 .macro apicinterrupt3 num sym do_sym ENTRY(\sym) INTR_FRAME -@@ -1197,6 +1357,7 @@ ENTRY(\sym) +@@ -1153,6 +1314,7 @@ ENTRY(\sym) CFI_ENDPROC END(\sym) .endm @@ -3239,7 +3240,7 @@ index 03cd2a8..728146f 100644 #ifdef CONFIG_TRACING #define trace(sym) trace_##sym -@@ -1253,6 +1414,14 @@ apicinterrupt CALL_FUNCTION_VECTOR \ +@@ -1209,6 +1371,14 @@ apicinterrupt CALL_FUNCTION_VECTOR \ call_function_interrupt smp_call_function_interrupt apicinterrupt RESCHEDULE_VECTOR \ reschedule_interrupt smp_reschedule_interrupt @@ -3254,7 +3255,7 @@ index 03cd2a8..728146f 100644 #endif apicinterrupt ERROR_APIC_VECTOR \ -@@ -1268,7 +1437,7 @@ apicinterrupt IRQ_WORK_VECTOR \ +@@ -1224,7 +1394,7 @@ apicinterrupt IRQ_WORK_VECTOR \ /* * Exception entry points. */ @@ -3263,19 +3264,19 @@ index 03cd2a8..728146f 100644 ENTRY(\sym) INTR_FRAME ASM_CLAC -@@ -1280,13 +1449,28 @@ ENTRY(\sym) +@@ -1236,13 +1406,28 @@ ENTRY(\sym) DEFAULT_FRAME 0 movq %rsp,%rdi /* pt_regs pointer */ xorl %esi,%esi /* no error code */ +#ifdef CONFIG_IPIPE + movq $\ex_code,%rdx + call __ipipe_handle_exception /* handle(regs, error_code, ex_code) */ -+ TRACE_IRQS_OFF + testl %eax, %eax + jz error_exit + movl %ebx,%eax + RESTORE_REST + DISABLE_INTERRUPTS(CLBR_NONE) ++ TRACE_IRQS_OFF + testl %eax,%eax + jne retint_noswapgs + jmp retint_swapgs_notrace @@ -3293,7 +3294,7 @@ index 03cd2a8..728146f 100644 ENTRY(\sym) INTR_FRAME ASM_CLAC -@@ -1295,10 +1479,25 @@ ENTRY(\sym) +@@ -1251,10 +1436,25 @@ ENTRY(\sym) subq $ORIG_RAX-R15, %rsp CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15 call save_paranoid @@ -3303,9 +3304,9 @@ index 03cd2a8..728146f 100644 + .if \ex_code + movq $\ex_code,%rsi + call __ipipe_divert_exception /* handle(regs, ex_code) */ -+ TRACE_IRQS_OFF + testl %eax,%eax + jnz 1f ++ TRACE_IRQS_OFF + movq %rsp,%rdi + .endif +#else @@ -3320,7 +3321,7 @@ index 03cd2a8..728146f 100644 jmp paranoid_exit /* %ebx: no swapgs flag */ CFI_ENDPROC END(\sym) -@@ -1314,8 +1513,8 @@ ENTRY(\sym) +@@ -1270,8 +1470,8 @@ ENTRY(\sym) subq $ORIG_RAX-R15, %rsp CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15 call save_paranoid @@ -3330,7 +3331,7 @@ index 03cd2a8..728146f 100644 xorl %esi,%esi /* no error code */ subq $EXCEPTION_STKSZ, INIT_TSS_IST(\ist) call \do_sym -@@ -1325,7 +1524,7 @@ ENTRY(\sym) +@@ -1281,7 +1481,7 @@ ENTRY(\sym) END(\sym) .endm @@ -3339,19 +3340,19 @@ index 03cd2a8..728146f 100644 ENTRY(\sym) XCPT_FRAME ASM_CLAC -@@ -1337,25 +1536,40 @@ ENTRY(\sym) +@@ -1293,25 +1493,40 @@ 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 */ +#ifdef CONFIG_IPIPE + movq $\ex_code,%rdx + call __ipipe_handle_exception /* handle(regs, error_code, ex_code) */ -+ TRACE_IRQS_OFF + testl %eax, %eax + jz error_exit + movl %ebx,%eax + RESTORE_REST + DISABLE_INTERRUPTS(CLBR_NONE) ++ TRACE_IRQS_OFF + testl %eax,%eax + jne retint_noswapgs + jmp retint_swapgs_notrace @@ -3386,7 +3387,7 @@ index 03cd2a8..728146f 100644 ENTRY(\sym) XCPT_FRAME ASM_CLAC -@@ -1364,29 +1578,44 @@ ENTRY(\sym) +@@ -1320,29 +1535,44 @@ ENTRY(\sym) CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15 call save_paranoid DEFAULT_FRAME 0 @@ -3426,7 +3427,7 @@ index 03cd2a8..728146f 100644 +zeroentry bounds do_bounds ex_do_bounds +zeroentry invalid_op do_invalid_op ex_do_invalid_op +zeroentry device_not_available do_device_not_available ex_do_device_not_available - paranoiderrorentry double_fault __do_double_fault + paranoiderrorentry double_fault do_double_fault -zeroentry coprocessor_segment_overrun do_coprocessor_segment_overrun -errorentry invalid_TSS do_invalid_TSS -errorentry segment_not_present do_segment_not_present @@ -3444,7 +3445,7 @@ index 03cd2a8..728146f 100644 /* Reload gs selector with exception handling */ -@@ -1422,15 +1651,19 @@ ENTRY(do_softirq_own_stack) +@@ -1378,15 +1608,19 @@ ENTRY(do_softirq_own_stack) CFI_REL_OFFSET rbp,0 mov %rsp,%rbp CFI_DEF_CFA_REGISTER rbp @@ -3464,7 +3465,7 @@ index 03cd2a8..728146f 100644 ret CFI_ENDPROC END(do_softirq_own_stack) -@@ -1547,16 +1780,21 @@ apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \ +@@ -1503,16 +1737,21 @@ apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \ */ .pushsection .kprobes.text, "ax" @@ -3474,8 +3475,9 @@ index 03cd2a8..728146f 100644 +#else paranoidzeroentry_ist debug do_debug DEBUG_STACK paranoidzeroentry_ist int3 do_int3 DEBUG_STACK +-errorentry stack_segment do_stack_segment +#endif - paranoiderrorentry stack_segment do_stack_segment ++errorentry stack_segment do_stack_segment ex_do_stack_segment #ifdef CONFIG_XEN zeroentry xen_debug do_debug zeroentry xen_int3 do_int3 @@ -3488,7 +3490,7 @@ index 03cd2a8..728146f 100644 #ifdef CONFIG_KVM_GUEST errorentry async_page_fault do_async_page_fault #endif -@@ -1582,8 +1820,13 @@ ENTRY(paranoid_exit) +@@ -1538,8 +1777,13 @@ ENTRY(paranoid_exit) DEFAULT_FRAME DISABLE_INTERRUPTS(CLBR_NONE) TRACE_IRQS_OFF_DEBUG @@ -3502,7 +3504,7 @@ index 03cd2a8..728146f 100644 testl $3,CS(%rsp) jnz paranoid_userspace paranoid_swapgs: -@@ -1654,7 +1897,6 @@ ENTRY(error_entry) +@@ -1610,7 +1854,6 @@ ENTRY(error_entry) error_swapgs: SWAPGS error_sti: @@ -3681,10 +3683,10 @@ index 2e977b5..e91576e 100644 handle_real_irq: diff --git a/arch/x86/kernel/ipipe.c b/arch/x86/kernel/ipipe.c new file mode 100644 -index 0000000..ac71e70 +index 0000000..767f838 --- /dev/null +++ b/arch/x86/kernel/ipipe.c -@@ -0,0 +1,605 @@ +@@ -0,0 +1,624 @@ +/* -*- linux-c -*- + * linux/arch/x86/kernel/ipipe.c + * @@ -4037,6 +4039,7 @@ index 0000000..ac71e70 + +int __ipipe_handle_exception(struct pt_regs *regs, long error_code, int vector) +{ ++ bool hard_irqs_off = hard_irqs_disabled(); + bool root_entry = false; + unsigned long flags = 0; + unsigned long cr2 = 0; @@ -4060,10 +4063,9 @@ index 0000000..ac71e70 + /* + * Replicate hw interrupt state into the virtual mask + * before calling the I-pipe event handler over the -+ * root domain. Also required later when calling the -+ * Linux exception handler. ++ * root domain. + */ -+ if (hard_irqs_disabled()) ++ if (hard_irqs_off) + local_irq_disable(); + } + @@ -4079,6 +4081,16 @@ index 0000000..ac71e70 + } + + if (likely(ipipe_root_p)) { ++ if (!root_entry) { ++ local_save_flags(flags); ++ ++ /* ++ * Sync Linux interrupt state with hardware state on ++ * entry. ++ */ ++ if (hard_irqs_off) ++ local_irq_disable(); ++ } + /* + * If root is not the topmost domain or in case we faulted in + * the iret path of x86-32, regs.flags does not match the root @@ -4087,8 +4099,7 @@ index 0000000..ac71e70 + * state sampled on entry or, if we migrated to root, with the + * current state. + */ -+ __fixup_if(root_entry ? raw_irqs_disabled_flags(flags) : -+ raw_irqs_disabled(), regs); ++ __fixup_if(raw_irqs_disabled_flags(flags), regs); + } else { + /* Detect unhandled faults over the head domain. */ + struct ipipe_domain *ipd = ipipe_current_domain; @@ -4097,6 +4108,10 @@ index 0000000..ac71e70 + hard_local_irq_disable(); + __ipipe_set_current_domain(ipipe_root_domain); + ++ /* Sync Linux interrupt state with hardware state on entry. */ ++ if (hard_irqs_off) ++ local_irq_disable(); ++ + ipipe_trace_panic_freeze(); + + /* Always warn about user land and unfixable faults. */ @@ -4136,13 +4151,14 @@ index 0000000..ac71e70 + +int __ipipe_divert_exception(struct pt_regs *regs, int vector) +{ ++ bool hard_irqs_off = hard_irqs_disabled(); + bool root_entry = false; + unsigned long flags = 0; + + if (ipipe_root_p) { + root_entry = true; + local_save_flags(flags); -+ if (hard_irqs_disabled()) { ++ if (hard_irqs_off) { + /* + * Same root state handling as in + * __ipipe_handle_exception. @@ -4185,9 +4201,14 @@ index 0000000..ac71e70 + } + + /* see __ipipe_handle_exception */ -+ if (likely(ipipe_root_p)) -+ __fixup_if(root_entry ? raw_irqs_disabled_flags(flags) : -+ raw_irqs_disabled(), regs); ++ if (likely(ipipe_root_p)) { ++ if (!root_entry) { ++ local_save_flags(flags); ++ if (hard_irqs_off) ++ local_irq_disable(); ++ } ++ __fixup_if(raw_irqs_disabled_flags(flags), regs); ++ } + /* + * No need to restore root state in the 64-bit case, the Linux + * handler and the return code will take care of it. @@ -4531,7 +4552,7 @@ index 0de43e9..46f88a9 100644 fpu_switch_t fpu; diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c -index 9c0280f..afd5acb 100644 +index e2d26ce..1f93389 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c @@ -51,6 +51,7 @@ @@ -4560,7 +4581,7 @@ index 9c0280f..afd5acb 100644 unsigned fsindex, gsindex; fpu_switch_t fpu; diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c -index 7461f50..9c0be7c 100644 +index 0686fe3..4a5082a 100644 --- a/arch/x86/kernel/ptrace.c +++ b/arch/x86/kernel/ptrace.c @@ -19,6 +19,7 @@ @@ -4571,7 +4592,7 @@ index 7461f50..9c0be7c 100644 #include <linux/perf_event.h> #include <linux/hw_breakpoint.h> #include <linux/rcupdate.h> -@@ -1515,6 +1516,10 @@ void syscall_trace_leave(struct pt_regs *regs) +@@ -1506,6 +1507,10 @@ void syscall_trace_leave(struct pt_regs *regs) */ user_exit(); @@ -4599,7 +4620,7 @@ index 7c3a5a6..274ff9f 100644 /* diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c -index 395be6d..c8eae1c 100644 +index 6828765..5f10db9 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -885,7 +885,7 @@ static int do_boot_cpu(int apicid, int cpu, struct task_struct *idle) @@ -4626,10 +4647,28 @@ index 395be6d..c8eae1c 100644 while (!cpu_online(cpu)) { cpu_relax(); diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c -index 57409f6..c086b59 100644 +index f9d976e..19b33b5 100644 --- a/arch/x86/kernel/traps.c +++ b/arch/x86/kernel/traps.c -@@ -622,6 +622,7 @@ asmlinkage void __attribute__((weak)) smp_threshold_interrupt(void) +@@ -102,7 +102,16 @@ static inline void conditional_cli(struct pt_regs *regs) + static inline void preempt_conditional_cli(struct pt_regs *regs) + { + if (regs->flags & X86_EFLAGS_IF) +- local_irq_disable(); ++ /* ++ * I-pipe doesn't virtualize the IRQ flags in the entry code. ++ * Therefore we cannot call the original local_irq_disable here ++ * because there will be no pairing IRQ enable for the root ++ * domain. So just disable interrupts physically. ++ * ++ * There is also no I-pipe hard-irq tracing on return from the ++ * exception, so do not trace here either. ++ */ ++ hard_local_irq_disable_notrace(); + preempt_count_dec(); + } + +@@ -659,6 +668,7 @@ asmlinkage void __attribute__((weak)) smp_threshold_interrupt(void) void math_state_restore(void) { struct task_struct *tsk = current; @@ -4637,7 +4676,7 @@ index 57409f6..c086b59 100644 if (!tsk_used_math(tsk)) { local_irq_enable(); -@@ -638,6 +639,7 @@ void math_state_restore(void) +@@ -675,6 +685,7 @@ void math_state_restore(void) local_irq_disable(); } @@ -4645,7 +4684,7 @@ index 57409f6..c086b59 100644 __thread_fpu_begin(tsk); /* -@@ -645,11 +647,13 @@ void math_state_restore(void) +@@ -682,11 +693,13 @@ void math_state_restore(void) */ if (unlikely(restore_fpu_checking(tsk))) { drop_init_fpu(tsk); @@ -4659,7 +4698,7 @@ index 57409f6..c086b59 100644 } EXPORT_SYMBOL_GPL(math_state_restore); -@@ -705,9 +709,14 @@ dotraplinkage void do_iret_error(struct pt_regs *regs, long error_code) +@@ -742,9 +755,14 @@ dotraplinkage void do_iret_error(struct pt_regs *regs, long error_code) /* Set of traps needed for early debugging. */ void __init early_trap_init(void) { @@ -4675,7 +4714,7 @@ index 57409f6..c086b59 100644 set_intr_gate(X86_TRAP_PF, page_fault); #endif diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c -index e0d1d7a..3d7d935 100644 +index de02906..63c0889 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c @@ -652,15 +652,15 @@ unsigned long native_calibrate_tsc(void) @@ -4765,7 +4804,7 @@ index e8edcf5..0a93042 100644 tsk->thread.screen_bitmap = info->screen_bitmap; if (info->flags & VM86_SCREEN_BITMAP) diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c -index 1f96f93..2f54855 100644 +index 09ce23a..a94e116 100644 --- a/arch/x86/kernel/vsyscall_64.c +++ b/arch/x86/kernel/vsyscall_64.c @@ -32,6 +32,7 @@ @@ -4787,10 +4826,10 @@ index 1f96f93..2f54855 100644 static void warn_bad_vsyscall(const char *level, struct pt_regs *regs, diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c -index a4b451c..937f8ee 100644 +index dd50e26..e2def56 100644 --- a/arch/x86/kernel/xsave.c +++ b/arch/x86/kernel/xsave.c -@@ -562,6 +562,10 @@ static void __init xstate_enable_boot_cpu(void) +@@ -563,6 +563,10 @@ static void __init xstate_enable_boot_cpu(void) if (cpu_has_xsaveopt && eagerfpu != DISABLE) eagerfpu = ENABLE; @@ -4802,7 +4841,7 @@ index a4b451c..937f8ee 100644 if (eagerfpu == DISABLE) { pr_err("eagerfpu not present, disabling some xstate features: 0x%llx\n", diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c -index 2de1bc0..d105f9a 100644 +index 9643eda6..7fdc371 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -3827,7 +3827,7 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu) @@ -4832,7 +4871,7 @@ index 2de1bc0..d105f9a 100644 } diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c -index 3927528..3674c63 100644 +index 0c90f4b..ab0f47b 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -1758,9 +1758,11 @@ static void __vmx_load_host_state(struct vcpu_vmx *vmx) @@ -4865,7 +4904,7 @@ index 3927528..3674c63 100644 if (cpu_has_vmx_msr_bitmap()) vmx_set_msr_bitmap(&vmx->vcpu); -@@ -7048,8 +7052,10 @@ static void vmx_handle_external_intr(struct kvm_vcpu *vcpu) +@@ -7058,8 +7062,10 @@ static void vmx_handle_external_intr(struct kvm_vcpu *vcpu) [ss]"i"(__KERNEL_DS), [cs]"i"(__KERNEL_CS) ); @@ -4877,7 +4916,7 @@ index 3927528..3674c63 100644 } static void vmx_recover_nmi_blocking(struct vcpu_vmx *vmx) -@@ -7420,7 +7426,9 @@ static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id) +@@ -7430,7 +7436,9 @@ static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id) vmx_vcpu_load(&vmx->vcpu, cpu); vmx->vcpu.cpu = cpu; err = vmx_vcpu_setup(vmx); @@ -4887,7 +4926,7 @@ index 3927528..3674c63 100644 put_cpu(); if (err) goto free_vmcs; -@@ -7443,6 +7451,9 @@ static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id) +@@ -7453,6 +7461,9 @@ static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id) vmx->nested.current_vmptr = -1ull; vmx->nested.current_vmcs12 = NULL; @@ -4898,7 +4937,7 @@ index 3927528..3674c63 100644 return &vmx->vcpu; diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c -index 8fbd1a7..08cccd1 100644 +index fab97ad..a328a06 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -39,6 +39,7 @@ @@ -4963,15 +5002,15 @@ index 8fbd1a7..08cccd1 100644 } static void shared_msr_update(unsigned slot, u32 msr) -@@ -234,6 +250,7 @@ void kvm_set_shared_msr(unsigned slot, u64 value, u64 mask) - return; - smsr->values[slot].curr = value; - wrmsrl(shared_msrs_global.msrs[slot], value); +@@ -237,6 +253,7 @@ int kvm_set_shared_msr(unsigned slot, u64 value, u64 mask) + err = wrmsrl_safe(shared_msrs_global.msrs[slot], value); + if (err) + return 1; + smsr->dirty = true; + if (!smsr->registered) { smsr->urn.on_user_return = kvm_on_user_return; - user_return_notifier_register(&smsr->urn); -@@ -2793,11 +2810,39 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) +@@ -2823,11 +2840,39 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) { @@ -5011,7 +5050,7 @@ index 8fbd1a7..08cccd1 100644 static int kvm_vcpu_ioctl_get_lapic(struct kvm_vcpu *vcpu, struct kvm_lapic_state *s) { -@@ -5952,6 +5997,10 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) +@@ -5982,6 +6027,10 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) } preempt_disable(); @@ -5022,7 +5061,7 @@ index 8fbd1a7..08cccd1 100644 kvm_x86_ops->prepare_guest_switch(vcpu); if (vcpu->fpu_active) -@@ -5967,12 +6016,11 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) +@@ -5997,12 +6046,11 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) */ smp_mb__after_srcu_read_unlock(); @@ -5578,18 +5617,18 @@ index 612dfc7..ffd8160 100644 .probe = serial8250_probe, .remove = serial8250_remove, diff --git a/fs/exec.c b/fs/exec.c -index 31e46b1..424e32a 100644 +index ea4449d..aa73a12 100644 --- a/fs/exec.c +++ b/fs/exec.c -@@ -821,6 +821,7 @@ static int exec_mmap(struct mm_struct *mm) +@@ -822,6 +822,7 @@ static int exec_mmap(struct mm_struct *mm) { struct task_struct *tsk; - struct mm_struct * old_mm, *active_mm; + struct mm_struct *old_mm, *active_mm; + unsigned long flags; /* Notify parent that we're no longer interested in the old VM */ tsk = current; -@@ -844,8 +845,10 @@ static int exec_mmap(struct mm_struct *mm) +@@ -845,8 +846,10 @@ static int exec_mmap(struct mm_struct *mm) task_lock(tsk); active_mm = tsk->active_mm; tsk->mm = mm; @@ -5597,9 +5636,9 @@ index 31e46b1..424e32a 100644 tsk->active_mm = mm; activate_mm(active_mm, mm); + ipipe_mm_switch_unprotect(flags); + tsk->mm->vmacache_seqnum = 0; + vmacache_flush(tsk); task_unlock(tsk); - if (old_mm) { - up_read(&old_mm->mmap_sem); diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h index 33bd2de..f752d41 100644 --- a/include/asm-generic/atomic.h @@ -5826,7 +5865,7 @@ index 493aa02..cb59b28 100644 /* diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h -index 67301a4..2562bfd 100644 +index 879065d..120fd3f 100644 --- a/include/linux/clocksource.h +++ b/include/linux/clocksource.h @@ -198,6 +198,10 @@ struct clocksource { @@ -8223,7 +8262,7 @@ index 5b9b84b..6c8bb4d 100644 static inline void __raw_read_lock(rwlock_t *lock) { diff --git a/include/linux/sched.h b/include/linux/sched.h -index ccd0c6f..2591dfc 100644 +index 218b058..d579687 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -24,6 +24,7 @@ struct sched_param { @@ -8234,7 +8273,7 @@ index ccd0c6f..2591dfc 100644 #include <asm/page.h> #include <asm/ptrace.h> -@@ -211,9 +212,17 @@ print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq); +@@ -215,9 +216,17 @@ print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq); #define TASK_WAKEKILL 128 #define TASK_WAKING 256 #define TASK_PARKED 512 @@ -8253,7 +8292,7 @@ index ccd0c6f..2591dfc 100644 extern char ___assert_task_state[1 - 2*!!( sizeof(TASK_STATE_TO_CHAR_STR)-1 != ilog2(TASK_STATE_MAX)+1)]; -@@ -325,6 +334,15 @@ extern void trap_init(void); +@@ -329,6 +338,15 @@ extern void trap_init(void); extern void update_process_times(int user); extern void scheduler_tick(void); @@ -8269,7 +8308,7 @@ index ccd0c6f..2591dfc 100644 extern void sched_show_task(struct task_struct *p); #ifdef CONFIG_LOCKUP_DETECTOR -@@ -445,6 +463,9 @@ static inline int get_dumpable(struct mm_struct *mm) +@@ -449,6 +467,9 @@ static inline int get_dumpable(struct mm_struct *mm) #define MMF_VM_MERGEABLE 16 /* KSM may merge identical pages */ #define MMF_VM_HUGEPAGE 17 /* set when VM_HUGEPAGE is set on vma */ #define MMF_EXE_FILE_CHANGED 18 /* see prctl_set_mm_exe_file() */ @@ -8279,7 +8318,7 @@ index ccd0c6f..2591dfc 100644 #define MMF_HAS_UPROBES 19 /* has uprobes */ #define MMF_RECALC_UPROBES 20 /* MMF_HAS_UPROBES can be wrong */ -@@ -1505,6 +1526,9 @@ struct task_struct { +@@ -1512,6 +1533,9 @@ struct task_struct { #endif /* CONFIG_NUMA_BALANCING */ struct rcu_head rcu; @@ -8289,7 +8328,7 @@ index ccd0c6f..2591dfc 100644 /* * cache last used pipe for splice -@@ -1688,7 +1712,7 @@ static inline pid_t task_tgid_vnr(struct task_struct *tsk) +@@ -1695,7 +1719,7 @@ static inline pid_t task_tgid_vnr(struct task_struct *tsk) } @@ -8642,7 +8681,7 @@ index 36fb3b5..3b5e2dc6 100644 * and other sensitive information are never written to disk. */ diff --git a/init/Kconfig b/init/Kconfig -index 93c5ef0..8a9e969 100644 +index 8b9521a..687345a 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -69,6 +69,7 @@ config COMPILE_TEST @@ -8729,10 +8768,10 @@ index 6cb20d2..a40b3ee 100644 if (in_interrupt()) diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c -index 334b398..fb27489 100644 +index 8865cae..9ea1c51 100644 --- a/kernel/debug/debug_core.c +++ b/kernel/debug/debug_core.c -@@ -114,8 +114,8 @@ static struct kgdb_bkpt kgdb_break[KGDB_MAX_BREAKPOINTS] = { +@@ -115,8 +115,8 @@ static struct kgdb_bkpt kgdb_break[KGDB_MAX_BREAKPOINTS] = { */ atomic_t kgdb_active = ATOMIC_INIT(-1); EXPORT_SYMBOL_GPL(kgdb_active); @@ -8743,7 +8782,7 @@ index 334b398..fb27489 100644 /* * We use NR_CPUs not PERCPU, in case kgdb is used to debug early -@@ -165,19 +165,21 @@ int __weak kgdb_arch_set_breakpoint(struct kgdb_bkpt *bpt) +@@ -166,19 +166,21 @@ int __weak kgdb_arch_set_breakpoint(struct kgdb_bkpt *bpt) { int err; @@ -8771,7 +8810,7 @@ index 334b398..fb27489 100644 } int __weak kgdb_validate_break_address(unsigned long addr) -@@ -450,7 +452,9 @@ static int kgdb_reenter_check(struct kgdb_state *ks) +@@ -458,7 +460,9 @@ static int kgdb_reenter_check(struct kgdb_state *ks) static void dbg_touch_watchdogs(void) { touch_softlockup_watchdog_sync(); @@ -8781,7 +8820,7 @@ index 334b398..fb27489 100644 rcu_cpu_stall_reset(); } -@@ -480,7 +484,7 @@ acquirelock: +@@ -488,7 +492,7 @@ acquirelock: * Interrupts will be restored by the 'trap return' code, except when * single stepping. */ @@ -8790,7 +8829,7 @@ index 334b398..fb27489 100644 cpu = ks->cpu; kgdb_info[cpu].debuggerinfo = regs; -@@ -529,7 +533,7 @@ return_normal: +@@ -537,7 +541,7 @@ return_normal: smp_mb__before_atomic_dec(); atomic_dec(&slaves_in_kgdb); dbg_touch_watchdogs(); @@ -8799,7 +8838,7 @@ index 334b398..fb27489 100644 return 0; } cpu_relax(); -@@ -547,7 +551,7 @@ return_normal: +@@ -555,7 +559,7 @@ return_normal: atomic_set(&kgdb_active, -1); raw_spin_unlock(&dbg_master_lock); dbg_touch_watchdogs(); @@ -8808,7 +8847,7 @@ index 334b398..fb27489 100644 goto acquirelock; } -@@ -660,7 +664,7 @@ kgdb_restore: +@@ -668,7 +672,7 @@ kgdb_restore: atomic_set(&kgdb_active, -1); raw_spin_unlock(&dbg_master_lock); dbg_touch_watchdogs(); @@ -8817,7 +8856,7 @@ index 334b398..fb27489 100644 return kgdb_info[cpu].ret_state; } -@@ -771,9 +775,9 @@ static void kgdb_console_write(struct console *co, const char *s, +@@ -779,9 +783,9 @@ static void kgdb_console_write(struct console *co, const char *s, if (!kgdb_connected || atomic_read(&kgdb_active) != -1 || dbg_kdb_mode) return; @@ -8873,10 +8912,10 @@ index 81b3d67..b5c92de 100644 if (unlikely(in_atomic())) printk(KERN_INFO "note: %s[%d] exited with preempt_count %d\n", diff --git a/kernel/fork.c b/kernel/fork.c -index c44bff8..5f85965 100644 +index e2c6853..68c5ef5a 100644 --- a/kernel/fork.c +++ b/kernel/fork.c -@@ -313,6 +313,8 @@ static struct task_struct *dup_task_struct(struct task_struct *orig) +@@ -315,6 +315,8 @@ static struct task_struct *dup_task_struct(struct task_struct *orig) tsk->stack = ti; setup_thread_stack(tsk, orig); @@ -8885,7 +8924,7 @@ index c44bff8..5f85965 100644 clear_user_return_notifier(tsk); clear_tsk_need_resched(tsk); stackend = end_of_stack(tsk); -@@ -610,6 +612,7 @@ void mmput(struct mm_struct *mm) +@@ -612,6 +614,7 @@ void mmput(struct mm_struct *mm) exit_aio(mm); ksm_exit(mm); khugepaged_exit(mm); /* must run before exit_mmap */ @@ -8893,7 +8932,7 @@ index c44bff8..5f85965 100644 exit_mmap(mm); set_mm_exe_file(mm, NULL); if (!list_empty(&mm->mmlist)) { -@@ -1491,6 +1494,7 @@ static struct task_struct *copy_process(unsigned long clone_flags, +@@ -1496,6 +1499,7 @@ static struct task_struct *copy_process(unsigned long clone_flags, cgroup_post_fork(p); if (clone_flags & CLONE_THREAD) threadgroup_change_end(current); @@ -9081,7 +9120,7 @@ index 0000000..c3ffe63 +obj-$(CONFIG_IPIPE_LEGACY) += compat.o diff --git a/kernel/ipipe/compat.c b/kernel/ipipe/compat.c new file mode 100644 -index 0000000..da3183f +index 0000000..797a849 --- /dev/null +++ b/kernel/ipipe/compat.c @@ -0,0 +1,273 @@ @@ -9354,7 +9393,7 @@ index 0000000..da3183f + } +} + -+notrace int __ipipe_check_root(void) /* hw IRQs off */ ++notrace asmlinkage int __ipipe_check_root(void) /* hw IRQs off */ +{ + return __ipipe_root_p; +} @@ -13835,10 +13874,20 @@ index ebb8a9e..aeeefa9 100644 out_unlock: raw_spin_unlock_irq(&desc->lock); diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c -index eb8a547..e24bb30 100644 +index eb8a547..2ffcbfd 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c -@@ -2579,7 +2579,7 @@ void trace_hardirqs_on_caller(unsigned long ip) +@@ -2559,6 +2559,9 @@ static void __trace_hardirqs_on_caller(unsigned long ip) + + void trace_hardirqs_on_caller(unsigned long ip) + { ++ if (!ipipe_root_p) ++ return; ++ + time_hardirqs_on(CALLER_ADDR0, ip); + + if (unlikely(!debug_locks || current->lockdep_recursion)) +@@ -2579,7 +2582,7 @@ void trace_hardirqs_on_caller(unsigned long ip) * already enabled, yet we find the hardware thinks they are in fact * enabled.. someone messed up their IRQ state tracing. */ @@ -13847,7 +13896,21 @@ index eb8a547..e24bb30 100644 return; /* -@@ -2623,7 +2623,7 @@ void trace_hardirqs_off_caller(unsigned long ip) +@@ -2612,7 +2615,12 @@ EXPORT_SYMBOL(trace_hardirqs_on); + */ + void trace_hardirqs_off_caller(unsigned long ip) + { +- struct task_struct *curr = current; ++ struct task_struct *curr; ++ ++ if (!ipipe_root_p) ++ return; ++ ++ curr = current; + + time_hardirqs_off(CALLER_ADDR0, ip); + +@@ -2623,7 +2631,7 @@ void trace_hardirqs_off_caller(unsigned long ip) * So we're supposed to get called after you mask local IRQs, but for * some reason the hardware doesn't quite think you did a proper job. */ @@ -13856,7 +13919,7 @@ index eb8a547..e24bb30 100644 return; if (curr->hardirqs_enabled) { -@@ -2659,7 +2659,7 @@ void trace_softirqs_on(unsigned long ip) +@@ -2659,7 +2667,7 @@ void trace_softirqs_on(unsigned long ip) * We fancy IRQs being disabled here, see softirq.c, avoids * funny state and nesting things. */ @@ -13865,7 +13928,7 @@ index eb8a547..e24bb30 100644 return; if (curr->softirqs_enabled) { -@@ -2698,7 +2698,7 @@ void trace_softirqs_off(unsigned long ip) +@@ -2698,7 +2706,7 @@ void trace_softirqs_off(unsigned long ip) /* * We fancy IRQs being disabled here, see softirq.c */ @@ -13890,7 +13953,7 @@ index 4b082b5..67447fc 100644 * The __lock_function inlines are taken from * include/linux/spinlock_api_smp.h diff --git a/kernel/module.c b/kernel/module.c -index 6716a1f..5a1cc7e 100644 +index 1d679a6..d452bce 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -879,7 +879,7 @@ static inline void print_unload_info(struct seq_file *m, struct module *mod) @@ -13953,7 +14016,7 @@ index 6716a1f..5a1cc7e 100644 const unsigned long *crc, const struct module *crc_owner) { -@@ -2252,7 +2252,7 @@ static char elf_type(const Elf_Sym *sym, const struct load_info *info) +@@ -2254,7 +2254,7 @@ static char elf_type(const Elf_Sym *sym, const struct load_info *info) } static bool is_core_symbol(const Elf_Sym *src, const Elf_Shdr *sechdrs, @@ -13962,7 +14025,7 @@ index 6716a1f..5a1cc7e 100644 { const Elf_Shdr *sec; -@@ -3035,7 +3035,7 @@ static int do_init_module(struct module *mod) +@@ -3037,7 +3037,7 @@ static int do_init_module(struct module *mod) ret = do_one_initcall(mod->init); if (ret < 0) { /* Init routine failed: abort. Try to protect us from @@ -13971,7 +14034,7 @@ index 6716a1f..5a1cc7e 100644 mod->state = MODULE_STATE_GOING; synchronize_sched(); module_put(mod); -@@ -3170,7 +3170,7 @@ out: +@@ -3172,7 +3172,7 @@ out: static int unknown_module_param_cb(char *param, char *val, const char *modname) { @@ -14002,7 +14065,7 @@ index 6d63003..2a26737 100644 do_oops_enter_exit(); } diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c -index 37170d4..fac5ec6 100644 +index 126586a..f10614c 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c @@ -275,6 +275,7 @@ static int create_image(int platform_mode) @@ -14021,7 +14084,7 @@ index 37170d4..fac5ec6 100644 error = syscore_suspend(); if (error) -@@ -543,6 +545,7 @@ int hibernation_platform_enter(void) +@@ -549,6 +551,7 @@ int hibernation_platform_enter(void) goto Platform_finish; local_irq_disable(); @@ -14162,7 +14225,7 @@ index b30a292..27376a0 100644 return sched_clock(); diff --git a/kernel/sched/core.c b/kernel/sched/core.c -index 515e212..8328320 100644 +index 9a3f3c4..e745ea9 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -1520,7 +1520,9 @@ void scheduler_ipi(void) @@ -14195,7 +14258,7 @@ index 515e212..8328320 100644 goto out; success = 1; /* we're going to change ->state */ -@@ -2210,6 +2215,8 @@ asmlinkage void schedule_tail(struct task_struct *prev) +@@ -2214,6 +2219,8 @@ asmlinkage void schedule_tail(struct task_struct *prev) { struct rq *rq = this_rq(); @@ -14204,7 +14267,7 @@ index 515e212..8328320 100644 finish_task_switch(rq, prev); /* -@@ -2230,7 +2237,7 @@ asmlinkage void schedule_tail(struct task_struct *prev) +@@ -2234,7 +2241,7 @@ asmlinkage void schedule_tail(struct task_struct *prev) * context_switch - switch to the new MM and the new * thread's register state. */ @@ -14213,7 +14276,7 @@ index 515e212..8328320 100644 context_switch(struct rq *rq, struct task_struct *prev, struct task_struct *next) { -@@ -2273,12 +2280,18 @@ context_switch(struct rq *rq, struct task_struct *prev, +@@ -2277,12 +2284,18 @@ context_switch(struct rq *rq, struct task_struct *prev, switch_to(prev, next, prev); barrier(); @@ -14232,7 +14295,7 @@ index 515e212..8328320 100644 } /* -@@ -2495,6 +2508,7 @@ notrace unsigned long get_parent_ip(unsigned long addr) +@@ -2499,6 +2512,7 @@ notrace unsigned long get_parent_ip(unsigned long addr) void __kprobes preempt_count_add(int val) { @@ -14240,7 +14303,7 @@ index 515e212..8328320 100644 #ifdef CONFIG_DEBUG_PREEMPT /* * Underflow? -@@ -2517,6 +2531,7 @@ EXPORT_SYMBOL(preempt_count_add); +@@ -2521,6 +2535,7 @@ EXPORT_SYMBOL(preempt_count_add); void __kprobes preempt_count_sub(int val) { @@ -14248,7 +14311,7 @@ index 515e212..8328320 100644 #ifdef CONFIG_DEBUG_PREEMPT /* * Underflow? -@@ -2563,6 +2578,7 @@ static noinline void __schedule_bug(struct task_struct *prev) +@@ -2567,6 +2582,7 @@ static noinline void __schedule_bug(struct task_struct *prev) */ static inline void schedule_debug(struct task_struct *prev) { @@ -14256,7 +14319,7 @@ index 515e212..8328320 100644 /* * Test if we are atomic. Since do_exit() needs to call into * schedule() atomically, we ignore that path. Otherwise whine -@@ -2649,7 +2665,7 @@ pick_next_task(struct rq *rq) +@@ -2653,7 +2669,7 @@ pick_next_task(struct rq *rq) * - return from syscall or exception to user-space * - return from interrupt-handler to user-space */ @@ -14265,7 +14328,7 @@ index 515e212..8328320 100644 { struct task_struct *prev, *next; unsigned long *switch_count; -@@ -2663,6 +2679,10 @@ need_resched: +@@ -2667,6 +2683,10 @@ need_resched: rcu_note_context_switch(cpu); prev = rq->curr; @@ -14276,7 +14339,7 @@ index 515e212..8328320 100644 schedule_debug(prev); if (sched_feat(HRTICK)) -@@ -2716,7 +2736,8 @@ need_resched: +@@ -2720,7 +2740,8 @@ need_resched: rq->curr = next; ++*switch_count; @@ -14286,7 +14349,7 @@ index 515e212..8328320 100644 /* * The context switch have flipped the stack from under us * and restored the local variables which were saved when -@@ -2725,14 +2746,18 @@ need_resched: +@@ -2729,14 +2750,18 @@ need_resched: */ cpu = smp_processor_id(); rq = cpu_rq(cpu); @@ -14306,7 +14369,7 @@ index 515e212..8328320 100644 } static inline void sched_submit_work(struct task_struct *tsk) -@@ -2795,12 +2820,13 @@ asmlinkage void __sched notrace preempt_schedule(void) +@@ -2799,12 +2824,13 @@ asmlinkage void __sched notrace preempt_schedule(void) * If there is a non-zero preempt_count or interrupts are disabled, * we do not want to preempt the current task. Just return.. */ @@ -14322,7 +14385,7 @@ index 515e212..8328320 100644 __preempt_count_sub(PREEMPT_ACTIVE); /* -@@ -3487,6 +3513,7 @@ change: +@@ -3491,6 +3517,7 @@ change: oldprio = p->prio; prev_class = p->sched_class; __setscheduler(rq, p, attr); @@ -14330,7 +14393,7 @@ index 515e212..8328320 100644 if (running) p->sched_class->set_curr_task(rq); -@@ -4579,10 +4606,13 @@ int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask) +@@ -4585,10 +4612,13 @@ int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask) do_set_cpus_allowed(p, new_mask); /* Can the task run on the task's current CPU? If so, we're done */ @@ -14345,7 +14408,7 @@ index 515e212..8328320 100644 if (p->on_rq) { struct migration_arg arg = { p, dest_cpu }; /* Need help from migration thread: drop lock and wait. */ -@@ -8014,3 +8044,42 @@ void dump_cpu_task(int cpu) +@@ -8026,3 +8056,42 @@ void dump_cpu_task(int cpu) pr_info("Task dump for CPU %d:\n", cpu); sched_show_task(cpu_curr(cpu)); } @@ -14753,10 +14816,10 @@ index e3be87e..e6a7b54 100644 /* ftrace_dyn_arch_init places the return code in addr */ if (addr) diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c -index 0954450..ae5f070 100644 +index 774a080..8b2f9dd 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c -@@ -2637,7 +2637,8 @@ static DEFINE_PER_CPU(unsigned int, current_context); +@@ -2651,7 +2651,8 @@ static DEFINE_PER_CPU(unsigned int, current_context); static __always_inline int trace_recursive_lock(void) { @@ -14766,7 +14829,7 @@ index 0954450..ae5f070 100644 int bit; if (in_interrupt()) { -@@ -2650,22 +2651,35 @@ static __always_inline int trace_recursive_lock(void) +@@ -2664,22 +2665,35 @@ static __always_inline int trace_recursive_lock(void) } else bit = 3; @@ -14923,6 +14986,43 @@ index 0b99120..d8e64ea 100644 } void set_graph_array(struct trace_array *tr) +diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c +index 2aefbee..c3ec43f 100644 +--- a/kernel/trace/trace_irqsoff.c ++++ b/kernel/trace/trace_irqsoff.c +@@ -486,28 +486,28 @@ inline void print_irqtrace_events(struct task_struct *curr) + */ + void trace_hardirqs_on(void) + { +- if (!preempt_trace() && irq_trace()) ++ if (ipipe_root_p && !preempt_trace() && irq_trace()) + stop_critical_timing(CALLER_ADDR0, CALLER_ADDR1); + } + EXPORT_SYMBOL(trace_hardirqs_on); + + void trace_hardirqs_off(void) + { +- if (!preempt_trace() && irq_trace()) ++ if (ipipe_root_p && !preempt_trace() && irq_trace()) + start_critical_timing(CALLER_ADDR0, CALLER_ADDR1); + } + EXPORT_SYMBOL(trace_hardirqs_off); + + void trace_hardirqs_on_caller(unsigned long caller_addr) + { +- if (!preempt_trace() && irq_trace()) ++ if (ipipe_root_p && !preempt_trace() && irq_trace()) + stop_critical_timing(CALLER_ADDR0, caller_addr); + } + EXPORT_SYMBOL(trace_hardirqs_on_caller); + + void trace_hardirqs_off_caller(unsigned long caller_addr) + { +- if (!preempt_trace() && irq_trace()) ++ if (ipipe_root_p && !preempt_trace() && irq_trace()) + start_critical_timing(CALLER_ADDR0, caller_addr); + } + EXPORT_SYMBOL(trace_hardirqs_off_caller); diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index a48abea..50cc0312 100644 --- a/lib/Kconfig.debug @@ -15144,7 +15244,7 @@ index 0862816..aacbf2df 100644 help Transparent Hugepages allows the kernel to use huge pages and diff --git a/mm/memory.c b/mm/memory.c -index 2121d8b8..84ce8f7 100644 +index 48d7365..e23fa86 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -788,6 +788,34 @@ out: @@ -15383,10 +15483,10 @@ index b1eb536..ca23f83 100644 +} +#endif diff --git a/mm/mmap.c b/mm/mmap.c -index 20ff0c3..0ad7309 100644 +index b91ac80..47ee8c0 100644 --- a/mm/mmap.c +++ b/mm/mmap.c -@@ -44,6 +44,10 @@ +@@ -45,6 +45,10 @@ #include "internal.h" @@ -15397,7 +15497,7 @@ index 20ff0c3..0ad7309 100644 #ifndef arch_mmap_check #define arch_mmap_check(addr, len, flags) (0) #endif -@@ -2606,7 +2610,7 @@ static unsigned long do_brk(unsigned long addr, unsigned long len) +@@ -2613,7 +2617,7 @@ static unsigned long do_brk(unsigned long addr, unsigned long len) flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags; _______________________________________________ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git