Skip to contentSkip to conversation

x86: critical fix for native_safe_halt

GIT PULL Jan Kiszka 2 participants 13 messages Dec 12, 2009 – Dec 16, 2009 x86

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

Recent moving of ipipe_suspend_domain finally exposed a deeper flaw in cpu_idle on x86: We failed to check the pipeline log before issuing the real hlt. This caused IRQ latencies or even drops for Linux, specifically on SMP. Credits go to plain QEMU whose slow SMP mode caused ipipe_critical_enter to deadlock frequently enough.

The first patch of this series fixes this (see below), the second one simply removes the two useless ipipe_suspend_domain calls.

The following changes since commit 7cd56451b429702996adef794f01f1067e5fff51:
Philippe Gerum (1):

        ipipe-2.6.31.1-x86-2.4-08

are available in the git repository at:

git://git.kiszka.org/ipipe-2.6 queues/2.6.31-x86

Jan Kiszka (2):
x86: Properly virtualize native_safe_halt
x86: Drop redundant ipipe_suspend_domain from cpu_idle

 arch/x86/include/asm/ipipe_base.h |    2 ++
 arch/x86/include/asm/irqflags.h   |    8 +++++---
 arch/x86/kernel/ipipe.c           |   23 +++++++++++++++++++++++
 arch/x86/kernel/process_32.c      |    2 --
 arch/x86/kernel/process_64.c      |    3 ---
 5 files changed, 30 insertions(+), 8 deletions(-)

------

x86: Properly virtualize native_safe_halt

We have to check the root domain's log before halting. If it is not empty, we need to replay and return immediately. Otherwise we risk to defer or even lose root domain interrupts.

---
 arch/x86/include/asm/ipipe_base.h |    2 ++
 arch/x86/include/asm/irqflags.h   |    8 +++++---
 arch/x86/kernel/ipipe.c           |   23 +++++++++++++++++++++++
 3 files changed, 30 insertions(+), 3 deletions(-)
arch/x86/include/asm/ipipe_base.h +2 -0
index c3bd7d1..3c81096 100644
@@ -203,6 +203,8 @@ static inline unsigned long __ipipe_test_root(void)
 
 #endif /* !CONFIG_SMP */
 
+void __ipipe_halt_root(void);
+
 void __ipipe_serial_debug(const char *fmt, ...);
 
 #endif	/* !__ASSEMBLY__ */
arch/x86/include/asm/irqflags.h +5 -3
index 71ede94..1baceba 100644
@@ -72,10 +72,12 @@ static inline void native_irq_enable(void)
 
 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
 }
 
 static inline void native_halt(void)
arch/x86/kernel/ipipe.c +23 -0
index d4789c8..487b2b0 100644
@@ -601,6 +601,29 @@ void __ipipe_preempt_schedule_irq(void)
 
 #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
Signature · 1 line
1.6.0.2
#1 lore raw
Quoted 9 lines · Jan Kiszka

Recent moving of ipipe_suspend_domain finally exposed a deeper flaw in cpu_idle on x86: We failed to check the pipeline log before issuing the real hlt. This caused IRQ latencies or even drops for Linux, specifically on SMP. Credits go to plain QEMU whose slow SMP mode caused ipipe_critical_enter to deadlock frequently enough.

The first patch of this series fixes this (see below), the second one simply removes the two useless ipipe_suspend_domain calls.

What your patch does as well, is killing the ability to run low priority domains below the root level.

Quoted 102 lines

The following changes since commit 7cd56451b429702996adef794f01f1067e5fff51:
Philippe Gerum (1):

        ipipe-2.6.31.1-x86-2.4-08

are available in the git repository at:

git://git.kiszka.org/ipipe-2.6 queues/2.6.31-x86

Jan Kiszka (2):
x86: Properly virtualize native_safe_halt
x86: Drop redundant ipipe_suspend_domain from cpu_idle

 arch/x86/include/asm/ipipe_base.h |    2 ++
 arch/x86/include/asm/irqflags.h   |    8 +++++---
 arch/x86/kernel/ipipe.c           |   23 +++++++++++++++++++++++
 arch/x86/kernel/process_32.c      |    2 --
 arch/x86/kernel/process_64.c      |    3 ---
 5 files changed, 30 insertions(+), 8 deletions(-)

------

x86: Properly virtualize native_safe_halt

We have to check the root domain's log before halting. If it is not empty, we need to replay and return immediately. Otherwise we risk to defer or even lose root domain interrupts.

---
 arch/x86/include/asm/ipipe_base.h |    2 ++
 arch/x86/include/asm/irqflags.h   |    8 +++++---
 arch/x86/kernel/ipipe.c           |   23 +++++++++++++++++++++++
 3 files changed, 30 insertions(+), 3 deletions(-)
arch/x86/include/asm/ipipe_base.h +2 -0
index c3bd7d1..3c81096 100644
@@ -203,6 +203,8 @@ static inline unsigned long __ipipe_test_root(void)
 
 #endif /* !CONFIG_SMP */
 
+void __ipipe_halt_root(void);
+
 void __ipipe_serial_debug(const char *fmt, ...);
 
 #endif	/* !__ASSEMBLY__ */
arch/x86/include/asm/irqflags.h +5 -3
index 71ede94..1baceba 100644
@@ -72,10 +72,12 @@ static inline void native_irq_enable(void)
 
 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
 }
 
 static inline void native_halt(void)
arch/x86/kernel/ipipe.c +23 -0
index d4789c8..487b2b0 100644
@@ -601,6 +601,29 @@ void __ipipe_preempt_schedule_irq(void)
 
 #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
Signature · 1 line
Philippe.
author
#2 lore raw
Quoted 7 lines · Philippe Gerum
Quoted 6 lines · Jan Kiszka

Recent moving of ipipe_suspend_domain finally exposed a deeper flaw in cpu_idle on x86: We failed to check the pipeline log before issuing the real hlt. This caused IRQ latencies or even drops for Linux, specifically on SMP. Credits go to plain QEMU whose slow SMP mode caused ipipe_critical_enter to deadlock frequently enough.

Quoted 6 lines
Quoted 3 lines

The first patch of this series fixes this (see below), the second one simply removes the two useless ipipe_suspend_domain calls.

What your patch does as well, is killing the ability to run low priority domains below the root level.

Yes, I'm killing the dream.

I heavily doubt that the functions I removed in the second patch ever contributed something good to this. It's always the job of the lowest domain to issue hardware halt, not of some arbitrary mid-prio domain. Moreover, what would be the practical use for such model in the context of Linux?

Jan

#3 lore raw
Quoted 15 lines · Jan Kiszka
Quoted 7 lines · Philippe Gerum
Quoted 6 lines · Jan Kiszka

Recent moving of ipipe_suspend_domain finally exposed a deeper flaw in cpu_idle on x86: We failed to check the pipeline log before issuing the real hlt. This caused IRQ latencies or even drops for Linux, specifically on SMP. Credits go to plain QEMU whose slow SMP mode caused ipipe_critical_enter to deadlock frequently enough.

Quoted 6 lines
Quoted 3 lines

The first patch of this series fixes this (see below), the second one simply removes the two useless ipipe_suspend_domain calls.

What your patch does as well, is killing the ability to run low priority domains below the root level.

Quoted 7 lines

Yes, I'm killing the dream.

I heavily doubt that the functions I removed in the second patch ever contributed something good to this. It's always the job of the lowest domain to issue hardware halt, not of some arbitrary mid-prio domain. Moreover, what would be the practical use for such model in the context of Linux?

That is _not_ the point. The point is, when submitting a patch, please make sure to raise all the concerns it might introduce wrt to changing the base features. I'm not opposed to make the feature set evolve, but I don't want this to happen "by mistake".

Quoted 3 lines

Jan

Signature · 1 line
Philippe.
author
#4 lore raw
Quoted 22 lines · Philippe Gerum
Quoted 13 lines · Jan Kiszka
Quoted 7 lines · Philippe Gerum
Quoted 6 lines · Jan Kiszka

Recent moving of ipipe_suspend_domain finally exposed a deeper flaw in cpu_idle on x86: We failed to check the pipeline log before issuing the real hlt. This caused IRQ latencies or even drops for Linux, specifically on SMP. Credits go to plain QEMU whose slow SMP mode caused ipipe_critical_enter to deadlock frequently enough.

Quoted 5 lines
Quoted 3 lines

The first patch of this series fixes this (see below), the second one simply removes the two useless ipipe_suspend_domain calls.

What your patch does as well, is killing the ability to run low priority domains below the root level.

Quoted 7 lines

Yes, I'm killing the dream.

