Re: [Xen-devel] [PATCH v5 2/7] x86: introduce a new set of APIs to manage Xen page tables

2020-01-27 Thread Wei Liu
On Mon, Jan 27, 2020 at 03:43:12PM +0100, Jan Beulich wrote: > On 27.01.2020 15:33, Xia, Hongyan wrote: > > On Thu, 2020-01-16 at 13:04 +0100, Jan Beulich wrote: > >> ... > >> > >>> +void free_xen_pagetable(void *v) > >>> +{ > >>> +mfn_t mfn = v ? virt_to_mfn(v) : INVALID_MFN; > >>> + > >>> +

Re: [Xen-devel] [PATCH v5 2/7] x86: introduce a new set of APIs to manage Xen page tables

2020-01-27 Thread Wei Liu
On Thu, Jan 16, 2020 at 01:04:16PM +0100, Jan Beulich wrote: [...] > > +/* v can point to an entry within a table or be NULL */ > > +void unmap_xen_pagetable(const void *v) > > Why "entry" in the comment? IIRC there would be cases that umap_xen_pagetable would be called with a pointer to a PTE.

Re: [Xen-devel] [PATCH v5 2/7] x86: introduce a new set of APIs to manage Xen page tables

2020-01-27 Thread George Dunlap
On 1/27/20 3:07 PM, Xia, Hongyan wrote: > On Mon, 2020-01-27 at 15:43 +0100, Jan Beulich wrote: >> On 27.01.2020 15:33, Xia, Hongyan wrote: >>> ... >>> >>> Reflecting back to your comment in v3 about whether the new Xen >>> page >>> table mapping APIs (map/unmap_xen_pagetable) are really

Re: [Xen-devel] [PATCH v5 2/7] x86: introduce a new set of APIs to manage Xen page tables

2020-01-27 Thread Xia, Hongyan
On Mon, 2020-01-27 at 15:43 +0100, Jan Beulich wrote: > On 27.01.2020 15:33, Xia, Hongyan wrote: > > ... > > > > Reflecting back to your comment in v3 about whether the new Xen > > page > > table mapping APIs (map/unmap_xen_pagetable) are really necessary, > > I > > agree in the end they will

Re: [Xen-devel] [PATCH v5 2/7] x86: introduce a new set of APIs to manage Xen page tables

2020-01-27 Thread Jan Beulich
On 27.01.2020 15:33, Xia, Hongyan wrote: > On Thu, 2020-01-16 at 13:04 +0100, Jan Beulich wrote: >> ... >> >>> +void free_xen_pagetable(void *v) >>> +{ >>> +mfn_t mfn = v ? virt_to_mfn(v) : INVALID_MFN; >>> + >>> +if ( system_state != SYS_STATE_early_boot ) >>> +

Re: [Xen-devel] [PATCH v5 2/7] x86: introduce a new set of APIs to manage Xen page tables

2020-01-27 Thread Xia, Hongyan
On Thu, 2020-01-16 at 13:04 +0100, Jan Beulich wrote: > ... > > > +void free_xen_pagetable(void *v) > > +{ > > +mfn_t mfn = v ? virt_to_mfn(v) : INVALID_MFN; > > + > > +if ( system_state != SYS_STATE_early_boot ) > > +free_xen_pagetable_new(mfn); > > The condition is (partly)

Re: [Xen-devel] [PATCH v5 2/7] x86: introduce a new set of APIs to manage Xen page tables

2020-01-16 Thread Jan Beulich
On 07.01.2020 13:06, Hongyan Xia wrote: > @@ -4992,22 +4993,55 @@ int mmcfg_intercept_write( > } > > void *alloc_xen_pagetable(void) > +{ > +mfn_t mfn = alloc_xen_pagetable_new(); > + > +return mfn_eq(mfn, INVALID_MFN) ? NULL : mfn_to_virt(mfn_x(mfn)); > +} Isn't it more dangerous to

[Xen-devel] [PATCH v5 2/7] x86: introduce a new set of APIs to manage Xen page tables

2020-01-07 Thread Hongyan Xia
From: Wei Liu We are going to switch to using domheap page for page tables. A new set of APIs is introduced to allocate, map, unmap and free pages for page tables. The allocation and deallocation work on mfn_t but not page_info, because they are required to work even before frame table is set