xen-devel
[Xen-devel] Re: [PATCH 2/4] x86,xen: introduce x86_init.mapping.pagetabl
To: |
"H. Peter Anvin" <hpa@xxxxxxxxxxxxxxx> |
Subject: |
[Xen-devel] Re: [PATCH 2/4] x86,xen: introduce x86_init.mapping.pagetable_reserve |
From: |
Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx> |
Date: |
Thu, 14 Apr 2011 12:05:42 +0100 |
Cc: |
"jeremy@xxxxxxxx" <jeremy@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, "konrad.wilk@xxxxxxxxxx" <konrad.wilk@xxxxxxxxxx>, Stefano Stabellini <Stefano.Stabellini@xxxxxxxxxxxxx>, "linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>, "H. Peter Anvin" <hpa@xxxxxxxxx>, "mingo@xxxxxxx" <mingo@xxxxxxx>, Yinghai Lu <yinghai@xxxxxxxxxx> |
Delivery-date: |
Thu, 14 Apr 2011 04:06:47 -0700 |
Envelope-to: |
www-data@xxxxxxxxxxxxxxxxxxx |
In-reply-to: |
<4DA5EB46.6090302@xxxxxxxxxxxxxxx> |
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: |
<alpine.DEB.2.00.1104121149280.22672@kaball-desktop> <1302607192-21355-2-git-send-email-stefano.stabellini@xxxxxxxxxxxxx> <4DA48EA9.70109@xxxxxxxxxx> <alpine.DEB.2.00.1104131125080.22672@kaball-desktop> <4DA5EB46.6090302@xxxxxxxxxxxxxxx> |
Sender: |
xen-devel-bounces@xxxxxxxxxxxxxxxxxxx |
User-agent: |
Alpine 2.00 (DEB 1167 2008-08-23) |
On Wed, 13 Apr 2011, H. Peter Anvin wrote:
> On 04/13/2011 03:35 AM, Stefano Stabellini wrote:
> > Yes, that would be ideal, but we cannot do that because we don't know
> > exactly where is pgt_buf_end before allocating the pagetable pages and
> > the pagetable pages need to be marked RO before being hooked into the
> > pagetable. This is why we mark the whole range RO and after the
> > pagetable allocation when we know for sure where is pgt_buf_end we
> > modify the range pgt_buf_end-pgt_buf_top to RW.
>
> The hell? You have to fill the pages before you hook them into the page
> tables anyway (this means writing!) and then you have to mark them RO as
> you add them to the page tables... anything else doesn't make any sense
> at all.
Right.
The problem is that at some point init_memory_mapping is going reach the
pagetable pages area and map those pages too (I don't mean hooking the
pagetable pages in the pagetable, I mean mapping them as normal memory
that falls in the range of addresses passed to init_memory_mapping as
argument).
Some of those pages are already pagetable pages (they are in the range
pgt_buf_start-pgt_buf_end) therefore they are going to be mapped RO and
everything is fine.
Some of these pages are not pagetable pages yet (they fall in the range
pgt_buf_end-pgt_buf_top; for example the page at pgt_buf_end) so they
are going to be mapped RW. When these pages become pagetable pages and
are hooked into the pagetable, xen will find that the guest has already
a RW mapping of them somewhere and fail the operation.
In order to fix the issue I could mark all the pages in the entire range
pgt_buf_start-pgt_buf_top as RO, but then once the pagetable allocation
is completed only the range pgt_buf_start-pgt_buf_end is reserved by
init_memory_mapping therefore the kernel is going to crash as soon as
one of the pages in the range pgt_buf_end-pgt_buf_top is reused.
Initially I suggested to add two hooks: one to allocate the pagetable
pages memory and one to reserve the pagetable pages memory after the
allocation:
http://marc.info/?l=linux-kernel&m=130141955626268
Following Yinghai's suggestion I removed the first hook (currently
unnecessary because we would use the same implementation on native and
on xen) and modified the second one, that became
x86_init.mapping.pagetable_reserve.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
<Prev in Thread] |
Current Thread |
[Next in Thread>
|
- [Xen-devel] Re: [PATCH 3/4] xen: more debugging in the e820 parsing, (continued)
[Xen-devel] [PATCH 2/4] x86, xen: introduce x86_init.mapping.pagetable_reserve, stefano . stabellini
[Xen-devel] Re: [PATCH 2/4] x86,xen: introduce x86_init.mapping.pagetable_reserve, Konrad Rzeszutek Wilk
[Xen-devel] Re: [PATCH 2/4] x86, xen: introduce x86_init.mapping.pagetable_reserve, H. Peter Anvin
[Xen-devel] Re: [PATCH 2/4] x86,xen: introduce x86_init.mapping.pagetable_reserve, Konrad Rzeszutek Wilk
[Xen-devel] Re: [PATCH 2/4] x86, xen: introduce x86_init.mapping.pagetable_reserve, H. Peter Anvin
- [Xen-devel] Re: [PATCH 2/4] x86,xen: introduce x86_init.mapping.pagetable_reserve, Stefano Stabellini
- [Xen-devel] Re: [PATCH 2/4] x86,xen: introduce x86_init.mapping.pagetable_reserve, Stefano Stabellini
- [Xen-devel] Re: [PATCH 2/4] x86, xen: introduce x86_init.mapping.pagetable_reserve, H. Peter Anvin
- [Xen-devel] Re: [PATCH 2/4] x86,xen: introduce x86_init.mapping.pagetable_reserve, Stefano Stabellini
- [Xen-devel] Re: [PATCH 2/4] x86,xen: introduce x86_init.mapping.pagetable_reserve, Stefano Stabellini
- [Xen-devel] Re: [PATCH 2/4] x86, xen: introduce x86_init.mapping.pagetable_reserve, H. Peter Anvin
|
|
|