ipipe_sync_stage deadlock
I love KVM - not only because I'm heavily hacking on it now, also because it is so easy to trigger various kinds of guest issues with it (SMP host + threaded virtual CPUs => true SMP guest - and if you want to watch fancy things happen, just load one host core).
Here is one I found that way:
void fastcall __ipipe_sync_stage(unsigned long syncmask) {
[ ... ]
while ((mask = (ipipe_this_cpudom_var(irqpend_himask) & syncmask)) != 0) {
level = __ipipe_ffnz(mask);
while ((submask = ipipe_this_cpudom_var(irqpend_lomask)[level]) != 0) {
rank = __ipipe_ffnz(submask);
irq = (level << IPIPE_IRQ_ISHIFT) + rank;
if (test_bit(IPIPE_LOCK_FLAG, &ipd->irqs[irq].control)) {
__clear_bit(rank, &ipipe_this_cpudom_var(irqpend_lomask)[level]);
continue;
}
__clear_bit(rank, &ipipe_this_cpudom_var(irqpend_lomask)[level]);
if (ipipe_this_cpudom_var(irqpend_lomask)[level] == 0)
__clear_bit(level, &ipipe_this_cpudom_var(irqpend_himask));[ ... ]
Who sees the deadlock? 100 points for the right answer! But be quick, I'm already hacking on a fix. :)
Jan
Quoted 10 lines · Jan Kiszka
I love KVM - not only because I'm heavily hacking on it now, also because it is so easy to trigger various kinds of guest issues with it (SMP host + threaded virtual CPUs => true SMP guest - and if you want to watch fancy things happen, just load one host core).
Here is one I found that way:
void fastcall
__ipipe_sync_stage(unsigned long syncmask){
[ ... ]
Quoted 9 lines
while ((mask = (ipipe_this_cpudom_var(irqpend_himask) & syncmask)) != 0) {
level = __ipipe_ffnz(mask);
while ((submask = ipipe_this_cpudom_var(irqpend_lomask)[level]) != 0) {
rank = __ipipe_ffnz(submask);
irq = (level << IPIPE_IRQ_ISHIFT) + rank;
if (test_bit(IPIPE_LOCK_FLAG, &ipd->irqs[irq].control)) {
__clear_bit(rank, &ipipe_this_cpudom_var(irqpend_lomask)[level]);- continue;
+ goto rpm_needs_more_neurons;
Quoted 4 lines
} __clear_bit(rank, &ipipe_this_cpudom_var(irqpend_lomask)[level]);
+ rpm_needs_more_neurons:
Quoted 17 lines
if (ipipe_this_cpudom_var(irqpend_lomask)[level] == 0) __clear_bit(level, &ipipe_this_cpudom_var(irqpend_himask));[ ... ]
Who sees the deadlock? 100 points for the right answer! But be quick, I'm already hacking on a fix. :)
Jan
------------------------------------------------------------------------
_______________________________________________
Adeos-main mailing list
[email protected]
https://mail.gna.org/listinfo/adeos-main
Signature · 1 line
Philippe.
Quoted 24 lines · Philippe Gerum
Quoted 19 lines · Jan Kiszka
I love KVM - not only because I'm heavily hacking on it now, also because it is so easy to trigger various kinds of guest issues with it (SMP host + threaded virtual CPUs => true SMP guest - and if you want to watch fancy things happen, just load one host core).
Here is one I found that way:
void fastcall
__ipipe_sync_stage(unsigned long syncmask){
[ ... ]while ((mask = (ipipe_this_cpudom_var(irqpend_himask) & syncmask)) != 0) { level = __ipipe_ffnz(mask); while ((submask = ipipe_this_cpudom_var(irqpend_lomask)[level]) != 0) { rank = __ipipe_ffnz(submask); irq = (level << IPIPE_IRQ_ISHIFT) + rank; if (test_bit(IPIPE_LOCK_FLAG, &ipd->irqs[irq].control)) { __clear_bit(rank, &ipipe_this_cpudom_var(irqpend_lomask)[level]);(quoted diff) +1
-1- continue; + goto rpm_needs_more_neurons;Quoted 2 lines
}
Quoted 7 lines
Quoted 2 lines
__clear_bit(rank, &ipipe_this_cpudom_var(irqpend_lomask)[level]);+
rpm_needs_more_neurons:Quoted 4 lines
if (ipipe_this_cpudom_var(irqpend_lomask)[level] == 0) __clear_bit(level, &ipipe_this_cpudom_var(irqpend_himask));[ ... ]
Of course, I'm not saying this is the real fix, but that just points at a possible issue. I do want those 100 points on my score card.
Quoted 15 lines
Quoted 13 lines
Who sees the deadlock? 100 points for the right answer! But be quick, I'm already hacking on a fix. :)
Jan
------------------------------------------------------------------------
_______________________________________________
Adeos-main mailing list
[email protected]
https://mail.gna.org/listinfo/adeos-main
Signature · 1 line
Philippe.
Quoted 27 lines · Philippe Gerum
Quoted 26 lines · Philippe Gerum
Quoted 19 lines · Jan Kiszka
I love KVM - not only because I'm heavily hacking on it now, also because it is so easy to trigger various kinds of guest issues with it (SMP host + threaded virtual CPUs => true SMP guest - and if you want to watch fancy things happen, just load one host core).
Here is one I found that way:
void fastcall
__ipipe_sync_stage(unsigned long syncmask){
[ ... ]while ((mask = (ipipe_this_cpudom_var(irqpend_himask) & syncmask)) != 0) { level = __ipipe_ffnz(mask); while ((submask = ipipe_this_cpudom_var(irqpend_lomask)[level]) != 0) { rank = __ipipe_ffnz(submask); irq = (level << IPIPE_IRQ_ISHIFT) + rank; if (test_bit(IPIPE_LOCK_FLAG, &ipd->irqs[irq].control)) { __clear_bit(rank, &ipipe_this_cpudom_var(irqpend_lomask)[level]);(quoted diff) +1
-1- continue; + goto rpm_needs_more_neurons;Quoted 4 lines
} __clear_bit(rank, &ipipe_this_cpudom_var(irqpend_lomask)[level]);
Quoted 8 lines
Quoted 5 lines
+
rpm_needs_more_neurons:Quoted 4 lines
if (ipipe_this_cpudom_var(irqpend_lomask)[level] == 0) __clear_bit(level, &ipipe_this_cpudom_var(irqpend_himask));[ ... ]
Of course, I'm not saying this is the real fix, but that just points at a possible issue. I do want those 100 points on my score card.
Well, I wasn't asking for a fix, just for spotting the gremlin - so you won! :->
Then let us fix this for real:
--- kernel/ipipe/core.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
kernel/ipipe/core.c +3 -5
@@ -957,16 +957,14 @@ void fastcall __ipipe_sync_stage(unsigne rank =__ipipe_ffnz (submask); irq = (level <<IPIPE_IRQ_ISHIFT ) + rank; -if (test_bit (IPIPE_LOCK_FLAG , &ipd->irqs[irq].control)) { -__clear_bit (rank, &ipipe_this_cpudom_var (irqpend_lomask)[level]); -continue ; - } -__clear_bit (rank, &ipipe_this_cpudom_var (irqpend_lomask)[level]);if (ipipe_this_cpudom_var (irqpend_lomask)[level] ==0 )__clear_bit (level, &ipipe_this_cpudom_var (irqpend_himask)); +if (test_bit (IPIPE_LOCK_FLAG , &ipd->irqs[irq].control)) +continue ; +__set_bit (IPIPE_STALL_FLAG , &ipipe_this_cpudom_var (status));if (ipd == ipipe_root_domain)
Quoted 33 lines · Jan Kiszka
Quoted 32 lines · Philippe Gerum
Quoted 31 lines · Philippe Gerum
Quoted 19 lines · Jan Kiszka
I love KVM - not only because I'm heavily hacking on it now, also because it is so easy to trigger various kinds of guest issues with it (SMP host + threaded virtual CPUs => true SMP guest - and if you want to watch fancy things happen, just load one host core).
Here is one I found that way:
void fastcall
__ipipe_sync_stage(unsigned long syncmask){
[ ... ]while ((mask = (ipipe_this_cpudom_var(irqpend_himask) & syncmask)) != 0) { level = __ipipe_ffnz(mask); while ((submask = ipipe_this_cpudom_var(irqpend_lomask)[level]) != 0) { rank = __ipipe_ffnz(submask); irq = (level << IPIPE_IRQ_ISHIFT) + rank; if (test_bit(IPIPE_LOCK_FLAG, &ipd->irqs[irq].control)) { __clear_bit(rank, &ipipe_this_cpudom_var(irqpend_lomask)[level]);(quoted diff) +1
-1- continue; + goto rpm_needs_more_neurons;Quoted 4 lines
} __clear_bit(rank, &ipipe_this_cpudom_var(irqpend_lomask)[level]);+
rpm_needs_more_neurons:Quoted 4 lines
if (ipipe_this_cpudom_var(irqpend_lomask)[level] == 0) __clear_bit(level, &ipipe_this_cpudom_var(irqpend_himask));[ ... ]
Quoted 6 lines
Quoted 2 lines
Of course, I'm not saying this is the real fix, but that just points at a possible issue. I do want those 100 points on my score card.
Well, I wasn't asking for a fix, just for spotting the gremlin - so you won! :->
Ah! Great. So this is the ultimate proof that when it comes to software development, one neuron is one too many!
Quoted 2 lines
Then let us fix this for real:
Ok, will merge thanks.
Quoted 29 lines
--- kernel/ipipe/core.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)Index:
b/kernel/ipipe/core.c
===================================================================kernel/ipipe/core.c +3
-5@@ -957,16 +957,14 @@ void fastcall __ipipe_sync_stage(unsigne rank =__ipipe_ffnz (submask); irq = (level <<IPIPE_IRQ_ISHIFT ) + rank; -if (test_bit (IPIPE_LOCK_FLAG , &ipd->irqs[irq].control)) { -__clear_bit (rank, &ipipe_this_cpudom_var (irqpend_lomask)[level]); -continue ; - } -__clear_bit (rank, &ipipe_this_cpudom_var (irqpend_lomask)[level]);if (ipipe_this_cpudom_var (irqpend_lomask)[level] ==0 )__clear_bit (level, &ipipe_this_cpudom_var (irqpend_himask)); +if (test_bit (IPIPE_LOCK_FLAG , &ipd->irqs[irq].control)) +continue ; +__set_bit (IPIPE_STALL_FLAG , &ipipe_this_cpudom_var (status));if (ipd == ipipe_root_domain)
Signature · 1 line
Philippe.