Skip to contentSkip to conversation

Inject Interrupt, Using VMCS during qemu live migration.

Qemu-devel 李 ヨンジュン 2 participants 2 messages Sep 9, 2012

lore
Share & tools
lore
#0 lore raw

Hello, I am trying to inject interrupt, in final phase of Live migration.

I use vmcs_write32 function to inject interrupt. This function is called by qemu, with ioctl.

This is Code.

(KVM)

void vmcs_write32_provider(unsigned long field, u32 value) {
vmcs_write32(field, value);
}

long kvm_arch_vcpu_ioctl(struct file *filp,
unsigned int ioctl, unsigned long arg)
{
~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
case KVM_TEST_IOCTL: {
r=0;
//printk("Test IOCTL!!!\n");
int type = 0;
int trap=58;
u32 intr_fields= (0x80000000 | (type<<8) | trap);
vmcs_write32_provider(0x00004016,intr_fields);
printk("vmcs_write Success!!!\n");

goto out;
}

This code works perfectly when called by hypercall.(When call this function in kvm_emulate_hypercall function by guest VM.)

But, when I trying to call this function by qemu(ioctl), This error message is occurred.

http://pds23.egloos.com/pds/201209/09/86/f0062286_504c07a4bc3c7.png

I need help. Thank you.

#1 lore raw
Quoted 28 lines · 李 ヨンジュン

Hello, I am trying to inject interrupt, in final phase of Live migration.

I use vmcs_write32 function to inject interrupt. This function is called by qemu, with ioctl.

This is Code.

(KVM)

void vmcs_write32_provider(unsigned long field, u32 value) {
vmcs_write32(field, value);
}

long kvm_arch_vcpu_ioctl(struct file *filp,
unsigned int ioctl, unsigned long arg)
{
~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
case KVM_TEST_IOCTL: {
r=0;
//printk("Test IOCTL!!!\n");
int type = 0;
int trap=58;
u32 intr_fields= (0x80000000 | (type<<8) | trap);
vmcs_write32_provider(0x00004016,intr_fields);
printk("vmcs_write Success!!!\n");

Quoted 2 lines

goto out;
}

This is not how you inject interrupts in KVM. You are calling kvm_set_irq() instead.

Quoted 5 lines

This code works perfectly when called by hypercall.(When call this function in kvm_emulate_hypercall function by guest VM.)

You mean this code sometimes accidentally has desirable effect.

Quoted 5 lines

But, when I trying to call this function by qemu(ioctl), This error message is occurred.

http://pds23.egloos.com/pds/201209/09/86/f0062286_504c07a4bc3c7.png

You are trying to inject interrupt when interrupts are disabled.

--
Gleb.