Skip to contentSkip to conversation

xen/arm: Make local_events_need_delivery working with idle VPCU

PATCH In review Julien Grall 5 participants 13 messages Apr 27, 2015 – May 5, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm: Make local_events_need_delivery working with idle VPCU

The commit 569fb6c "xen/arm: Data abort exception (R/W) mem_access events" makes apply_p2m_changes to call hypercall_preempt_check for any operation rather than for relinquish.

The function hypercall_preempt_check call local_events_need_delivery which rely on the current VCPU is not an idle VCPU. Although, during DOM0 building the current VCPU is an idle one. This would make Xen crash with the following stack trace:

(XEN) CPU0: Unexpected Trap: Data Abort
[...]
(XEN) Xen call trace:

(XEN)    [<00256ef4>] apply_p2m_changes+0x210/0x1190 (PC)
(XEN)    [<002506b4>] gic_events_need_delivery+0x5c/0x13c (LR)
(XEN)    [<002580ec>] map_mmio_regions+0x64/0x74
(XEN)    [<00251958>] gicv2v_setup+0xf8/0x150
(XEN)    [<00250964>] gicv_setup+0x20/0x30
(XEN)    [<0024cb3c>] arch_domain_create+0x170/0x244
(XEN)    [<00207df0>] domain_create+0x2ac/0x4d8
(XEN)    [<0028e3d0>] start_xen+0xcbc/0xee4
(XEN)    [<00200540>] paging+0x94/0xd8

(XEN)
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) CPU0: Unexpected Trap: Data Abort
(XEN)
(XEN) ****************************************

As an idle VCPU can never receive an event, return 0 when the current VCPU is an idle VCPU in local_events_need_delivery.

---

This bug has been catched during boot on Mustang. This is because we have to map large chunk of PCI memory region.

I was able to reproduce the bug on midway by lowering down preempt_count_limit to 16 in apply_p2m_changes.

Although, I'm not sure this is the right fix for the bug.

---
 xen/include/asm-arm/event.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
xen/include/asm-arm/event.h +6 -1
index 5330dfe..0149d06 100644
@@ -39,7 +39,12 @@ static inline int local_events_need_delivery_nomask(void)
 
 static inline int local_events_need_delivery(void)
 {
-    if ( !vcpu_event_delivery_is_enabled(current) )
+    struct vcpu *v = current;
+
+    if ( unlikely(is_idle_vcpu(v)) )
+        return 0;
+
+    if ( !vcpu_event_delivery_is_enabled(v) )
         return 0;
     return local_events_need_delivery_nomask();
 }
Signature · 1 line
2.1.4
#1 lore raw
Quoted 57 lines · Julien Grall

The commit 569fb6c "xen/arm: Data abort exception (R/W) mem_access events" makes apply_p2m_changes to call hypercall_preempt_check for any operation rather than for relinquish.

The function hypercall_preempt_check call local_events_need_delivery which rely on the current VCPU is not an idle VCPU. Although, during DOM0 building the current VCPU is an idle one. This would make Xen crash with the following stack trace:

(XEN) CPU0: Unexpected Trap: Data Abort
[...]
(XEN) Xen call trace:

(XEN)    [<00256ef4>] apply_p2m_changes+0x210/0x1190 (PC)
(XEN)    [<002506b4>] gic_events_need_delivery+0x5c/0x13c (LR)
(XEN)    [<002580ec>] map_mmio_regions+0x64/0x74
(XEN)    [<00251958>] gicv2v_setup+0xf8/0x150
(XEN)    [<00250964>] gicv_setup+0x20/0x30
(XEN)    [<0024cb3c>] arch_domain_create+0x170/0x244
(XEN)    [<00207df0>] domain_create+0x2ac/0x4d8
(XEN)    [<0028e3d0>] start_xen+0xcbc/0xee4
(XEN)    [<00200540>] paging+0x94/0xd8

