Re: [Xen-devel] [PATCH v5 8/9] libxc: rework of domain builder's page table handler

2015-11-19 Thread Boris Ostrovsky

On 11/19/2015 01:09 AM, Juergen Gross wrote:

On 18/11/15 17:21, Boris Ostrovsky wrote:

On 11/18/2015 11:16 AM, Wei Liu wrote:

On Wed, Nov 18, 2015 at 11:11:16AM -0500, Boris Ostrovsky wrote:

On 11/12/2015 08:43 AM, Juergen Gross wrote:

In order to prepare a p2m list outside of the initial kernel mapping
do a rework of the domain builder's page table handler. The goal is
to be able to use common helpers for page table allocation and setup
for initial kernel page tables and page tables mapping the p2m list.
This is achieved by supporting multiple mapping areas. The mapped
virtual addresses of the single areas must not overlap, while the
page tables of a new area added might already be partially present.
Especially the top level page table is existing only once, of course.

Currently restrict the number of mappings to 1 because the only mapping
now is the initial mapping created by toolstack. There should not be
behaviour change and guest visible change introduced.

Signed-off-by: Juergen Gross 
Reviewed-by: Wei Liu 

Re: [Xen-devel] [PATCH v5 8/9] libxc: rework of domain builder's page table handler

2015-11-18 Thread Wei Liu
On Wed, Nov 18, 2015 at 11:11:16AM -0500, Boris Ostrovsky wrote:
> On 11/12/2015 08:43 AM, Juergen Gross wrote:
> >In order to prepare a p2m list outside of the initial kernel mapping
> >do a rework of the domain builder's page table handler. The goal is
> >to be able to use common helpers for page table allocation and setup
> >for initial kernel page tables and page tables mapping the p2m list.
> >This is achieved by supporting multiple mapping areas. The mapped
> >virtual addresses of the single areas must not overlap, while the
> >page tables of a new area added might already be partially present.
> >Especially the top level page table is existing only once, of course.
> >
> >Currently restrict the number of mappings to 1 because the only mapping
> >now is the initial mapping created by toolstack. There should not be
> >behaviour change and guest visible change introduced.
> >
> >Signed-off-by: Juergen Gross 
> >Reviewed-by: Wei Liu  >---
> >  tools/libxc/xc_dom_x86.c | 479 
> > ---
> >  tools/libxc/xg_private.h |  39 +---
> >  2 files changed, 252 insertions(+), 266 deletions(-)
> 
> This broke PVH. I get a triple fault (somewhere in clear_page(), so the
> guest have run a little)
> 

Is there any output? We just noticed 32 bit pvgrub is broken. Not sure
these two problems are related but the more information the better.

Wei.

> -boris
> 
> 
> 

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v5 8/9] libxc: rework of domain builder's page table handler

2015-11-18 Thread Boris Ostrovsky

On 11/18/2015 11:16 AM, Wei Liu wrote:

On Wed, Nov 18, 2015 at 11:11:16AM -0500, Boris Ostrovsky wrote:

On 11/12/2015 08:43 AM, Juergen Gross wrote:

In order to prepare a p2m list outside of the initial kernel mapping
do a rework of the domain builder's page table handler. The goal is
to be able to use common helpers for page table allocation and setup
for initial kernel page tables and page tables mapping the p2m list.
This is achieved by supporting multiple mapping areas. The mapped
virtual addresses of the single areas must not overlap, while the
page tables of a new area added might already be partially present.
Especially the top level page table is existing only once, of course.

Currently restrict the number of mappings to 1 because the only mapping
now is the initial mapping created by toolstack. There should not be
behaviour change and guest visible change introduced.

Signed-off-by: Juergen Gross 
Reviewed-by: Wei Liu 

Re: [Xen-devel] [PATCH v5 8/9] libxc: rework of domain builder's page table handler

2015-11-18 Thread Boris Ostrovsky

On 11/12/2015 08:43 AM, Juergen Gross wrote:

In order to prepare a p2m list outside of the initial kernel mapping
do a rework of the domain builder's page table handler. The goal is
to be able to use common helpers for page table allocation and setup
for initial kernel page tables and page tables mapping the p2m list.
This is achieved by supporting multiple mapping areas. The mapped
virtual addresses of the single areas must not overlap, while the
page tables of a new area added might already be partially present.
Especially the top level page table is existing only once, of course.

Currently restrict the number of mappings to 1 because the only mapping
now is the initial mapping created by toolstack. There should not be
behaviour change and guest visible change introduced.

Signed-off-by: Juergen Gross 
Reviewed-by: Wei Liu 

Re: [Xen-devel] [PATCH v5 8/9] libxc: rework of domain builder's page table handler

2015-11-18 Thread Juergen Gross
On 18/11/15 17:21, Boris Ostrovsky wrote:
> On 11/18/2015 11:16 AM, Wei Liu wrote:
>> On Wed, Nov 18, 2015 at 11:11:16AM -0500, Boris Ostrovsky wrote:
>>> On 11/12/2015 08:43 AM, Juergen Gross wrote:
 In order to prepare a p2m list outside of the initial kernel mapping
 do a rework of the domain builder's page table handler. The goal is
 to be able to use common helpers for page table allocation and setup
 for initial kernel page tables and page tables mapping the p2m list.
 This is achieved by supporting multiple mapping areas. The mapped
 virtual addresses of the single areas must not overlap, while the
 page tables of a new area added might already be partially present.
 Especially the top level page table is existing only once, of course.

 Currently restrict the number of mappings to 1 because the only mapping
 now is the initial mapping created by toolstack. There should not be
 behaviour change and guest visible change introduced.

 Signed-off-by: Juergen Gross 
 Reviewed-by: Wei Liu >> This broke PVH. I get a triple fault (somewhere in clear_page(), so the
>>> guest have run a little)
>>>
>> Is there any output? We just noticed 32 bit pvgrub is broken. Not sure
>> these two problems are related but the more information the better.
> 
> 
> Not much:
> 
> (d3) mapping kernel into physical memory
> (XEN) d3v0 Triple fault - invoking HVM shutdown action 0
> 
> I then looked at RIP and it was pointing to 'mov%rax,(%rdi)' in
> clear_page_orig(). I didn't check what %rdi was.

I think I've found the bug. I dropped the special case for pvh to
map page tables writable. Can you try the attached patch, please?


Juergen

diff --git a/tools/libxc/xc_dom_x86.c b/tools/libxc/xc_dom_x86.c
index 7279fa2..d529518 100644
--- a/tools/libxc/xc_dom_x86.c
+++ b/tools/libxc/xc_dom_x86.c
@@ -380,7 +380,7 @@ static x86_pgentry_t get_pg_prot_x86(struct xc_dom_image *dom, int l,
 map = domx86->maps + m;
 pfn_s = map->lvls[domx86->params->levels - 1].pfn;
 pfn_e = map->area.pgtables + pfn_s;
-if ( pfn >= pfn_s && pfn < pfn_e )
+if ( !dom->pvh_enabled && pfn >= pfn_s && pfn < pfn_e )
 return prot & ~_PAGE_RW;
 }
 
___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v5 8/9] libxc: rework of domain builder's page table handler

2015-11-16 Thread Juergen Gross
On 16/11/15 14:40, Ian Campbell wrote:
> On Thu, 2015-11-12 at 14:48 +0100, Juergen Gross wrote:
>> On 12/11/15 14:47, Wei Liu wrote:
>>> On Thu, Nov 12, 2015 at 02:43:35PM +0100, Juergen Gross wrote:
 In order to prepare a p2m list outside of the initial kernel mapping
 do a rework of the domain builder's page table handler. The goal is
 to be able to use common helpers for page table allocation and setup
 for initial kernel page tables and page tables mapping the p2m list.
 This is achieved by supporting multiple mapping areas. The mapped
 virtual addresses of the single areas must not overlap, while the
 page tables of a new area added might already be partially present.
 Especially the top level page table is existing only once, of course.

 Currently restrict the number of mappings to 1 because the only
 mapping
 now is the initial mapping created by toolstack. There should not be
 behaviour change and guest visible change introduced.

 Signed-off-by: Juergen Gross 
 Reviewed-by: Wei Liu >>
