task_hijacked, prepare_arch_switch and irq disabling
Hi Philippe,
a customer just stumbled over some unclear spots in current I-pipe patches:
Why is there local_irq_enable_hw in task_hijacked? Looks like it was once paired with prepare_arch_switch, but that call is now only used by legacy 2.4 PPC. Can we safely drop it from all other patches (it's in the context switch fast-path...)? Moreover, I bet the ENABLE_INTERRUPTS_HW_COND in entry_32.S' ret_from_fork is related to this as well, right?
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2 Corporate Competence Center Embedded Linux
Quoted 7 lines · Jan Kiszka
Hi Philippe,
a customer just stumbled over some unclear spots in current I-pipe patches:
Why is there
local_irq_enable_hwintask_hijacked? Looks like it was once paired withprepare_arch_switch, but that call is now only used by legacy 2.4 PPC.
It is still used in all trees, since we define it in asm/ipipe.h. We could not context switch properly on the linux side with hw interrupts on anyway, due to the conflicts that would raise with Xenomai's tasking code.
Quoted 2 lines
Can we safely drop it from all other patches (it's in
the context switch fast-path...)?
No, since prepare_arch_switch() is still applicable.
Quoted 3 lines
Moreover, I bet the
ENABLE_INTERRUPTS_HW_CONDinentry_32.S'ret_from_forkis related to this as well, right?
No, it's there to prevent the scheduling tail from running hw IRQs off, given that copy_thread() may set a copy for eflags which prevents preemption.
Quoted 3 lines
Jan
Signature · 1 line
Philippe.
Quoted 19 lines · Philippe Gerum
Quoted 7 lines · Jan Kiszka
Hi Philippe,
a customer just stumbled over some unclear spots in current I-pipe patches:
Why is there
local_irq_enable_hwintask_hijacked? Looks like it was once paired withprepare_arch_switch, but that call is now only used by legacy 2.4 PPC.It is still used in all trees, since we define it in
asm/ipipe.h. We could not context switch properly on the linux side with hw interrupts on anyway, due to the conflicts that would raise with Xenomai's tasking code.Quoted 2 lines
Can we safely drop it from all other patches (it's in
the context switch fast-path...)?No, since
prepare_arch_switch()is still applicable.
Quoted 7 lines
Quoted 3 lines
Moreover, I bet the
ENABLE_INTERRUPTS_HW_CONDinentry_32.S'ret_from_forkis related to this as well, right?No, it's there to prevent the scheduling tail from running hw IRQs off, given that
copy_thread()may set a copy for eflags which prevents preemption.
Forget about this one, this does not apply to x86 anymore. So the answer to this question is rather: that used to be required on x86 a long time ago due to the implementation of the task switching code in system.h (2.4 era IIRC); but in any case, yes, this is still required for the reasons explained above, since we must run the switch code with hw IRQs off.
Quoted 6 lines
Quoted 4 lines
Jan
Signature · 1 line
Philippe.
Quoted 25 lines · Philippe Gerum
Quoted 15 lines · Philippe Gerum
Quoted 7 lines · Jan Kiszka
Hi Philippe,
a customer just stumbled over some unclear spots in current I-pipe patches:
Why is there
local_irq_enable_hwintask_hijacked? Looks like it was once paired withprepare_arch_switch, but that call is now only used by legacy 2.4 PPC.It is still used in all trees, since we define it in
asm/ipipe.h. We could not context switch properly on the linux side with hw interrupts on anyway, due to the conflicts that would raise with Xenomai's tasking code.Quoted 2 lines
Can we safely drop it from all other patches (it's in
the context switch fast-path...)?Quoted 8 lines
No, since
prepare_arch_switch()is still applicable.Quoted 3 lines
Moreover, I bet the
ENABLE_INTERRUPTS_HW_CONDinentry_32.S'ret_from_forkis related to this as well, right?No, it's there to prevent the scheduling tail from running hw IRQs off, given that
copy_thread()may set a copy for eflags which prevents preemption.
Quoted 6 lines
Forget about this one, this does not apply to x86 anymore. So the answer to this question is rather: that used to be required on x86 a long time ago due to the implementation of the task switching code in
system.h(2.4 era IIRC); but in any case, yes, this is still required for the reasons explained above, since we must run the switch code with hw IRQs off.
Still can't follow: Where is prepare_arch_switch referenced? My dumb approach to do a text search over the ipipe patch and Xenomai failed to find that spot. And then the question: How is disabling the IRQs that task_hijacked reenables?
Thanks,
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2 Corporate Competence Center Embedded Linux
Quoted 26 lines · Jan Kiszka
Quoted 25 lines · Philippe Gerum
Quoted 23 lines · Philippe Gerum
Quoted 7 lines · Jan Kiszka
Hi Philippe,
a customer just stumbled over some unclear spots in current I-pipe patches:
Why is there
local_irq_enable_hwintask_hijacked? Looks like it was once paired withprepare_arch_switch, but that call is now only used by legacy 2.4 PPC.It is still used in all trees, since we define it in
asm/ipipe.h. We could not context switch properly on the linux side with hw interrupts on anyway, due to the conflicts that would raise with Xenomai's tasking code.Quoted 2 lines
Can we safely drop it from all other patches (it's in
the context switch fast-path...)?No, since
prepare_arch_switch()is still applicable.Quoted 3 lines
Moreover, I bet the
ENABLE_INTERRUPTS_HW_CONDinentry_32.S'ret_from_forkis related to this as well, right?No, it's there to prevent the scheduling tail from running hw IRQs off, given that
copy_thread()may set a copy for eflags which prevents preemption.
Quoted 8 lines
Quoted 6 lines
Forget about this one, this does not apply to x86 anymore. So the answer to this question is rather: that used to be required on x86 a long time ago due to the implementation of the task switching code in
system.h(2.4 era IIRC); but in any case, yes, this is still required for the reasons explained above, since we must run the switch code with hw IRQs off.Still can't follow: Where is
prepare_arch_switchreferenced?
prepare_task_switch(), kernel/sched.c
Quoted 8 lines
My dumb
approach to do a text search over the ipipe patch and Xenomai failed to find that spot. And then the question: How is disabling the IRQs thattask_hijackedreenables?Thanks,
Jan
Signature · 1 line
Philippe.
Quoted 32 lines · Philippe Gerum
Quoted 31 lines · Jan Kiszka
Quoted 30 lines · Philippe Gerum
Quoted 15 lines · Philippe Gerum
Quoted 7 lines · Jan Kiszka
Hi Philippe,
a customer just stumbled over some unclear spots in current I-pipe patches:
Why is there
local_irq_enable_hwintask_hijacked? Looks like it was once paired withprepare_arch_switch, but that call is now only used by legacy 2.4 PPC.It is still used in all trees, since we define it in
asm/ipipe.h. We could not context switch properly on the linux side with hw interrupts on anyway, due to the conflicts that would raise with Xenomai's tasking code.Quoted 2 lines
Can we safely drop it from all other patches (it's in
the context switch fast-path...)?Quoted 8 lines
No, since
prepare_arch_switch()is still applicable.Quoted 3 lines
Moreover, I bet the
ENABLE_INTERRUPTS_HW_CONDinentry_32.S'ret_from_forkis related to this as well, right?No, it's there to prevent the scheduling tail from running hw IRQs off, given that
copy_thread()may set a copy for eflags which prevents preemption.Forget about this one, this does not apply to x86 anymore. So the answer to this question is rather: that used to be required on x86 a long time ago due to the implementation of the task switching code in
system.h(2.4 era IIRC); but in any case, yes, this is still required for the reasons explained above, since we must run the switch code with hw IRQs off.
Quoted 3 lines
Quoted 1 line
Still can't follow: Where is
prepare_arch_switchreferenced?
prepare_task_switch(),kernel/sched.c
Ah, this is mainline! Thought is was an ipipe extension.
OK, thanks, clear now: prepare_task_switch pairs with enabling in task_hijacked & ret_from_fork.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2 Corporate Competence Center Embedded Linux
Quoted 33 lines · Jan Kiszka
Quoted 32 lines · Philippe Gerum
Quoted 31 lines · Jan Kiszka
Quoted 30 lines · Philippe Gerum
Quoted 15 lines · Philippe Gerum
Quoted 7 lines · Jan Kiszka
Hi Philippe,
a customer just stumbled over some unclear spots in current I-pipe patches:
Why is there
local_irq_enable_hwintask_hijacked? Looks like it was once paired withprepare_arch_switch, but that call is now only used by legacy 2.4 PPC.It is still used in all trees, since we define it in
asm/ipipe.h. We could not context switch properly on the linux side with hw interrupts on anyway, due to the conflicts that would raise with Xenomai's tasking code.Quoted 2 lines
Can we safely drop it from all other patches (it's in
the context switch fast-path...)?Quoted 8 lines
No, since
prepare_arch_switch()is still applicable.Quoted 3 lines
Moreover, I bet the
ENABLE_INTERRUPTS_HW_CONDinentry_32.S'ret_from_forkis related to this as well, right?No, it's there to prevent the scheduling tail from running hw IRQs off, given that
copy_thread()may set a copy for eflags which prevents preemption.Forget about this one, this does not apply to x86 anymore. So the answer to this question is rather: that used to be required on x86 a long time ago due to the implementation of the task switching code in
system.h(2.4 era IIRC); but in any case, yes, this is still required for the reasons explained above, since we must run the switch code with hw IRQs off.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Still can't follow: Where is
prepare_arch_switchreferenced?
prepare_task_switch(),kernel/sched.cAh, this is mainline!
Yep.
Quoted 7 lines
Thought is was an ipipe extension.
OK, thanks, clear now:
prepare_task_switchpairs with enabling intask_hijacked&ret_from_fork.Jan
Signature · 1 line
Philippe.