You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(22) |
Sep
(45) |
Oct
(165) |
Nov
(149) |
Dec
(53) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(155) |
Feb
(71) |
Mar
(219) |
Apr
(262) |
May
(21) |
Jun
(5) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Jerone Y. <jy...@us...> - 2008-04-29 16:39:41
|
On Tue, 2008-04-29 at 10:06 -0500, Hollis Blanchard wrote: > On Monday 28 April 2008 16:23:04 Jerone Young wrote: > > +/* This function is to manipulate a cell with multiple values */ > > +void dt_cell_multi(void *fdt, char *node_path, char *property, > > + uint32_t *val_array, int size) > > +{ > > + > > + int offset; > > + int ret; > > Could you please be more careful with your whitespace? Hmmm..I'm looking at the patch on my local machine and it doesn't have any whitespace damage. If there is whitespace damage it was caused by something else (like hg email is doing something). I've attached the orginal patch to this email. > |
From: <ehr...@li...> - 2008-04-29 16:18:20
|
From: Christian Ehrhardt <ehr...@li...> This patch adds the delivery of INTERRUPT_FP_UNAVAIL exceptions to the guest. It's needed if a guest uses ppc binaries using the Floating point instructions. Signed-off-by: Christian Ehrhardt <ehr...@li...> --- [diffstat] [diff] booke_guest.c | 5 +++++ 1 files changed, 5 insertions(+) diff --git a/arch/powerpc/kvm/booke_guest.c b/arch/powerpc/kvm/booke_guest.c --- a/arch/powerpc/kvm/booke_guest.c +++ b/arch/powerpc/kvm/booke_guest.c @@ -340,6 +340,11 @@ int kvmppc_handle_exit(struct kvm_run *r default: BUG(); } + break; + + case BOOKE_INTERRUPT_FP_UNAVAIL: + kvmppc_queue_exception(vcpu, exit_nr); + r = RESUME_GUEST; break; case BOOKE_INTERRUPT_DATA_STORAGE: |
From: Hollis B. <ho...@us...> - 2008-04-29 15:08:48
|
On Monday 28 April 2008 16:23:04 Jerone Young wrote: > +/* This function is to manipulate a cell with multiple values */ > +void dt_cell_multi(void *fdt, char *node_path, char *property, > + uint32_t *val_array, int size) > +{ > + > + int offset; > + int ret; Could you please be more careful with your whitespace? -- Hollis Blanchard IBM Linux Technology Center |
From: David M. <da...@da...> - 2008-04-29 10:30:08
|
From: Avi Kivity <av...@qu...> Date: Sun, 27 Apr 2008 12:40:29 +0300 > Avi Kivity wrote: > > I propose moving the kvm lists to vger.kernel.org, for the following > > benefits: > > > > - better spam control > > - faster service (I see significant lag with the sourceforge lists) > > - no ads appended to the end of each email > > > > If no objections are raised, and if the vger postmasters agree, I will > > mass subscribe the current subscribers so that there will be no > > service interruption. > > > > Since no objections were raised, we'll start to get this rolling. Should I create the list(s) now? If so, please let me know the names they should have. Thanks. |
From: Jerone Y. <jy...@us...> - 2008-04-28 21:30:00
|
1 file changed, 1 deletion(-) qemu/hw/ppc440_bamboo.c | 1 - In 2.6.26 wait is now enabled by default. With this the /hypervisor node will not be need to be idetified to enable the guest to go into wait state while idle. Signed-off-by: Jerone Young <jy...@us...> diff --git a/qemu/hw/ppc440_bamboo.c b/qemu/hw/ppc440_bamboo.c --- a/qemu/hw/ppc440_bamboo.c +++ b/qemu/hw/ppc440_bamboo.c @@ -163,7 +163,6 @@ void bamboo_init(ram_addr_t ram_size, in dt_cell(fdt, "/chosen", "linux,initrd-end", (initrd_base + initrd_size)); dt_string(fdt, "/chosen", "bootargs", (char *)kernel_cmdline); - dt_node(fdt, "/", "hypervisor"); #endif if (kvm_enabled()) { |
From: Jerone Y. <jy...@us...> - 2008-04-28 21:29:00
|
This set of patches contain fixes for bamboo board model, as well as provides more functionality for device tree manipulation. Signed-off-by: Jerone Young <jy...@us...> 3 files changed, 22 insertions(+), 1 deletion(-) qemu/hw/device_tree.c | 16 ++++++++++++++++ qemu/hw/device_tree.h | 2 ++ qemu/hw/ppc440_bamboo.c | 5 ++++- |
From: Jerone Y. <jy...@us...> - 2008-04-28 21:29:00
|
2 files changed, 18 insertions(+) qemu/hw/device_tree.c | 16 ++++++++++++++++ qemu/hw/device_tree.h | 2 ++ This patch adds function dt_cell_multi to allow for manipulation of device tree properties that contain mulitiple 32bit values. Signed-off-by: Jerone Young <jy...@us...> diff --git a/qemu/hw/device_tree.c b/qemu/hw/device_tree.c --- a/qemu/hw/device_tree.c +++ b/qemu/hw/device_tree.c @@ -162,6 +162,22 @@ void dt_cell(void *fdt, char *node_path, } } +/* This function is to manipulate a cell with multiple values */ +void dt_cell_multi(void *fdt, char *node_path, char *property, + uint32_t *val_array, int size) +{ + + int offset; + int ret; + offset = get_offset_of_node(fdt, node_path); + ret = fdt_setprop(fdt, offset, property, val_array, size); + if (ret < 0) { + printf("Unable to set device tree property '%s'\n", + property); + exit(1); + } +} + void dt_string(void *fdt, char *node_path, char *property, char *string) { diff --git a/qemu/hw/device_tree.h b/qemu/hw/device_tree.h --- a/qemu/hw/device_tree.h +++ b/qemu/hw/device_tree.h @@ -19,6 +19,8 @@ void dump_device_tree_to_file(void *fdt, void dump_device_tree_to_file(void *fdt, char *filename); void dt_cell(void *fdt, char *node_path, char *property, uint32_t val); +void dt_cell_multi(void *fdt, char *node_path, char *property, + uint32_t *val_array, int size); void dt_string(void *fdt, char *node_path, char *property, char *string); void dt_node(void *fdt, char *node_parent_path, char *name); |
From: Jerone Y. <jy...@us...> - 2008-04-28 21:26:49
|
1 file changed, 4 insertions(+) qemu/hw/ppc440_bamboo.c | 4 ++++ This fixes a issue where the amount of memory is not properly being defined in the device tree. It currently is hardcoded for 144MB. The result is that if you specify a memory size below the hardcoded size, the guest crashes. This patch now dynamically changes the device tree to the memory value specified. Signed-off-by: Jerone Young <jy...@us...> diff --git a/qemu/hw/ppc440_bamboo.c b/qemu/hw/ppc440_bamboo.c --- a/qemu/hw/ppc440_bamboo.c +++ b/qemu/hw/ppc440_bamboo.c @@ -50,6 +50,7 @@ void bamboo_init(ram_addr_t ram_size, in int i=0, k=0; uint32_t cpu_freq; uint32_t timebase_freq; + uint32_t mem_reg_property[]={0, 0, ram_size}; printf("%s: START\n", __func__); @@ -73,6 +74,7 @@ void bamboo_init(ram_addr_t ram_size, in printf("WARNING: %i MB left over memory is ram\n", bytes_to_mb((int)tmp_ram_size)); ram_size -= tmp_ram_size; + mem_reg_property[2] = ram_size; } /* Setup CPU */ @@ -159,6 +161,8 @@ void bamboo_init(ram_addr_t ram_size, in /* manipulate device tree in memory */ dt_cell(fdt, "/cpus/cpu@0", "clock-frequency", cpu_freq); dt_cell(fdt, "/cpus/cpu@0", "timebase-frequency", timebase_freq); + dt_cell_multi(fdt, "/memory", "reg", mem_reg_property, + sizeof(mem_reg_property)); dt_cell(fdt, "/chosen", "linux,initrd-start", initrd_base); dt_cell(fdt, "/chosen", "linux,initrd-end", (initrd_base + initrd_size)); |
From: Jerone Y. <jy...@us...> - 2008-04-28 19:09:19
|
1 file changed, 25 insertions(+), 13 deletions(-) kernel/Makefile | 38 +++++++++++++++++++++++++------------- This patch removes static x86 entries and makes things work for multiple archs. Signed-off-by: Jerone Young <jy...@us...> diff --git a/kernel/Makefile b/kernel/Makefile --- a/kernel/Makefile +++ b/kernel/Makefile @@ -1,5 +1,10 @@ include ../config.mak include ../config.mak +ARCH_DIR=$(ARCH) +ifneq '$(filter $(ARCH_DIR), x86_64 i386)' '' + ARCH_DIR=x86 +endif + KVERREL = $(patsubst /lib/modules/%/build,%,$(KERNELDIR)) DESTDIR= @@ -18,10 +23,19 @@ _hack = mv $1 $1.orig && \ | sed '/\#include/! s/\blapic\b/l_apic/g' > $1 && rm $1.orig unifdef = mv $1 $1.orig && \ - unifdef -DCONFIG_X86 $1.orig > $1; \ + unifdef -DCONFIG_$(shell echo $(ARCH_DIR)|tr '[:lower:]' '[:upper:]') $1.orig > $1; \ [ $$? -le 1 ] && rm $1.orig hack = $(call _hack,$T/$(strip $1)) + +ifneq '$(filter $(ARCH_DIR), x86)' '' +HACK_FILES = kvm_main.c \ + mmu.c \ + vmx.c \ + svm.c \ + x86.c \ + irq.h +endif all:: # include header priority 1) $LINUX 2) $KERNELDIR 3) include-compat @@ -49,21 +63,19 @@ header-sync: rm -rf $T rm -f include/asm - ln -sf asm-x86 include/asm - ln -sf asm-x86 include-compat/asm + ln -sf asm-$(ARCH_DIR) include/asm + ln -sf asm-$(ARCH_DIR) include-compat/asm source-sync: rm -rf $T rsync --exclude='*.mod.c' -R \ - "$(LINUX)"/arch/x86/kvm/./*.[ch] \ - "$(LINUX)"/virt/kvm/./*.[ch] \ - $T/ - $(call hack, kvm_main.c) - $(call hack, mmu.c) - $(call hack, vmx.c) - $(call hack, svm.c) - $(call hack, x86.c) - $(call hack, irq.h) + "$(LINUX)"/arch/$(ARCH_DIR)/kvm/./*.[ch] \ + "$(LINUX)"/virt/kvm/./*.[ch] \ + $T/ + + for i in $(HACK_FILES); \ + do $(call hack, $$i); done + for i in $$(find $T -type f -printf '%P '); \ do cmp -s $$i $T/$$i || cp $T/$$i $$i; done rm -rf $T @@ -72,7 +84,7 @@ install: mkdir -p $(DESTDIR)/$(INSTALLDIR) cp *.ko $(DESTDIR)/$(INSTALLDIR) for i in $(ORIGMODDIR)/drivers/kvm/*.ko \ - $(ORIGMODDIR)/arch/x86/kvm/*.ko; do \ + $(ORIGMODDIR)/arch/$(ARCH_DIR)/kvm/*.ko; do \ if [ -f "$$i" ]; then mv "$$i" "$$i.orig"; fi; \ done /sbin/depmod -a |
From: Avi K. <av...@qu...> - 2008-04-28 17:01:15
|
Hollis Blanchard wrote: > This reduces host CPU usage when the guest is idle. However, the guest must > set MSR[WE] in its idle loop, which Linux did not do until 2.6.26. > > Applied, thanks. -- error compiling committee.c: too many arguments to function |
From: <ehr...@li...> - 2008-04-28 14:17:26
|
From: Christian Ehrhardt <ehr...@li...> I had today the issue of an unemulated stwx. This patch adds the emulation for it. Signed-off-by: Christian Ehrhardt <ehr...@li...> --- [diffstat] [diff] emulate.c | 7 +++++++ 1 files changed, 7 insertions(+) diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c --- a/arch/powerpc/kvm/emulate.c +++ b/arch/powerpc/kvm/emulate.c @@ -270,6 +270,13 @@ int kvmppc_emulate_instruction(struct kv case 146: /* mtmsr */ rs = get_rs(inst); kvmppc_set_msr(vcpu, vcpu->arch.gpr[rs]); + break; + + case 151: /* stwx */ + rs = get_rs(inst); + emulated = kvmppc_handle_store(run, vcpu, + vcpu->arch.gpr[rs], + 4, 1); break; case 163: /* wrteei */ |
From: Avi K. <av...@qu...> - 2008-04-27 15:15:57
|
The preliminary KVM Forum 2008 agenda at http://kforum.qumranet.com/KVMForum/agenda.php has been updated, with a few more new presentations added. Be sure to check them out. Note we still have a couple more in the pipeline. If you haven't done so already, please register! There is a big "Register Now" button on the page. Early bird registration ends May 1. Note we have a few more sessions in the pipeline; the page will be updated in a few days. [Speakers: if we've misspelled your name or if you'd like to change your slot, let us know] -- Do not meddle in the internals of kernels, for they are subtle and quick to panic. |
From: Avi K. <av...@qu...> - 2008-04-27 13:00:40
|
Jerone Young wrote: > This is a relic of the big userspace refactoring, but today libkvm does should not include settings from the test suite. This patch resolves this and removes the overwriting of setting from the main config.mak with test suite settings. > > applied, thanks. -- error compiling committee.c: too many arguments to function |
From: Avi K. <av...@qu...> - 2008-04-27 09:40:50
|
Avi Kivity wrote: > I propose moving the kvm lists to vger.kernel.org, for the following > benefits: > > - better spam control > - faster service (I see significant lag with the sourceforge lists) > - no ads appended to the end of each email > > If no objections are raised, and if the vger postmasters agree, I will > mass subscribe the current subscribers so that there will be no > service interruption. > Since no objections were raised, we'll start to get this rolling. -- error compiling committee.c: too many arguments to function |
From: Hollis B. <ho...@us...> - 2008-04-25 22:56:25
|
This reduces host CPU usage when the guest is idle. However, the guest must set MSR[WE] in its idle loop, which Linux did not do until 2.6.26. Signed-off-by: Hollis Blanchard <ho...@us...> Signed-off-by: Jerone Young <jy...@us...> --- Avi, this is a fairly important and simple patch, so please send this upstream for 2.6.26. Thanks! diff --git a/arch/powerpc/kvm/booke_guest.c b/arch/powerpc/kvm/booke_guest.c --- a/arch/powerpc/kvm/booke_guest.c +++ b/arch/powerpc/kvm/booke_guest.c @@ -49,6 +49,7 @@ { "inst_emu", VCPU_STAT(emulated_inst_exits) }, { "dec", VCPU_STAT(dec_exits) }, { "ext_intr", VCPU_STAT(ext_intr_exits) }, + { "halt_wakeup", VCPU_STAT(halt_wakeup) }, { NULL } }; diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c @@ -36,13 +36,12 @@ int kvm_cpu_has_interrupt(struct kvm_vcpu *v) { - /* XXX implement me */ - return 0; + return !!(v->arch.pending_exceptions); } int kvm_arch_vcpu_runnable(struct kvm_vcpu *v) { - return 1; + return !(v->arch.msr & MSR_WE); } @@ -214,6 +213,11 @@ struct kvm_vcpu *vcpu = (struct kvm_vcpu *)data; kvmppc_queue_exception(vcpu, BOOKE_INTERRUPT_DECREMENTER); + + if (waitqueue_active(&vcpu->wq)) { + wake_up_interruptible(&vcpu->wq); + vcpu->stat.halt_wakeup++; + } } int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) @@ -339,6 +343,8 @@ int r; sigset_t sigsaved; + vcpu_load(vcpu); + if (vcpu->sigset_active) sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved); @@ -363,12 +369,20 @@ if (vcpu->sigset_active) sigprocmask(SIG_SETMASK, &sigsaved, NULL); + vcpu_put(vcpu); + return r; } int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, struct kvm_interrupt *irq) { kvmppc_queue_exception(vcpu, BOOKE_INTERRUPT_EXTERNAL); + + if (waitqueue_active(&vcpu->wq)) { + wake_up_interruptible(&vcpu->wq); + vcpu->stat.halt_wakeup++; + } + return 0; } diff --git a/include/asm-powerpc/kvm_host.h b/include/asm-powerpc/kvm_host.h --- a/include/asm-powerpc/kvm_host.h +++ b/include/asm-powerpc/kvm_host.h @@ -59,6 +59,7 @@ u32 emulated_inst_exits; u32 dec_exits; u32 ext_intr_exits; + u32 halt_wakeup; }; struct tlbe { diff --git a/include/asm-powerpc/kvm_ppc.h b/include/asm-powerpc/kvm_ppc.h --- a/include/asm-powerpc/kvm_ppc.h +++ b/include/asm-powerpc/kvm_ppc.h @@ -77,12 +77,17 @@ clear_bit(priority, &vcpu->arch.pending_exceptions); } +/* Helper function for "full" MSR writes. No need to call this if only EE is + * changing. */ static inline void kvmppc_set_msr(struct kvm_vcpu *vcpu, u32 new_msr) { if ((new_msr & MSR_PR) != (vcpu->arch.msr & MSR_PR)) kvmppc_mmu_priv_switch(vcpu, new_msr & MSR_PR); vcpu->arch.msr = new_msr; + + if (vcpu->arch.msr & MSR_WE) + kvm_vcpu_block(vcpu); } #endif /* __POWERPC_KVM_PPC_H__ */ |
From: Jerone Y. <jy...@us...> - 2008-04-25 19:25:42
|
2 files changed, 68 insertions(+), 1 deletion(-) arch/powerpc/platforms/44x/Makefile | 2 - arch/powerpc/platforms/44x/idle.c | 67 +++++++++++++++++++++++++++++++++++ This patch has been accepted upstream and will be in 2.6.26. So it will eventually need to be removed when we move to 2.6.26rc. This patch adds the ability for the CPU to go into wait state while in cpu_idle loop. This helps virtulization solutions know when the guest Linux kernel is in an idle state. There are two ways to do it. Command line options: idle=spin <-- CPU will spin By default will go into wait mode. Signed-off-by: Jerone Young <jy...@us...> diff --git a/arch/powerpc/platforms/44x/Makefile b/arch/powerpc/platforms/44x/Makefile --- a/arch/powerpc/platforms/44x/Makefile +++ b/arch/powerpc/platforms/44x/Makefile @@ -1,4 +1,4 @@ obj-$(CONFIG_44x) := misc_44x.o -obj-$(CONFIG_44x) := misc_44x.o +obj-$(CONFIG_44x) := misc_44x.o idle.o obj-$(CONFIG_EBONY) += ebony.o obj-$(CONFIG_TAISHAN) += taishan.o obj-$(CONFIG_BAMBOO) += bamboo.o diff --git a/arch/powerpc/platforms/44x/idle.c b/arch/powerpc/platforms/44x/idle.c new file mode 100644 --- /dev/null +++ b/arch/powerpc/platforms/44x/idle.c @@ -0,0 +1,67 @@ +/* + * Copyright 2008 IBM Corp. + * + * Based on arch/powerpc/platforms/pasemi/idle.c: + * Copyright (C) 2006-2007 PA Semi, Inc + * + * Added by: Jerone Young <jy...@us...> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that 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 + * + */ + +#include <linux/of.h> +#include <linux/kernel.h> +#include <asm/machdep.h> + +static int mode_spin; + +static void ppc44x_idle(void) +{ + unsigned long msr_save; + + msr_save = mfmsr(); + /* set wait state MSR */ + mtmsr(msr_save|MSR_WE|MSR_EE|MSR_CE|MSR_DE); + isync(); + /* return to initial state */ + mtmsr(msr_save); + isync(); +} + +int __init ppc44x_idle_init(void) +{ + if (!mode_spin) { + /* If we are not setting spin mode + then we set to wait mode */ + ppc_md.power_save = &ppc44x_idle; + } + + return 0; +} + +arch_initcall(ppc44x_idle_init); + +static int __init idle_param(char *p) +{ + + if (!strcmp("spin", p)) { + mode_spin = 1; + ppc_md.power_save = NULL; + } + + return 0; +} + +early_param("idle", idle_param); |
From: Jerone Y. <jy...@us...> - 2008-04-25 19:25:29
|
2 files changed, 23 insertions(+), 3 deletions(-) arch/powerpc/kvm/emulate.c | 14 ++++++++++++++ arch/powerpc/kvm/powerpc.c | 12 +++++++++--- This patch handles a guest that is in a wait state & wake up guest that end up being recheduled and go to sleep. This ensures that the guest is not allways eating up 100% cpu when it is idle. Signed-off-by: Jerone Young <jy...@us...> diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c --- a/arch/powerpc/kvm/emulate.c +++ b/arch/powerpc/kvm/emulate.c @@ -235,6 +235,13 @@ int kvmppc_emulate_instruction(struct kv case 50: /* rfi */ kvmppc_emul_rfi(vcpu); advance = 0; + + /* Handle guest vcpu that is in wait state. + * This will implicitly wake up when it is ready. + */ + if (vcpu->arch.msr & MSR_WE) { + kvm_vcpu_block(vcpu); + } break; default: @@ -265,6 +272,13 @@ int kvmppc_emulate_instruction(struct kv case 146: /* mtmsr */ rs = get_rs(inst); kvmppc_set_msr(vcpu, vcpu->arch.gpr[rs]); + + /* Handle guest vcpu that is in wait state + * This will implicitly wake up when it is ready. + */ + if (vcpu->arch.msr & MSR_WE) { + kvm_vcpu_block(vcpu); + } break; case 163: /* wrteei */ diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c @@ -36,13 +36,12 @@ gfn_t unalias_gfn(struct kvm *kvm, gfn_t int kvm_cpu_has_interrupt(struct kvm_vcpu *v) { - /* XXX implement me */ - return 0; + return !!(v->arch.pending_exceptions); } int kvm_arch_vcpu_runnable(struct kvm_vcpu *v) { - return 1; + return !(v->arch.msr & MSR_WE); } @@ -213,6 +212,9 @@ static void kvmppc_decrementer_func(unsi { struct kvm_vcpu *vcpu = (struct kvm_vcpu *)data; + if (waitqueue_active(&vcpu->wq)) + wake_up_interruptible(&vcpu->wq); + kvmppc_queue_exception(vcpu, BOOKE_INTERRUPT_DECREMENTER); } @@ -339,6 +341,8 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_v int r; sigset_t sigsaved; + vcpu_load(vcpu); + if (vcpu->sigset_active) sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved); @@ -362,6 +366,8 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_v if (vcpu->sigset_active) sigprocmask(SIG_SETMASK, &sigsaved, NULL); + + vcpu_put(vcpu); return r; } |
From: Jerone Y. <jy...@us...> - 2008-04-25 19:23:02
|
* This update consolidates patches, adds more explicit comments, and add wait check when rfi instruction is emulated. This set of patches fixes 100% CPU usage when a guest is idle on PowerPC. Idle CPU usage is now at ~15-16% CPU time. An improvment. Signed-off-by: Jeorne Young <jy...@us...> 4 files changed, 91 insertions(+), 4 deletions(-) arch/powerpc/kvm/emulate.c | 14 +++++++ arch/powerpc/kvm/powerpc.c | 12 ++++-- arch/powerpc/platforms/44x/Makefile | 2 - arch/powerpc/platforms/44x/idle.c | 67 +++++++++++++++++++++++++++++++++++ |
From: Jerone Y. <jy...@us...> - 2008-04-25 16:37:48
|
On Fri, 2008-04-25 at 09:00 -0500, Hollis Blanchard wrote: > On Friday 25 April 2008 00:56:01 Jerone Young wrote: > > This set of patches fixes 100% CPU usage when a guest is idle on PowerPC. > This time it uses common kvm functions to sleep the guest. > > Looking much better now, with just a few minor issues to correct. With these > patches applied, about how much CPU *does* an idling guest consume? With the current patch *as is* idle guest are eating about 16% CPU. Better then 100%, but more then the other patch. I'll see if by removing the vcpu_loads & vcpu_puts if that goes down. > > By the way, you don't explicitly *unset* MSR[WE]. I think this works > implicitly because of the way we deliver interrupts; could you add a comment > explaining that? Yes it is unset implicity. I can add a comment on this. > |
From: Hollis B. <ho...@us...> - 2008-04-25 14:01:07
|
On Friday 25 April 2008 00:56:01 Jerone Young wrote: > This set of patches fixes 100% CPU usage when a guest is idle on PowerPC. This time it uses common kvm functions to sleep the guest. Looking much better now, with just a few minor issues to correct. With these patches applied, about how much CPU *does* an idling guest consume? By the way, you don't explicitly *unset* MSR[WE]. I think this works implicitly because of the way we deliver interrupts; could you add a comment explaining that? -- Hollis Blanchard IBM Linux Technology Center |
From: Hollis B. <ho...@us...> - 2008-04-25 13:57:20
|
On Friday 25 April 2008 00:56:04 Jerone Young wrote: > diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c > --- a/arch/powerpc/kvm/powerpc.c > +++ b/arch/powerpc/kvm/powerpc.c > @@ -212,6 +212,9 @@ static void kvmppc_decrementer_func(unsi > { > struct kvm_vcpu *vcpu = (struct kvm_vcpu *)data; > > + if (waitqueue_active(&vcpu->wq)) > + wake_up_interruptible(&vcpu->wq); > + > kvmppc_queue_exception(vcpu, BOOKE_INTERRUPT_DECREMENTER); > } Hooray! > int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, struct kvm_interrupt *irq) > { > + vcpu_load(vcpu); > kvmppc_queue_exception(vcpu, BOOKE_INTERRUPT_EXTERNAL); > + vcpu_put(vcpu); > + > return 0; > } load/put here is definitely unnecessary. That makes me question how necessary it is in other parts of this patch too. I think the (hardware) TLB is the only state we really need to worry about, because there is no other state that our guest can load into the hardware that is not handled by a regular context switch. If that's true, we should only need vcpu_load/put() on paths where we muck with the TLB behind the host's back, and that is only in the run path. -- Hollis Blanchard IBM Linux Technology Center |
From: Hollis B. <ho...@us...> - 2008-04-25 13:57:16
|
On Friday 25 April 2008 00:56:03 Jerone Young wrote: > This patch handles a guest that is in a wait state. This ensures that the guest is not allways eating up 100% cpu when it is idle. > > Signed-off-by: Jerone Young <jy...@us...> > > diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c > --- a/arch/powerpc/kvm/emulate.c > +++ b/arch/powerpc/kvm/emulate.c > @@ -265,6 +265,11 @@ int kvmppc_emulate_instruction(struct kv > case 146: /* mtmsr */ > rs = get_rs(inst); > kvmppc_set_msr(vcpu, vcpu->arch.gpr[rs]); > + > + /* handle guest vcpu that is in wait state */ > + if (vcpu->arch.msr & MSR_WE) { > + kvm_vcpu_block(vcpu); > + } > break; > > case 163: /* wrteei */ So if I apply this patch and not #3, the guest will put itself to sleep and never wake up? You need to combine patches 2 and 3. Also, for completeness, you should add the same test to the rfi emulation, which could (theoretically) also set MSR[WE]. -- Hollis Blanchard IBM Linux Technology Center |
From: Jes S. <je...@sg...> - 2008-04-25 09:18:29
|
>>>>> "Avi" == Avi Kivity <av...@qu...> writes: Avi> kvm-devel doesn't do manual moderation. If vger has the Avi> infrastructure, I don't see why you can't continue doing this on Avi> kvm-ppc-devel. Please don't do this for the kvm-ia64 list either. Avi> btw, we can probably shorten the names to kvm@ and kvm-$arch@ Avi> while we're at it. Either way works IMHO. Cheers, Jes |
From: Jerone Y. <jy...@us...> - 2008-04-25 05:58:27
|
2 files changed, 7 insertions(+), 3 deletions(-) arch/powerpc/kvm/emulate.c | 5 +++++ arch/powerpc/kvm/powerpc.c | 5 ++--- This patch handles a guest that is in a wait state. This ensures that the guest is not allways eating up 100% cpu when it is idle. Signed-off-by: Jerone Young <jy...@us...> diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c --- a/arch/powerpc/kvm/emulate.c +++ b/arch/powerpc/kvm/emulate.c @@ -265,6 +265,11 @@ int kvmppc_emulate_instruction(struct kv case 146: /* mtmsr */ rs = get_rs(inst); kvmppc_set_msr(vcpu, vcpu->arch.gpr[rs]); + + /* handle guest vcpu that is in wait state */ + if (vcpu->arch.msr & MSR_WE) { + kvm_vcpu_block(vcpu); + } break; case 163: /* wrteei */ diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c @@ -36,13 +36,12 @@ gfn_t unalias_gfn(struct kvm *kvm, gfn_t int kvm_cpu_has_interrupt(struct kvm_vcpu *v) { - /* XXX implement me */ - return 0; + return !!(v->arch.pending_exceptions); } int kvm_arch_vcpu_runnable(struct kvm_vcpu *v) { - return 1; + return !(v->arch.msr & MSR_WE); } |
From: Jerone Y. <jy...@us...> - 2008-04-25 05:58:27
|
2 files changed, 68 insertions(+), 1 deletion(-) arch/powerpc/platforms/44x/Makefile | 2 - arch/powerpc/platforms/44x/idle.c | 67 +++++++++++++++++++++++++++++++++++ This patch has been accepted upstream and will be in 2.6.26. So it will eventually need to be removed when we move to 2.6.26rc. This patch adds the ability for the CPU to go into wait state while in cpu_idle loop. This helps virtulization solutions know when the guest Linux kernel is in an idle state. There are two ways to do it. Command line options: idle=spin <-- CPU will spin By default will go into wait mode. Signed-off-by: Jerone Young <jy...@us...> diff --git a/arch/powerpc/platforms/44x/Makefile b/arch/powerpc/platforms/44x/Makefile --- a/arch/powerpc/platforms/44x/Makefile +++ b/arch/powerpc/platforms/44x/Makefile @@ -1,4 +1,4 @@ obj-$(CONFIG_44x) := misc_44x.o -obj-$(CONFIG_44x) := misc_44x.o +obj-$(CONFIG_44x) := misc_44x.o idle.o obj-$(CONFIG_EBONY) += ebony.o obj-$(CONFIG_TAISHAN) += taishan.o obj-$(CONFIG_BAMBOO) += bamboo.o diff --git a/arch/powerpc/platforms/44x/idle.c b/arch/powerpc/platforms/44x/idle.c new file mode 100644 --- /dev/null +++ b/arch/powerpc/platforms/44x/idle.c @@ -0,0 +1,67 @@ +/* + * Copyright 2008 IBM Corp. + * + * Based on arch/powerpc/platforms/pasemi/idle.c: + * Copyright (C) 2006-2007 PA Semi, Inc + * + * Added by: Jerone Young <jy...@us...> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that 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 + * + */ + +#include <linux/of.h> +#include <linux/kernel.h> +#include <asm/machdep.h> + +static int mode_spin; + +static void ppc44x_idle(void) +{ + unsigned long msr_save; + + msr_save = mfmsr(); + /* set wait state MSR */ + mtmsr(msr_save|MSR_WE|MSR_EE|MSR_CE|MSR_DE); + isync(); + /* return to initial state */ + mtmsr(msr_save); + isync(); +} + +int __init ppc44x_idle_init(void) +{ + if (!mode_spin) { + /* If we are not setting spin mode + then we set to wait mode */ + ppc_md.power_save = &ppc44x_idle; + } + + return 0; +} + +arch_initcall(ppc44x_idle_init); + +static int __init idle_param(char *p) +{ + + if (!strcmp("spin", p)) { + mode_spin = 1; + ppc_md.power_save = NULL; + } + + return 0; +} + +early_param("idle", idle_param); |