From nobody Sun May 19 02:38:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=eu.citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1571411373; cv=none; d=zoho.com; s=zohoarc; b=CAtx47HvWnGnUBypI8d2QykugZA5XFkPLXhi3n/phz7Eht/s4oyiKOPVWEUmwDOiFMA9zgS1YzB6pb7SC14eOaCd8u4cdryZxl4PM4UvAuF+OMxXvY2N0p/A4U29B3rzEBrxjZizPXcK2fbeCXVx5af34foLbhQCX76VqPQ56Bs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571411373; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tAA2UfdYqOXna3Nt0/cQfGgmJLl54a4ynCF+NUlNxdU=; b=ElHEHlz6ZGHuOThLFRYU5Xe33JM3X8aITlsMvyRTKrnSkmdoeJMcsTyUqyXFuXBiFBM33bOHx5kJ7nyEe+CUYG5GqopGOVmUQgIClcSTz5ipV162pvPx2P0mnhofeOD03nSvx8fRm5ZtD6TVJXhI1KrjrYXTjxlhj951ReVue6g= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1571411373007820.9386400950335; Fri, 18 Oct 2019 08:09:33 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iLTqM-00051Z-0G; Fri, 18 Oct 2019 15:07:06 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iLTqK-00050l-HW for xen-devel@lists.xenproject.org; Fri, 18 Oct 2019 15:07:04 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id eecd94a0-f1b8-11e9-beca-bc764e2007e4; Fri, 18 Oct 2019 15:06:59 +0000 (UTC) X-Inumbo-ID: eecd94a0-f1b8-11e9-beca-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1571411219; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=Z2wcBcBGG/Y/drK4rHShO5xZz9+eTKQjLFNrm0BeVIw=; b=GqzF+j4tT+noK+0BRPBzBEG+vOwkkeoPQOXQZ4TuDNXiVh1i/iQnfpDA +HrKixruA8QsOkJ/avvG9LBK4CKgyLJy7oZ2UfruhTxUK3/yhasUK9W65 8DMkg1UCRQRCX5BZUI9+BAC9UQyoYBkM37gYX+AgD6SKEV3XM/isTyf4R I=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=ian.jackson@eu.citrix.com; spf=Pass smtp.mailfrom=Ian.Jackson@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of ian.jackson@eu.citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="ian.jackson@eu.citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa6.hc3370-68.iphmx.com: domain of Ian.Jackson@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="Ian.Jackson@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: J8TqHjyMUNtm+W4qjbDb02FwwbYHCC1fOxKwDhWXpGQjUYJcBdh5yC09Wr+YoRhFHRnK5Ltyfx OyRC93FLt3ZRbA75li3C/aRgE0eimihGQ7pUrW5U0kn+BNN8YqjPCj7i66zbOhx1D8YrTE4oY7 jtBF0hhduL/K37I7Y4+aPgOBQ7SaU4exXtXkiYmymLfkmna94zHUntUVm3sIiOzYHAPI4a3qd+ c0BG73BjhHG56/p0m+kQkGPNz9er8UiihBa/Mr+1vFR/PFL5LMllsiZDCKUyjRjNk/kzpuvBxI wt4= X-SBRS: 2.7 X-MesageID: 7434353 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.67,312,1566878400"; d="scan'208";a="7434353" From: Ian Jackson To: Date: Fri, 18 Oct 2019 16:06:44 +0100 Message-ID: <20191018150653.24862-2-ian.jackson@eu.citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191018150653.24862-1-ian.jackson@eu.citrix.com> References: <20191018150653.24862-1-ian.jackson@eu.citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [XEN PATCH for-4.13 v5 01/10] libxl: Offer API versions 0x040700 and 0x040800 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: Paul Durrant , Ian Jackson , Jan Beulich , Andrew Cooper Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) According to git log -G: 0x040700 was introduced in 304400459ef0 (aka 4.7.0-rc1~481) "tools/libxl: rename remus device to checkpoint device" 0x040800 was introduced in 57f8b13c7240 (aka 4.8.0-rc1~437) "libxl: memory size in kb requires 64 bit variable" It is surprising that no-one noticed this. Anyway, in the meantime, we should fix it. Backporting this is probably a good idea: it won't change the behaviour for existing callers but it will avoid errors for some older correct uses. Signed-off-by: Ian Jackson Acked-by: Anthony PERARD --- v2: Adjusted commit message slightly. --- tools/libxl/libxl.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index 2555e9cd3b..518fc9e47f 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -655,6 +655,7 @@ typedef struct libxl__ctx libxl_ctx; #ifdef LIBXL_API_VERSION #if LIBXL_API_VERSION !=3D 0x040200 && LIBXL_API_VERSION !=3D 0x040300 && \ LIBXL_API_VERSION !=3D 0x040400 && LIBXL_API_VERSION !=3D 0x040500 && \ + LIBXL_API_VERSION !=3D 0x040700 && LIBXL_API_VERSION !=3D 0x040800 && \ LIBXL_API_VERSION !=3D 0x041300 #error Unknown LIBXL_API_VERSION #endif --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Sun May 19 02:38:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=eu.citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1571411374; cv=none; d=zoho.com; s=zohoarc; b=BfQay4iqfM9uV6p3wWi+GJN0jdsSD0TDFV6VAK4KMDS6ieFvH9Q/xMzxlOJvGvyKZRe8obtGhV32TKxuWhwKeKqJfTwAC4XTcOK6nCIkS4IHj1u6vOaKlIiecFdrJhBQtoVDGDhkt2rXuQzTc81bXVuw+IXoQENexfacdbREaUg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571411374; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Y11FNwS1RESPABy8uIdR4/VoXhRjR5zj1I/VUD72jOA=; b=jMg2O1rkKhjUXe7dj2GQxSMhrSlzecZvpwcdK0RVQ/88zMVi6w18hjgN7Q9gTjjhniVm+HR4TM+vhDNHvGEOjrKkQwe6O+hMrdxhbo5Ovpkpgv1aHHq98T9NXA27pDJORtjM+yQFmX/BJojeOABHIKu1YtzGDxMTZL6reMmCIp8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1571411374293451.03118762150166; Fri, 18 Oct 2019 08:09:34 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iLTqQ-00052M-KL; Fri, 18 Oct 2019 15:07:10 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iLTqP-000526-IF for xen-devel@lists.xenproject.org; Fri, 18 Oct 2019 15:07:09 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id eed63808-f1b8-11e9-beca-bc764e2007e4; Fri, 18 Oct 2019 15:06:59 +0000 (UTC) X-Inumbo-ID: eed63808-f1b8-11e9-beca-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1571411219; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=Zzusm/RjFNRE7hHrONeMgqDs0JYfYY3tV4/RvhfMiVc=; b=UGLDPniQuTjYCN1iibkp8ipvqCs17BVLowxiwGT11SjccioYbHopZUDS o1n4B0ilgVLhr+w6eaVmzyfxdop8ayff/TICDJXg6QKIOhs2+8BszFIG3 4P0u5v5tYIpBp8DanucP/b+0VikkNCzQ8g4tA8Jn7fxOUaF29J2F5yEs/ U=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=ian.jackson@eu.citrix.com; spf=Pass smtp.mailfrom=Ian.Jackson@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of ian.jackson@eu.citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="ian.jackson@eu.citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa6.hc3370-68.iphmx.com: domain of Ian.Jackson@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="Ian.Jackson@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: XrvMVtRnUbF3txWp1cpUK2Q6KHLXScoJihn/xwTqegoeOPFCQP5x518GKAwYDQ/do9kBmFfb4g 1+YprCKyCp+Qsdk/v87lA0KSiD85jAvum5/XudwPzik/FQvg/nkMG0EnKNHHPaxSZfYxJSQtk7 txnOmNdTFreAaBONosfhIFkSl5Xr46C2aS4wkV0RGR2y/dyvW+oZp6AObOMY83rU9EwYOxcHBi pI0cFbZLuVB2JCG9BJnZikVjgMY2ghJ24djEqDRDXe8TJpKA2TKSf92uwdghzuQMU+RfdV249M tuc= X-SBRS: 2.7 X-MesageID: 7434354 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.67,312,1566878400"; d="scan'208";a="7434354" From: Ian Jackson To: Date: Fri, 18 Oct 2019 16:06:45 +0100 Message-ID: <20191018150653.24862-3-ian.jackson@eu.citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191018150653.24862-1-ian.jackson@eu.citrix.com> References: <20191018150653.24862-1-ian.jackson@eu.citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [XEN PATCH for-4.13 v5 02/10] xl: Pass libxl_domain_config to freemem(), instead of b_info 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: Paul Durrant , Ian Jackson , Jan Beulich , Andrew Cooper Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) We are going to change the libxl API in a moment and this change will make it simpler. Signed-off-by: Ian Jackson Reviewed-by: Anthony PERARD --- tools/xl/xl_vmcontrol.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c index b20582e15b..d33c6b38c9 100644 --- a/tools/xl/xl_vmcontrol.c +++ b/tools/xl/xl_vmcontrol.c @@ -314,7 +314,7 @@ static int domain_wait_event(uint32_t domid, libxl_even= t **event_r) * Returns true in case there is already, or we manage to free it, enough * memory, but also if autoballoon is false. */ -static bool freemem(uint32_t domid, libxl_domain_build_info *b_info) +static bool freemem(uint32_t domid, libxl_domain_config *d_config) { int rc, retries =3D 3; uint64_t need_memkb, free_memkb; @@ -322,7 +322,7 @@ static bool freemem(uint32_t domid, libxl_domain_build_= info *b_info) if (!autoballoon) return true; =20 - rc =3D libxl_domain_need_memory(ctx, b_info, &need_memkb); + rc =3D libxl_domain_need_memory(ctx, &d_config->b_info, &need_memkb); if (rc < 0) return false; =20 @@ -879,7 +879,7 @@ start: goto error_out; =20 if (domid_soft_reset =3D=3D INVALID_DOMID) { - if (!freemem(domid, &d_config.b_info)) { + if (!freemem(domid, &d_config)) { fprintf(stderr, "failed to free memory for the domain\n"); ret =3D ERROR_FAIL; goto error_out; --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Sun May 19 02:38:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=eu.citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1571411370; cv=none; d=zoho.com; s=zohoarc; b=LqnQztnkNux1l+MSW1DHbj9+4DCZ6148rWhF/WOLaHlQDnZdT0yvRkmbTcl5utLFTLWbPiE8PtGq1AmJIV3j39xXQ6P0Ei5eiD+NoDstFs3iD8JcCfMoRmktK9NiJysC1r/u5VVgXCesUNOTnm0VDql0DYz04Ek5Ry6wt1lI8Zc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571411370; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=XB7iC9S/YUFYD1Tm5Eq5IS3y+MegVGJZfaGAQQGaF9E=; b=Ns2KyddelN/ndcBOxKvCKmn06dlJYTd+qrjT3WhBNkfAPxdRQr+fwx2Pkt67OAAiRZWRY+GpFl0sLVK9mc11HoVIV0ImPgvTRIDwYp6JkOfMa3c1e9n5ZwkRTnVeQuzVTlVWaMfsTwycDxkFnEAqO/WR2ggdvqzABI72GwhT9sE= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1571411370703491.4917862928037; Fri, 18 Oct 2019 08:09:30 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iLTqV-00054g-Uf; Fri, 18 Oct 2019 15:07:15 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iLTqU-00054D-Hs for xen-devel@lists.xenproject.org; Fri, 18 Oct 2019 15:07:14 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id ef3f4032-f1b8-11e9-beca-bc764e2007e4; Fri, 18 Oct 2019 15:07:00 +0000 (UTC) X-Inumbo-ID: ef3f4032-f1b8-11e9-beca-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1571411220; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=1jKUJSikxB9yiqNmqcnpVueJx6HmmRvphhPyUj0dFVU=; b=gS4a1VAk6P3WaQsTCBd04wvj4aw3D13iCqFuqni7a9y04bARJVIwR0On lI7ZndHmRyZnZoFZaIFWstUBlr/OgZEcxGkVGZQHjwrL+1iSx0UUsbUWo 8vZiqmUnqFKG3LPVNUuudzd+SaAt+nEnykmHcSEaocCaz85t4PhaA7CsL I=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=ian.jackson@eu.citrix.com; spf=Pass smtp.mailfrom=Ian.Jackson@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of ian.jackson@eu.citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="ian.jackson@eu.citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa6.hc3370-68.iphmx.com: domain of Ian.Jackson@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="Ian.Jackson@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: +WhMRasiYSJn4GUg5s3ARFnsrReYPOnnJS+Mh5D7JXTC++r/4iWnx3nZ5jXpih7WxyjlRm9g37 4mEPAMELT53ahHohWNIPwKZ0WUIUuzo6e+1q6QmbWb5/BUbBdVC29KxNvjF1Un2Td2GST+fD9p QhvKaCRbsCHeDWecwaum6bFiPHfuCPGGHGad2/Fvp2JiK2GPypK0uxNYeqJ8zbEtX61eBDT0KK 6MRhT3fPKQh8OO2kHAsKHGrRGyKIjr9WP8widub4+oXCkYvSoBmFEKSfuvg1PRHWCR+2zd0dAd SJE= X-SBRS: 2.7 X-MesageID: 7434355 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.67,312,1566878400"; d="scan'208";a="7434355" From: Ian Jackson To: Date: Fri, 18 Oct 2019 16:06:46 +0100 Message-ID: <20191018150653.24862-4-ian.jackson@eu.citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191018150653.24862-1-ian.jackson@eu.citrix.com> References: <20191018150653.24862-1-ian.jackson@eu.citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [XEN PATCH for-4.13 v5 03/10] libxl: libxl__domain_config_setdefault: New function 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: Paul Durrant , Ian Jackson , Jan Beulich , Andrew Cooper Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Break out this into a new function. We are going to want to call it from a new call site. Unfortunately not all of the defaults can be moved into the new function without changing the order in which things are done. That does not seem wise at this stage of the release. The effect is that additional calls to libxl__domain_config_setdefault (which are going to be introduced) do not quite set everything. But they will do what is needed. After Xen 4.13 is done, we should move those settings into the right order. No functional change. Signed-off-by: Ian Jackson Reviewed-by: Anthony PERARD --- v2: Add missing error check --- tools/libxl/libxl_create.c | 41 +++++++++++++++++++++++++++++------------ tools/libxl/libxl_internal.h | 3 +++ 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index 099761a2d7..fd8bb22be9 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -862,22 +862,14 @@ static void domcreate_destruction_cb(libxl__egc *egc, libxl__domain_destroy_state *dds, int rc); =20 -static void initiate_domain_create(libxl__egc *egc, - libxl__domain_create_state *dcs) +int libxl__domain_config_setdefault(libxl__gc *gc, + libxl_domain_config *d_config, + uint32_t domid) { - STATE_AO_GC(dcs->ao); libxl_ctx *ctx =3D libxl__gc_owner(gc); - uint32_t domid; - int i, ret; + int ret; bool pod_enabled =3D false; =20 - /* convenience aliases */ - libxl_domain_config *const d_config =3D dcs->guest_config; - const int restore_fd =3D dcs->restore_fd; - - domid =3D dcs->domid_soft_reset; - libxl__domain_build_state_init(&dcs->build_state); - if (d_config->c_info.ssid_label) { char *s =3D d_config->c_info.ssid_label; ret =3D libxl_flask_context_to_sid(ctx, s, strlen(s), @@ -1008,6 +1000,28 @@ static void initiate_domain_create(libxl__egc *egc, goto error_out; } =20 + ret =3D 0; + error_out: + return ret; +} + +static void initiate_domain_create(libxl__egc *egc, + libxl__domain_create_state *dcs) +{ + STATE_AO_GC(dcs->ao); + uint32_t domid; + int i, ret; + + /* convenience aliases */ + libxl_domain_config *const d_config =3D dcs->guest_config; + const int restore_fd =3D dcs->restore_fd; + + domid =3D dcs->domid_soft_reset; + libxl__domain_build_state_init(&dcs->build_state); + + ret =3D libxl__domain_config_setdefault(gc,d_config,domid); + if (ret) goto error_out; + ret =3D libxl__domain_make(gc, d_config, &dcs->build_state, &domid); if (ret) { LOGD(ERROR, domid, "cannot make domain: %d", ret); @@ -1019,6 +1033,9 @@ static void initiate_domain_create(libxl__egc *egc, dcs->guest_domid =3D domid; dcs->sdss.dm.guest_domid =3D 0; /* means we haven't spawned */ =20 + /* post-4.13 todo: move these next bits of defaulting to + * libxl__domain_config_setdefault */ + /* * Set the dm version quite early so that libxl doesn't have to pass t= he * build info around just to know if the domain has a device model or = not. diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index d2d5af746b..50ac7b64ed 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1440,6 +1440,9 @@ _hidden int libxl__resolve_domid(libxl__gc *gc, const= char *name, * All libxl API functions are expected to have arranged for this * to be called before using any values within these structures. */ +_hidden int libxl__domain_config_setdefault(libxl__gc *gc, + libxl_domain_config *d_config, + uint32_t domid /* logging only= */); _hidden int libxl__domain_create_info_setdefault(libxl__gc *gc, libxl_domain_create_info *c_info); _hidden int libxl__domain_build_info_setdefault(libxl__gc *gc, --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Sun May 19 02:38:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=eu.citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1571411370; cv=none; d=zoho.com; s=zohoarc; b=bOlQf37+o0Ka3t8FYFMgjYjUZKE446Vj1lm6PYpfkLtQkm5muPgYE0ItRrAtvmt7J6nJm+JqFLgzo0T733pLMK4OTwBAR45nC5SKAnDUexDGzh06F7PshTy8o3zvYexpDTLuB9zACds4smtd364By00oJ+Dj0mI+EpiNZloLuOQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571411370; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ZnUfB/sse97DSGOKaTHMKFuE4+ZqzjUmwUw1WtXmW+Q=; b=DscT5F7YXD6siHD3kFcQAakDawBQQWslx4klUs1FgysVykdwAny2/vnptcLK6l9AD/WzZZLsM5nD8WUV2ANGpn9eZMU6Vu5j4tAtEQqE1cHbRdxmdNPf2Ox85g5w6WzhzY3kxiHAgG+xUC8au7HALhk8ARWCkvaquI+yGtXyxQI= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 157141137065284.95008105719603; Fri, 18 Oct 2019 08:09:30 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iLTqK-00050m-Il; Fri, 18 Oct 2019 15:07:04 +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 1iLTqJ-00050f-P2 for xen-devel@lists.xenproject.org; Fri, 18 Oct 2019 15:07:03 +0000 Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id eee8016e-f1b8-11e9-93f5-12813bfff9fa; Fri, 18 Oct 2019 15:07:00 +0000 (UTC) X-Inumbo-ID: eee8016e-f1b8-11e9-93f5-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1571411220; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=mcnHNnuobJVIoAVNjV2dKd+l7QxXNdod66g53zaBt+0=; b=SF+HHc+jf5+AlilwvmRWglRM937WjqT+ieBXw0uZ7fMp3UbmBXzQFFet BLcMskmZBDdC9Gctxp/hf1Ofa0BhVW06fjyQ4WQAfmzjQDhvt5H2eRAfd BBQ4HncieQQhXQE8KQ8x6Z2yepNRzcQCgi9Zp1MzBLN329nJU1xZrU8QS M=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=ian.jackson@eu.citrix.com; spf=Pass smtp.mailfrom=Ian.Jackson@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of ian.jackson@eu.citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="ian.jackson@eu.citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa3.hc3370-68.iphmx.com: domain of Ian.Jackson@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="Ian.Jackson@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: OoxVqheXOykuCz+MwgDuY70+V3jAeC0VSPa9U9lUhrIhYJPyKRAsT4F6CwqJTE6SsxpJsjK842 HDfHsYmaW2iXgSwbpDN3g4ztENOjoepj5/t7jhZxXTDx8NCBzLkW3BzWz2wxV5+EUKyX1RyNWe AoIkrXzc7MsMlYMS4GJw/Fm7W3ZwijyADwjh1MXz0UB5hkXFvtkBMWdE0zfsGnp0UQQJtcOIwU ix4Sl94WbePcHZ8Qw5G2HfseGCc5fqYOFqJMd0P33t1exSNkdvyb1YFbvTw6GUyw98g4CJHlQj uKQ= X-SBRS: 2.7 X-MesageID: 7099409 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.67,312,1566878400"; d="scan'208";a="7099409" From: Ian Jackson To: Date: Fri, 18 Oct 2019 16:06:47 +0100 Message-ID: <20191018150653.24862-5-ian.jackson@eu.citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191018150653.24862-1-ian.jackson@eu.citrix.com> References: <20191018150653.24862-1-ian.jackson@eu.citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [XEN PATCH for-4.13 v5 04/10] libxl: libxl_domain_need_memory: Make it take a domain_config 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: Paul Durrant , Ian Jackson , Jan Beulich , Andrew Cooper Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) This should calculate the extra memory needed for shadow and iommu, the defaults for which depend on values in c_info. So we need this to have the complete domain config available. And the defaults should actually be updated and stored. So make it non-const. We provide the usual kind of compatibility function for callers expecting 4.12 and earlier. This function becomes responsible for the clone-and-modify of the b_info. No overall functional change for external libxl callers which use the API version system to request a particular API version. Other external libxl callers will need to update their calling code, and will then find that the new version of this function fills in most of the defaults in d_config. Because libxl__domain_config_setdefault doesn't quite do all of the defaults, that's only partial. For present purposes that doesn't matter because none of the missing settings are used by the memory calculations. It does mean we need to document in the API spec that the defaulting is only partial. This lack of functional change is despite the fact that numa_place_domain now no longer calls libxl__domain_build_info_setdefault (via libxl_domain_need_memory). That is OK because it's idempotent and numa_place_domain's one call site is libxl__build_pre which is called from libxl__domain_build which is called from domcreate_bootloader_done, well after the defaults are set by initiate_domain_create. Signed-off-by: Ian Jackson Reviewed-by: Anthony PERARD --- v2: Drop now-erroneous GC_FREE as well as the corresponding GC_INIT. --- tools/libxl/libxl.h | 23 +++++++++++++++- tools/libxl/libxl_dom.c | 7 +++-- tools/libxl/libxl_internal.h | 4 +++ tools/libxl/libxl_mem.c | 65 +++++++++++++++++++++++++++++++++++-----= ---- tools/xl/xl_vmcontrol.c | 2 +- 5 files changed, 83 insertions(+), 18 deletions(-) diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index 518fc9e47f..49b56fa1a3 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -1245,6 +1245,20 @@ void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, = const libxl_mac *src); */ #define LIBXL_HAVE_FN_USING_QMP_ASYNC 1 =20 +/* + * LIBXL_HAVE_DOMAIN_NEED_MEMORY_CONFIG + * + * If this is set, libxl_domain_need_memory takes a + * libxl_domain_config* (non-const) and uint32_t domid_for_logging + * (instead of a const libxl_domain_build_info*). + * + * If this is set, there is no need to call + * libxl_get_required_shadow_memory and instead the caller should + * simply leave shadow_memkb set to LIBXL_MEMKB_DEFAULT and allow + * libxl to fill in a suitable default in the usual way. + */ +#define LIBXL_HAVE_DOMAIN_NEED_MEMORY_CONFIG + typedef char **libxl_string_list; void libxl_string_list_dispose(libxl_string_list *sl); int libxl_string_list_length(const libxl_string_list *sl); @@ -1723,8 +1737,13 @@ int libxl_get_memory_target_0x040700(libxl_ctx *ctx,= uint32_t domid, */ /* how much free memory in the system a domain needs to be built */ int libxl_domain_need_memory(libxl_ctx *ctx, - const libxl_domain_build_info *b_info_in, + libxl_domain_config *config + /* ^ will be partially defaulted */, + uint32_t domid_for_logging /* INVALID_DOMID o= k */, uint64_t *need_memkb); +int libxl_domain_need_memory_0x041200(libxl_ctx *ctx, + const libxl_domain_build_info *b_inf= o_in, + uint64_t *need_memkb); int libxl_domain_need_memory_0x040700(libxl_ctx *ctx, const libxl_domain_build_info *b_inf= o_in, uint32_t *need_memkb) @@ -1754,6 +1773,8 @@ int libxl_wait_for_memory_target(libxl_ctx *ctx, uint= 32_t domid, int wait_secs); #define libxl_get_memory_target libxl_get_memory_target_0x040700 #define libxl_domain_need_memory libxl_domain_need_memory_0x040700 #define libxl_get_free_memory libxl_get_free_memory_0x040700 +#elif defined(LIBXL_API_VERSION) && LIBXL_API_VERSION < 0x041300 +#define libxl_domain_need_memory libxl_domain_need_memory_0x041200 #endif =20 int libxl_vncviewer_exec(libxl_ctx *ctx, uint32_t domid, int autopass); diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index c5685b061c..cdb294ab8d 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -140,8 +140,9 @@ static int numa_cmpf(const libxl__numa_candidate *c1, =20 /* The actual automatic NUMA placement routine */ static int numa_place_domain(libxl__gc *gc, uint32_t domid, - libxl_domain_build_info *info) + libxl_domain_config *d_config) { + libxl_domain_build_info *info =3D &d_config->b_info; int found; libxl__numa_candidate candidate; libxl_bitmap cpumap, cpupool_nodemap, *map; @@ -195,7 +196,7 @@ static int numa_place_domain(libxl__gc *gc, uint32_t do= mid, } } =20 - rc =3D libxl_domain_need_memory(CTX, info, &memkb); + rc =3D libxl__domain_need_memory_calculate(gc, info, &memkb); if (rc) goto out; if (libxl_node_bitmap_alloc(CTX, &cpupool_nodemap, 0)) { @@ -432,7 +433,7 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid, if (rc) return rc; =20 - rc =3D numa_place_domain(gc, domid, info); + rc =3D numa_place_domain(gc, domid, d_config); if (rc) { libxl_bitmap_dispose(&cpumap_soft); return rc; diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 50ac7b64ed..01de5576d9 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1450,6 +1450,10 @@ _hidden int libxl__domain_build_info_setdefault(libx= l__gc *gc, _hidden void libxl__rdm_setdefault(libxl__gc *gc, libxl_domain_build_info *b_info); =20 +_hidden int libxl__domain_need_memory_calculate(libxl__gc *gc, + libxl_domain_build_info *b_info, + uint64_t *need_memkb); + _hidden const char *libxl__device_nic_devname(libxl__gc *gc, uint32_t domid, uint32_t devid, diff --git a/tools/libxl/libxl_mem.c b/tools/libxl/libxl_mem.c index fd6f33312e..6042299393 100644 --- a/tools/libxl/libxl_mem.c +++ b/tools/libxl/libxl_mem.c @@ -446,20 +446,12 @@ int libxl_get_memory_target_0x040700( return libxl__memkb_64to32(ctx, rc, my_out_target, out_target); } =20 -int libxl_domain_need_memory(libxl_ctx *ctx, - const libxl_domain_build_info *b_info_in, - uint64_t *need_memkb) +int libxl__domain_need_memory_calculate(libxl__gc *gc, + libxl_domain_build_info *b_info, + uint64_t *need_memkb) { - GC_INIT(ctx); - libxl_domain_build_info b_info[1]; int rc; =20 - libxl_domain_build_info_init(b_info); - libxl_domain_build_info_copy(ctx, b_info, b_info_in); - - rc =3D libxl__domain_build_info_setdefault(gc, b_info); - if (rc) goto out; - *need_memkb =3D b_info->target_memkb; *need_memkb +=3D b_info->shadow_memkb + b_info->iommu_memkb; =20 @@ -481,10 +473,57 @@ int libxl_domain_need_memory(libxl_ctx *ctx, *need_memkb +=3D (2 * 1024) - (*need_memkb % (2 * 1024)); rc =3D 0; out: + return rc; +} + +int libxl_domain_need_memory(libxl_ctx *ctx, + libxl_domain_config *d_config, + uint32_t domid_for_logging, + uint64_t *need_memkb) +{ + GC_INIT(ctx); + int rc; + + rc =3D libxl__domain_config_setdefault(gc, + d_config, + domid_for_logging); + if (rc) goto out; + + rc =3D libxl__domain_need_memory_calculate(gc, + &d_config->b_info, + need_memkb); + if (rc) goto out; + + rc =3D 0; + out: GC_FREE; - libxl_domain_build_info_dispose(b_info); return rc; +} + +int libxl_domain_need_memory_0x041200(libxl_ctx *ctx, + const libxl_domain_build_info *b_inf= o_in, + uint64_t *need_memkb) +{ + GC_INIT(ctx); + int rc; + + libxl_domain_build_info b_info[1]; + libxl_domain_build_info_init(b_info); + libxl_domain_build_info_copy(ctx, b_info, b_info_in); + + rc =3D libxl__domain_build_info_setdefault(gc, b_info); + if (rc) goto out; =20 + rc =3D libxl__domain_need_memory_calculate(gc, + b_info, + need_memkb); + if (rc) goto out; + + rc =3D 0; + out: + libxl_domain_build_info_dispose(b_info); + GC_FREE; + return rc; } =20 int libxl_domain_need_memory_0x040700(libxl_ctx *ctx, @@ -494,7 +533,7 @@ int libxl_domain_need_memory_0x040700(libxl_ctx *ctx, uint64_t my_need_memkb; int rc; =20 - rc =3D libxl_domain_need_memory(ctx, b_info_in, &my_need_memkb); + rc =3D libxl_domain_need_memory_0x041200(ctx, b_info_in, &my_need_memk= b); return libxl__memkb_64to32(ctx, rc, my_need_memkb, need_memkb); } =20 diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c index d33c6b38c9..e520b1da79 100644 --- a/tools/xl/xl_vmcontrol.c +++ b/tools/xl/xl_vmcontrol.c @@ -322,7 +322,7 @@ static bool freemem(uint32_t domid, libxl_domain_config= *d_config) if (!autoballoon) return true; =20 - rc =3D libxl_domain_need_memory(ctx, &d_config->b_info, &need_memkb); + rc =3D libxl_domain_need_memory(ctx, d_config, domid, &need_memkb); if (rc < 0) return false; =20 --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Sun May 19 02:38:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=eu.citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1571411377; cv=none; d=zoho.com; s=zohoarc; b=TJHEaDlQZyieh5osXOUhSJZpeapthoNFFJUlqXrvqMimAqy+HOpmrDDxK/q36OB+0o8UAwCZa84ni9YxqNB9nZusKDJtaVle57ISCe31ljk3Xj2FWDBBhLNOjbFlhaM/hnR7XtWjOzcNG2dwmIjj4nUhCkHMoWzpbq1BCRYquMA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571411377; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8JYYBaRHOrvwYzrJVYJ8ZE/p9nsVWhq+NDNqTyezyh0=; b=aAzdcESbf3nS76KsbI+UTQpzBDvPsaBOBUSM8+idf8Gq+Dw8cmXbfoD6Y6ZSmsrxVpw4sY3qRebgt9LvGR5sa0KCMego31i6R4CyHTgnMuXg0MZq+kgf27yiOFQKFGp6lYnn6LbP48ovoiWFDdu5SuBOXrih0dfJopNTLrHv0d4= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1571411377309342.494598784038; Fri, 18 Oct 2019 08:09:37 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iLTqb-00057I-9a; Fri, 18 Oct 2019 15:07:21 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iLTqZ-00056X-IY for xen-devel@lists.xenproject.org; Fri, 18 Oct 2019 15:07:19 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id eeffa9d6-f1b8-11e9-8aca-bc764e2007e4; Fri, 18 Oct 2019 15:07:00 +0000 (UTC) X-Inumbo-ID: eeffa9d6-f1b8-11e9-8aca-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1571411221; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=UK8D8SXQlm+rrYSLRdhzAFRqrVgJXLVpfsEELklIuFA=; b=EYuihNXsWSKkLkaVqbXWampdNQqCHD2llF/0fZquUL+1ZH3cslqz6i0L 39f01jW7mfzE+5RtZRiuSlB5BEHApNn8JTmjhHIEvAYYyFwUfw0i/Wvp+ OcJbVNslcVctVpQo6xdRcWMbPCOliwqamIVpxTm3E0RhQw5cAvXdvs2ld k=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=ian.jackson@eu.citrix.com; spf=Pass smtp.mailfrom=Ian.Jackson@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of ian.jackson@eu.citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="ian.jackson@eu.citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.hc3370-68.iphmx.com: domain of Ian.Jackson@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="Ian.Jackson@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: taGQT/DowkvdmrnUombJJxpaQYmOV3o8yFiy7jUucRJB54Latife49S15VUkVlU/LBBa6Z2hYG IJp4OxWAEMtrAHEXKsMEG6gJtyIJiYRHkXqBilnITOZ4i+1/A/cEzI0tzOECjdRn9YfFINH370 pdkO6PoLPokiq3iePXzTyorxAN4fb16/ZXopcwh8Vv+9ArExZehC638tZ9pe3VUR2k1UcibXDA otCiX1gDVK/6gwnPMX0eX1fPP8uQj7CaoJ1e1MYSG8eUlNHhpYECMM3sf94lX9UtJqduYSJUgt KbM= X-SBRS: 2.7 X-MesageID: 7191966 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.67,312,1566878400"; d="scan'208";a="7191966" From: Ian Jackson To: Date: Fri, 18 Oct 2019 16:06:48 +0100 Message-ID: <20191018150653.24862-6-ian.jackson@eu.citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191018150653.24862-1-ian.jackson@eu.citrix.com> References: <20191018150653.24862-1-ian.jackson@eu.citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [XEN PATCH for-4.13 v5 05/10] libxl: Move shadow_memkb and iommu_memkb defaulting into libxl 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: Paul Durrant , Ian Jackson , Jan Beulich , Andrew Cooper Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Defaulting is supposed to be done by libxl. So these calculations should be here in libxl. libxl__domain_config_setdefault has all the necessary information including the values of max_memkb and max_vcpus. The overall functional effect depends on the caller: For xl, no change. The code moves from xl to libxl. For callers who set one or both shadow_memkb and iommu_memkb (whether from libxl_get_required_shadow_memory or otherwise) before calling libxl_domain_need_memory (any version): the new code will leave their setting(s) unchanged. For callers who do not call libxl_domain_need_memory at all, and who fail to set one of these memory values: now they are both are properly set. The shadow and iommu memory to be properly accounted for as intended. For callers which call libxl_domain_need_memory and request the current API (4.13) or which track libxl, the default values are also now right and everything works as intended. For callers which call libxl_domain_need_memory, and request an old pre-4.13 libxl API, and which leave one of these memkb settings unset, we take special measures to preserve the old behaviour. This means that they don't get the additional iommu memory and are at risk of the domain running out of memory as a result of f89f555827a6 "remove late (on-demand) construction of IOMMU page tables". But this is no worse than the state just after f89f555827a6, which already broke such callers in that way. This is perhaps justifiable because of the API stability warning next to libxl_domain_need_memory. An alternative would be to drop the special-casing of these callers. That would cause a discrepancy between libxl_domain_need_memory and libxl_domain_create: the former would not include the iommu memory and the latter would. That seems worse, but it's debateable. Signed-off-by: Ian Jackson Reviewed-by: Anthony PERARD --- v4: Provide a fallback default for iommu_memkb too, for old callers. v2: Replace _Bool with bool Fix logic sense in ok_to_default_memkb_in_create --- tools/libxl/libxl_create.c | 44 ++++++++++++++++++++++++++++++++++++++++= ++++ tools/libxl/libxl_internal.h | 3 +++ tools/libxl/libxl_mem.c | 4 ++++ tools/xl/xl_parse.c | 15 ++------------- 4 files changed, 53 insertions(+), 13 deletions(-) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index fd8bb22be9..3b3b6ec381 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -247,9 +247,14 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc, libxl__arch_domain_build_info_setdefault(gc, b_info); libxl_defbool_setdefault(&b_info->dm_restrict, false); =20 + if (b_info->iommu_memkb =3D=3D LIBXL_MEMKB_DEFAULT) + /* Normally defaulted in libxl__domain_create_info_setdefault */ + b_info->iommu_memkb =3D 0; + switch (b_info->type) { case LIBXL_DOMAIN_TYPE_HVM: if (b_info->shadow_memkb =3D=3D LIBXL_MEMKB_DEFAULT) + /* Normally defaulted in libxl__domain_create_info_setdefault = */ b_info->shadow_memkb =3D 0; if (b_info->u.hvm.mmio_hole_memkb =3D=3D LIBXL_MEMKB_DEFAULT) b_info->u.hvm.mmio_hole_memkb =3D 0; @@ -395,6 +400,7 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc, if (b_info->video_memkb =3D=3D LIBXL_MEMKB_DEFAULT) b_info->video_memkb =3D 0; if (b_info->shadow_memkb =3D=3D LIBXL_MEMKB_DEFAULT) + /* Normally defaulted in libxl__domain_create_info_setdefault = */ b_info->shadow_memkb =3D 0; if (b_info->u.pv.slack_memkb =3D=3D LIBXL_MEMKB_DEFAULT) b_info->u.pv.slack_memkb =3D 0; @@ -862,6 +868,30 @@ static void domcreate_destruction_cb(libxl__egc *egc, libxl__domain_destroy_state *dds, int rc); =20 +static bool ok_to_default_memkb_in_create(libxl__gc *gc) +{ + /* + * This is a fudge. We are trying to find whether the caller + * calls the old version of libxl_domain_need_memory. If they do + * then, because it only gets the b_info, and because it can't + * update the b_info (because it's const), it will base its + * calculations on defaulting shadow_memkb and iommu_memkb to 0 + * In that case we probably shouldn't default them differently + * during libxl_domain_create. + * + * The result is that the behaviour with old callers is the same + * as in 4.13: no additional memory is allocated for shadow and + * iommu (unless the caller set shadow_memkb, eg from a call to + * libxl_get_required_shadow_memory). + */ + return !CTX->libxl_domain_need_memory_0x041200_called || + CTX->libxl_domain_need_memory_called; + /* + * Treat mixed callers as new callers. Presumably they know what + * they are doing. + */ +} + int libxl__domain_config_setdefault(libxl__gc *gc, libxl_domain_config *d_config, uint32_t domid) @@ -974,6 +1004,20 @@ int libxl__domain_config_setdefault(libxl__gc *gc, goto error_out; } =20 + if (d_config->b_info.shadow_memkb =3D=3D LIBXL_MEMKB_DEFAULT + && ok_to_default_memkb_in_create(gc)) + d_config->b_info.shadow_memkb =3D + libxl_get_required_shadow_memory(d_config->b_info.max_memkb, + d_config->b_info.max_vcpus); + + /* No IOMMU reservation is needed if passthrough mode is not 'sync_pt'= */ + if (d_config->b_info.iommu_memkb =3D=3D LIBXL_MEMKB_DEFAULT + && ok_to_default_memkb_in_create(gc)) + d_config->b_info.iommu_memkb =3D + (d_config->c_info.passthrough =3D=3D LIBXL_PASSTHROUGH_SYNC_PT) + ? libxl_get_required_iommu_memory(d_config->b_info.max_memkb) + : 0; + ret =3D libxl__domain_build_info_setdefault(gc, &d_config->b_info); if (ret) { LOGD(ERROR, domid, "Unable to set domain build info defaults"); diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 01de5576d9..0185b8ff01 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -637,6 +637,9 @@ struct libxl__ctx { LIBXL_LIST_ENTRY(libxl_ctx) sigchld_users_entry; =20 libxl_version_info version_info; + + bool libxl_domain_need_memory_0x041200_called, + libxl_domain_need_memory_called; }; =20 /* diff --git a/tools/libxl/libxl_mem.c b/tools/libxl/libxl_mem.c index 6042299393..7c01fac7e5 100644 --- a/tools/libxl/libxl_mem.c +++ b/tools/libxl/libxl_mem.c @@ -484,6 +484,8 @@ int libxl_domain_need_memory(libxl_ctx *ctx, GC_INIT(ctx); int rc; =20 + ctx->libxl_domain_need_memory_called =3D 1; + rc =3D libxl__domain_config_setdefault(gc, d_config, domid_for_logging); @@ -507,6 +509,8 @@ int libxl_domain_need_memory_0x041200(libxl_ctx *ctx, GC_INIT(ctx); int rc; =20 + ctx->libxl_domain_need_memory_0x041200_called =3D 1; + libxl_domain_build_info b_info[1]; libxl_domain_build_info_init(b_info); libxl_domain_build_info_copy(ctx, b_info, b_info_in); diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c index 03a2c54dd2..79871c22d0 100644 --- a/tools/xl/xl_parse.c +++ b/tools/xl/xl_parse.c @@ -1572,19 +1572,8 @@ void parse_config_data(const char *config_source, exit(-ERROR_FAIL); } =20 - /* libxl_get_required_shadow_memory() and - * libxl_get_required_iommu_memory() must be called after final values - * (default or specified) for vcpus and memory are set, because the - * calculations depend on those values. */ - b_info->shadow_memkb =3D !xlu_cfg_get_long(config, "shadow_memory", &l= , 0) - ? l * 1024 - : libxl_get_required_shadow_memory(b_info->max_memkb, - b_info->max_vcpus); - - /* No IOMMU reservation is needed if passthrough mode is not 'sync_pt'= */ - b_info->iommu_memkb =3D (c_info->passthrough =3D=3D LIBXL_PASSTHROUGH_= SYNC_PT) - ? libxl_get_required_iommu_memory(b_info->max_memkb) - : 0; + if (!xlu_cfg_get_long(config, "shadow_memory", &l, 0)) + b_info->shadow_memkb =3D l * 1024; =20 xlu_cfg_get_defbool(config, "nomigrate", &b_info->disable_migrate, 0); =20 --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Sun May 19 02:38:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=eu.citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1571411391; cv=none; d=zoho.com; s=zohoarc; b=ew9m6jr3xcqdgU9yl+7bwnZQURXVTWaRy4zG+4nInZvMW0EGKJaD9022ae68D6NU8Lf0i0Md7nkAuoXosWGv4gZ2jt5wNkQ85Gdqvv1W1GFCfL6RpcTfsKAqixbdHEZ39sAKoLg8mqzfXyDO/RgEH/GVwJ/5JhcVK5spoCoSchI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571411391; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KdT/k1HwOgbticiAf1KkE7A83l8LjDNZb+jI5Goul1U=; b=jGIcUQelETYZ/d1TV3Zy5uPtiPnulfBXamzuETjcyQgmbgW1zw9LDI6g9HGKyhSLQoRXYIjmTXM1KXHbLJ/mf/AGnBOp+/JBGhvNPu04WoXcM1nq+C7stFC9fyL7SBGABOLL5hnAb2weKhLENobyBqKWfYeUMON8Rx6JuqWXQPg= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1571411391635384.8049653350279; Fri, 18 Oct 2019 08:09:51 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iLTqq-0005HT-Gi; Fri, 18 Oct 2019 15:07:36 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iLTqo-0005GK-IW for xen-devel@lists.xenproject.org; Fri, 18 Oct 2019 15:07:34 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id f0687bea-f1b8-11e9-8aca-bc764e2007e4; Fri, 18 Oct 2019 15:07:02 +0000 (UTC) X-Inumbo-ID: f0687bea-f1b8-11e9-8aca-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1571411223; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=CGsCVvA9C5CHOtZ4CTQQ9jiw/fTOwqzG4idefXSC/GY=; b=cXCKAOnpsP+pE+JyzpEudOm/w00FXoadL+lk8zDquBYsVjoRzxUe0+lF zknE0lKaT3lXg0hwjQbKnUZMdoL7J/LMZfe0jgSblX7Opu+aJECDzl6wx bC0/5Erb8YGHNmwmA/Ga8SsWj1EBFF4WpfJcAwTm8/k7LeDvZKhJOOqg/ E=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=ian.jackson@eu.citrix.com; spf=Pass smtp.mailfrom=Ian.Jackson@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of ian.jackson@eu.citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="ian.jackson@eu.citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.hc3370-68.iphmx.com: domain of Ian.Jackson@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="Ian.Jackson@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: VL2Nhg9wQOxgWbo2aJnZGNlxaUcPw7AWpQgcVx5hutHshAzukQkWfSF0CW0KEMPmu5dnyQV6T0 wRUX2XfSJS2F+W3DLwoIsWMWXJt8aoBkywEqnNVInmctDXe9NAT45qiJQgBemVxW4nRg5hbWmD pfGvQjTdM/A/odg96LgpKPtNiXJ/wozRUDZmdZFOpRMD5mPkIYu1UEMtPyP8Ngfj5KLGjOVIbc zS3fnhFShHlUs4Vo03x809q6s62NyX4QcQHAGPKG8S+D8lzGZXTbkztEnoGVa4m6s0dzb/sG4G fcM= X-SBRS: 2.7 X-MesageID: 7191969 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.67,312,1566878400"; d="scan'208";a="7191969" From: Ian Jackson To: Date: Fri, 18 Oct 2019 16:06:49 +0100 Message-ID: <20191018150653.24862-7-ian.jackson@eu.citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191018150653.24862-1-ian.jackson@eu.citrix.com> References: <20191018150653.24862-1-ian.jackson@eu.citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [XEN PATCH for-4.13 v5 06/10] libxl: Remove/deprecate libxl_get_required_*_memory from the API 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: Paul Durrant , Ian Jackson , Jan Beulich , Andrew Cooper Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) These are now redundant because shadow_memkb and iommu_memkb are now defaulted automatically by libxl_domain_need_memory and libxl_domain_create etc. Callers should not now call these; instead, they should just let libxl take care of it. libxl_get_required_shadow_memory was introduced in f89f555827a6 "remove late (on-demand) construction of IOMMU page tables" We can freely remove it because it was never in any release. libxl_get_required_shadow_memory has been in libxl approximately forever. It should probably not have survived the creation of libxl_domain_create, but it seems the API awkwardnesses we see in recent commits prevented this. So we have to keep it. It remains functional but we can deprecate it. Hopefully we can get rid of it completely before we find the need to change the calculation to use additional information which its arguments do not currently supply. Signed-off-by: Ian Jackson Acked-by: Anthony PERARD --- tools/libxl/libxl_create.c | 17 ++++++++++++++++- tools/libxl/libxl_utils.c | 15 --------------- tools/libxl/libxl_utils.h | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index 3b3b6ec381..e4ddfd067f 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -892,6 +892,21 @@ static bool ok_to_default_memkb_in_create(libxl__gc *g= c) */ } =20 +static unsigned long libxl__get_required_iommu_memory(unsigned long maxmem= _kb) +{ + unsigned long iommu_pages =3D 0, mem_pages =3D maxmem_kb / 4; + unsigned int level; + + /* Assume a 4 level page table with 512 entries per level */ + for (level =3D 0; level < 4; level++) + { + mem_pages =3D DIV_ROUNDUP(mem_pages, 512); + iommu_pages +=3D mem_pages; + } + + return iommu_pages * 4; +} + int libxl__domain_config_setdefault(libxl__gc *gc, libxl_domain_config *d_config, uint32_t domid) @@ -1015,7 +1030,7 @@ int libxl__domain_config_setdefault(libxl__gc *gc, && ok_to_default_memkb_in_create(gc)) d_config->b_info.iommu_memkb =3D (d_config->c_info.passthrough =3D=3D LIBXL_PASSTHROUGH_SYNC_PT) - ? libxl_get_required_iommu_memory(d_config->b_info.max_memkb) + ? libxl__get_required_iommu_memory(d_config->b_info.max_memkb) : 0; =20 ret =3D libxl__domain_build_info_setdefault(gc, &d_config->b_info); diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c index 405733b7e1..f360f5e228 100644 --- a/tools/libxl/libxl_utils.c +++ b/tools/libxl/libxl_utils.c @@ -48,21 +48,6 @@ unsigned long libxl_get_required_shadow_memory(unsigned = long maxmem_kb, unsigned return 4 * (256 * smp_cpus + 2 * (maxmem_kb / 1024)); } =20 -unsigned long libxl_get_required_iommu_memory(unsigned long maxmem_kb) -{ - unsigned long iommu_pages =3D 0, mem_pages =3D maxmem_kb / 4; - unsigned int level; - - /* Assume a 4 level page table with 512 entries per level */ - for (level =3D 0; level < 4; level++) - { - mem_pages =3D DIV_ROUNDUP(mem_pages, 512); - iommu_pages +=3D mem_pages; - } - - return iommu_pages * 4; -} - char *libxl_domid_to_name(libxl_ctx *ctx, uint32_t domid) { unsigned int len; diff --git a/tools/libxl/libxl_utils.h b/tools/libxl/libxl_utils.h index 630ccbe28a..46918aea84 100644 --- a/tools/libxl/libxl_utils.h +++ b/tools/libxl/libxl_utils.h @@ -24,7 +24,7 @@ const char *libxl_basename(const char *name); /* returns string from strdup */ =20 unsigned long libxl_get_required_shadow_memory(unsigned long maxmem_kb, un= signed int smp_cpus); -unsigned long libxl_get_required_iommu_memory(unsigned long maxmem_kb); + /* deprecated; see LIBXL_HAVE_DOMAIN_NEED_MEMORY_CONFIG in libxl.h */ int libxl_name_to_domid(libxl_ctx *ctx, const char *name, uint32_t *domid); int libxl_domain_qualifier_to_domid(libxl_ctx *ctx, const char *name, uint= 32_t *domid); char *libxl_domid_to_name(libxl_ctx *ctx, uint32_t domid); --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Sun May 19 02:38:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=eu.citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1571411381; cv=none; d=zoho.com; s=zohoarc; b=S/01wK6fArOm7Dt9WHxfl0hu/uZAxdx/z4aC75nqwDXYclanUEEw1wu5UXN63oB3iFrvz1HzhRgWui1pEuo63SVegqdB87zO8I/AqBsrFsX36lZ6kPMr3KLhYNWJfkJZoQmdB8nykBTEqXfasE5HwXIkTWCaI4J96bIb52Cmy3I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571411381; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=siwMK1hGorR6VLhFBAWXhxXCPSU6QSYtqs8TyacYsxU=; b=NQ8L88XfW8NlcqzZsYZQ0+XUONk0jCSPs+MvkmM/YoF5sYGfS6EJtaKWjhPoQT9+xjGqO8IIPcfd/1Ifzt1CLY95ZJJoToo5byOesorTYQvlH11A2PeAftppSh7nuROuKaTI/SFwG6N/7Yz1dI7j3MrS3lq9h6/FJLhA97pvXcE= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1571411381340811.0670816023331; Fri, 18 Oct 2019 08:09:41 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iLTqf-0005AX-Qx; Fri, 18 Oct 2019 15:07:25 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iLTqe-00059w-Hl for xen-devel@lists.xenproject.org; Fri, 18 Oct 2019 15:07:24 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id efa2e394-f1b8-11e9-8aca-bc764e2007e4; Fri, 18 Oct 2019 15:07:01 +0000 (UTC) X-Inumbo-ID: efa2e394-f1b8-11e9-8aca-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1571411222; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=oQSOfhArtlO3bwUuH/V4jT2AeG2GwRZpRhSiBnBelUo=; b=Bg+sy8cqhPtJzeKHHxuUheqpmvtWobv42FFVZvNKYmN+w0+9U40drBGJ fx7ncaXEn8bd758ipLgvlSmBenbkpIUffnevyjGd7smbvzWXVX35m1f5H GMm1Rvo7nRIuONIdzoXhifmy4yGbX3EUvtzi7pqEytef5vTXrbcJ07Jov A=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=ian.jackson@eu.citrix.com; spf=Pass smtp.mailfrom=Ian.Jackson@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of ian.jackson@eu.citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="ian.jackson@eu.citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.hc3370-68.iphmx.com: domain of Ian.Jackson@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="Ian.Jackson@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: Ma4s4eOZN/gs4ow3XkD9OhGiz5FqU4lnmCXLWsQ4553FHi4H/00QD8fJkQXoZ4tsv3b6O6Tlpx bN/Z7Br20pTBvm0NKGIdBU4BEGtBc5Wq/Z57FDam36alCFgMBButwX0hIASL236AVPFkkKdrWb BTR/ig7bxYFSOinOdpE57Vl+OeLa+/g7hJIX3vKOxfTbFF11XzShtpiZdnB7i0RLoCowJcaubb QJ2piWKdycROMteZSJ/o4VFmlL261CRM+qa6eaonRHuL0s+wJqIBZwXCGj+dcgIQazSnwR/fA6 u0o= X-SBRS: 2.7 X-MesageID: 7191967 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.67,312,1566878400"; d="scan'208";a="7191967" From: Ian Jackson To: Date: Fri, 18 Oct 2019 16:06:50 +0100 Message-ID: <20191018150653.24862-8-ian.jackson@eu.citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191018150653.24862-1-ian.jackson@eu.citrix.com> References: <20191018150653.24862-1-ian.jackson@eu.citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [XEN PATCH for-4.13 v5 07/10] libxl: create: setdefault: Make libxl_physinfo info[1] 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: Paul Durrant , Ian Jackson , Jan Beulich , Andrew Cooper Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) No functional change. This will let us make it into a pointer without textual change other than to the definition. While we are here, fix some style errors (missing { }). Signed-off-by: Ian Jackson Acked-by: Wei Liu --- v2: New patch in this version of the series. --- tools/libxl/libxl_create.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index e4ddfd067f..d65df7924d 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -30,10 +30,10 @@ int libxl__domain_create_info_setdefault(libxl__gc *gc, libxl_domain_create_info *c_info) { - libxl_physinfo info; + libxl_physinfo info[1]; int rc; =20 - rc =3D libxl_get_physinfo(CTX, &info); + rc =3D libxl_get_physinfo(CTX, info); if (rc) return rc; =20 @@ -45,11 +45,11 @@ int libxl__domain_create_info_setdefault(libxl__gc *gc, libxl__arch_domain_create_info_setdefault(gc, c_info); =20 if (c_info->type !=3D LIBXL_DOMAIN_TYPE_PV) { - if (info.cap_hap) + if (info->cap_hap) { libxl_defbool_setdefault(&c_info->hap, true); - else if (info.cap_shadow) + } else if (info->cap_shadow) { libxl_defbool_setdefault(&c_info->hap, false); - else { + } else { LOG(ERROR, "neither hap nor shadow paging available"); return ERROR_INVAL; } @@ -63,12 +63,12 @@ int libxl__domain_create_info_setdefault(libxl__gc *gc, if (!c_info->ssidref) c_info->ssidref =3D SECINITSID_DOMU; =20 - if (info.cap_hvm_directio && + if (info->cap_hvm_directio && (c_info->passthrough =3D=3D LIBXL_PASSTHROUGH_UNKNOWN)) { c_info->passthrough =3D ((c_info->type =3D=3D LIBXL_DOMAIN_TYPE_PV= ) || - !info.cap_iommu_hap_pt_share) ? + !info->cap_iommu_hap_pt_share) ? LIBXL_PASSTHROUGH_SYNC_PT : LIBXL_PASSTHROUGH_SHARE_PT; - } else if (!info.cap_hvm_directio) { + } else if (!info->cap_hvm_directio) { c_info->passthrough =3D LIBXL_PASSTHROUGH_DISABLED; } =20 --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Sun May 19 02:38:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=eu.citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1571411385; cv=none; d=zoho.com; s=zohoarc; b=k7B+tYLUTDEKfT/UP/ha64eZK2Uni5glYkeP0tYOJQgCfimtttDmUVbEc1mK98aAbppKpRVL7JuejYS9ubZX+652rylLkq9ZyEQtkYehH8JXmYZw07XxZdHzqpoVAwDlulBRIp0V96Ud0VMUVy6fz1hKgTudPZmHz29Tmqca6nA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571411385; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=PjfeXqbN71lBBe3R96AtOLuTIn8RwJUASSAXPli4MDU=; b=cMRknWt4JWFREItn+sHnv+1iUJ3sv6NoBw7E/8rI/lvnkImXXCecSGOtc5sRyjkThYIasgAVM3e8Mvr38D3XGzYl/LZ7lAXZgdAdJGcPxRFvB4Ysy7uSBqFo6y/UnzRNC597xYc3YB4IHGhZLhyXnaC8JwsotRvDc/0+E3L8N/4= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1571411385220811.3538796907217; Fri, 18 Oct 2019 08:09:45 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iLTql-0005DU-5y; Fri, 18 Oct 2019 15:07:31 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iLTqj-0005CL-I8 for xen-devel@lists.xenproject.org; Fri, 18 Oct 2019 15:07:29 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id efffa6e2-f1b8-11e9-8aca-bc764e2007e4; Fri, 18 Oct 2019 15:07:01 +0000 (UTC) X-Inumbo-ID: efffa6e2-f1b8-11e9-8aca-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1571411222; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=swnojc7p8tZlUMVSFiHA8JZpgY6zZQc/i4P8oEhC9ww=; b=Q4VIekXbNoaCLi2fCb47cDv61G9VsdbJQjd66ZFJ2cWELA84waWBQHpo Wd8ZwGtvxzxKc7+Jv2mXhhwexGx1dMWhbEdo5myvvCufzoGbUbyKcOqCR chf+xAXRdp35T/TEHd+l/LijSOZYOUjvyICrDZJIjmQ4Q1Y8OWiOKeLoW 4=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=ian.jackson@eu.citrix.com; spf=Pass smtp.mailfrom=Ian.Jackson@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of ian.jackson@eu.citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="ian.jackson@eu.citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.hc3370-68.iphmx.com: domain of Ian.Jackson@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="Ian.Jackson@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: KUrhtdMS17EYfWNXQ69KT0UPl/BlfGgb+knrPHdK9UT0MKtuVCtOWOs/gajDRgUWolA7zjl1zv HFKXjHETVqTU2WUz/Zn+aib577DWcjaF99vPtx1jFYi0PAHZht8dp6K98bXzCRWfh1pa6X8O8N pdWZOU8x7C+LSptxW/jRdMzQhrPOPQeknTR0KKCMV3BU/AiAhO1xHCadVpUf8cZUUw++ELGMCz JxolZW5u9zpqtD/cPiEzo0E7zHFhbJSHhjefkrnbAtg4kCZRN/IpE38/AfhfONDHTrI0umHYA7 8bU= X-SBRS: 2.7 X-MesageID: 7191968 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.67,312,1566878400"; d="scan'208";a="7191968" From: Ian Jackson To: Date: Fri, 18 Oct 2019 16:06:51 +0100 Message-ID: <20191018150653.24862-9-ian.jackson@eu.citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191018150653.24862-1-ian.jackson@eu.citrix.com> References: <20191018150653.24862-1-ian.jackson@eu.citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [XEN PATCH for-4.13 v5 08/10] libxl: create: setdefault: Move physinfo into config_setdefault 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: Paul Durrant , Ian Jackson , Jan Beulich , Andrew Cooper Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) No functional change. This will let us refer to it in code we are about to add to this function. Signed-off-by: Ian Jackson Acked-by: Wei Liu --- v2: New patch in this version of the series. --- tools/libxl/libxl_create.c | 17 ++++++++--------- tools/libxl/libxl_dm.c | 7 ++++++- tools/libxl/libxl_internal.h | 3 ++- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index d65df7924d..0670ef90ed 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -28,15 +28,9 @@ #include =20 int libxl__domain_create_info_setdefault(libxl__gc *gc, - libxl_domain_create_info *c_info) + libxl_domain_create_info *c_info, + const libxl_physinfo *info) { - libxl_physinfo info[1]; - int rc; - - rc =3D libxl_get_physinfo(CTX, info); - if (rc) - return rc; - if (!c_info->type) { LOG(ERROR, "domain type unspecified"); return ERROR_INVAL; @@ -915,6 +909,10 @@ int libxl__domain_config_setdefault(libxl__gc *gc, int ret; bool pod_enabled =3D false; =20 + libxl_physinfo physinfo; + ret =3D libxl_get_physinfo(CTX, &physinfo); + if (ret) goto error_out; + if (d_config->c_info.ssid_label) { char *s =3D d_config->c_info.ssid_label; ret =3D libxl_flask_context_to_sid(ctx, s, strlen(s), @@ -1013,7 +1011,8 @@ int libxl__domain_config_setdefault(libxl__gc *gc, goto error_out; } =20 - ret =3D libxl__domain_create_info_setdefault(gc, &d_config->c_info); + ret =3D libxl__domain_create_info_setdefault(gc, &d_config->c_info, + &physinfo); if (ret) { LOGD(ERROR, domid, "Unable to set domain create info defaults"); goto error_out; diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index c00356a2f1..e6a48974f8 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -2167,7 +2167,12 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__st= ub_dm_spawn_state *sdss) dm_config->c_info.run_hotplug_scripts =3D guest_config->c_info.run_hotplug_scripts; =20 - ret =3D libxl__domain_create_info_setdefault(gc, &dm_config->c_info); + libxl_physinfo physinfo; + ret =3D libxl_get_physinfo(CTX, &physinfo); + if (ret) goto out; + + ret =3D libxl__domain_create_info_setdefault(gc, &dm_config->c_info, + &physinfo); if (ret) goto out; ret =3D libxl__domain_build_info_setdefault(gc, &dm_config->b_info); if (ret) goto out; diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 0185b8ff01..6a614658c2 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1447,7 +1447,8 @@ _hidden int libxl__domain_config_setdefault(libxl__gc= *gc, libxl_domain_config *d_config, uint32_t domid /* logging only= */); _hidden int libxl__domain_create_info_setdefault(libxl__gc *gc, - libxl_domain_create_info *c_info); + libxl_domain_create_info *c_info, + const libxl_physinfo *info); _hidden int libxl__domain_build_info_setdefault(libxl__gc *gc, libxl_domain_build_info *b_info); _hidden void libxl__rdm_setdefault(libxl__gc *gc, --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Sun May 19 02:38:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=eu.citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1571411369; cv=none; d=zoho.com; s=zohoarc; b=GB0usttK0M8fDC/optuOAw7Sv0wjgA/Hmn3WHewI+7nYIkjwklf8RVsFw3ZfaG5am8Uvakt74X4PAxctvz39XzL/Qr9pIOBctrdYafAV7YELQNeTEx6V0HLWwShV/9Ws3ul4ZHBMH3Xyac5pVloqX1bK0d5oKkygkKsfm3OmMKM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571411369; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FGWXKWBJPUKsV9uSBh2Sr+MFH+glngrRGwFjLABuFXw=; b=Fkz4ENd594D+nvLbWt2Yk2CLEUretsBBXTbNrVoTLNNKmP9wKxxiaV0b0rIzulqwXrL7qdCy//h9nf8HTgiYtg7j7/Y1eoMWNzoX+OmYaEmEDoS8t8M2NtXm9ro74N67VieSXPVIlhWcwXCjML1OAHmEskoQU45eyJi/ujEn9ks= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1571411369229420.49087975949124; Fri, 18 Oct 2019 08:09:29 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iLTqQ-00052G-AH; Fri, 18 Oct 2019 15:07:10 +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 1iLTqO-00051t-Nr for xen-devel@lists.xenproject.org; Fri, 18 Oct 2019 15:07:08 +0000 Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id f1142b35-f1b8-11e9-93f5-12813bfff9fa; Fri, 18 Oct 2019 15:07:03 +0000 (UTC) X-Inumbo-ID: f1142b35-f1b8-11e9-93f5-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1571411223; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=CkgMpeIsW3IyunynNO0/sGnSmpzrNnEvXVsPqh/9w6s=; b=KIYtpLblsViXPAZ4K5+G3NItDXaDWmC1lJYINrrAEHRVrBaOj/Ln4J+b zhutBLpGo7jukMza4hZJj7VNPhgaU8wIgmpFkMrN54nZMgLdOYuIDrbeF 2IHafIbbDK+Ess/n5TQJZIAOqAkDZDq/i3HfYRus4rsv+tV3EXfeJzICX I=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=ian.jackson@eu.citrix.com; spf=Pass smtp.mailfrom=Ian.Jackson@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of ian.jackson@eu.citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="ian.jackson@eu.citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa3.hc3370-68.iphmx.com: domain of Ian.Jackson@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="Ian.Jackson@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: 5N5KEc/XxAK9mXZj4jSLuzxHuJMkC0/Uid3w29gmHdBGVfZJZckDjP6qKZt6UzaplwhwW9RL8G x9nfTbRQzvSfFZ7ICEmaScXXqh0DNISSiKyysgLuuCwtO2uibdTLd7AdzLPsREMvfxbZ0Nc+70 2/eSPoF1oiWsml2m19fbK3BagELBQ/qV01+K1T7mhNF5CTDorqbotyB0PuceZV9mSYJuzN2geV +0XWjULp/fLL5NIMgTVzZ+BtvIPUA5lTmJ5Uf4gdD5IFaqRcgNOhakSZZoCQT9VXJv+8/yC4lg y40= X-SBRS: 2.7 X-MesageID: 7099412 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.67,312,1566878400"; d="scan'208";a="7099412" From: Ian Jackson To: Date: Fri, 18 Oct 2019 16:06:52 +0100 Message-ID: <20191018150653.24862-10-ian.jackson@eu.citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191018150653.24862-1-ian.jackson@eu.citrix.com> References: <20191018150653.24862-1-ian.jackson@eu.citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [XEN PATCH for-4.13 v5 09/10] libxl: Move domain_create_info_setdefault earlier 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: Paul Durrant , Ian Jackson , Jan Beulich , Andrew Cooper Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) We need this before we start to figure out the passthrough mode. I have checked that nothing in libxl__domain_create_info_setdefault nor the two implementations of ..._arch_... accesses anything else, other than (i) the domain type (which this function is responsible for setting and nothing before it looks at) (ii) c_info->ssidref (which is defaulted by flask code near the top of libxl__domain_config_setdefault and not accessed afterwards). So no functional change. Signed-off-by: Ian Jackson Acked-by: Anthony PERARD --- v3: New patch in this version of the series. --- tools/libxl/libxl_create.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index 0670ef90ed..7869d54b32 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -972,6 +972,13 @@ int libxl__domain_config_setdefault(libxl__gc *gc, goto error_out; } =20 + ret =3D libxl__domain_create_info_setdefault(gc, &d_config->c_info, + &physinfo); + if (ret) { + LOGD(ERROR, domid, "Unable to set domain create info defaults"); + goto error_out; + } + /* If target_memkb is smaller than max_memkb, the subsequent call * to libxc when building HVM domain will enable PoD mode. */ @@ -1011,13 +1018,6 @@ int libxl__domain_config_setdefault(libxl__gc *gc, goto error_out; } =20 - ret =3D libxl__domain_create_info_setdefault(gc, &d_config->c_info, - &physinfo); - if (ret) { - LOGD(ERROR, domid, "Unable to set domain create info defaults"); - goto error_out; - } - if (d_config->b_info.shadow_memkb =3D=3D LIBXL_MEMKB_DEFAULT && ok_to_default_memkb_in_create(gc)) d_config->b_info.shadow_memkb =3D --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Sun May 19 02:38:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=eu.citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1571411403; cv=none; d=zoho.com; s=zohoarc; b=XoPiMM0uD83mmKRj+Xcdj2nmg8at+yhKhx31pPRFTO3gEtfBK3GsNGcfDfhBT6HXIJkF+kYRIVNijnRNxOy5TfKt+qqcNxHgDq3y9PHGogV7Mmncs8HtiDdbRW3OBpYK0Gg4AJWTwBE1itGkkByS0meo6ncdqQDeia1NSVL1N2o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571411403; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nHqmQ0+N53Rmu6KfFChzhwnaMxaXPAFIWxgLZts7eZQ=; b=fbAwpQuYr0iHqE+zjWyhsgUMVodETOBPjFFzVlUp5iuP7L+NtqoI1Xhq4nD51kOck7q4ginp/D7wPesoWhYP6iiiUgTGjN1owUUG3XMCIeZkyBlmtqwSsWzdY2VTjm/5pysUynh+YhqCHPRhuzXPs8s/ZlwvEQlv5Yt9e66KYbk= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1571411403393172.93598174715748; Fri, 18 Oct 2019 08:10:03 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iLTqu-0005KM-QD; Fri, 18 Oct 2019 15:07:40 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iLTqt-0005JK-IY for xen-devel@lists.xenproject.org; Fri, 18 Oct 2019 15:07:39 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id f0752584-f1b8-11e9-8aca-bc764e2007e4; Fri, 18 Oct 2019 15:07:02 +0000 (UTC) X-Inumbo-ID: f0752584-f1b8-11e9-8aca-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1571411223; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=zJ505CVIc7EboI0NLvSJ4NNuvkfu18tz73mUbyNQaI8=; b=gGPyThhrINdGMaqvfqPfsCBeqF16M2jhJSNV26hA2caUEBpdwL6yzGsl nM/6LtxVKIP/zklpE9r2B20wrQdUWKjHD5/FvjL/KSMnDDLe+2dGdJTsK p8+npoR4u5qekw8NoX0XpghpYeN15s+VR+9PtSX2aofKqc74GZSkdG91m o=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=ian.jackson@eu.citrix.com; spf=Pass smtp.mailfrom=Ian.Jackson@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of ian.jackson@eu.citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="ian.jackson@eu.citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.hc3370-68.iphmx.com: domain of Ian.Jackson@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="Ian.Jackson@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: YyIe/SLmB8rcqjfPEat7MNPBJf47efN80agRPQTKzUbTglpmjnLpv3fRCEweNBR/zDF1FQGUR1 W426Fk6OSofubklFpvUDPzyS0gMWi/VwuDNaXnYzBYSAHf5qNUhjkCQ68PXq0FJeF/SWjkhcc7 PGmOSq+2koe0nupFpI/W5QtCR6Sv5y+oYYViVbgheQo+zKJJ7FfcS3qGNXtzd+2VU7y9n6gMtl i7D3yMOCt6Rg1nj9/NqcfAOlRCSOaMxO0KuJUfbsFaeNLmb9TiO4f70/NXjOH00gFpZ1dYpsJk Js4= X-SBRS: 2.7 X-MesageID: 7191970 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.67,312,1566878400"; d="scan'208";a="7191970" From: Ian Jackson To: Date: Fri, 18 Oct 2019 16:06:53 +0100 Message-ID: <20191018150653.24862-11-ian.jackson@eu.citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191018150653.24862-1-ian.jackson@eu.citrix.com> References: <20191018150653.24862-1-ian.jackson@eu.citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [XEN PATCH for-4.13 v5 10/10] libxl/xl: Overhaul passthrough setting logic 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 , Julien Grall , Andrew Cooper , Ian Jackson , Paul Durrant , Jan Beulich , Volodymyr Babchuk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) LIBXL_PASSTHROUGH_UNKNOWN (aka "ENABLED" in an earlier uncommitted version of this code) is doing double duty. We actually need all of the following to be specifiable: * "default": enable PT iff we have devices to pass through specified in the initial config file. * "enabled" (and fail if the platform doesn't support it). * "disabled" (and reject future PT hotplug). * "share_pt"/"sync_pt": enable PT and set a specific PT mode. Defaulting and error checking should be done in libxl. So, we make several changes here. We introduce "enabled", and rename "unknown" to "default". We move all of the error checking and defaulting code from xl into libxl. Now, libxl__domain_config_setdefault has all of the necessary information to get this right. So we can do it all there. Choosing the specific mode is arch-specific. We can also arrange to have only one place each which calculates (i) whether passthrough needs to be enabled because pt devices were specified (ii) whether pt_share can be used (for each arch). xl now only has to parse the enum in the same way as it parses all other enums. This change fixes a regression from earlier 4.13-pre: until recent changes, passthrough was only enabled by default if passthrough devices were specified. We restore this behaviour. Signed-off-by: Ian Jackson CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Andrew Cooper CC: Paul Durrant CC: Jan Beulich --- v5: Change "unknown" to "default". In the manpage too. v4: Fix trailing whitespace No longer change "unknown" to "unspecified". v3: Drop paragraph about masking another osstest regression, as that's now fixed. Drop redundant "ERROR:" in two log messages. Add a comment about the way "enabled" gets changed to a specific value. Split passthrough mode defaulting into arch specific functions. On ARM, always choose (and insist on) share_pt. Reject share_pt for non-HAP guests. Reject passthrough for PVH guests. Actually document "unspecified" option in xl.cfg(5) Rename "unknown" to "unspecified" v2: New patch in this version of the series. --- docs/man/xl.cfg.5.pod.in | 6 ++++ tools/libxl/libxl_arch.h | 6 ++++ tools/libxl/libxl_arm.c | 24 ++++++++++++++++ tools/libxl/libxl_create.c | 43 ++++++++++++++++++++--------- tools/libxl/libxl_types.idl | 7 +++-- tools/libxl/libxl_x86.c | 41 +++++++++++++++++++++++++++ tools/xl/xl_parse.c | 67 ++++-------------------------------------= ---- 7 files changed, 116 insertions(+), 78 deletions(-) diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in index 64bed30bce..245d3f9472 100644 --- a/docs/man/xl.cfg.5.pod.in +++ b/docs/man/xl.cfg.5.pod.in @@ -660,6 +660,12 @@ in preference. However, the availability of this optio= n is hardware specific. If B reports B containing B then this option may be used. =20 +=3Ditem B + +The default, which chooses between B and B +according to whether passthrough devices are enabled in the config +file. + =3Dback =20 =3Dback diff --git a/tools/libxl/libxl_arch.h b/tools/libxl/libxl_arch.h index d624159e53..ee6641b3e6 100644 --- a/tools/libxl/libxl_arch.h +++ b/tools/libxl/libxl_arch.h @@ -73,6 +73,12 @@ void libxl__arch_domain_build_info_setdefault(libxl__gc = *gc, libxl_domain_build_info *b_i= nfo); =20 _hidden +int libxl__arch_passthrough_mode_setdefault(libxl__gc *gc, + uint32_t domid, + libxl_domain_config *d_config, + const libxl_physinfo *physinfo= ); + +_hidden int libxl__arch_extra_memory(libxl__gc *gc, const libxl_domain_build_info *info, uint64_t *out); diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c index bf31b9b3ca..2f1ca69431 100644 --- a/tools/libxl/libxl_arm.c +++ b/tools/libxl/libxl_arm.c @@ -1191,6 +1191,30 @@ void libxl__arch_domain_build_info_setdefault(libxl_= _gc *gc, libxl_domain_build_info_init_type(b_info, LIBXL_DOMAIN_TYPE_PVH); } =20 +int libxl__arch_passthrough_mode_setdefault(libxl__gc *gc, + uint32_t domid, + libxl_domain_config *d_config, + const libxl_physinfo *physinfo) +{ + int rc; + libxl_domain_create_info *const c_info =3D &d_config->c_info; + + if (c_info->passthrough =3D=3D LIBXL_PASSTHROUGH_ENABLED) { + c_info->passthrough =3D LIBXL_PASSTHROUGH_SHARE_PT; + } + + if (c_info->passthrough =3D=3D LIBXL_PASSTHROUGH_SYNC_PT) { + LOGD(ERROR, domid, + "passthrough=3D\"sync_pt\" not supported on ARM\n"); + rc =3D ERROR_INVAL; + goto out; + } + + rc =3D 0; + out: + return rc; +} + /* * Local variables: * mode: C diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index 7869d54b32..d59ac2ab05 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -57,18 +57,6 @@ int libxl__domain_create_info_setdefault(libxl__gc *gc, if (!c_info->ssidref) c_info->ssidref =3D SECINITSID_DOMU; =20 - if (info->cap_hvm_directio && - (c_info->passthrough =3D=3D LIBXL_PASSTHROUGH_UNKNOWN)) { - c_info->passthrough =3D ((c_info->type =3D=3D LIBXL_DOMAIN_TYPE_PV= ) || - !info->cap_iommu_hap_pt_share) ? - LIBXL_PASSTHROUGH_SYNC_PT : LIBXL_PASSTHROUGH_SHARE_PT; - } else if (!info->cap_hvm_directio) { - c_info->passthrough =3D LIBXL_PASSTHROUGH_DISABLED; - } - - /* An explicit setting should now have been chosen */ - assert(c_info->passthrough !=3D LIBXL_PASSTHROUGH_UNKNOWN); - return 0; } =20 @@ -591,7 +579,7 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_conf= ig *d_config, libxl_defbool_val(info->oos) ? 0 : XEN_DOMCTL_CDF_oos_off; } =20 - assert(info->passthrough !=3D LIBXL_PASSTHROUGH_UNKNOWN); + assert(info->passthrough !=3D LIBXL_PASSTHROUGH_DEFAULT); LOG(DETAIL, "passthrough: %s", libxl_passthrough_to_string(info->passthrough)); =20 @@ -908,6 +896,7 @@ int libxl__domain_config_setdefault(libxl__gc *gc, libxl_ctx *ctx =3D libxl__gc_owner(gc); int ret; bool pod_enabled =3D false; + libxl_domain_create_info *c_info =3D &d_config->c_info; =20 libxl_physinfo physinfo; ret =3D libxl_get_physinfo(CTX, &physinfo); @@ -979,6 +968,34 @@ int libxl__domain_config_setdefault(libxl__gc *gc, goto error_out; } =20 + bool need_pt =3D d_config->num_pcidevs || d_config->num_dtdevs; + if (c_info->passthrough =3D=3D LIBXL_PASSTHROUGH_DEFAULT) { + c_info->passthrough =3D need_pt + ? LIBXL_PASSTHROUGH_ENABLED : LIBXL_PASSTHROUGH_DISABLED; + } + + bool iommu_enabled =3D physinfo.cap_hvm_directio; + if (c_info->passthrough !=3D LIBXL_PASSTHROUGH_DISABLED && !iommu_enab= led) { + LOGD(ERROR, domid, + "passthrough not supported on this platform\n"); + ret =3D ERROR_INVAL; + goto error_out; + } + + if (c_info->passthrough =3D=3D LIBXL_PASSTHROUGH_DISABLED && need_pt) { + LOGD(ERROR, domid, + "passthrough disabled but devices are specified"); + ret =3D ERROR_INVAL; + goto error_out; + } + + ret =3D libxl__arch_passthrough_mode_setdefault(gc,domid,d_config,&phy= sinfo); + if (ret) goto error_out; + + /* An explicit setting should now have been chosen */ + assert(c_info->passthrough !=3D LIBXL_PASSTHROUGH_DEFAULT); + assert(c_info->passthrough !=3D LIBXL_PASSTHROUGH_ENABLED); + /* If target_memkb is smaller than max_memkb, the subsequent call * to libxc when building HVM domain will enable PoD mode. */ diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl index 3ac9494b80..0546d7865a 100644 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -264,10 +264,11 @@ libxl_vkb_backend =3D Enumeration("vkb_backend", [ ]) =20 libxl_passthrough =3D Enumeration("passthrough", [ - (0, "unknown"), + (0, "default"), (1, "disabled"), - (2, "sync_pt"), - (3, "share_pt"), + (2, "enabled"), # becomes {sync,share}_pt once defaults are evaluated + (3, "sync_pt"), + (4, "share_pt"), ]) =20 # diff --git a/tools/libxl/libxl_x86.c b/tools/libxl/libxl_x86.c index c0f88a7eaa..8b804537ba 100644 --- a/tools/libxl/libxl_x86.c +++ b/tools/libxl/libxl_x86.c @@ -631,6 +631,47 @@ void libxl__arch_domain_build_info_setdefault(libxl__g= c *gc, libxl_defbool_setdefault(&b_info->acpi, true); } =20 +int libxl__arch_passthrough_mode_setdefault(libxl__gc *gc, + uint32_t domid, + libxl_domain_config *d_config, + const libxl_physinfo *physinfo) +{ + int rc; + libxl_domain_create_info *const c_info =3D &d_config->c_info; + + if (c_info->passthrough !=3D LIBXL_PASSTHROUGH_DISABLED && + c_info->type =3D=3D LIBXL_DOMAIN_TYPE_PVH) { + LOGD(ERROR, domid, + "passthrough not yet supported for x86 PVH guests\n"); + rc =3D ERROR_INVAL; + goto out; + } + + const char *whynot_pt_share =3D + c_info->type =3D=3D LIBXL_DOMAIN_TYPE_PV ? "not valid for PV domai= n" : + !physinfo->cap_iommu_hap_pt_share ? "not supported on this platfor= m" : + !libxl_defbool_val(d_config->c_info.hap) ?"only valid for HAP gues= ts": + NULL; + + if (c_info->passthrough =3D=3D LIBXL_PASSTHROUGH_ENABLED) { + c_info->passthrough =3D whynot_pt_share + ? LIBXL_PASSTHROUGH_SYNC_PT : LIBXL_PASSTHROUGH_SHARE_PT; + } + + if (c_info->passthrough =3D=3D LIBXL_PASSTHROUGH_SHARE_PT && whynot_pt= _share) { + LOGD(ERROR, domid, + "passthrough=3D\"share_pt\" %s\n", + whynot_pt_share); + rc =3D ERROR_INVAL; + goto out; + } + + rc =3D 0; + out: + return rc; +} + + /* * Local variables: * mode: C diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c index 79871c22d0..112f8ee026 100644 --- a/tools/xl/xl_parse.c +++ b/tools/xl/xl_parse.c @@ -1222,7 +1222,6 @@ void parse_config_data(const char *config_source, int pci_seize =3D 0; int i, e; char *kernel_basename; - bool iommu_enabled, iommu_hap_pt_share; =20 libxl_domain_create_info *c_info =3D &d_config->c_info; libxl_domain_build_info *b_info =3D &d_config->b_info; @@ -1234,8 +1233,6 @@ void parse_config_data(const char *config_source, exit(EXIT_FAILURE); } =20 - iommu_enabled =3D physinfo.cap_hvm_directio; - iommu_hap_pt_share =3D physinfo.cap_iommu_hap_pt_share; libxl_physinfo_dispose(&physinfo); =20 config=3D xlu_cfg_init(stderr, config_source); @@ -1509,67 +1506,13 @@ void parse_config_data(const char *config_source, } } =20 - if (xlu_cfg_get_string(config, "passthrough", &buf, 0)) { - c_info->passthrough =3D - (d_config->num_pcidevs || d_config->num_dtdevs) - ? LIBXL_PASSTHROUGH_UNKNOWN : LIBXL_PASSTHROUGH_DISABLED; - } else { - if (!strcasecmp("enabled", buf)) - c_info->passthrough =3D LIBXL_PASSTHROUGH_UNKNOWN; - else { - libxl_passthrough o; - - e =3D libxl_passthrough_from_string(buf, &o); - if (e || !strcasecmp("unknown", buf)) { - fprintf(stderr, - "ERROR: unknown passthrough option '%s'\n", - buf); - exit(-ERROR_FAIL); - } - - c_info->passthrough =3D o; - } - } - - switch (c_info->passthrough) { - case LIBXL_PASSTHROUGH_UNKNOWN: - /* - * Choose a suitable default. libxl would also do this but - * choosing here allows the code calculating 'iommu_memkb' - * below make an informed decision. - */ - c_info->passthrough =3D - (c_info->type =3D=3D LIBXL_DOMAIN_TYPE_PV) || !iommu_hap_pt_sh= are - ? LIBXL_PASSTHROUGH_SYNC_PT : LIBXL_PASSTHROUGH_SHARE_PT; - break; - - case LIBXL_PASSTHROUGH_DISABLED: - if (d_config->num_pcidevs || d_config->num_dtdevs) { + if (!xlu_cfg_get_string(config, "passthrough", &buf, 0)) { + if (libxl_passthrough_from_string(buf, &c_info->passthrough)) { fprintf(stderr, - "ERROR: passthrough disabled but devices are specified= \n"); - exit(-ERROR_FAIL); - } - break; - case LIBXL_PASSTHROUGH_SHARE_PT: - if (c_info->type =3D=3D LIBXL_DOMAIN_TYPE_PV) { - fprintf(stderr, - "ERROR: passthrough=3D\"share_pt\" not valid for PV do= main\n"); - exit(-ERROR_FAIL); - } else if (!iommu_hap_pt_share) { - fprintf(stderr, - "ERROR: passthrough=3D\"share_pt\" not supported on th= is platform\n"); - exit(-ERROR_FAIL); + "ERROR: unknown passthrough option '%s'\n", + buf); + exit(1); } - break; - case LIBXL_PASSTHROUGH_SYNC_PT: - break; - } - - if ((c_info->passthrough !=3D LIBXL_PASSTHROUGH_DISABLED) && - !iommu_enabled) { - fprintf(stderr, - "ERROR: passthrough not supported on this platform\n"); - exit(-ERROR_FAIL); } =20 if (!xlu_cfg_get_long(config, "shadow_memory", &l, 0)) --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel