From: Jan Kiszka <jan.kiszka@domain.hid>
To: Philippe Gerum <rpm@xenomai.org>
Cc: adeos-main <adeos-main@gna.org>
Subject: [Adeos-main] [PATCH 2/3] ipipe: x86: Push IF as set to stack of root IRQ handlers
Date: Thu, 25 Nov 2010 17:47:02 +0100 [thread overview]
Message-ID: <4CEE9306.10704@domain.hid> (raw)
In-Reply-To: <4CEE91CB.3060303@domain.hid>
Preemption check of the Linux interrupt tail verifies, among other
things, that IF set for the preempted context. If it's not, no Linux
task switch is initiated. As we fake the context on root IRQ replay, we
must ensure that IF is faked properly as well, otherwise long Linux
rescheduling latencies up to deadlocks can occur.
Based on suggestion by Philippe.
Signed-off-by: Jan Kiszka <jan.kiszka@domain.hid>
---
arch/x86/include/asm/ipipe_32.h | 8 ++++++--
arch/x86/include/asm/ipipe_64.h | 8 ++++++--
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/arch/x86/include/asm/ipipe_32.h b/arch/x86/include/asm/ipipe_32.h
index 4263a7f..61d7913 100644
--- a/arch/x86/include/asm/ipipe_32.h
+++ b/arch/x86/include/asm/ipipe_32.h
@@ -70,6 +70,7 @@ static inline void __do_root_xirq(ipipe_irq_handler_t handler,
regs->orig_ax = ~__ipipe_get_irq_vector(irq);
__asm__ __volatile__("pushfl\n\t"
+ "orl %[x86if],(%%esp)\n\t"
"pushl %%cs\n\t"
"pushl $__xirq_end\n\t"
"pushl %%eax\n\t"
@@ -89,7 +90,8 @@ static inline void __do_root_xirq(ipipe_irq_handler_t handler,
"jmp ret_from_intr\n\t"
"__xirq_end: cli\n"
: /* no output */
- : "a" (~irq), "r" (handler), "rm" (regs));
+ : "a" (~irq), "r" (handler), "rm" (regs),
+ [x86if] "i" (X86_EFLAGS_IF));
}
#define __ipipe_do_root_xirq(ipd, irq) \
@@ -103,6 +105,7 @@ static inline void __do_root_virq(ipipe_irq_handler_t handler,
irq_enter();
__asm__ __volatile__("pushfl\n\t"
+ "orl %[x86if],(%%esp)\n\t"
"pushl %%cs\n\t"
"pushl $__virq_end\n\t"
"pushl $-1\n\t"
@@ -122,7 +125,8 @@ static inline void __do_root_virq(ipipe_irq_handler_t handler,
"call *%1\n\t"
"addl $8,%%esp\n"
: /* no output */
- : "a" (irq), "r" (handler), "d" (cookie));
+ : "a" (irq), "r" (handler), "d" (cookie),
+ [x86if] "i" (X86_EFLAGS_IF));
irq_exit();
__asm__ __volatile__("jmp ret_from_intr\n\t"
"__virq_end: cli\n"
diff --git a/arch/x86/include/asm/ipipe_64.h b/arch/x86/include/asm/ipipe_64.h
index b9367f6..c8f2c54 100644
--- a/arch/x86/include/asm/ipipe_64.h
+++ b/arch/x86/include/asm/ipipe_64.h
@@ -71,6 +71,7 @@ static inline void __do_root_xirq(ipipe_irq_handler_t handler,
"pushq $0\n\t"
"pushq %%rax\n\t"
"pushfq\n\t"
+ "orq %[x86if],(%%rsp)\n\t"
"pushq %[kernel_cs]\n\t"
"pushq $__xirq_end\n\t"
"pushq %[vector]\n\t"
@@ -91,7 +92,8 @@ static inline void __do_root_xirq(ipipe_irq_handler_t handler,
: /* no output */
: [kernel_cs] "i" (__KERNEL_CS),
[vector] "rm" (regs->orig_ax),
- [handler] "r" (handler), "D" (regs)
+ [handler] "r" (handler), "D" (regs),
+ [x86if] "i" (X86_EFLAGS_IF)
: "rax");
}
@@ -109,6 +111,7 @@ static inline void __do_root_virq(ipipe_irq_handler_t handler,
"pushq $0\n\t"
"pushq %%rax\n\t"
"pushfq\n\t"
+ "orq %[x86if],(%%rsp)\n\t"
"pushq %[kernel_cs]\n\t"
"pushq $__virq_end\n\t"
"pushq $-1\n\t"
@@ -125,7 +128,8 @@ static inline void __do_root_virq(ipipe_irq_handler_t handler,
"call *%[handler]\n\t"
: /* no output */
: [kernel_cs] "i" (__KERNEL_CS),
- [handler] "r" (handler), "D" (irq), "S" (cookie)
+ [handler] "r" (handler), "D" (irq),
+ "S" (cookie), [x86if] "i" (X86_EFLAGS_IF)
: "rax");
irq_exit();
__asm__ __volatile__("cli\n\t"
--
1.7.1
next prev parent reply other threads:[~2010-11-25 16:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-25 16:41 [Adeos-main] [git pull] Updates for ipipe-2.6.35-x86 Jan Kiszka
2010-11-25 16:46 ` [Adeos-main] [PATCH 1/3] ipipe: x86-32: Drop IRQ flag virtualization from syscall/interrupt entry/exit Jan Kiszka
2010-11-25 16:47 ` Jan Kiszka [this message]
2010-11-25 16:47 ` [Adeos-main] [PATCH 3/3] ipipe: x86: Fix up root state after __do_root_[vx]irq under CONFIG_TRACE_IRQFLAGS Jan Kiszka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4CEE9306.10704@domain.hid \
--to=jan.kiszka@domain.hid \
--cc=adeos-main@gna.org \
--cc=rpm@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.