Re: [OE-core] [PATCH] qemu: IRQ Stats not shown with virsh command

2019-05-23 Thread Burton, Ross
On Thu, 23 May 2019 at 07:48, Jiping Ma  wrote:
> Issue: LIN10-5872
>
> Add IRQ statistic code in kvm/i8259.c.
>
> (LOCAL REV: NOT UPSTREAM) -- oe-core already included it.

Can you remove all these Wind River-specific lines and replace them
with a better commit message?

Ross
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH] qemu: IRQ Stats not shown with virsh command

2019-05-23 Thread Jiping Ma
Issue: LIN10-5872

Add IRQ statistic code in kvm/i8259.c.

(LOCAL REV: NOT UPSTREAM) -- oe-core already included it.

Signed-off-by: Jiping Ma 
---
 ...1-kvm-i8259-support-info-pic-and-info-irq.patch |  76 +
 .../0002-i8259-use-DEBUG_IRQ_COUNT-always.patch|  89 +++
 ...59-generalize-statistics-into-common-code.patch | 177 +
 meta/recipes-devtools/qemu/qemu_2.10.0.bb  |   3 +
 4 files changed, 345 insertions(+)
 create mode 100644 
meta/recipes-devtools/qemu/qemu/0001-kvm-i8259-support-info-pic-and-info-irq.patch
 create mode 100644 
meta/recipes-devtools/qemu/qemu/0002-i8259-use-DEBUG_IRQ_COUNT-always.patch
 create mode 100644 
meta/recipes-devtools/qemu/qemu/0003-i8259-generalize-statistics-into-common-code.patch

diff --git 
a/meta/recipes-devtools/qemu/qemu/0001-kvm-i8259-support-info-pic-and-info-irq.patch
 
b/meta/recipes-devtools/qemu/qemu/0001-kvm-i8259-support-info-pic-and-info-irq.patch
new file mode 100644
index 00..1640ac403d
--- /dev/null
+++ 
b/meta/recipes-devtools/qemu/qemu/0001-kvm-i8259-support-info-pic-and-info-irq.patch
@@ -0,0 +1,76 @@
+From ba55afb7804d9d77234440b4cf00529b052e8b87 Mon Sep 17 00:00:00 2001
+From: Peter Xu 
+Date: Sun, 10 Dec 2017 14:38:18 +0800
+Subject: [PATCH 1/3] kvm-i8259: support "info pic" and "info irq"
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Let's leverage the i8259 common code for kvm-i8259 too.
+
+I think it's still possible that stats can lost when i8259 is in kernel
+and meanwhile when irqfd is used, e.g., by vfio or vhost devices.
+However that should be rare IMHO since they should be using MSIs mostly
+if they really want performance (that's why people use vhost and device
+assignment), and no old INTx should be used.  As long as the INTx users
+are emulated in QEMU the stats will be correct.
+
+For "info pic", it should be always accurate since we fetch kvm regs
+before dump.
+
+More importantly, it's just too simple to do this now - it's only 10+
+LOC to gain this feature.
+
+Upstream-Status: Backport
+
+Signed-off-by: Peter Xu 
+Message-Id: <20171210063819.14892-5-pet...@redhat.com>
+Reviewed-by: Philippe Mathieu-Daudé 
+Signed-off-by: Paolo Bonzini 
+Signed-off-by: Jiping Ma 
+---
+ hw/i386/kvm/i8259.c | 8 
+ 1 file changed, 8 insertions(+)
+
+diff --git a/hw/i386/kvm/i8259.c b/hw/i386/kvm/i8259.c
+index 11d1b726..57abe091 100644
+--- a/hw/i386/kvm/i8259.c
 b/hw/i386/kvm/i8259.c
+@@ -111,6 +111,7 @@ static void kvm_pic_set_irq(void *opaque, int irq, int 
level)
+ {
+ int delivered;
+ 
++pic_stat_update_irq(irq, level);
+ delivered = kvm_set_irq(kvm_state, irq, level);
+ apic_report_irq_delivered(delivered);
+ }
+@@ -139,12 +140,15 @@ static void kvm_i8259_class_init(ObjectClass *klass, 
void *data)
+ KVMPICClass *kpc = KVM_PIC_CLASS(klass);
+ PICCommonClass *k = PIC_COMMON_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
++InterruptStatsProviderClass *ic = INTERRUPT_STATS_PROVIDER_CLASS(klass);
+ 
+ dc->reset = kvm_pic_reset;
+ kpc->parent_realize = dc->realize;
+ dc->realize   = kvm_pic_realize;
+ k->pre_save   = kvm_pic_get;
+ k->post_load  = kvm_pic_put;
++ic->get_statistics = pic_get_statistics;
++ic->print_info = pic_print_info;
+ }
+ 
+ static const TypeInfo kvm_i8259_info = {
+@@ -153,6 +157,10 @@ static const TypeInfo kvm_i8259_info = {
+ .instance_size = sizeof(PICCommonState),
+ .class_init = kvm_i8259_class_init,
+ .class_size = sizeof(KVMPICClass),
++.interfaces = (InterfaceInfo[]) {
++{ TYPE_INTERRUPT_STATS_PROVIDER },
++{ }
++},
+ };
+ 
+ static void kvm_pic_register_types(void)
+-- 
+2.18.1
+
diff --git 
a/meta/recipes-devtools/qemu/qemu/0002-i8259-use-DEBUG_IRQ_COUNT-always.patch 
b/meta/recipes-devtools/qemu/qemu/0002-i8259-use-DEBUG_IRQ_COUNT-always.patch
new file mode 100644
index 00..f6484de67e
--- /dev/null
+++ 
b/meta/recipes-devtools/qemu/qemu/0002-i8259-use-DEBUG_IRQ_COUNT-always.patch
@@ -0,0 +1,89 @@
+From 67cdfed7e6515e773bd5927a1a3c2860537d4d50 Mon Sep 17 00:00:00 2001
+From: Peter Xu 
+Date: Sun, 10 Dec 2017 14:38:16 +0800
+Subject: [PATCH 2/3] i8259: use DEBUG_IRQ_COUNT always
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+It's not really scary to even enable it forever.  After all it's i8259,
+and it's even not the kernel one.
+
+Then we can remove quite a few of lines to make it cleaner.  And "info
+irq" will always work for it.
+
+Upstream-Status: Backport
+
+Signed-off-by: Peter Xu 
+Message-Id: <20171210063819.14892-3-pet...@redhat.com>
+Reviewed-by: Philippe Mathieu-Daudé 
+Signed-off-by: Paolo Bonzini 
+Signed-off-by: Jiping Ma 
+---
+ hw/intc/i8259.c | 17 +
+ 1 file changed, 1 insertion(+), 16 deletions(-)
+
+diff --git a/hw/intc/i8259.c b/hw/intc/i8259.c
+index fe9ecd6b..993aef9d 100644
+--- a/hw/intc/i8259.c