From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] KVM: Fix MAXPHYADDR calculation when cpuid does not support it Date: Sun, 11 Apr 2010 16:33:48 +0300 Message-ID: <4BC1CFBC.5060406@redhat.com> References: <1270989212-3117-1-git-send-email-avi@redhat.com> <4BC1CF54.4020804@cs.helsinki.fi> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , kvm@vger.kernel.org To: Pekka Enberg Return-path: Received: from mx1.redhat.com ([209.132.183.28]:56914 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751718Ab0DKNd7 (ORCPT ); Sun, 11 Apr 2010 09:33:59 -0400 In-Reply-To: <4BC1CF54.4020804@cs.helsinki.fi> Sender: kvm-owner@vger.kernel.org List-ID: On 04/11/2010 04:32 PM, Pekka Enberg wrote: > Avi Kivity wrote: >> MAXPHYADDR is derived from cpuid 0x80000008, but when that isn't >> present, we >> get some random value. >> >> Fix by checking first that cpuid 0x80000008 is supported. >> >> Pekka Enberg >> Signed-off-by: Avi Kivity >> --- >> arch/x86/kvm/x86.c | 4 ++++ >> 1 files changed, 4 insertions(+), 0 deletions(-) >> >> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c >> index fd5c3d3..b2460cd 100644 >> --- a/arch/x86/kvm/x86.c >> +++ b/arch/x86/kvm/x86.c >> @@ -4165,9 +4165,13 @@ int cpuid_maxphyaddr(struct kvm_vcpu *vcpu) >> { >> struct kvm_cpuid_entry2 *best; >> >> + best = kvm_find_cpuid_entry(vcpu, 0x80000000, 0); >> + if (!best || best->eax < 0x80000008) >> + goto not_found; >> best = kvm_find_cpuid_entry(vcpu, 0x80000008, 0); >> if (best) >> return best->eax & 0xff; >> +not_found: >> return 36; >> } >> > > Hmm, doesn't seem to work here. I still that triple fault in guest. Can you add a printk to see what value is returned and why? -- error compiling committee.c: too many arguments to function