KVM Virtual CPU time profiling
Hi All, Is there a way in KVM to measure the real physical (CPU) time consumed by each running Virtual CPU? (I want to do time profiling of the virtual machines running on host system) Also, is there an explanation somewhere on how Virtual CPU scheduling is achieved in KVM? Thanks Abhishek -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
GDB Debugging
Hi Guys, Any help will be appreciated on following issue. I have been struggling on this for quite some time... -Abhishek -Original Message- From: Saksena, Abhishek Sent: Tuesday, October 20, 2009 11:49 AM To: 'Jan Kiszka' Cc: kvm@vger.kernel.org Subject: GDB + KVM Debug I have now tried using both Set arch i8086 and Set arch i386:x86-64:intel But still see the same issue. Do I need to apply any patch? Abhishek -Original Message- From: Jan Kiszka [mailto:jan.kis...@siemens.com] Sent: Thursday, September 17, 2009 1:36 AM To: Saksena, Abhishek Cc: kvm@vger.kernel.org Subject: Re: GDB + KVM Debug Saksena, Abhishek wrote: I am using KVM-88. However I can't get gdb still working. I stared qemu with -s -S option and when I try to connect gdb to it I get following error:- (gdb) target remote lochost:1234 lochost: unknown host lochost:1234: No such file or directory. (gdb) target remote locahost:1234 locahost: unknown host locahost:1234: No such file or directory. (gdb) target remote localhost:1234 Remote debugging using localhost:1234 [New Thread 1] Remote 'g' packet reply is too long: 2306f0ff023002f07f03000 0 (gdb) Try 'set arch target-architecture' before connecting. This is required if you didn't load the corresponding target image into gdb. Jan -- Siemens AG, Corporate Technology, CT SE 2 Corporate Competence Center Embedded Linux -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
GDB + KVM Debug
I have now tried using both Set arch i8086 and Set arch i386:x86-64:intel But still see the same issue. Do I need to apply any patch? Abhishek -Original Message- From: Jan Kiszka [mailto:jan.kis...@siemens.com] Sent: Thursday, September 17, 2009 1:36 AM To: Saksena, Abhishek Cc: kvm@vger.kernel.org Subject: Re: GDB + KVM Debug Saksena, Abhishek wrote: I am using KVM-88. However I can't get gdb still working. I stared qemu with -s -S option and when I try to connect gdb to it I get following error:- (gdb) target remote lochost:1234 lochost: unknown host lochost:1234: No such file or directory. (gdb) target remote locahost:1234 locahost: unknown host locahost:1234: No such file or directory. (gdb) target remote localhost:1234 Remote debugging using localhost:1234 [New Thread 1] Remote 'g' packet reply is too long: 2306f0ff023002f07f03000 0 (gdb) Try 'set arch target-architecture' before connecting. This is required if you didn't load the corresponding target image into gdb. Jan -- Siemens AG, Corporate Technology, CT SE 2 Corporate Competence Center Embedded Linux -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
KVM Support for windows
I would like to know is there a plan for KVM to be supported under Windows(host OS)? If yes, by when? -Thanks Abhishek -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
GDB + KVM Debug
Hi All, I see Qemu support GDB server that allows debugging kernels, boot loaders and others. Is this kind of support is available when KVM is enabled. For some reason the single stepping of instructions doesn't seem to work when KVM is in use. So what debug capabilities (for Guest SW) KVM support at this point in time? -Thanks Abhishek -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: GDB + KVM Debug
I am using KVM-88. However I can't get gdb still working. I stared qemu with -s -S option and when I try to connect gdb to it I get following error:- (gdb) target remote lochost:1234 lochost: unknown host lochost:1234: No such file or directory. (gdb) target remote locahost:1234 locahost: unknown host locahost:1234: No such file or directory. (gdb) target remote localhost:1234 Remote debugging using localhost:1234 [New Thread 1] Remote 'g' packet reply is too long: 2306f0ff023002f07f03 (gdb) Any help will be appreciated! Thanks Abhishek -Original Message- From: Jan Kiszka [mailto:jan.kis...@siemens.com] Sent: Wednesday, September 16, 2009 9:37 AM To: Saksena, Abhishek Cc: kvm@vger.kernel.org Subject: Re: GDB + KVM Debug Saksena, Abhishek wrote: Thanks for the quick reply. What versions (kernel/kvm-kmod and qemu-kvm) are you using? What is your host, what your target architecture/operating mode (real mode, 32 bit prot. mode, 64 bit mode)? I am using KVM-74? Do I need to upgrade then? Yes, definitely. My target is x86 and we want to debug all real, prot. and 64 bit mode. If your host is running 64 bit mode but your target uses less, you need an extra patch [1] to deal with gdb limitations and a lacking workaround in qemu(-kvm). Jan [1]http://git.kiszka.org/?p=qemu-kvm.git;a=shortlog;h=refs/heads/queues/gdb -- Siemens AG, Corporate Technology, CT SE 2 Corporate Competence Center Embedded Linux -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
KVM and Qemu Synchronization
Hi All, I am interested to know how the KVM Synchronize with Qemu. I know KVM maintain the time in PIT/RTC and Qemu it's own thread for IO devices callback (using alarm timers). How it is guaranteed that Qemu maintained view of time is not passing to slow or too fast w.r.t KVM VCPu. Also, what's the approach for time synchronization when using SMP? Thanks in advance. -Abhishek -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: KVM and Qemu Synchronization
Thanks for the reply. Can keeping device models and KVM pit synchronize with the host clock result in any issues with booting up OSes? -Abhishek -Original Message- From: Avi Kivity [mailto:a...@redhat.com] Sent: Wednesday, September 02, 2009 12:16 PM To: Saksena, Abhishek Cc: 'kvm@vger.kernel.org' Subject: Re: KVM and Qemu Synchronization On 09/02/2009 10:04 PM, Saksena, Abhishek wrote: Hi All, I am interested to know how the KVM Synchronize with Qemu. I know KVM maintain the time in PIT/RTC and Qemu it's own thread for IO devices callback (using alarm timers). How it is guaranteed that Qemu maintained view of time is not passing to slow or too fast w.r.t KVM VCPu. Time is not synchronized. The kvm pit attempts to synchronize with the host clock, and so do the device models, but nothing is guaranteed. Also, what's the approach for time synchronization when using SMP? What do you mean? -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain. -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: KVM and Qemu Synchronization
Correction to question:- Can keeping device models and KVM pit synchronize with the host clock separately result in any issues with booting up OSes? -Abhishek -Original Message- From: kvm-ow...@vger.kernel.org [mailto:kvm-ow...@vger.kernel.org] On Behalf Of Saksena, Abhishek Sent: Wednesday, September 02, 2009 1:09 PM To: Avi Kivity Cc: 'kvm@vger.kernel.org' Subject: RE: KVM and Qemu Synchronization Thanks for the reply. Can keeping device models and KVM pit synchronize with the host clock result in any issues with booting up OSes? -Abhishek -Original Message- From: Avi Kivity [mailto:a...@redhat.com] Sent: Wednesday, September 02, 2009 12:16 PM To: Saksena, Abhishek Cc: 'kvm@vger.kernel.org' Subject: Re: KVM and Qemu Synchronization On 09/02/2009 10:04 PM, Saksena, Abhishek wrote: Hi All, I am interested to know how the KVM Synchronize with Qemu. I know KVM maintain the time in PIT/RTC and Qemu it's own thread for IO devices callback (using alarm timers). How it is guaranteed that Qemu maintained view of time is not passing to slow or too fast w.r.t KVM VCPu. Time is not synchronized. The kvm pit attempts to synchronize with the host clock, and so do the device models, but nothing is guaranteed. Also, what's the approach for time synchronization when using SMP? What do you mean? -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain. -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: KVM's PIT and PIC programming question
Isn't by default PIT and PIC are initialized in Kernel? Is something more needed on top of it? I have enable PIC interuupt using following code :- PIC Programming ;; PIC mov al, #0x00 out 0x21, AL ;master pic: all IRQs unmasked out 0xA1, AL ;slave pic: all IRQs unmasked Also, I wonder if LAPIC need to be configured and initialized properly. I don't want to use LAPIC, can it be disabled in KVM. I am just using one VCPU. -Thanks Abhishek -Original Message- From: Avi Kivity [mailto:a...@redhat.com] Sent: Thursday, August 20, 2009 1:29 AM To: Saksena, Abhishek Cc: kvm@vger.kernel.org Subject: Re: KVM's PIT and PIC programming question On 08/20/2009 12:26 AM, Saksena, Abhishek wrote: Hi Guys, I am writing very simple bios for KVM (not using Qemu but creating a simple io device models around KVM). I am having trouble in receiving regular Timer interrupts after programming PIT. I think I have enabled PIC and PIT correctly using following code:- PIC Programming ;; PIC mov al, #0x00 out 0x21, AL ;master pic: all IRQs unmasked out 0xA1, AL ;slave pic: all IRQs unmasked PIT Programming and also enable PIT to genrate regular timer interruput SET_INT_VECTOR(0x08, #0xF000, #int08_handler) mov al, #0x34 ; timer0: binary count, 16bit count, mode 2 out 0x43, al mov al, #0x00 ; maximum count of H = 18.2Hz out 0x40, al out 0x40, al PIT Timer ISR code Timer ISR code ;- ;- INT08 - ;- .org 0xfea5 ; INT 08h System Timer ISR Entry Point int08_handler: sti push ax push ds mov ax, #0x0040 mov ds, ax mov ax, 0x006c ; increment lower word inc ax mov 0x006c, ax jnz inc_done mov ax, 0x006e ; increment upper word inc ax mov 0x006e, ax For some reason I never see int08_handler ever been called. Any clues what may be wrong? I am creating only one VCPU Things to check: - have you initialized the kernel PIC and PIT? - are interrupts enabled? -- error compiling committee.c: too many arguments to function -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: KVM's PIT and PIC programming question
I am using libkvm and believe it creates PIC and PIT by default. I see kvm_create make calls to:- 1. kvm_arch_create function which indeed calls kvm_create_pit and KVM_CREATE_PIT 2. kvm_create_irqchip function and KVM_CREATE_IRQCHIP Is this understanding wrong? -Thanks Abhishek -Original Message- From: Avi Kivity [mailto:a...@redhat.com] Sent: Thursday, August 20, 2009 8:21 AM To: Saksena, Abhishek Cc: kvm@vger.kernel.org Subject: Re: KVM's PIT and PIC programming question On 08/20/2009 06:05 PM, Saksena, Abhishek wrote: Isn't by default PIT and PIC are initialized in Kernel? Is something more needed on top of it? You need KVM_CREATE_IRQCHIP and KVM_CREATE_PIT. Also, I wonder if LAPIC need to be configured and initialized properly. I don't want to use LAPIC, can it be disabled in KVM. I am just using one VCPU. The lapic is disabled by default. -- error compiling committee.c: too many arguments to function -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: KVM's PIT and PIC programming question
Thnaks, So just programming of PIC (8259) should do the trick. Do I have to care about IOAPIC or LAPIC programming? You mentioned lapic is disabled by default, what about IOAPIC. I see in x86.c case KVM_CREATE_IRQCHIP: r = -ENOMEM; kvm-arch.vpic = kvm_create_pic(kvm); if (kvm-arch.vpic) { r = kvm_ioapic_init(kvm); if (r) { kfree(kvm-arch.vpic); kvm-arch.vpic = NULL; goto out; } } else goto out; break; so ioapic is created. I have enabled all the interrupts in 8259s correctly PIC Programming of master and slave 8259s ;; PIC mov al, #0x00 out 0x21, AL ;master pic: all IRQs unmasked out 0xA1, AL ;slave pic: all IRQs unmasked PIT Programming SET_INT_VECTOR(0x08, #0xF000, #int08_handler) mov al, #0x34 ; timer0: binary count, 16bit count, mode 2 out 0x43, al mov al, #0x00 ; maximum count of H = 18.2Hz out 0x40, al out 0x40, al But still not see PIT interrupts or Timer ISR being called! -thanks Abhishek -Original Message- From: Avi Kivity [mailto:a...@redhat.com] Sent: Thursday, August 20, 2009 10:26 AM To: Saksena, Abhishek Cc: kvm@vger.kernel.org Subject: Re: KVM's PIT and PIC programming question On 08/20/2009 07:49 PM, Saksena, Abhishek wrote: I am using libkvm and believe it creates PIC and PIT by default. I see kvm_create make calls to:- 1. kvm_arch_create function which indeed calls kvm_create_pit and KVM_CREATE_PIT 2. kvm_create_irqchip function and KVM_CREATE_IRQCHIP It should work, but best to check using strace or adding printfs. -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain. -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
KVM's PIT and PIC programming question
Hi Guys, I am writing very simple bios for KVM (not using Qemu but creating a simple io device models around KVM). I am having trouble in receiving regular Timer interrupts after programming PIT. I think I have enabled PIC and PIT correctly using following code:- PIC Programming ;; PIC mov al, #0x00 out 0x21, AL ;master pic: all IRQs unmasked out 0xA1, AL ;slave pic: all IRQs unmasked PIT Programming and also enable PIT to genrate regular timer interruput SET_INT_VECTOR(0x08, #0xF000, #int08_handler) mov al, #0x34 ; timer0: binary count, 16bit count, mode 2 out 0x43, al mov al, #0x00 ; maximum count of H = 18.2Hz out 0x40, al out 0x40, al PIT Timer ISR code Timer ISR code ;- ;- INT08 - ;- .org 0xfea5 ; INT 08h System Timer ISR Entry Point int08_handler: sti push ax push ds mov ax, #0x0040 mov ds, ax mov ax, 0x006c ; increment lower word inc ax mov 0x006c, ax jnz inc_done mov ax, 0x006e ; increment upper word inc ax mov 0x006e, ax For some reason I never see int08_handler ever been called. Any clues what may be wrong? I am creating only one VCPU -Abhishek -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
KVM bug
Hi I am trying to boot a patched version of Boch's BIOS on KVM. It works fine with Qemu with -no-kvm option. However I get following with KVM unhandled vm exit: 0x8021 vcpu_id 0 rax rbx 133a rcx rdx 0008 rsi 0008 rdi 0008 rsp 11a4 rbp 11bc r8 r9 r10 r11 r12 r13 r14 r15 rip 07ca rflags 00023046 cs f000 (000f/ p 1 dpl 3 db 0 s 1 type 3 l 0 g 0 avl 0) ds 88f9 (00088f9b/ p 1 dpl 3 db 0 s 1 type 3 l 0 g 0 avl 0) es (/ p 1 dpl 3 db 0 s 1 type 3 l 0 g 0 avl 0) ss c181 (000c1810/ p 1 dpl 3 db 0 s 1 type 3 l 0 g 0 avl 0) fs (/ p 1 dpl 3 db 0 s 1 type 3 l 0 g 0 avl 0) gs (/ p 1 dpl 3 db 0 s 1 type 3 l 0 g 0 avl 0) tr (fffbd000/2088 p 1 dpl 0 db 0 s 0 type b l 0 g 0 avl 0) ldt (/ p 1 dpl 0 db 0 s 0 type 2 l 0 g 0 avl 0) gdt 88f6b/30 idt 0/3ff cr0 0 cr2 0 cr3 0 cr4 0 cr8 0 efer 0 Abort I am not sure what's going on but expecting some bug in KVM and will appreciate some help. As forum don't accept posting with attachments. I can forward the BIOS image to anybody who wants to help. Thanks Abhishek -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
KVM Irq injection
Hi, I am building some device models around the KVM and am intersted in injecting IRQs. The current LibKVM.h provides following function int kvm_inject_irq ( kvm_context_tfile:///C:/Documents%20and%20Settings/asaksena/Desktop/march_onwards/kvmsocket/doc/htmlkvm/structkvm__context.html kvm, int vcpu, unsignedirq ) Simulate an external vectored interrupt. This allows you to simulate an external vectored interrupt. Parameters: kvm Pointer to the current kvm_contextfile:///C:/Documents%20and%20Settings/asaksena/Desktop/march_onwards/kvmsocket/doc/htmlkvm/structkvm__context.html vcpuWhich virtual CPU should get dumped irq Vector number Returns: 0 on success My question is if I am say Injecting IRQ on pin 0 on PIC how do I get croosponding vector? I am using KVM's interrupt controllers. I also see another function int kvm_set_irq_level ( kvm_context_tfile:///C:/Documents%20and%20Settings/asaksena/Desktop/march_onwards/kvmsocket/doc/htmlkvm/structkvm__context.html kvm, int irq, int level ) Can this be used safely to inject IRQ- I am gusseing irq refers to the pin and Level the value of that pin. How do I tell with this function which CPU I want to inject interrupt? -Abhishek -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
VGA address mapping?
Hi I am implementing a VGA Device model. The model provides functions to read/write VGA memory space. Just for testing I want to capture memory reads/writes to addresses 0xA-0xC and forward it to my VGA model. I have used following function to create physical ram int kvm_create ( kvm_context_tfile:///C:/Documents%20and%20Settings/asaksena/Desktop/march_onwards/kvmsocket/doc/htmlkvm/structkvm__context.html kvm, unsigned long phys_mem_bytes, void ** phys_mem ) The function comments says that this creates a new virtual machine, maps physical RAM to it, and creates a virtual CPU for it. Memory gets mapped for addresses 0-0xA, 0xC-phys_mem_bytes. I was expecting mimio read/write callbacks to capture transactions between 0xA-0xC but I don't see that happening. My question is how I can configure KVM to forward me reads/writes for VGA address space? Thanks Abhishek -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: VGA address mapping?
Would also like to mention I am not using Qemu and building some basic IO models around KVM (only using libkvm.h) -Abhishek From: Saksena, Abhishek Sent: Tuesday, July 21, 2009 11:13 AM To: kvm@vger.kernel.org Subject: VGA address mapping? Hi I am implementing a VGA Device model. The model provides functions to read/write VGA memory space. Just for testing I want to capture memory reads/writes to addresses 0xA-0xC and forward it to my VGA model. I have used following function to create physical ram int kvm_create ( kvm_context_tfile:///C:/Documents%20and%20Settings/asaksena/Desktop/march_onwards/kvmsocket/doc/htmlkvm/structkvm__context.html kvm, unsigned long phys_mem_bytes, void ** phys_mem ) The function comments says that this creates a new virtual machine, maps physical RAM to it, and creates a virtual CPU for it. Memory gets mapped for addresses 0-0xA, 0xC-phys_mem_bytes. I was expecting mimio read/write callbacks to capture transactions between 0xA-0xC but I don't see that happening. My question is how I can configure KVM to forward me reads/writes for VGA address space? Thanks Abhishek -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html