I heavily doubt that the functions I removed in the second patch ever contributed something good to this. It's always the job of the lowest domain to issue hardware halt, not of some arbitrary mid-prio domain. Moreover, what would be the practical use for such model in the context of Linux?

Quoted 4 lines

That is _not_ the point. The point is, when submitting a patch, please make sure to raise all the concerns it might introduce wrt to changing the base features. I'm not opposed to make the feature set evolve, but I don't want this to happen "by mistake".

Just pushed

"x86: Drop redundant ipipe_suspend_domain from cpu_idle

Allowing domains below root always required more than these calls (Linux would have to give up idle management). And syncing the root domain now takes place in __ipipe_halt_root. So remove these suspension calls."

as commit message for the second patch. Is that what you are looking for?

Jan

#5 lore raw
Quoted 13 lines · Jan Kiszka
Quoted 12 lines · Philippe Gerum
Quoted 11 lines · Jan Kiszka
Quoted 10 lines · Philippe Gerum
Quoted 9 lines · Jan Kiszka

Recent moving of ipipe_suspend_domain finally exposed a deeper flaw in cpu_idle on x86: We failed to check the pipeline log before issuing the real hlt. This caused IRQ latencies or even drops for Linux, specifically on SMP. Credits go to plain QEMU whose slow SMP mode caused ipipe_critical_enter to deadlock frequently enough.

The first patch of this series fixes this (see below), the second one simply removes the two useless ipipe_suspend_domain calls.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines

What your patch does as well, is killing the ability to run low priority domains below the root level.

Yes, I'm killing the dream.

I heavily doubt that the functions I removed in the second patch ever contributed something good to this. It's always the job of the lowest domain to issue hardware halt, not of some arbitrary mid-prio domain.

Actually, no it's not. You may use a low-priority domain to run idle level jobs outside of the linux infrastructure for that purpose (e.g. RCU). A high priority domain may want to post events for a low priority domain to act upon when a mid priority domain is about to enter the CPU idle state.

Quoted 10 lines
Quoted 7 lines
Quoted 2 lines

Moreover, what would be the practical use for such model in the context of Linux?

That is _not_ the point. The point is, when submitting a patch, please make sure to raise all the concerns it might introduce wrt to changing the base features. I'm not opposed to make the feature set evolve, but I don't want this to happen "by mistake".

Just pushed

Quoted 8 lines

"x86: Drop redundant ipipe_suspend_domain from cpu_idle

Allowing domains below root always required more than these calls (Linux would have to give up idle management). And syncing the root domain now takes place in __ipipe_halt_root. So remove these suspension calls."

as commit message for the second patch. Is that what you are looking for?

Not exactly, because your comment states that what was removed was intrinsically useless, it was not, and has been used, even if only in a couple of occasions, mainly to enable a debugging hack. This is why I choked on removing a feature silently. But at the same time, we are in a simplification trend of the I-pipe toward X3, so I agree on the final goal you are pursuing with that patch.

In short, let's move on, I'll merge that as well, now that everything is on the table, and there is no objection anyway.

Quoted 6 lines

Jan

_______________________________________________
Adeos-main mailing list
[email protected]
https://mail.gna.org/listinfo/adeos-main

Signature · 1 line
Philippe.
author
#6 lore raw
Quoted 22 lines · Philippe Gerum
Quoted 13 lines · Jan Kiszka
Quoted 12 lines · Philippe Gerum
Quoted 11 lines · Jan Kiszka
Quoted 10 lines · Philippe Gerum
Quoted 9 lines · Jan Kiszka

Recent moving of ipipe_suspend_domain finally exposed a deeper flaw in cpu_idle on x86: We failed to check the pipeline log before issuing the real hlt. This caused IRQ latencies or even drops for Linux, specifically on SMP. Credits go to plain QEMU whose slow SMP mode caused ipipe_critical_enter to deadlock frequently enough.

The first patch of this series fixes this (see below), the second one simply removes the two useless ipipe_suspend_domain calls.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines

What your patch does as well, is killing the ability to run low priority domains below the root level.

Yes, I'm killing the dream.

I heavily doubt that the functions I removed in the second patch ever contributed something good to this. It's always the job of the lowest domain to issue hardware halt, not of some arbitrary mid-prio domain.

Quoted 5 lines

Actually, no it's not. You may use a low-priority domain to run idle level jobs outside of the linux infrastructure for that purpose (e.g. RCU). A high priority domain may want to post events for a low priority domain to act upon when a mid priority domain is about to enter the CPU idle state.

Even if all the related bugs were fixed: When you pass down control to the lower domain on cpu_idle via ipipe_suspend_domain, you won't get a Linux reschedule (without CONFIG_PREEMPT) until the low-prio domain finally returns from its event handler - likely not what "low-prio" suggests.

Quoted 25 lines
Quoted 9 lines
Quoted 7 lines
Quoted 3 lines

Moreover, what would be the practical use for such model in the context of Linux?

That is _not_ the point. The point is, when submitting a patch, please make sure to raise all the concerns it might introduce wrt to changing the base features. I'm not opposed to make the feature set evolve, but I don't want this to happen "by mistake".

Just pushed

Quoted 8 lines

"x86: Drop redundant ipipe_suspend_domain from cpu_idle

Allowing domains below root always required more than these calls (Linux would have to give up idle management). And syncing the root domain now takes place in __ipipe_halt_root. So remove these suspension calls."

as commit message for the second patch. Is that what you are looking for?

Not exactly, because your comment states that what was removed was intrinsically useless, it was not, and has been used, even if only in a couple of occasions, mainly to enable a debugging hack. This is why I choked on removing a feature silently. But at the same time, we are in a simplification trend of the I-pipe toward X3, so I agree on the final goal you are pursuing with that patch.

Quoted 2 lines

In short, let's move on, I'll merge that as well, now that everything is on the table, and there is no objection anyway.

I couldn't agree more. :)

Jan

#7 lore raw
Quoted 29 lines · Jan Kiszka
Quoted 22 lines · Philippe Gerum
Quoted 13 lines · Jan Kiszka
Quoted 12 lines · Philippe Gerum
Quoted 11 lines · Jan Kiszka
Quoted 10 lines · Philippe Gerum
Quoted 9 lines · Jan Kiszka

Recent moving of ipipe_suspend_domain finally exposed a deeper flaw in cpu_idle on x86: We failed to check the pipeline log before issuing the real hlt. This caused IRQ latencies or even drops for Linux, specifically on SMP. Credits go to plain QEMU whose slow SMP mode caused ipipe_critical_enter to deadlock frequently enough.

The first patch of this series fixes this (see below), the second one simply removes the two useless ipipe_suspend_domain calls.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines

What your patch does as well, is killing the ability to run low priority domains below the root level.

Yes, I'm killing the dream.

I heavily doubt that the functions I removed in the second patch ever contributed something good to this. It's always the job of the lowest domain to issue hardware halt, not of some arbitrary mid-prio domain.

Quoted 5 lines

Actually, no it's not. You may use a low-priority domain to run idle level jobs outside of the linux infrastructure for that purpose (e.g. RCU). A high priority domain may want to post events for a low priority domain to act upon when a mid priority domain is about to enter the CPU idle state.

Quoted 5 lines

Even if all the related bugs were fixed: When you pass down control to the lower domain on cpu_idle via ipipe_suspend_domain, you won't get a Linux reschedule (without CONFIG_PREEMPT) until the low-prio domain finally returns from its event handler - likely not what "low-prio" suggests.

low prio suggests nothing else than "runs whenever nothing else has to be done higher in the pipeline". I just don't get why you seem to bind the Linux rescheduling logic with what a low prio domain would do; by definition, adeos-wise, both are totally non-related.

Quoted 33 lines
Quoted 26 lines
Quoted 10 lines
Quoted 8 lines
Quoted 4 lines

Moreover, what would be the practical use for such model in the context of Linux?

That is _not_ the point. The point is, when submitting a patch, please make sure to raise all the concerns it might introduce wrt to changing the base features. I'm not opposed to make the feature set evolve, but I don't want this to happen "by mistake".

Just pushed

Quoted 8 lines

"x86: Drop redundant ipipe_suspend_domain from cpu_idle

Allowing domains below root always required more than these calls (Linux would have to give up idle management). And syncing the root domain now takes place in __ipipe_halt_root. So remove these suspension calls."

as commit message for the second patch. Is that what you are looking for?

Not exactly, because your comment states that what was removed was intrinsically useless, it was not, and has been used, even if only in a couple of occasions, mainly to enable a debugging hack. This is why I choked on removing a feature silently. But at the same time, we are in a simplification trend of the I-pipe toward X3, so I agree on the final goal you are pursuing with that patch.

Quoted 2 lines

In short, let's move on, I'll merge that as well, now that everything is on the table, and there is no objection anyway.

I couldn't agree more. :)

Jan

Signature · 1 line
Philippe.
#8 lore raw
Quoted 30 lines · Philippe Gerum
Quoted 29 lines · Jan Kiszka
Quoted 27 lines · Philippe Gerum
Quoted 13 lines · Jan Kiszka
Quoted 12 lines · Philippe Gerum
Quoted 11 lines · Jan Kiszka
Quoted 10 lines · Philippe Gerum
Quoted 9 lines · Jan Kiszka

Recent moving of ipipe_suspend_domain finally exposed a deeper flaw in cpu_idle on x86: We failed to check the pipeline log before issuing the real hlt. This caused IRQ latencies or even drops for Linux, specifically on SMP. Credits go to plain QEMU whose slow SMP mode caused ipipe_critical_enter to deadlock frequently enough.

The first patch of this series fixes this (see below), the second one simply removes the two useless ipipe_suspend_domain calls.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines

What your patch does as well, is killing the ability to run low priority domains below the root level.

Yes, I'm killing the dream.

I heavily doubt that the functions I removed in the second patch ever contributed something good to this. It's always the job of the lowest domain to issue hardware halt, not of some arbitrary mid-prio domain.

Actually, no it's not. You may use a low-priority domain to run idle level jobs outside of the linux infrastructure for that purpose (e.g. RCU). A high priority domain may want to post events for a low priority domain to act upon when a mid priority domain is about to enter the CPU idle state.

Quoted 8 lines
Quoted 5 lines

Even if all the related bugs were fixed: When you pass down control to the lower domain on cpu_idle via ipipe_suspend_domain, you won't get a Linux reschedule (without CONFIG_PREEMPT) until the low-prio domain finally returns from its event handler - likely not what "low-prio" suggests.

low prio suggests nothing else than "runs whenever nothing else has to be done higher in the pipeline".

Nothing, meaning nothing interrupt-wise. For the rest, it's a deal between all OSes there.

Quoted 39 lines

I just don't get why you seem to bind
the Linux rescheduling logic with what a low prio domain would do; by definition, adeos-wise, both are totally non-related.

Quoted 33 lines
Quoted 26 lines
Quoted 10 lines
Quoted 8 lines
Quoted 4 lines

Moreover, what would be the practical use for such model in the context of Linux?

That is _not_ the point. The point is, when submitting a patch, please make sure to raise all the concerns it might introduce wrt to changing the base features. I'm not opposed to make the feature set evolve, but I don't want this to happen "by mistake".

Just pushed

Quoted 8 lines

"x86: Drop redundant ipipe_suspend_domain from cpu_idle

Allowing domains below root always required more than these calls (Linux would have to give up idle management). And syncing the root domain now takes place in __ipipe_halt_root. So remove these suspension calls."

as commit message for the second patch. Is that what you are looking for?

Not exactly, because your comment states that what was removed was intrinsically useless, it was not, and has been used, even if only in a couple of occasions, mainly to enable a debugging hack. This is why I choked on removing a feature silently. But at the same time, we are in a simplification trend of the I-pipe toward X3, so I agree on the final goal you are pursuing with that patch.

Quoted 2 lines

In short, let's move on, I'll merge that as well, now that everything is on the table, and there is no objection anyway.

I couldn't agree more. :)

Jan

Signature · 1 line
Philippe.
author
#9 lore raw
Quoted 34 lines · Philippe Gerum
Quoted 33 lines · Philippe Gerum
Quoted 32 lines · Jan Kiszka
Quoted 18 lines · Philippe Gerum
Quoted 17 lines · Jan Kiszka
Quoted 16 lines · Philippe Gerum
Quoted 15 lines · Jan Kiszka
Quoted 7 lines · Philippe Gerum
Quoted 6 lines · Jan Kiszka

Recent moving of ipipe_suspend_domain finally exposed a deeper flaw in cpu_idle on x86: We failed to check the pipeline log before issuing the real hlt. This caused IRQ latencies or even drops for Linux, specifically on SMP. Credits go to plain QEMU whose slow SMP mode caused ipipe_critical_enter to deadlock frequently enough.

Quoted 5 lines
Quoted 3 lines

The first patch of this series fixes this (see below), the second one simply removes the two useless ipipe_suspend_domain calls.

What your patch does as well, is killing the ability to run low priority domains below the root level.

Yes, I'm killing the dream.

Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

I heavily doubt that the functions I removed in the second patch ever contributed something good to this. It's always the job of the lowest domain to issue hardware halt, not of some arbitrary mid-prio domain.

Actually, no it's not. You may use a low-priority domain to run idle level jobs outside of the linux infrastructure for that purpose (e.g. RCU). A high priority domain may want to post events for a low priority domain to act upon when a mid priority domain is about to enter the CPU idle state.

Even if all the related bugs were fixed: When you pass down control to the lower domain on cpu_idle via ipipe_suspend_domain, you won't get a Linux reschedule (without CONFIG_PREEMPT) until the low-prio domain finally returns from its event handler - likely not what "low-prio" suggests.

Quoted 6 lines
Quoted 2 lines

low prio suggests nothing else than "runs whenever nothing else has to be done higher in the pipeline".

Nothing, meaning nothing interrupt-wise. For the rest, it's a deal between all OSes there.

Right, and that deal was, well, fairly incomplete in the previous code. That's my whole point.

Jan

#10 lore raw
Quoted 38 lines · Jan Kiszka
Quoted 37 lines · Philippe Gerum
Quoted 35 lines · Philippe Gerum
Quoted 27 lines · Jan Kiszka
Quoted 18 lines · Philippe Gerum
Quoted 17 lines · Jan Kiszka
Quoted 16 lines · Philippe Gerum
Quoted 15 lines · Jan Kiszka
Quoted 7 lines · Philippe Gerum
Quoted 6 lines · Jan Kiszka

Recent moving of ipipe_suspend_domain finally exposed a deeper flaw in cpu_idle on x86: We failed to check the pipeline log before issuing the real hlt. This caused IRQ latencies or even drops for Linux, specifically on SMP. Credits go to plain QEMU whose slow SMP mode caused ipipe_critical_enter to deadlock frequently enough.

Quoted 5 lines
Quoted 3 lines

The first patch of this series fixes this (see below), the second one simply removes the two useless ipipe_suspend_domain calls.

What your patch does as well, is killing the ability to run low priority domains below the root level.

Yes, I'm killing the dream.

Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

I heavily doubt that the functions I removed in the second patch ever contributed something good to this. It's always the job of the lowest domain to issue hardware halt, not of some arbitrary mid-prio domain.

Actually, no it's not. You may use a low-priority domain to run idle level jobs outside of the linux infrastructure for that purpose (e.g. RCU). A high priority domain may want to post events for a low priority domain to act upon when a mid priority domain is about to enter the CPU idle state.

Quoted 5 lines

Even if all the related bugs were fixed: When you pass down control to the lower domain on cpu_idle via ipipe_suspend_domain, you won't get a Linux reschedule (without CONFIG_PREEMPT) until the low-prio domain finally returns from its event handler - likely not what "low-prio" suggests.

low prio suggests nothing else than "runs whenever nothing else has to be done higher in the pipeline".

Quoted 6 lines
Quoted 3 lines

Nothing, meaning nothing interrupt-wise. For the rest, it's a deal between all OSes there.

Right, and that deal was, well, fairly incomplete in the previous code. That's my whole point.

Nope. The missing code would have been provided by the low priority domain, without requiring anything to be changed on the Linux side, if that use was only about running (pre-)idle context code.

Which does not removes anything to the usefulness of actually fixing CPU halt code this said, but that is unrelated.

Quoted 7 lines

Jan

_______________________________________________
Adeos-main mailing list
[email protected]
https://mail.gna.org/listinfo/adeos-main

Signature · 1 line
Philippe.
author
#11 lore raw
In reply to Philippe Gerum
Quoted 34 lines · Philippe Gerum
Quoted 27 lines · Jan Kiszka
Quoted 18 lines · Philippe Gerum
Quoted 17 lines · Jan Kiszka
Quoted 16 lines · Philippe Gerum
Quoted 15 lines · Jan Kiszka
Quoted 7 lines · Philippe Gerum
Quoted 6 lines · Jan Kiszka

Recent moving of ipipe_suspend_domain finally exposed a deeper flaw in cpu_idle on x86: We failed to check the pipeline log before issuing the real hlt. This caused IRQ latencies or even drops for Linux, specifically on SMP. Credits go to plain QEMU whose slow SMP mode caused ipipe_critical_enter to deadlock frequently enough.

Quoted 5 lines
Quoted 3 lines

The first patch of this series fixes this (see below), the second one simply removes the two useless ipipe_suspend_domain calls.

