[PATCH] kvm: qemu: remove some unused variables
From: Jan Kiszka [EMAIL PROTECTED] This patch addresses all current warnings regarding unused variables in KVM userspace. Signed-off-by: Jan Kiszka [EMAIL PROTECTED] Signed-off-by: Avi Kivity [EMAIL PROTECTED] diff --git a/qemu/exec.c b/qemu/exec.c index 7a37dfd..37c8392 100644 --- a/qemu/exec.c +++ b/qemu/exec.c @@ -182,7 +182,6 @@ static void io_mem_init(void); CPUWriteMemoryFunc *io_mem_write[IO_MEM_NB_ENTRIES][4]; CPUReadMemoryFunc *io_mem_read[IO_MEM_NB_ENTRIES][4]; void *io_mem_opaque[IO_MEM_NB_ENTRIES]; -static int io_mem_nb; char io_mem_used[IO_MEM_NB_ENTRIES]; static int io_mem_watch; #endif diff --git a/qemu/hw/device-hotplug.c b/qemu/hw/device-hotplug.c index 3d170c5..8e2bc35 100644 --- a/qemu/hw/device-hotplug.c +++ b/qemu/hw/device-hotplug.c @@ -13,7 +13,6 @@ static PCIDevice *qemu_system_hot_add_nic(const char *opts, int bus_nr) { int ret; -char buf[4096]; PCIBus *pci_bus; pci_bus = pci_find_bus (bus_nr); diff --git a/qemu/kvm-tpr-opt.c b/qemu/kvm-tpr-opt.c index 122d8c3..6677741 100644 --- a/qemu/kvm-tpr-opt.c +++ b/qemu/kvm-tpr-opt.c @@ -353,7 +353,7 @@ static void vtpr_ioport_write(void *opaque, uint32_t addr, uint32_t val) CPUState *env = cpu_single_env; struct kvm_regs regs; struct kvm_sregs sregs; -uint32_t rip, apic; +uint32_t rip; kvm_get_regs(kvm_context, env-cpu_index, regs); rip = regs.rip - 2; diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c index 1d07650..3466015 100644 --- a/qemu/qemu-kvm.c +++ b/qemu/qemu-kvm.c @@ -605,8 +605,6 @@ int kvm_main_loop(void) static int kvm_debug(void *opaque, int vcpu) { -CPUState *env = cpu_single_env; - kvm_debug_stop_requested = 1; vcpu_info[vcpu].stopped = 1; return 1; -- To unsubscribe from this list: send the line unsubscribe kvm-commits in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] kvm: qemu: Add missing DEPLIBS in Makefile.target
From: Sheng Yang [EMAIL PROTECTED] Seems this flags is missing during merging long ago... And this result in updating of libkvm.a didn't affect make process of qemu, which is very puzzling... Signed-off-by: Sheng Yang [EMAIL PROTECTED] Signed-off-by: Avi Kivity [EMAIL PROTECTED] diff --git a/qemu/Makefile.target b/qemu/Makefile.target index a86464f..2cf1b6c 100644 --- a/qemu/Makefile.target +++ b/qemu/Makefile.target @@ -747,7 +747,7 @@ firmware.o: firmware.c $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $ endif -$(QEMU_PROG): $(OBJS) ../libqemu_common.a libqemu.a +$(QEMU_PROG): $(OBJS) ../libqemu_common.a libqemu.a $(DEPLIBS) $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS) endif # !CONFIG_USER_ONLY -- To unsubscribe from this list: send the line unsubscribe kvm-commits in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] kvm: bios: end AP boot code execution in rombios
From: Sebastian Herbszt [EMAIL PROTECTED] Jump to rombios before executing the halt loop. Signed-off-by: Sebastian Herbszt [EMAIL PROTECTED] Signed-off-by: Avi Kivity [EMAIL PROTECTED] diff --git a/bios/rombios32start.S b/bios/rombios32start.S index c4f3366..aaed78b 100644 --- a/bios/rombios32start.S +++ b/bios/rombios32start.S @@ -40,6 +40,7 @@ _start: .code16 smp_ap_boot_code_start: + cli xor %ax, %ax mov %ax, %ds xor %eax, %eax @@ -60,6 +61,7 @@ smp_ap_boot_code_start: 12: incw CPU_COUNT_ADDR + ljmp $0xe000, $(1f-_start) 1: hlt jmp 1b -- To unsubscribe from this list: send the line unsubscribe kvm-commits in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] kvm: qemu: include header for register_ioport_write
From: Jan Kiszka [EMAIL PROTECTED] Signed-off-by: Jan Kiszka [EMAIL PROTECTED] Signed-off-by: Avi Kivity [EMAIL PROTECTED] diff --git a/qemu/kvm-tpr-opt.c b/qemu/kvm-tpr-opt.c index ab33ea0..122d8c3 100644 --- a/qemu/kvm-tpr-opt.c +++ b/qemu/kvm-tpr-opt.c @@ -12,6 +12,7 @@ #include string.h #include hw/hw.h +#include hw/isa.h #include sysemu.h #include qemu-kvm.h #include cpu.h -- To unsubscribe from this list: send the line unsubscribe kvm-commits in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] kvm: qemu: work around dhclient brokenness
From: Anthony Liguori [EMAIL PROTECTED] With the latest GSO/csum offload patches, any guest using an unpatched version of dhclient (any Ubuntu guest, for instance), will no longer be able to get a DHCP address. dhclient is actually at fault here. It uses AF_PACKET to receive DHCP responses but does not check auxdata to see if the packet has a valid csum. This causes it to throw out the DHCP responses it gets from the virtio interface as there is not a valid checksum. Fedora has carried a patch to fix their dhclient (it's needed for Xen too) but this patch has not made it into a release of dhclient. AFAIK, the patch is in the dhclient CVS but I cannot confirm since their CVS is not public. This patch, suggested by Rusty, looks for UDP packets (of a normal MTU) and explicitly adds a checksum to them if they are missing one. This allows unpatched dhclients to continue to work without needing to update the guest kernels. Signed-off-by: Anthony Liguori [EMAIL PROTECTED] Signed-off-by: Avi Kivity [EMAIL PROTECTED] diff --git a/qemu/hw/virtio-net.c b/qemu/hw/virtio-net.c index 61215b1..409960f 100644 --- a/qemu/hw/virtio-net.c +++ b/qemu/hw/virtio-net.c @@ -154,6 +154,34 @@ static int virtio_net_can_receive(void *opaque) return 1; } +/* dhclient uses AF_PACKET but doesn't pass auxdata to the kernel so + * it never finds out that the packets don't have valid checksums. This + * causes dhclient to get upset. Fedora's carried a patch for ages to + * fix this with Xen but it hasn't appeared in an upstream release of + * dhclient yet. + * + * To avoid breaking existing guests, we catch udp packets and add + * checksums. This is terrible but it's better than hacking the guest + * kernels. + * + * N.B. if we introduce a zero-copy API, this operation is no longer free so + * we should provide a mechanism to disable it to avoid polluting the host + * cache. + */ +static void work_around_broken_dhclient(struct virtio_net_hdr *hdr, +const uint8_t *buf, size_t size) +{ +if ((hdr-flags VIRTIO_NET_HDR_F_NEEDS_CSUM) /* missing csum */ +(size 27 size 1500) /* normal sized MTU */ +(buf[12] == 0x08 buf[13] == 0x00) /* ethertype == IPv4 */ +(buf[23] == 17) /* ip.protocol == UDP */ +(buf[34] == 0 buf[35] == 67)) { /* udp.srcport == bootps */ +/* FIXME this cast is evil */ +net_checksum_calculate((uint8_t *)buf, size); +hdr-flags = ~VIRTIO_NET_HDR_F_NEEDS_CSUM; +} +} + static void virtio_net_receive(void *opaque, const uint8_t *buf, int size) { VirtIONet *n = opaque; @@ -180,6 +208,7 @@ static void virtio_net_receive(void *opaque, const uint8_t *buf, int size) if (tap_has_vnet_hdr(n-vc-vlan-first_client)) { memcpy(hdr, buf, sizeof(*hdr)); offset += total; +work_around_broken_dhclient(hdr, buf + offset, size - offset); } /* copy in packet. ugh */ -- To unsubscribe from this list: send the line unsubscribe kvm-commits in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] KVM: Fix KVM_GET_LAPIC using wrong size
From: Sheng Yang [EMAIL PROTECTED] Which caused migration fail in recent commits. Signed-off-by: Sheng Yang [EMAIL PROTECTED] Signed-off-by: Avi Kivity [EMAIL PROTECTED] diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index ee005a6..4a03375 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1555,7 +1555,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp, if (r) goto out; r = -EFAULT; - if (copy_to_user(argp, lapic, sizeof lapic)) + if (copy_to_user(argp, lapic, sizeof(struct kvm_lapic_state))) goto out; r = 0; break; -- To unsubscribe from this list: send the line unsubscribe kvm-commits in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] KVM: Device assignment: Check for privileges before assigning irq
From: Amit Shah [EMAIL PROTECTED] Even though we don't share irqs at the moment, we should ensure regular user processes don't try to allocate system resources. We check for capability to access IO devices (CAP_SYS_RAWIO) before we request_irq on behalf of the guest. Noticed by Avi. Signed-off-by: Amit Shah [EMAIL PROTECTED] Signed-off-by: Avi Kivity [EMAIL PROTECTED] diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 4a03375..fffdf4f 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -191,6 +191,11 @@ static int kvm_vm_ioctl_assign_irq(struct kvm *kvm, kvm_assigned_dev_interrupt_work_handler); if (irqchip_in_kernel(kvm)) { + if (!capable(CAP_SYS_RAWIO)) { + return -EPERM; + goto out; + } + if (assigned_irq-host_irq) match-host_irq = assigned_irq-host_irq; else -- To unsubscribe from this list: send the line unsubscribe kvm-commits in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] KVM: VMX: Add module parameter and emulation flag.
From: Mohammed Gamal [EMAIL PROTECTED] The patch adds the module parameter required to enable emulating invalid guest state, as well as the emulation_required flag used to drive emulation whenever needed. Signed-off-by: Mohammed Gamal [EMAIL PROTECTED] Signed-off-by: Avi Kivity [EMAIL PROTECTED] diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index e0714d8..15bbf42 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -49,6 +49,9 @@ module_param(flexpriority_enabled, bool, 0); static int enable_ept = 1; module_param(enable_ept, bool, 0); +static int emulate_invalid_guest_state = 0; +module_param(emulate_invalid_guest_state, bool, 0); + struct vmcs { u32 revision_id; u32 abort; @@ -86,6 +89,7 @@ struct vcpu_vmx { } irq; } rmode; int vpid; + bool emulation_required; }; static inline struct vcpu_vmx *to_vmx(struct kvm_vcpu *vcpu) -- To unsubscribe from this list: send the line unsubscribe kvm-commits in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] KVM: VMX: Modify mode switching and vmentry functions
From: Mohammed Gamal [EMAIL PROTECTED] This patch modifies mode switching and vmentry function in order to drive invalid guest state emulation. Signed-off-by: Mohammed Gamal [EMAIL PROTECTED] Signed-off-by: Avi Kivity [EMAIL PROTECTED] diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 5307a8f..d6dc08e 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -1298,7 +1298,9 @@ static void fix_pmode_dataseg(int seg, struct kvm_save_segment *save) static void enter_pmode(struct kvm_vcpu *vcpu) { unsigned long flags; + struct vcpu_vmx *vmx = to_vmx(vcpu); + vmx-emulation_required = 1; vcpu-arch.rmode.active = 0; vmcs_writel(GUEST_TR_BASE, vcpu-arch.rmode.tr.base); @@ -1315,6 +1317,9 @@ static void enter_pmode(struct kvm_vcpu *vcpu) update_exception_bitmap(vcpu); + if (emulate_invalid_guest_state) + return; + fix_pmode_dataseg(VCPU_SREG_ES, vcpu-arch.rmode.es); fix_pmode_dataseg(VCPU_SREG_DS, vcpu-arch.rmode.ds); fix_pmode_dataseg(VCPU_SREG_GS, vcpu-arch.rmode.gs); @@ -1355,7 +1360,9 @@ static void fix_rmode_seg(int seg, struct kvm_save_segment *save) static void enter_rmode(struct kvm_vcpu *vcpu) { unsigned long flags; + struct vcpu_vmx *vmx = to_vmx(vcpu); + vmx-emulation_required = 1; vcpu-arch.rmode.active = 1; vcpu-arch.rmode.tr.base = vmcs_readl(GUEST_TR_BASE); @@ -1377,6 +1384,9 @@ static void enter_rmode(struct kvm_vcpu *vcpu) vmcs_writel(GUEST_CR4, vmcs_readl(GUEST_CR4) | X86_CR4_VME); update_exception_bitmap(vcpu); + if (emulate_invalid_guest_state) + goto continue_rmode; + vmcs_write16(GUEST_SS_SELECTOR, vmcs_readl(GUEST_SS_BASE) 4); vmcs_write32(GUEST_SS_LIMIT, 0x); vmcs_write32(GUEST_SS_AR_BYTES, 0xf3); @@ -1392,6 +1402,7 @@ static void enter_rmode(struct kvm_vcpu *vcpu) fix_rmode_seg(VCPU_SREG_GS, vcpu-arch.rmode.gs); fix_rmode_seg(VCPU_SREG_FS, vcpu-arch.rmode.fs); +continue_rmode: kvm_mmu_reset_context(vcpu); init_rmode(vcpu-kvm); } @@ -2317,6 +2328,9 @@ static int vmx_vcpu_reset(struct kvm_vcpu *vcpu) ret = 0; + /* HACK: Don't enable emulation on guest boot/reset */ + vmx-emulation_required = 0; + out: up_read(vcpu-kvm-slots_lock); return ret; @@ -3184,6 +3198,12 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) struct vcpu_vmx *vmx = to_vmx(vcpu); u32 intr_info; + /* Handle invalid guest state instead of entering VMX */ + if (vmx-emulation_required emulate_invalid_guest_state) { + handle_invalid_guest_state(vcpu, kvm_run); + return; + } + if (test_bit(VCPU_REGS_RSP, (unsigned long *)vcpu-arch.regs_dirty)) vmcs_writel(GUEST_RSP, vcpu-arch.regs[VCPU_REGS_RSP]); if (test_bit(VCPU_REGS_RIP, (unsigned long *)vcpu-arch.regs_dirty)) -- To unsubscribe from this list: send the line unsubscribe kvm-commits in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] KVM: ia64: add a dummy irq ack notification
From: Xiantao Zhang [EMAIL PROTECTED] Before enabling notify_acked_irq for ia64, leave the related APIs as nop-op first. Signed-off-by: Xiantao Zhang [EMAIL PROTECTED] Signed-off-by: Avi Kivity [EMAIL PROTECTED] diff --git a/arch/ia64/kvm/irq.h b/arch/ia64/kvm/irq.h new file mode 100644 index 000..f2e6545 --- /dev/null +++ b/arch/ia64/kvm/irq.h @@ -0,0 +1,32 @@ +/* + * irq.h: In-kernel interrupt controller related definitions + * Copyright (c) 2008, Intel Corporation. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307 USA. + * + * Authors: + * Xiantao Zhang [EMAIL PROTECTED] + * + */ + +#ifndef __IRQ_H +#define __IRQ_H + +struct kvm; + +static inline void kvm_notify_acked_irq(struct kvm *kvm, unsigned gsi) +{ +} + +#endif diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c index 515cd7c..53772bb 100644 --- a/virt/kvm/ioapic.c +++ b/virt/kvm/ioapic.c @@ -386,7 +386,7 @@ static void ioapic_mmio_write(struct kvm_io_device *this, gpa_t addr, int len, break; #ifdef CONFIG_IA64 case IOAPIC_REG_EOI: - kvm_ioapic_update_eoi(ioapic-kvm, data); + kvm_ioapic_update_eoi(ioapic-kvm, data, IOAPIC_LEVEL_TRIG); break; #endif -- To unsubscribe from this list: send the line unsubscribe kvm-commits in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] Work around dhclient brokenness
On Tuesday 19 August 2008 15:17:08 Herbert Xu wrote: On Mon, Aug 18, 2008 at 10:13:55PM -0700, Chris Wedgwood wrote: CSUM2 sounds so ugly though. Features seem to get added and never removed how about if this had a documented short lifetime (if it really must go in)? All we need is a simple toggle to disable checksum offload. Every NIC that offers receive checksum offload allows it to be disabled. virtio shouldn't be any different. Resetting the NIC seems a bit over the top. Not really. We could extend the protocol, but that's currently how feature negotiation works: you can't do it while the device is live. That seemed simplest. I learnt from Xen :) (Of course, we don't need to *disable* it, we need to *enable* it). Cheers, Rusty. -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] Work around dhclient brokenness
Rusty Russell wrote: On Monday 18 August 2008 21:44:25 Herbert Xu wrote: On Mon, Aug 18, 2008 at 02:40:55PM +0300, Avi Kivity wrote: Isn't that turned on automatically for real hardware? And what's to prevent a broken dhclient together with the (presumably) hacked up initscripts that call ethtool? Well the idea is that only a fixed guest would even know about enabling this. For those not following closely: We already have a method for the guest to accept or reject features. Our problem is that the guest is already accepting the CSUM feature: but one critical userspace app (dhcp-client) can't actually handle it due to a bug. The proposal is to add another mechanism, whereby the host doesn't advertise CSUM, but advertises a new CSUM2 feature. The driver doesn't accept this by default: then guest userspace says hey, I *really can* handle CSUM. This would have to be done dby resetting the device in the ethtool callback (that's how we renegotiate features). And guests need a special virtio hack in their init scripts. This leaves the small number of current users without CSUM (and hence GSO etc). Yet they might not use dhcp with bridging anyway. Worst of all, we have to document this embarrassing workaround. Neither solution is good. But I don't think Anthony's hack looks so bad after this. Well, if changed to avoid random udp packets and focus on dhcp, okay. I'd still like a way to disable it from the host. Even when it does nothing it will force the header into the host cache, which may be different from the guest cache. -- 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 [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] Work around dhclient brokenness
On Tuesday 19 August 2008 15:28:40 Chris Wedgwood wrote: On Tue, Aug 19, 2008 at 03:17:08PM +1000, Herbert Xu wrote: All we need is a simple toggle to disable checksum offload. Every NIC that offers receive checksum offload allows it to be disabled. virtio shouldn't be any different. So why CSUM2 and not an ethtool interface then? We need both. CSUM2 is the new virtio-level feature. The ethtool interface allows you to toggle it (we don't support that currently, but that's simply slackness). Rusty. -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] Fix KVM/IA-64 build issue in latest kvm.git.
From d53dfacedea40213382694229700d02bfa72d923 Mon Sep 17 00:00:00 2001 From: Xiantao Zhang [EMAIL PROTECTED] Date: Tue, 19 Aug 2008 17:33:21 +0800 Subject: [PATCH] KVM: KVM/IA-64: Fix kvm/ia64's build issue. Disable irq ack notification for ia64. Signed-off-by: Xiantao Zhang [EMAIL PROTECTED] --- virt/kvm/ioapic.c |7 ++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c index 515cd7c..992199b 100644 --- a/virt/kvm/ioapic.c +++ b/virt/kvm/ioapic.c @@ -39,7 +39,10 @@ #include ioapic.h #include lapic.h + +#ifdef CONFIG_X86 #include irq.h +#endif #if 0 #define ioapic_debug(fmt,arg...) printk(KERN_WARNING fmt,##arg) @@ -293,7 +296,9 @@ static void __kvm_ioapic_update_eoi(struct kvm_ioapic *ioapic, int gsi, ent = ioapic-redirtbl[gsi]; +#ifdef CONFIG_X86 kvm_notify_acked_irq(ioapic-kvm, gsi); +#endif if (trigger_mode == IOAPIC_LEVEL_TRIG) { ASSERT(ent-fields.trig_mode == IOAPIC_LEVEL_TRIG); @@ -386,7 +391,7 @@ static void ioapic_mmio_write(struct kvm_io_device *this, gpa_t addr, int len, break; #ifdef CONFIG_IA64 case IOAPIC_REG_EOI: - kvm_ioapic_update_eoi(ioapic-kvm, data); + kvm_ioapic_update_eoi(ioapic-kvm, data, IOAPIC_LEVEL_TRIG); break; #endif -- 1.5.1 0001-KVM-KVM-IA-64-Fix-kvm-ia64-s-build-issue.patch Description: 0001-KVM-KVM-IA-64-Fix-kvm-ia64-s-build-issue.patch
Re: [PATCH] Work around dhclient brokenness
On Tue, Aug 19, 2008 at 07:08:23PM +1000, Rusty Russell wrote: Not really. We could extend the protocol, but that's currently how feature negotiation works: you can't do it while the device is live. That seemed simplest. I learnt from Xen :) (Of course, we don't need to *disable* it, we need to *enable* it). I don't see why we shouldn't support disabling it. After all, any NIC that supports receive checksum offload allows it to be disabled. Cheers, -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmVHI~} [EMAIL PROTECTED] Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] Fix KVM/IA-64 build issue in latest kvm.git.
Zhang, Xiantao wrote: From d53dfacedea40213382694229700d02bfa72d923 Mon Sep 17 00:00:00 2001 From: Xiantao Zhang [EMAIL PROTECTED] Date: Tue, 19 Aug 2008 17:33:21 +0800 Subject: [PATCH] KVM: KVM/IA-64: Fix kvm/ia64's build issue. Disable irq ack notification for ia64. Signed-off-by: Xiantao Zhang [EMAIL PROTECTED] --- virt/kvm/ioapic.c |7 ++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c index 515cd7c..992199b 100644 --- a/virt/kvm/ioapic.c +++ b/virt/kvm/ioapic.c @@ -39,7 +39,10 @@ #include ioapic.h #include lapic.h + +#ifdef CONFIG_X86 #include irq.h +#endif Please keep the include; add an ia64 specific irq.h instead. #if 0 #define ioapic_debug(fmt,arg...) printk(KERN_WARNING fmt,##arg) @@ -293,7 +296,9 @@ static void __kvm_ioapic_update_eoi(struct kvm_ioapic *ioapic, int gsi, ent = ioapic-redirtbl[gsi]; +#ifdef CONFIG_X86 kvm_notify_acked_irq(ioapic-kvm, gsi); +#endif Keep this as well. You can have a nop-op irq notification API, and later merge with x86. I think you will need irq ack notification if you implement device assignment, or for improved timekeeping. -- 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 [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Un-googlable
David Abrahams wrote: Serious question: has anyone considered changing the name of this project? Finding information about kvm on the web is extremely frustrating due to the enormous number of pages related to KVM switches and the heavily overlapping target audience (people who want to run multiple OSes). Try this: http://www.google.com/linux Jurrit -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH] Fix KVM/IA-64 build issue in latest kvm.git.
OK, also fine to me! Attached the updated patch. Thanks Xiantao Avi Kivity wrote: Zhang, Xiantao wrote: From d53dfacedea40213382694229700d02bfa72d923 Mon Sep 17 00:00:00 2001 From: Xiantao Zhang [EMAIL PROTECTED] Date: Tue, 19 Aug 2008 17:33:21 +0800 Subject: [PATCH] KVM: KVM/IA-64: Fix kvm/ia64's build issue. Disable irq ack notification for ia64. Signed-off-by: Xiantao Zhang [EMAIL PROTECTED] --- virt/kvm/ioapic.c |7 ++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c index 515cd7c..992199b 100644 --- a/virt/kvm/ioapic.c +++ b/virt/kvm/ioapic.c @@ -39,7 +39,10 @@ #include ioapic.h #include lapic.h + +#ifdef CONFIG_X86 #include irq.h +#endif Please keep the include; add an ia64 specific irq.h instead. #if 0 #define ioapic_debug(fmt,arg...) printk(KERN_WARNING fmt,##arg) @@ -293,7 +296,9 @@ static void __kvm_ioapic_update_eoi(struct kvm_ioapic *ioapic, int gsi, ent = ioapic-redirtbl[gsi]; +#ifdef CONFIG_X86 kvm_notify_acked_irq(ioapic-kvm, gsi); +#endif Keep this as well. You can have a nop-op irq notification API, and later merge with x86. I think you will need irq ack notification if you implement device assignment, or for improved timekeeping. 0001-KVM-kvm-ia64-Leave-notify_acked_irq-as-blank-funt.patch Description: 0001-KVM-kvm-ia64-Leave-notify_acked_irq-as-blank-funt.patch
Re: [PATCH] Work around dhclient brokenness
Anthony Liguori wrote: I'd still like a way to disable it from the host. Even when it does nothing it will force the header into the host cache, which may be different from the guest cache. It's already in the host cache as we don't have a zero copy API right now. I'm thinking of the possibility that we will have a zero copy API one day. -- 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 [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] Fix KVM/IA-64 build issue in latest kvm.git.
Zhang, Xiantao wrote: OK, also fine to me! Attached the updated patch. Applied, thanks (modified to static inline to avoid warnings). -- 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 [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] Work around dhclient brokenness (v2)
With the latest GSO/csum offload patches, any guest using an unpatched version of dhclient (any Ubuntu guest, for instance), will no longer be able to get a DHCP address. dhclient is actually at fault here. It uses AF_PACKET to receive DHCP responses but does not check auxdata to see if the packet has a valid csum. This causes it to throw out the DHCP responses it gets from the virtio interface as there is not a valid checksum. Fedora has carried a patch to fix their dhclient (it's needed for Xen too) but this patch has not made it into a release of dhclient. AFAIK, the patch is in the dhclient CVS but I cannot confirm since their CVS is not public. This patch, suggested by Rusty, looks for UDP packets (of a normal MTU) and explicitly adds a checksum to them if they are missing one. This allows unpatched dhclients to continue to work without needing to update the guest kernels. Since v1, we refined the search criteria to only consider packets originating from a DHCP server. I also added a comment to note that we should disable this routine when we introduce zero copy. Signed-off-by: Anthony Liguori [EMAIL PROTECTED] diff --git a/qemu/hw/virtio-net.c b/qemu/hw/virtio-net.c index 61215b1..409960f 100644 --- a/qemu/hw/virtio-net.c +++ b/qemu/hw/virtio-net.c @@ -154,6 +154,34 @@ static int virtio_net_can_receive(void *opaque) return 1; } +/* dhclient uses AF_PACKET but doesn't pass auxdata to the kernel so + * it never finds out that the packets don't have valid checksums. This + * causes dhclient to get upset. Fedora's carried a patch for ages to + * fix this with Xen but it hasn't appeared in an upstream release of + * dhclient yet. + * + * To avoid breaking existing guests, we catch udp packets and add + * checksums. This is terrible but it's better than hacking the guest + * kernels. + * + * N.B. if we introduce a zero-copy API, this operation is no longer free so + * we should provide a mechanism to disable it to avoid polluting the host + * cache. + */ +static void work_around_broken_dhclient(struct virtio_net_hdr *hdr, +const uint8_t *buf, size_t size) +{ +if ((hdr-flags VIRTIO_NET_HDR_F_NEEDS_CSUM) /* missing csum */ +(size 27 size 1500) /* normal sized MTU */ +(buf[12] == 0x08 buf[13] == 0x00) /* ethertype == IPv4 */ +(buf[23] == 17) /* ip.protocol == UDP */ +(buf[34] == 0 buf[35] == 67)) { /* udp.srcport == bootps */ +/* FIXME this cast is evil */ +net_checksum_calculate((uint8_t *)buf, size); +hdr-flags = ~VIRTIO_NET_HDR_F_NEEDS_CSUM; +} +} + static void virtio_net_receive(void *opaque, const uint8_t *buf, int size) { VirtIONet *n = opaque; @@ -180,6 +208,7 @@ static void virtio_net_receive(void *opaque, const uint8_t *buf, int size) if (tap_has_vnet_hdr(n-vc-vlan-first_client)) { memcpy(hdr, buf, sizeof(*hdr)); offset += total; +work_around_broken_dhclient(hdr, buf + offset, size - offset); } /* copy in packet. ugh */ -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] Work around dhclient brokenness (v2)
Anthony Liguori wrote: With the latest GSO/csum offload patches, any guest using an unpatched version of dhclient (any Ubuntu guest, for instance), will no longer be able to get a DHCP address. dhclient is actually at fault here. It uses AF_PACKET to receive DHCP responses but does not check auxdata to see if the packet has a valid csum. This causes it to throw out the DHCP responses it gets from the virtio interface as there is not a valid checksum. Fedora has carried a patch to fix their dhclient (it's needed for Xen too) but this patch has not made it into a release of dhclient. AFAIK, the patch is in the dhclient CVS but I cannot confirm since their CVS is not public. This patch, suggested by Rusty, looks for UDP packets (of a normal MTU) and explicitly adds a checksum to them if they are missing one. This allows unpatched dhclients to continue to work without needing to update the guest kernels. Since v1, we refined the search criteria to only consider packets originating from a DHCP server. I also added a comment to note that we should disable this routine when we introduce zero copy. Applied, thanks. -- 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 [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[no subject]
subscribe kvm -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/4] Extend virtio config routines to support ballooning
This patch updates the virtio device methods to provide hooks for setting and getting the config. This is needed for ballooning since the balloon driver uses config changes to signal changes in the balloon amount. We also add a method to signal that we have changed the config. Signed-off-by: Anthony Liguori [EMAIL PROTECTED] diff --git a/qemu/hw/virtio-blk.c b/qemu/hw/virtio-blk.c index 88dc086..da9e795 100644 --- a/qemu/hw/virtio-blk.c +++ b/qemu/hw/virtio-blk.c @@ -286,7 +286,7 @@ void *virtio_blk_init(PCIBus *bus, uint16_t vendor, uint16_t device, if (!s) return NULL; -s-vdev.update_config = virtio_blk_update_config; +s-vdev.get_config = virtio_blk_update_config; s-vdev.get_features = virtio_blk_get_features; s-vdev.reset = virtio_blk_reset; s-bs = bs; diff --git a/qemu/hw/virtio-net.c b/qemu/hw/virtio-net.c index 409960f..bc2ede6 100644 --- a/qemu/hw/virtio-net.c +++ b/qemu/hw/virtio-net.c @@ -332,7 +332,7 @@ PCIDevice *virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn) if (!n) return NULL; -n-vdev.update_config = virtio_net_update_config; +n-vdev.get_config = virtio_net_update_config; n-vdev.get_features = virtio_net_get_features; n-vdev.set_features = virtio_net_set_features; n-rx_vq = virtio_add_queue(n-vdev, 256, virtio_net_handle_rx); diff --git a/qemu/hw/virtio.c b/qemu/hw/virtio.c index e035e4e..e675f43 100644 --- a/qemu/hw/virtio.c +++ b/qemu/hw/virtio.c @@ -313,6 +313,8 @@ static uint32_t virtio_config_readb(void *opaque, uint32_t addr) VirtIODevice *vdev = opaque; uint8_t val; +vdev-get_config(vdev, vdev-config); + addr -= vdev-addr + VIRTIO_PCI_CONFIG; if (addr (vdev-config_len - sizeof(val))) return (uint32_t)-1; @@ -326,6 +328,8 @@ static uint32_t virtio_config_readw(void *opaque, uint32_t addr) VirtIODevice *vdev = opaque; uint16_t val; +vdev-get_config(vdev, vdev-config); + addr -= vdev-addr + VIRTIO_PCI_CONFIG; if (addr (vdev-config_len - sizeof(val))) return (uint32_t)-1; @@ -339,6 +343,8 @@ static uint32_t virtio_config_readl(void *opaque, uint32_t addr) VirtIODevice *vdev = opaque; uint32_t val; +vdev-get_config(vdev, vdev-config); + addr -= vdev-addr + VIRTIO_PCI_CONFIG; if (addr (vdev-config_len - sizeof(val))) return (uint32_t)-1; @@ -357,6 +363,9 @@ static void virtio_config_writeb(void *opaque, uint32_t addr, uint32_t data) return; memcpy(vdev-config + addr, val, sizeof(val)); + +if (vdev-set_config) +vdev-set_config(vdev, vdev-config); } static void virtio_config_writew(void *opaque, uint32_t addr, uint32_t data) @@ -369,6 +378,9 @@ static void virtio_config_writew(void *opaque, uint32_t addr, uint32_t data) return; memcpy(vdev-config + addr, val, sizeof(val)); + +if (vdev-set_config) +vdev-set_config(vdev, vdev-config); } static void virtio_config_writel(void *opaque, uint32_t addr, uint32_t data) @@ -381,6 +393,9 @@ static void virtio_config_writel(void *opaque, uint32_t addr, uint32_t data) return; memcpy(vdev-config + addr, val, sizeof(val)); + +if (vdev-set_config) +vdev-set_config(vdev, vdev-config); } static void virtio_map(PCIDevice *pci_dev, int region_num, @@ -409,7 +424,7 @@ static void virtio_map(PCIDevice *pci_dev, int region_num, register_ioport_read(addr + 20, vdev-config_len, 4, virtio_config_readl, vdev); - vdev-update_config(vdev, vdev-config); + vdev-get_config(vdev, vdev-config); } } @@ -439,7 +454,13 @@ void virtio_notify(VirtIODevice *vdev, VirtQueue *vq) (vq-vring.avail-flags VRING_AVAIL_F_NO_INTERRUPT)) return; -vdev-isr = 1; +vdev-isr |= 0x01; +virtio_update_irq(vdev); +} + +void virtio_notify_config(VirtIODevice *vdev) +{ +vdev-isr |= 0x03; virtio_update_irq(vdev); } diff --git a/qemu/hw/virtio.h b/qemu/hw/virtio.h index 1adaed3..0dcedbf 100644 --- a/qemu/hw/virtio.h +++ b/qemu/hw/virtio.h @@ -120,7 +120,8 @@ struct VirtIODevice void *config; uint32_t (*get_features)(VirtIODevice *vdev); void (*set_features)(VirtIODevice *vdev, uint32_t val); -void (*update_config)(VirtIODevice *vdev, uint8_t *config); +void (*get_config)(VirtIODevice *vdev, uint8_t *config); +void (*set_config)(VirtIODevice *vdev, const uint8_t *config); void (*reset)(VirtIODevice *vdev); VirtQueue vq[VIRTIO_PCI_QUEUE_MAX]; }; @@ -147,4 +148,6 @@ void virtio_save(VirtIODevice *vdev, QEMUFile *f); void virtio_load(VirtIODevice *vdev, QEMUFile *f); +void virtio_notify_config(VirtIODevice *vdev); + #endif -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/4] libkvm: add kvm_has_mmu_notifiers
This patch adds a kvm_has_mmu_notifiers routine to libkvm. This allows userspace to query the existence of mmu notifiers which is important for ballooning since madvise() is not safe from userspace without it. Signed-off-by: Anthony Liguori [EMAIL PROTECTED] diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c index 5edfad7..ebee5b8 100644 --- a/libkvm/libkvm.c +++ b/libkvm/libkvm.c @@ -1053,6 +1053,15 @@ int kvm_pit_in_kernel(kvm_context_t kvm) return kvm-pit_in_kernel; } +int kvm_has_mmu_notifiers(kvm_context_t kvm) +{ +int r = 0; +#ifdef KVM_CAP_SYNC_MMU +r = ioctl(kvm-fd, KVM_CHECK_EXTENSION, KVM_CAP_SYNC_MMU); +#endif +return r; +} + int kvm_init_coalesced_mmio(kvm_context_t kvm) { int r = 0; diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h index 9f06fcc..fb51ee1 100644 --- a/libkvm/libkvm.h +++ b/libkvm/libkvm.h @@ -528,6 +528,8 @@ int kvm_dirty_pages_log_reset(kvm_context_t kvm); */ int kvm_irqchip_in_kernel(kvm_context_t kvm); +int kvm_has_mmu_notifiers(kvm_context_t kvm); + #ifdef KVM_CAP_IRQCHIP /*! * \brief Dump in kernel IRQCHIP contents -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/4] add ballooning infrastructure to QEMU
This patch adds a ballooning infrastructure to QEMU. This includes a pair of monitor commands, balloon and info balloon, to balloon a guest and to query the guest's balloon status. Signed-off-by: Anthony Liguori [EMAIL PROTECTED] diff --git a/qemu/balloon.h b/qemu/balloon.h new file mode 100644 index 000..60b4a5d --- /dev/null +++ b/qemu/balloon.h @@ -0,0 +1,27 @@ +/* + * Balloon + * + * Copyright IBM, Corp. 2008 + * + * Authors: + * Anthony Liguori [EMAIL PROTECTED] + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + */ + +#ifndef _QEMU_BALLOON_H +#define _QEMU_BALLOON_H + +#include cpu-defs.h + +typedef ram_addr_t (QEMUBalloonEvent)(void *opaque, ram_addr_t target); + +void qemu_add_balloon_handler(QEMUBalloonEvent *func, void *opaque); + +void qemu_balloon(ram_addr_t target); + +ram_addr_t qemu_balloon_status(void); + +#endif diff --git a/qemu/monitor.c b/qemu/monitor.c index 4acf346..2240d8e 100644 --- a/qemu/monitor.c +++ b/qemu/monitor.c @@ -35,6 +35,7 @@ #include audio/audio.h #include disas.h #include migration.h +#include balloon.h #include dirent.h #include qemu-timer.h @@ -1399,6 +1400,23 @@ static void do_inject_nmi(int cpu_index) } #endif +static void do_balloon(int value) +{ +ram_addr_t target = value; +qemu_balloon(target 20); +} + +static void do_info_balloon(void) +{ +ram_addr_t actual; + +actual = qemu_balloon_status(); +if (actual == 0) + term_printf(Ballooning not activated in VM\n); +else + term_printf(balloon: actual=%d\n, (int)(actual 20)); +} + static term_cmd_t term_cmds[] = { { help|?, s?, do_help, [cmd], show the help }, @@ -1494,6 +1512,8 @@ static term_cmd_t term_cmds[] = { { pci_add, iss, device_hot_add, bus nic|storage [[vlan=n][,macaddr=addr][,model=type]] [file=file][,if=type][,bus=nr]..., hot-add PCI device }, { pci_del, ii, device_hot_remove, bus slot-number, hot remove PCI device }, #endif +{ balloon, i, do_balloon, + target, request VM to change it's memory allocation (in MB) }, { NULL, NULL, }, }; @@ -1558,6 +1578,8 @@ static term_cmd_t info_cmds[] = { #endif { migration, , do_info_migration, , show migration information }, +{ balloon, , do_info_balloon, + , show balloon information }, { NULL, NULL, }, }; diff --git a/qemu/vl.c b/qemu/vl.c index 2dc1311..ec89921 100644 --- a/qemu/vl.c +++ b/qemu/vl.c @@ -38,6 +38,7 @@ #include block.h #include audio/audio.h #include migration.h +#include balloon.h #include qemu-kvm.h #include unistd.h @@ -530,6 +531,31 @@ void hw_error(const char *fmt, ...) va_end(ap); abort(); } + +/***/ +/* ballooning */ + +static QEMUBalloonEvent *qemu_balloon_event; +void *qemu_balloon_event_opaque; + +void qemu_add_balloon_handler(QEMUBalloonEvent *func, void *opaque) +{ +qemu_balloon_event = func; +qemu_balloon_event_opaque = opaque; +} + +void qemu_balloon(ram_addr_t target) +{ +if (qemu_balloon_event) + qemu_balloon_event(qemu_balloon_event_opaque, target); +} + +ram_addr_t qemu_balloon_status(void) +{ +if (qemu_balloon_event) + return qemu_balloon_event(qemu_balloon_event_opaque, 0); +return 0; +} /***/ /* keyboard/mouse */ -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/4] Add virtio balloon driver
This patch adds the virtio balloon driver. It doesn't actually reduce the RSS size when using KVM (although it does when using -no-kvm). This is because even with MMU notifiers, we're holding a reference to each page in the shadow page table. Once we switch to not taking a reference for pages in the shadow page table, the balloon driver should work as expected. Signed-off-by: Anthony Liguori [EMAIL PROTECTED] diff --git a/qemu/Makefile.target b/qemu/Makefile.target index a86464f..cd985f6 100644 --- a/qemu/Makefile.target +++ b/qemu/Makefile.target @@ -598,7 +598,7 @@ OBJS += rtl8139.o OBJS += e1000.o # virtio devices -OBJS += virtio.o virtio-net.o virtio-blk.o +OBJS += virtio.o virtio-net.o virtio-blk.o virtio-balloon.o OBJS += device-hotplug.o diff --git a/qemu/hw/pc.c b/qemu/hw/pc.c index 3a8269b..b19e558 100644 --- a/qemu/hw/pc.c +++ b/qemu/hw/pc.c @@ -1161,6 +1161,9 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size, extboot_init(info-bdrv, 1); } + +if (pci_enabled) +virtio_balloon_init(pci_bus); } static void pc_init_pci(ram_addr_t ram_size, int vga_ram_size, diff --git a/qemu/hw/pc.h b/qemu/hw/pc.h index c284bf1..5b68d69 100644 --- a/qemu/hw/pc.h +++ b/qemu/hw/pc.h @@ -164,4 +164,7 @@ void *virtio_blk_init(PCIBus *bus, uint16_t vendor, uint16_t device, void extboot_init(BlockDriverState *bs, int cmd); +/* virtio-balloon.h */ +void *virtio_balloon_init(PCIBus *bus); + #endif diff --git a/qemu/hw/virtio-balloon.c b/qemu/hw/virtio-balloon.c new file mode 100644 index 000..457b88f --- /dev/null +++ b/qemu/hw/virtio-balloon.c @@ -0,0 +1,194 @@ +/* + * Virtio Block Device + * + * Copyright IBM, Corp. 2008 + * + * Authors: + * Anthony Liguori [EMAIL PROTECTED] + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + */ + +#include qemu-common.h +#include virtio.h +#include pc.h +#include sysemu.h +#include cpu.h +#include balloon.h +#include virtio-balloon.h +#include qemu-kvm.h + +#if defined(__linux__) +#include sys/mman.h +#endif + +typedef struct VirtIOBalloon +{ +VirtIODevice vdev; +VirtQueue *ivq, *dvq; +uint32_t num_pages; +uint32_t actual; +} VirtIOBalloon; + +static VirtIOBalloon *to_virtio_balloon(VirtIODevice *vdev) +{ +return (VirtIOBalloon *)vdev; +} + +static void balloon_page(void *addr, int deflate) +{ +#if defined(__linux__) +if (!kvm_enabled() || !qemu_kvm_has_mmu_notifiers()) +madvise(addr, TARGET_PAGE_SIZE, +deflate ? MADV_WILLNEED : MADV_DONTNEED); +#endif +} + +/* FIXME: once we do a virtio refactoring, this will get subsumed into common + * code */ +static size_t memcpy_from_iovector(void *data, size_t offset, size_t size, + struct iovec *iov, int iovlen) +{ +int i; +uint8_t *ptr = data; +size_t iov_off = 0; +size_t data_off = 0; + +for (i = 0; i iovlen size; i++) { +if (offset (iov_off + iov[i].iov_len)) { +size_t len = MIN((iov_off + iov[i].iov_len) - offset , size); + +memcpy(ptr + data_off, iov[i].iov_base + (offset - iov_off), len); + +data_off += len; +offset += len; +size -= len; +} + +iov_off += iov[i].iov_len; +} + +return data_off; +} + +static void virtio_balloon_handle_output(VirtIODevice *vdev, VirtQueue *vq) +{ +VirtIOBalloon *s = to_virtio_balloon(vdev); +VirtQueueElement elem; + +while (virtqueue_pop(vq, elem)) { + size_t offset = 0; + uint32_t pfn; + + while (memcpy_from_iovector(pfn, offset, 4, +elem.out_sg, elem.out_num) == 4) { + ram_addr_t pa; + ram_addr_t addr; + + pa = (ram_addr_t)ldl_p(pfn) TARGET_PAGE_BITS; + offset += 4; + + addr = cpu_get_physical_page_desc(pa); + if ((addr ~TARGET_PAGE_MASK) != IO_MEM_RAM) + continue; + + balloon_page(phys_ram_base + addr, !!(vq == s-dvq)); + } + + virtqueue_push(vq, elem, offset); + virtio_notify(vdev, vq); +} +} + +static void virtio_balloon_get_config(VirtIODevice *vdev, uint8_t *config_data) +{ +VirtIOBalloon *dev = to_virtio_balloon(vdev); +struct virtio_balloon_config config; + +config.num_pages = cpu_to_le32(dev-num_pages); +config.actual = cpu_to_le32(dev-actual); + +memcpy(config_data, config, 8); +} + +static void virtio_balloon_set_config(VirtIODevice *vdev, + const uint8_t *config_data) +{ +VirtIOBalloon *dev = to_virtio_balloon(vdev); +struct virtio_balloon_config config; +memcpy(config, config_data, 8); +dev-actual = config.actual; +} + +static uint32_t virtio_balloon_get_features(VirtIODevice *vdev) +{ +return 0; +} + +static ram_addr_t virtio_balloon_to_target(void *opaque, ram_addr_t target) +{ +VirtIOBalloon *dev =
Re: [PATCH] Work around dhclient brokenness
On Tue, Aug 19, 2008 at 07:10:44PM +1000, Rusty Russell wrote: We need both. CSUM2 is the new virtio-level feature. Perhaps that's what I'm misisng. How is this different to CSUM? -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: serial/ rs232 and qemu /kvm?
On Tue, Aug 19, 2008 at 11:24 AM, Marc Weber [EMAIL PROTECTED] wrote: First of all, is this the mailinglist to ask this question? Or should I ask it on the qemu lists? I'd like to run WinXP/ Vista within kvm and do microcontroller programming. My host is linux of course. I had some success using the qemu pre 0.8 way using slsnif. Setting baud rate to 115200 made some of the operations work, but most don't. So is there a way to connect COM1 within the guest to /dev/ttyS0 so that baud rate settings within the guest will be forwarded to /dev/ttyS0 on the host? check out for qemu's -serial option Marc Weber -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html -- Glauber Costa. Free as in Freedom http://glommer.net The less confident you are, the more serious you have to act. -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Migrating Vm's from one machine to another...and back
Hi Chris, thank you for your advice. I tried but did not succeed yet. I experienced some issues with tcp mode. I will retry when I am back from vacation next week. I will tell you. jean-pierre This message was sent using IMP, the Internet Messaging Program. -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: serial/ rs232 and qemu /kvm?
I have been trying to use kvm to do some microcontroller programming, mostly with success - until I want to send an ascii NULL down the port. (I don't know what's going on there, but if you have any ideas, that would be fantastic)Our communication protocol is very touchy about speeds, so the baud rate was being passed on correctly when I used qemu/kvm like this: kvm irrelevant options -serial /dev/ttyUSB0 (I'm using a usb-serial converter). You can have up to 4 COM ports by repeating the -serial device option. See the qemu man page for more details (yes, it works just the same when you're invoking it with kvm). If you're trying to use virt-manager, then don't. Virt-manager stops you from having access to a bunch of the underlying features of kvm/qemu such as serial ports. I'm told they're working on it, but it's only useful for a basic setup at the moment. Michael Glauber Costa wrote: On Tue, Aug 19, 2008 at 11:24 AM, Marc Weber [EMAIL PROTECTED] wrote: First of all, is this the mailinglist to ask this question? Or should I ask it on the qemu lists? I'd like to run WinXP/ Vista within kvm and do microcontroller programming. My host is linux of course. I had some success using the qemu pre 0.8 way using slsnif. Setting baud rate to 115200 made some of the operations work, but most don't. So is there a way to connect COM1 within the guest to /dev/ttyS0 so that baud rate settings within the guest will be forwarded to /dev/ttyS0 on the host? check out for qemu's -serial option Marc Weber -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html === This email, including any attachments, is only for the intended addressee. It is subject to copyright, is confidential and may be the subject of legal or other privilege, none of which is waived or lost by reason of this transmission. If the receiver is not the intended addressee, please accept our apologies, notify us by return, delete all copies and perform no other act on the email. Unfortunately, we cannot warrant that the email has not been altered or corrupted during transmission. === -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: serial/ rs232 and qemu /kvm?
Michael Malone wrote: If you're trying to use virt-manager, then don't. Virt-manager stops you from having access to a bunch of the underlying features of kvm/qemu such as serial ports. I'm told they're working on it, but it's only useful for a basic setup at the moment. Serial ports *are* available through libvirt, and have been since late April. Using a recent git build of libvirt, I've yet to find anything I'm interested in but incapable of (except perhaps USB storage hot-unplug, but that's very much just a nice-to-have). -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: serial/ rs232 and qemu /kvm?
Charles Duffy wrote: Michael Malone wrote: If you're trying to use virt-manager, then don't. Virt-manager stops you from having access to a bunch of the underlying features of kvm/qemu such as serial ports. I'm told they're working on it, but it's only useful for a basic setup at the moment. Serial ports *are* available through libvirt, and have been since late April. Using a recent git build of libvirt, I've yet to find anything I'm interested in but incapable of (except perhaps USB storage hot-unplug, but that's very much just a nice-to-have). My apologies. It's more than likely that I'm using Ubuntu and using their package (where feature updates are only included every 6months), rather than a recent download. -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html === This email, including any attachments, is only for the intended addressee. It is subject to copyright, is confidential and may be the subject of legal or other privilege, none of which is waived or lost by reason of this transmission. If the receiver is not the intended addressee, please accept our apologies, notify us by return, delete all copies and perform no other act on the email. Unfortunately, we cannot warrant that the email has not been altered or corrupted during transmission. === -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] Use .fixup instead of .text.fixup on __kvm_handle_fault_on_reboot
[oops. sent it to the old kvm-devel list. sending to the right list, now] vmlinux.lds expects the fixup code to be on a section named .fixup. The .text.fixup section is not mentioned on vmlinux.lds, and is included on the resulting vmlinux (just after .text) only because of ld heuristics on placing orphan sections. However, placing .text.fixup outside .text breaks the definition of _etext, making it exclude the .text.fixup contents. That makes .text.fixup be ignored by the kernel initialization code that needs to know about section locations, such as the code setting page protection bits. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- include/asm-x86/kvm_host.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/include/asm-x86/kvm_host.h b/include/asm-x86/kvm_host.h index 1e28880..982b6b2 100644 --- a/include/asm-x86/kvm_host.h +++ b/include/asm-x86/kvm_host.h @@ -743,7 +743,7 @@ asmlinkage void kvm_handle_fault_on_reboot(void); #define __kvm_handle_fault_on_reboot(insn) \ 666: insn \n\t \ - .pushsection .text.fixup, \ax\ \n \ + .pushsection .fixup, \ax\ \n \ 667: \n\t \ __ASM_SIZE(push) $666b \n\t\ jmp kvm_handle_fault_on_reboot \n\t \ -- 1.5.5.GIT -- Eduardo -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] kvm: bios: end AP boot code execution in rombios
Avi Kivity wrote: .code16 smp_ap_boot_code_start: + cli Redundant (but no harm done). I added it so it's explicit this code is run with IF=0. Kind of serves a documentation purpose so we don't have to look up whether the cpu starts with IF=0 or not. - Sebastian -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 0/2] do not run halted vcpu's
On Sun, Aug 17, 2008 at 10:41:07AM +0300, Avi Kivity wrote: Avi Kivity wrote: Marcelo Tosatti wrote: KVM: x86: do not execute halted vcpus Alright, need_resched was actually checked in vcpu_enter_guest, so this checks signal_pending too: Offline or uninitialized vcpu's can be executed if requested to perform userspace work. Follow Avi's suggestion to handle halted vcpu's in the main loop, simplifying kvm_emulate_halt(). Introduce a new vcpu-requests bit to indicate events that promote state from halted to running. Also standardize vcpu wake sites. Applied, thanks. This killed reboot, so I reverted it. Works for me (both UP/SMP, Windows/Linux, guest initiated/system_reset), and can't find anything obvious in the diff. How can it be reproduced? -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC][PATCH]Problems with hpet on kvm
I've been playing with my hpet patch on kvm and seeing some strange behavior. The patch I've been using is attached below. /usr/local/bin/qemu-system-x86_64 -boot cd -hda /home/beth/images/ubuntu_server_8.04_10G.img -m 1024 -net nic,model=e1000 -net user -smp 2 -vnc :1 With the above command line the boot intermittently fails with an infinite roll of error messages that look something like this: *BEGIN ERROR MESSAGES ... ACPI Exception (evgpe-0704): AE_NO_MEMORY, Unable to queue handler for GPE[ E] - event disabled [20070126] ACPI Exception (evgpe-0704): AE_NO_MEMORY, Unable to queue handler for GPE[ F] - event disabled [20070126] printk: 242 messages suppressed. kacpid: page allocation failure. order:0, mode:0x20 Pid: 93, comm: kacpid Not tainted 2.6.25.9 #13 Call Trace: IRQ [8025f143] __alloc_pages+0x325/0x33e [8027b27c] kmem_getpages+0xc6/0x194 [8027b85a] fallback_alloc+0x10d/0x185 [8027bea7] kmem_cache_alloc+0xbd/0xe7 [80369944] acpi_ev_asynch_execute_gpe_method+0x0/0x117 [80362e9f] acpi_os_execute+0x2e/0x9a [80369823] acpi_ev_gpe_dispatch+0xd0/0x149 [80369b0c] acpi_ev_gpe_detect+0xb1/0x104 [80367600] acpi_ev_fixed_event_detect+0x34/0xd4 [8036800a] acpi_ev_sci_xrupt_handler+0x1a/0x22 [80362895] acpi_irq+0x11/0x23 [802553a0] handle_IRQ_event+0x25/0x53 [802567f6] handle_fasteoi_irq+0x90/0xc8 [8020da12] do_IRQ+0xf1/0x15f [8020b471] ret_from_intr+0x0/0xa [80233398] __do_softirq+0x5a/0xce [8020c0ec] call_softirq+0x1c/0x28 [8020d794] do_softirq+0x2c/0x68 [802332fa] irq_exit+0x3f/0x83 [8020da5f] do_IRQ+0x13e/0x15f [8020b471] ret_from_intr+0x0/0xa EOI [80371f1c] acpi_ns_get_parent_node+0x14/0x15 [80371b08] acpi_ns_delete_namespace_by_owner+0xb7/0xde [80365641] acpi_ds_terminate_control_method+0x73/0xc6 [80373933] acpi_ps_parse_aml+0x179/0x254 [80374c4c] acpi_ps_execute_method+0x12b/0x1d7 [80371c18] acpi_ns_evaluate+0xa4/0x100 [80369a08] acpi_ev_asynch_execute_gpe_method+0xc4/0x117 [80362dd6] acpi_os_execute_deferred+0x0/0x2c [80362df9] acpi_os_execute_deferred+0x23/0x2c [8023cb6c] run_workqueue+0x79/0x104 [8023d47f] worker_thread+0xd9/0xe8 [8023fc91] autoremove_wake_function+0x0/0x2e [8023d3a6] worker_thread+0x0/0xe8 [8023fb5d] kthread+0x47/0x76 [80229e74] schedule_tail+0x28/0x5c [8020bd78] child_rip+0xa/0x12 [8023fb16] kthread+0x0/0x76 [8020bd6e] child_rip+0x0/0x12 Mem-info: Node 0 DMA per-cpu: CPU0: hi:0, btch: 1 usd: 0 CPU1: hi:0, btch: 1 usd: 0 Node 0 DMA32 per-cpu: CPU0: hi: 186, btch: 31 usd: 65 CPU1: hi: 186, btch: 31 usd: 184 Active:0 inactive:0 dirty:0 writeback:0 unstable:0 free:0 slab:255796 mapped:0 pagetables:0 bounce:0 Node 0 DMA free:0kB min:0kB low:0kB high:0kB active:0kB inactive:0kB present:8924kB pages_scanned:0 all_unreclaimable? no lowmem_reserve[]: 0 0 0 0 Node 0 DMA32 free:0kB min:0kB low:0kB high:0kB active:0kB inactive:0kB present:1018020kB pages_scanned:0 all_unreclaimable? no lowmem_reserve[]: 0 0 0 0 Node 0 DMA: 0*4kB 0*8kB 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 0kB Node 0 DMA32: 0*4kB 0*8kB 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 0kB 0 total pagecache pages Swap cache: add 0, delete 0, find 0/0 Free swap = 0kB Total swap = 0kB Free swap:0kB 262128 pages of RAM 5637 reserved pages 0 pages shared 0 pages swap cached ACPI Exception (evgpe-0704): AE_NO_MEMORY, Unable to queue handler for GPE[ 8] - event disabled [20070126] ACPI Exception (evgpe-0704): AE_NO_MEMORY, Unable to queue handler for GPE[ 9] - event disabled [20070126] ... *END ERROR MESSAGES** If I add -no-kvm-irqchip, the error disappears. Can anyone offer any insight about what is going on here? I don't know if it is related, but booting linux with the hpet seems to stall in some places, and I don't see that when booting without the hpet. Other than this problem, I have booted win2k8 and linux with the hpet. The only other odd situation is that, to get linux to work I have to use irq 0 for timer0, but to get windows to work, I have to use irq 2. In hpet.c update_irq: if (timer-tn == 0) irq=timer-state-irqs[0]; must be changed to if (timer-tn == 0) irq=timer-state-irqs[2]; to get win2k8 to boot. Any ideas? Beth Kon IBM Linux Technology Center ** signed-off-by Beth Kon [EMAIL PROTECTED] diff --git a/qemu/Makefile.target b/qemu/Makefile.target index a86464f..8634186 100644 --- a/qemu/Makefile.target +++ b/qemu/Makefile.target @@ -607,7 +607,7 @@ ifeq
Re: [PATCH] Work around dhclient brokenness
Rusty Russell wrote: On Tuesday 19 August 2008 15:17:08 Herbert Xu wrote: On Mon, Aug 18, 2008 at 10:13:55PM -0700, Chris Wedgwood wrote: CSUM2 sounds so ugly though. Features seem to get added and never removed how about if this had a documented short lifetime (if it really must go in)? All we need is a simple toggle to disable checksum offload. Every NIC that offers receive checksum offload allows it to be disabled. virtio shouldn't be any different. Resetting the NIC seems a bit over the top. Not really. We could extend the protocol, but that's currently how feature negotiation works: you can't do it while the device is live. That seemed simplest. I learnt from Xen :) (Of course, we don't need to *disable* it, we need to *enable* it). Checksum offload enabled could be a config flag. Then it could be toggled while the device is live. Of course, you need a feature flag for the config flag. Regards, Anthony Liguori Cheers, Rusty. -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: madvise() not triggering page discard with MMU-notifiers
Hi Anthony, On Mon, Aug 18, 2008 at 05:04:25PM -0500, Anthony Liguori wrote: Attached is an updated migration patch. It does not appear, however, that madvise() is triggering discarding of pages even with an MMU-notifier enabled kernel. I take it that this is because we're still holding a reference count to the page when it is in the shadow page table? Any ETA on when this will change? Shadow references should be dropped via kvm_unmap_rmapp - rmap_remove. So the symptom is that RSS for the task does not decrease accordingly to the ballooned down size? -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] x86 emulator: Simplify emulating Grp4/Grp5 instructions.
On Tue, Aug 19, 2008 at 1:17 AM, Mohammed Gamal [EMAIL PROTECTED] wrote: emulate_grp45() always returns 0. Therefore there is no need to check its return value. Signed-off-by: Mohammed Gamal [EMAIL PROTECTED] --- arch/x86/kvm/x86_emulate.c |4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c index b97e80e..3aa9acb 100644 --- a/arch/x86/kvm/x86_emulate.c +++ b/arch/x86/kvm/x86_emulate.c @@ -1810,9 +1810,7 @@ special_insn: c-dst.type = OP_NONE; /* Disable writeback. */ break; case 0xfe ... 0xff: /* Grp4/Grp5 */ - rc = emulate_grp45(ctxt, ops); - if (rc != 0) - goto done; + emulate_grp45(ctxt, ops); break; } -- 1.5.4.3 Ignore this patch, it'd be wiser to keep the check when we add the rest of Grp4/5 instructions to emulate_grp45() -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] x86 emulator: Add call near absolute (opcode 0xff rm/2)
This adds the near call with absolute address instruction. Signed-off-by: Mohammed Gamal [EMAIL PROTECTED] --- arch/x86/kvm/x86_emulate.c | 55 +-- 1 files changed, 37 insertions(+), 18 deletions(-) diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c index b97e80e..1707056 100644 --- a/arch/x86/kvm/x86_emulate.c +++ b/arch/x86/kvm/x86_emulate.c @@ -1080,6 +1080,37 @@ static inline void emulate_push(struct x86_emulate_ctxt *ctxt) c-regs[VCPU_REGS_RSP]); } +static int emulate_near_call(struct x86_emulate_ctxt *ctxt, +struct x86_emulate_ops *ops, +bool absolute) +{ + struct decode_cache *c = ctxt-decode; + long int offset; + int rc = 0; + + switch (c-op_bytes) { + case 2: + offset = insn_fetch(s16, 2, c-eip); + break; + case 4: + offset = insn_fetch(s32, 4, c-eip); + break; + default: + DPRINTF(Call: Invalid op_bytes\n); + rc = 1; + goto done; + } + c-src.val = (unsigned long) c-eip; + if (absolute) + c-eip = offset; + else + jmp_rel(c, offset); + c-op_bytes = c-ad_bytes; + emulate_push(ctxt); +done: + return rc; +} + static inline int emulate_grp1a(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops) { @@ -1162,6 +1193,8 @@ static inline int emulate_grp45(struct x86_emulate_ctxt *ctxt, case 1: /* dec */ emulate_1op(dec, c-dst, ctxt-eflags); break; + case 2: /* call near abs */ + return emulate_near_call(ctxt, ops, 1); case 4: /* jmp abs */ c-eip = c-src.val; break; @@ -1710,25 +1743,11 @@ special_insn: port = insn_fetch(u8, 1, c-eip); io_direction = 0; goto do_io; - case 0xe8: /* call (near) */ { - long int rel; - switch (c-op_bytes) { - case 2: - rel = insn_fetch(s16, 2, c-eip); - break; - case 4: - rel = insn_fetch(s32, 4, c-eip); - break; - default: - DPRINTF(Call: Invalid op_bytes\n); - goto cannot_emulate; - } - c-src.val = (unsigned long) c-eip; - jmp_rel(c, rel); - c-op_bytes = c-ad_bytes; - emulate_push(ctxt); + case 0xe8: /* call (near) */ + rc = emulate_near_call(ctxt, ops, 0); + if (rc != 0) + goto done; break; - } case 0xe9: /* jmp rel */ goto jmp; case 0xea: /* jmp far */ { -- 1.5.4.3 -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 0/2] do not run halted vcpu's
Marcelo Tosatti wrote: On Sun, Aug 17, 2008 at 10:41:07AM +0300, Avi Kivity wrote: Avi Kivity wrote: Marcelo Tosatti wrote: KVM: x86: do not execute halted vcpus Alright, need_resched was actually checked in vcpu_enter_guest, so this checks signal_pending too: Offline or uninitialized vcpu's can be executed if requested to perform userspace work. Follow Avi's suggestion to handle halted vcpu's in the main loop, simplifying kvm_emulate_halt(). Introduce a new vcpu-requests bit to indicate events that promote state from halted to running. Also standardize vcpu wake sites. Applied, thanks. This killed reboot, so I reverted it. Works for me (both UP/SMP, Windows/Linux, guest initiated/system_reset), and can't find anything obvious in the diff. How can it be reproduced? Windows UP guest initiated. Since you say it worked, I probably botched something while testing. I'll try again. -- Do not meddle in the internals of kernels, for they are subtle and quick to panic. -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/4] kvmppc: convert wrteei to wrtee as kvm guest optimization
On Tuesday 19 August 2008, [EMAIL PROTECTED] wrote: Dependent on the already existing CONFIG_KVM_GUEST config option this patch changes wrteei to wrtee allowing the hypervisor to rewrite those to nontrapping instructions. Maybe we should split the kvm guest otpimizations in two parts one for the overhead free optimizations and on for the rest that might add some complexity for non virtualized execution (like this one). Signed-off-by: Christian Ehrhardt [EMAIL PROTECTED] How significant is the performance impact of this change for non-virtualized systems? If it's very low, maybe you should not bother with the #ifdef, and if it's noticable, you might be better off using dynamic patching for this. Arnd -- To unsubscribe from this list: send the line unsubscribe kvm-ppc in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/4] kvmppc: read device tree hypervisor node infrastructure
On Tue, 2008-08-19 at 07:52 -0400, Josh Boyer wrote: On Tue, 2008-08-19 at 12:36 +0200, [EMAIL PROTECTED] wrote: diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c new file mode 100644 --- /dev/null +++ b/arch/powerpc/kernel/kvm.c @@ -0,0 +1,30 @@ +#include linux/percpu.h +#include linux/mm.h +#include linux/kvm_para.h + +void __init kvm_guest_init(void) +{ + if (!kvm_para_available()) + return; +} This looks really odd. You have a void function that checks the return value of another function and returns if not true or.. returns if true. Why bother with the if at all? Nevermind. I see you add more code below this in patch 3. Still looks odd by itself, but makes more sense when the whole series is applied. josh -- To unsubscribe from this list: send the line unsubscribe kvm-ppc in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html