Re: [Xen-devel] [PATCH v9 3/5] xen/mem_sharing: VM forking

2020-02-25 Thread Tamas K Lengyel
> > Note also that during a restore the guest is aware of such process, > > and will know that it needs to re-register some stuff, but that's not > > the case when forking, since the guest is not aware you need to make > > sure everything is in place. There are also the grant table pages, > >

Re: [Xen-devel] [PATCH v9 3/5] xen/mem_sharing: VM forking

2020-02-25 Thread Tamas K Lengyel
On Tue, Feb 25, 2020 at 6:28 AM Jan Beulich wrote: > > On 24.02.2020 13:39, Roger Pau Monné wrote: > > On Fri, Feb 21, 2020 at 10:49:21AM -0800, Tamas K Lengyel wrote: > >> +static int mem_sharing_fork(struct domain *d, struct domain *cd) > >> +{ > >> +int rc = -EINVAL; > >> + > >> +if (

Re: [Xen-devel] [PATCH v9 3/5] xen/mem_sharing: VM forking

2020-02-25 Thread Jan Beulich
On 24.02.2020 16:45, Tamas K Lengyel wrote: > On Mon, Feb 24, 2020 at 5:39 AM Roger Pau Monné wrote: >> On Fri, Feb 21, 2020 at 10:49:21AM -0800, Tamas K Lengyel wrote: >>> --- a/xen/arch/x86/mm/p2m.c >>> +++ b/xen/arch/x86/mm/p2m.c >>> @@ -509,6 +509,14 @@ mfn_t __get_gfn_type_access(struct

Re: [Xen-devel] [PATCH v9 3/5] xen/mem_sharing: VM forking

2020-02-25 Thread Jan Beulich
On 24.02.2020 13:39, Roger Pau Monné wrote: > On Fri, Feb 21, 2020 at 10:49:21AM -0800, Tamas K Lengyel wrote: >> +static int mem_sharing_fork(struct domain *d, struct domain *cd) >> +{ >> +int rc = -EINVAL; >> + >> +if ( !cd->controller_pause_count ) >> +return rc; > > -EBUSY

Re: [Xen-devel] [PATCH v9 3/5] xen/mem_sharing: VM forking

2020-02-25 Thread Tamas K Lengyel
On Tue, Feb 25, 2020 at 5:06 AM Roger Pau Monné wrote: > > On Tue, Feb 25, 2020 at 04:43:30AM -0700, Tamas K Lengyel wrote: > > On Tue, Feb 25, 2020 at 3:05 AM Roger Pau Monné > > wrote: > > > > > > On Fri, Feb 21, 2020 at 10:49:21AM -0800, Tamas K Lengyel wrote: > > > > VM forking is the

Re: [Xen-devel] [PATCH v9 3/5] xen/mem_sharing: VM forking

2020-02-25 Thread Roger Pau Monné
On Tue, Feb 25, 2020 at 04:43:30AM -0700, Tamas K Lengyel wrote: > On Tue, Feb 25, 2020 at 3:05 AM Roger Pau Monné wrote: > > > > On Fri, Feb 21, 2020 at 10:49:21AM -0800, Tamas K Lengyel wrote: > > > VM forking is the process of creating a domain with an empty memory space > > > and a > > >

Re: [Xen-devel] [PATCH v9 3/5] xen/mem_sharing: VM forking

2020-02-25 Thread Tamas K Lengyel
On Tue, Feb 25, 2020 at 3:05 AM Roger Pau Monné wrote: > > On Fri, Feb 21, 2020 at 10:49:21AM -0800, Tamas K Lengyel wrote: > > VM forking is the process of creating a domain with an empty memory space > > and a > > parent domain specified from which to populate the memory when necessary. > >

Re: [Xen-devel] [PATCH v9 3/5] xen/mem_sharing: VM forking

2020-02-25 Thread Roger Pau Monné
On Fri, Feb 21, 2020 at 10:49:21AM -0800, Tamas K Lengyel wrote: > VM forking is the process of creating a domain with an empty memory space and > a > parent domain specified from which to populate the memory when necessary. For > the new domain to be functional the VM state is copied over as

Re: [Xen-devel] [PATCH v9 3/5] xen/mem_sharing: VM forking

2020-02-25 Thread Roger Pau Monné
On Mon, Feb 24, 2020 at 03:26:05PM -0700, Tamas K Lengyel wrote: > > > Also cd and d and not very helpful names, I would just use child and > > > parent. > > > > Sure. > > Looking at this in the context of the whole pre-existing code-base, > the names cd & d are used throughout mem_sharing. So

Re: [Xen-devel] [PATCH v9 3/5] xen/mem_sharing: VM forking

2020-02-25 Thread Roger Pau Monné
On Mon, Feb 24, 2020 at 03:14:56PM -0700, Tamas K Lengyel wrote: > > > > +int mem_sharing_fork_page(struct domain *d, gfn_t gfn, bool unsharing) > > > > +{ > > > > +int rc = -ENOENT; > > > > +shr_handle_t handle; > > > > +struct domain *parent; > > > > > > Can you constify parent, I

Re: [Xen-devel] [PATCH v9 3/5] xen/mem_sharing: VM forking

2020-02-24 Thread Tamas K Lengyel
> > Also cd and d and not very helpful names, I would just use child and > > parent. > > Sure. Looking at this in the context of the whole pre-existing code-base, the names cd & d are used throughout mem_sharing. So for consistency I will keep it for now. Tamas

Re: [Xen-devel] [PATCH v9 3/5] xen/mem_sharing: VM forking

2020-02-24 Thread Tamas K Lengyel
> > > +int mem_sharing_fork_page(struct domain *d, gfn_t gfn, bool unsharing) > > > +{ > > > +int rc = -ENOENT; > > > +shr_handle_t handle; > > > +struct domain *parent; > > > > Can you constify parent, I assume there are no changes made to the > > parent domain, just the forked one. >

Re: [Xen-devel] [PATCH v9 3/5] xen/mem_sharing: VM forking

2020-02-24 Thread Roger Pau Monné
On Mon, Feb 24, 2020 at 08:45:05AM -0700, Tamas K Lengyel wrote: > On Mon, Feb 24, 2020 at 5:39 AM Roger Pau Monné wrote: > > > > On Fri, Feb 21, 2020 at 10:49:21AM -0800, Tamas K Lengyel wrote: > > > +} > > > + > > > +/* > > > + * If it's a write access (ie. unsharing) or if adding a

Re: [Xen-devel] [PATCH v9 3/5] xen/mem_sharing: VM forking

2020-02-24 Thread Tamas K Lengyel
On Mon, Feb 24, 2020 at 5:39 AM Roger Pau Monné wrote: > > On Fri, Feb 21, 2020 at 10:49:21AM -0800, Tamas K Lengyel wrote: > > VM forking is the process of creating a domain with an empty memory space > > and a > > parent domain specified from which to populate the memory when necessary. > >

Re: [Xen-devel] [PATCH v9 3/5] xen/mem_sharing: VM forking

2020-02-24 Thread Roger Pau Monné
On Fri, Feb 21, 2020 at 10:49:21AM -0800, Tamas K Lengyel wrote: > VM forking is the process of creating a domain with an empty memory space and > a > parent domain specified from which to populate the memory when necessary. For > the new domain to be functional the VM state is copied over as

[Xen-devel] [PATCH v9 3/5] xen/mem_sharing: VM forking

2020-02-21 Thread Tamas K Lengyel
VM forking is the process of creating a domain with an empty memory space and a parent domain specified from which to populate the memory when necessary. For the new domain to be functional the VM state is copied over as part of the fork operation (HVM params, hap allocation, etc). Signed-off-by: