xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/2] xen/arm: maintenance_interrupt SMP fix
@ 2014-01-27 17:33 Oleksandr Tyshchenko
  2014-01-27 17:33 ` [PATCH v1 1/2] xen/arm: Add return value to smp_call_function_interrupt function Oleksandr Tyshchenko
                   ` (3 more replies)
  0 siblings, 4 replies; 48+ messages in thread
From: Oleksandr Tyshchenko @ 2014-01-27 17:33 UTC (permalink / raw)
  To: xen-devel

Hi, all.

We are trying to bringing up XEN on DRA7XX (OMAP5) platform.

We sometimes see some hangs in Hypervisor and these hangs are related to SMP.
We found out that deadlock took place in on_selected_cpus function
in case of simultaneous occurrence cross-interrupts.

The issue:

1. We receive irqs from first CPU (for example CPU0) and second CPU (for example CPU1) in parallel.
2. In our case the maintenance_interrupt function for maintenance irq from CPU0 is executed on CPU1 and
maintenance_interrupt for irq from CPU1 is executed on CPU0.
3. According to existing logic we have run gic_irq_eoi function on CPU which it was scheduled.
4. Due to this in both cases we need to call on_selected_cpus function to EOI irqs.
5. For the CPU0 on_selected_cpus function is called where we take a lock in the beginning of the function
and continue to execute it.
6. Parallel to this the same function is called for the CPU1 where we stop after attempting to take a lock because it is already holding.  
7. For the CPU0 we send IPI and going to wait until CPU1 execute function and cleared cpumask.
8. But the mask will never be cleaned, because CPU1 is waiting too. 

Now, we have next situation. The CPU0 can not exit from busy loop, it is waiting CPU1 to execute function and clear mask, but CPU0 is waiting to release lock. 
This causes to deadlock.  

Since as we needed solution to avoid hangs the attached patch was created. The solution is just to
call the smp_call_function_interrupt function if lock is holding. This causes the waiting CPU to exit from busy loop and release lock.
But I am afraid this solution not completed and maybe not enough for stable work. I would appreciate if you could explain me how to solve the issue in a right way or give some advices.

P.S. We use next SW:
1. Hypervisor - XEN 4.4 unstable
2. Dom0 - Kernel 3.8
3. DomU - Kernel 3.8 

Oleksandr Tyshchenko (2):
  xen/arm: Add return value to smp_call_function_interrupt function
  xen/arm: Fix deadlock in on_selected_cpus function

 xen/common/smp.c      |   13 ++++++++++---
 xen/include/xen/smp.h |    2 +-
 2 files changed, 11 insertions(+), 4 deletions(-)

-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 48+ messages in thread

end of thread, other threads:[~2014-02-21 12:07 UTC | newest]

Thread overview: 48+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-27 17:33 [PATCH v1 0/2] xen/arm: maintenance_interrupt SMP fix Oleksandr Tyshchenko
2014-01-27 17:33 ` [PATCH v1 1/2] xen/arm: Add return value to smp_call_function_interrupt function Oleksandr Tyshchenko
2014-01-27 18:28   ` Stefano Stabellini
2014-01-27 17:33 ` [PATCH v1 2/2] xen/arm: Fix deadlock in on_selected_cpus function Oleksandr Tyshchenko
2014-01-27 19:00   ` Stefano Stabellini
2014-01-28 10:03     ` Ian Campbell
2014-01-28 14:00       ` Stefano Stabellini
2014-01-28 15:05         ` Ian Campbell
2014-01-28 16:02           ` Stefano Stabellini
2014-01-28 16:12             ` Ian Campbell
2014-01-28 16:23               ` Stefano Stabellini
2014-01-28 13:58   ` Stefano Stabellini
2014-01-30 11:58     ` Oleksandr Tyshchenko
2014-01-27 17:40 ` [PATCH v1 0/2] xen/arm: maintenance_interrupt SMP fix Ian Campbell
2014-01-27 17:51 ` Julien Grall
2014-01-28 19:25   ` Oleksandr Tyshchenko
2014-01-29 10:56     ` Oleksandr Tyshchenko
2014-01-29 11:42       ` Stefano Stabellini
2014-01-29 11:46         ` Stefano Stabellini
2014-01-29 13:15           ` Julien Grall
2014-02-04 15:32           ` Julien Grall
2014-02-04 16:20         ` [PATCH] xen/arm: route irqs to cpu0 Stefano Stabellini
2014-02-04 16:32           ` Julien Grall
2014-02-04 16:56             ` Oleksandr Tyshchenko
2014-02-19 13:43           ` Julien Grall
2014-02-19 13:53             ` Ian Campbell
2014-02-19 14:15               ` George Dunlap
2014-02-20 14:52                 ` Stefano Stabellini
2014-02-21 11:12                   ` George Dunlap
2014-02-21 11:59                     ` Julien Grall
2014-02-21 12:07                       ` George Dunlap
2014-01-29 13:07       ` [PATCH v1 0/2] xen/arm: maintenance_interrupt SMP fix Julien Grall
2014-01-29 13:22         ` Stefano Stabellini
2014-01-29 18:40           ` Oleksandr Tyshchenko
2014-01-29 18:43             ` Oleksandr Tyshchenko
2014-01-29 18:49             ` Julien Grall
2014-01-29 19:54               ` Oleksandr Tyshchenko
2014-01-30  0:42                 ` Julien Grall
2014-01-30 13:24               ` Stefano Stabellini
2014-01-30 15:06                 ` Oleksandr Tyshchenko
2014-01-30 15:35                   ` Stefano Stabellini
2014-01-30 16:10                     ` Oleksandr Tyshchenko
2014-01-30 17:18                       ` Stefano Stabellini
2014-01-30 19:54                         ` Oleksandr Tyshchenko
2014-01-30 21:47                           ` Julien Grall
2014-01-31  1:57                             ` Oleksandr Tyshchenko
2014-01-29 13:12     ` Julien Grall
2014-01-29 18:55       ` Oleksandr Tyshchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).