All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave McCracken <dcm@mccr.org>
To: xen-devel@lists.xensource.com
Subject: [PATCH 1/2] PV Hugetlb support - Hypervisor portion
Date: Thu, 24 Jul 2008 08:48:13 -0500	[thread overview]
Message-ID: <200807240848.13587.dcm@mccr.org> (raw)
In-Reply-To: <200807240845.08753.dcm@mccr.org>

[-- Attachment #1: Type: text/plain, Size: 69 bytes --]


Here is the hypervisor portion of hugetlb support for PV machines.


[-- Attachment #2: linux-xen-hpage-02.patch --]
[-- Type: text/x-diff, Size: 3193 bytes --]

--- linux-2.6.18-xen/./fs/Kconfig	2008-07-17 09:54:14.000000000 -0500
+++ linux-hpage/./fs/Kconfig	2008-07-23 09:31:06.000000000 -0500
@@ -870,7 +870,7 @@ config TMPFS
 config HUGETLBFS
 	bool "HugeTLB file system support"
 	depends X86 || IA64 || PPC64 || SPARC64 || SUPERH || BROKEN
-	depends on !XEN
+#	depends on !XEN
 	help
 	  hugetlbfs is a filesystem backing for HugeTLB pages, based on
 	  ramfs. For architectures that support it, say Y here and read
--- linux-2.6.18-xen/./include/asm-x86_64/mach-xen/asm/page.h	2008-07-17 09:54:18.000000000 -0500
+++ linux-hpage/./include/asm-x86_64/mach-xen/asm/page.h	2008-07-23 09:31:06.000000000 -0500
@@ -62,6 +62,8 @@
 #define HPAGE_MASK	(~(HPAGE_SIZE - 1))
 #define HUGETLB_PAGE_ORDER	(HPAGE_SHIFT - PAGE_SHIFT)
 
+#define ARCH_HAS_SETCLEAR_HUGE_PTE
+
 #ifdef __KERNEL__
 #ifndef __ASSEMBLY__
 
--- linux-2.6.18-xen/./include/asm-x86_64/mach-xen/asm/pgtable.h	2008-07-17 09:54:18.000000000 -0500
+++ linux-hpage/./include/asm-x86_64/mach-xen/asm/pgtable.h	2008-07-23 09:31:06.000000000 -0500
@@ -261,6 +261,12 @@ static inline unsigned long pud_bad(pud_
 		set_pte((ptep), (pteval));				\
 } while (0)
 
+static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pteval) {
+	if ((mm != current->mm && mm != &init_mm) ||
+	    HYPERVISOR_update_va_mapping(addr, pteval, 0))
+		set_pmd((pmd_t *)ptep, (pmd_t){__pte_val(pteval)});
+}
+
 #define pte_none(x)	(!(x).pte)
 #define pte_present(x)	((x).pte & (_PAGE_PRESENT | _PAGE_PROTNONE))
 #define pte_clear(mm,addr,xp)	do { set_pte_at(mm, addr, xp, __pte(0)); } while (0)
@@ -296,6 +302,19 @@ static inline pte_t ptep_get_and_clear(s
 	return pte;
 }
 
+static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
+{
+	pte_t pte = *ptep;
+	if (!pte_none(pte)) {
+		if ((mm != &init_mm) ||
+		    HYPERVISOR_update_va_mapping(addr, __pte(0), 0)) {
+			pte = *ptep;
+			set_pmd((pmd_t *)ptep, __pmd(0));
+		}
+	}
+	return pte;
+}
+
 static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long addr, pte_t *ptep, int full)
 {
 	if (full) {
--- linux-2.6.18-xen/./arch/x86_64/mm/pageattr-xen.c	2008-07-17 09:54:10.000000000 -0500
+++ linux-hpage/./arch/x86_64/mm/pageattr-xen.c	2008-07-23 09:31:06.000000000 -0500
@@ -62,6 +62,8 @@ static void _pin_lock(struct mm_struct *
 
 					if (pmd_none(*pmd))
 						continue;
+					if (pte_huge(*(pte_t *)pmd))
+						continue;
 					ptl = pte_lockptr(0, pmd);
 					if (lock)
 						spin_lock(ptl);
--- linux-2.6.18-xen/./mm/hugetlb.c	2008-07-17 09:54:19.000000000 -0500
+++ linux-hpage/./mm/hugetlb.c	2008-07-23 09:31:06.000000000 -0500
@@ -294,12 +294,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 = pte_wrprotect(mk_pte(page, vma->vm_page_prot));
+		entry = pte_wrprotect(mk_pte(page, pgprot));
 	}
 	entry = pte_mkyoung(entry);
 	entry = pte_mkhuge(entry);

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

  reply	other threads:[~2008-07-24 13:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-24 13:45 [PATCH 0/2] Add hugetlb support for PV Dave McCracken
2008-07-24 13:48 ` Dave McCracken [this message]
2008-07-24 13:51   ` [PATCH 1/2] PV Hugetlb support - Hypervisor portion Dave McCracken
2008-07-24 13:50 ` [PATCH 2/2] PV hugetlb support - kernel portion Dave McCracken
2008-07-24 14:23 ` [PATCH 0/2] Add hugetlb support for PV Jan Beulich
2008-07-24 14:50   ` Jeremy Fitzhardinge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200807240848.13587.dcm@mccr.org \
    --to=dcm@mccr.org \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.