lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4FC36E85.4010909@redhat.com>
Date:	Mon, 28 May 2012 15:24:37 +0300
From:	Avi Kivity <avi@...hat.com>
To:	Xiao Guangrong <xiaoguangrong@...ux.vnet.ibm.com>
CC:	Marcelo Tosatti <mtosatti@...hat.com>,
	LKML <linux-kernel@...r.kernel.org>, KVM <kvm@...r.kernel.org>,
	Andrea Arcangeli <aarcange@...hat.com>
Subject: Re: [PATCH] KVM: MMU: fix huge page adapted on non-PAE host

On 05/28/2012 02:39 PM, Xiao Guangrong wrote:
> On 05/28/2012 06:57 PM, Avi Kivity wrote:
> 
>> On 05/28/2012 09:10 AM, Xiao Guangrong wrote:
>>> The huge page size is 4M on non-PAE host, but 2M page size is used in
>>> transparent_hugepage_adjust(), so the page we get after adjust the
>>> mapping level is not the head page, the BUG_ON() will be triggered
>>>
>>>
>>> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
>>> index 72102e0..be3cea4 100644
>>> --- a/arch/x86/kvm/mmu.c
>>> +++ b/arch/x86/kvm/mmu.c
>>> @@ -2595,8 +2595,7 @@ static void transparent_hugepage_adjust(struct kvm_vcpu *vcpu,
>>>  			*gfnp = gfn;
>>>  			kvm_release_pfn_clean(pfn);
>>>  			pfn &= ~mask;
>>> -			if (!get_page_unless_zero(pfn_to_page(pfn)))
>>> -				BUG();
>>> +			kvm_get_pfn(pfn);
>>>  			*pfnp = pfn;
>>>  		}
>>>  	}
>> 
>> Shouldn't we adjust mask instead?
>> 
> 
> 
> Adjusting mask to map the whole 4M huge page to KVM guest?

The code moves the refcount from the small page to the huge page.  i.e.
from pfn 0x1312 to pfn 0x1200.  But if the huge page frame contains
0x400 pages, it should move the refcount to pfn 0x1000.

> But it seams 4M page size is not supported on VMX/SVM.

We always use 64-bit PTEs in the lowest level, whether using shadow,
EPT, or NPT.  Note NPT supports 32-bit PTEs in the lowest level, but we
don't support that configuration.  But that doesn't mean we can't use
host 4M pages to back guest 2M pages (or direct maps).

-- 
error compiling committee.c: too many arguments to function
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