(XEN)
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) CPU0: Unexpected Trap: Data Abort
(XEN)
(XEN) ****************************************

As an idle VCPU can never receive an event, return 0 when the current VCPU is an idle VCPU in local_events_need_delivery.

---

This bug has been catched during boot on Mustang. This is because we have to map large chunk of PCI memory region.

I was able to reproduce the bug on midway by lowering down preempt_count_limit to 16 in apply_p2m_changes.

Although, I'm not sure this is the right fix for the bug.

---
 xen/include/asm-arm/event.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
xen/include/asm-arm/event.h +0 -0
index 5330dfe..0149d06 100644
@@ -39,7 +39,12 @@ static inline int local_events_need_delivery_nomask(void)
 
 static inline int local_events_need_delivery(void)
 {

xen/include/asm-arm/event.h static inline int local_events_need_delivery_nomask(void) · line 50

Quoted 10 lines
xen/include/asm-arm/event.h +6 -1
-    if ( !vcpu_event_delivery_is_enabled(current) )
+    struct vcpu *v = current;
+
+    if ( unlikely(is_idle_vcpu(v)) )
+        return 0;
+
+    if ( !vcpu_event_delivery_is_enabled(v) )
         return 0;
     return local_events_need_delivery_nomask();
 }

Is it actually considered correct in Xen to call hypercall_preempt_check and/or local_events_need_delivery on the idle vcpu?

Shouldn't it be avoided and maybe a BUG_ON added here instead?

#2 lore raw

Hi Stefano,

Quoted 56 lines · Stefano Stabellini
Quoted 55 lines · Julien Grall

The commit 569fb6c "xen/arm: Data abort exception (R/W) mem_access events" makes apply_p2m_changes to call hypercall_preempt_check for any operation rather than for relinquish.

The function hypercall_preempt_check call local_events_need_delivery which rely on the current VCPU is not an idle VCPU. Although, during DOM0 building the current VCPU is an idle one. This would make Xen crash with the following stack trace:

(XEN) CPU0: Unexpected Trap: Data Abort
[...]
(XEN) Xen call trace:

(XEN)    [<00256ef4>] apply_p2m_changes+0x210/0x1190 (PC)
(XEN)    [<002506b4>] gic_events_need_delivery+0x5c/0x13c (LR)
(XEN)    [<002580ec>] map_mmio_regions+0x64/0x74
(XEN)    [<00251958>] gicv2v_setup+0xf8/0x150
(XEN)    [<00250964>] gicv_setup+0x20/0x30
(XEN)    [<0024cb3c>] arch_domain_create+0x170/0x244
(XEN)    [<00207df0>] domain_create+0x2ac/0x4d8
(XEN)    [<0028e3d0>] start_xen+0xcbc/0xee4
(XEN)    [<00200540>] paging+0x94/0xd8

(XEN)
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) CPU0: Unexpected Trap: Data Abort
(XEN)
(XEN) ****************************************

As an idle VCPU can never receive an event, return 0 when the current VCPU is an idle VCPU in local_events_need_delivery.

---

This bug has been catched during boot on Mustang. This is because we have to map large chunk of PCI memory region.

I was able to reproduce the bug on midway by lowering down preempt_count_limit to 16 in apply_p2m_changes.

Although, I'm not sure this is the right fix for the bug.

---
 xen/include/asm-arm/event.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
xen/include/asm-arm/event.h +0 -0
index 5330dfe..0149d06 100644
@@ -39,7 +39,12 @@ static inline int local_events_need_delivery_nomask(void)
 
Quoted 15 lines

xen/include/asm-arm/event.h static inline int local_events_need_delivery_nomask(void) · line 50

Quoted 12 lines
xen/include/asm-arm/event.h +6 -1
 static inline int local_events_need_delivery(void)
 {
-    if ( !vcpu_event_delivery_is_enabled(current) )
+    struct vcpu *v = current;
+
+    if ( unlikely(is_idle_vcpu(v)) )
+        return 0;
+
+    if ( !vcpu_event_delivery_is_enabled(v) )
         return 0;
     return local_events_need_delivery_nomask();
 }

Is it actually considered correct in Xen to call hypercall_preempt_check and/or local_events_need_delivery on the idle vcpu?

It seems that the x86 version of hypercall_preempt_check is able to cope with idle VCPU. Although, I'm not sure if there is path where hypercall_preempt_check can be called on an idle VCPU (cc x86 maintainers for this purpose).

Quoted 1 line

Shouldn't it be avoided and maybe a BUG_ON added here instead?

This patch was the simple way to fix the bug. I have other ideas in mind which require some rework in apply_p2m_changes.

I'll wait to see what x86 maintainers think.

Regards,

Signature · 1 line
Julien Grall
#3 lore raw

Hi,

Quoted 80 lines · Julien Grall

Hi Stefano,

Quoted 56 lines · Stefano Stabellini
Quoted 55 lines · Julien Grall

The commit 569fb6c "xen/arm: Data abort exception (R/W) mem_access events" makes apply_p2m_changes to call hypercall_preempt_check for any operation rather than for relinquish.

The function hypercall_preempt_check call local_events_need_delivery which rely on the current VCPU is not an idle VCPU. Although, during DOM0 building the current VCPU is an idle one. This would make Xen crash with the following stack trace:

(XEN) CPU0: Unexpected Trap: Data Abort
[...]
(XEN) Xen call trace:

(XEN)    [<00256ef4>] apply_p2m_changes+0x210/0x1190 (PC)
(XEN)    [<002506b4>] gic_events_need_delivery+0x5c/0x13c (LR)
(XEN)    [<002580ec>] map_mmio_regions+0x64/0x74
(XEN)    [<00251958>] gicv2v_setup+0xf8/0x150
(XEN)    [<00250964>] gicv_setup+0x20/0x30
(XEN)    [<0024cb3c>] arch_domain_create+0x170/0x244
(XEN)    [<00207df0>] domain_create+0x2ac/0x4d8
(XEN)    [<0028e3d0>] start_xen+0xcbc/0xee4
(XEN)    [<00200540>] paging+0x94/0xd8

(XEN)
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) CPU0: Unexpected Trap: Data Abort
(XEN)
(XEN) ****************************************

As an idle VCPU can never receive an event, return 0 when the current VCPU is an idle VCPU in local_events_need_delivery.

---

This bug has been catched during boot on Mustang. This is because we have to map large chunk of PCI memory region.

I was able to reproduce the bug on midway by lowering down preempt_count_limit to 16 in apply_p2m_changes.

Although, I'm not sure this is the right fix for the bug.

---
 xen/include/asm-arm/event.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
xen/include/asm-arm/event.h +0 -0
index 5330dfe..0149d06 100644
@@ -39,7 +39,12 @@ static inline int local_events_need_delivery_nomask(void)
 
Quoted 15 lines

xen/include/asm-arm/event.h static inline int local_events_need_delivery_nomask(void) · line 50

Quoted 12 lines
xen/include/asm-arm/event.h +6 -1
 static inline int local_events_need_delivery(void)
 {
-    if ( !vcpu_event_delivery_is_enabled(current) )
+    struct vcpu *v = current;
+
+    if ( unlikely(is_idle_vcpu(v)) )
+        return 0;
+
+    if ( !vcpu_event_delivery_is_enabled(v) )
         return 0;
     return local_events_need_delivery_nomask();
 }

Is it actually considered correct in Xen to call hypercall_preempt_check and/or local_events_need_delivery on the idle vcpu?

It seems that the x86 version of hypercall_preempt_check is able to cope with idle VCPU. Although, I'm not sure if there is path where hypercall_preempt_check can be called on an idle VCPU (cc x86 maintainers for this purpose).

Quoted 6 lines
Quoted 1 line

Shouldn't it be avoided and maybe a BUG_ON added here instead?

