[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v4 15/18] xen/mem_sharing: VM forking
On Thu, Jan 9, 2020 at 3:29 AM Julien Grall <julien@xxxxxxx> wrote: > > Hi Tamas, > > On 08/01/2020 17:14, Tamas K Lengyel wrote: > > +static int mem_sharing_fork(struct domain *d, struct domain *cd) > > +{ > > + int rc; > > + > > + if ( !d->controller_pause_count && > > + (rc = domain_pause_by_systemcontroller(d)) ) > > AFAIU, the parent domain will be paused if it wasn't paused before and > this will not be unpaused by the same hypercall. Right? Yes, it needs to remain paused as long as there are forks active from it. Afterwards it can be unpaused. > > If so, this brings two questions: > - What would happen if the toolstack decide to unpause the domain? The forks eventually would end up misbehaving since the memory they haven't touched yet would start changing underneath their feat. If they never use those pages, then they are safe. If they are, and they expect them to be in the same state when they were created, it will lead to issues. Depends really on what is running in the fork. > - How does the caller knows whether this was paused by the > hypercall or not? Well, if they paused the VM before then the hypercall doesn't pause it again. If it wasn't paused, it will be now. > > I would also suggest to document the behavior of the hypercall as this > is not entirely obvious that the domain will be paused here. Sure. > > > + return rc; > > + > > + cd->max_pages = d->max_pages; > > + cd->max_vcpus = d->max_vcpus; > > + > > + /* this is preemptible so it's the first to get done */ > > + if ( (rc = fork_hap_allocation(d, cd)) ) > > + return rc; > > + > > + if ( (rc = bring_up_vcpus(cd, d->cpupool)) ) > > + return rc; > > + > > + if ( (rc = hvm_copy_context_and_params(d, cd)) ) > > + return rc; > > + > > + fork_tsc(d, cd); > > + > > + cd->parent = d; > > How do you ensure that the parent domain will not get destroyed before > the forked domain? Do you have a refcount somewhere? We don't. At this point we expect the user to keep the parent VM alive but paused. Is there such a thing as a domain refcount we could use for this? Tamas _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |