Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Xen: Devel

[PATCH 1/2] XEN, X86: Improve semantic support for pagetable_reserve PVOP

 

 

Xen devel RSS feed   Index | Next | Previous | View Threaded


attilio.rao at citrix

Aug 10, 2012, 7:17 AM

Post #1 of 2 (57 views)
Permalink
[PATCH 1/2] XEN, X86: Improve semantic support for pagetable_reserve PVOP

- Allow xen_mapping_pagetable_reserve() to handle a start different from
pgt_buf_start, but still bigger than it.
- Add checks to xen_mapping_pagetable_reserve() and native_pagetable_reserve()
for verifying start and end are contained in the range
[pgt_buf_start, pgt_buf_top].
- In xen_mapping_pagetable_reserve(), change printk into pr_debug.
- In xen_mapping_pagetable_reserve(), print out diagnostic only if there is
an actual need to do that (or, in other words, if there are actually some
pages going to switch from RO to RW).

Signed-off-by: Attilio Rao <attilio.rao [at] citrix>
---
arch/x86/mm/init.c | 4 ++++
arch/x86/xen/mmu.c | 22 ++++++++++++++++++++--
2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index e0e6990..c5849b6 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -92,6 +92,10 @@ static void __init find_early_table_space(struct map_range *mr, unsigned long en

void __init native_pagetable_reserve(u64 start, u64 end)
{
+ if (start < PFN_PHYS(pgt_buf_start) || end > PFN_PHYS(pgt_buf_top))
+ panic("Invalid address range: [%llu - %llu] should be a subset of [%llu - %llu]\n"
+ start, end, PFN_PHYS(pgt_buf_start),
+ PFN_PHYS(pgt_buf_top));
memblock_reserve(start, end - start);
}

diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index b65a761..8d943e0a 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -1180,12 +1180,30 @@ static void __init xen_pagetable_setup_start(pgd_t *base)

static __init void xen_mapping_pagetable_reserve(u64 start, u64 end)
{
+ u64 sh_start;
+
+ sh_start = PFN_PHYS(pgt_buf_start);
+
+ if (start < sh_start || end > PFN_PHYS(pgt_buf_top))
+ panic("Invalid address range: [%llu - %llu] should be a subset of [%llu - %llu]\n"
+ start, end, sh_start, PFN_PHYS(pgt_buf_top));
+
+ /* set RW the initial range */
+ if (start != sh_start)
+ pr_debug("xen: setting RW the range %llx - %llx\n",
+ sh_start, start);
+ while (sh_start < start) {
+ make_lowmem_page_readwrite(__va(sh_start));
+ sh_start += PAGE_SIZE;
+ }
+
/* reserve the range used */
native_pagetable_reserve(start, end);

/* set as RW the rest */
- printk(KERN_DEBUG "xen: setting RW the range %llx - %llx\n", end,
- PFN_PHYS(pgt_buf_top));
+ if (end != PFN_PHYS(pgt_buf_top))
+ pr_debug("xen: setting RW the range %llx - %llx\n",
+ end, PFN_PHYS(pgt_buf_top));
while (end < PFN_PHYS(pgt_buf_top)) {
make_lowmem_page_readwrite(__va(end));
end += PAGE_SIZE;
--
1.7.2.5


_______________________________________________
Xen-devel mailing list
Xen-devel [at] lists
http://lists.xen.org/xen-devel


konrad.wilk at oracle

Aug 13, 2012, 1:43 PM

Post #2 of 2 (51 views)
Permalink
Re: [PATCH 1/2] XEN, X86: Improve semantic support for pagetable_reserve PVOP [In reply to]

On Fri, Aug 10, 2012 at 03:17:06PM +0100, Attilio Rao wrote:
> - Allow xen_mapping_pagetable_reserve() to handle a start different from
> pgt_buf_start, but still bigger than it.
> - Add checks to xen_mapping_pagetable_reserve() and native_pagetable_reserve()
> for verifying start and end are contained in the range
> [pgt_buf_start, pgt_buf_top].
> - In xen_mapping_pagetable_reserve(), change printk into pr_debug.
> - In xen_mapping_pagetable_reserve(), print out diagnostic only if there is
> an actual need to do that (or, in other words, if there are actually some
> pages going to switch from RO to RW).
>
> Signed-off-by: Attilio Rao <attilio.rao [at] citrix>
> ---
> arch/x86/mm/init.c | 4 ++++
> arch/x86/xen/mmu.c | 22 ++++++++++++++++++++--
> 2 files changed, 24 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
> index e0e6990..c5849b6 100644
> --- a/arch/x86/mm/init.c
> +++ b/arch/x86/mm/init.c
> @@ -92,6 +92,10 @@ static void __init find_early_table_space(struct map_range *mr, unsigned long en
>
> void __init native_pagetable_reserve(u64 start, u64 end)
> {
> + if (start < PFN_PHYS(pgt_buf_start) || end > PFN_PHYS(pgt_buf_top))
> + panic("Invalid address range: [%llu - %llu] should be a subset of [%llu - %llu]\n"
> + start, end, PFN_PHYS(pgt_buf_start),
> + PFN_PHYS(pgt_buf_top));
> memblock_reserve(start, end - start);
> }
>
> diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
> index b65a761..8d943e0a 100644
> --- a/arch/x86/xen/mmu.c
> +++ b/arch/x86/xen/mmu.c
> @@ -1180,12 +1180,30 @@ static void __init xen_pagetable_setup_start(pgd_t *base)
>
> static __init void xen_mapping_pagetable_reserve(u64 start, u64 end)
> {
> + u64 sh_start;

sh... shared? shell? Can it be just 'begin' or 'pgt_buf_start_phys' ?
Or 'start_phys' ?
Perhaps 'orig_start' ? 'early_start'? '_start'?

> +
> + sh_start = PFN_PHYS(pgt_buf_start);
> +
> + if (start < sh_start || end > PFN_PHYS(pgt_buf_top))
> + panic("Invalid address range: [%llu - %llu] should be a subset of [%llu - %llu]\n"
> + start, end, sh_start, PFN_PHYS(pgt_buf_top));
> +
> + /* set RW the initial range */
> + if (start != sh_start)
> + pr_debug("xen: setting RW the range %llx - %llx\n",
> + sh_start, start);
> + while (sh_start < start) {
> + make_lowmem_page_readwrite(__va(sh_start));
> + sh_start += PAGE_SIZE;
> + }
> +
> /* reserve the range used */
> native_pagetable_reserve(start, end);
>
> /* set as RW the rest */
> - printk(KERN_DEBUG "xen: setting RW the range %llx - %llx\n", end,
> - PFN_PHYS(pgt_buf_top));
> + if (end != PFN_PHYS(pgt_buf_top))
> + pr_debug("xen: setting RW the range %llx - %llx\n",
> + end, PFN_PHYS(pgt_buf_top));
> while (end < PFN_PHYS(pgt_buf_top)) {
> make_lowmem_page_readwrite(__va(end));
> end += PAGE_SIZE;
> --
> 1.7.2.5

_______________________________________________
Xen-devel mailing list
Xen-devel [at] lists
http://lists.xen.org/xen-devel

Xen devel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.