Skip to contentSkip to conversation

xen/arm: Do not include in the image functions...

PATCH In review Michal Orzel 2 participants 6 messages Dec 6, 2021 – Dec 7, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm: Do not include in the image functions...

vtimer_update_irqs, vtimer_update_irq and vcpu_update_evtchn_irq if CONFIG_NEW_VGIC is not set.

enter_hypervisor_from_guest is protecting calls to these functions with CONFIG_NEW_VGIC but their definitions and declarations are not protected. This means that we are including them in the image even though we are not making use of them. Fix that.

---
 xen/arch/arm/domain.c        | 2 ++
 xen/arch/arm/vtimer.c        | 2 ++
 xen/include/asm-arm/event.h  | 2 ++
 xen/include/asm-arm/vtimer.h | 2 ++
 4 files changed, 8 insertions(+)
xen/arch/arm/domain.c +2 -0
index 96e1b23550..7baa2b7417 100644
@@ -1108,12 +1108,14 @@ void vcpu_mark_events_pending(struct vcpu *v)
     vgic_inject_irq(v->domain, v, v->domain->arch.evtchn_irq, true);
 }
 
+#ifdef CONFIG_NEW_VGIC
 void vcpu_update_evtchn_irq(struct vcpu *v)
 {
     bool pending = vcpu_info(v, evtchn_upcall_pending);
 
     vgic_inject_irq(v->domain, v, v->domain->arch.evtchn_irq, pending);
 }
+#endif
 
 /* The ARM spec declares that even if local irqs are masked in
  * the CPSR register, an irq should wake up a cpu from WFI anyway.
xen/arch/arm/vtimer.c +2 -0
index 0196951af4..63a8374f7d 100644
@@ -347,6 +347,7 @@ bool vtimer_emulate(struct cpu_user_regs *regs, union hsr hsr)
     }
 }
 
+#ifdef CONFIG_NEW_VGIC
 static void vtimer_update_irq(struct vcpu *v, struct vtimer *vtimer,
                               register_t vtimer_ctl)
 {
@@ -395,6 +396,7 @@ void vtimer_update_irqs(struct vcpu *v)
     /* For the physical timer we rely on our emulated state. */
     vtimer_update_irq(v, &v->arch.phys_timer, v->arch.phys_timer.ctl);
 }
+#endif /* CONFIG_NEW_VGIC */
 
 /*
  * Local variables:
xen/include/asm-arm/event.h +2 -0
index b14c166ad6..f4193cb62e 100644
@@ -5,7 +5,9 @@
 
 void vcpu_kick(struct vcpu *v);
 void vcpu_mark_events_pending(struct vcpu *v);
+#ifdef CONFIG_NEW_VGIC
 void vcpu_update_evtchn_irq(struct vcpu *v);
+#endif
 void vcpu_block_unless_event_pending(struct vcpu *v);
 
 static inline int vcpu_event_delivery_is_enabled(struct vcpu *v)
xen/include/asm-arm/vtimer.h +2 -0
index 9d4fb4c6e8..1e945ae2c5 100644
@@ -27,7 +27,9 @@ extern bool vtimer_emulate(struct cpu_user_regs *regs, union hsr hsr);
 extern void virt_timer_save(struct vcpu *v);
 extern void virt_timer_restore(struct vcpu *v);
 extern void vcpu_timer_destroy(struct vcpu *v);
+#ifdef CONFIG_NEW_VGIC
 void vtimer_update_irqs(struct vcpu *v);
+#endif
 
 #endif
 
Signature · 1 line
2.29.0
#1 lore raw

Hi Michal,

Quoted 6 lines · Michal Orzel

vtimer_update_irqs, vtimer_update_irq and vcpu_update_evtchn_irq if CONFIG_NEW_VGIC is not set.

enter_hypervisor_from_guest is protecting calls to these functions
with CONFIG_NEW_VGIC but their definitions and declarations are not > protected. This means that we are including them in the image even though we are not making use of them. Fix that.

While I agree, they are only used by the new vGIC, the implementation of the functions are not. So I don't think they should be protected by CONFIG_NEW_VGIC.

Actually, I am not convinced they should be protected. But I guess you did that for a reason. Would you be able to clarify what is your reason?

Cheers,

Signature · 1 line
Julien Grall
#2 lore raw

Hi Julien,

Quoted 6 lines · Julien Grall

Hi Michal,

Quoted 3 lines · Michal Orzel

vtimer_update_irqs, vtimer_update_irq and vcpu_update_evtchn_irq if CONFIG_NEW_VGIC is not set.

Quoted 8 lines
Quoted 3 lines

enter_hypervisor_from_guest is protecting calls to these functions
with CONFIG_NEW_VGIC but their definitions and declarations are not > protected. This means that we are including them in the image even though we are not making use of them. Fix that.

While I agree, they are only used by the new vGIC, the implementation of the functions are not. So I don't think they should be protected by CONFIG_NEW_VGIC.

Actually, I am not convinced they should be protected. But I guess you did that for a reason. Would you be able to clarify what is your reason?

From what I know + what the commit introducing these fucntions states (b9db96f71a74), the current vGIC does not handle level-triggered vIRQs. The functionality of these functions is only related to new VGIC implementation which can handle level triggered vIRQs. So I do not think that these functions are generic and thus I believe they should be protected.

Quoted 2 lines

Cheers,

Cheers,
Michal

#3 lore raw
Quoted 1 line · Michal Orzel

Hi Julien,

Hi Michal,

Quoted 11 lines · Julien Grall
Quoted 10 lines

Hi Michal,

Quoted 6 lines · Michal Orzel

vtimer_update_irqs, vtimer_update_irq and vcpu_update_evtchn_irq if CONFIG_NEW_VGIC is not set.

enter_hypervisor_from_guest is protecting calls to these functions
with CONFIG_NEW_VGIC but their definitions and declarations are not > protected. This means that we are including them in the image even though we are not making use of them. Fix that.

Quoted 6 lines
Quoted 4 lines

While I agree, they are only used by the new vGIC, the implementation of the functions are not. So I don't think they should be protected by CONFIG_NEW_VGIC.

Actually, I am not convinced they should be protected. But I guess you did that for a reason. Would you be able to clarify what is your reason?

From what I know + what the commit introducing these fucntions states (b9db96f71a74), the current vGIC does not handle level-triggered vIRQs.
The functionality of these functions is only related to new VGIC implementation which can handle level triggered vIRQs.

This is a known error in the vGIC implementation which should be resolved before this leads to a disaster.

Quoted 1 line

So I do not think that these functions are generic and thus I believe they should be protected.

None of the functions rely on the internal of the new vGIC. In fact, as I wrote above, the current vGIC ought to be able to handle level-trigger interrupt properly.

They are not called for the current vGIC because there was concern about the performance impact on each trap (see [1]).

So I think those functions ought to stay compiled in for everyone.

Cheers,

[1] https://lore.kernel.org/xen-devel/[email protected]/

Quoted 6 lines
Quoted 2 lines

Cheers,

Cheers,
Michal

Signature · 1 line
Julien Grall
#4 lore raw

Hi Julien,

Quoted 18 lines · Julien Grall
Quoted 1 line · Michal Orzel

Hi Julien,

Hi Michal,

Quoted 11 lines · Julien Grall
Quoted 10 lines

Hi Michal,

Quoted 6 lines · Michal Orzel

vtimer_update_irqs, vtimer_update_irq and vcpu_update_evtchn_irq if CONFIG_NEW_VGIC is not set.

enter_hypervisor_from_guest is protecting calls to these functions
with CONFIG_NEW_VGIC but their definitions and declarations are not > protected. This means that we are including them in the image even though we are not making use of them. Fix that.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

While I agree, they are only used by the new vGIC, the implementation of the functions are not. So I don't think they should be protected by CONFIG_NEW_VGIC.

Actually, I am not convinced they should be protected. But I guess you did that for a reason. Would you be able to clarify what is your reason?

 From what I know + what the commit introducing these fucntions states (b9db96f71a74), the current vGIC does not handle level-triggered vIRQs. The functionality of these functions is only related to new VGIC implementation which can handle level triggered vIRQs.

This is a known error in the vGIC implementation which should be resolved before this leads to a disaster.

I just thought that if this error is present for such a long time, there are no plans to make current vgic handle level type irqs.

Quoted 9 lines
Quoted 2 lines

So I do not think that these functions are generic and thus I believe they should be protected.

None of the functions rely on the internal of the new vGIC. In fact, as I wrote above, the current vGIC ought to be able to handle level-trigger interrupt properly.

They are not called for the current vGIC because there was concern about the performance impact on each trap (see [1]).

So I think those functions ought to stay compiled in for everyone.

I'm totally ok with that.

Quoted 13 lines

Cheers,

[1] https://lore.kernel.org/xen-devel/[email protected]/

Quoted 6 lines
Quoted 2 lines

Cheers,

Cheers,
Michal

Cheers,
Michal

#5 lore raw

Hi,

Quoted 21 lines · Michal Orzel
Quoted 20 lines · Julien Grall
Quoted 1 line · Michal Orzel

Hi Julien,

Hi Michal,

Quoted 13 lines · Julien Grall
Quoted 12 lines

Hi Michal,

Quoted 6 lines · Michal Orzel

vtimer_update_irqs, vtimer_update_irq and vcpu_update_evtchn_irq if CONFIG_NEW_VGIC is not set.

enter_hypervisor_from_guest is protecting calls to these functions
with CONFIG_NEW_VGIC but their definitions and declarations are not > protected. This means that we are including them in the image even though we are not making use of them. Fix that.

While I agree, they are only used by the new vGIC, the implementation of the functions are not. So I don't think they should be protected by CONFIG_NEW_VGIC.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Actually, I am not convinced they should be protected. But I guess you did that for a reason. Would you be able to clarify what is your reason?

 From what I know + what the commit introducing these fucntions states (b9db96f71a74), the current vGIC does not handle level-triggered vIRQs.
The functionality of these functions is only related to new VGIC implementation which can handle level triggered vIRQs.

This is a known error in the vGIC implementation which should be resolved before this leads to a disaster.

I just thought that if this error is present for such a long time, there are no plans to make current vgic handle level type irqs.

The error has been present for such a long time because no-one yet volunteered to properly fix it. That said, the new vGIC has been an attempt to resolve it but the effort kind of died.

It would be nice to revive the effort.

Cheers,

Signature · 1 line
Julien Grall