From patchwork Wed Jan 22 14:44:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 11345865 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 520E613A4 for ; Wed, 22 Jan 2020 14:46: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 2DC4E21835 for ; Wed, 22 Jan 2020 14:46:42 +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="HMoqaZ0H" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2DC4E21835 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 1iuHGO-0000qV-CL; Wed, 22 Jan 2020 14:45:48 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iuHGN-0000qG-9w for xen-devel@lists.xenproject.org; Wed, 22 Jan 2020 14:45:47 +0000 X-Inumbo-ID: dff93ab6-3d25-11ea-bc69-12813bfff9fa Received: from smtp-fw-2101.amazon.com (unknown [72.21.196.25]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id dff93ab6-3d25-11ea-bc69-12813bfff9fa; Wed, 22 Jan 2020 14:45:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1579704347; x=1611240347; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eSWeDs33Xk0ZJ9WDOyHx4AeQnnVYfVe84mVD3fIk6pA=; b=HMoqaZ0Hq4w5wyWPRkpIklGNe1INej8WakEsyHwhuP9UljPXZCr604KZ nnKxfkjMxFESDcYOMaBSrTl9uI+rn5GH7Gkklrx/xQDJBqk35YJi3eOwQ 1m2Qq0QRA+zuHeC5XkOxiicWMoKdDdnpsa2tyLkgKd5UzbBtMKcCIA9UF U=; IronPort-SDR: pb+wluFlu4tjlDcEosgKd24CZuoTBQBv/RrLirC1fUlgYxpf8vUwLMBuiMie8sl4VEekz2VIvH NAFMCCAt++dA== X-IronPort-AV: E=Sophos;i="5.70,350,1574121600"; d="scan'208";a="13689615" Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-1d-74cf8b49.us-east-1.amazon.com) ([10.43.8.2]) by smtp-border-fw-out-2101.iad2.amazon.com with ESMTP; 22 Jan 2020 14:45:46 +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-74cf8b49.us-east-1.amazon.com (Postfix) with ESMTPS id EEF17C0920; Wed, 22 Jan 2020 14:45:45 +0000 (UTC) Received: from EX13D32EUB004.ant.amazon.com (10.43.166.212) by EX13MTAUEA002.ant.amazon.com (10.43.61.77) with Microsoft SMTP Server (TLS) id 15.0.1236.3; Wed, 22 Jan 2020 14:45:01 +0000 Received: from EX13MTAUEE002.ant.amazon.com (10.43.62.24) by EX13D32EUB004.ant.amazon.com (10.43.166.212) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 22 Jan 2020 14:45:00 +0000 Received: from u2f063a87eabd5f.cbg10.amazon.com (10.125.106.135) by mail-relay.amazon.com (10.43.62.224) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Wed, 22 Jan 2020 14:44:58 +0000 From: Paul Durrant To: Date: Wed, 22 Jan 2020 14:44:45 +0000 Message-ID: <20200122144446.919-7-pdurrant@amazon.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200122144446.919-1-pdurrant@amazon.com> References: <20200122144446.919-1-pdurrant@amazon.com> MIME-Version: 1.0 Precedence: Bulk Subject: [Xen-devel] [PATCH v4 6/7] 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;