[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/3] x86/mem_sharing: use dom_cow as placeholder parent until fork is complete


  • To: Tamas K Lengyel <tamas.lengyel@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 28 Mar 2022 15:32:07 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zf8vVRD8jN9UizjcSitGFTUmWSdhWQ/t0kP0qD48EOI=; b=huQ4iTspfgmP5jj4mZw9xdNUA+Cn2ikjlD816TBb/8MC+UZNxjRD0w6chM7Q3zdvSwAsrx+wniZEoM89WLZMLXwidkL1DxuomDIIOBSjkkoyydqk+B+zoRytfXtPASoxw61dvxaZZ2ENk4zFlD2BhW+JG9/fYokPbhK2FBgJ+cAlaJ9WdhhEN4TXDDc4FPpTestQPVmbBT3uni7o98cy7g2/FBaBhru3jtw/o1Q7ta3I7iV5eaKmQmhG7nhiDGlzL+AmTsmdoby2D8XLtysQq4SGtHpHeeBmh0ZAf7LQZknu3mqnrxgxldO5tfPk/SPEQcB1yLMFBvBroa6ffPWJQQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f6+075y1ZQaWtBoVLsT5SAfbmiECMqIT4UbcXx560WZhKwPyC0ik0FCQENOOPK97ty0/tD1R8fytNfGrKvz3Lbw21G+0Nm1PewD1k5BydqJ/aDpFkW9h1Ye9PCNlRQ4x3XtrscAVrHza2rD/MY1J4l/ymq4KvJGud8wG77Dh0y/Y7jZvuN+zxcZakbswkKT2k6mphfKRsEEDxT8ke/XYWu+oIjVs2zpZ97+9mVdpfPGlsA7CBrFefrxqQ8eilLhMZN9fGE+hFycL7bRN46K99h/f47HZJw087wBOpN2ddj03yDVtfx3dmachWiZazUCn+W/d3oMBwsgHsRN5kPGOOg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Tamas K Lengyel <tamas@xxxxxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 28 Mar 2022 13:32:20 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 22.03.2022 18:41, Tamas K Lengyel wrote:
> For the duration of the fork memop set dom_cow as a placeholder parent. This
> gets updated to the real parent when the fork operation completes, or to NULL
> in case the fork failed.

I am concerned of this, in particular because the state may last across
perhaps a long series of preemptions. Furthermore ...

> --- a/xen/arch/x86/include/asm/mem_sharing.h
> +++ b/xen/arch/x86/include/asm/mem_sharing.h
> @@ -79,7 +79,7 @@ static inline int mem_sharing_unshare_page(struct domain *d,
>  
>  static inline bool mem_sharing_is_fork(const struct domain *d)
>  {
> -    return d->parent;
> +    return d->parent && d->parent != dom_cow;
>  }

... this now makes the function "lie" (the domain is a fork already
while being constructed). Hence at the very least a comment would want
to appear here explaining why this is wanted despite not really being
correct. This "lying" for example means a partly set up fork would be
skipped by domain_relinquish_resources(), in case the tool stack
decided to kill the domain instead of waiting for its creation to
finish.

> --- a/xen/arch/x86/mm/mem_sharing.c
> +++ b/xen/arch/x86/mm/mem_sharing.c
> @@ -1850,7 +1850,9 @@ static int fork(struct domain *cd, struct domain *d, 
> uint16_t flags)
>          *cd->arch.cpuid = *d->arch.cpuid;
>          *cd->arch.msr = *d->arch.msr;
>          cd->vmtrace_size = d->vmtrace_size;
> -        cd->parent = d;
> +
> +        /* use dom_cow as a placeholder until we are all done */

Nit: As per ./CODING_STYLE you want to at least start the comment with
a capital letter.

Jan




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.