A suggestion about processing irq
Hello,
While I was reading gic handling part of xen arm, I noticed that, in gic_set_guest_irq function, if lr_pending is not empty, the arrival irq is also stored into pending list.
I think although lr_pending is not empty, there maybe empty slots in lr, and if so, we can insert IRQ immediately. Since I'd like to keep the IRQ in priority order, how about checking the highest priority in lr_pending list rather than emptiness?
Here goes the simple patch:
---
arch/arm/gic.c 2013-07-31 11:19:28.094799335 +0900 renamed from arch/arm/gic.c 2013-07-30 10:16:45.076382483 +0900 +7 -3
@@ -587,12 +587,17 @@ unsigned int state, unsigned int priority) { int i; - struct pending_irq *iter, *n; + struct pending_irq *iter, *n, *first_item; unsigned long flags; spin_lock_irqsave(&gic.lock, flags); + + first_item = list_entry( (&v->arch.vgic.lr_pending)->next, + typeof(*iter), lr_queue ); - if (( v == current ) && (list_empty(&v->arch.vgic.lr_pending) )) + if ( ( v == current ) && + ( list_empty(&v->arch.vgic.lr_pending) || + ( priority > first_item->priority ) ) ) { i = find_first_zero_bit(&this_cpu(lr_mask), nr_lrs); if (i < nr_lrs) { ---
Thanks.
Best Regards.
Jaemin Kim
Quoted 7 lines · 김재민
Hello,
While I was reading gic handling part of xen arm, I noticed that, ingic_set_guest_irqfunction, iflr_pendingis not empty, the arrival irq is also stored into pending list.
I think althoughlr_pendingis not empty, there maybe empty slots in lr, and if so, we can insert IRQ immediately. Since I'd like to keep the IRQ in priority order, how about checking the highest priority inlr_pendinglist rather than emptiness?
Here goes the simple patch:
Julien & Stefano know about this stuff -- guys?
Julien was planning to rework a bunch of the interrupt handling stuff, I don't know if that was orthogonal to this or not.
Quoted 25 lines
Signed-off-by Jaemin Kim <[email protected]>---
diff -urNxen/arch/arm/gic.cxen2/arch/arm/gic.carch/arm/gic.c 2013-07-31 11:19:28.094799335 +0900 renamed from arch/arm/gic.c 2013-07-30 10:16:45.076382483 +0900 +7
-3@@ -587,12 +587,17 @@ unsigned int state, unsigned int priority) { int i; - struct pending_irq *iter, *n; + struct pending_irq *iter, *n, *first_item; unsigned long flags; spin_lock_irqsave(&gic.lock, flags); + + first_item = list_entry( (&v->arch.vgic.lr_pending)->next, + typeof(*iter), lr_queue ); - if (( v == current ) && (list_empty(&v->arch.vgic.lr_pending) )) + if ( ( v == current ) && + ( list_empty(&v->arch.vgic.lr_pending) || + ( priority > first_item->priority ) ) ) { i = find_first_zero_bit(&this_cpu(lr_mask), nr_lrs); if (i < nr_lrs) { ---
Quoted 7 lines
Thanks.
Best Regards.
Jaemin Kim
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 9 lines · Ian Campbell
Quoted 7 lines · 김재민
Hello,
While I was reading gic handling part of xen arm, I noticed that, ingic_set_guest_irqfunction, iflr_pendingis not empty, the arrival irq is also stored into pending list.
I think althoughlr_pendingis not empty, there maybe empty slots in lr, and if so, we can insert IRQ immediately. Since I'd like to keep the IRQ in priority order, how about checking the highest priority inlr_pendinglist rather than emptiness?
Here goes the simple patch:
Quoted 4 lines
Julien & Stefano know about this stuff -- guys?
Julien was planning to rework a bunch of the interrupt handling stuff, I don't know if that was orthogonal to this or not.
Not yet.. I though there is no Operating System with IRQ priority support. I will add to my TODO list for interrupt.
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Quoted 1 line · 김재민
Hello,
Hi,
Quoted 5 lines
While I was reading gic handling part of xen arm, I noticed that, in
gic_set_guest_irqfunction, iflr_pendingis not empty, the arrival irq is also stored into pending list.
I think althoughlr_pendingis not empty, there maybe empty slots in lr, and if so, we can insert IRQ immediately. Since I'd like to keep the IRQ in priority order, how about checking the highest priority inlr_pendinglist rather than emptiness?
Thanks for this patch. Do you plan to have a full support for priority?
Cheers,
Quoted 25 lines
Here goes the simple patch:
Signed-off-by Jaemin Kim <[email protected]>---
diff -urNxen/arch/arm/gic.cxen2/arch/arm/gic.carch/arm/gic.c 2013-07-31 11:19:28.094799335 +0900 renamed from arch/arm/gic.c 2013-07-30 10:16:45.076382483 +0900 +7
-2@@ -587,12 +587,17 @@ unsigned int state, unsigned int priority) { int i; - struct pending_irq *iter, *n; + struct pending_irq *iter, *n, *first_item; unsigned long flags; spin_lock_irqsave(&gic.lock, flags); + + first_item = list_entry( (&v->arch.vgic.lr_pending)->next, + typeof(*iter), lr_queue ); - if (( v == current ) && (list_empty(&v->arch.vgic.lr_pending) )) + if ( ( v == current ) && + ( list_empty(&v->arch.vgic.lr_pending) || + ( priority > first_item->priority ) ) ) { i = find_first_zero_bit(&this_cpu(lr_mask), nr_lrs); if (i < nr_lrs) {
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Jaemin,
thank you for the patch and sorry for my late reply.
Quoted 5 lines · 김재민
Hello,
While I was reading gic handling part of xen arm, I noticed that, ingic_set_guest_irqfunction, iflr_pendingis not empty, the arrival irq is also stored into pending list.
I think althoughlr_pendingis not empty, there maybe empty slots in lr, and if so, we can insert IRQ immediately.
Yes, the idea is that if not list_empty(&v->arch.vgic.lr_pending), somebody else is already queuing for a free LR register, so there is no point in trying to find one.
If you look at maintenance_interrupt, you'll see that as soon as an LR is freed, the first irq in the lr_pending queue is going to be removed from the queue and added to the register. So if at least one irq is prensent in lr_pending, all lr registers must be already in use.
Quoted 2 lines
Since I'd like to keep the IRQ in priority order, how about checking the highest priority in
lr_pendinglist rather than emptiness?
Injecting irqs in priority order is a good goal to have, but it requires more than this change.
From gic_set_guest_irq you would need to find an LR register with an IRQ of lower priority that is PENDING and not ACTIVE and remove it from the register, replacing it with the new irq. You would need to add the removed irq to lr_pending again.
Also keep in mind that lower priority numbers mean higher priority.
Quoted 15 lines
Here goes the simple patch:
Signed-off-by Jaemin Kim <[email protected]>---
diff -urNxen/arch/arm/gic.cxen2/arch/arm/gic.carch/arm/gic.c 2013-07-31 11:19:28.094799335 +0900 renamed from arch/arm/gic.c 2013-07-30 10:16:45.076382483 +0900 +1
-1@@ -587,12 +587,17 @@ unsigned int state, unsigned int priority) { int i; - struct pending_irq *iter, *n; + struct pending_irq *iter, *n, *first_item; unsigned long flags; spin_lock_irqsave(&gic.lock, flags);
arch/arm/gic.c 2013-07-31 11:19:28.094799335 +0900 line 601
Quoted 10 lines
arch/arm/gic.c 2013-07-31 11:19:28.094799335 +0900 renamed from arch/arm/gic.c 2013-07-30 10:16:45.076382483 +0900 +6
-1+ + first_item = list_entry( (&v->arch.vgic.lr_pending)->next, + typeof(*iter), lr_queue ); - if (( v == current ) && (list_empty(&v->arch.vgic.lr_pending) )) + if ( ( v == current ) && + ( list_empty(&v->arch.vgic.lr_pending) || + ( priority > first_item->priority ) ) ) { i = find_first_zero_bit(&this_cpu(lr_mask), nr_lrs); if (i < nr_lrs) {
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel