xen/arm: irq: Don't use _IRQ_PENDING when handling host interrupt
PATCH 1/1 xen/arm: irq: Don't use _IRQ_PENDING when handling host interrupt
While SPIs are shared between CPU, it is not possible to receive the same interrupts on a different CPU while the interrupt is in active state. The deactivation of the interrupt is done at the end of the handling.
This means the _IRQ_PENDING logic is unecessary on Arm as a same interrupt can never come up while in the loop. So remove it to simplify the interrupt handle code.
--- xen/arch/arm/irq.c | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-)
xen/arch/arm/irq.c +10 -22
@@ -199,6 +199,7 @@ int request_irq(unsigned int irq, unsigned int irqflags,void do_IRQ (struct cpu_user_regs *regs,unsigned int irq,int is_fiq) {struct irq_desc *desc =irq_to_desc (irq); +struct irqaction *action;perfc_incr (irqs);
@@ -242,35 +243,22 @@ void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int is_fiq) goto out_no_end; } -set_bit (_IRQ_PENDING, &desc->status); - -/* -* Since we set PENDING, if another processor is handling a different -* instance of this same irq, the other processor will take care of it. -*/ -if (test_bit (_IRQ_DISABLED, &desc->status) || -test_bit (_IRQ_INPROGRESS, &desc->status) ) +if (test_bit (_IRQ_DISABLED, &desc->status) ) goto out;set_bit (_IRQ_INPROGRESS, &desc->status); -while (test_bit (_IRQ_PENDING, &desc->status) ) - { -struct irqaction *action; + action = desc->action; -clear_bit (_IRQ_PENDING, &desc->status); - action = desc->action; +spin_unlock_irq (&desc->lock); -spin_unlock_irq (&desc->lock); - -do - { - action->handler (irq, action->dev_id, regs); - action = action->next; - }while ( action ); +do + { + action->handler (irq, action->dev_id, regs); + action = action->next; + }while ( action ); -spin_lock_irq (&desc->lock); - } +spin_lock_irq (&desc->lock);clear_bit (_IRQ_INPROGRESS, &desc->status);
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Hi,
Gentle ping.
Cheers,
Quoted 72 lines · Julien Grall
While SPIs are shared between CPU, it is not possible to receive the same interrupts on a different CPU while the interrupt is in active state. The deactivation of the interrupt is done at the end of the handling.
This means the
_IRQ_PENDINGlogic is unecessary on Arm as a same interrupt can never come up while in the loop. So remove it to simplify the interrupt handle code.Signed-off-by Julien Grall <[email protected]>--- xen/arch/arm/irq.c | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-)xen/arch/arm/irq.c +10
-22@@ -199,6 +199,7 @@ int request_irq(unsigned int irq, unsigned int irqflags,void do_IRQ (struct cpu_user_regs *regs,unsigned int irq,int is_fiq) {struct irq_desc *desc =irq_to_desc (irq); +struct irqaction *action;perfc_incr (irqs);@@ -242,35 +243,22 @@ void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int is_fiq) goto out_no_end; } -set_bit (_IRQ_PENDING, &desc->status); - -/* -* Since we set PENDING, if another processor is handling a different -* instance of this same irq, the other processor will take care of it. -*/ -if (test_bit (_IRQ_DISABLED, &desc->status) || -test_bit (_IRQ_INPROGRESS, &desc->status) ) +if (test_bit (_IRQ_DISABLED, &desc->status) ) goto out;set_bit (_IRQ_INPROGRESS, &desc->status); -while (test_bit (_IRQ_PENDING, &desc->status) ) - { -struct irqaction *action; + action = desc->action; -clear_bit (_IRQ_PENDING, &desc->status); - action = desc->action; +spin_unlock_irq (&desc->lock); -spin_unlock_irq (&desc->lock); - -do - { - action->handler (irq, action->dev_id, regs); - action = action->next; - }while ( action ); +do + { + action->handler (irq, action->dev_id, regs); + action = action->next; + }while ( action ); -spin_lock_irq (&desc->lock); - } +spin_lock_irq (&desc->lock);clear_bit (_IRQ_INPROGRESS, &desc->status);
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 8 lines · Julien Grall
While SPIs are shared between CPU, it is not possible to receive the same interrupts on a different CPU while the interrupt is in active state. The deactivation of the interrupt is done at the end of the handling.
This means the
_IRQ_PENDINGlogic is unecessary on Arm as a same interrupt can never come up while in the loop. So remove it to simplify the interrupt handle code.
What about _IRQ_PENDING macro itself?
Any reasons to not eliminate it?
Quoted 64 lines
Signed-off-by Julien Grall <[email protected]>--- xen/arch/arm/irq.c | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-)xen/arch/arm/irq.c +10
-22@@ -199,6 +199,7 @@ int request_irq(unsigned int irq, unsigned int irqflags,void do_IRQ (struct cpu_user_regs *regs,unsigned int irq,int is_fiq) {struct irq_desc *desc =irq_to_desc (irq); +struct irqaction *action;perfc_incr (irqs);@@ -242,35 +243,22 @@ void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int is_fiq) goto out_no_end; } -set_bit (_IRQ_PENDING, &desc->status); - -/* -* Since we set PENDING, if another processor is handling a different -* instance of this same irq, the other processor will take care of it. -*/ -if (test_bit (_IRQ_DISABLED, &desc->status) || -test_bit (_IRQ_INPROGRESS, &desc->status) ) +if (test_bit (_IRQ_DISABLED, &desc->status) ) goto out;set_bit (_IRQ_INPROGRESS, &desc->status); -while (test_bit (_IRQ_PENDING, &desc->status) ) - { -struct irqaction *action; + action = desc->action; -clear_bit (_IRQ_PENDING, &desc->status); - action = desc->action; +spin_unlock_irq (&desc->lock); -spin_unlock_irq (&desc->lock); - -do - { - action->handler (irq, action->dev_id, regs); - action = action->next; - }while ( action ); +do + { + action->handler (irq, action->dev_id, regs); + action = action->next; + }while ( action ); -spin_lock_irq (&desc->lock); - } +spin_lock_irq (&desc->lock);clear_bit (_IRQ_INPROGRESS, &desc->status);
Signature · 7 lines
Sincerely, Andrii Anisov. _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 6 lines · Andrii Anisov
Quoted 5 lines · Julien Grall
While SPIs are shared between CPU, it is not possible to receive the same interrupts on a different CPU while the interrupt is in active state. The deactivation of the interrupt is done at the end of the handling.
Quoted 6 lines
Quoted 3 lines
This means the
_IRQ_PENDINGlogic is unecessary on Arm as a same interrupt can never come up while in the loop. So remove it to simplify the interrupt handle code.What about
_IRQ_PENDINGmacro itself?
Any reasons to not eliminate it?
It is in common header and used by x86. It is preferable to keep all IRQ flags at the same place hence why this was not moved in arch-specific header.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Andrii Anisov
Reviewed-byHello Julien,
Quoted 1 line · Julien Grall
It is in common header and used by x86. It is preferable to keep all IRQ flags at the same place hence why this was not moved in arch-specific header.
Ah, yes, sure.
Signature · 7 lines
Sincerely, Andrii Anisov. _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 30 lines · Julien Grall
While SPIs are shared between CPU, it is not possible to receive the same interrupts on a different CPU while the interrupt is in active state. The deactivation of the interrupt is done at the end of the handling.
This means the
_IRQ_PENDINGlogic is unecessary on Arm as a same interrupt can never come up while in the loop. So remove it to simplify the interrupt handle code.Signed-off-by Julien Grall <[email protected]>--- xen/arch/arm/irq.c | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-)xen/arch/arm/irq.c +1
-0@@ -199,6 +199,7 @@ int request_irq(unsigned int irq, unsigned int irqflags,void do_IRQ (struct cpu_user_regs *regs,unsigned int irq,int is_fiq) {struct irq_desc *desc =irq_to_desc (irq); +struct irqaction *action;perfc_incr (irqs);@@ -242,35 +243,22 @@ void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int is_fiq) goto out_no_end; }
xen/arch/arm/irq.c void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int is_fiq) · line 247
Quoted 10 lines
xen/arch/arm/irq.c +1
-8-set_bit (_IRQ_PENDING, &desc->status); - -/* -* Since we set PENDING, if another processor is handling a different -* instance of this same irq, the other processor will take care of it. -*/ -if (test_bit (_IRQ_DISABLED, &desc->status) || -test_bit (_IRQ_INPROGRESS, &desc->status) ) +if (test_bit (_IRQ_DISABLED, &desc->status) ) goto out;
It is a good idea to remove the IRQ_PENDING logic, that is OK.
However, are we sure that we want to remove the _IRQ_INPROGRESS check too? IRQ handlers shouldn't be called twice in a row. Given that _IRQ_INPROGRESS can be set manually (gicv2_set_active_state) it seems it would be a good idea to keep the check anyway?
Quoted 33 lines
xen/arch/arm/irq.c +8
-14set_bit (_IRQ_INPROGRESS, &desc->status); -while (test_bit (_IRQ_PENDING, &desc->status) ) - { -struct irqaction *action; + action = desc->action; -clear_bit (_IRQ_PENDING, &desc->status); - action = desc->action; +spin_unlock_irq (&desc->lock); -spin_unlock_irq (&desc->lock); - -do - { - action->handler (irq, action->dev_id, regs); - action = action->next; - }while ( action ); +do + { + action->handler (irq, action->dev_id, regs); + action = action->next; + }while ( action ); -spin_lock_irq (&desc->lock); - } +spin_lock_irq (&desc->lock);clear_bit (_IRQ_INPROGRESS, &desc->status);Signature · 1 line
2.11.0
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Hi Stefano,
Quoted 45 lines · Stefano Stabellini
Quoted 30 lines · Julien Grall
While SPIs are shared between CPU, it is not possible to receive the same interrupts on a different CPU while the interrupt is in active state. The deactivation of the interrupt is done at the end of the handling.
This means the
_IRQ_PENDINGlogic is unecessary on Arm as a same interrupt can never come up while in the loop. So remove it to simplify the interrupt handle code.Signed-off-by Julien Grall <[email protected]>--- xen/arch/arm/irq.c | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-)xen/arch/arm/irq.c +1
-0@@ -199,6 +199,7 @@ int request_irq(unsigned int irq, unsigned int irqflags,void do_IRQ (struct cpu_user_regs *regs,unsigned int irq,int is_fiq) {struct irq_desc *desc =irq_to_desc (irq); +struct irqaction *action;perfc_incr (irqs);@@ -242,35 +243,22 @@ void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int is_fiq) goto out_no_end; }xen/arch/arm/irq.c void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int is_fiq) · line 247
Quoted 10 lines
xen/arch/arm/irq.c +1
-8-set_bit (_IRQ_PENDING, &desc->status); - -/* -* Since we set PENDING, if another processor is handling a different -* instance of this same irq, the other processor will take care of it. -*/ -if (test_bit (_IRQ_DISABLED, &desc->status) || -test_bit (_IRQ_INPROGRESS, &desc->status) ) +if (test_bit (_IRQ_DISABLED, &desc->status) ) goto out;It is a good idea to remove the
IRQ_PENDINGlogic, that is OK.
Quoted 4 lines
However, are we sure that we want to remove the
_IRQ_INPROGRESScheck too? IRQ handlers shouldn't be called twice in a row. Given that_IRQ_INPROGRESScan be set manually (gicv2_set_active_state) it seems it would be a good idea to keep the check anyway?
set_active_state is only used by the vGIC to replicate state from of the virtual interrupt to the physical interrupt. We don't have the virtual interrupt in this path (see above).
Any other user (e.g interrupts routed to Xen) would be pretty broken. At best you would break the interrupt flow. At worst, you may never receive the interrupt again.
So I think we can drop _IRQ_PROGRESS here.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Stefano Stabellini
Reviewed-byQuoted 57 lines · Julien Grall
Hi Stefano,
Quoted 45 lines · Stefano Stabellini
Quoted 35 lines · Julien Grall
While SPIs are shared between CPU, it is not possible to receive the same interrupts on a different CPU while the interrupt is in active state. The deactivation of the interrupt is done at the end of the handling.
This means the
_IRQ_PENDINGlogic is unecessary on Arm as a same interrupt can never come up while in the loop. So remove it to simplify the interrupt handle code.Signed-off-by Julien Grall <[email protected]>--- xen/arch/arm/irq.c | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-)xen/arch/arm/irq.c +1
-0@@ -199,6 +199,7 @@ int request_irq(unsigned int irq, unsigned int irqflags,void do_IRQ (struct cpu_user_regs *regs,unsigned int irq,int is_fiq) {struct irq_desc *desc =irq_to_desc (irq); +struct irqaction *action;perfc_incr (irqs); @@ -242,35 +243,22 @@ void do_IRQ(struct cpu_user_regs *regs, unsignedint irq, int
is_fiq)goto out_no_end; }-
set_bit(_IRQ_PENDING, &desc->status);xen/arch/arm/irq.c +0
-4- -/* -* Since we set PENDING, if another processor is handling a different -* instance of this same irq, the other processor will take care of it.
xen/arch/arm/irq.c void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int is_fiq) · line 247
Quoted 5 lines
xen/arch/arm/irq.c +1
-3-*/ -if (test_bit (_IRQ_DISABLED, &desc->status) || -test_bit (_IRQ_INPROGRESS, &desc->status) ) +if (test_bit (_IRQ_DISABLED, &desc->status) ) goto out;It is a good idea to remove the
IRQ_PENDINGlogic, that is OK.Quoted 4 lines
However, are we sure that we want to remove the
_IRQ_INPROGRESScheck too? IRQ handlers shouldn't be called twice in a row. Given that_IRQ_INPROGRESScan be set manually (gicv2_set_active_state) it seems it would be a good idea to keep the check anyway?
set_active_stateis only used by the vGIC to replicate state from of the virtual interrupt to the physical interrupt. We don't have the virtual interrupt in this path (see above).
Quoted 5 lines
Any other user (e.g interrupts routed to Xen) would be pretty broken. At best you would break the interrupt flow. At worst, you may never receive the interrupt again.
So I think we can drop
_IRQ_PROGRESShere.
I gave it a close look. You are right, it is safe to remove the _IRQ_PROGRESS check here.
The thing that worries me a bit is that technically set_active_state is part of the gic_hw_operations functions which are not necessarily guest
specific: we haven't written down anywhere that set_active_state cannot be called passing one of the xen irqs as parameter. I agree it would be broken to do so, but still... Maybe we should add a comment?
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Hi,
Quoted 67 lines · Stefano Stabellini
Quoted 57 lines · Julien Grall
Hi Stefano,
Quoted 45 lines · Stefano Stabellini
Quoted 35 lines · Julien Grall
While SPIs are shared between CPU, it is not possible to receive the same interrupts on a different CPU while the interrupt is in active state. The deactivation of the interrupt is done at the end of the handling.
This means the
_IRQ_PENDINGlogic is unecessary on Arm as a same interrupt can never come up while in the loop. So remove it to simplify the interrupt handle code.Signed-off-by Julien Grall <[email protected]>--- xen/arch/arm/irq.c | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-)xen/arch/arm/irq.c +1
-0@@ -199,6 +199,7 @@ int request_irq(unsigned int irq, unsigned int irqflags,void do_IRQ (struct cpu_user_regs *regs,unsigned int irq,int is_fiq) {struct irq_desc *desc =irq_to_desc (irq); +struct irqaction *action;perfc_incr (irqs); @@ -242,35 +243,22 @@ void do_IRQ(struct cpu_user_regs *regs, unsignedint irq, int
is_fiq)goto out_no_end; }-
set_bit(_IRQ_PENDING, &desc->status);xen/arch/arm/irq.c +0
-4- -/* -* Since we set PENDING, if another processor is handling a different -* instance of this same irq, the other processor will take care of it.
xen/arch/arm/irq.c void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int is_fiq) · line 247
Quoted 5 lines
xen/arch/arm/irq.c +1
-3-*/ -if (test_bit (_IRQ_DISABLED, &desc->status) || -test_bit (_IRQ_INPROGRESS, &desc->status) ) +if (test_bit (_IRQ_DISABLED, &desc->status) ) goto out;It is a good idea to remove the
IRQ_PENDINGlogic, that is OK.Quoted 4 lines
However, are we sure that we want to remove the
_IRQ_INPROGRESScheck too? IRQ handlers shouldn't be called twice in a row. Given that_IRQ_INPROGRESScan be set manually (gicv2_set_active_state) it seems it would be a good idea to keep the check anyway?
set_active_stateis only used by the vGIC to replicate state from of the virtual interrupt to the physical interrupt. We don't have the virtual interrupt in this path (see above).Quoted 5 lines
Any other user (e.g interrupts routed to Xen) would be pretty broken. At best you would break the interrupt flow. At worst, you may never receive the interrupt again.
So I think we can drop
_IRQ_PROGRESShere.I gave it a close look. You are right, it is safe to remove the
_IRQ_PROGRESScheck here.
Quoted 8 lines
Reviewed-by Stefano Stabellini <[email protected]>The thing that worries me a bit is that technically
set_active_stateis part of thegic_hw_operationsfunctions which are not necessarily guest
specific: we haven't written down anywhere thatset_active_statecannot be called passing one of the xen irqs as parameter. I agree it would be broken to do so, but still... Maybe we should add a comment?
How about adding an ASSERT(test_bit(_IRQ_GUEST, &desc->status)) ?
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 78 lines · Julien Grall
Hi,
Quoted 75 lines · Stefano Stabellini
Quoted 61 lines · Julien Grall
Hi Stefano,
Quoted 49 lines · Stefano Stabellini
Quoted 39 lines · Julien Grall
While SPIs are shared between CPU, it is not possible to receive the same interrupts on a different CPU while the interrupt is in active state. The deactivation of the interrupt is done at the end of the handling.
This means the
_IRQ_PENDINGlogic is unecessary on Arm as a same interrupt can never come up while in the loop. So remove it to simplify the interrupt handle code.Signed-off-by Julien Grall <[email protected]>--- xen/arch/arm/irq.c | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-)xen/arch/arm/irq.c +1
-0@@ -199,6 +199,7 @@ int request_irq(unsigned int irq, unsigned int irqflags,void do_IRQ (struct cpu_user_regs *regs,unsigned int irq,int is_fiq) {struct irq_desc *desc =irq_to_desc (irq); +struct irqaction *action;perfc_incr (irqs);@@ -242,35 +243,22 @@ void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int is_fiq) goto out_no_end; }-
set_bit(_IRQ_PENDING, &desc->status);xen/arch/arm/irq.c +0
-3- -/* -* Since we set PENDING, if another processor is handling a different
- * instance of this same irq, the other processor will take care
of
it.xen/arch/arm/irq.c void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int is_fiq) · line 247
Quoted 5 lines
xen/arch/arm/irq.c +1
-3-*/ -if (test_bit (_IRQ_DISABLED, &desc->status) || -test_bit (_IRQ_INPROGRESS, &desc->status) ) +if (test_bit (_IRQ_DISABLED, &desc->status) ) goto out;It is a good idea to remove the
IRQ_PENDINGlogic, that is OK.Quoted 4 lines
However, are we sure that we want to remove the
_IRQ_INPROGRESScheck too? IRQ handlers shouldn't be called twice in a row. Given that_IRQ_INPROGRESScan be set manually (gicv2_set_active_state) it seems it would be a good idea to keep the check anyway?
set_active_stateis only used by the vGIC to replicate state from of the virtual interrupt to the physical interrupt. We don't have the virtual interrupt in this path (see above).Quoted 6 lines
Any other user (e.g interrupts routed to Xen) would be pretty broken. At best
you would break the interrupt flow. At worst, you may never receive the interrupt again.So I think we can drop
_IRQ_PROGRESShere.I gave it a close look. You are right, it is safe to remove the
_IRQ_PROGRESScheck here.Reviewed-by Stefano Stabellini <[email protected]>
Quoted 7 lines
Quoted 5 lines
The thing that worries me a bit is that technically
set_active_stateis part of thegic_hw_operationsfunctions which are not necessarily guest
specific: we haven't written down anywhere thatset_active_statecannot be called passing one of the xen irqs as parameter. I agree it would be broken to do so, but still... Maybe we should add a comment?How about adding an
ASSERT(test_bit(_IRQ_GUEST, &desc->status))?
even better
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Hi Stefano,
Quoted 85 lines · Stefano Stabellini
Quoted 84 lines · Julien Grall
Hi,
Quoted 80 lines · Stefano Stabellini
Quoted 61 lines · Julien Grall
Hi Stefano,
Quoted 49 lines · Stefano Stabellini
Quoted 39 lines · Julien Grall
While SPIs are shared between CPU, it is not possible to receive the same interrupts on a different CPU while the interrupt is in active state. The deactivation of the interrupt is done at the end of the handling.
This means the
_IRQ_PENDINGlogic is unecessary on Arm as a same interrupt can never come up while in the loop. So remove it to simplify the interrupt handle code.Signed-off-by Julien Grall <[email protected]>--- xen/arch/arm/irq.c | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-)xen/arch/arm/irq.c +1
-0@@ -199,6 +199,7 @@ int request_irq(unsigned int irq, unsigned int irqflags,void do_IRQ (struct cpu_user_regs *regs,unsigned int irq,int is_fiq) {struct irq_desc *desc =irq_to_desc (irq); +struct irqaction *action;perfc_incr (irqs);@@ -242,35 +243,22 @@ void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int is_fiq) goto out_no_end; } - set_bit(_IRQ_PENDING, &desc->status);xen/arch/arm/irq.c +0
-3- -/* -* Since we set PENDING, if another processor is handling a different
- * instance of this same irq, the other processor will take care
of
it.xen/arch/arm/irq.c void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int is_fiq) · line 247
Quoted 5 lines
xen/arch/arm/irq.c +1
-3-*/ -if (test_bit (_IRQ_DISABLED, &desc->status) || -test_bit (_IRQ_INPROGRESS, &desc->status) ) +if (test_bit (_IRQ_DISABLED, &desc->status) ) goto out;It is a good idea to remove the
IRQ_PENDINGlogic, that is OK.Quoted 4 lines
However, are we sure that we want to remove the
_IRQ_INPROGRESScheck too? IRQ handlers shouldn't be called twice in a row. Given that_IRQ_INPROGRESScan be set manually (gicv2_set_active_state) it seems it would be a good idea to keep the check anyway?
set_active_stateis only used by the vGIC to replicate state from of the virtual interrupt to the physical interrupt. We don't have the virtual interrupt in this path (see above).Quoted 6 lines
Any other user (e.g interrupts routed to Xen) would be pretty broken. At best
you would break the interrupt flow. At worst, you may never receive the interrupt again.So I think we can drop
_IRQ_PROGRESShere.I gave it a close look. You are right, it is safe to remove the
_IRQ_PROGRESScheck here.Reviewed-by Stefano Stabellini <[email protected]>The thing that worries me a bit is that technically
set_active_stateis part of thegic_hw_operationsfunctions which are not necessarily guest
specific: we haven't written down anywhere thatset_active_statecannot be called passing one of the xen irqs as parameter. I agree it would be broken to do so, but still... Maybe we should add a comment?
Quoted 3 lines
Quoted 1 line
How about adding an
ASSERT(test_bit(_IRQ_GUEST, &desc->status))?even better
Do you want the change to be in this patch or separately?
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 94 lines · Julien Grall
Quoted 93 lines · Stefano Stabellini
Quoted 92 lines · Julien Grall
Hi,
Quoted 88 lines · Stefano Stabellini
Quoted 67 lines · Julien Grall
Hi Stefano,
Quoted 52 lines · Stefano Stabellini
Quoted 42 lines · Julien Grall
While SPIs are shared between CPU, it is not possible to receive the
same interrupts on a different CPU while the interrupt is in active
state. The deactivation of the interrupt is done at the end of the handling.This means the
_IRQ_PENDINGlogic is unecessary on Arm as a same interrupt can never come up while in the loop. So remove it to simplify the interrupt handle code.Signed-off-by Julien Grall <[email protected]>--- xen/arch/arm/irq.c | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-)xen/arch/arm/irq.c +1
-0@@ -199,6 +199,7 @@ int request_irq(unsigned int irq, unsigned int irqflags,void do_IRQ (struct cpu_user_regs *regs,unsigned int irq,int is_fiq) {struct irq_desc *desc =irq_to_desc (irq); +struct irqaction *action;perfc_incr (irqs);@@ -242,35 +243,22 @@ void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int is_fiq) goto out_no_end; } - set_bit(_IRQ_PENDING, &desc->status);xen/arch/arm/irq.c +0
-3- -/* -* Since we set PENDING, if another processor is handling a different
- * instance of this same irq, the other processor will take
care
of
it.xen/arch/arm/irq.c
Quoted 5 lines
xen/arch/arm/irq.c +1
-3-*/ -if (test_bit (_IRQ_DISABLED, &desc->status) || -test_bit (_IRQ_INPROGRESS, &desc->status) ) +if (test_bit (_IRQ_DISABLED, &desc->status) ) goto out;It is a good idea to remove the
IRQ_PENDINGlogic, that is OK.Quoted 6 lines
However, are we sure that we want to remove the
_IRQ_INPROGRESScheck
too? IRQ handlers shouldn't be called twice in a row. Given that_IRQ_INPROGRESScan be set manually (gicv2_set_active_state) it seems it
would be a good idea to keep the check anyway?
set_active_stateis only used by the vGIC to replicate state from of the
virtual interrupt to the physical interrupt. We don't have the virtual interrupt in this path (see above).Quoted 8 lines
Any other user (e.g interrupts routed to Xen) would be pretty broken. At
best
you would break the interrupt flow. At worst, you may never receive the
interrupt again.So I think we can drop
_IRQ_PROGRESShere.I gave it a close look. You are right, it is safe to remove the
_IRQ_PROGRESScheck here.Reviewed-by Stefano Stabellini <[email protected]>The thing that worries me a bit is that technically
set_active_stateis part of thegic_hw_operationsfunctions which are not necessarily guest
specific: we haven't written down anywhere thatset_active_statecannot be called passing one of the xen irqs as parameter. I agree it would be broken to do so, but still... Maybe we should add a comment?
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
How about adding an
ASSERT(test_bit(_IRQ_GUEST, &desc->status))?even better
Do you want the change to be in this patch or separately?
In this patch please
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Hi Stefano,
Quoted 95 lines · Stefano Stabellini
Quoted 94 lines · Julien Grall
Quoted 93 lines · Stefano Stabellini
Quoted 92 lines · Julien Grall
Hi,
Quoted 88 lines · Stefano Stabellini
Quoted 67 lines · Julien Grall
Hi Stefano,
Quoted 52 lines · Stefano Stabellini
Quoted 42 lines · Julien Grall
While SPIs are shared between CPU, it is not possible to receive the
same interrupts on a different CPU while the interrupt is in active
state. The deactivation of the interrupt is done at the end of the handling.This means the
_IRQ_PENDINGlogic is unecessary on Arm as a same interrupt can never come up while in the loop. So remove it to simplify the interrupt handle code.Signed-off-by Julien Grall <[email protected]>--- xen/arch/arm/irq.c | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-)xen/arch/arm/irq.c +1
-0@@ -199,6 +199,7 @@ int request_irq(unsigned int irq, unsigned int irqflags,void do_IRQ (struct cpu_user_regs *regs,unsigned int irq,int is_fiq) {struct irq_desc *desc =irq_to_desc (irq); +struct irqaction *action;perfc_incr (irqs);@@ -242,35 +243,22 @@ void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int is_fiq) goto out_no_end; } - set_bit(_IRQ_PENDING, &desc->status);xen/arch/arm/irq.c +0
-3- -/* -* Since we set PENDING, if another processor is handling a different
- * instance of this same irq, the other processor will take
care
of
it.xen/arch/arm/irq.c
Quoted 5 lines
xen/arch/arm/irq.c +1
-3-*/ -if (test_bit (_IRQ_DISABLED, &desc->status) || -test_bit (_IRQ_INPROGRESS, &desc->status) ) +if (test_bit (_IRQ_DISABLED, &desc->status) ) goto out;It is a good idea to remove the
IRQ_PENDINGlogic, that is OK.Quoted 6 lines
However, are we sure that we want to remove the
_IRQ_INPROGRESScheck
too? IRQ handlers shouldn't be called twice in a row. Given that_IRQ_INPROGRESScan be set manually (gicv2_set_active_state) it seems it
would be a good idea to keep the check anyway?
set_active_stateis only used by the vGIC to replicate state from of the
virtual interrupt to the physical interrupt. We don't have the virtual interrupt in this path (see above).Quoted 8 lines
Any other user (e.g interrupts routed to Xen) would be pretty broken. At
best
you would break the interrupt flow. At worst, you may never receive the
interrupt again.So I think we can drop
_IRQ_PROGRESShere.I gave it a close look. You are right, it is safe to remove the
_IRQ_PROGRESScheck here.Reviewed-by Stefano Stabellini <[email protected]>The thing that worries me a bit is that technically
set_active_stateis part of thegic_hw_operationsfunctions which are not necessarily guest
specific: we haven't written down anywhere thatset_active_statecannot be called passing one of the xen irqs as parameter. I agree it would be broken to do so, but still... Maybe we should add a comment?
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
How about adding an
ASSERT(test_bit(_IRQ_GUEST, &desc->status))?even better
Do you want the change to be in this patch or separately?
In this patch please
Ok, I will respin the patch.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel