[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 38/46] kvm-i8259: support "info pic" and "info irq"
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 38/46] kvm-i8259: support "info pic" and "info irq" |
Date: |
Wed, 20 Dec 2017 18:14:50 +0100 |
From: Peter Xu <address@hidden>
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.
Signed-off-by: Peter Xu <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/i386/kvm/i8259.c | 8 ++++++++
hw/intc/i8259_common.c | 1 +
2 files changed, 9 insertions(+)
diff --git a/hw/i386/kvm/i8259.c b/hw/i386/kvm/i8259.c
index 11d1b72..57abe09 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)
diff --git a/hw/intc/i8259_common.c b/hw/intc/i8259_common.c
index a3cadde..7efd2e8 100644
--- a/hw/intc/i8259_common.c
+++ b/hw/intc/i8259_common.c
@@ -132,6 +132,7 @@ void pic_print_info(InterruptStatsProvider *obj, Monitor
*mon)
{
PICCommonState *s = PIC_COMMON(obj);
+ pic_dispatch_pre_save(s);
monitor_printf(mon, "pic%d: irr=%02x imr=%02x isr=%02x hprio=%d "
"irq_base=%02x rr_sel=%d elcr=%02x fnm=%d\n",
s->master ? 0 : 1, s->irr, s->imr, s->isr, s->priority_add,
--
1.8.3.1
- [Qemu-devel] [PULL 25/46] cpu: refactor cpu_address_space_init(), (continued)
- [Qemu-devel] [PULL 25/46] cpu: refactor cpu_address_space_init(), Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 29/46] exec: Don't reuse unassigned_mem_ops for io_mem_rom, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 27/46] block/iscsi: dont leave allocmap in an invalid state on UNMAP failure, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 28/46] block/iscsi: only report an iSCSI Failure if we don't handle it gracefully, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 30/46] hw/mips/boston: Remove workaround for writes to ROM aborting, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 31/46] hw/i386/vmport: replace fprintf() by trace events or LOG_UNIMP, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 33/46] scsi: replace hex constants with #defines, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 32/46] scsi: provide general-purpose functions to manage sense data, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 37/46] i8259: generalize statistics into common code, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 35/46] i8259: convert DPRINTFs into trace, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 38/46] kvm-i8259: support "info pic" and "info irq",
Paolo Bonzini <=
- [Qemu-devel] [PULL 36/46] i8259: use DEBUG_IRQ_COUNT always, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 34/46] Remove legacy -no-kvm-pit option, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 39/46] i8259: move TYPE_INTERRUPT_STATS_PROVIDER upper, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 40/46] checkpatch: volatile with a comment or sig_atomic_t is okay, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 43/46] test: add some chardev mux event tests, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 41/46] rcu: reduce more than 7MB heap memory by malloc_trim(), Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 42/46] chardev: fix backend events regression with mux chardev, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 45/46] blockdev: convert qemu-nbd server to QIONetListener, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 44/46] blockdev: convert internal NBD server to QIONetListener, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 46/46] chardev: convert the socket server to QIONetListener, Paolo Bonzini, 2017/12/20