>>> Missing closing ">". :-)
>>
>> Uuh, mouse buffer underrun, I guess ;-)
>>
>>>
>>> I don't think you need to resend though.
>>
>> Thanks,
> 
> I fixed while I was applying the whole series.

Thanks,


Juergen


___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v5 8/9] libxc: rework of domain builder's page table handler

2015-11-16 Thread Ian Campbell
On Thu, 2015-11-12 at 14:48 +0100, Juergen Gross wrote:
> On 12/11/15 14:47, Wei Liu wrote:
> > On Thu, Nov 12, 2015 at 02:43:35PM +0100, Juergen Gross wrote:
> > > In order to prepare a p2m list outside of the initial kernel mapping
> > > do a rework of the domain builder's page table handler. The goal is
> > > to be able to use common helpers for page table allocation and setup
> > > for initial kernel page tables and page tables mapping the p2m list.
> > > This is achieved by supporting multiple mapping areas. The mapped
> > > virtual addresses of the single areas must not overlap, while the
> > > page tables of a new area added might already be partially present.
> > > Especially the top level page table is existing only once, of course.
> > > 
> > > Currently restrict the number of mappings to 1 because the only
> > > mapping
> > > now is the initial mapping created by toolstack. There should not be
> > > behaviour change and guest visible change introduced.
> > > 
> > > Signed-off-by: Juergen Gross 
> > > Reviewed-by: Wei Liu  > 
> > Missing closing ">". :-)
> 
> Uuh, mouse buffer underrun, I guess ;-)
> 
> > 
> > I don't think you need to resend though.
> 
> Thanks,

I fixed while I was applying the whole series.

Ian.


___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v5 8/9] libxc: rework of domain builder's page table handler

2015-11-12 Thread Wei Liu
On Thu, Nov 12, 2015 at 02:43:35PM +0100, Juergen Gross wrote:
> In order to prepare a p2m list outside of the initial kernel mapping
> do a rework of the domain builder's page table handler. The goal is
> to be able to use common helpers for page table allocation and setup
> for initial kernel page tables and page tables mapping the p2m list.
> This is achieved by supporting multiple mapping areas. The mapped
> virtual addresses of the single areas must not overlap, while the
> page tables of a new area added might already be partially present.
> Especially the top level page table is existing only once, of course.
> 
> Currently restrict the number of mappings to 1 because the only mapping
> now is the initial mapping created by toolstack. There should not be
> behaviour change and guest visible change introduced.
> 
> Signed-off-by: Juergen Gross 
> Reviewed-by: Wei Liu ". :-)

I don't think you need to resend though.

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v5 8/9] libxc: rework of domain builder's page table handler

2015-11-12 Thread Juergen Gross
On 12/11/15 14:47, Wei Liu wrote:
> On Thu, Nov 12, 2015 at 02:43:35PM +0100, Juergen Gross wrote:
>> In order to prepare a p2m list outside of the initial kernel mapping
>> do a rework of the domain builder's page table handler. The goal is
>> to be able to use common helpers for page table allocation and setup
>> for initial kernel page tables and page tables mapping the p2m list.
>> This is achieved by supporting multiple mapping areas. The mapped
>> virtual addresses of the single areas must not overlap, while the
>> page tables of a new area added might already be partially present.
>> Especially the top level page table is existing only once, of course.
>>
>> Currently restrict the number of mappings to 1 because the only mapping
>> now is the initial mapping created by toolstack. There should not be
>> behaviour change and guest visible change introduced.
>>
>> Signed-off-by: Juergen Gross 
>> Reviewed-by: Wei Liu  
> Missing closing ">". :-)

Uuh, mouse buffer underrun, I guess ;-)

> 
> I don't think you need to resend though.

Thanks,


Juergen


___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel