-
Notifications
You must be signed in to change notification settings - Fork 22
Print ioeventfd, iobus, vmstat and vcpustat information in kvm module. #167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! A few small nits, but nothing major. Thank you :)
drgn_tools/kvm.py
Outdated
class KvmIoBus(enum.Enum): | ||
KVM_MMIO_BUS = 0 | ||
KVM_PIO_BUS = 1 | ||
KVM_VIRTIO_CCW_NOTIFY_BUS = 2 | ||
KVM_FAST_MMIO_BUS = 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This corresponds to enum kvm_bus
, right? Since there's a nice enum present from UEK5 to mainline, let's use that instead of hard-coding it here.
Notably, this definition here seems to be missing KVM_IOCSR_BUS
which I see in the definition, which is a great reason to just use the debuginfo.
enum kvm_bus {
KVM_MMIO_BUS,
KVM_PIO_BUS,
KVM_VIRTIO_CCW_NOTIFY_BUS,
KVM_FAST_MMIO_BUS,
KVM_IOCSR_BUS,
KVM_NR_BUSES
};
drgn_tools/kvm.py
Outdated
iobus = hex(bus.value_()) | ||
dev_count = bus.dev_count.value_() | ||
eventfd_count = bus.ioeventfd_count.value_() | ||
bus_name = KvmIoBus(i).name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To get the enum name here, we can do this:
bus_name = KvmIoBus(i).name | |
bus_name = enum_name_get(kvm_bus_type, i) |
You can declare kvm_bus_type
outside all the loops like this:
kvm_bus_type = prog.type("enum kvm_bus")
And you can import enum_name_get()
at the top:
from drgn_tools.util import enum_name_get
drgn_tools/kvm.py
Outdated
i = 0 | ||
for bus in iobus_iterator: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than manually managing this counter, you can do:
for i, bus in enumerate(io_bus_iterator):
...
drgn_tools/kvm.py
Outdated
vcpu_stat = vcpu.stat | ||
rows_vcpu = [ | ||
[ | ||
"\nVCPU:", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't include the \n
here, instead have separate print()
above this to put in the newline. Otherwise, the print_table()
code considers it a character for alignment purposes, and it misaligns the first row. EG:
VCPU: 0 HALT_SUC: 467 HALT_ATTMPT: 881 HALT_INV: 0
PF_FIXED: 971 PF_GUEST: 0 TLB_FLUSH: 15563 INVLPG: 0
EXITS: 1290959 IO_EXIT: 128538 MMIO_EXIT: 35913 SIG_EXIT: 0
IRQ_WIN_EXIT: 31 NMI_WIN_EXIT: 0 L1D_FLUSH: 0 HALT_EXIT: 2278
REQ_IRQ_EXIT: 0 IRQ_EXITS: 2190 HOST_STATE_RL: 165126 FPU_RL: 164309
INSN_EMUL: 54456 INSN_EMUL_FAIL: 0 HYPERCALLS: 6 IRQ_INJ: 61
NMI_INJ: 0 REQ_EVENT: 46633 PREEMPT_RPT: 18 PREEMT_OTH: 12
Oh, and one more thing: can you file an Orabug for this (targeting "next" -- see the developer workflow doc), and then include the Orabug statement in the commit message? This will also make sure you get credit in the changelog :) |
Hi Stephen, |
I don't know why I missed that, my apologies. That's perfect, thank you. |
7e0e32a
to
f3e884b
Compare
ad839f3
to
2adcee7
Compare
Orabug: 37713468 Signed-off-by: Siddhi Katage <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All I did was rebase on the main branch to get the fix for the v6.16 UEK-next kernels.
With that, this looks good, thank you!
No description provided.