This patch was the simple way to fix the bug. I have other ideas in mind which require some rework in apply_p2m_changes.

I'll wait to see what x86 maintainers think.

Any news on this front? The head Xen is still failing in LAVA. We are risking that
new regressions get introduced undetected while we wait for the fix for this...

Riku

#4 lore raw

Hi,

Quoted 83 lines · Riku Voipio
Quoted 82 lines · Julien Grall

Hi Stefano,

Quoted 56 lines · Stefano Stabellini
Quoted 55 lines · Julien Grall

The commit 569fb6c "xen/arm: Data abort exception (R/W) mem_access events" makes apply_p2m_changes to call hypercall_preempt_check for any operation rather than for relinquish.

The function hypercall_preempt_check call local_events_need_delivery which rely on the current VCPU is not an idle VCPU. Although, during DOM0 building the current VCPU is an idle one. This would make Xen crash with the following stack trace:

(XEN) CPU0: Unexpected Trap: Data Abort
[...]
(XEN) Xen call trace:

(XEN)    [<00256ef4>] apply_p2m_changes+0x210/0x1190 (PC)
(XEN)    [<002506b4>] gic_events_need_delivery+0x5c/0x13c (LR)
(XEN)    [<002580ec>] map_mmio_regions+0x64/0x74
(XEN)    [<00251958>] gicv2v_setup+0xf8/0x150
(XEN)    [<00250964>] gicv_setup+0x20/0x30
(XEN)    [<0024cb3c>] arch_domain_create+0x170/0x244
(XEN)    [<00207df0>] domain_create+0x2ac/0x4d8
(XEN)    [<0028e3d0>] start_xen+0xcbc/0xee4
(XEN)    [<00200540>] paging+0x94/0xd8

(XEN)
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) CPU0: Unexpected Trap: Data Abort
(XEN)
(XEN) ****************************************

As an idle VCPU can never receive an event, return 0 when the current VCPU is an idle VCPU in local_events_need_delivery.

---

This bug has been catched during boot on Mustang. This is because we have to map large chunk of PCI memory region.

I was able to reproduce the bug on midway by lowering down preempt_count_limit to 16 in apply_p2m_changes.

Although, I'm not sure this is the right fix for the bug.

---
  xen/include/asm-arm/event.h | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
xen/include/asm-arm/event.h +0 -0
index 5330dfe..0149d06 100644
@@ -39,7 +39,12 @@ static inline int local_events_need_delivery_nomask(void)
 
Quoted 15 lines

xen/include/asm-arm/event.h static inline int local_events_need_delivery_nomask(void) · line 50

Quoted 12 lines
xen/include/asm-arm/event.h +6 -1
  static inline int local_events_need_delivery(void)
  {
-    if ( !vcpu_event_delivery_is_enabled(current) )
+    struct vcpu *v = current;
+
+    if ( unlikely(is_idle_vcpu(v)) )
+        return 0;
+
+    if ( !vcpu_event_delivery_is_enabled(v) )
          return 0;
      return local_events_need_delivery_nomask();
  }

Is it actually considered correct in Xen to call hypercall_preempt_check and/or local_events_need_delivery on the idle vcpu?

It seems that the x86 version of hypercall_preempt_check is able to cope with idle VCPU. Although, I'm not sure if there is path where hypercall_preempt_check can be called on an idle VCPU (cc x86 maintainers for this purpose).

Quoted 1 line

Shouldn't it be avoided and maybe a BUG_ON added here instead?

Quoted 8 lines
Quoted 4 lines

This patch was the simple way to fix the bug. I have other ideas in mind which require some rework in apply_p2m_changes.

I'll wait to see what x86 maintainers think.

Any news on this front? The head Xen is still failing in LAVA. We are risking that
new regressions get introduced undetected while we wait for the fix for this...

Most of the maintainers were at the Xen hackathon last week and it's a bank holiday in England. I expect to have feedback during this week.

