From patchwork Wed Feb 19 09:37:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 11390815 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 1C95D109A for ; Wed, 19 Feb 2020 09:40:53 +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 ED03A2464E for ; Wed, 19 Feb 2020 09:40:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="R+738pJs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ED03A2464E Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amazon.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 1j4Log-0008GI-By; Wed, 19 Feb 2020 09:38:50 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j4Lof-0008Fh-3p for xen-devel@lists.xenproject.org; Wed, 19 Feb 2020 09:38:49 +0000 X-Inumbo-ID: a154319e-52fb-11ea-aa99-bc764e2007e4 Received: from smtp-fw-6001.amazon.com (unknown [52.95.48.154]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id a154319e-52fb-11ea-aa99-bc764e2007e4; Wed, 19 Feb 2020 09:38:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1582105128; x=1613641128; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eSWeDs33Xk0ZJ9WDOyHx4AeQnnVYfVe84mVD3fIk6pA=; b=R+738pJsNO+JjTq1BBSjbCE0QaGuj3v0oewOuyvmRLvlMonnT2b2+fXY itEdjhgYbtVLiiUZsac74FyZuOsMHKX9SFkbX/QnKRVXVrVkrYjpde8p7 u5KaV0O5jcV4OVjNKLXk89jxEztxFp8dZbc/1DmpfBOv61wzt3z+zI5VO k=; IronPort-SDR: mKArS8eNCqvM25f9Gc2nPi+dO5BdcRfZsV+PNr4C0WdXHLb54y5K85z8IYzUv8VljWdOwY0ank fngbIKCUYHOg== X-IronPort-AV: E=Sophos;i="5.70,459,1574121600"; d="scan'208";a="18531467" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-1d-f273de60.us-east-1.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-6001.iad6.amazon.com with ESMTP; 19 Feb 2020 09:38:24 +0000 Received: from EX13MTAUEA002.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan2.iad.amazon.com [10.40.159.162]) by email-inbound-relay-1d-f273de60.us-east-1.amazon.com (Postfix) with ESMTPS id 9E66FA2701; Wed, 19 Feb 2020 09:38:23 +0000 (UTC) Received: from EX13D32EUC001.ant.amazon.com (10.43.164.159) by EX13MTAUEA002.ant.amazon.com (10.43.61.77) with Microsoft SMTP Server (TLS) id 15.0.1236.3; Wed, 19 Feb 2020 09:38:10 +0000 Received: from EX13MTAUEB002.ant.amazon.com (10.43.60.12) by EX13D32EUC001.ant.amazon.com (10.43.164.159) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 19 Feb 2020 09:38:09 +0000 Received: from u2f063a87eabd5f.cbg10.amazon.com (10.125.106.135) by mail-relay.amazon.com (10.43.60.234) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Wed, 19 Feb 2020 09:38:08 +0000 From: Paul Durrant To: Date: Wed, 19 Feb 2020 09:37:53 +0000 Message-ID: <20200219093754.2924-6-pdurrant@amazon.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200219093754.2924-1-pdurrant@amazon.com> References: <20200219093754.2924-1-pdurrant@amazon.com> MIME-Version: 1.0 Precedence: Bulk Subject: [Xen-devel] [PATCH v6 5/6] xl.conf: introduce 'domid_policy' X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Anthony PERARD , Paul Durrant , Ian Jackson , Wei Liu Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" This patch adds a new global 'domid_policy' configuration option to decide how domain id values are allocated for new domains. It may be set to one of two values: "xen", the default value, will cause an invalid domid value to be passed to do_domain_create() preserving the existing behaviour of having Xen choose the domid value during domain_create(). "random" will cause the special RANDOM_DOMID value to be passed to do_domain_create() such that libxl__domain_make() will select a random domid value. Signed-off-by: Paul Durrant Acked-by: Ian Jackson --- Cc: Wei Liu Cc: Anthony PERARD v2: - New in v2 --- docs/man/xl.conf.5.pod | 10 ++++++++++ tools/examples/xl.conf | 4 ++++ tools/xl/xl.c | 10 ++++++++++ tools/xl/xl.h | 1 + tools/xl/xl_vmcontrol.c | 2 ++ 5 files changed, 27 insertions(+) diff --git a/docs/man/xl.conf.5.pod b/docs/man/xl.conf.5.pod index 207ab3e77a..41ee428744 100644 --- a/docs/man/xl.conf.5.pod +++ b/docs/man/xl.conf.5.pod @@ -45,6 +45,16 @@ The semantics of each C defines which form of C is required. =over 4 +=item B + +Determines how domain-id is set when creating a new domain. + +If set to "xen" then the hypervisor will allocate new domain-id values on a sequential basis. + +If set to "random" then a random domain-id value will be chosen. + +Default: "xen" + =item B If set to "on" then C will automatically reduce the amount of diff --git a/tools/examples/xl.conf b/tools/examples/xl.conf index 0446deb304..95f2f442d3 100644 --- a/tools/examples/xl.conf +++ b/tools/examples/xl.conf @@ -1,5 +1,9 @@ ## Global XL config file ## +# Set domain-id policy. "xen" means that the hypervisor will choose the +# id of a new domain. "random" means that a random value will be chosen. +#domid_policy="xen" + # Control whether dom0 is ballooned down when xen doesn't have enough # free memory to create a domain. "auto" means only balloon if dom0 # starts with all the host's memory. diff --git a/tools/xl/xl.c b/tools/xl/xl.c index 3d4390a46d..2a5ddd4390 100644 --- a/tools/xl/xl.c +++ b/tools/xl/xl.c @@ -54,6 +54,7 @@ int claim_mode = 1; bool progress_use_cr = 0; int max_grant_frames = -1; int max_maptrack_frames = -1; +libxl_domid domid_policy = INVALID_DOMID; xentoollog_level minmsglevel = minmsglevel_default; @@ -228,6 +229,15 @@ static void parse_global_config(const char *configfile, else libxl_bitmap_set_any(&global_pv_affinity_mask); + if (!xlu_cfg_get_string (config, "domid_policy", &buf, 0)) { + if (!strcmp(buf, "xen")) + domid_policy = INVALID_DOMID; + else if (!strcmp(buf, "random")) + domid_policy = RANDOM_DOMID; + else + fprintf(stderr, "invalid domid_policy option"); + } + xlu_cfg_destroy(config); } diff --git a/tools/xl/xl.h b/tools/xl/xl.h index 60bdad8ffb..2b4709efb2 100644 --- a/tools/xl/xl.h +++ b/tools/xl/xl.h @@ -283,6 +283,7 @@ extern int max_maptrack_frames; extern libxl_bitmap global_vm_affinity_mask; extern libxl_bitmap global_hvm_affinity_mask; extern libxl_bitmap global_pv_affinity_mask; +extern libxl_domid domid_policy; enum output_format { OUTPUT_FORMAT_JSON, diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c index e520b1da79..39292acfe6 100644 --- a/tools/xl/xl_vmcontrol.c +++ b/tools/xl/xl_vmcontrol.c @@ -899,6 +899,8 @@ start: autoconnect_console_how = 0; } + d_config.c_info.domid = domid_policy; + if ( restoring ) { libxl_domain_restore_params params;