WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [Linux PATCH] Fix to hugepages to work around new PWT ha

To: Dave McCracken <dcm@xxxxxxxx>
Subject: Re: [Xen-devel] [Linux PATCH] Fix to hugepages to work around new PWT handling
From: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Date: Wed, 09 Jun 2010 11:21:45 -0700
Cc: Xen Developers List <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 09 Jun 2010 11:22:44 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20100609140252.18351.48175.sendpatchset@xxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20100609140252.18351.48175.sendpatchset@xxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-2.fc12 Lightning/1.0b2pre Thunderbird/3.0.4
On 06/09/2010 07:02 AM, Dave McCracken wrote:
> Recent changes to Linux include code to set new flags in the pte,
> including _PAGE_PAT and _PAGE_PWT.  That change conflicts with hugepage
> using the pte macros to set up its pmd entries.  This patch resolves
> that problem.
>   

Could you explain this a bit more clearly?  Why is using __pmd not
working in this case?  Is it because the kernel is now setting PAT and
PWT on huge pages?  But PAT isn't even the same flag for huge pages...

> An additional fix here is to make sure the _PAGE_PRESENT bit is set
> before hugepages does a mk_pte(), since Xen depends on that bit to
> trigger the pfn->mfn translation.
>   

Why is the kernel creating a non-present mapping?  If it isn't present,
why does it matter whether we do the pfn->mfn conversion?

    J

> Signed-off-by: Dave McCracken <dave.mccracken@xxxxxxxxxx>
>
> --------
>
>
> --- stable-2.6.32.x//arch/x86/include/asm/hugetlb.h   2010-06-04 
> 12:19:31.000000000 -0500
> +++ 2.6.32-hfix//arch/x86/include/asm/hugetlb.h       2010-06-08 
> 12:23:53.000000000 -0500
> @@ -44,7 +44,7 @@ static inline pte_t huge_ptep_get(pte_t
>  static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
>                                  pte_t *ptep, pte_t pte)
>  {
> -     set_pmd((pmd_t *)ptep, __pmd(pte_val(pte)));
> +     set_pmd((pmd_t *)ptep, native_make_pmd(native_pte_val(pte)));
>  }
>  
>  static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
> --- stable-2.6.32.x//mm/hugetlb.c     2010-06-04 12:19:36.000000000 -0500
> +++ 2.6.32-hfix//mm/hugetlb.c 2010-06-07 07:11:34.000000000 -0500
> @@ -1732,12 +1732,14 @@ static pte_t make_huge_pte(struct vm_are
>                               int writable)
>  {
>       pte_t entry;
> +     pgprot_t pgprot;
>  
> +     pgprot = __pgprot(pgprot_val(vma->vm_page_prot) | _PAGE_PRESENT);
>       if (writable) {
>               entry =
> -                 pte_mkwrite(pte_mkdirty(mk_pte(page, vma->vm_page_prot)));
> +                 pte_mkwrite(pte_mkdirty(mk_pte(page, pgprot)));
>       } else {
> -             entry = huge_pte_wrprotect(mk_pte(page, vma->vm_page_prot));
> +             entry = huge_pte_wrprotect(mk_pte(page, pgprot));
>       }
>       entry = pte_mkyoung(entry);
>       entry = pte_mkhuge(entry);
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel
>
>   


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel