On Sun, Dec 15, 2013 at 04:20:05PM +0800, Qingshu Chen wrote: > hi,I want to calculate the latencyof virtio in kvm, I read the document in > http://www.linux-kvm.org/page/Virtio/Block/Latency and met some problem. > 1. when calculating latency in kvm, the document said kvm_pio and > kvm_set_irq can be filtered using command 'lspci -vv -nn' and 'cat > /proc/interrupts' , but I don't know how to use the result to filter kvm_pio > and kvm_set_irq. Hi Qingshu, I wrote that wiki page. The commands on the wiki are: cd /sys/kernel/debug/tracing echo 'port == 0xc090' >events/kvm/kvm_pio/filter echo 'gsi == 26' >events/kvm/kvm_set_irq/filter echo 1 >events/kvm/kvm_pio/enable echo 1 >events/kvm/kvm_set_irq/enable cat trace_pipe >/tmp/trace Here is how you can find the right port and gsi values to filter: 1. The 'kvm_pio' event is used to trace guest->host virtqueue notification. Looking at drivers/virtio/virtio_pci.c reveals that the port is ioaddr + VIRTIO_PCI_QUEUE_NOTIFY (16). Here is an example: # lspci -vv -nn 00:04.0 SCSI storage controller [0100]: Red Hat, Inc Virtio block device [1af4:1001] [...] Region 0: I/O ports at c080 [size=64] Therefore you need to filter on 0xc080 + 0x10 = 0xc090 to trace VIRTIO_PCI_QUEUE_NOTIFY accesses. 2. The 'kvm_set_irq' event is used to trace host->guest virtqueue notifications. Find the virtio driver instance: # ls /sys/block/vda/device/driver/ bind module unbind virtio1 Now look up the virtqueue interrupt for 'virtio1': # cat /proc/interrupts [...] 185: 35129 0 0 0 0 0 8760 0 PCI-MSI-X virtio1-requests So gsi is 185. Stefan -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html