Although, no big changes has been pushed to Xen upstream as the committers were away too. Therefore, we should not see any major regression.

Regards,

Signature · 1 line
Julien Grall
#5 lore raw
In reply to Julien Grall
Quoted 22 lines · Julien Grall
Quoted 6 lines
Quoted 6 lines
xen/include/asm-arm/event.h +0 -0
index 5330dfe..0149d06 100644
@@ -39,7 +39,12 @@ static inline int local_events_need_delivery_nomask(void)
 
Quoted 15 lines

xen/include/asm-arm/event.h static inline int local_events_need_delivery_nomask(void) · line 50

Quoted 12 lines
xen/include/asm-arm/event.h +6 -1
 static inline int local_events_need_delivery(void)
 {
-    if ( !vcpu_event_delivery_is_enabled(current) )
+    struct vcpu *v = current;
+
+    if ( unlikely(is_idle_vcpu(v)) )
+        return 0;
+
+    if ( !vcpu_event_delivery_is_enabled(v) )
         return 0;
     return local_events_need_delivery_nomask();
 }

Is it actually considered correct in Xen to call hypercall_preempt_check and/or local_events_need_delivery on the idle vcpu?

Quoted 2 lines

It seems that the x86 version of hypercall_preempt_check is able to cope with idle VCPU.

AFAICT that's just a coincidence, since an idle vcpu won't ever have a pending up call.

Quoted 10 lines

Although, I'm not sure if there is path where hypercall_preempt_check can be called on an idle VCPU (cc x86 maintainers for this purpose).

Quoted 1 line

Shouldn't it be avoided and maybe a BUG_ON added here instead?

This patch was the simple way to fix the bug. I have other ideas in mind which require some rework in apply_p2m_changes.

I'll wait to see what x86 maintainers think.

I'm inclined to just go with this patch for now, unless Stefano is nacking it.

One question first: What aspect of local_events_need_delivery relies on the vcpu not being an idle one? I suppose something is not initialised, but what.

Ian.

#6 lore raw
Quoted 35 lines · Ian Campbell
Quoted 22 lines · Julien Grall
Quoted 6 lines
Quoted 6 lines
xen/include/asm-arm/event.h +0 -0
index 5330dfe..0149d06 100644
@@ -39,7 +39,12 @@ static inline int local_events_need_delivery_nomask(void)
 
Quoted 15 lines

xen/include/asm-arm/event.h static inline int local_events_need_delivery_nomask(void) · line 50

Quoted 12 lines
xen/include/asm-arm/event.h +6 -1
 static inline int local_events_need_delivery(void)
 {
-    if ( !vcpu_event_delivery_is_enabled(current) )
+    struct vcpu *v = current;
+
+    if ( unlikely(is_idle_vcpu(v)) )
+        return 0;
+
+    if ( !vcpu_event_delivery_is_enabled(v) )
         return 0;
     return local_events_need_delivery_nomask();
 }

Is it actually considered correct in Xen to call hypercall_preempt_check and/or local_events_need_delivery on the idle vcpu?

Quoted 2 lines

It seems that the x86 version of hypercall_preempt_check is able to cope with idle VCPU.

AFAICT that's just a coincidence, since an idle vcpu won't ever have a pending up call.

Quoted 6 lines

Although, I'm not sure if there is path where hypercall_preempt_check can be called on an idle VCPU (cc x86 maintainers for this purpose).

Quoted 1 line

Shouldn't it be avoided and maybe a BUG_ON added here instead?

Quoted 7 lines
Quoted 4 lines

This patch was the simple way to fix the bug. I have other ideas in mind which require some rework in apply_p2m_changes.

I'll wait to see what x86 maintainers think.

I'm inclined to just go with this patch for now, unless Stefano is nacking it.

I won't nack it.

Quoted 7 lines

One question first: What aspect of local_events_need_delivery relies on the vcpu not being an idle one? I suppose something is not initialised, but what.

Ian.

#7 lore raw
In reply to Ian Campbell

Hi Ian,

Quoted 35 lines · Ian Campbell
Quoted 22 lines · Julien Grall
Quoted 6 lines
Quoted 6 lines
xen/include/asm-arm/event.h +0 -0
index 5330dfe..0149d06 100644
@@ -39,7 +39,12 @@ static inline int local_events_need_delivery_nomask(void)
 
Quoted 15 lines

xen/include/asm-arm/event.h static inline int local_events_need_delivery_nomask(void) · line 50

Quoted 12 lines
xen/include/asm-arm/event.h +6 -1
 static inline int local_events_need_delivery(void)
 {
-    if ( !vcpu_event_delivery_is_enabled(current) )
+    struct vcpu *v = current;
+
+    if ( unlikely(is_idle_vcpu(v)) )
+        return 0;
+
+    if ( !vcpu_event_delivery_is_enabled(v) )
         return 0;
     return local_events_need_delivery_nomask();
 }

Is it actually considered correct in Xen to call hypercall_preempt_check and/or local_events_need_delivery on the idle vcpu?

Quoted 2 lines

It seems that the x86 version of hypercall_preempt_check is able to cope with idle VCPU.

AFAICT that's just a coincidence, since an idle vcpu won't ever have a pending up call.

Quoted 6 lines

Although, I'm not sure if there is path where hypercall_preempt_check can be called on an idle VCPU (cc x86 maintainers for this purpose).

Quoted 1 line

Shouldn't it be avoided and maybe a BUG_ON added here instead?

Quoted 7 lines
Quoted 4 lines

This patch was the simple way to fix the bug. I have other ideas in mind which require some rework in apply_p2m_changes.

I'll wait to see what x86 maintainers think.

I'm inclined to just go with this patch for now, unless Stefano is nacking it.

This patch seem to turn into a workaround, would it be better to move check idle_check in apply_p2m_check?

I will prepare a follow-up to avoid properly the call hypercall_preempt_check with idle_vcpu.

Quoted 3 lines

One question first: What aspect of local_events_need_delivery relies on the vcpu not being an idle one? I suppose something is not initialised, but what.

Everything related to the vGIC is not initialized. It's used in local_event_need_delivery_nomask (see irq_to_pending and gic_events_need_devlivery).

Signature · 1 line
Julien Grall
#8 lore raw
Quoted 9 lines · Julien Grall
Quoted 2 lines

I'm inclined to just go with this patch for now, unless Stefano is nacking it.

This patch seem to turn into a workaround, would it be better to move check idle_check in apply_p2m_check?

I will prepare a follow-up to avoid properly the call hypercall_preempt_check with idle_vcpu.

Quoted 7 lines
Quoted 3 lines

One question first: What aspect of local_events_need_delivery relies on the vcpu not being an idle one? I suppose something is not initialised, but what.

Everything related to the vGIC is not initialized. It's used in local_event_need_delivery_nomask (see irq_to_pending and gic_events_need_devlivery).

Would it be better to arrange that vcpu_event_delivery_is_enabled is never true for an idle vcpu? Either with an explicit check or by arranging regs->cpsr to say that?

Ian.

Quoted 1 line
#9 lore raw
Quoted 14 lines · Ian Campbell
Quoted 13 lines · Julien Grall
Quoted 2 lines

I'm inclined to just go with this patch for now, unless Stefano is nacking it.

This patch seem to turn into a workaround, would it be better to move check idle_check in apply_p2m_check?

I will prepare a follow-up to avoid properly the call hypercall_preempt_check with idle_vcpu.

Quoted 3 lines

One question first: What aspect of local_events_need_delivery relies on the vcpu not being an idle one? I suppose something is not initialised, but what.

Quoted 7 lines
Quoted 3 lines

Everything related to the vGIC is not initialized. It's used in local_event_need_delivery_nomask (see irq_to_pending and gic_events_need_devlivery).

Would it be better to arrange that vcpu_event_delivery_is_enabled is never true for an idle vcpu? Either with an explicit check or by arranging regs->cpsr to say that?

That could work.

Although, as discussed IRL, I will move the check of idle_vcpu in apply_p2m_changes in a preempt variable.

Regards,

Signature · 1 line
Julien Grall
#10 lore raw
In reply to Julien Grall

IMHO we should check if op==RELINQUISH || op==MEMACCESS before calling hypercall_preempt_check.
That was a change I made - previously it was only called if the op was RELINQUISH
and not the other way around.

Tamas

Quoted 67 lines · Julien Grall

The commit 569fb6c "xen/arm: Data abort exception (R/W) mem_access events" makes apply_p2m_changes to call hypercall_preempt_check for any operation rather than for relinquish.

The function hypercall_preempt_check call local_events_need_delivery which rely on the current VCPU is not an idle VCPU. Although, during DOM0 building the current VCPU is an idle one. This would make Xen crash with the following stack trace:

(XEN) CPU0: Unexpected Trap: Data Abort
[...]
(XEN) Xen call trace:

(XEN)    [<00256ef4>] apply_p2m_changes+0x210/0x1190 (PC)
(XEN)    [<002506b4>] gic_events_need_delivery+0x5c/0x13c (LR)
(XEN)    [<002580ec>] map_mmio_regions+0x64/0x74
(XEN)    [<00251958>] gicv2v_setup+0xf8/0x150
(XEN)    [<00250964>] gicv_setup+0x20/0x30
(XEN)    [<0024cb3c>] arch_domain_create+0x170/0x244
(XEN)    [<00207df0>] domain_create+0x2ac/0x4d8
(XEN)    [<0028e3d0>] start_xen+0xcbc/0xee4
(XEN)    [<00200540>] paging+0x94/0xd8

(XEN)
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) CPU0: Unexpected Trap: Data Abort
(XEN)
(XEN) ****************************************

As an idle VCPU can never receive an event, return 0 when the current VCPU is an idle VCPU in local_events_need_delivery.

---

This bug has been catched during boot on Mustang. This is because we have to map large chunk of PCI memory region.

I was able to reproduce the bug on midway by lowering down preempt_count_limit to 16 in apply_p2m_changes.

Although, I'm not sure this is the right fix for the bug.

---
 xen/include/asm-arm/event.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
xen/include/asm-arm/event.h +6 -1
index 5330dfe..0149d06 100644
@@ -39,7 +39,12 @@ static inline int
 local_events_need_delivery_nomask(void)
 
 static inline int local_events_need_delivery(void)
 {
-    if ( !vcpu_event_delivery_is_enabled(current) )
+    struct vcpu *v = current;
+
+    if ( unlikely(is_idle_vcpu(v)) )
+        return 0;
+
+    if ( !vcpu_event_delivery_is_enabled(v) )
         return 0;
     return local_events_need_delivery_nomask();
Quoted 5 lines

}
--
2.1.4

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#11 lore raw

Hi Tamas,

Quoted 3 lines · Tamas K Lengyel

IMHO we should check if op==RELINQUISH || op==MEMACCESS before calling hypercall_preempt_check. That was a change I made - previously it was only called if the op was RELINQUISH and not the other way around.

I though about it but it make the code a lot uglier. It would be worst if we decide to preempt more operations in the future...

Regards,

Signature · 1 line
Julien Grall
#12 lore raw
Quoted 7 lines · Julien Grall

Hi Tamas,

Quoted 3 lines · Tamas K Lengyel

IMHO we should check if op==RELINQUISH || op==MEMACCESS before calling hypercall_preempt_check. That was a change I made - previously it was only called if the op was RELINQUISH and not the other way around.

Quoted 8 lines

I though about it but it make the code a lot uglier. It would be worst if we decide to preempt more operations in the future...

Regards,

--
Julien Grall

Ack, that was my original reasoning as well for switching it up.

Tamas

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel