Patchwork [21/26] KVM: PPC: Force enable nap on KVM

login
register
mail settings
Submitter Alexander Graf
Date Aug. 17, 2010, 1:57 p.m.
Message ID <1282053481-18787-22-git-send-email-agraf@suse.de>
Download mbox | patch
Permalink /patch/61913/
State Not Applicable
Headers show

Comments

Alexander Graf - Aug. 17, 2010, 1:57 p.m.
There are some heuristics in the PPC power management code that try to find
out if the particular hardware we're running on supports proper power management
or just hangs the machine when going into nap mode.

Since we know that KVM is safe with nap, let's force enable it in the PV code
once we're certain that we are on a KVM VM.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/powerpc/kernel/kvm.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Scott Wood - Aug. 17, 2010, 6:28 p.m.
On Tue, 17 Aug 2010 15:57:56 +0200
Alexander Graf <agraf@suse.de> wrote:

> There are some heuristics in the PPC power management code that try to find
> out if the particular hardware we're running on supports proper power management
> or just hangs the machine when going into nap mode.
> 
> Since we know that KVM is safe with nap, let's force enable it in the PV code
> once we're certain that we are on a KVM VM.

Could this cause the cache to be flushed unnecessarily on e500?  Where
available, doze would probably be better for signalling the hypervisor
that the guest is idle.

> 
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
>  arch/powerpc/kernel/kvm.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c
> index 517da39..95aed6b 100644
> --- a/arch/powerpc/kernel/kvm.c
> +++ b/arch/powerpc/kernel/kvm.c
> @@ -583,6 +583,9 @@ static int __init kvm_guest_init(void)
>  	if (kvm_para_has_feature(KVM_FEATURE_MAGIC_PAGE))
>  		kvm_use_magic_page();
>  
> +	/* Enable napping */
> +	powersave_nap = 1;
> +
>  free_tmp:
>  	kvm_free_tmp();
>
Alexander Graf - Aug. 17, 2010, 8:07 p.m.
On 17.08.2010, at 20:28, Scott Wood wrote:

> On Tue, 17 Aug 2010 15:57:56 +0200
> Alexander Graf <agraf@suse.de> wrote:
> 
>> There are some heuristics in the PPC power management code that try to find
>> out if the particular hardware we're running on supports proper power management
>> or just hangs the machine when going into nap mode.
>> 
>> Since we know that KVM is safe with nap, let's force enable it in the PV code
>> once we're certain that we are on a KVM VM.
> 
> Could this cause the cache to be flushed unnecessarily on e500?  Where
> available, doze would probably be better for signalling the hypervisor
> that the guest is idle.

You're right - this should be #ifdef'ed on Book3s. I'll add that as a patch on top, as Qemu on BookE doesn't expose KVM capabilities yet.


Alex

Patch

diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c
index 517da39..95aed6b 100644
--- a/arch/powerpc/kernel/kvm.c
+++ b/arch/powerpc/kernel/kvm.c
@@ -583,6 +583,9 @@  static int __init kvm_guest_init(void)
 	if (kvm_para_has_feature(KVM_FEATURE_MAGIC_PAGE))
 		kvm_use_magic_page();
 
+	/* Enable napping */
+	powersave_nap = 1;
+
 free_tmp:
 	kvm_free_tmp();