From patchwork Fri Feb 21 18:49:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamas K Lengyel X-Patchwork-Id: 11397207 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9825B92A for ; Fri, 21 Feb 2020 18:50:42 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7BD16208E4 for ; Fri, 21 Feb 2020 18:50:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7BD16208E4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j5DMy-0006iY-Ag; Fri, 21 Feb 2020 18:49:48 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j5DMw-0006hw-M5 for xen-devel@lists.xenproject.org; Fri, 21 Feb 2020 18:49:46 +0000 X-Inumbo-ID: e80d6e4e-54da-11ea-b0fd-bc764e2007e4 Received: from mga12.intel.com (unknown [192.55.52.136]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id e80d6e4e-54da-11ea-b0fd-bc764e2007e4; Fri, 21 Feb 2020 18:49:36 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Feb 2020 10:49:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,469,1574150400"; d="scan'208";a="259709283" Received: from btraw-mobl.amr.corp.intel.com (HELO localhost.localdomain) ([10.251.1.240]) by fmsmga004.fm.intel.com with ESMTP; 21 Feb 2020 10:49:33 -0800 From: Tamas K Lengyel To: xen-devel@lists.xenproject.org Date: Fri, 21 Feb 2020 10:49:20 -0800 Message-Id: <08d22ed5ffef1d947b819606aafa6414a16bed0b.1582310142.git.tamas.lengyel@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v9 2/5] xen: add parent_domid field to createdomain domctl X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Tamas K Lengyel , Wei Liu , Konrad Rzeszutek Wilk , Andrew Cooper , Ian Jackson , George Dunlap , Jan Beulich , Julien Grall Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" When creating a domain that will be used as a VM fork some information is required to set things up properly, like the max_vcpus count. Instead of the toolstack having to gather this information for each fork in a separate hypercall we can just include the parent domain's id in the createdomain domctl so that Xen can copy the setting without the extra toolstack queries. Signed-off-by: Tamas K Lengyel --- xen/common/domctl.c | 14 ++++++++++++++ xen/include/public/domctl.h | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/xen/common/domctl.c b/xen/common/domctl.c index a69b3b59a8..22aceb3860 100644 --- a/xen/common/domctl.c +++ b/xen/common/domctl.c @@ -489,6 +489,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) case XEN_DOMCTL_createdomain: { domid_t dom; + domid_t parent_dom; static domid_t rover = 0; dom = op->domain; @@ -515,6 +516,19 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) rover = dom; } + parent_dom = op->u.createdomain.parent_domid; + if ( parent_dom ) + { + struct domain *pd = rcu_lock_domain_by_id(parent_dom); + + ret = -EINVAL; + if ( !pd ) + break; + + op->u.createdomain.max_vcpus = pd->max_vcpus; + rcu_unlock_domain(pd); + } + d = domain_create(dom, &op->u.createdomain, false); if ( IS_ERR(d) ) { diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h index fec6f6fdd1..251cc40ef6 100644 --- a/xen/include/public/domctl.h +++ b/xen/include/public/domctl.h @@ -38,7 +38,7 @@ #include "hvm/save.h" #include "memory.h" -#define XEN_DOMCTL_INTERFACE_VERSION 0x00000012 +#define XEN_DOMCTL_INTERFACE_VERSION 0x00000013 /* * NB. xen_domctl.domain is an IN/OUT parameter for this operation. @@ -92,6 +92,7 @@ struct xen_domctl_createdomain { uint32_t max_evtchn_port; int32_t max_grant_frames; int32_t max_maptrack_frames; + domid_t parent_domid; struct xen_arch_domainconfig arch; };