From: Mark McLoughlin <markmc@redhat.com>
To: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
xen-devel@lists.xensource.com,
Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>,
Mark McLoughlin <markmc@redhat.com>
Subject: [PATCH 2/3] xen: Do not pin/unpin PMD pages
Date: Wed, 2 Apr 2008 15:36:37 +0100 [thread overview]
Message-ID: <1207146998-14607-2-git-send-email-markmc@redhat.com> (raw)
In-Reply-To: <1207146998-14607-1-git-send-email-markmc@redhat.com>
During process startup, in xen_pgd_pin(), we pin PTE pages
but not PMD pages. If we then later map and unmap using an
otherwise unused PMD page, the unpin in release_pd() fails
because it wasn't previously pinned.
i.e. with this simple test case:
int fd = open("/dev/zero", O_RDONLY);
munmap(mmap((void *)0x40000000, 0x1000_LEN, PROT_READ, MAP_PRIVATE, fd, 0), 0x1000);
close(fd);
we currently get:
kernel BUG at arch/x86/xen/enlighten.c:678!
...
EIP is at xen_release_pt+0x79/0xa9
...
Call Trace:
[<c041da25>] ? __pmd_free_tlb+0x1a/0x75
[<c047a192>] ? free_pgd_range+0x1d2/0x2b5
[<c047a2f3>] ? free_pgtables+0x7e/0x93
[<c047b272>] ? unmap_region+0xb9/0xf5
[<c047c1bd>] ? do_munmap+0x193/0x1f5
[<c047c24f>] ? sys_munmap+0x30/0x3f
[<c0408cce>] ? syscall_call+0x7/0xb
=======================
and xen complains:
(XEN) mm.c:2241:d4 Mfn 1cc37 not pinned
Further details at:
https://bugzilla.redhat.com/436453
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
---
arch/x86/xen/enlighten.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 16e2f80..f16b056 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -689,8 +689,6 @@ static void xen_alloc_ptpage(struct mm_struct *mm, u32 pfn, unsigned level)
make_lowmem_page_readonly(__va(PFN_PHYS(pfn)));
if (level == PT_PTE)
pin_pagetable_pfn(MMUEXT_PIN_L1_TABLE, pfn);
- else if (level == PT_PMD)
- pin_pagetable_pfn(MMUEXT_PIN_L2_TABLE, pfn);
} else
/* make sure there are no stray mappings of
this page */
@@ -715,7 +713,8 @@ static void xen_release_ptpage(u32 pfn, unsigned level)
if (PagePinned(page)) {
if (!PageHighMem(page)) {
- pin_pagetable_pfn(MMUEXT_UNPIN_TABLE, pfn);
+ if (level == PT_PTE)
+ pin_pagetable_pfn(MMUEXT_UNPIN_TABLE, pfn);
make_lowmem_page_readwrite(__va(PFN_PHYS(pfn)));
}
}
--
1.5.4.5
WARNING: multiple messages have this Message-ID (diff)
From: Mark McLoughlin <markmc@redhat.com>
To: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Mark McLoughlin <markmc@redhat.com>,
xen-devel@lists.xensource.com, linux-kernel@vger.kernel.org,
"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@elte.hu>,
Thomas Gleixner <tglx@linutronix.de>
Subject: [PATCH 2/3] xen: Do not pin/unpin PMD pages
Date: Wed, 2 Apr 2008 15:36:37 +0100 [thread overview]
Message-ID: <1207146998-14607-2-git-send-email-markmc@redhat.com> (raw)
In-Reply-To: <1207146998-14607-1-git-send-email-markmc@redhat.com>
During process startup, in xen_pgd_pin(), we pin PTE pages
but not PMD pages. If we then later map and unmap using an
otherwise unused PMD page, the unpin in release_pd() fails
because it wasn't previously pinned.
i.e. with this simple test case:
int fd = open("/dev/zero", O_RDONLY);
munmap(mmap((void *)0x40000000, 0x1000_LEN, PROT_READ, MAP_PRIVATE, fd, 0), 0x1000);
close(fd);
we currently get:
kernel BUG at arch/x86/xen/enlighten.c:678!
...
EIP is at xen_release_pt+0x79/0xa9
...
Call Trace:
[<c041da25>] ? __pmd_free_tlb+0x1a/0x75
[<c047a192>] ? free_pgd_range+0x1d2/0x2b5
[<c047a2f3>] ? free_pgtables+0x7e/0x93
[<c047b272>] ? unmap_region+0xb9/0xf5
[<c047c1bd>] ? do_munmap+0x193/0x1f5
[<c047c24f>] ? sys_munmap+0x30/0x3f
[<c0408cce>] ? syscall_call+0x7/0xb
=======================
and xen complains:
(XEN) mm.c:2241:d4 Mfn 1cc37 not pinned
Further details at:
https://bugzilla.redhat.com/436453
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
---
arch/x86/xen/enlighten.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 16e2f80..f16b056 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -689,8 +689,6 @@ static void xen_alloc_ptpage(struct mm_struct *mm, u32 pfn, unsigned level)
make_lowmem_page_readonly(__va(PFN_PHYS(pfn)));
if (level == PT_PTE)
pin_pagetable_pfn(MMUEXT_PIN_L1_TABLE, pfn);
- else if (level == PT_PMD)
- pin_pagetable_pfn(MMUEXT_PIN_L2_TABLE, pfn);
} else
/* make sure there are no stray mappings of
this page */
@@ -715,7 +713,8 @@ static void xen_release_ptpage(u32 pfn, unsigned level)
if (PagePinned(page)) {
if (!PageHighMem(page)) {
- pin_pagetable_pfn(MMUEXT_UNPIN_TABLE, pfn);
+ if (level == PT_PTE)
+ pin_pagetable_pfn(MMUEXT_UNPIN_TABLE, pfn);
make_lowmem_page_readwrite(__va(PFN_PHYS(pfn)));
}
}
--
1.5.4.5
next prev parent reply other threads:[~2008-04-02 14:37 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-28 16:38 [PATCH 0/3] xen: Fix oops when mapping/unmapping addr above 1Gb Mark McLoughlin
2008-03-28 16:38 ` Mark McLoughlin
2008-03-28 16:38 ` [PATCH 1/3] xen: Refactor xen_{alloc,release}_{pte,pmd}() Mark McLoughlin
2008-03-28 16:38 ` [PATCH 1/3] xen: Refactor xen_{alloc, release}_{pte, pmd}() Mark McLoughlin
2008-03-28 16:38 ` [PATCH 2/3] xen: Do not pin/unpin PMD pages Mark McLoughlin
2008-03-28 16:38 ` Mark McLoughlin
2008-03-28 16:38 ` [PATCH 3/3] xen: Clear PG_pinned in release_{pte,pmd}() Mark McLoughlin
2008-03-28 16:38 ` [PATCH 3/3] xen: Clear PG_pinned in release_{pte, pmd}() Mark McLoughlin
2008-03-28 18:02 ` [PATCH 0/3] xen: Fix oops when mapping/unmapping addr above 1Gb Jeremy Fitzhardinge
2008-03-28 18:02 ` Jeremy Fitzhardinge
2008-03-31 13:14 ` Ingo Molnar
2008-03-31 14:55 ` Jeremy Fitzhardinge
2008-04-02 14:35 ` Mark McLoughlin
2008-04-02 14:35 ` Mark McLoughlin
2008-04-02 14:36 ` [PATCH 1/3] xen: Refactor xen_{alloc,release}_{pt,pd}() Mark McLoughlin
2008-04-02 14:36 ` [PATCH 1/3] xen: Refactor xen_{alloc, release}_{pt, pd}() Mark McLoughlin
2008-04-02 14:36 ` Mark McLoughlin [this message]
2008-04-02 14:36 ` [PATCH 2/3] xen: Do not pin/unpin PMD pages Mark McLoughlin
2008-04-02 14:36 ` [PATCH 3/3] xen: Clear PG_pinned in release_{pt,pd}() Mark McLoughlin
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=1207146998-14607-2-git-send-email-markmc@redhat.com \
--to=markmc@redhat.com \
--cc=hpa@zytor.com \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--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.