What your patch does as well, is killing the ability to run low priority domains below the root level.

Yes, I'm killing the dream.

Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

I heavily doubt that the functions I removed in the second patch ever contributed something good to this. It's always the job of the lowest domain to issue hardware halt, not of some arbitrary mid-prio domain.

Actually, no it's not. You may use a low-priority domain to run idle level jobs outside of the linux infrastructure for that purpose (e.g. RCU). A high priority domain may want to post events for a low priority domain to act upon when a mid priority domain is about to enter the CPU idle state.

Quoted 5 lines

Even if all the related bugs were fixed: When you pass down control to the lower domain on cpu_idle via ipipe_suspend_domain, you won't get a Linux reschedule (without CONFIG_PREEMPT) until the low-prio domain finally returns from its event handler - likely not what "low-prio" suggests.

Quoted 5 lines

low prio suggests nothing else than "runs whenever nothing else has to be done higher in the pipeline". I just don't get why you seem to bind the Linux rescheduling logic with what a low prio domain would do; by definition, adeos-wise, both are totally non-related.

I meant that a low prio domain is able to (indirectly) defer activities of a mig prio domain due to the way the latter passed on the control in its idle loop. Think about my scenario again: where are the preemption points of on idle, !CONFIG_PREEMPT Linux kernel?

Jan

#12 lore raw
Quoted 41 lines · Jan Kiszka
Quoted 34 lines · Philippe Gerum
Quoted 27 lines · Jan Kiszka
Quoted 18 lines · Philippe Gerum
Quoted 17 lines · Jan Kiszka
Quoted 16 lines · Philippe Gerum
Quoted 15 lines · Jan Kiszka
Quoted 7 lines · Philippe Gerum
Quoted 6 lines · Jan Kiszka

Recent moving of ipipe_suspend_domain finally exposed a deeper flaw in cpu_idle on x86: We failed to check the pipeline log before issuing the real hlt. This caused IRQ latencies or even drops for Linux, specifically on SMP. Credits go to plain QEMU whose slow SMP mode caused ipipe_critical_enter to deadlock frequently enough.

Quoted 5 lines
Quoted 3 lines

The first patch of this series fixes this (see below), the second one simply removes the two useless ipipe_suspend_domain calls.

What your patch does as well, is killing the ability to run low priority domains below the root level.

Yes, I'm killing the dream.

Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

I heavily doubt that the functions I removed in the second patch ever contributed something good to this. It's always the job of the lowest domain to issue hardware halt, not of some arbitrary mid-prio domain.

Actually, no it's not. You may use a low-priority domain to run idle level jobs outside of the linux infrastructure for that purpose (e.g. RCU). A high priority domain may want to post events for a low priority domain to act upon when a mid priority domain is about to enter the CPU idle state.

Quoted 5 lines

Even if all the related bugs were fixed: When you pass down control to the lower domain on cpu_idle via ipipe_suspend_domain, you won't get a Linux reschedule (without CONFIG_PREEMPT) until the low-prio domain finally returns from its event handler - likely not what "low-prio" suggests.

Quoted 5 lines

low prio suggests nothing else than "runs whenever nothing else has to be done higher in the pipeline". I just don't get why you seem to bind the Linux rescheduling logic with what a low prio domain would do; by definition, adeos-wise, both are totally non-related.

Quoted 3 lines

I meant that a low prio domain is able to (indirectly) defer activities of a mig prio domain due to the way the latter passed on the control in its idle loop.

That is a deal between domains, we could do the same by preventing Xenomai to reschedule before exiting the interrupt handler, the pipeline imposes absolutely nothing there. What it says, and only that is:
interrupts must be prioritized. What interrupt handlers do, e.g. rescheduling or not, is not the pipeline's business. This is another level of abstraction/logic.

If for some reason, I want to allow such deferral because it helps me debugging a misbehavior in some upper domain, I may do this. This is really as simple as that. You have an extended interpretation of what the pipeline should enforce, really. Albeit it is practically true most of the time, it may be relaxed in some (rare) occasions, without killing the entire design, or considering this as a bug. Your perception of something being a bug could very well be seen as a feature by others. That's life.

Quoted 9 lines

Think about my scenario again: where are the preemption
points of on idle, !CONFIG_PREEMPT Linux kernel?

Jan

_______________________________________________
Adeos-main mailing list
[email protected]
https://mail.gna.org/listinfo/adeos-main

Signature · 1 line
Philippe.